public void Initialize() { GoldTree.ServerStarted = DateTime.Now; Console.Clear(); Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(); Console.WriteLine(" _______ _________ ______ "); Console.WriteLine(" | _____| |___ ___| | _____|"); Console.WriteLine(" | | ___ | | | |____"); Console.WriteLine(" | | |_ | | | | ____|"); Console.WriteLine(" | |___| | | | | |____"); Console.WriteLine(" |_______| |_| |______|"); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine(" " + PrettyVersion); Console.WriteLine(); try { UserAdMessage = new List <string>(); WebClient client2 = new WebClient(); Stream stream2 = client2.OpenRead("https://raw.github.com/JunioriRetro/Gold-Tree-Emulator/master/useradtype.txt"); StreamReader reader2 = new StreamReader(stream2); String content2 = reader2.ReadLine(); try { UserAdType = int.Parse(content2); } catch { } WebClient client3 = new WebClient(); Stream stream3 = client3.OpenRead("https://raw.github.com/JunioriRetro/Gold-Tree-Emulator/master/useradmessage.txt"); StreamReader reader3 = new StreamReader(stream3); string line2; while ((line2 = reader3.ReadLine()) != null) { UserAdMessage.Add(line2); } WebClient client4 = new WebClient(); Stream stream4 = client4.OpenRead("https://raw.github.com/JunioriRetro/Gold-Tree-Emulator/master/useradlink.txt"); StreamReader reader4 = new StreamReader(stream4); String content4 = reader4.ReadLine(); UserAdLink = content4; try { WebClient client = new WebClient(); Stream stream = client.OpenRead("https://raw.github.com/JunioriRetro/Gold-Tree-Emulator/master/consoleads.txt"); StreamReader reader = new StreamReader(stream); string line; while ((line = reader.ReadLine()) != null) { if (line.StartsWith(":")) { string[] Params = line.Split(new char[] { ' ' }); if (Params[0] == ":textcolor") { if (!string.IsNullOrEmpty(Params[1])) { ConsoleColor Color = (ConsoleColor)Enum.Parse(typeof(ConsoleColor), Params[1]); Console.ForegroundColor = Color; } } else if (Params[0] == ":colorchangingtext") { string text = line.Substring(Params[0].Length + Params[1].Length + Params[2].Length + Params[3].Length + Params[4].Length + 5); RainbowText(text, IntToArray(Params[1]), 0, int.Parse(Params[2]), 0, int.Parse(Params[3]), bool.Parse(Params[4]), -1); } } else { Console.WriteLine(line); Console.ForegroundColor = ConsoleColor.White; } } } catch { } } catch { Console.WriteLine("Sad cant find ads :("); } Console.ResetColor(); try { GoldTree.Configuration = new ConfigurationData("config.conf"); DateTime now = DateTime.Now; //Lookds = new Random().Next(Int32.MaxValue).ToString(); DatabaseServer dbServer = new DatabaseServer(GoldTree.GetConfig().data["db.hostname"], uint.Parse(GoldTree.GetConfig().data["db.port"]), GoldTree.GetConfig().data["db.username"], GoldTree.GetConfig().data["db.password"]); Database database = new Database(GoldTree.GetConfig().data["db.name"], uint.Parse(GoldTree.GetConfig().data["db.pool.minsize"]), uint.Parse(GoldTree.GetConfig().data["db.pool.maxsize"])); GoldTree.DatabaseManager = new DatabaseManager(dbServer, database); try { using (DatabaseClient dbClient = GoldTree.GetDatabase().GetClient()) { dbClient.ExecuteQuery("UPDATE users SET online = '0'"); dbClient.ExecuteQuery("UPDATE rooms SET 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("Updating items (Fireworks) ..."); dbClient.ExecuteQuery("DROP TABLE IF EXISTS items_firework"); 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;"); DataTable dataTable = dbClient.ReadDataTable("SELECT Id, fw_count FROM items;"); int fails1 = 0; if (dataTable != null) { foreach (DataRow dataRow in dataTable.Rows) { try { if (dataRow != null && !string.IsNullOrEmpty(dataRow["Id"].ToString()) && !string.IsNullOrEmpty(dataRow["fw_count"].ToString()) && (uint)dataRow["Id"] > 0 && (int)dataRow["fw_count"] > 0) { uint id = (uint)dataRow["Id"]; int wf_count = (int)dataRow["fw_count"]; if (wf_count > 0) { dbClient.AddParamWithValue("fkey" + id, id); dbClient.AddParamWithValue("fvalue" + id, wf_count); dbClient.ExecuteQuery("INSERT INTO items_firework(item_id, fw_count) VALUES (@fkey" + id + ", @fvalue" + id + ")"); } } } catch (Exception ex) { Console.WriteLine("OOPS! Error when updating.. Firework count lost :( Lets continue..."); Logging.LogItemUpdateError(ex.ToString()); fails1++; } } } if (fails1 > 0 && !DoYouWantContinue("Failed update " + fails1 + " item firework count. Do you want continue? YOU LOST THEIR ITEMS FIREWORK COUNT! [Y/N]")) { Logging.WriteLine("Press any key to shut down ..."); Console.ReadKey(true); GoldTree.Destroy(); Logging.WriteLine("Press any key to close window ..."); Console.ReadKey(true); Environment.Exit(0); return; } if (dataTable != null) { dataTable.Clear(); } dataTable = null; dbClient.ExecuteQuery("ALTER TABLE items DROP fw_count"); Console.WriteLine("completed!"); } 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("Updating items (Extra data) ..."); dbClient.ExecuteQuery("DROP TABLE IF EXISTS items_extra_data"); 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;"); DataTable dataTable2 = dbClient.ReadDataTable("SELECT Id, extra_data FROM items;"); int fails2 = 0; if (dataTable2 != null) { foreach (DataRow dataRow in dataTable2.Rows) { try { if (dataRow != null && !string.IsNullOrEmpty(dataRow["Id"].ToString()) && !string.IsNullOrEmpty(dataRow["extra_data"].ToString()) && (uint)dataRow["Id"] > 0) { uint id = (uint)dataRow["Id"]; string extra_data = (string)dataRow["extra_data"]; if (!string.IsNullOrEmpty(extra_data)) { dbClient.AddParamWithValue("ekey" + id, id); dbClient.AddParamWithValue("evalue" + id, extra_data); dbClient.ExecuteQuery("INSERT INTO items_extra_data(item_id, extra_data) VALUES (@ekey" + id + ", @evalue" + id + ")"); } Console.WriteLine("Step 1 | ID: " + id + " | Extra data: " + extra_data); } } catch (Exception ex) { Console.WriteLine("OOPS! Error when updating.. Extra data lost :( Lets continue..."); Logging.LogItemUpdateError(ex.ToString()); fails2++; } } } if (dataTable2 != null) { dataTable2.Clear(); } dataTable2 = null; if (fails2 > 0 && !DoYouWantContinue("Failed update " + fails2 + " item extra data. Do you want continue? YOU LOST THEIR ITEMS EXTRA DATA! [Y/N]")) { Logging.WriteLine("Press any key to shut down ..."); Console.ReadKey(true); GoldTree.Destroy(); Logging.WriteLine("Press any key to close window ..."); Console.ReadKey(true); Environment.Exit(0); return; } dbClient.ExecuteQuery("ALTER TABLE items DROP extra_data"); Console.WriteLine("completed!"); } } else { Logging.WriteLine("Press any key to shut down ..."); Console.ReadKey(true); GoldTree.Destroy(); Logging.WriteLine("Press any key to close window ..."); Console.ReadKey(true); Environment.Exit(0); return; } } } //GoldTree.ConnectionManage.method_7(); GoldTree.Internal_Game.ContinueLoading(); } catch { } GoldTree.Internal_Game = new Game(int.Parse(GoldTree.GetConfig().data["game.tcp.conlimit"])); GoldTree.PacketManager = new PacketManager(); GoldTree.PacketManager.Handshake(); GoldTree.PacketManager.Messenger(); GoldTree.PacketManager.Navigator(); GoldTree.PacketManager.RoomsAction(); GoldTree.PacketManager.RoomsAvatar(); GoldTree.PacketManager.RoomsChat(); GoldTree.PacketManager.RoomsEngine(); GoldTree.PacketManager.RoomsFurniture(); GoldTree.PacketManager.RoomsPets(); GoldTree.PacketManager.RoomsPools(); GoldTree.PacketManager.RoomsSession(); GoldTree.PacketManager.RoomsSettings(); GoldTree.PacketManager.Catalog(); GoldTree.PacketManager.Marketplace(); GoldTree.PacketManager.Recycler(); GoldTree.PacketManager.Quest(); GoldTree.PacketManager.InventoryAchievements(); GoldTree.PacketManager.InventoryAvatarFX(); GoldTree.PacketManager.InventoryBadges(); GoldTree.PacketManager.InventoryFurni(); GoldTree.PacketManager.InventoryPurse(); GoldTree.PacketManager.InventoryTrading(); GoldTree.PacketManager.Avatar(); GoldTree.PacketManager.Users(); GoldTree.PacketManager.Register(); GoldTree.PacketManager.Help(); GoldTree.PacketManager.Sound(); GoldTree.PacketManager.Wired(); GoldTree.PacketManager.Jukebox(); GoldTree.MusListener = new MusListener(GoldTree.GetConfig().data["mus.tcp.bindip"], int.Parse(GoldTree.GetConfig().data["mus.tcp.port"]), GoldTree.GetConfig().data["mus.tcp.allowedaddr"].Split(new char[] { ';' }), 20); GoldTree.SocketsManager = new SocketsManager(GoldTree.GetConfig().data["game.tcp.bindip"], int.Parse(GoldTree.GetConfig().data["game.tcp.port"]), int.Parse(GoldTree.GetConfig().data["game.tcp.conlimit"])); //ConnectionManage = new ConnectionHandeling(GoldTree.GetConfig().data["game.tcp.port"], int.Parse(GoldTree.GetConfig().data["game.tcp.conlimit"]), int.Parse(GoldTree.GetConfig().data["game.tcp.conlimit"]), true); GoldTree.SocketsManager.method_3().method_0(); //ConnectionManage.init(); //ConnectionManage.Start(); /*try * { * if (int.Parse(GoldTree.GetConfig().data["automatic-error-report"]) < 1 || int.Parse(GoldTree.GetConfig().data["automatic-error-report"]) > 2) * { * Console.ForegroundColor = ConsoleColor.Red; * Logging.WriteLine("Erroreita ei raportoida automaattisesti!!!"); * Console.ForegroundColor = ConsoleColor.Gray; * } * if (int.Parse(GoldTree.GetConfig().data["automatic-error-report"]) == 1) * { * Console.ForegroundColor = ConsoleColor.Green; * Logging.WriteLine("Kaikki errorit reportoidaan automaattisesti"); * Console.ForegroundColor = ConsoleColor.Gray; * } * if (int.Parse(GoldTree.GetConfig().data["automatic-error-report"]) > 1) * { * Console.ForegroundColor = ConsoleColor.Green; * Logging.WriteLine("Vain kritikaaliset virheiden reportoidaan automaattisesti"); * Console.ForegroundColor = ConsoleColor.Gray; * } * } * catch * { * Console.ForegroundColor = ConsoleColor.Red; * Logging.WriteLine("Erroreita ei raportoida automaattisesti!!!"); * Console.ForegroundColor = ConsoleColor.Gray; * }*/ TimeSpan timeSpan = DateTime.Now - now; Logging.WriteLine(string.Concat(new object[] { "Server -> READY! (", timeSpan.Seconds, " s, ", timeSpan.Milliseconds, " ms)" })); Console.Beep(); } catch (KeyNotFoundException KeyNotFoundException) { Logging.WriteLine("Failed to boot, key not found: " + KeyNotFoundException); Logging.WriteLine("Press any key to shut down ..."); Console.ReadKey(true); GoldTree.Destroy(); } catch (InvalidOperationException ex) { Logging.WriteLine("Failed to initialize GoldTreeEmulator: " + ex.Message); Logging.WriteLine("Press any key to shut down ..."); Console.ReadKey(true); GoldTree.Destroy(); } }
public void Initialize() { if (!Licence.smethod_0(true)) { GoldTree.ServerStarted = DateTime.Now; Console.Clear(); Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(); //Console.WriteLine(" ______ _ _ _______ "); //Based to phoenix //Console.WriteLine(" (_____ \\| | (_) (_______) "); //Based to phoenix //Console.WriteLine(" _____) ) | _ ___ ____ ____ _ _ _ _____ ____ _ _ "); //Based to phoenix //Console.WriteLine(" | ____/| || \\ / _ \\ / _ ) _ \\| ( \\ / ) | ___) | \\| | | |"); //Based to phoenix //Console.WriteLine(" | | | | | | |_| ( (/ /| | | | |) X ( | |_____| | | | |_| |"); //Based to phoenix //Console.WriteLine(" |_| |_| |_|\\___/ \\____)_| |_|_(_/ \\_) |_______)_|_|_|\\____|"); //Based to phoenix Console.WriteLine(" _______ _________ ______ "); Console.WriteLine(" | _____| |___ ___| | _____|"); Console.WriteLine(" | | ___ | | | |____"); Console.WriteLine(" | | |_ | | | | ____|"); Console.WriteLine(" | |___| | | | | |____"); Console.WriteLine(" |_______| |_| |______|"); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine(" " + PrettyVersion); Console.WriteLine(); Console.ResetColor(); try { GoldTree.Configuration = new ConfigurationData("config.conf"); DateTime now = DateTime.Now; string_6 = GetConfig().data["GTE.username"]; string_7 = GetConfig().data["GTE.password"]; //Lookds = new Random().Next(Int32.MaxValue).ToString(); int num = string_6.Length * string_7.Length; if (string_6 == "" || string_7 == "" || LicenseTools.Boolean_7) { Console.WriteLine(); Console.ForegroundColor = ConsoleColor.Red; GoldTree.Destroy("Invalid Licence details found #0001", false); } else { LicenseTools.String_6 = GoldTree.string_6; LicenseTools.String_3 = GoldTree.string_7; string text = new Random().Next(Int32.MaxValue).ToString(); text = Licence.smethod_1(text, this.string_3); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.Gray; string str = new Random().Next(Int32.MaxValue).ToString();//text.Substring(32, 32); str = GoldTree.smethod_0(str + GoldTree.string_6); str = GoldTree.smethod_0(str + "4g"); str = GoldTree.smethod_1(str + GoldTree.string_7); string b = GoldTree.smethod_0(num.ToString()); DatabaseServer Message3_ = new DatabaseServer(GoldTree.GetConfig().data["db.hostname"], uint.Parse(GoldTree.GetConfig().data["db.port"]), GoldTree.GetConfig().data["db.username"], GoldTree.GetConfig().data["db.password"]); text = "r4r43mfgp3kkkr3mgprekw[gktp6ijhy[h]5h76ju6j7uj7";//text.Substring(64, 96); Database Message2_ = new Database(GoldTree.GetConfig().data["db.name"], uint.Parse(GoldTree.GetConfig().data["db.pool.minsize"]), uint.Parse(GoldTree.GetConfig().data["db.pool.maxsize"])); GoldTree.DatabaseManager = new DatabaseManager(Message3_, Message2_); try { using (DatabaseClient @class = GoldTree.GetDatabase().GetClient()) { @class.ExecuteQuery("UPDATE users SET online = '0'"); @class.ExecuteQuery("UPDATE rooms SET users_now = '0'"); } GoldTree.ConnectionManage.method_7(); GoldTree.Game.ContinueLoading(); } catch { } LicenseTools.String_1 = text; GoldTree.Game = new Game(int.Parse(GoldTree.GetConfig().data["game.tcp.conlimit"])); string text2 = LicenseTools.String_5 + GoldTree.smethod_0((LicenseTools.String_6.Length * 10).ToString()); text2 += GoldTree.smethod_0((LicenseTools.String_3.Length % 10).ToString()); GoldTree.class117_0 = new PacketManager(); GoldTree.class117_0.Handshake(); GoldTree.class117_0.Messenger(); GoldTree.class117_0.Navigator(); GoldTree.class117_0.RoomsAction(); GoldTree.class117_0.RoomsAvatar(); GoldTree.class117_0.RoomsChat(); GoldTree.class117_0.RoomsEngine(); GoldTree.class117_0.RoomsFurniture(); GoldTree.class117_0.RoomsPets(); GoldTree.class117_0.RoomsPools(); GoldTree.class117_0.RoomsSession(); GoldTree.class117_0.RoomsSettings(); GoldTree.class117_0.Catalog(); GoldTree.class117_0.Marketplace(); GoldTree.class117_0.Recycler(); GoldTree.class117_0.Quest(); GoldTree.class117_0.InventoryAchievements(); GoldTree.class117_0.InventoryAvatarFX(); GoldTree.class117_0.InventoryBadges(); GoldTree.class117_0.InventoryFurni(); GoldTree.class117_0.InventoryPurse(); GoldTree.class117_0.InventoryTrading(); GoldTree.class117_0.Avatar(); GoldTree.class117_0.Users(); GoldTree.class117_0.Register(); GoldTree.class117_0.Help(); GoldTree.class117_0.Sound(); GoldTree.class117_0.Wired(); GoldTree.class117_0.Jukebox(); } LicenseTools.int_12 = int.Parse(GoldTree.GetConfig().data["game.tcp.port"]); LicenseTools.int_13 = int.Parse(GoldTree.GetConfig().data["mus.tcp.port"]); try { LicenseTools.ProxyIP = GetConfig().data["game.tcp.proxyip"]; } catch { } GoldTree.MusListener = new MusListener(GoldTree.GetConfig().data["mus.tcp.bindip"], LicenseTools.int_13, GoldTree.GetConfig().data["mus.tcp.allowedaddr"].Split(new char[] { ';' }), 20); GoldTree.ConnectionManage = new SocketsManager(LicenseTools.string_33, LicenseTools.int_12, int.Parse(GoldTree.GetConfig().data["game.tcp.conlimit"])); GoldTree.ConnectionManage.method_3().method_0(); /*try * { * if (int.Parse(GoldTree.GetConfig().data["automatic-error-report"]) < 1 || int.Parse(GoldTree.GetConfig().data["automatic-error-report"]) > 2) * { * Console.ForegroundColor = ConsoleColor.Red; * Logging.WriteLine("Erroreita ei raportoida automaattisesti!!!"); * Console.ForegroundColor = ConsoleColor.Gray; * } * if (int.Parse(GoldTree.GetConfig().data["automatic-error-report"]) == 1) * { * Console.ForegroundColor = ConsoleColor.Green; * Logging.WriteLine("Kaikki errorit reportoidaan automaattisesti"); * Console.ForegroundColor = ConsoleColor.Gray; * } * if (int.Parse(GoldTree.GetConfig().data["automatic-error-report"]) > 1) * { * Console.ForegroundColor = ConsoleColor.Green; * Logging.WriteLine("Vain kritikaaliset virheiden reportoidaan automaattisesti"); * Console.ForegroundColor = ConsoleColor.Gray; * } * } * catch * { * Console.ForegroundColor = ConsoleColor.Red; * Logging.WriteLine("Erroreita ei raportoida automaattisesti!!!"); * Console.ForegroundColor = ConsoleColor.Gray; * }*/ TimeSpan timeSpan = DateTime.Now - now; Logging.WriteLine(string.Concat(new object[] { "Server -> READY! (", timeSpan.Seconds, " s, ", timeSpan.Milliseconds, " ms)" })); Console.Beep(); } catch (KeyNotFoundException) { Logging.WriteLine("Failed to boot, key not found."); Logging.WriteLine("Press any key to shut down ..."); Console.ReadKey(true); GoldTree.smethod_16(); } catch (InvalidOperationException ex) { if (ex.Message.Contains("goldtree")) { Logging.WriteLine("Failed to initialize GoldTreeEmulator"); } else { Logging.WriteLine("Failed to initialize GoldTreeEmulator: " + ex.Message); } Logging.WriteLine("Press any key to shut down ..."); Console.ReadKey(true); GoldTree.smethod_16(); } } }
public void Initialize() { Essential.consoleWriter = new ConsoleWriter(Console.Out); Console.SetOut(Essential.consoleWriter); try { Console.WindowWidth = 130; Console.WindowHeight = 36; } catch { } Essential.ServerStarted = DateTime.Now; Console.Clear(); Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(); Console.WriteLine(@" ______ _ _ _ "); Console.WriteLine(@" | ____| | | (_) | |"); Console.WriteLine(@" | |__ ___ ___ ___ _ __ | |_ _ __ _| |"); Console.WriteLine(@" | __| / __/ __|/ _ \ '_ \| __| |/ _` | |"); Console.WriteLine(@" | |____\__ \__ \ __/ | | | |_| | (_| | |"); Console.WriteLine(@" |______|___/___/\___|_| |_|\__|_|\__,_|_|"); Console.WriteLine(); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine(" Essential Emulator Build " + Build + " by " + Creator); Console.WriteLine(); Console.WriteLine(" Credits to: Meth0d (Uber), Sojobo (Phoenix), Juniori (GTE) & Rootkit (Essential)"); Console.WriteLine(); Console.ResetColor(); try { Essential.Configuration = new ConfigurationData("config.conf"); DateTime now = DateTime.Now; try { Essential.SWFDirectory = Essential.GetConfig().data["web.api.furni.hof_furni"]; } catch { } if (!Directory.Exists("API")) { Directory.CreateDirectory("API"); } DatabaseServer dbServer = new DatabaseServer(Essential.GetConfig().data["db.hostname"], uint.Parse(Essential.GetConfig().data["db.port"]), Essential.GetConfig().data["db.username"], Essential.GetConfig().data["db.password"]); Database database = new Database(Essential.GetConfig().data["db.name"], uint.Parse(Essential.GetConfig().data["db.pool.minsize"]), uint.Parse(Essential.GetConfig().data["db.pool.maxsize"])); Essential.DatabaseManager = new DatabaseManager(dbServer, database); GroupsPartsData.InitGroups(); try { using (DatabaseClient dbClient = Essential.GetDatabase().GetClient()) { dbClient.ExecuteQuery("SET @@global.sql_mode= '';"); dbClient.ExecuteQuery("UPDATE users SET online = '0'"); dbClient.ExecuteQuery("UPDATE rooms SET users_now = '0'"); } Essential.Internal_Game.ContinueLoading(); } catch { } Essential.Internal_Game = new Game(int.Parse(Essential.GetConfig().data["game.tcp.conlimit"])); Essential.PacketManager = new PacketManager(); Essential.PacketManager.Load(); Essential.mhandler = new MobileHandler(); Essential.mhandler.Load(); Console.WriteLine(Essential.PacketManager.Count + " Packets loaded!"); Essential.antiAdSystem = new AntiAd(); Essential.MusListener = new MusListener(Essential.GetConfig().data["mus.tcp.bindip"], int.Parse(Essential.GetConfig().data["mus.tcp.port"]), Essential.GetConfig().data["mus.tcp.allowedaddr"].Split(new char[] { ';' }), 20); Essential.SocketsManager = new SocketsManager(Essential.GetConfig().data["game.tcp.bindip"], int.Parse(Essential.GetConfig().data["game.tcp.port"]), int.Parse(Essential.GetConfig().data["game.tcp.conlimit"])); //ConnectionManage = new ConnectionHandeling(Essential.GetConfig().data["game.tcp.port"], int.Parse(Essential.GetConfig().data["game.tcp.conlimit"]), int.Parse(Essential.GetConfig().data["game.tcp.conlimit"]), true); Essential.HeadImagerURL = Essential.GetConfig().data["eventstream.imager.url"]; using (DatabaseClient dbClient = Essential.GetDatabase().GetClient()) { dbClient.ExecuteQuery("UPDATE server_status SET bannerdata='" + EssentialEnvironment.globalCrypto.Prime + ":" + EssentialEnvironment.globalCrypto.Generator + "';"); } Essential.SocketsManager.method_3().method_0(); webSocketServerManager = new WebSocketServerManager(Essential.GetConfig().data["websocket.url"]); Console.WriteLine("Server started at " + Essential.GetConfig().data["websocket.url"]); webManager = new WebManager(); TimeSpan timeSpan = DateTime.Now - now; Logging.WriteLine(string.Concat(new object[] { "Server -> READY! (", timeSpan.Seconds, " s, ", timeSpan.Milliseconds, " ms)" })); using (DatabaseClient dbClient = Essential.GetDatabase().GetClient()) { dbClient.ExecuteQuery("UPDATE server_status SET server_started='" + Convert.ToInt32(GetUnixTimestamp()) + "'"); } Console.Beep(); } catch (KeyNotFoundException KeyNotFoundException) { Logging.WriteLine("Failed to boot, key not found: " + KeyNotFoundException); Logging.WriteLine("Press any key to shut down ..."); Console.ReadKey(true); Essential.Destroy(); } catch (InvalidOperationException ex) { Logging.WriteLine("Failed to initialize EssentialEmulator: " + ex.Message); Logging.WriteLine("Press any key to shut down ..."); Console.ReadKey(true); Essential.Destroy(); } }
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(); } }