public void method_1() { this.Enabled = false; using (DatabaseClient @class = HabboIM.GetDatabase().GetClient()) { @class.ExecuteQuery("UPDATE room_items_moodlight SET enabled = '0' WHERE item_id = '" + this.ItemId + "' LIMIT 1"); } }
private static bool smethod_1(CtrlType enum0_0) { DeleteMenu(GetSystemMenu(GetConsoleWindow(), true), SC_CLOSE, MF_BYCOMMAND); if (Program.bool_0) { Logging.Disable(); Console.Clear(); Console.WriteLine("The server is saving users furniture, rooms, etc. WAIT FOR THE SERVER TO CLOSE, DO NOT EXIT THE PROCESS IN TASK MANAGER!!"); HabboIM.Destroy("", true); } return(true); }
public MoodlightPreset method_3(string string_0) { string[] array = string_0.Split(new char[] { ',' }); if (!this.method_5(array[0])) { array[0] = "#000000"; } return(new MoodlightPreset(array[0], int.Parse(array[1]), HabboIM.StringToBoolean(array[2]))); }
internal static void smethod_17(string string_8) { try { ServerMessage Message = new ServerMessage(139u); Message.AppendStringWithBreak(string_8); HabboIM.GetGame().GetClientManager().BroadcastMessage(Message); } catch { } }
public void method_2(int int_1, string string_0, int int_2, bool bool_1) { string text = null; if (this.method_5(string_0) && this.method_6(int_2)) { switch (int_1) { case 1: { text = "one"; goto IL_44; } case 2: { text = "two"; goto IL_44; } case 3: { text = "three"; goto IL_44; } } /*goto IL_2E;*/ IL_44: using (DatabaseClient @class = HabboIM.GetDatabase().GetClient()) { @class.AddParamWithValue("color", string_0); @class.ExecuteQuery(string.Concat(new object[] { "UPDATE room_items_moodlight SET preset_", text, " = '@color,", int_2, ",", HabboIM.BooleanToString(bool_1), "' WHERE item_id = '", this.ItemId, "' LIMIT 1" })); } this.method_4(int_1).ColorCode = string_0; this.method_4(int_1).ColorIntensity = int_2; this.method_4(int_1).BackgroundOnly = bool_1; } }
public MoodlightData(uint mItemId) { this.ItemId = mItemId; DataRow Row = null; using (DatabaseClient @class = HabboIM.GetDatabase().GetClient()) { Row = @class.ReadDataRow("SELECT enabled,current_preset,preset_one,preset_two,preset_three FROM room_items_moodlight WHERE item_id = '" + mItemId + "' LIMIT 1"); } if (Row == null) { throw new ArgumentException(); } this.Enabled = HabboIM.StringToBoolean(Row["enabled"].ToString()); this.CurrentPreset = (int)Row["current_preset"]; this.Presets = new List <MoodlightPreset>(); this.Presets.Add(this.method_3((string)Row["preset_one"])); this.Presets.Add(this.method_3((string)Row["preset_two"])); this.Presets.Add(this.method_3((string)Row["preset_three"])); }
public static void Main(string[] args) { CustomCultureInfo.SetupCustomCultureInfo(); AppDomain currentDomain = AppDomain.CurrentDomain; currentDomain.UnhandledException += new UnhandledExceptionEventHandler(Program.smethod_0); Program.delegate0_0 = (Program.EventHandler)Delegate.Combine(Program.delegate0_0, new Program.EventHandler(Program.smethod_1)); Program.SetConsoleCtrlHandler(Program.delegate0_0, true); try { HabboIM @class = new HabboIM(); @class.Initialize(); Program.bool_0 = true; DeleteMenu(GetSystemMenu(GetConsoleWindow(), false), SC_CLOSE, MF_BYCOMMAND); Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("\r\nDrücke ESC, um den Emulator runterzufahren.\r\n"); Console.ForegroundColor = ConsoleColor.Gray; } catch (Exception ex) { Console.Write(ex.ToString()); } while (true) { ConsoleKeyInfo = Console.ReadKey(); if (ConsoleKeyInfo.Key == ConsoleKey.Escape) { smethod_1(CtrlType.CTRL_CLOSE_EVENT); } } }
public static void Destroy() { Program.DeleteMenu(Program.GetSystemMenu(Program.GetConsoleWindow(), true), Program.SC_CLOSE, Program.MF_BYCOMMAND); Console.BackgroundColor = ConsoleColor.Black; Logging.WriteLine("Destroying Unicorn environment..."); if (HabboIM.GetGame() != null) { HabboIM.GetGame().ContinueLoading(); HabboIM.Internal_Game = null; } if (HabboIM.GetSocketsManager() != null) { Logging.WriteLine("Destroying connection manager."); HabboIM.GetSocketsManager().method_3().method_2(); //HabboIM.smethod_14().Destroy(); HabboIM.GetSocketsManager().method_0(); HabboIM.SocketsManager = null; } if (HabboIM.GetDatabase() != null) { try { Logging.WriteLine("Destroying database manager."); MySqlConnection.ClearAllPools(); HabboIM.DatabaseManager = null; } catch { } } Logging.WriteLine("Uninitialized successfully. Closing."); }
internal static void Destroy(string string_8, bool ExitWhenDone, bool waitExit = false) { Program.DeleteMenu(Program.GetSystemMenu(Program.GetConsoleWindow(), true), Program.SC_CLOSE, Program.MF_BYCOMMAND); try { Internal_Game.StopGameLoop(); } catch { } try { if (HabboIM.GetPacketManager() != null) { HabboIM.GetPacketManager().Clear(); } } catch { } if (string_8 != "") { if (HabboIM.bool_1) { return; } Console.WriteLine(string_8); Logging.Disable(); HabboIM.smethod_17("ATTENTION:\r\nThe server is shutting down. All furniture placed in rooms/traded/bought after this message is on your own responsibillity."); HabboIM.bool_1 = true; Console.WriteLine("Server shutting down..."); try { HabboIM.Internal_Game.GetRoomManager().method_4(); } catch { } try { HabboIM.GetSocketsManager().method_3().method_1(); //HabboIM.smethod_14().Destroy(); HabboIM.GetGame().GetClientManager().CloseAll(); } catch { } try { Console.WriteLine("Destroying database manager."); MySqlConnection.ClearAllPools(); HabboIM.DatabaseManager = null; } catch { } Console.WriteLine("System disposed, goodbye!"); } else { Logging.Disable(); HabboIM.bool_1 = true; try { if (HabboIM.Internal_Game != null && HabboIM.Internal_Game.GetRoomManager() != null) { HabboIM.Internal_Game.GetRoomManager().UnloadAllRooms(); HabboIM.Internal_Game.GetRoomManager().method_4(); } } catch { } try { if (HabboIM.GetSocketsManager() != null) { HabboIM.GetSocketsManager().method_3().method_1(); //HabboIM.smethod_14().Destroy(); HabboIM.GetGame().GetClientManager().CloseAll(); } } catch { } if (SocketsManager != null) { //HabboIM.ConnectionManage.method_7(); } if (HabboIM.Internal_Game != null) { HabboIM.Internal_Game.ContinueLoading(); } Console.WriteLine(string_8); } if (ExitWhenDone) { if (waitExit) { Console.WriteLine("Press any key to exit.."); Console.ReadKey(); } Environment.Exit(0); } }
internal static void Close() { HabboIM.Destroy("", true); }
public void Initialize() { HabboIM.ServerStarted = DateTime.Now; Console.Title = "HabboIM Emulator wird gestartet.."; Console.SetWindowPosition(0, 0); Console.SetWindowSize(100, 20); Console.BackgroundColor = ConsoleColor.Black; Console.CursorVisible = false; Console.Clear(); Console.ForegroundColor = ConsoleColor.Red; try { Console.WriteLine(); Console.Clear(); Console.ForegroundColor = ConsoleColor.Black; Console.WriteLine(" @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ "); Console.Write(" @@@"); Console.ForegroundColor = ConsoleColor.Yellow; Console.Write("*****************"); Console.ForegroundColor = ConsoleColor.Black; Console.Write("@@@"); Console.ForegroundColor = ConsoleColor.Yellow; Console.Write("*****************"); Console.ForegroundColor = ConsoleColor.Black; Console.Write("@@@ "); Console.WriteLine(""); Console.Write(" @@@"); Console.ForegroundColor = ConsoleColor.Yellow; Console.Write("*****************"); Console.ForegroundColor = ConsoleColor.Black; Console.Write("@@@"); Console.ForegroundColor = ConsoleColor.Yellow; Console.Write("*****************"); Console.ForegroundColor = ConsoleColor.Black; Console.Write("@@@ "); Console.WriteLine(""); Console.Write(" @@@"); Console.ForegroundColor = ConsoleColor.Yellow; Console.Write("*****************"); Console.ForegroundColor = ConsoleColor.Black; Console.Write("@@@"); Console.ForegroundColor = ConsoleColor.Yellow; Console.Write("*****************"); Console.ForegroundColor = ConsoleColor.Black; Console.Write("@@@ "); Console.WriteLine(""); Console.Write(" @@@"); Console.ForegroundColor = ConsoleColor.Yellow; Console.Write("*****************"); Console.ForegroundColor = ConsoleColor.Black; Console.Write("@@@"); Console.ForegroundColor = ConsoleColor.Yellow; Console.Write("*****************"); Console.ForegroundColor = ConsoleColor.Black; Console.Write("@@@ "); Console.WriteLine(""); Console.Write(" @@@"); Console.ForegroundColor = ConsoleColor.Yellow; Console.Write("*****************"); Console.ForegroundColor = ConsoleColor.Black; Console.Write("@@@"); Console.ForegroundColor = ConsoleColor.Yellow; Console.Write("*****************"); Console.ForegroundColor = ConsoleColor.Black; Console.Write("@@@ "); Console.WriteLine(""); Console.Write(" @@@"); Console.ForegroundColor = ConsoleColor.Yellow; Console.Write("*************************************"); Console.ForegroundColor = ConsoleColor.Black; Console.Write("@@@"); Console.WriteLine(""); Console.Write(" @@@"); Console.ForegroundColor = ConsoleColor.Yellow; Console.Write("*************************************"); Console.ForegroundColor = ConsoleColor.Black; Console.Write("@@@"); Console.WriteLine(""); Console.Write(" @@@"); Console.ForegroundColor = ConsoleColor.Yellow; Console.Write("*************************************"); Console.ForegroundColor = ConsoleColor.Black; Console.Write("@@@"); Console.WriteLine(""); Console.Write(" @@@"); Console.ForegroundColor = ConsoleColor.Yellow; Console.Write("*************************************"); Console.ForegroundColor = ConsoleColor.Black; Console.Write("@@@"); Console.WriteLine(""); Console.Write(" @@@"); Console.ForegroundColor = ConsoleColor.Yellow; Console.Write("*************************************"); Console.ForegroundColor = ConsoleColor.Black; Console.Write("@@@"); Console.WriteLine(""); Console.Write(" @@@"); Console.ForegroundColor = ConsoleColor.Yellow; Console.Write("*************************************"); Console.ForegroundColor = ConsoleColor.Black; Console.Write("@@@"); Console.WriteLine(""); Console.Write(" @@@"); Console.ForegroundColor = ConsoleColor.Yellow; Console.Write("*****************"); Console.ForegroundColor = ConsoleColor.Black; Console.Write("@@@"); Console.ForegroundColor = ConsoleColor.Yellow; Console.Write("*****************"); Console.ForegroundColor = ConsoleColor.Black; Console.Write("@@@ "); Console.WriteLine(""); Console.Write(" @@@"); Console.ForegroundColor = ConsoleColor.Yellow; Console.Write("*****************"); Console.ForegroundColor = ConsoleColor.Black; Console.Write("@@@"); Console.ForegroundColor = ConsoleColor.Yellow; Console.Write("*****************"); Console.ForegroundColor = ConsoleColor.Black; Console.Write("@@@ "); Console.WriteLine(""); Console.Write(" @@@"); Console.ForegroundColor = ConsoleColor.Yellow; Console.Write("*****************"); Console.ForegroundColor = ConsoleColor.Black; Console.Write("@@@"); Console.ForegroundColor = ConsoleColor.Yellow; Console.Write("*****************"); Console.ForegroundColor = ConsoleColor.Black; Console.Write("@@@ "); Console.WriteLine(""); Console.Write(" @@@"); Console.ForegroundColor = ConsoleColor.Yellow; Console.Write("*****************"); Console.ForegroundColor = ConsoleColor.Black; Console.Write("@@@"); Console.ForegroundColor = ConsoleColor.Yellow; Console.Write("*****************"); Console.ForegroundColor = ConsoleColor.Black; Console.Write("@@@ "); Console.WriteLine(""); Console.WriteLine(" @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ "); Console.ForegroundColor = ConsoleColor.Gray; Console.WriteLine(" "); Console.WriteLine(" " + Version); Console.WriteLine(" " + Developer); Console.WriteLine(" Lizenz: " + licence); Console.ForegroundColor = ConsoleColor.Gray; Console.WriteLine("____________________________________________________________________________________________________"); Console.WriteLine(); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("Lotto gestartet! Nächste Ziehung um " + (hour_lastlotto+1) + ":00 Uhr"); Console.ResetColor(); Console.BackgroundColor = ConsoleColor.Black; Console.ForegroundColor = ConsoleColor.White; try { DateTime now = DateTime.Now; try { HabboIM.Configuration = new ConfigurationData("config.conf"); Check(); DatabaseServer dbServer = new DatabaseServer(HabboIM.GetConfig().data["db.hostname"], uint.Parse(HabboIM.GetConfig().data["db.port"]), HabboIM.GetConfig().data["db.username"], HabboIM.GetConfig().data["db.password"]); Database database = new Database(HabboIM.GetConfig().data["db.name"], uint.Parse(HabboIM.GetConfig().data["db.pool.minsize"]), uint.Parse(HabboIM.GetConfig().data["db.pool.maxsize"])); HabboIM.DatabaseManager = new DatabaseManager(dbServer, database); } catch { Logging.WriteLine("Der Emulator wurde falsch konfiguriert!"); Logging.WriteLine("Press any key to shut down ..."); Console.ReadKey(true); HabboIM.Destroy(); } try { using (DatabaseClient dbClient = HabboIM.GetDatabase().GetClient()) { dbClient.ExecuteQuery("SET @@global.sql_mode= '';"); dbClient.ExecuteQuery("UPDATE users SET online = '0' WHERE online = '1' "); dbClient.ExecuteQuery("UPDATE rooms SET users_now = '0' WHERE users_now > 0"); DataRow DataRow; DataRow = dbClient.ReadDataRow("SHOW COLUMNS FROM `items` WHERE field = 'fw_count'"); DataRow DataRow2; DataRow2 = dbClient.ReadDataRow("SHOW COLUMNS FROM `items` WHERE field = 'extra_data'"); if (DataRow != null || DataRow2 != null) { if (DoYouWantContinue("Remember get backups before continue! Do you want continue? [Y/N]")) { if (DataRow != null) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("UPDATING ITEMS POSSIBLY TAKE A LONG TIME! DONT SHUTDOWN EMULATOR! PLEASE WAIT!"); Console.ForegroundColor = ConsoleColor.Gray; Console.Write("Items werden geupdatet (Feuerwerke) ..."); dbClient.ExecuteQuery("DROP TABLE IF EXISTS items_firework", int.MaxValue); dbClient.ExecuteQuery("CREATE TABLE IF NOT EXISTS `items_firework` (`item_id` int(10) unsigned NOT NULL, `fw_count` int(10) NOT NULL, PRIMARY KEY (`item_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;", int.MaxValue); dbClient.ExecuteQuery("INSERT INTO items_firework SELECT Id, fw_count FROM items WHERE fw_count > 0;", int.MaxValue); dbClient.ExecuteQuery("ALTER TABLE items DROP fw_count", int.MaxValue); Console.WriteLine("Erfolgreich!"); } if (DataRow2 != null) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("UPDATING ITEMS POSSIBLY TAKE A LONG TIME! DONT SHUTDOWN EMULATOR! PLEASE WAIT!"); Console.ForegroundColor = ConsoleColor.Gray; Console.Write("Items werden geupdatet (Extra data) ..."); dbClient.ExecuteQuery("DROP TABLE IF EXISTS items_extra_data", int.MaxValue); dbClient.ExecuteQuery("CREATE TABLE IF NOT EXISTS `items_extra_data` (`item_id` int(10) unsigned NOT NULL, `extra_data` text NOT NULL, PRIMARY KEY (`item_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;", int.MaxValue); dbClient.ExecuteQuery("INSERT INTO items_extra_data SELECT Id, extra_data FROM items WHERE extra_data != '';", int.MaxValue); dbClient.ExecuteQuery("ALTER TABLE items DROP extra_data", int.MaxValue); Console.WriteLine("Erfolgreich!"); } } else { Console.BackgroundColor = ConsoleColor.Black; Logging.WriteLine("Press any key to shut down ..."); Console.ReadKey(true); HabboIM.Destroy(); Logging.WriteLine("Press any key to close window ..."); Console.ReadKey(true); Environment.Exit(0); return; } } } //HabboIM.ConnectionManage.method_7(); HabboIM.Internal_Game.ContinueLoading(); } catch { } Console.BackgroundColor = ConsoleColor.Black; try { HabboIM.Internal_Game = new Game(int.Parse(HabboIM.GetConfig().data["game.tcp.conlimit"])); } catch { Console.BackgroundColor = ConsoleColor.Black; Logging.WriteLine("Fehler bei den Permissions"); Logging.WriteLine("Press any key to shut down ..."); Console.ReadKey(true); HabboIM.Destroy(); } try { HabboIM.PacketManager = new PacketManager(); HabboIM.PacketManager.Handshake(); HabboIM.PacketManager.Messenger(); HabboIM.PacketManager.Navigator(); HabboIM.PacketManager.RoomsAction(); HabboIM.PacketManager.RoomsAvatar(); HabboIM.PacketManager.RoomsChat(); HabboIM.PacketManager.RoomsEngine(); HabboIM.PacketManager.RoomsFurniture(); HabboIM.PacketManager.RoomsPets(); HabboIM.PacketManager.RoomsPools(); HabboIM.PacketManager.RoomsSession(); HabboIM.PacketManager.RoomsSettings(); HabboIM.PacketManager.Catalog(); HabboIM.PacketManager.Marketplace(); HabboIM.PacketManager.Recycler(); HabboIM.PacketManager.Quest(); HabboIM.PacketManager.InventoryAchievements(); HabboIM.PacketManager.InventoryAvatarFX(); HabboIM.PacketManager.InventoryBadges(); HabboIM.PacketManager.InventoryFurni(); HabboIM.PacketManager.InventoryPurse(); HabboIM.PacketManager.InventoryTrading(); HabboIM.PacketManager.Avatar(); HabboIM.PacketManager.Users(); HabboIM.PacketManager.Register(); HabboIM.PacketManager.Help(); HabboIM.PacketManager.Sound(); HabboIM.PacketManager.Wired(); HabboIM.PacketManager.Jukebox(); HabboIM.PacketManager.FriendStream(); } catch { Console.BackgroundColor = ConsoleColor.Black; Logging.WriteLine("Fehler bei wat weiß ich."); Logging.WriteLine("Press any key to shut down ..."); Console.ReadKey(true); HabboIM.Destroy(); } try { HabboIM.webSocketManager = new WebSocketServerManager(HabboIM.GetConfig().data["websockets.url"]); HabboIM.MusListener = new MusListener(HabboIM.GetConfig().data["mus.tcp.bindip"], int.Parse(HabboIM.GetConfig().data["mus.tcp.port"]), HabboIM.GetConfig().data["mus.tcp.allowedaddr"].Split(new char[] { ';' }), 20); HabboIM.SocketsManager = new SocketsManager(HabboIM.GetConfig().data["game.tcp.bindip"], int.Parse(HabboIM.GetConfig().data["game.tcp.port"]), int.Parse(HabboIM.GetConfig().data["game.tcp.conlimit"])); HabboIM.SocketsManager.method_3().method_0(); } catch { Console.BackgroundColor = ConsoleColor.Black; Logging.WriteLine("MUS Verbindung fehlgeschlagen!"); Logging.WriteLine("Press any key to shut down ..."); Console.ReadKey(true); HabboIM.Destroy(); } TimeSpan timeSpan = DateTime.Now - now; Console.BackgroundColor = ConsoleColor.Black; Logging.WriteLine(string.Concat(new object[] { "HabboIM -> BEREIT! (", timeSpan.Seconds, " s, ", timeSpan.Milliseconds, " ms)" })); Console.Beep(); } catch (KeyNotFoundException KeyNotFoundException) { Console.BackgroundColor = ConsoleColor.Black; Logging.WriteLine("Failed to boot, key not found: " + KeyNotFoundException); Logging.WriteLine("Press any key to shut down ..."); Console.ReadKey(true); HabboIM.Destroy(); } catch (InvalidOperationException ex) { Console.BackgroundColor = ConsoleColor.Black; Logging.WriteLine("Failed to initialize Unicorn: " + ex.Message); Logging.WriteLine("Press any key to shut down ..."); Console.ReadKey(true); HabboIM.Destroy(); } } catch { Console.BackgroundColor = ConsoleColor.Black; Logging.WriteLine("Configuration not found "); Logging.WriteLine("Press any key to shut down ..."); Console.ReadKey(true); HabboIM.Destroy(); } }