Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace WinNamespace.HabboHotel.Wired
- {
- using System;
- using System.Data;
- using System.Threading;
- using WinNamespace;
- using WinNamespace.HabboHotel.GameClients;
- using WinNamespace.HabboHotel.Items;
- using WinNamespace.HabboHotel.Rooms;
- using WinNamespace.Messages;
- using WinNamespace.Storage;
- internal class WiredFunctions
- {
- private int Aleatorio = 0;
- public void WiredAtSetTime(GameClient Session, RoomUser User)
- {
- }
- public void WiredGameEnds(GameClient Session, RoomUser User)
- {
- }
- public void WiredGameStarts(GameClient Session, RoomUser User)
- {
- }
- public void WiredOffFurni(GameClient Session, RoomUser User)
- {
- foreach (RoomItem item in User.GetClient().GetHabbo().CurrentRoom.FloorItems.Values)
- {
- if (item.GetBaseItem().Name.ToLower() == "wf_trg_walks_off_furni")
- {
- foreach (RoomItem item2 in User.GetClient().GetHabbo().CurrentRoom.FloorItems.Values)
- {
- if ((item.GetX == item2.GetX) && (item.GetY == item2.GetY))
- {
- DatabaseClient client;
- DataTable table;
- DataTable table2;
- DataTable table3;
- DataTable table4;
- DataTable table5;
- DataTable table6;
- if (item2.GetBaseItem().Name.ToLower() == "wf_act_show_message")
- {
- using (client = WinENV.GetDatabase().GetClient())
- {
- table = client.query_read("SELECT * FROM wired_items WHERE item_id = '" + item.Id + "' LIMIT 1");
- foreach (DataRow row in table.Rows)
- {
- table2 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra2"] + "'");
- table3 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra3"] + "'");
- table4 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra4"] + "'");
- table5 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra5"] + "'");
- table6 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra6"] + "'");
- foreach (DataRow row2 in table2.Rows)
- {
- foreach (DataRow row3 in table3.Rows)
- {
- foreach (DataRow row4 in table4.Rows)
- {
- foreach (DataRow row5 in table5.Rows)
- {
- foreach (DataRow row6 in table6.Rows)
- {
- if (((((User.X == ((int) row2["x"])) && (User.Y == ((int) row2["y"]))) || ((User.X == ((int) row3["x"])) && (User.Y == ((int) row3["y"])))) || (((User.X == ((int) row4["x"])) && (User.Y == ((int) row4["y"]))) || ((User.X == ((int) row5["x"])) && (User.Y == ((int) row5["y"]))))) || ((User.X == ((int) row6["x"])) && (User.Y == ((int) row6["y"]))))
- {
- string s = client.query_string("SELECT extra2 FROM wired_items WHERE item_id = '" + item2.Id + "' LIMIT 1");
- if (s != "")
- {
- ServerMessage message = new ServerMessage();
- message.Init(0x19);
- message.AppendInt32(User.GetClient().GetHabbo().CurrentRoom.GetRoomUserByHabbo(User.GetClient().GetHabbo().Username).VirtualId);
- message.AppendStringWithBreak(s);
- message.AppendBoolean(false);
- User.GetClient().SendMessage(message);
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- if (item2.GetBaseItem().Name.ToLower() == "wf_act_teleport_to")
- {
- using (client = WinENV.GetDatabase().GetClient())
- {
- table = client.query_read("SELECT * FROM wired_items WHERE item_id = '" + item.Id + "' LIMIT 1");
- foreach (DataRow row in table.Rows)
- {
- table2 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra2"] + "'");
- table3 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra3"] + "'");
- table4 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra4"] + "'");
- table5 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra5"] + "'");
- table6 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra6"] + "'");
- foreach (DataRow row2 in table2.Rows)
- {
- foreach (DataRow row3 in table3.Rows)
- {
- foreach (DataRow row4 in table4.Rows)
- {
- foreach (DataRow row5 in table5.Rows)
- {
- foreach (DataRow row6 in table6.Rows)
- {
- DataTable table7 = client.query_read("SELECT * FROM wired_items WHERE item_id = '" + item2.Id + "' LIMIT 1");
- foreach (DataRow row7 in table7.Rows)
- {
- if (((((User.X == ((int) row2["x"])) && (User.Y == ((int) row2["y"]))) || ((User.X == ((int) row3["x"])) && (User.Y == ((int) row3["y"])))) || (((User.X == ((int) row4["x"])) && (User.Y == ((int) row4["y"]))) || ((User.X == ((int) row5["x"])) && (User.Y == ((int) row5["y"]))))) || ((User.X == ((int) row6["x"])) && (User.Y == ((int) row6["y"]))))
- {
- DataTable table8;
- if (this.Aleatorio == 0)
- {
- table8 = client.query_read("SELECT * FROM room_items WHERE id = '" + row7["extra2"] + "'");
- foreach (DataRow row8 in table8.Rows)
- {
- User.X = (int) row8["x"];
- User.Y = (int) row8["y"];
- User.UpdateNeeded = true;
- User.UpdateNeeded = true;
- User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(4);
- Thread.Sleep(0x7d0);
- User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(0);
- this.Aleatorio++;
- }
- }
- else if (this.Aleatorio == 1)
- {
- table8 = client.query_read("SELECT * FROM room_items WHERE id = '" + row7["extra3"] + "'");
- foreach (DataRow row8 in table8.Rows)
- {
- User.X = (int) row8["x"];
- User.Y = (int) row8["y"];
- User.UpdateNeeded = true;
- User.UpdateNeeded = true;
- User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(4);
- Thread.Sleep(0x7d0);
- User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(0);
- this.Aleatorio++;
- }
- }
- else if (this.Aleatorio == 2)
- {
- table8 = client.query_read("SELECT * FROM room_items WHERE id = '" + row7["extra4"] + "'");
- foreach (DataRow row8 in table8.Rows)
- {
- User.X = (int) row8["x"];
- User.Y = (int) row8["y"];
- User.UpdateNeeded = true;
- User.UpdateNeeded = true;
- User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(4);
- Thread.Sleep(0x7d0);
- User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(0);
- this.Aleatorio++;
- }
- }
- else if (this.Aleatorio == 3)
- {
- table8 = client.query_read("SELECT * FROM room_items WHERE id = '" + row7["extra5"] + "'");
- foreach (DataRow row8 in table8.Rows)
- {
- User.X = (int) row8["x"];
- User.Y = (int) row8["y"];
- User.UpdateNeeded = true;
- User.UpdateNeeded = true;
- User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(4);
- Thread.Sleep(0x7d0);
- User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(0);
- this.Aleatorio++;
- }
- }
- else
- {
- table8 = client.query_read("SELECT * FROM room_items WHERE id = '" + row7["extra6"] + "'");
- foreach (DataRow row8 in table8.Rows)
- {
- User.X = (int) row8["x"];
- User.Y = (int) row8["y"];
- User.UpdateNeeded = true;
- User.UpdateNeeded = true;
- User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(4);
- Thread.Sleep(0x7d0);
- User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(0);
- this.Aleatorio = 0;
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- public void WiredOnEnterRoom(GameClient Session, RoomUser User)
- {
- foreach (RoomItem item in Session.GetHabbo().CurrentRoom.FloorItems.Values)
- {
- foreach (RoomItem item2 in Session.GetHabbo().CurrentRoom.FloorItems.Values)
- {
- DatabaseClient client;
- if (((item2.GetBaseItem().Name == "wf_trg_enter_room") && (item.GetBaseItem().Name == "wf_act_show_message")) && ((item2.GetX == item.GetX) && (item2.GetY == item.GetY)))
- {
- using (client = WinENV.GetDatabase().GetClient())
- {
- string s = client.query_string("SELECT extra2 FROM wired_items WHERE item_id = '" + item.Id + "' LIMIT 1");
- if (s != "")
- {
- ServerMessage message = new ServerMessage();
- message.Init(0x19);
- message.AppendInt32(User.GetClient().GetHabbo().CurrentRoom.GetRoomUserByHabbo(User.GetClient().GetHabbo().Username).VirtualId);
- message.AppendStringWithBreak(s);
- message.AppendBoolean(false);
- User.GetClient().SendMessage(message);
- }
- }
- }
- if (((item2.GetBaseItem().Name == "wf_trg_enter_room") && (item.GetBaseItem().Name == "wf_act_teleport_to")) && ((item2.GetX == item.GetX) && (item2.GetY == item.GetY)))
- {
- using (client = WinENV.GetDatabase().GetClient())
- {
- DataTable table = client.query_read("SELECT * FROM wired_items WHERE item_id = '" + item.Id + "' LIMIT 1");
- foreach (DataRow row in table.Rows)
- {
- DataTable table2;
- if (this.Aleatorio == 0)
- {
- table2 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra2"] + "'");
- foreach (DataRow row2 in table2.Rows)
- {
- User.X = (int) row2["x"];
- User.Y = (int) row2["y"];
- User.UpdateNeeded = true;
- User.UpdateNeeded = true;
- User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(4);
- Thread.Sleep(0x7d0);
- User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(0);
- this.Aleatorio++;
- }
- }
- else if (this.Aleatorio == 1)
- {
- table2 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra3"] + "'");
- foreach (DataRow row2 in table2.Rows)
- {
- User.X = (int) row2["x"];
- User.Y = (int) row2["y"];
- User.UpdateNeeded = true;
- User.UpdateNeeded = true;
- User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(4);
- Thread.Sleep(0x7d0);
- User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(0);
- this.Aleatorio++;
- }
- }
- else if (this.Aleatorio == 2)
- {
- table2 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra4"] + "'");
- foreach (DataRow row2 in table2.Rows)
- {
- User.X = (int) row2["x"];
- User.Y = (int) row2["y"];
- User.UpdateNeeded = true;
- User.UpdateNeeded = true;
- User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(4);
- Thread.Sleep(0x7d0);
- User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(0);
- this.Aleatorio++;
- }
- }
- else if (this.Aleatorio == 3)
- {
- table2 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra5"] + "'");
- foreach (DataRow row2 in table2.Rows)
- {
- User.X = (int) row2["x"];
- User.Y = (int) row2["y"];
- User.UpdateNeeded = true;
- User.UpdateNeeded = true;
- User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(4);
- Thread.Sleep(0x7d0);
- User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(0);
- this.Aleatorio++;
- }
- }
- else
- {
- table2 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra6"] + "'");
- foreach (DataRow row2 in table2.Rows)
- {
- User.X = (int) row2["x"];
- User.Y = (int) row2["y"];
- User.UpdateNeeded = true;
- User.UpdateNeeded = true;
- User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(4);
- Thread.Sleep(0x7d0);
- User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(0);
- this.Aleatorio = 0;
- }
- }
- }
- }
- }
- if (((item2.GetBaseItem().Name == "wf_trg_enter_room") && (item.GetBaseItem().Name == "wf_act_toggle_state")) && ((item2.GetX == item.GetX) && (item2.GetY == item.GetY)))
- {
- using (client = WinENV.GetDatabase().GetClient())
- {
- int num = client.ReadInt32("SELECT extra2 FROM wired_items WHERE item_id = '" + item.Id + "'");
- int num2 = client.ReadInt32("SELECT extra3 FROM wired_items WHERE item_id = '" + item.Id + "'");
- int num3 = client.ReadInt32("SELECT extra4 FROM wired_items WHERE item_id = '" + item.Id + "'");
- int num4 = client.ReadInt32("SELECT extra5 FROM wired_items WHERE item_id = '" + item.Id + "'");
- int num5 = client.ReadInt32("SELECT extra6 FROM wired_items WHERE item_id = '" + item.Id + "'");
- foreach (RoomItem item3 in Session.GetHabbo().CurrentRoom.FloorItems.Values)
- {
- if (item3.Id == num)
- {
- if (item3.ExtraData == "0")
- {
- item3.ExtraData = "1";
- item3.UpdateState(false, true);
- }
- else if (item3.ExtraData == "1")
- {
- item3.ExtraData = "0";
- item3.UpdateState(false, true);
- }
- }
- if (item3.Id == num2)
- {
- if (item3.ExtraData == "0")
- {
- item3.ExtraData = "1";
- item3.UpdateState(false, true);
- }
- else if (item3.ExtraData == "1")
- {
- item3.ExtraData = "0";
- item3.UpdateState(false, true);
- }
- }
- if (item3.Id == num3)
- {
- if (item3.ExtraData == "0")
- {
- item3.ExtraData = "1";
- item3.UpdateState(false, true);
- }
- else if (item3.ExtraData == "1")
- {
- item3.ExtraData = "0";
- item3.UpdateState(false, true);
- }
- }
- if (item3.Id == num4)
- {
- if (item3.ExtraData == "0")
- {
- item3.ExtraData = "1";
- item3.UpdateState(false, true);
- }
- else if (item3.ExtraData == "1")
- {
- item3.ExtraData = "0";
- item3.UpdateState(false, true);
- }
- }
- if (item3.Id == num5)
- {
- if (item3.ExtraData == "0")
- {
- item3.ExtraData = "1";
- item3.UpdateState(false, true);
- }
- else if (item3.ExtraData == "1")
- {
- item3.ExtraData = "0";
- item3.UpdateState(false, true);
- }
- }
- }
- }
- }
- }
- }
- }
- public void WiredOnFurni(GameClient Session, RoomUser User, RoomItem Item)
- {
- foreach (RoomItem item in User.GetClient().GetHabbo().CurrentRoom.FloorItems.Values)
- {
- if (item.GetBaseItem().Name.ToLower() == "wf_trg_walks_on_furni")
- {
- foreach (RoomItem item2 in User.GetClient().GetHabbo().CurrentRoom.FloorItems.Values)
- {
- if ((item.GetX == item2.GetX) && (item.GetY == item2.GetY))
- {
- DatabaseClient client;
- DataTable table;
- DataTable table2;
- DataTable table3;
- DataTable table4;
- DataTable table5;
- DataTable table6;
- if (item2.GetBaseItem().Name.ToLower() == "wf_act_show_message")
- {
- using (client = WinENV.GetDatabase().GetClient())
- {
- table = client.query_read("SELECT * FROM wired_items WHERE item_id = '" + item.Id + "' LIMIT 1");
- foreach (DataRow row in table.Rows)
- {
- table2 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra2"] + "'");
- table3 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra3"] + "'");
- table4 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra4"] + "'");
- table5 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra5"] + "'");
- table6 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra6"] + "'");
- foreach (DataRow row2 in table2.Rows)
- {
- foreach (DataRow row3 in table3.Rows)
- {
- foreach (DataRow row4 in table4.Rows)
- {
- foreach (DataRow row5 in table5.Rows)
- {
- foreach (DataRow row6 in table6.Rows)
- {
- if (((((User.X == ((int) row2["x"])) && (User.Y == ((int) row2["y"]))) || ((User.X == ((int) row3["x"])) && (User.Y == ((int) row3["y"])))) || (((User.X == ((int) row4["x"])) && (User.Y == ((int) row4["y"]))) || ((User.X == ((int) row5["x"])) && (User.Y == ((int) row5["y"]))))) || ((User.X == ((int) row6["x"])) && (User.Y == ((int) row6["y"]))))
- {
- string s = "";
- if (client.query_assoc("SELECT extra2 FROM wired_items WHERE item_id = '" + item2.Id + "' LIMIT 1") != null)
- {
- s = client.query_string("SELECT extra2 FROM wired_items WHERE item_id = '" + item2.Id + "' LIMIT 1");
- }
- else
- {
- s = "";
- }
- if (s != "")
- {
- ServerMessage message = new ServerMessage();
- message.Init(0x19);
- message.AppendInt32(User.GetClient().GetHabbo().CurrentRoom.GetRoomUserByHabbo(User.GetClient().GetHabbo().Username).VirtualId);
- message.AppendStringWithBreak(s);
- message.AppendBoolean(false);
- User.GetClient().SendMessage(message);
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- if (item2.GetBaseItem().Name.ToLower() == "wf_act_teleport_to")
- {
- using (client = WinENV.GetDatabase().GetClient())
- {
- table = client.query_read("SELECT * FROM wired_items WHERE item_id = '" + item.Id + "' LIMIT 1");
- foreach (DataRow row in table.Rows)
- {
- table2 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra2"] + "'");
- table3 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra3"] + "'");
- table4 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra4"] + "'");
- table5 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra5"] + "'");
- table6 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra6"] + "'");
- foreach (DataRow row2 in table2.Rows)
- {
- foreach (DataRow row3 in table3.Rows)
- {
- foreach (DataRow row4 in table4.Rows)
- {
- foreach (DataRow row5 in table5.Rows)
- {
- foreach (DataRow row6 in table6.Rows)
- {
- DataTable table7 = client.query_read("SELECT * FROM wired_items WHERE item_id = '" + item2.Id + "' LIMIT 1");
- foreach (DataRow row7 in table7.Rows)
- {
- if (((((User.X == ((int) row2["x"])) && (User.Y == ((int) row2["y"]))) || ((User.X == ((int) row3["x"])) && (User.Y == ((int) row3["y"])))) || (((User.X == ((int) row4["x"])) && (User.Y == ((int) row4["y"]))) || ((User.X == ((int) row5["x"])) && (User.Y == ((int) row5["y"]))))) || ((User.X == ((int) row6["x"])) && (User.Y == ((int) row6["y"]))))
- {
- DataTable table8;
- if (this.Aleatorio == 0)
- {
- table8 = client.query_read("SELECT * FROM room_items WHERE id = '" + row7["extra2"] + "'");
- foreach (DataRow row8 in table8.Rows)
- {
- User.X = (int) row8["x"];
- User.Y = (int) row8["y"];
- User.UpdateNeeded = true;
- User.UpdateNeeded = true;
- User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(4);
- Thread.Sleep(0x7d0);
- User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(0);
- this.Aleatorio++;
- }
- }
- else if (this.Aleatorio == 1)
- {
- table8 = client.query_read("SELECT * FROM room_items WHERE id = '" + row7["extra3"] + "'");
- foreach (DataRow row8 in table8.Rows)
- {
- User.X = (int) row8["x"];
- User.Y = (int) row8["y"];
- User.UpdateNeeded = true;
- User.UpdateNeeded = true;
- User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(4);
- Thread.Sleep(0x7d0);
- User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(0);
- this.Aleatorio++;
- }
- }
- else if (this.Aleatorio == 2)
- {
- table8 = client.query_read("SELECT * FROM room_items WHERE id = '" + row7["extra4"] + "'");
- foreach (DataRow row8 in table8.Rows)
- {
- User.X = (int) row8["x"];
- User.Y = (int) row8["y"];
- User.UpdateNeeded = true;
- User.UpdateNeeded = true;
- User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(4);
- Thread.Sleep(0x7d0);
- User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(0);
- this.Aleatorio++;
- }
- }
- else if (this.Aleatorio == 3)
- {
- table8 = client.query_read("SELECT * FROM room_items WHERE id = '" + row7["extra5"] + "'");
- foreach (DataRow row8 in table8.Rows)
- {
- User.X = (int) row8["x"];
- User.Y = (int) row8["y"];
- User.UpdateNeeded = true;
- User.UpdateNeeded = true;
- User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(4);
- Thread.Sleep(0x7d0);
- User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(0);
- this.Aleatorio++;
- }
- }
- else
- {
- table8 = client.query_read("SELECT * FROM room_items WHERE id = '" + row7["extra6"] + "'");
- foreach (DataRow row8 in table8.Rows)
- {
- User.X = (int) row8["x"];
- User.Y = (int) row8["y"];
- User.UpdateNeeded = true;
- User.UpdateNeeded = true;
- User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(4);
- Thread.Sleep(0x7d0);
- User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(0);
- this.Aleatorio = 0;
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- if (item2.GetBaseItem().Name.ToLower() == "wf_act_toggle_state")
- {
- using (client = WinENV.GetDatabase().GetClient())
- {
- table = client.query_read("SELECT * FROM wired_items WHERE item_id = '" + item.Id + "' LIMIT 1");
- foreach (DataRow row in table.Rows)
- {
- table2 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra2"] + "'");
- table3 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra3"] + "'");
- table4 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra4"] + "'");
- table5 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra5"] + "'");
- table6 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra6"] + "'");
- foreach (DataRow row2 in table2.Rows)
- {
- foreach (DataRow row3 in table3.Rows)
- {
- foreach (DataRow row4 in table4.Rows)
- {
- foreach (DataRow row5 in table5.Rows)
- {
- foreach (DataRow row6 in table6.Rows)
- {
- if (((((User.X == ((int) row2["x"])) && (User.Y == ((int) row2["y"]))) || ((User.X == ((int) row3["x"])) && (User.Y == ((int) row3["y"])))) || (((User.X == ((int) row4["x"])) && (User.Y == ((int) row4["y"]))) || ((User.X == ((int) row5["x"])) && (User.Y == ((int) row5["y"]))))) || ((User.X == ((int) row6["x"])) && (User.Y == ((int) row6["y"]))))
- {
- int num = client.ReadInt32("SELECT extra2 FROM wired_items WHERE item_id = '" + item2.Id + "'");
- int num2 = client.ReadInt32("SELECT extra3 FROM wired_items WHERE item_id = '" + item2.Id + "'");
- int num3 = client.ReadInt32("SELECT extra4 FROM wired_items WHERE item_id = '" + item2.Id + "'");
- int num4 = client.ReadInt32("SELECT extra5 FROM wired_items WHERE item_id = '" + item2.Id + "'");
- int num5 = client.ReadInt32("SELECT extra6 FROM wired_items WHERE item_id = '" + item2.Id + "'");
- foreach (RoomItem item3 in Session.GetHabbo().CurrentRoom.FloorItems.Values)
- {
- if (item3.Id == num)
- {
- if (item3.ExtraData == "0")
- {
- item3.ExtraData = "1";
- item3.UpdateState(false, true);
- }
- else if (item3.ExtraData == "1")
- {
- item3.ExtraData = "0";
- item3.UpdateState(false, true);
- }
- }
- if (item3.Id == num2)
- {
- if (item3.ExtraData == "0")
- {
- item3.ExtraData = "1";
- item3.UpdateState(false, true);
- }
- else if (item3.ExtraData == "1")
- {
- item3.ExtraData = "0";
- item3.UpdateState(false, true);
- }
- }
- if (item3.Id == num3)
- {
- if (item3.ExtraData == "0")
- {
- item3.ExtraData = "1";
- item3.UpdateState(false, true);
- }
- else if (item3.ExtraData == "1")
- {
- item3.ExtraData = "0";
- item3.UpdateState(false, true);
- }
- }
- if (item3.Id == num4)
- {
- if (item3.ExtraData == "0")
- {
- item3.ExtraData = "1";
- item3.UpdateState(false, true);
- }
- else if (item3.ExtraData == "1")
- {
- item3.ExtraData = "0";
- item3.UpdateState(false, true);
- }
- }
- if (item3.Id == num5)
- {
- if (item3.ExtraData == "0")
- {
- item3.ExtraData = "1";
- item3.UpdateState(false, true);
- }
- else if (item3.ExtraData == "1")
- {
- item3.ExtraData = "0";
- item3.UpdateState(false, true);
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- public void WiredPeriodically(GameClient Session, RoomUser User)
- {
- using (DatabaseClient client = WinENV.GetDatabase().GetClient())
- {
- foreach (RoomItem item in Session.GetHabbo().CurrentRoom.FloorItems.Values)
- {
- if (item.GetBaseItem().Name.ToLower() == "wf_trg_periodically")
- {
- foreach (RoomItem item2 in Session.GetHabbo().CurrentRoom.FloorItems.Values)
- {
- if (item2.GetBaseItem().Name.ToLower() == "wf_act_toggle_state")
- {
- int num = client.ReadInt32("SELECT extra2 FROM wired_items WHERE item_id = '" + item.Id + "'");
- int num2 = client.ReadInt32("SELECT extra2 FROM wired_items WHERE item_id = '" + item2.Id + "'");
- int num3 = client.ReadInt32("SELECT extra3 FROM wired_items WHERE item_id = '" + item2.Id + "'");
- int num4 = client.ReadInt32("SELECT extra4 FROM wired_items WHERE item_id = '" + item2.Id + "'");
- int num5 = client.ReadInt32("SELECT extra5 FROM wired_items WHERE item_id = '" + item2.Id + "'");
- int num6 = client.ReadInt32("SELECT extra6 FROM wired_items WHERE item_id = '" + item2.Id + "'");
- if ((item.GetX == item2.GetX) && (item.GetY == item2.GetY))
- {
- while ((item.GetX == item2.GetX) && (item.GetY == item2.GetY))
- {
- Thread.Sleep((int) ((num / 2) * 0x3e8));
- foreach (RoomItem item3 in Session.GetHabbo().CurrentRoom.FloorItems.Values)
- {
- if (item3.Id == num2)
- {
- if (item3.ExtraData == "0")
- {
- item3.ExtraData = "1";
- item3.UpdateState(false, true);
- }
- else if (item3.ExtraData == "1")
- {
- item3.ExtraData = "0";
- item3.UpdateState(false, true);
- }
- }
- if (item3.Id == num3)
- {
- if (item3.ExtraData == "0")
- {
- item3.ExtraData = "1";
- item3.UpdateState(false, true);
- }
- else if (item3.ExtraData == "1")
- {
- item3.ExtraData = "0";
- item3.UpdateState(false, true);
- }
- }
- if (item3.Id == num4)
- {
- if (item3.ExtraData == "0")
- {
- item3.ExtraData = "1";
- item3.UpdateState(false, true);
- }
- else if (item3.ExtraData == "1")
- {
- item3.ExtraData = "0";
- item3.UpdateState(false, true);
- }
- }
- if (item3.Id == num5)
- {
- if (item3.ExtraData == "0")
- {
- item3.ExtraData = "1";
- item3.UpdateState(false, true);
- }
- else if (item3.ExtraData == "1")
- {
- item3.ExtraData = "0";
- item3.UpdateState(false, true);
- }
- }
- if (item3.Id == num6)
- {
- if (item3.ExtraData == "0")
- {
- item3.ExtraData = "1";
- item3.UpdateState(false, true);
- }
- else if (item3.ExtraData == "1")
- {
- item3.ExtraData = "0";
- item3.UpdateState(false, true);
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- public void WiredSayKeyword(GameClient Session, RoomUser User, string Message)
- {
- using (DatabaseClient client = WinENV.GetDatabase().GetClient())
- {
- foreach (RoomItem item in Session.GetHabbo().CurrentRoom.FloorItems.Values)
- {
- if (item.GetBaseItem().Name.ToLower() == "wf_trg_says_something")
- {
- string s = client.query_string("SELECT extra1 FROM wired_items WHERE item_id = '" + item.Id + "'");
- if (Message == s)
- {
- ServerMessage message = new ServerMessage();
- message.Init(0x19);
- message.AppendInt32(User.GetClient().GetHabbo().CurrentRoom.GetRoomUserByHabbo(User.GetClient().GetHabbo().Username).VirtualId);
- message.AppendStringWithBreak(s);
- message.AppendBoolean(false);
- User.GetClient().SendMessage(message);
- foreach (RoomItem item2 in Session.GetHabbo().CurrentRoom.FloorItems.Values)
- {
- if ((item.GetX == item2.GetX) && (item.GetY == item2.GetY))
- {
- if (item2.GetBaseItem().Name.ToLower() == "wf_act_show_message")
- {
- string str2 = client.query_string("SELECT extra2 FROM wired_items WHERE item_id = '" + item2.Id + "' LIMIT 1");
- if (Message != "")
- {
- ServerMessage message2 = new ServerMessage();
- message2.Init(0x19);
- message2.AppendInt32(User.GetClient().GetHabbo().CurrentRoom.GetRoomUserByHabbo(User.GetClient().GetHabbo().Username).VirtualId);
- message2.AppendStringWithBreak(str2);
- message2.AppendBoolean(false);
- User.GetClient().SendMessage(message2);
- }
- }
- if (item2.GetBaseItem().Name.ToLower() == "wf_act_teleport_to")
- {
- DataTable table = client.query_read("SELECT * FROM wired_items WHERE item_id = '" + item2.Id + "' LIMIT 1");
- foreach (DataRow row in table.Rows)
- {
- DataTable table2;
- if (this.Aleatorio == 0)
- {
- table2 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra2"] + "'");
- foreach (DataRow row2 in table2.Rows)
- {
- User.X = (int) row2["x"];
- User.Y = (int) row2["y"];
- User.UpdateNeeded = true;
- User.UpdateNeeded = true;
- User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(4);
- Thread.Sleep(0x7d0);
- User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(0);
- this.Aleatorio++;
- }
- }
- else if (this.Aleatorio == 1)
- {
- table2 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra3"] + "'");
- foreach (DataRow row2 in table2.Rows)
- {
- User.X = (int) row2["x"];
- User.Y = (int) row2["y"];
- User.UpdateNeeded = true;
- User.UpdateNeeded = true;
- User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(4);
- Thread.Sleep(0x7d0);
- User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(0);
- this.Aleatorio++;
- }
- }
- else if (this.Aleatorio == 2)
- {
- table2 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra4"] + "'");
- foreach (DataRow row2 in table2.Rows)
- {
- User.X = (int) row2["x"];
- User.Y = (int) row2["y"];
- User.UpdateNeeded = true;
- User.UpdateNeeded = true;
- User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(4);
- Thread.Sleep(0x7d0);
- User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(0);
- this.Aleatorio++;
- }
- }
- else if (this.Aleatorio == 3)
- {
- table2 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra5"] + "'");
- foreach (DataRow row2 in table2.Rows)
- {
- User.X = (int) row2["x"];
- User.Y = (int) row2["y"];
- User.UpdateNeeded = true;
- User.UpdateNeeded = true;
- User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(4);
- Thread.Sleep(0x7d0);
- User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(0);
- this.Aleatorio++;
- }
- }
- else
- {
- table2 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra6"] + "'");
- foreach (DataRow row2 in table2.Rows)
- {
- User.X = (int) row2["x"];
- User.Y = (int) row2["y"];
- User.UpdateNeeded = true;
- User.UpdateNeeded = true;
- User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(4);
- Thread.Sleep(0x7d0);
- User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(0);
- this.Aleatorio = 0;
- }
- }
- }
- }
- if (item2.GetBaseItem().Name.ToLower() == "wf_act_toggle_state")
- {
- int num = client.ReadInt32("SELECT extra2 FROM wired_items WHERE item_id = '" + item2.Id + "'");
- int num2 = client.ReadInt32("SELECT extra3 FROM wired_items WHERE item_id = '" + item2.Id + "'");
- int num3 = client.ReadInt32("SELECT extra4 FROM wired_items WHERE item_id = '" + item2.Id + "'");
- int num4 = client.ReadInt32("SELECT extra5 FROM wired_items WHERE item_id = '" + item2.Id + "'");
- int num5 = client.ReadInt32("SELECT extra6 FROM wired_items WHERE item_id = '" + item2.Id + "'");
- foreach (RoomItem item3 in Session.GetHabbo().CurrentRoom.FloorItems.Values)
- {
- if (item3.Id == num)
- {
- if (item3.ExtraData == "0")
- {
- item3.ExtraData = "1";
- item3.UpdateState(false, true);
- }
- else if (item3.ExtraData == "1")
- {
- item3.ExtraData = "0";
- item3.UpdateState(false, true);
- }
- }
- if (item3.Id == num2)
- {
- if (item3.ExtraData == "0")
- {
- item3.ExtraData = "1";
- item3.UpdateState(false, true);
- }
- else if (item3.ExtraData == "1")
- {
- item3.ExtraData = "0";
- item3.UpdateState(false, true);
- }
- }
- if (item3.Id == num3)
- {
- if (item3.ExtraData == "0")
- {
- item3.ExtraData = "1";
- item3.UpdateState(false, true);
- }
- else if (item3.ExtraData == "1")
- {
- item3.ExtraData = "0";
- item3.UpdateState(false, true);
- }
- }
- if (item3.Id == num4)
- {
- if (item3.ExtraData == "0")
- {
- item3.ExtraData = "1";
- item3.UpdateState(false, true);
- }
- else if (item3.ExtraData == "1")
- {
- item3.ExtraData = "0";
- item3.UpdateState(false, true);
- }
- }
- if (item3.Id == num5)
- {
- if (item3.ExtraData == "0")
- {
- item3.ExtraData = "1";
- item3.UpdateState(false, true);
- }
- else if (item3.ExtraData == "1")
- {
- item3.ExtraData = "0";
- item3.UpdateState(false, true);
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- public void WiredScoreAchieved(GameClient Session, RoomUser User)
- {
- }
- public void WiredStateIsChanged(GameClient Session, RoomUser User)
- {
- foreach (RoomItem item in Session.GetHabbo().CurrentRoom.FloorItems.Values)
- {
- foreach (RoomItem item2 in Session.GetHabbo().CurrentRoom.FloorItems.Values)
- {
- if (((item2.GetBaseItem().Name == "wf_trg_state_changed") && (item.GetBaseItem().Name == "wf_act_show_message")) && ((item2.GetX == item.GetX) && (item2.GetY == item.GetY)))
- {
- using (DatabaseClient client = WinENV.GetDatabase().GetClient())
- {
- int num = client.ReadInt32("SELECT extra2 FROM wired_items WHERE item_id = '" + item.Id + "'");
- int num2 = client.ReadInt32("SELECT extra3 FROM wired_items WHERE item_id = '" + item.Id + "'");
- int num3 = client.ReadInt32("SELECT extra4 FROM wired_items WHERE item_id = '" + item.Id + "'");
- int num4 = client.ReadInt32("SELECT extra5 FROM wired_items WHERE item_id = '" + item.Id + "'");
- int num5 = client.ReadInt32("SELECT extra6 FROM wired_items WHERE item_id = '" + item.Id + "'");
- foreach (RoomItem item3 in Session.GetHabbo().CurrentRoom.FloorItems.Values)
- {
- if (item3.Id == num)
- {
- string str;
- ServerMessage message;
- if (item3.ExtraData == "0")
- {
- item3.ExtraData = "1";
- item3.UpdateState(false, true);
- str = client.query_string("SELECT extra2 FROM wired_items WHERE item_id = '" + item.Id + "' LIMIT 1");
- if (str != "")
- {
- message = new ServerMessage();
- message.Init(0x19);
- message.AppendInt32(User.GetClient().GetHabbo().CurrentRoom.GetRoomUserByHabbo(User.GetClient().GetHabbo().Username).VirtualId);
- message.AppendStringWithBreak(str);
- message.AppendBoolean(false);
- User.GetClient().SendMessage(message);
- }
- }
- else if (item3.ExtraData == "1")
- {
- item3.ExtraData = "0";
- item3.UpdateState(false, true);
- str = client.query_string("SELECT extra2 FROM wired_items WHERE item_id = '" + item.Id + "' LIMIT 1");
- if (str != "")
- {
- message = new ServerMessage();
- message.Init(0x19);
- message.AppendInt32(User.GetClient().GetHabbo().CurrentRoom.GetRoomUserByHabbo(User.GetClient().GetHabbo().Username).VirtualId);
- message.AppendStringWithBreak(str);
- message.AppendBoolean(false);
- User.GetClient().SendMessage(message);
- }
- }
- }
- if (item3.Id == num2)
- {
- if (item3.ExtraData == "0")
- {
- item3.ExtraData = "1";
- item3.UpdateState(false, true);
- }
- else if (item3.ExtraData == "1")
- {
- item3.ExtraData = "0";
- item3.UpdateState(false, true);
- }
- }
- if (item3.Id == num3)
- {
- if (item3.ExtraData == "0")
- {
- item3.ExtraData = "1";
- item3.UpdateState(false, true);
- }
- else if (item3.ExtraData == "1")
- {
- item3.ExtraData = "0";
- item3.UpdateState(false, true);
- }
- }
- if (item3.Id == num4)
- {
- if (item3.ExtraData == "0")
- {
- item3.ExtraData = "1";
- item3.UpdateState(false, true);
- }
- else if (item3.ExtraData == "1")
- {
- item3.ExtraData = "0";
- item3.UpdateState(false, true);
- }
- }
- if (item3.Id == num5)
- {
- if (item3.ExtraData == "0")
- {
- item3.ExtraData = "1";
- item3.UpdateState(false, true);
- }
- else if (item3.ExtraData == "1")
- {
- item3.ExtraData = "0";
- item3.UpdateState(false, true);
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment