public static void LoadDataBuffers() { //DisabledQuikEdit(); Stopwatch allData = new Stopwatch(); allData.Start(); int count = 0; count += DataProvider.LoadEtc(@".\NX\Etc.nx"); ManualResetEvent[] handles = new ManualResetEvent[6]; for (int i = 0; i < handles.Count(); i++) { handles[i] = new ManualResetEvent(false); } ThreadPool.QueueUserWorkItem(new WaitCallback(LoadMobs), handles[2]); ThreadPool.QueueUserWorkItem(new WaitCallback(LoadEquips), handles[0]); ThreadPool.QueueUserWorkItem(new WaitCallback(LoadItems), handles[1]); ThreadPool.QueueUserWorkItem(new WaitCallback(LoadSkills), handles[3]); ThreadPool.QueueUserWorkItem(new WaitCallback(LoadQuests), handles[4]); handles[2].WaitOne(); //Wait for mob thread to finish ThreadPool.QueueUserWorkItem(new WaitCallback(LoadMaps), handles[5]); //Map needs mob wz info, so wait until mobs finished WaitHandle.WaitAll(handles); //Always do strings after the other WZs! count += DataProvider.LoadStrings(@".\NX\String.nx"); ServerConsole.Info("{0} Strings loaded", count); ServerConsole.Info("Finished loading .NX in {0} ms", (int)allData.ElapsedMilliseconds); Stopwatch sw = new Stopwatch(); sw.Start(); count = DataProvider.LoadScripts(); ServerConsole.Info("{0} Scripts loaded in {1} ms", count, (int)sw.ElapsedMilliseconds); sw.Reset(); /* * sw.Start(); * Count = LoadCashShopItems(); * ServerConsole.Info(String.Format("{0} CashShop items loaded in {1} ms", Count, (int)sw.ElapsedMilliseconds)); * sw.Reset(); */ sw.Start(); count = AdminCommands.ReloadCommands(); count += GMCommands.ReloadCommands(); count += PlayerCommands.ReloadCommands(); count += DonorCommands.ReloadCommands(); ServerConsole.Info("{0} Commands loaded in {1} ms", count, (int)sw.ElapsedMilliseconds); sw.Reset(); LoadMonsterDrops(); allData.Stop(); ServerConsole.Info("All data loaded in {0} ms", (int)allData.ElapsedMilliseconds); ServerConsole.Info("=============================================="); }
public static void Handle(MapleClient c, PacketReader pr) { int tickCount = pr.ReadInt(); string message = pr.ReadMapleString(); byte show = pr.ReadByte(); ServerConsole.Info(c.Account.Character.Name + ": " + message); if (message[0] == '@') { if (PlayerCommands.ProcessCommand(message.Substring(1).Split(' '), c)) { return; } } else if (message[0] == '!') { if (c.Account.IsGM) { string[] split = message.Substring(1).Split(' '); if (GMCommands.ProcessCommand(split, c)) { return; } if (c.Account.IsAdmin) { if (AdminCommands.ProcessCommand(split, c)) { return; } else { c.Account.Character.SendBlueMessage("Unrecognized Admin command"); return; } } else { c.Account.Character.SendBlueMessage("Unrecognized GM command"); return; } } } else if (message[0] == '#') { if (c.Account.IsGM || c.Account.IsDonor) { string[] split = message.Substring(1).Split(' '); if (DonorCommands.ProcessCommand(split, c)) { return; } else { c.Account.Character.SendBlueMessage("Unrecognized Donor command"); return; } } } PacketWriter packet = PlayerChatPacket(c.Account.Character.Id, message, show, c.Account.IsGM); c.Account.Character.Map.BroadcastPacket(packet); }