Guest User

Untitled

a guest
Nov 23rd, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 80.73 KB | None | 0 0
  1. namespace WinNamespace.HabboHotel.Wired
  2. {
  3.     using System;
  4.     using System.Data;
  5.     using System.Threading;
  6.     using WinNamespace;
  7.     using WinNamespace.HabboHotel.GameClients;
  8.     using WinNamespace.HabboHotel.Items;
  9.     using WinNamespace.HabboHotel.Rooms;
  10.     using WinNamespace.Messages;
  11.     using WinNamespace.Storage;
  12.  
  13.     internal class WiredFunctions
  14.     {
  15.         private int Aleatorio = 0;
  16.  
  17.         public void WiredAtSetTime(GameClient Session, RoomUser User)
  18.         {
  19.         }
  20.  
  21.         public void WiredGameEnds(GameClient Session, RoomUser User)
  22.         {
  23.         }
  24.  
  25.         public void WiredGameStarts(GameClient Session, RoomUser User)
  26.         {
  27.         }
  28.  
  29.         public void WiredOffFurni(GameClient Session, RoomUser User)
  30.         {
  31.             foreach (RoomItem item in User.GetClient().GetHabbo().CurrentRoom.FloorItems.Values)
  32.             {
  33.                 if (item.GetBaseItem().Name.ToLower() == "wf_trg_walks_off_furni")
  34.                 {
  35.                     foreach (RoomItem item2 in User.GetClient().GetHabbo().CurrentRoom.FloorItems.Values)
  36.                     {
  37.                         if ((item.GetX == item2.GetX) && (item.GetY == item2.GetY))
  38.                         {
  39.                             DatabaseClient client;
  40.                             DataTable table;
  41.                             DataTable table2;
  42.                             DataTable table3;
  43.                             DataTable table4;
  44.                             DataTable table5;
  45.                             DataTable table6;
  46.                             if (item2.GetBaseItem().Name.ToLower() == "wf_act_show_message")
  47.                             {
  48.                                 using (client = WinENV.GetDatabase().GetClient())
  49.                                 {
  50.                                     table = client.query_read("SELECT * FROM wired_items WHERE item_id = '" + item.Id + "' LIMIT 1");
  51.                                     foreach (DataRow row in table.Rows)
  52.                                     {
  53.                                         table2 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra2"] + "'");
  54.                                         table3 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra3"] + "'");
  55.                                         table4 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra4"] + "'");
  56.                                         table5 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra5"] + "'");
  57.                                         table6 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra6"] + "'");
  58.                                         foreach (DataRow row2 in table2.Rows)
  59.                                         {
  60.                                             foreach (DataRow row3 in table3.Rows)
  61.                                             {
  62.                                                 foreach (DataRow row4 in table4.Rows)
  63.                                                 {
  64.                                                     foreach (DataRow row5 in table5.Rows)
  65.                                                     {
  66.                                                         foreach (DataRow row6 in table6.Rows)
  67.                                                         {
  68.                                                             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"]))))
  69.                                                             {
  70.                                                                 string s = client.query_string("SELECT extra2 FROM wired_items WHERE item_id = '" + item2.Id + "' LIMIT 1");
  71.                                                                 if (s != "")
  72.                                                                 {
  73.                                                                     ServerMessage message = new ServerMessage();
  74.                                                                     message.Init(0x19);
  75.                                                                     message.AppendInt32(User.GetClient().GetHabbo().CurrentRoom.GetRoomUserByHabbo(User.GetClient().GetHabbo().Username).VirtualId);
  76.                                                                     message.AppendStringWithBreak(s);
  77.                                                                     message.AppendBoolean(false);
  78.                                                                     User.GetClient().SendMessage(message);
  79.                                                                 }
  80.                                                             }
  81.                                                         }
  82.                                                     }
  83.                                                 }
  84.                                             }
  85.                                         }
  86.                                     }
  87.                                 }
  88.                             }
  89.                             if (item2.GetBaseItem().Name.ToLower() == "wf_act_teleport_to")
  90.                             {
  91.                                 using (client = WinENV.GetDatabase().GetClient())
  92.                                 {
  93.                                     table = client.query_read("SELECT * FROM wired_items WHERE item_id = '" + item.Id + "' LIMIT 1");
  94.                                     foreach (DataRow row in table.Rows)
  95.                                     {
  96.                                         table2 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra2"] + "'");
  97.                                         table3 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra3"] + "'");
  98.                                         table4 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra4"] + "'");
  99.                                         table5 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra5"] + "'");
  100.                                         table6 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra6"] + "'");
  101.                                         foreach (DataRow row2 in table2.Rows)
  102.                                         {
  103.                                             foreach (DataRow row3 in table3.Rows)
  104.                                             {
  105.                                                 foreach (DataRow row4 in table4.Rows)
  106.                                                 {
  107.                                                     foreach (DataRow row5 in table5.Rows)
  108.                                                     {
  109.                                                         foreach (DataRow row6 in table6.Rows)
  110.                                                         {
  111.                                                             DataTable table7 = client.query_read("SELECT * FROM wired_items WHERE item_id = '" + item2.Id + "' LIMIT 1");
  112.                                                             foreach (DataRow row7 in table7.Rows)
  113.                                                             {
  114.                                                                 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"]))))
  115.                                                                 {
  116.                                                                     DataTable table8;
  117.                                                                     if (this.Aleatorio == 0)
  118.                                                                     {
  119.                                                                         table8 = client.query_read("SELECT * FROM room_items WHERE id = '" + row7["extra2"] + "'");
  120.                                                                         foreach (DataRow row8 in table8.Rows)
  121.                                                                         {
  122.                                                                             User.X = (int) row8["x"];
  123.                                                                             User.Y = (int) row8["y"];
  124.                                                                             User.UpdateNeeded = true;
  125.                                                                             User.UpdateNeeded = true;
  126.                                                                             User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(4);
  127.                                                                             Thread.Sleep(0x7d0);
  128.                                                                             User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(0);
  129.                                                                             this.Aleatorio++;
  130.                                                                         }
  131.                                                                     }
  132.                                                                     else if (this.Aleatorio == 1)
  133.                                                                     {
  134.                                                                         table8 = client.query_read("SELECT * FROM room_items WHERE id = '" + row7["extra3"] + "'");
  135.                                                                         foreach (DataRow row8 in table8.Rows)
  136.                                                                         {
  137.                                                                             User.X = (int) row8["x"];
  138.                                                                             User.Y = (int) row8["y"];
  139.                                                                             User.UpdateNeeded = true;
  140.                                                                             User.UpdateNeeded = true;
  141.                                                                             User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(4);
  142.                                                                             Thread.Sleep(0x7d0);
  143.                                                                             User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(0);
  144.                                                                             this.Aleatorio++;
  145.                                                                         }
  146.                                                                     }
  147.                                                                     else if (this.Aleatorio == 2)
  148.                                                                     {
  149.                                                                         table8 = client.query_read("SELECT * FROM room_items WHERE id = '" + row7["extra4"] + "'");
  150.                                                                         foreach (DataRow row8 in table8.Rows)
  151.                                                                         {
  152.                                                                             User.X = (int) row8["x"];
  153.                                                                             User.Y = (int) row8["y"];
  154.                                                                             User.UpdateNeeded = true;
  155.                                                                             User.UpdateNeeded = true;
  156.                                                                             User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(4);
  157.                                                                             Thread.Sleep(0x7d0);
  158.                                                                             User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(0);
  159.                                                                             this.Aleatorio++;
  160.                                                                         }
  161.                                                                     }
  162.                                                                     else if (this.Aleatorio == 3)
  163.                                                                     {
  164.                                                                         table8 = client.query_read("SELECT * FROM room_items WHERE id = '" + row7["extra5"] + "'");
  165.                                                                         foreach (DataRow row8 in table8.Rows)
  166.                                                                         {
  167.                                                                             User.X = (int) row8["x"];
  168.                                                                             User.Y = (int) row8["y"];
  169.                                                                             User.UpdateNeeded = true;
  170.                                                                             User.UpdateNeeded = true;
  171.                                                                             User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(4);
  172.                                                                             Thread.Sleep(0x7d0);
  173.                                                                             User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(0);
  174.                                                                             this.Aleatorio++;
  175.                                                                         }
  176.                                                                     }
  177.                                                                     else
  178.                                                                     {
  179.                                                                         table8 = client.query_read("SELECT * FROM room_items WHERE id = '" + row7["extra6"] + "'");
  180.                                                                         foreach (DataRow row8 in table8.Rows)
  181.                                                                         {
  182.                                                                             User.X = (int) row8["x"];
  183.                                                                             User.Y = (int) row8["y"];
  184.                                                                             User.UpdateNeeded = true;
  185.                                                                             User.UpdateNeeded = true;
  186.                                                                             User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(4);
  187.                                                                             Thread.Sleep(0x7d0);
  188.                                                                             User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(0);
  189.                                                                             this.Aleatorio = 0;
  190.                                                                         }
  191.                                                                     }
  192.                                                                 }
  193.                                                             }
  194.                                                         }
  195.                                                     }
  196.                                                 }
  197.                                             }
  198.                                         }
  199.                                     }
  200.                                 }
  201.                             }
  202.                         }
  203.                     }
  204.                 }
  205.             }
  206.         }
  207.  
  208.         public void WiredOnEnterRoom(GameClient Session, RoomUser User)
  209.         {
  210.             foreach (RoomItem item in Session.GetHabbo().CurrentRoom.FloorItems.Values)
  211.             {
  212.                 foreach (RoomItem item2 in Session.GetHabbo().CurrentRoom.FloorItems.Values)
  213.                 {
  214.                     DatabaseClient client;
  215.                     if (((item2.GetBaseItem().Name == "wf_trg_enter_room") && (item.GetBaseItem().Name == "wf_act_show_message")) && ((item2.GetX == item.GetX) && (item2.GetY == item.GetY)))
  216.                     {
  217.                         using (client = WinENV.GetDatabase().GetClient())
  218.                         {
  219.                             string s = client.query_string("SELECT extra2 FROM wired_items WHERE item_id = '" + item.Id + "' LIMIT 1");
  220.                             if (s != "")
  221.                             {
  222.                                 ServerMessage message = new ServerMessage();
  223.                                 message.Init(0x19);
  224.                                 message.AppendInt32(User.GetClient().GetHabbo().CurrentRoom.GetRoomUserByHabbo(User.GetClient().GetHabbo().Username).VirtualId);
  225.                                 message.AppendStringWithBreak(s);
  226.                                 message.AppendBoolean(false);
  227.                                 User.GetClient().SendMessage(message);
  228.                             }
  229.                         }
  230.                     }
  231.                     if (((item2.GetBaseItem().Name == "wf_trg_enter_room") && (item.GetBaseItem().Name == "wf_act_teleport_to")) && ((item2.GetX == item.GetX) && (item2.GetY == item.GetY)))
  232.                     {
  233.                         using (client = WinENV.GetDatabase().GetClient())
  234.                         {
  235.                             DataTable table = client.query_read("SELECT * FROM wired_items WHERE item_id = '" + item.Id + "' LIMIT 1");
  236.                             foreach (DataRow row in table.Rows)
  237.                             {
  238.                                 DataTable table2;
  239.                                 if (this.Aleatorio == 0)
  240.                                 {
  241.                                     table2 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra2"] + "'");
  242.                                     foreach (DataRow row2 in table2.Rows)
  243.                                     {
  244.                                         User.X = (int) row2["x"];
  245.                                         User.Y = (int) row2["y"];
  246.                                         User.UpdateNeeded = true;
  247.                                         User.UpdateNeeded = true;
  248.                                         User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(4);
  249.                                         Thread.Sleep(0x7d0);
  250.                                         User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(0);
  251.                                         this.Aleatorio++;
  252.                                     }
  253.                                 }
  254.                                 else if (this.Aleatorio == 1)
  255.                                 {
  256.                                     table2 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra3"] + "'");
  257.                                     foreach (DataRow row2 in table2.Rows)
  258.                                     {
  259.                                         User.X = (int) row2["x"];
  260.                                         User.Y = (int) row2["y"];
  261.                                         User.UpdateNeeded = true;
  262.                                         User.UpdateNeeded = true;
  263.                                         User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(4);
  264.                                         Thread.Sleep(0x7d0);
  265.                                         User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(0);
  266.                                         this.Aleatorio++;
  267.                                     }
  268.                                 }
  269.                                 else if (this.Aleatorio == 2)
  270.                                 {
  271.                                     table2 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra4"] + "'");
  272.                                     foreach (DataRow row2 in table2.Rows)
  273.                                     {
  274.                                         User.X = (int) row2["x"];
  275.                                         User.Y = (int) row2["y"];
  276.                                         User.UpdateNeeded = true;
  277.                                         User.UpdateNeeded = true;
  278.                                         User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(4);
  279.                                         Thread.Sleep(0x7d0);
  280.                                         User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(0);
  281.                                         this.Aleatorio++;
  282.                                     }
  283.                                 }
  284.                                 else if (this.Aleatorio == 3)
  285.                                 {
  286.                                     table2 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra5"] + "'");
  287.                                     foreach (DataRow row2 in table2.Rows)
  288.                                     {
  289.                                         User.X = (int) row2["x"];
  290.                                         User.Y = (int) row2["y"];
  291.                                         User.UpdateNeeded = true;
  292.                                         User.UpdateNeeded = true;
  293.                                         User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(4);
  294.                                         Thread.Sleep(0x7d0);
  295.                                         User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(0);
  296.                                         this.Aleatorio++;
  297.                                     }
  298.                                 }
  299.                                 else
  300.                                 {
  301.                                     table2 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra6"] + "'");
  302.                                     foreach (DataRow row2 in table2.Rows)
  303.                                     {
  304.                                         User.X = (int) row2["x"];
  305.                                         User.Y = (int) row2["y"];
  306.                                         User.UpdateNeeded = true;
  307.                                         User.UpdateNeeded = true;
  308.                                         User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(4);
  309.                                         Thread.Sleep(0x7d0);
  310.                                         User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(0);
  311.                                         this.Aleatorio = 0;
  312.                                     }
  313.                                 }
  314.                             }
  315.                         }
  316.                     }
  317.                     if (((item2.GetBaseItem().Name == "wf_trg_enter_room") && (item.GetBaseItem().Name == "wf_act_toggle_state")) && ((item2.GetX == item.GetX) && (item2.GetY == item.GetY)))
  318.                     {
  319.                         using (client = WinENV.GetDatabase().GetClient())
  320.                         {
  321.                             int num = client.ReadInt32("SELECT extra2 FROM wired_items WHERE item_id = '" + item.Id + "'");
  322.                             int num2 = client.ReadInt32("SELECT extra3 FROM wired_items WHERE item_id = '" + item.Id + "'");
  323.                             int num3 = client.ReadInt32("SELECT extra4 FROM wired_items WHERE item_id = '" + item.Id + "'");
  324.                             int num4 = client.ReadInt32("SELECT extra5 FROM wired_items WHERE item_id = '" + item.Id + "'");
  325.                             int num5 = client.ReadInt32("SELECT extra6 FROM wired_items WHERE item_id = '" + item.Id + "'");
  326.                             foreach (RoomItem item3 in Session.GetHabbo().CurrentRoom.FloorItems.Values)
  327.                             {
  328.                                 if (item3.Id == num)
  329.                                 {
  330.                                     if (item3.ExtraData == "0")
  331.                                     {
  332.                                         item3.ExtraData = "1";
  333.                                         item3.UpdateState(false, true);
  334.                                     }
  335.                                     else if (item3.ExtraData == "1")
  336.                                     {
  337.                                         item3.ExtraData = "0";
  338.                                         item3.UpdateState(false, true);
  339.                                     }
  340.                                 }
  341.                                 if (item3.Id == num2)
  342.                                 {
  343.                                     if (item3.ExtraData == "0")
  344.                                     {
  345.                                         item3.ExtraData = "1";
  346.                                         item3.UpdateState(false, true);
  347.                                     }
  348.                                     else if (item3.ExtraData == "1")
  349.                                     {
  350.                                         item3.ExtraData = "0";
  351.                                         item3.UpdateState(false, true);
  352.                                     }
  353.                                 }
  354.                                 if (item3.Id == num3)
  355.                                 {
  356.                                     if (item3.ExtraData == "0")
  357.                                     {
  358.                                         item3.ExtraData = "1";
  359.                                         item3.UpdateState(false, true);
  360.                                     }
  361.                                     else if (item3.ExtraData == "1")
  362.                                     {
  363.                                         item3.ExtraData = "0";
  364.                                         item3.UpdateState(false, true);
  365.                                     }
  366.                                 }
  367.                                 if (item3.Id == num4)
  368.                                 {
  369.                                     if (item3.ExtraData == "0")
  370.                                     {
  371.                                         item3.ExtraData = "1";
  372.                                         item3.UpdateState(false, true);
  373.                                     }
  374.                                     else if (item3.ExtraData == "1")
  375.                                     {
  376.                                         item3.ExtraData = "0";
  377.                                         item3.UpdateState(false, true);
  378.                                     }
  379.                                 }
  380.                                 if (item3.Id == num5)
  381.                                 {
  382.                                     if (item3.ExtraData == "0")
  383.                                     {
  384.                                         item3.ExtraData = "1";
  385.                                         item3.UpdateState(false, true);
  386.                                     }
  387.                                     else if (item3.ExtraData == "1")
  388.                                     {
  389.                                         item3.ExtraData = "0";
  390.                                         item3.UpdateState(false, true);
  391.                                     }
  392.                                 }
  393.                             }
  394.                         }
  395.                     }
  396.                 }
  397.             }
  398.         }
  399.  
  400.         public void WiredOnFurni(GameClient Session, RoomUser User, RoomItem Item)
  401.         {
  402.             foreach (RoomItem item in User.GetClient().GetHabbo().CurrentRoom.FloorItems.Values)
  403.             {
  404.                 if (item.GetBaseItem().Name.ToLower() == "wf_trg_walks_on_furni")
  405.                 {
  406.                     foreach (RoomItem item2 in User.GetClient().GetHabbo().CurrentRoom.FloorItems.Values)
  407.                     {
  408.                         if ((item.GetX == item2.GetX) && (item.GetY == item2.GetY))
  409.                         {
  410.                             DatabaseClient client;
  411.                             DataTable table;
  412.                             DataTable table2;
  413.                             DataTable table3;
  414.                             DataTable table4;
  415.                             DataTable table5;
  416.                             DataTable table6;
  417.                             if (item2.GetBaseItem().Name.ToLower() == "wf_act_show_message")
  418.                             {
  419.                                 using (client = WinENV.GetDatabase().GetClient())
  420.                                 {
  421.                                     table = client.query_read("SELECT * FROM wired_items WHERE item_id = '" + item.Id + "' LIMIT 1");
  422.                                     foreach (DataRow row in table.Rows)
  423.                                     {
  424.                                         table2 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra2"] + "'");
  425.                                         table3 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra3"] + "'");
  426.                                         table4 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra4"] + "'");
  427.                                         table5 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra5"] + "'");
  428.                                         table6 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra6"] + "'");
  429.                                         foreach (DataRow row2 in table2.Rows)
  430.                                         {
  431.                                             foreach (DataRow row3 in table3.Rows)
  432.                                             {
  433.                                                 foreach (DataRow row4 in table4.Rows)
  434.                                                 {
  435.                                                     foreach (DataRow row5 in table5.Rows)
  436.                                                     {
  437.                                                         foreach (DataRow row6 in table6.Rows)
  438.                                                         {
  439.                                                             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"]))))
  440.                                                             {
  441.                                                                 string s = "";
  442.                                                                 if (client.query_assoc("SELECT extra2 FROM wired_items WHERE item_id = '" + item2.Id + "' LIMIT 1") != null)
  443.                                                                 {
  444.                                                                     s = client.query_string("SELECT extra2 FROM wired_items WHERE item_id = '" + item2.Id + "' LIMIT 1");
  445.                                                                 }
  446.                                                                 else
  447.                                                                 {
  448.                                                                     s = "";
  449.                                                                 }
  450.                                                                 if (s != "")
  451.                                                                 {
  452.                                                                     ServerMessage message = new ServerMessage();
  453.                                                                     message.Init(0x19);
  454.                                                                     message.AppendInt32(User.GetClient().GetHabbo().CurrentRoom.GetRoomUserByHabbo(User.GetClient().GetHabbo().Username).VirtualId);
  455.                                                                     message.AppendStringWithBreak(s);
  456.                                                                     message.AppendBoolean(false);
  457.                                                                     User.GetClient().SendMessage(message);
  458.                                                                 }
  459.                                                             }
  460.                                                         }
  461.                                                     }
  462.                                                 }
  463.                                             }
  464.                                         }
  465.                                     }
  466.                                 }
  467.                             }
  468.                             if (item2.GetBaseItem().Name.ToLower() == "wf_act_teleport_to")
  469.                             {
  470.                                 using (client = WinENV.GetDatabase().GetClient())
  471.                                 {
  472.                                     table = client.query_read("SELECT * FROM wired_items WHERE item_id = '" + item.Id + "' LIMIT 1");
  473.                                     foreach (DataRow row in table.Rows)
  474.                                     {
  475.                                         table2 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra2"] + "'");
  476.                                         table3 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra3"] + "'");
  477.                                         table4 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra4"] + "'");
  478.                                         table5 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra5"] + "'");
  479.                                         table6 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra6"] + "'");
  480.                                         foreach (DataRow row2 in table2.Rows)
  481.                                         {
  482.                                             foreach (DataRow row3 in table3.Rows)
  483.                                             {
  484.                                                 foreach (DataRow row4 in table4.Rows)
  485.                                                 {
  486.                                                     foreach (DataRow row5 in table5.Rows)
  487.                                                     {
  488.                                                         foreach (DataRow row6 in table6.Rows)
  489.                                                         {
  490.                                                             DataTable table7 = client.query_read("SELECT * FROM wired_items WHERE item_id = '" + item2.Id + "' LIMIT 1");
  491.                                                             foreach (DataRow row7 in table7.Rows)
  492.                                                             {
  493.                                                                 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"]))))
  494.                                                                 {
  495.                                                                     DataTable table8;
  496.                                                                     if (this.Aleatorio == 0)
  497.                                                                     {
  498.                                                                         table8 = client.query_read("SELECT * FROM room_items WHERE id = '" + row7["extra2"] + "'");
  499.                                                                         foreach (DataRow row8 in table8.Rows)
  500.                                                                         {
  501.                                                                             User.X = (int) row8["x"];
  502.                                                                             User.Y = (int) row8["y"];
  503.                                                                             User.UpdateNeeded = true;
  504.                                                                             User.UpdateNeeded = true;
  505.                                                                             User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(4);
  506.                                                                             Thread.Sleep(0x7d0);
  507.                                                                             User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(0);
  508.                                                                             this.Aleatorio++;
  509.                                                                         }
  510.                                                                     }
  511.                                                                     else if (this.Aleatorio == 1)
  512.                                                                     {
  513.                                                                         table8 = client.query_read("SELECT * FROM room_items WHERE id = '" + row7["extra3"] + "'");
  514.                                                                         foreach (DataRow row8 in table8.Rows)
  515.                                                                         {
  516.                                                                             User.X = (int) row8["x"];
  517.                                                                             User.Y = (int) row8["y"];
  518.                                                                             User.UpdateNeeded = true;
  519.                                                                             User.UpdateNeeded = true;
  520.                                                                             User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(4);
  521.                                                                             Thread.Sleep(0x7d0);
  522.                                                                             User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(0);
  523.                                                                             this.Aleatorio++;
  524.                                                                         }
  525.                                                                     }
  526.                                                                     else if (this.Aleatorio == 2)
  527.                                                                     {
  528.                                                                         table8 = client.query_read("SELECT * FROM room_items WHERE id = '" + row7["extra4"] + "'");
  529.                                                                         foreach (DataRow row8 in table8.Rows)
  530.                                                                         {
  531.                                                                             User.X = (int) row8["x"];
  532.                                                                             User.Y = (int) row8["y"];
  533.                                                                             User.UpdateNeeded = true;
  534.                                                                             User.UpdateNeeded = true;
  535.                                                                             User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(4);
  536.                                                                             Thread.Sleep(0x7d0);
  537.                                                                             User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(0);
  538.                                                                             this.Aleatorio++;
  539.                                                                         }
  540.                                                                     }
  541.                                                                     else if (this.Aleatorio == 3)
  542.                                                                     {
  543.                                                                         table8 = client.query_read("SELECT * FROM room_items WHERE id = '" + row7["extra5"] + "'");
  544.                                                                         foreach (DataRow row8 in table8.Rows)
  545.                                                                         {
  546.                                                                             User.X = (int) row8["x"];
  547.                                                                             User.Y = (int) row8["y"];
  548.                                                                             User.UpdateNeeded = true;
  549.                                                                             User.UpdateNeeded = true;
  550.                                                                             User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(4);
  551.                                                                             Thread.Sleep(0x7d0);
  552.                                                                             User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(0);
  553.                                                                             this.Aleatorio++;
  554.                                                                         }
  555.                                                                     }
  556.                                                                     else
  557.                                                                     {
  558.                                                                         table8 = client.query_read("SELECT * FROM room_items WHERE id = '" + row7["extra6"] + "'");
  559.                                                                         foreach (DataRow row8 in table8.Rows)
  560.                                                                         {
  561.                                                                             User.X = (int) row8["x"];
  562.                                                                             User.Y = (int) row8["y"];
  563.                                                                             User.UpdateNeeded = true;
  564.                                                                             User.UpdateNeeded = true;
  565.                                                                             User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(4);
  566.                                                                             Thread.Sleep(0x7d0);
  567.                                                                             User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(0);
  568.                                                                             this.Aleatorio = 0;
  569.                                                                         }
  570.                                                                     }
  571.                                                                 }
  572.                                                             }
  573.                                                         }
  574.                                                     }
  575.                                                 }
  576.                                             }
  577.                                         }
  578.                                     }
  579.                                 }
  580.                             }
  581.                             if (item2.GetBaseItem().Name.ToLower() == "wf_act_toggle_state")
  582.                             {
  583.                                 using (client = WinENV.GetDatabase().GetClient())
  584.                                 {
  585.                                     table = client.query_read("SELECT * FROM wired_items WHERE item_id = '" + item.Id + "' LIMIT 1");
  586.                                     foreach (DataRow row in table.Rows)
  587.                                     {
  588.                                         table2 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra2"] + "'");
  589.                                         table3 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra3"] + "'");
  590.                                         table4 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra4"] + "'");
  591.                                         table5 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra5"] + "'");
  592.                                         table6 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra6"] + "'");
  593.                                         foreach (DataRow row2 in table2.Rows)
  594.                                         {
  595.                                             foreach (DataRow row3 in table3.Rows)
  596.                                             {
  597.                                                 foreach (DataRow row4 in table4.Rows)
  598.                                                 {
  599.                                                     foreach (DataRow row5 in table5.Rows)
  600.                                                     {
  601.                                                         foreach (DataRow row6 in table6.Rows)
  602.                                                         {
  603.                                                             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"]))))
  604.                                                             {
  605.                                                                 int num = client.ReadInt32("SELECT extra2 FROM wired_items WHERE item_id = '" + item2.Id + "'");
  606.                                                                 int num2 = client.ReadInt32("SELECT extra3 FROM wired_items WHERE item_id = '" + item2.Id + "'");
  607.                                                                 int num3 = client.ReadInt32("SELECT extra4 FROM wired_items WHERE item_id = '" + item2.Id + "'");
  608.                                                                 int num4 = client.ReadInt32("SELECT extra5 FROM wired_items WHERE item_id = '" + item2.Id + "'");
  609.                                                                 int num5 = client.ReadInt32("SELECT extra6 FROM wired_items WHERE item_id = '" + item2.Id + "'");
  610.                                                                 foreach (RoomItem item3 in Session.GetHabbo().CurrentRoom.FloorItems.Values)
  611.                                                                 {
  612.                                                                     if (item3.Id == num)
  613.                                                                     {
  614.                                                                         if (item3.ExtraData == "0")
  615.                                                                         {
  616.                                                                             item3.ExtraData = "1";
  617.                                                                             item3.UpdateState(false, true);
  618.                                                                         }
  619.                                                                         else if (item3.ExtraData == "1")
  620.                                                                         {
  621.                                                                             item3.ExtraData = "0";
  622.                                                                             item3.UpdateState(false, true);
  623.                                                                         }
  624.                                                                     }
  625.                                                                     if (item3.Id == num2)
  626.                                                                     {
  627.                                                                         if (item3.ExtraData == "0")
  628.                                                                         {
  629.                                                                             item3.ExtraData = "1";
  630.                                                                             item3.UpdateState(false, true);
  631.                                                                         }
  632.                                                                         else if (item3.ExtraData == "1")
  633.                                                                         {
  634.                                                                             item3.ExtraData = "0";
  635.                                                                             item3.UpdateState(false, true);
  636.                                                                         }
  637.                                                                     }
  638.                                                                     if (item3.Id == num3)
  639.                                                                     {
  640.                                                                         if (item3.ExtraData == "0")
  641.                                                                         {
  642.                                                                             item3.ExtraData = "1";
  643.                                                                             item3.UpdateState(false, true);
  644.                                                                         }
  645.                                                                         else if (item3.ExtraData == "1")
  646.                                                                         {
  647.                                                                             item3.ExtraData = "0";
  648.                                                                             item3.UpdateState(false, true);
  649.                                                                         }
  650.                                                                     }
  651.                                                                     if (item3.Id == num4)
  652.                                                                     {
  653.                                                                         if (item3.ExtraData == "0")
  654.                                                                         {
  655.                                                                             item3.ExtraData = "1";
  656.                                                                             item3.UpdateState(false, true);
  657.                                                                         }
  658.                                                                         else if (item3.ExtraData == "1")
  659.                                                                         {
  660.                                                                             item3.ExtraData = "0";
  661.                                                                             item3.UpdateState(false, true);
  662.                                                                         }
  663.                                                                     }
  664.                                                                     if (item3.Id == num5)
  665.                                                                     {
  666.                                                                         if (item3.ExtraData == "0")
  667.                                                                         {
  668.                                                                             item3.ExtraData = "1";
  669.                                                                             item3.UpdateState(false, true);
  670.                                                                         }
  671.                                                                         else if (item3.ExtraData == "1")
  672.                                                                         {
  673.                                                                             item3.ExtraData = "0";
  674.                                                                             item3.UpdateState(false, true);
  675.                                                                         }
  676.                                                                     }
  677.                                                                 }
  678.                                                             }
  679.                                                         }
  680.                                                     }
  681.                                                 }
  682.                                             }
  683.                                         }
  684.                                     }
  685.                                 }
  686.                             }
  687.                         }
  688.                     }
  689.                 }
  690.             }
  691.         }
  692.  
  693.         public void WiredPeriodically(GameClient Session, RoomUser User)
  694.         {
  695.             using (DatabaseClient client = WinENV.GetDatabase().GetClient())
  696.             {
  697.                 foreach (RoomItem item in Session.GetHabbo().CurrentRoom.FloorItems.Values)
  698.                 {
  699.                     if (item.GetBaseItem().Name.ToLower() == "wf_trg_periodically")
  700.                     {
  701.                         foreach (RoomItem item2 in Session.GetHabbo().CurrentRoom.FloorItems.Values)
  702.                         {
  703.                             if (item2.GetBaseItem().Name.ToLower() == "wf_act_toggle_state")
  704.                             {
  705.                                 int num = client.ReadInt32("SELECT extra2 FROM wired_items WHERE item_id = '" + item.Id + "'");
  706.                                 int num2 = client.ReadInt32("SELECT extra2 FROM wired_items WHERE item_id = '" + item2.Id + "'");
  707.                                 int num3 = client.ReadInt32("SELECT extra3 FROM wired_items WHERE item_id = '" + item2.Id + "'");
  708.                                 int num4 = client.ReadInt32("SELECT extra4 FROM wired_items WHERE item_id = '" + item2.Id + "'");
  709.                                 int num5 = client.ReadInt32("SELECT extra5 FROM wired_items WHERE item_id = '" + item2.Id + "'");
  710.                                 int num6 = client.ReadInt32("SELECT extra6 FROM wired_items WHERE item_id = '" + item2.Id + "'");
  711.                                 if ((item.GetX == item2.GetX) && (item.GetY == item2.GetY))
  712.                                 {
  713.                                     while ((item.GetX == item2.GetX) && (item.GetY == item2.GetY))
  714.                                     {
  715.                                         Thread.Sleep((int) ((num / 2) * 0x3e8));
  716.                                         foreach (RoomItem item3 in Session.GetHabbo().CurrentRoom.FloorItems.Values)
  717.                                         {
  718.                                             if (item3.Id == num2)
  719.                                             {
  720.                                                 if (item3.ExtraData == "0")
  721.                                                 {
  722.                                                     item3.ExtraData = "1";
  723.                                                     item3.UpdateState(false, true);
  724.                                                 }
  725.                                                 else if (item3.ExtraData == "1")
  726.                                                 {
  727.                                                     item3.ExtraData = "0";
  728.                                                     item3.UpdateState(false, true);
  729.                                                 }
  730.                                             }
  731.                                             if (item3.Id == num3)
  732.                                             {
  733.                                                 if (item3.ExtraData == "0")
  734.                                                 {
  735.                                                     item3.ExtraData = "1";
  736.                                                     item3.UpdateState(false, true);
  737.                                                 }
  738.                                                 else if (item3.ExtraData == "1")
  739.                                                 {
  740.                                                     item3.ExtraData = "0";
  741.                                                     item3.UpdateState(false, true);
  742.                                                 }
  743.                                             }
  744.                                             if (item3.Id == num4)
  745.                                             {
  746.                                                 if (item3.ExtraData == "0")
  747.                                                 {
  748.                                                     item3.ExtraData = "1";
  749.                                                     item3.UpdateState(false, true);
  750.                                                 }
  751.                                                 else if (item3.ExtraData == "1")
  752.                                                 {
  753.                                                     item3.ExtraData = "0";
  754.                                                     item3.UpdateState(false, true);
  755.                                                 }
  756.                                             }
  757.                                             if (item3.Id == num5)
  758.                                             {
  759.                                                 if (item3.ExtraData == "0")
  760.                                                 {
  761.                                                     item3.ExtraData = "1";
  762.                                                     item3.UpdateState(false, true);
  763.                                                 }
  764.                                                 else if (item3.ExtraData == "1")
  765.                                                 {
  766.                                                     item3.ExtraData = "0";
  767.                                                     item3.UpdateState(false, true);
  768.                                                 }
  769.                                             }
  770.                                             if (item3.Id == num6)
  771.                                             {
  772.                                                 if (item3.ExtraData == "0")
  773.                                                 {
  774.                                                     item3.ExtraData = "1";
  775.                                                     item3.UpdateState(false, true);
  776.                                                 }
  777.                                                 else if (item3.ExtraData == "1")
  778.                                                 {
  779.                                                     item3.ExtraData = "0";
  780.                                                     item3.UpdateState(false, true);
  781.                                                 }
  782.                                             }
  783.                                         }
  784.                                     }
  785.                                 }
  786.                             }
  787.                         }
  788.                     }
  789.                 }
  790.             }
  791.         }
  792.  
  793.         public void WiredSayKeyword(GameClient Session, RoomUser User, string Message)
  794.         {
  795.             using (DatabaseClient client = WinENV.GetDatabase().GetClient())
  796.             {
  797.                 foreach (RoomItem item in Session.GetHabbo().CurrentRoom.FloorItems.Values)
  798.                 {
  799.                     if (item.GetBaseItem().Name.ToLower() == "wf_trg_says_something")
  800.                     {
  801.                         string s = client.query_string("SELECT extra1 FROM wired_items WHERE item_id = '" + item.Id + "'");
  802.                         if (Message == s)
  803.                         {
  804.                             ServerMessage message = new ServerMessage();
  805.                             message.Init(0x19);
  806.                             message.AppendInt32(User.GetClient().GetHabbo().CurrentRoom.GetRoomUserByHabbo(User.GetClient().GetHabbo().Username).VirtualId);
  807.                             message.AppendStringWithBreak(s);
  808.                             message.AppendBoolean(false);
  809.                             User.GetClient().SendMessage(message);
  810.                             foreach (RoomItem item2 in Session.GetHabbo().CurrentRoom.FloorItems.Values)
  811.                             {
  812.                                 if ((item.GetX == item2.GetX) && (item.GetY == item2.GetY))
  813.                                 {
  814.                                     if (item2.GetBaseItem().Name.ToLower() == "wf_act_show_message")
  815.                                     {
  816.                                         string str2 = client.query_string("SELECT extra2 FROM wired_items WHERE item_id = '" + item2.Id + "' LIMIT 1");
  817.                                         if (Message != "")
  818.                                         {
  819.                                             ServerMessage message2 = new ServerMessage();
  820.                                             message2.Init(0x19);
  821.                                             message2.AppendInt32(User.GetClient().GetHabbo().CurrentRoom.GetRoomUserByHabbo(User.GetClient().GetHabbo().Username).VirtualId);
  822.                                             message2.AppendStringWithBreak(str2);
  823.                                             message2.AppendBoolean(false);
  824.                                             User.GetClient().SendMessage(message2);
  825.                                         }
  826.                                     }
  827.                                     if (item2.GetBaseItem().Name.ToLower() == "wf_act_teleport_to")
  828.                                     {
  829.                                         DataTable table = client.query_read("SELECT * FROM wired_items WHERE item_id = '" + item2.Id + "' LIMIT 1");
  830.                                         foreach (DataRow row in table.Rows)
  831.                                         {
  832.                                             DataTable table2;
  833.                                             if (this.Aleatorio == 0)
  834.                                             {
  835.                                                 table2 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra2"] + "'");
  836.                                                 foreach (DataRow row2 in table2.Rows)
  837.                                                 {
  838.                                                     User.X = (int) row2["x"];
  839.                                                     User.Y = (int) row2["y"];
  840.                                                     User.UpdateNeeded = true;
  841.                                                     User.UpdateNeeded = true;
  842.                                                     User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(4);
  843.                                                     Thread.Sleep(0x7d0);
  844.                                                     User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(0);
  845.                                                     this.Aleatorio++;
  846.                                                 }
  847.                                             }
  848.                                             else if (this.Aleatorio == 1)
  849.                                             {
  850.                                                 table2 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra3"] + "'");
  851.                                                 foreach (DataRow row2 in table2.Rows)
  852.                                                 {
  853.                                                     User.X = (int) row2["x"];
  854.                                                     User.Y = (int) row2["y"];
  855.                                                     User.UpdateNeeded = true;
  856.                                                     User.UpdateNeeded = true;
  857.                                                     User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(4);
  858.                                                     Thread.Sleep(0x7d0);
  859.                                                     User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(0);
  860.                                                     this.Aleatorio++;
  861.                                                 }
  862.                                             }
  863.                                             else if (this.Aleatorio == 2)
  864.                                             {
  865.                                                 table2 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra4"] + "'");
  866.                                                 foreach (DataRow row2 in table2.Rows)
  867.                                                 {
  868.                                                     User.X = (int) row2["x"];
  869.                                                     User.Y = (int) row2["y"];
  870.                                                     User.UpdateNeeded = true;
  871.                                                     User.UpdateNeeded = true;
  872.                                                     User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(4);
  873.                                                     Thread.Sleep(0x7d0);
  874.                                                     User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(0);
  875.                                                     this.Aleatorio++;
  876.                                                 }
  877.                                             }
  878.                                             else if (this.Aleatorio == 3)
  879.                                             {
  880.                                                 table2 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra5"] + "'");
  881.                                                 foreach (DataRow row2 in table2.Rows)
  882.                                                 {
  883.                                                     User.X = (int) row2["x"];
  884.                                                     User.Y = (int) row2["y"];
  885.                                                     User.UpdateNeeded = true;
  886.                                                     User.UpdateNeeded = true;
  887.                                                     User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(4);
  888.                                                     Thread.Sleep(0x7d0);
  889.                                                     User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(0);
  890.                                                     this.Aleatorio++;
  891.                                                 }
  892.                                             }
  893.                                             else
  894.                                             {
  895.                                                 table2 = client.query_read("SELECT * FROM room_items WHERE id = '" + row["extra6"] + "'");
  896.                                                 foreach (DataRow row2 in table2.Rows)
  897.                                                 {
  898.                                                     User.X = (int) row2["x"];
  899.                                                     User.Y = (int) row2["y"];
  900.                                                     User.UpdateNeeded = true;
  901.                                                     User.UpdateNeeded = true;
  902.                                                     User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(4);
  903.                                                     Thread.Sleep(0x7d0);
  904.                                                     User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ShowEffect(0);
  905.                                                     this.Aleatorio = 0;
  906.                                                 }
  907.                                             }
  908.                                         }
  909.                                     }
  910.                                     if (item2.GetBaseItem().Name.ToLower() == "wf_act_toggle_state")
  911.                                     {
  912.                                         int num = client.ReadInt32("SELECT extra2 FROM wired_items WHERE item_id = '" + item2.Id + "'");
  913.                                         int num2 = client.ReadInt32("SELECT extra3 FROM wired_items WHERE item_id = '" + item2.Id + "'");
  914.                                         int num3 = client.ReadInt32("SELECT extra4 FROM wired_items WHERE item_id = '" + item2.Id + "'");
  915.                                         int num4 = client.ReadInt32("SELECT extra5 FROM wired_items WHERE item_id = '" + item2.Id + "'");
  916.                                         int num5 = client.ReadInt32("SELECT extra6 FROM wired_items WHERE item_id = '" + item2.Id + "'");
  917.                                         foreach (RoomItem item3 in Session.GetHabbo().CurrentRoom.FloorItems.Values)
  918.                                         {
  919.                                             if (item3.Id == num)
  920.                                             {
  921.                                                 if (item3.ExtraData == "0")
  922.                                                 {
  923.                                                     item3.ExtraData = "1";
  924.                                                     item3.UpdateState(false, true);
  925.                                                 }
  926.                                                 else if (item3.ExtraData == "1")
  927.                                                 {
  928.                                                     item3.ExtraData = "0";
  929.                                                     item3.UpdateState(false, true);
  930.                                                 }
  931.                                             }
  932.                                             if (item3.Id == num2)
  933.                                             {
  934.                                                 if (item3.ExtraData == "0")
  935.                                                 {
  936.                                                     item3.ExtraData = "1";
  937.                                                     item3.UpdateState(false, true);
  938.                                                 }
  939.                                                 else if (item3.ExtraData == "1")
  940.                                                 {
  941.                                                     item3.ExtraData = "0";
  942.                                                     item3.UpdateState(false, true);
  943.                                                 }
  944.                                             }
  945.                                             if (item3.Id == num3)
  946.                                             {
  947.                                                 if (item3.ExtraData == "0")
  948.                                                 {
  949.                                                     item3.ExtraData = "1";
  950.                                                     item3.UpdateState(false, true);
  951.                                                 }
  952.                                                 else if (item3.ExtraData == "1")
  953.                                                 {
  954.                                                     item3.ExtraData = "0";
  955.                                                     item3.UpdateState(false, true);
  956.                                                 }
  957.                                             }
  958.                                             if (item3.Id == num4)
  959.                                             {
  960.                                                 if (item3.ExtraData == "0")
  961.                                                 {
  962.                                                     item3.ExtraData = "1";
  963.                                                     item3.UpdateState(false, true);
  964.                                                 }
  965.                                                 else if (item3.ExtraData == "1")
  966.                                                 {
  967.                                                     item3.ExtraData = "0";
  968.                                                     item3.UpdateState(false, true);
  969.                                                 }
  970.                                             }
  971.                                             if (item3.Id == num5)
  972.                                             {
  973.                                                 if (item3.ExtraData == "0")
  974.                                                 {
  975.                                                     item3.ExtraData = "1";
  976.                                                     item3.UpdateState(false, true);
  977.                                                 }
  978.                                                 else if (item3.ExtraData == "1")
  979.                                                 {
  980.                                                     item3.ExtraData = "0";
  981.                                                     item3.UpdateState(false, true);
  982.                                                 }
  983.                                             }
  984.                                         }
  985.                                     }
  986.                                 }
  987.                             }
  988.                         }
  989.                     }
  990.                 }
  991.             }
  992.         }
  993.  
  994.         public void WiredScoreAchieved(GameClient Session, RoomUser User)
  995.         {
  996.         }
  997.  
  998.         public void WiredStateIsChanged(GameClient Session, RoomUser User)
  999.         {
  1000.             foreach (RoomItem item in Session.GetHabbo().CurrentRoom.FloorItems.Values)
  1001.             {
  1002.                 foreach (RoomItem item2 in Session.GetHabbo().CurrentRoom.FloorItems.Values)
  1003.                 {
  1004.                     if (((item2.GetBaseItem().Name == "wf_trg_state_changed") && (item.GetBaseItem().Name == "wf_act_show_message")) && ((item2.GetX == item.GetX) && (item2.GetY == item.GetY)))
  1005.                     {
  1006.                         using (DatabaseClient client = WinENV.GetDatabase().GetClient())
  1007.                         {
  1008.                             int num = client.ReadInt32("SELECT extra2 FROM wired_items WHERE item_id = '" + item.Id + "'");
  1009.                             int num2 = client.ReadInt32("SELECT extra3 FROM wired_items WHERE item_id = '" + item.Id + "'");
  1010.                             int num3 = client.ReadInt32("SELECT extra4 FROM wired_items WHERE item_id = '" + item.Id + "'");
  1011.                             int num4 = client.ReadInt32("SELECT extra5 FROM wired_items WHERE item_id = '" + item.Id + "'");
  1012.                             int num5 = client.ReadInt32("SELECT extra6 FROM wired_items WHERE item_id = '" + item.Id + "'");
  1013.                             foreach (RoomItem item3 in Session.GetHabbo().CurrentRoom.FloorItems.Values)
  1014.                             {
  1015.                                 if (item3.Id == num)
  1016.                                 {
  1017.                                     string str;
  1018.                                     ServerMessage message;
  1019.                                     if (item3.ExtraData == "0")
  1020.                                     {
  1021.                                         item3.ExtraData = "1";
  1022.                                         item3.UpdateState(false, true);
  1023.                                         str = client.query_string("SELECT extra2 FROM wired_items WHERE item_id = '" + item.Id + "' LIMIT 1");
  1024.                                         if (str != "")
  1025.                                         {
  1026.                                             message = new ServerMessage();
  1027.                                             message.Init(0x19);
  1028.                                             message.AppendInt32(User.GetClient().GetHabbo().CurrentRoom.GetRoomUserByHabbo(User.GetClient().GetHabbo().Username).VirtualId);
  1029.                                             message.AppendStringWithBreak(str);
  1030.                                             message.AppendBoolean(false);
  1031.                                             User.GetClient().SendMessage(message);
  1032.                                         }
  1033.                                     }
  1034.                                     else if (item3.ExtraData == "1")
  1035.                                     {
  1036.                                         item3.ExtraData = "0";
  1037.                                         item3.UpdateState(false, true);
  1038.                                         str = client.query_string("SELECT extra2 FROM wired_items WHERE item_id = '" + item.Id + "' LIMIT 1");
  1039.                                         if (str != "")
  1040.                                         {
  1041.                                             message = new ServerMessage();
  1042.                                             message.Init(0x19);
  1043.                                             message.AppendInt32(User.GetClient().GetHabbo().CurrentRoom.GetRoomUserByHabbo(User.GetClient().GetHabbo().Username).VirtualId);
  1044.                                             message.AppendStringWithBreak(str);
  1045.                                             message.AppendBoolean(false);
  1046.                                             User.GetClient().SendMessage(message);
  1047.                                         }
  1048.                                     }
  1049.                                 }
  1050.                                 if (item3.Id == num2)
  1051.                                 {
  1052.                                     if (item3.ExtraData == "0")
  1053.                                     {
  1054.                                         item3.ExtraData = "1";
  1055.                                         item3.UpdateState(false, true);
  1056.                                     }
  1057.                                     else if (item3.ExtraData == "1")
  1058.                                     {
  1059.                                         item3.ExtraData = "0";
  1060.                                         item3.UpdateState(false, true);
  1061.                                     }
  1062.                                 }
  1063.                                 if (item3.Id == num3)
  1064.                                 {
  1065.                                     if (item3.ExtraData == "0")
  1066.                                     {
  1067.                                         item3.ExtraData = "1";
  1068.                                         item3.UpdateState(false, true);
  1069.                                     }
  1070.                                     else if (item3.ExtraData == "1")
  1071.                                     {
  1072.                                         item3.ExtraData = "0";
  1073.                                         item3.UpdateState(false, true);
  1074.                                     }
  1075.                                 }
  1076.                                 if (item3.Id == num4)
  1077.                                 {
  1078.                                     if (item3.ExtraData == "0")
  1079.                                     {
  1080.                                         item3.ExtraData = "1";
  1081.                                         item3.UpdateState(false, true);
  1082.                                     }
  1083.                                     else if (item3.ExtraData == "1")
  1084.                                     {
  1085.                                         item3.ExtraData = "0";
  1086.                                         item3.UpdateState(false, true);
  1087.                                     }
  1088.                                 }
  1089.                                 if (item3.Id == num5)
  1090.                                 {
  1091.                                     if (item3.ExtraData == "0")
  1092.                                     {
  1093.                                         item3.ExtraData = "1";
  1094.                                         item3.UpdateState(false, true);
  1095.                                     }
  1096.                                     else if (item3.ExtraData == "1")
  1097.                                     {
  1098.                                         item3.ExtraData = "0";
  1099.                                         item3.UpdateState(false, true);
  1100.                                     }
  1101.                                 }
  1102.                             }
  1103.                         }
  1104.                     }
  1105.                 }
  1106.             }
  1107.         }
  1108.     }
  1109. }
Add Comment
Please, Sign In to add comment