public static void RunSuperSocket() { SuperSocket = new ServerSocket { Socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp) }; ServerSocket.OnReceive = PacketHandler.Handle; IncommingPacketQueue.Start(); SuperSocket.Enable(Port); }
public static void LoadServer(bool KnowConfig) { Time32 Start = Time32.Now; RandomSeed = Convert.ToInt32(DateTime.Now.Ticks.ToString().Remove(DateTime.Now.Ticks.ToString().Length / 2)); Console.Title = "Conquord Is Loading..."; Kernel.Random = new FastRandom(RandomSeed); if (!KnowConfig) { ConquordDBName = "test"; ConquordDBPass = "******"; ConquordIP = "149.202.128.35"; } System.Console.ForegroundColor = ConsoleColor.DarkGray; IntPtr hWnd = FindWindow(null, Console.Title); System.Console.WriteLine(@" ` ______ __ ` ` "); System.Console.WriteLine(@" / ____/___ ____ ____ ___ ______ _________/ / "); System.Console.WriteLine(@" ` / / / __ \/ __ \/ __ `/ / / / __ \/ ___/ __ / ` ` _ "); System.Console.WriteLine(@" _/ /___/ /_/ / / / / /_/ / /_/ / /_/ / / / /_/ / | | "); System.Console.WriteLine(@" ` \____/\____/_/ /_/\__, /\__,_/\____/_/ \__,_/ ` ___| | "); System.Console.WriteLine(@" ` /_/ ` ` ( .' "); System.Console.WriteLine(@" __ ... _____ Michael Nashaat _____ ... __ ) ( "); System.Console.WriteLine(); System.Console.WriteLine(@" Copyright (c) Conquord Project 2015-2016. "); Console.BackgroundColor = ConsoleColor.Black; System.Console.ForegroundColor = ConsoleColor.DarkGray; Database.DataHolder.CreateConnection(ConquordDBName, ConquordDBPass); Database.EntityTable.EntityUID = new Counter(0); new MySqlCommand(MySqlCommandType.UPDATE).Update("entities").Set("Online", 0).Execute(); using (MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT)) { cmd.Select("configuration"); using (MySqlReader r = new MySqlReader(cmd)) { if (r.Read()) { if (!KnowConfig) { ConquordIP = r.ReadString("ConquordIP"); GamePort = 5816; AuthPort = r.ReadUInt16("ConquordPort"); } Database.EntityTable.EntityUID = new Counter(r.ReadUInt32("EntityID")); if (Database.EntityTable.EntityUID.Now == 0) { Database.EntityTable.EntityUID.Now = 1; } Union.UnionCounter = new Counter(r.ReadUInt32("UnionID")); Kernel.ServerKingdom = (r.ReadUInt32("ServerKingdom")); if (r.ReadByte("LastDailySignReset") != DateTime.Now.Month) { MsgSignIn.Reset(); } Game.ConquerStructures.Society.Guild.GuildCounter = new Conquord.Counter(r.ReadUInt32("GuildID")); Network.GamePackets.ConquerItem.ItemUID = new Conquord.Counter(r.ReadUInt32("ItemUID")); Constants.ExtraExperienceRate = r.ReadUInt32("ExperienceRate"); Constants.ExtraSpellRate = r.ReadUInt32("SpellExperienceRate"); Constants.ExtraProficiencyRate = r.ReadUInt32("ProficiencyExperienceRate"); Constants.MoneyDropRate = r.ReadUInt32("MoneyDropRate"); Constants.ConquerPointsDropRate = r.ReadUInt32("ConquerPointsDropRate"); Constants.ItemDropRate = r.ReadUInt32("ItemDropRate"); Constants.ItemDropQualityRates = r.ReadString("ItemDropQualityString").Split('~'); Database.EntityVariableTable.Load(0, out Vars); } } } using (var cmd = new MySqlCommand(MySqlCommandType.UPDATE).Update("configuration")) cmd.Set("LastDailySignReset", DateTime.Now.Month).Execute(); Database.JiangHu.LoadStatus(); Database.JiangHu.LoadJiangHu(); Console.WriteLine("JiangHu Loaded."); Way2Heroes.Load(); QuestInfo.Load(); AuctionBase.Load(); Database.DataHolder.ReadStats(); Conquord.Soul.SoulProtection.Load(); Database.PerfectionTable.Load(); Console.WriteLine("Perfection Loaded."); Database.LotteryTable.Load(); Database.ConquerItemTable.ClearNulledItems(); Database.ConquerItemInformation.Load(); Console.WriteLine("Items Loaded."); Database.GameUpdetess.LoadRates(); Database.MonsterInformation.Load(); Database.IPBan.Load(); Database.SpellTable.Load(); Database.ShopFile.Load(); Database.HonorShop.Load(); Database.RacePointShop.Load(); Database.ChampionShop.Load(); Database.EShopFile.Load(); Database.EShopV2File.Load(); Console.WriteLine("Shops Loaded."); Database.MapsTable.Load(); Database.Flowers.LoadFlowers(); Database.Flowers.SaveFlowers(); Console.WriteLine("Flowers Systems Loaded."); Database.NobilityTable.Load(); Database.ArenaTable.Load(); Database.TeamArenaTable.Load(); Database.GuildTable.Load(); Database.ChiTable.LoadAllChi(); Console.WriteLine("Social Systems Loaded."); Refinery.LoadItems(); StorageManager.Load(); UnionTable.Load(); Console.WriteLine("Union Loaded."); World = new World(); World.Init(); Database.Statue.Load(); Console.WriteLine("Tops And Quests Loaded."); Database.PoketTables.LoadTables(); Database.InnerPowerTable.LoadDBInformation(); Database.InnerPowerTable.Load(); Console.WriteLine("InnerPower Loaded."); Map.CreateTimerFactories(); Database.SignInTable.Load(); Database.DMaps.Load(); Console.WriteLine("Maps Loaded."); Game.Screen.CreateTimerFactories(); World.CreateTournaments(); Game.GuildWar.Initiate(); Game.ClanWar.Initiate(); Game.Tournaments.SkillTournament.LoadSkillTop8(); Game.Tournaments.TeamTournament.LoadTeamTop8(); Clan.LoadClans(); Game.EliteGuildWar.EliteGwint(); Console.WriteLine("Guilds and Clans loaded."); Booths.Load(); Console.WriteLine("Booths Loaded."); Database.FloorItemTable.Load(); Database.ReincarnationTable.Load(); new MsgUserAbilityScore().GetRankingList(); new MsgEquipRefineRank().UpdateRanking(); PrestigeRank.LoadRanking(); Console.WriteLine("Ranks Loaded."); BruteForceProtection.CreatePoll(); Console.WriteLine("Protection System On."); { Client.GameClient gc = new Client.GameClient(new ClientWrapper()); gc.Account = new AccountTable("NONE"); gc.Socket.Alive = false; gc.Entity = new Entity(EntityFlag.Player, false) { Name = "NONE" }; Npcs.GetDialog(new NpcRequest(), gc, true); } #region OpenSocket Network.Cryptography.AuthCryptography.PrepareAuthCryptography(); AuthServer = new ServerSocket(); AuthServer.OnClientConnect += AuthServer_OnClientConnect; AuthServer.OnClientReceive += AuthServer_OnClientReceive; AuthServer.OnClientDisconnect += AuthServer_OnClientDisconnect; AuthServer.Enable(AuthPort, "0.0.0.0"); GameServer = new ServerSocket(); GameServer.OnClientConnect += GameServer_OnClientConnect; GameServer.OnClientReceive += GameServer_OnClientReceive; GameServer.OnClientDisconnect += GameServer_OnClientDisconnect; GameServer.Enable(GamePort, "0.0.0.0"); #endregion Console.WriteLine("Server loaded iN : " + (Time32.Now - Start) + " MilliSeconds."); ConquordHandler += ConquordConsole_CloseEvent; Native.SetConsoleCtrlHandler(ConquordHandler, true); GC.Collect(); WorkConsole(); }