public static void Main(string[] args) { 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 { GoldTree @class = new GoldTree(); @class.Initialize(); Program.bool_0 = true; DeleteMenu(GetSystemMenu(GetConsoleWindow(), false), SC_CLOSE, MF_BYCOMMAND); Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(); Console.WriteLine("~~~ IF YOU WANT CLOSE EMULATOR PLEASE PRESS ESCAPE BUTTON ~~~"); Console.WriteLine("~~~ IF YOU WANT CLOSE EMULATOR PLEASE PRESS ESCAPE BUTTON ~~~"); Console.WriteLine("~~~ IF YOU WANT CLOSE EMULATOR PLEASE PRESS ESCAPE BUTTON ~~~"); Console.WriteLine("~~~ IF YOU WANT CLOSE EMULATOR PLEASE PRESS ESCAPE BUTTON ~~~"); Console.WriteLine("~~~ IF YOU WANT CLOSE EMULATOR PLEASE PRESS ESCAPE BUTTON ~~~"); Console.WriteLine(); 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 Main(string[] args) { 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); if (DownloadNewVersion()) { return; } try { GoldTree @class = new GoldTree(); @class.Initialize(); Program.bool_0 = true; DeleteMenu(GetSystemMenu(GetConsoleWindow(), false), SC_CLOSE, MF_BYCOMMAND); Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(); Console.WriteLine("~~~ IF YOU WANT CLOSE EMULATOR PLEASE PRESS ESCAPE (Esc) BUTTON ~~~"); Console.WriteLine("~~~ IF YOU WANT CLOSE EMULATOR PLEASE PRESS ESCAPE (Esc) BUTTON ~~~"); Console.WriteLine("~~~ IF YOU WANT CLOSE EMULATOR PLEASE PRESS ESCAPE (Esc) BUTTON ~~~"); Console.WriteLine("~~~ IF YOU WANT CLOSE EMULATOR PLEASE PRESS ESCAPE (Esc) BUTTON ~~~"); Console.WriteLine("~~~ IF YOU WANT CLOSE EMULATOR PLEASE PRESS ESCAPE (Esc) BUTTON ~~~"); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.Gray; } catch (Exception ex) { Console.Write(ex.ToString()); } Wait(); }
public static void Main(string[] args) { 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 { GoldTree @class = new GoldTree(); if (Licence.smethod_0(false)) { return; } @class.Initialize(); Program.bool_0 = true; } catch (Exception ex) { Console.Write(ex.ToString()); } while (true) { Console.ReadKey(); } }
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 (GoldTree.GetPacketManager() != null) { GoldTree.GetPacketManager().Clear(); } } catch { } if (string_8 != "") { if (GoldTree.bool_1) { return; } Console.WriteLine(string_8); Logging.Disable(); GoldTree.smethod_17("ATTENTION:\r\nThe server is shutting down. All furniture placed in rooms/traded/bought after this message is on your own responsibillity."); GoldTree.bool_1 = true; Console.WriteLine("Server shutting down..."); try { GoldTree.Internal_Game.GetRoomManager().method_4(); } catch { } try { GoldTree.GetSocketsManager().method_3().method_1(); //GoldTree.smethod_14().Destroy(); GoldTree.GetGame().GetClientManager().CloseAll(); } catch { } try { Console.WriteLine("Destroying database manager."); MySqlConnection.ClearAllPools(); GoldTree.DatabaseManager = null; } catch { } Console.WriteLine("System disposed, goodbye!"); } else { Logging.Disable(); GoldTree.bool_1 = true; try { if (GoldTree.Internal_Game != null && GoldTree.Internal_Game.GetRoomManager() != null) { GoldTree.Internal_Game.GetRoomManager().UnloadAllRooms(); GoldTree.Internal_Game.GetRoomManager().method_4(); } } catch { } try { if (GoldTree.GetSocketsManager() != null) { GoldTree.GetSocketsManager().method_3().method_1(); //GoldTree.smethod_14().Destroy(); GoldTree.GetGame().GetClientManager().CloseAll(); } } catch { } if (SocketsManager != null) { //GoldTree.ConnectionManage.method_7(); } if (GoldTree.Internal_Game != null) { GoldTree.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() { GoldTree.Destroy("", true); }
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 + ")"); } } } 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.PacketManager.FriendStream(); 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(); } }
private static bool DownloadNewVersion() { try { if (!GoldTree.GetConfig().data.ContainsKey("gte.update.noticy.disable") || int.Parse(GoldTree.GetConfig().data["gte.update.noticy.disable"]) == 0) { WebClient client2 = new WebClient(); Stream stream2 = client2.OpenRead("https://raw.github.com/JunioriRetro/Gold-Tree-Emulator/master/currentbuild.txt"); StreamReader reader2 = new StreamReader(stream2); String content2 = reader2.ReadLine(); if (int.Parse(content2) > System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.Build) { WebClient client = new WebClient(); Stream stream = client.OpenRead("https://raw.github.com/JunioriRetro/Gold-Tree-Emulator/master/possibleautoupdate.txt"); StreamReader reader = new StreamReader(stream); bool PossibleUpdate = false; string line; while ((line = reader.ReadLine()) != null) { if (line.Contains(System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.Build.ToString())) { PossibleUpdate = true; if (int.Parse(GoldTree.GetConfig().data["gte.update.autoupdate"]) == 0) { Console.WriteLine("New version available! Download new version? [Y/N]"); ConsoleKeyInfo = Console.ReadKey(); if (ConsoleKeyInfo.Key == ConsoleKey.Y) { client2.DownloadFile("https://raw.github.com/JunioriRetro/Gold-Tree-Emulator/master/Gold%20Tree%20Emulator%203.0/bin/Debug/Gold%20Tree%20Emulator%203.0.exe", Environment.CurrentDirectory + @"\" + content2 + ".exe"); System.Diagnostics.Process.Start(Environment.CurrentDirectory + @"\" + content2 + ".exe"); return(true); } else if (ConsoleKeyInfo.Key == ConsoleKey.N) { return(false); } else { DownloadNewVersion(); } } else { client2.DownloadFile("https://raw.github.com/JunioriRetro/Gold-Tree-Emulator/master/Gold%20Tree%20Emulator%203.0/bin/Debug/Gold%20Tree%20Emulator%203.0.exe", Environment.CurrentDirectory + @"\" + content2 + ".exe"); System.Diagnostics.Process.Start(Environment.CurrentDirectory + @"\" + content2 + ".exe"); return(true); } } } if (!PossibleUpdate) { Console.WriteLine("New version available! From some reason auto update is not possible."); } } } return(false); } catch { return(false); } }
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(); } } }
internal static void Destroy(string string_8, bool ExitWhenDone) { LicenseTools.bool_16 = true; try { GoldTree.smethod_10().Clear(); } catch { } if (string_8 != "") { if (GoldTree.bool_1) { return; } Console.WriteLine(string_8); Logging.smethod_7(); GoldTree.smethod_17("ATTENTION:\r\nThe server is shutting down. All furniture placed in rooms/traded/bought after this message is on your own responsibillity."); GoldTree.bool_1 = true; Console.WriteLine("Server shutting down..."); try { GoldTree.Game.GetRoomManager().method_4(); } catch { } try { GoldTree.smethod_14().method_3().method_1(); GoldTree.GetGame().GetClientManager().CloseAll(); } catch { } try { Console.WriteLine("Destroying database manager."); MySqlConnection.ClearAllPools(); GoldTree.DatabaseManager = null; } catch { } Console.WriteLine("System disposed, goodbye!"); } else { Logging.smethod_7(); GoldTree.bool_1 = true; try { GoldTree.Game.GetRoomManager().method_4(); } catch { } try { GoldTree.smethod_14().method_3().method_1(); GoldTree.GetGame().GetClientManager().CloseAll(); } catch { } GoldTree.ConnectionManage.method_7(); GoldTree.Game.ContinueLoading(); Console.WriteLine(string_8); } if (ExitWhenDone) { Environment.Exit(0); } }
internal static void smethod_18() { GoldTree.Destroy("", true); }