public override void OnTrigger(GameClient Session, RoomItem RoomItem_0, int int_0, bool bool_0) { if (Session.GetHabbo().CurrentRoom.CheckRights(Session, false)) { HabboIM.GetWebSocketManager().getWebSocketByName(Session.GetHabbo().Username).Send("9|" + RoomItem_0.uint_0 + "|" + RoomItem_0.Double_0); } }
public override void OnTrigger(GameClients.GameClient Session, RoomItem RoomItem_0, int int_0, bool bool_0) { if (bool_0) { try { HabboIM.GetWebSocketManager().getWebSocketByName(Session.GetHabbo().Username).Send("31|" + RoomItem_0.uint_0 + "|" + "https://youtube.com/watch?v=" + RoomItem_0.string_2); } catch { } } }
internal uint method_14() { string abcde = "dev"; HabboIM.GetWebSocketManager().SendMessageToEveryConnection(abcde); lock (this.object_0) return(this.uint_0++); }
public override void OnTrigger(GameClients.GameClient Session, RoomItem RoomItem_0, int int_0, bool bool_0) { HabboIM.GetWebSocketManager().getWebSocketByName(Session.GetHabbo().Username).Send("366"); }
public void Handle(GameClient Session, ClientMessage Event) { if (Session.GetHabbo().uint_2 > 0u && Session.GetHabbo().bool_5) { RoomData @class = HabboIM.GetGame().GetRoomManager().method_12(Session.GetHabbo().uint_2); if (@class != null) { Session.GetHabbo().collector = false; Session.GetHabbo().knastarbeit = false; Session.GetHabbo().last_gearbeitet = 0.0; if (Session.GetHabbo().jail == 1 && Session.GetHabbo().jailtime < 1) { Session.GetHabbo().jail = 0; Session.GetHabbo().jailtime = 0.0; Session.GetHabbo().UpdateJail(true); Session.GetHabbo().UpdateJailTime(true); } if (Session.GetHabbo().jail == 1) { if (Session.GetHabbo().jailtime > 1) { HabboIM.GetWebSocketManager().getWebSocketByName(Session.GetHabbo().Username).Send("myh_arrest"); } } if (HabboIM.GetGame().GetClientManager().wartung == true && @class.Id != 0u && @class.Id != 1732u && @class.Id != 1732 && @class.Id != 901 && @class.Id != 901u && Session.GetHabbo().Rank < 6) { if (Session.GetHabbo().jail == 1) { uint num2 = Convert.ToUInt32(1732); Room class3 = HabboIM.GetGame().GetRoomManager().method_15(num2); ServerMessage Message2 = new ServerMessage(286u); Message2.AppendBoolean(class3.IsPublic); Message2.AppendUInt(1732); Session.SendMessage(Message2); } else { uint num2 = Convert.ToUInt32(901); Room class3 = HabboIM.GetGame().GetRoomManager().method_15(num2); ServerMessage Message2 = new ServerMessage(286u); Message2.AppendBoolean(class3.IsPublic); Message2.AppendUInt(901); Session.SendMessage(Message2); Session.SendNotification("Zugang verweigert!\r\rDas Hotel befindet sich momentan im Wartungszustand."); } } else { if (Session.GetHabbo().jail == 1 && Session.GetHabbo().jailtime > 0 && @class.Id != 1732 && @class.Id != 0u && @class.Id != 1732u) { uint num2 = Convert.ToUInt32(1732); Room class3 = HabboIM.GetGame().GetRoomManager().method_15(num2); ServerMessage Message2 = new ServerMessage(286u); Message2.AppendBoolean(class3.IsPublic); Message2.AppendUInt(1732); Session.SendMessage(Message2); if (Session.GetHabbo().jailtime != 0.0 && Session.GetHabbo().jailtime > 0) { double seconds = (Session.GetHabbo().jailtime) / 60; decimal newtimexx = Convert.ToDecimal(seconds); decimal rundesecs = Math.Round(newtimexx); Session.SendNotification("Versuche nicht, aus dem MyHuBBa Gefängnis auszubrechen...!\r\rDu hast noch eine Haftzeit in höhe von " + rundesecs + " Minuten.\r\rHalte dich das nächste mal an die Regeln des Hotels!"); } } else { if (@class.Id == 1732 && Session.GetHabbo().jail == 0 && @class.Id != 0u && Session.GetHabbo().Rank < 3) { Room @classx = HabboIM.GetGame().GetRoomManager().GetRoom(@class.Id); @classx.method_47(Session, true, false); Session.SendNotification("Du kannst das MyHuBBa Gefängnis nicht betreten da du keine Haftstrafe absitzen musst."); } else { if (@class.Model == null) { Session.SendNotification("Error loading room, please try again soon! (Error Code: MdlData)"); Session.SendMessage(new ServerMessage(18u)); Session.GetClientMessageHandler().method_7(); } else { Session.SendMessage(@class.Model.method_1()); Session.SendMessage(@class.Model.method_2()); Room class2 = HabboIM.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().uint_2); if (class2 != null) { Session.GetClientMessageHandler().method_7(); ServerMessage Message = new ServerMessage(30u); if (class2.RoomModel.string_2 != "") { Message.AppendStringWithBreak(class2.RoomModel.string_2); } else { Message.AppendInt32(0); } Session.SendMessage(Message); if (class2.Type == "private") { Hashtable hashtable_ = class2.Hashtable_0; Hashtable hashtable_2 = class2.Hashtable_1; ServerMessage Message2 = new ServerMessage(32u); Message2.AppendInt32(hashtable_.Count); foreach (RoomItem class3 in hashtable_.Values) { class3.method_6(Message2); } Session.SendMessage(Message2); ServerMessage Message3 = new ServerMessage(45u); Message3.AppendInt32(hashtable_2.Count); foreach (RoomItem class3 in hashtable_2.Values) { class3.method_6(Message3); } Session.SendMessage(Message3); } class2.method_46(Session, Session.GetHabbo().bool_8); List <RoomUser> list = new List <RoomUser>(); for (int i = 0; i < class2.RoomUsers.Length; i++) { RoomUser class4 = class2.RoomUsers[i]; if (class4 != null && (!class4.bool_11 && class4.bool_12)) { list.Add(class4); } } ServerMessage Message4 = new ServerMessage(28u); Message4.AppendInt32(list.Count); foreach (RoomUser class4 in list) { class4.method_14(Message4); } Session.SendMessage(Message4); ServerMessage Message5 = new ServerMessage(472u); Message5.AppendBoolean(class2.Hidewall); Message5.AppendInt32(class2.Wallthick); Message5.AppendInt32(class2.Floorthick); Session.SendMessage(Message5); if (class2.Type == "public") { ServerMessage Message6 = new ServerMessage(471u); Message6.AppendBoolean(false); Message6.AppendStringWithBreak(class2.ModelName); Message6.AppendBoolean(false); Session.SendMessage(Message6); } else { if (class2.Type == "private") { ServerMessage Message6 = new ServerMessage(471u); Message6.AppendBoolean(true); Message6.AppendUInt(class2.Id); if (class2.CheckRights(Session, true)) { Message6.AppendBoolean(true); } else { Message6.AppendBoolean(false); } Session.SendMessage(Message6); ServerMessage Message7 = new ServerMessage(454u); Message7.AppendBoolean(false); @class.method_3(Message7, false, false); Session.SendMessage(Message7); } } ServerMessage Message8 = class2.method_67(true); if (Message8 != null) { Session.SendMessage(Message8); } for (int i = 0; i < class2.RoomUsers.Length; i++) { RoomUser class4 = class2.RoomUsers[i]; if (class4 != null && !class4.bool_11) { if (class4.IsDancing) { ServerMessage Message9 = new ServerMessage(480u); Message9.AppendInt32(class4.VirtualId); Message9.AppendInt32(class4.DanceId); Session.SendMessage(Message9); } if (class4.bool_8) { ServerMessage Message10 = new ServerMessage(486u); Message10.AppendInt32(class4.VirtualId); Message10.AppendBoolean(true); Session.SendMessage(Message10); } if (class4.CarryItemID > 0 && class4.int_6 > 0) { ServerMessage Message11 = new ServerMessage(482u); Message11.AppendInt32(class4.VirtualId); Message11.AppendInt32(class4.CarryItemID); Session.SendMessage(Message11); } if (!class4.IsBot) { try { if (class4.GetClient().GetHabbo() != null && class4.GetClient().GetHabbo().GetEffectsInventoryComponent() != null && class4.GetClient().GetHabbo().GetEffectsInventoryComponent().int_0 >= 1) { ServerMessage Message12 = new ServerMessage(485u); Message12.AppendInt32(class4.VirtualId); Message12.AppendInt32(class4.GetClient().GetHabbo().GetEffectsInventoryComponent().int_0); Session.SendMessage(Message12); } goto IL_5C5; } catch { goto IL_5C5; } } if (!class4.IsPet && class4.RoomBot.EffectId != 0) { ServerMessage Message12 = new ServerMessage(485u); Message12.AppendInt32(class4.VirtualId); Message12.AppendInt32(class4.RoomBot.EffectId); Session.SendMessage(Message12); } } IL_5C5 :; } if (class2 != null && Session != null && Session.GetHabbo().CurrentRoom != null) { Session.GetHabbo().GetEffectsInventoryComponent().method_2(0, true); class2.method_8(Session.GetHabbo().CurrentRoom.GetRoomUserByHabbo(Session.GetHabbo().Id)); } if (class2.Achievement > 0u) { HabboIM.GetGame().GetAchievementManager().addAchievement(Session, class2.Achievement, 1); } if (Session.GetHabbo().IsMuted&& Session.GetHabbo().int_4 > 0) { ServerMessage Message13 = new ServerMessage(27u); Message13.AppendInt32(Session.GetHabbo().int_4); Session.SendMessage(Message13); } } } } } } } } }
public override void OnTrigger(GameClient Session, RoomItem RoomItem_0, int int_1, bool bool_0) { if (RoomItem_0.GetBaseItem().sfx_id != "" && bool_0) { Room class2 = HabboIM.GetGame().GetRoomManager().GetRoom(RoomItem_0.method_8().Id); for (int i = 0; i < class2.RoomUsers.Length; i++) { RoomUser class5 = class2.RoomUsers[i]; if (class5 != null && !class5.IsBot) { try { HabboIM.GetWebSocketManager().getWebSocketByName(class5.GetClient().GetHabbo().Username).Send("55|" + RoomItem_0.GetBaseItem().sfx_id); } catch { } } } } if (this.Modes != 0 && (bool_0 || RoomItem_0.GetBaseItem().InteractionType.ToLower() == "switch")) { if (RoomItem_0.GetBaseItem().InteractionType.ToLower() == "switch" && Session != null) { RoomUser @class = Session.GetHabbo().CurrentRoom.GetRoomUserByHabbo(Session.GetHabbo().Id); if (@class.Position.x - RoomItem_0.GStruct1_1.x > 1 || @class.Position.y - RoomItem_0.GStruct1_1.y > 1) { if (@class.bool_0) { @class.MoveTo(RoomItem_0.GStruct1_0); return; } return; } } int num = 0; if (RoomItem_0.ExtraData.Length > 0) { num = int.Parse(RoomItem_0.ExtraData); } int num2; if (num <= 0) { num2 = 1; } else { if (num >= this.Modes) { num2 = 0; } else { num2 = num + 1; } } //if (RoomItem_0.GetBaseItem().Name.Contains("jukebox")) //{ // ServerMessage Message = new ServerMessage(327u); // if (num2 == 1) // { // Message.AppendInt32(7); // Message.AppendInt32(6); // Message.AppendInt32(7); // Message.AppendInt32(0); // Message.AppendInt32(0); // RoomItem_0.int_0 = 1; // RoomItem_0.bool_0 = true; // RoomItem_0.bool_1 = true; // } // else // { // Message.AppendInt32(-1); // Message.AppendInt32(-1); // Message.AppendInt32(-1); // Message.AppendInt32(-1); // Message.AppendInt32(0); // RoomItem_0.int_0 = 0; // RoomItem_0.bool_0 = false; // RoomItem_0.method_8().int_13 = 0; // } // RoomItem_0.method_8().SendMessage(Message, null); //} double double_ = RoomItem_0.Double_1; RoomItem_0.ExtraData = num2.ToString(); RoomItem_0.method_4(); if (double_ != RoomItem_0.Double_1) { Dictionary <int, AffectedTile> dictionary = RoomItem_0.Dictionary_0; if (dictionary == null) { dictionary = new Dictionary <int, AffectedTile>(); } RoomItem_0.method_8().method_87(RoomItem_0.method_8().method_43(RoomItem_0.Int32_0, RoomItem_0.Int32_1), true, false); foreach (AffectedTile current in dictionary.Values) { RoomItem_0.method_8().method_87(RoomItem_0.method_8().method_43(current.Int32_0, current.Int32_1), true, false); } } if (Session != null) { RoomUser RoomUser_ = Session.GetHabbo().CurrentRoom.GetRoomUserByHabbo(Session.GetHabbo().Id); RoomItem_0.method_8().method_10(RoomUser_, RoomItem_0); } } }
public static void Initialise() { double lastDatabaseUpdate = HabboIM.GetUnixTimestamp(); double lastDatabaseUpdate2 = HabboIM.GetUnixTimestamp(); while (true) { try { DateTime now = DateTime.Now; TimeSpan timeSpan = now - HabboIM.ServerStarted; new PerformanceCounter("Processor", "% Processor Time", "_Total"); int Status = 1; int UsersOnline = HabboIM.GetGame().GetClientManager().ClientCount; int RoomsLoaded = HabboIM.GetGame().GetRoomManager().LoadedRoomsCount; try { if (HabboIM.GetConfig().data["shutdown-server"] != null) { DateTime shutdown_server_time = Convert.ToDateTime(HabboIM.GetConfig().data["shutdown-server"]); var time = shutdown_server_time.TimeOfDay.TotalSeconds; string s = DateTime.Now.ToString("HH:mm:ss"); DateTime dt2 = DateTime.ParseExact(s, "HH:mm:ss", CultureInfo.InvariantCulture); var time2 = dt2.TimeOfDay.TotalSeconds; try { if (HabboIM.GetConfig().data["shutdown-warning-alert"] != null) { if (time - time2 <= 60 && time - time2 >= 50) { try { if (int.Parse(HabboIM.GetConfig().data["shutdown-server-player-limit"]) < UsersOnline || int.Parse(HabboIM.GetConfig().data["shutdown-server-player-limit"]) <= 0) { string str = HabboIM.GetConfig().data["shutdown-warning-alert"]; ServerMessage Message2 = new ServerMessage(808u); Message2.AppendStringWithBreak(HabboIMEnvironment.GetExternalText("cmd_ha_title")); Message2.AppendStringWithBreak(str + "\r\n- " + "Hotel"); ServerMessage Message3 = new ServerMessage(161u); Message3.AppendStringWithBreak(str + "\r\n- " + "Hotel"); HabboIM.GetGame().GetClientManager().method_15(Message2, Message3); } } catch { } } } } catch { } if (time - time2 <= 11 && time - time2 >= 0) { try { if (int.Parse(HabboIM.GetConfig().data["shutdown-server-player-limit"]) < UsersOnline || int.Parse(HabboIM.GetConfig().data["shutdown-server-player-limit"]) <= 0) { HabboIM.Destroy("SERVER SHUTDOWN! YOU HAVE SETUP TO CONFIG.CONF FILE SHUTDOWN TIME!", true); } } catch { HabboIM.Destroy("SERVER SHUTDOWN! YOU HAVE SETUP TO CONFIG.CONF FILE SHUTDOWN TIME!", true); } } } } catch { } double timestamp = HabboIM.GetUnixTimestamp() - lastDatabaseUpdate; if (timestamp >= 5) { using (DatabaseClient dbClient = HabboIM.GetDatabase().GetClient()) { dbClient.ExecuteQuery(string.Concat(new object[] { "UPDATE server_status SET stamp = UNIX_TIMESTAMP(), status = '", Status, "', users_online = '", UsersOnline, "', rooms_loaded = '", RoomsLoaded, "', server_ver = '", HabboIM.Version, "' LIMIT 1" })); uint num3 = (uint)dbClient.ReadInt32("SELECT users FROM system_stats ORDER BY ID DESC LIMIT 1"); if ((long)UsersOnline > (long)((ulong)num3)) { dbClient.ExecuteQuery(string.Concat(new object[] { "UPDATE system_stats SET users = '", UsersOnline, "', rooms = '", RoomsLoaded, "' ORDER BY ID DESC LIMIT 1" })); } } lastDatabaseUpdate = HabboIM.GetUnixTimestamp(); } double timestamp2 = HabboIM.GetUnixTimestamp() - lastDatabaseUpdate2; if (timestamp2 >= 30.0) { using (DatabaseClient dbClient = HabboIM.GetDatabase().GetClient()) { dbClient.ExecuteQuery(string.Concat(new object[] { "INSERT INTO online_statistik (`useronline`,`rooms_loaded`,`timestamp`) VALUES ('", UsersOnline, "','", RoomsLoaded, "', '", HabboIM.GetUnixTimestamp(), "');" }), 30); } lastDatabaseUpdate2 = HabboIM.GetUnixTimestamp(); } HabboIM.GetGame().GetClientManager().method_23(); Console.Title = string.Concat(new object[] { "HabboIM Emulator | Spieler: ", UsersOnline, " | Räume: ", RoomsLoaded, " | Online: ", timeSpan.Days, " Tage, ", timeSpan.Hours, " Stunden und ", timeSpan.Minutes, " Minuten" }); if (HabboIM.hour_lastlotto != now.Hour) { HabboIM.hour_lastlotto = now.Hour; //ServerMessage Message2 = new ServerMessage(808u); //Message2.AppendStringWithBreak("MyHuBBa Lotterie"); //Message2.AppendStringWithBreak("Aufgepasst, nun könnt ihr an unserer Lotterie teilnehmen. Verwende hierzu den Befehl :lotto ZAHL und schon nimmst du teil. Die Zahl darf zwischen 1 & 50 liegen. Kosten für Teilnahme beträgt 3.500 Taler!\r\n- System"); ServerMessage Message3 = new ServerMessage(161u); //Message3.AppendStringWithBreak("Aufgepasst, nun könnt ihr an unserer Lotterie teilnehmen. Verwende hierzu den Befehl :lotto ZAHL und schon nimmst du teil. Die Zahl darf zwischen 1 & 50 liegen. Kosten für Teilnahme beträgt 3.500 Taler!\r\n- System"); //HabboIM.GetGame().GetClientManager().method_15(Message2, Message3); HabboIM.GetGame().GetClientManager().method_WHISPER("Lotto: Sende jetzt eine Zahl von 0-50 mit :lotto Zahl ein. Kosten: 3.500 Taler."); HabboIM.lotto = true; Random rand = new Random(); int lottozahl = rand.Next(1, 50); // Lottozahlen definieren Console.BackgroundColor = ConsoleColor.Black; Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine("Lotto: Ziehung gestartet! Die Zahl lautet " + lottozahl); HabboIM.lottozahl = lottozahl; HabboIM.lottowinner = 0; HabboIM.lotto_end = HabboIM.GetUnixTimestamp() + 5 * 60; //Info für den dummen Hazed: // 5 * 60 steht für 5 Minuten, da 5 Minuten 5 mal 60 Sekunden sind. HabboIM.lotto_einsatz = 3500; } if (HabboIM.GetUnixTimestamp() >= HabboIM.lotto_end && HabboIM.lotto == true) { Console.BackgroundColor = ConsoleColor.Black; Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine("Lotto: Ziehung gestoppt!"); HabboIM.lotto = false; HabboIM.GetGame().GetClientManager().resetlotto(); GameClients.GameClient client; try { client = HabboIM.GetGame().GetClientManager().method_2(HabboIM.lottowinner); client.GetHabbo().Credits += HabboIM.lotto_einsatz; client.GetHabbo().UpdateCredits(true); HabboIM.GetGame().GetClientManager().method_WHISPER("" + client.GetHabbo().Username + " hat den Jackpot in Höhe von " + HabboIM.lotto_einsatz.ToString() + " Talern geknackt! (Zahl: " + HabboIM.lottozahl + ")"); HabboIM.lotto_einsatz = 3500; Console.BackgroundColor = ConsoleColor.Black; Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine("Lotto: " + client.GetHabbo().Username + " hat den Jackpot geknackt."); } catch { HabboIM.GetGame().GetClientManager().method_WHISPER("Lotto: Heute hat leider keiner den Jackpot geknackt!"); HabboIM.lotto_einsatz = 3500; Console.BackgroundColor = ConsoleColor.Black; Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine("Lotto: Keiner konnte den Jackpot knacken."); } } var minimum_users = int.Parse(HabboIM.GetConfig().data["habboim.zufallsrare_minimum_spieler"]); if (HabboIM.hour_lastrr + HabboIM.nxt_rr * 60 < HabboIM.GetUnixTimestamp()) { HabboIM.hour_lastrr = HabboIM.GetUnixTimestamp(); if (int.Parse(HabboIM.GetConfig().data["habboim.zufallsrare"]) == 1) { //Wenn genug Habbos Online if (UsersOnline >= minimum_users) { //Ausgabe in Konsole Console.BackgroundColor = ConsoleColor.Black; Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("____________________________________________________________________________________________________"); Console.WriteLine(" "); Console.ForegroundColor = ConsoleColor.DarkGreen; Console.Write("["); string time1 = DateTime.Now.ToString(); Console.Write(time1 + "] "); Console.ForegroundColor = ConsoleColor.Green; Console.Write("Zufallsrare: Verteilt!"); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.DarkGreen; Console.Write("["); string time2 = DateTime.Now.ToString(); Console.Write(time2 + "] "); Console.ForegroundColor = ConsoleColor.Green; Console.Write("Nächste Zufallsrare wird in " + HabboIM.nxt_rr + " Minuten verteilt!"); Console.WriteLine(); } else { if (UsersOnline < minimum_users) { string time3 = DateTime.Now.ToString(); Console.BackgroundColor = ConsoleColor.Black; Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("____________________________________________________________________________________________________"); Console.WriteLine(" "); Console.ForegroundColor = ConsoleColor.DarkRed; Console.Write("["); Console.Write(time3 + "] "); Console.ForegroundColor = ConsoleColor.Red; Console.Write("Zufallsrare nicht verteilt. Grund: Nicht genug Online! Minimum: " + minimum_users + " Habbos."); Console.WriteLine(); HabboIM.zufallsrare = false; } } if (UsersOnline >= minimum_users) { //Ermittle über Websocket den Gewinner des Zufallsrare HabboIM.zufallsrare = false; string random_rare = "9307620"; HabboIM.GetWebSocketManager().SendMessageToEveryConnection(random_rare); } } //string random_rare = "5|ZUFALLSRARE|Baumstamm|15180"; //HabboIM.GetWebSocketManager().SendMessageToEveryConnection(random_rare); /* using (DatabaseClient stafflist = HabboIM.GetDatabase().GetClient()) * { * //DataTable start = stafflist.ReadDataTable("SELECT id FROM users ORDER BY desc LIMIT 1") * //DataTable Staffs = stafflist.ReadDataTable("SELECT * FROM users WHERE id = '" + testst + "' LIMIT 1"); * StringBuilder StringStaff = new StringBuilder(); * DataTable Staffs = stafflist.ReadDataTable("SELECT * FROM users ORDER BY id desc"); * foreach(DataRow testRow in Staffs.Rows) * { * int dreiund = rand.Next(Staffs.Rows.Count, Staffs.Rows.Count); * Console.WriteLine("ZUFALL (MIT FOREACH) " + dreiund); * } * int testst = rand.Next(Staffs.Rows.Count, Staffs.Rows.Count); * Console.WriteLine("STAFF ROW " + Staffs.Rows.Count); * * Console.WriteLine("ZUFALL (OHNE FOREACH) " + testst); * * * //Console.WriteLine("User gefunden ID:" + testst); * foreach (DataRow baumstammRow in Staffs.Rows) * { * //Console.WriteLine("User gefunden ID:" + testst); * // Console.WriteLine((string)baumstammRow["username"]); * Console.WriteLine(testst); * } * //Console.WriteLine((string)baumstammRow["username"]); * * }*/ } } catch (Exception ex) { Program.DeleteMenu(Program.GetSystemMenu(Program.GetConsoleWindow(), true), Program.SC_CLOSE, Program.MF_BYCOMMAND); Logging.LogThreadException(ex.ToString(), "Server status update task"); } Thread.Sleep(5000); } }
public WebSocketServerManager(string SocketURL) { FleckLog.Level = LogLevel.Error; allSockets = new List <IWebSocketConnection>(); socketbyName = new Dictionary <string, IWebSocketConnection>(); namebySocket = new Dictionary <IWebSocketConnection, string>(); server = new WebSocketServer(SocketURL); server.Start(socket => { socket.OnOpen = () => { if (allSockets.Contains(socket)) { allSockets.Remove(socket); } allSockets.Add(socket); }; socket.OnClose = () => { string name = ""; if (namebySocket.ContainsKey(socket)) { name = namebySocket[socket].ToString(); namebySocket.Remove(socket); } if (socketbyName.ContainsKey(name) && name != "") { socketbyName.Remove(name); } if (allSockets.Contains(socket)) { allSockets.Remove(socket); } if (name != "") { using (DatabaseClient dbClient = HabboIM.GetDatabase().GetClient()) { dbClient.AddParamWithValue("name", name); dbClient.ExecuteQuery("UPDATE users SET websocket='0' WHERE username=@name"); } } }; socket.OnMessage = message => { var msg = message; int pId = 0; if (!int.TryParse(msg.Split('|')[0], out pId)) { return; } if (msg.Length > 1024) { return; } if (msg.StartsWith("1|")) { using (DatabaseClient dbClient = HabboIM.GetDatabase().GetClient()) { dbClient.AddParamWithValue("auth", msg.Substring(2)); DataRow drow = null; drow = dbClient.ReadDataRow("SELECT username FROM users WHERE auth_ticket= @auth LIMIT 1"); if (drow == null) { socket.Close(); } else { if (socketbyName.ContainsKey((string)drow["username"])) {/* socketbyName[(string)drow["username"]].Close();*/ socketbyName.Remove((string)drow["username"]); } socketbyName.Add(drow["username"].ToString(), socket); if (namebySocket.ContainsKey(socket)) { namebySocket.Remove(socket); } namebySocket.Add(socket, drow["username"].ToString()); dbClient.AddParamWithValue("name", drow["username"].ToString()); } } } else { GameClient Session = HabboIM.GetGame().GetClientManager().GetClientByHabbo(GetNameByWebSocket(socket)); Room room = Session.GetHabbo().CurrentRoom; string[] args = msg.Split('|'); switch (int.Parse(args[0])) { case 88: { GameClient class4 = HabboIM.GetGame().GetClientManager().method_2(Convert.ToUInt32(args[1])); if (class4 == null) { Session.GetHabbo().Whisper("Diese Person ist bereits offline. Du kannst die Anfrage deshalb nicht mehr annehmen."); break; } if (class4.GetHabbo().sexanfrage != Session.GetHabbo().Id) { Session.GetHabbo().Whisper("Ooops, da lief wohl etwas schief."); break; } if (class4.GetHabbo().boyfriend != 0 || Session.GetHabbo().boyfriend != 0) { Session.GetHabbo().Whisper("Du bist noch mit wem zusammen."); break; } if (args[2] == "1") { class4.GetHabbo().lovepoints = 0; class4.GetHabbo().kissed = 0; class4.GetHabbo().lovedate = 0; class4.GetHabbo().hugged = 0; class4.GetHabbo().hugtime = 0; class4.GetHabbo().kisstime = 0; class4.GetHabbo().boyfriend = 0; Session.GetHabbo().lovepoints = 0; Session.GetHabbo().kissed = 0; Session.GetHabbo().lovedate = 0; Session.GetHabbo().hugged = 0; Session.GetHabbo().hugtime = 0; Session.GetHabbo().kisstime = 0; Session.GetHabbo().lovedate = HabboIM.GetUnixTimestamp(); class4.GetHabbo().lovedate = HabboIM.GetUnixTimestamp(); class4.GetHabbo().boyfriend = Convert.ToInt32(Session.GetHabbo().Id); Session.GetHabbo().boyfriend = Convert.ToInt32(class4.GetHabbo().Id); try { using (DatabaseClient dbClient = HabboIM.GetDatabase().GetClient()) { dbClient.ExecuteQuery(string.Concat(new object[] { "UPDATE users SET boyfriend = '", Session.GetHabbo().Id, "', love_date = '", class4.GetHabbo().lovedate, "' WHERE Id = '", class4.GetHabbo().Id, "' LIMIT 1;" })); dbClient.ExecuteQuery(string.Concat(new object[] { "UPDATE users SET boyfriend = '", class4.GetHabbo().Id, "', love_date = '", Session.GetHabbo().lovedate, "' WHERE Id = '", Session.GetHabbo().Id, "' LIMIT 1;" })); } HabboIM.GetWebSocketManager().getWebSocketByName(Session.GetHabbo().Username).Send("textosteron|Beziehung|Du bist jetzt in einer Beziehung mit " + class4.GetHabbo().Username + "."); HabboIM.GetWebSocketManager().getWebSocketByName(class4.GetHabbo().Username).Send("textosteron|Beziehung|Du bist jetzt in einer Beziehung mit " + Session.GetHabbo().Username + "."); } catch { } } if (args[2] == "2") { HabboIM.GetWebSocketManager().getWebSocketByName(Session.GetHabbo().Username).Send("textosteron|Beziehungsanfrage|Die Beziehungsanfrage wurde abgelehnt."); HabboIM.GetWebSocketManager().getWebSocketByName(class4.GetHabbo().Username).Send("textosteron|Beziehungsanfrage|Die Beziehungsanfrage wurde abgelehnt."); } class4.GetHabbo().sexanfrage = 0; Session.GetHabbo().sexanfrage = 0; break; } case 74: { try { using (DatabaseClient dbClient = HabboIM.GetDatabase().GetClient()) { dbClient.ExecuteQuery(string.Concat(new object[] { "UPDATE users SET lastkiss_time = '0', lasthug_time = '0', lovepoints = '0', kisses_bf = '0', hugs_bf = '0', boyfriend = '0' WHERE Id = '", Session.GetHabbo().Id, "' OR Id = '", Session.GetHabbo().boyfriend, "' LIMIT 2;" })); } Session.GetHabbo().lovepoints = 0; Session.GetHabbo().kissed = 0; Session.GetHabbo().lovedate = 0; Session.GetHabbo().hugged = 0; Session.GetHabbo().hugtime = 0; Session.GetHabbo().kisstime = 0; GameClient class4 = HabboIM.GetGame().GetClientManager().method_2(Convert.ToUInt32(Session.GetHabbo().boyfriend)); if (class4 != null) { class4.GetHabbo().lovepoints = 0; class4.GetHabbo().kissed = 0; class4.GetHabbo().lovedate = 0; class4.GetHabbo().hugged = 0; class4.GetHabbo().hugtime = 0; class4.GetHabbo().kisstime = 0; class4.GetHabbo().boyfriend = 0; HabboIM.GetWebSocketManager().getWebSocketByName(Session.GetHabbo().Username).Send("textosteron|Trennung|Du hast mit " + class4.GetHabbo().Username + " Schluss gemacht."); HabboIM.GetWebSocketManager().getWebSocketByName(class4.GetHabbo().Username).Send("textosteron|Trennung|" + Session.GetHabbo().Username + " hat mit dir Schluss gemacht."); } Session.GetHabbo().boyfriend = 0; if (class4 == null) { HabboIM.GetWebSocketManager().getWebSocketByName(Session.GetHabbo().Username).Send("textosteron|Trennung|Du hast Schluss gemacht."); } } catch (Exception x) { } break; } case 6: { try { room = HabboIM.GetGame().GetRoomManager().GetRoom(uint.Parse(args[1])); if (Session != null && room != null) { ServerMessage Message = new ServerMessage(286u); Message.AppendBoolean(room.IsPublic); Message.AppendUInt(room.Id); Session.SendMessage(Message); } } catch { } break; } case 9: { try { if (Session.GetHabbo().CurrentRoom.CheckRights(Session, false)) { int ItemId = int.Parse(args[1]); double newZ = double.Parse(args[2]); RoomItem ri = Session.GetHabbo().CurrentRoom.method_28((uint)ItemId); if (ri != null && ri.GetBaseItem().InteractionType == "stackfield") { ri.setHeight(newZ); ri.method_8().method_80(ri); ServerMessage Message = new ServerMessage(94u); Message.AppendRawUInt(ri.uint_0); Message.AppendStringWithBreak(""); Message.AppendBoolean(false); Session.GetHabbo().CurrentRoom.SendMessage(Message, null); ServerMessage Message5_ = new ServerMessage(95u); ri.SerializeStackField(Message5_); Session.GetHabbo().CurrentRoom.SendMessage(Message5_, null); ServerMessage Message1_ = new ServerMessage(93u); ri.SerializeStackField(Message1_); Session.GetHabbo().CurrentRoom.SendMessage(Message1_, null); } } } catch { } break; } case 10: { try { if (Session.GetHabbo().CurrentRoom.CheckRights(Session, false)) { uint itemid = uint.Parse(args[1]); int handitemId = int.Parse(args[2]); RoomItem ri = Session.GetHabbo().CurrentRoom.method_28(itemid); if (ri != null && ri.GetBaseItem().InteractionType == "wf_cnd_has_handitem") { ri.string_2 = handitemId.ToString(); ri.UpdateState(true, false); } } } catch { } break; } case 12: { try { if (Session.GetHabbo().CurrentRoom.CheckRights(Session, false)) { uint itemid = uint.Parse(args[1]); string team = args[2]; RoomItem ri = Session.GetHabbo().CurrentRoom.method_28(itemid); if (ri != null && (ri.GetBaseItem().InteractionType == "wf_cnd_actor_in_team" || ri.GetBaseItem().InteractionType == "wf_cnd_not_in_team") && Session.GetHabbo().CurrentRoom.IsValidTeam(team)) { ri.string_2 = team; ri.UpdateState(true, false); } } } catch { } break; } case 14: { try { Session.GetHabbo().CurrentRoom.method_56(Session.GetHabbo().Username).CarryItem(int.Parse(args[1])); } catch { } break; } case 32: { if (Session.GetHabbo().CurrentRoom.CheckRights(Session, true)) { try { RoomItem ri = Session.GetHabbo().CurrentRoom.method_28(uint.Parse(args[1])); if (ri != null && ri.GetBaseItem().InteractionType == "wf_act_yt") { string ytlink = args[2].Split('=')[1]; ri.string_2 = ytlink; ri.UpdateState(true, false); } } catch { } } break; } case 35: { if (Session.GetHabbo().CurrentRoom.CheckRights(Session, true)) { try { RoomItem ri = Session.GetHabbo().CurrentRoom.method_28(uint.Parse(args[1])); if (ri != null && (ri.GetBaseItem().InteractionType == "wf_cnd_has_purse" || ri.GetBaseItem().InteractionType == "wf_cnd_hasnot_purse")) { string currency = Session.GetHabbo().CurrentRoom.IsValidCurrency(args[2]) ? args[2] : "credits"; int number = 1337; int.TryParse(args[3], out number); ri.string_2 = currency + ";" + number; ri.UpdateState(true, false); } } catch { } } break; } case 36: { if (Session.GetHabbo().CurrentRoom.CheckRights(Session, true)) { try { RoomItem ri = Session.GetHabbo().CurrentRoom.method_28(uint.Parse(args[1])); if (ri != null && ri.GetBaseItem().InteractionType == "wf_act_img" && IsValidFile(args[2])) { ri.string_2 = args[2]; ri.UpdateState(true, false); } } catch { } } break; } case 93076201: { if (HabboIM.zufallsrare == false) { HabboIM.zufallsrare = true; uint item = uint.Parse(args[1]); uint user = uint.Parse(args[2]); uint id = uint.Parse(args[3]); uint geschenk = 169; var geschenkmsg = "!HabboIM Zufallsrare - Was hier wohl drin sein mag?"; uint amount = 1; using (DatabaseClient dbclient = HabboIM.GetDatabase().GetClient()) { dbclient.AddParamWithValue("spieler", uint.Parse(args[2])); dbclient.AddParamWithValue("raum", '0'); dbclient.AddParamWithValue("moebel", uint.Parse(args[1])); dbclient.AddParamWithValue("geschenk", geschenk); dbclient.AddParamWithValue("geschenkmsg", geschenkmsg); dbclient.AddParamWithValue("amount", amount); StringBuilder StringGetiditem = new StringBuilder(); DataTable Getiditem = dbclient.ReadDataTable("SELECT * FROM items ORDER BY RAND() LIMIT 1"); foreach (DataRow StaffRow in Getiditem.Rows) { uint num5 = HabboIM.GetGame().GetCatalog().method_14(); dbclient.AddParamWithValue("id", num5); Console.WriteLine(StaffRow["id"]); dbclient.ExecuteQuery(string.Concat(new object[] { "INSERT INTO items (Id,user_id,base_item,wall_pos) VALUES ('", (object)num5, "','", uint.Parse(args[2]), "','169','')" })); dbclient.ExecuteQuery(string.Concat(new object[] { "INSERT INTO items_extra_data (item_id,extra_data) VALUES ('", (object)num5, "','", "!HabboIM Zufallsrare - Was hier wohl drin sein mag?", "')" })); dbclient.ExecuteQuery(string.Concat(new object[] { "INSERT INTO user_presents (item_id,base_id,amount,extra_data) VALUES ('", (object)num5, "','", uint.Parse(args[1]), "','1','')" })); /* * dbclient.ExecuteQuery("INSERT INTO items (id, user_id, room_id, base_item) VALUES ('" + (object)num5 + "', @spieler, @raum, @geschenk)"); * dbclient.ExecuteQuery("INSERT INTO items_extra_data (item_id, extra_data) VALUES ('" + (object)num5 + "', @geschenkmsg)"); * dbclient.ExecuteQuery("INSERT INTO user_presents (item_id, base_id, amount) VALUES ('" + (object)num5 + "', @moebel, @amount)");*/ } } //Staffchat Ausgabe ServerMessage Logging = new ServerMessage(134u); Logging.AppendUInt(0u); Logging.AppendString("INFO: Der Spieler " + args[4] + " hat eine Zufallsrarität erhalten!"); HabboIM.GetGame().GetClientManager().method_16(Logging, Logging); if (int.Parse(HabboIM.GetConfig().data["habboim.customdesign"]) == 1) { string rmessage = "rndrmsg"; HabboIM.GetWebSocketManager().SendMessageToEveryConnection(rmessage); HabboIM.GetGame().GetClientManager().method_WHISPER("Nächste Zufallsrare wird in " + HabboIM.nxt_rr + " Minuten verteilt!"); } else { HabboIM.GetGame().GetClientManager().method_WHISPER("Die Zufallsrare wurde soeben verteilt!"); HabboIM.GetGame().GetClientManager().method_WHISPER("Nächste Zufallsrare wird in " + HabboIM.nxt_rr + " Minuten verteilt!"); } GameClient gameClient = HabboIM.GetGame().GetClientManager().method_2(uint.Parse(args[2])); if (gameClient != null) { gameClient.SendNotification("Überprüfe dein Inventar, denn du hast eine Zufallsrarität erhalten!"); gameClient.GetHabbo().GetInventoryComponent().method_9(true); ++gameClient.GetHabbo().RandomRares; gameClient.GetHabbo().CheckRandomRares(); } return; } break; } case 51: { if (Session.GetHabbo().CurrentRoom.CheckRights(Session, true)) { try { RoomItem ri = Session.GetHabbo().CurrentRoom.method_28(uint.Parse(args[1])); if (ri != null && (ri.GetBaseItem().InteractionType == "wf_cnd_user_count_in" || ri.GetBaseItem().InteractionType == "wfc_cnd_not_user_count") && IsValidFile(args[2])) { int min = 1; int max = 50; int.TryParse(args[2], out min); int.TryParse(args[3], out max); ri.string_3 = min + ";" + max; ri.UpdateState(true, false); } } catch { } } break; } default: break; } } }; }); }