예제 #1
0
        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("==============================================");
        }