Пример #1
0
 public static void Load()
 {
     if (!RunTimePatch.Applied)
     {
         RunTimePatch.PatchAll();
     }
     if (!Timers.IsRunning)
     {
         Timers.TimerStart();
     }
     if (!LoadTriggers.IsRunning)
     {
         LoadTriggers.Load();
     }
     if (Poll.IsEnabled && PersistentContainer.Instance.PollOpen)
     {
         Poll.CheckTime();
     }
     if (!ClanManager.IsEnabled)
     {
         ClanManager.Clans.Clear();
         ClanManager.ClanMember.Clear();
     }
     if (!InfoTicker.IsEnabled && InfoTicker.IsRunning)
     {
         InfoTicker.Unload();
     }
     if (InfoTicker.IsEnabled && !InfoTicker.IsRunning)
     {
         InfoTicker.Load();
     }
     if (Gimme.IsRunning && !Gimme.IsEnabled)
     {
         Gimme.Unload();
     }
     if (!Gimme.IsRunning && Gimme.IsEnabled)
     {
         Gimme.Load();
     }
     if (Badwords.IsRunning && !Badwords.IsEnabled)
     {
         Badwords.Unload();
     }
     if (!Badwords.IsRunning && Badwords.IsEnabled)
     {
         Badwords.Load();
     }
     if (!LoginNotice.IsRunning && LoginNotice.IsEnabled)
     {
         LoginNotice.Load();
     }
     if (LoginNotice.IsRunning && !LoginNotice.IsEnabled)
     {
         LoginNotice.Unload();
     }
     if (!Zones.IsRunning && Zones.IsEnabled)
     {
         Zones.Load();
     }
     if (Zones.IsRunning && !Zones.IsEnabled)
     {
         Zones.Unload();
     }
     if (!VoteReward.IsRunning && VoteReward.IsEnabled)
     {
         VoteReward.Load();
     }
     if (VoteReward.IsRunning && !VoteReward.IsEnabled)
     {
         VoteReward.Unload();
     }
     if (!Watchlist.IsRunning && Watchlist.IsEnabled)
     {
         Watchlist.Load();
     }
     if (Watchlist.IsRunning && !Watchlist.IsEnabled)
     {
         Watchlist.Unload();
     }
     if (!ReservedSlots.IsRunning && ReservedSlots.IsEnabled)
     {
         ReservedSlots.Load();
     }
     if (ReservedSlots.IsRunning && !ReservedSlots.IsEnabled)
     {
         ReservedSlots.Unload();
     }
     if (!StartingItems.IsRunning && StartingItems.IsEnabled)
     {
         StartingItems.Load();
     }
     if (StartingItems.IsRunning && !StartingItems.IsEnabled)
     {
         StartingItems.Unload();
     }
     if (!Travel.IsRunning && Travel.IsEnabled)
     {
         Travel.Load();
     }
     if (Travel.IsRunning && !Travel.IsEnabled)
     {
         Travel.Unload();
     }
     if (!Shop.IsRunning && Shop.IsEnabled)
     {
         Shop.Load();
     }
     if (Shop.IsRunning && !Shop.IsEnabled)
     {
         Shop.Unload();
     }
     if (!Motd.IsRunning && Motd.IsEnabled)
     {
         Motd.Load();
     }
     if (Motd.IsRunning && !Motd.IsEnabled)
     {
         Motd.Unload();
     }
     if (InvalidItems.IsRunning && !InvalidItems.IsEnabled)
     {
         InvalidItems.Unload();
     }
     if (!InvalidItems.IsRunning && InvalidItems.IsEnabled)
     {
         InvalidItems.Load();
     }
     if (HighPingKicker.IsRunning && !HighPingKicker.IsEnabled)
     {
         HighPingKicker.Unload();
     }
     if (!HighPingKicker.IsRunning && HighPingKicker.IsEnabled)
     {
         HighPingKicker.Load();
     }
     if (CredentialCheck.IsRunning && !CredentialCheck.IsEnabled)
     {
         CredentialCheck.Unload();
     }
     if (!CredentialCheck.IsRunning && CredentialCheck.IsEnabled)
     {
         CredentialCheck.Load();
     }
     if (CustomCommands.IsRunning && !CustomCommands.IsEnabled)
     {
         CustomCommands.Unload();
     }
     if (!CustomCommands.IsRunning && CustomCommands.IsEnabled)
     {
         CustomCommands.Load();
     }
     if (DupeLog.IsRunning && !DupeLog.IsEnabled)
     {
         DupeLog.Unload();
     }
     if (!DupeLog.IsRunning && DupeLog.IsEnabled)
     {
         DupeLog.Load();
     }
     if (ChatColorPrefix.IsRunning && !ChatColorPrefix.IsEnabled)
     {
         ChatColorPrefix.Unload();
     }
     if (!ChatColorPrefix.IsRunning && ChatColorPrefix.IsEnabled)
     {
         ChatColorPrefix.Load();
     }
     if (KillNotice.IsRunning && !KillNotice.IsEnabled)
     {
         KillNotice.Unload();
     }
     if (!KillNotice.IsRunning && KillNotice.IsEnabled)
     {
         KillNotice.Load();
     }
     if (Prayer.IsRunning && !Prayer.IsEnabled)
     {
         Prayer.Unload();
     }
     if (!Prayer.IsRunning && Prayer.IsEnabled)
     {
         Prayer.Load();
     }
     if (BloodmoonWarrior.IsRunning && !BloodmoonWarrior.IsEnabled)
     {
         BloodmoonWarrior.Unload();
     }
     if (!BloodmoonWarrior.IsRunning && BloodmoonWarrior.IsEnabled)
     {
         BloodmoonWarrior.Load();
     }
     if (ProtectedSpaces.IsRunning && !ProtectedSpaces.IsEnabled)
     {
         ProtectedSpaces.Unload();
     }
     if (!ProtectedSpaces.IsRunning && ProtectedSpaces.IsEnabled)
     {
         ProtectedSpaces.Load();
     }
     if (ClanManager.IsEnabled)
     {
         ClanManager.ClanList();
     }
     if (Auction.IsEnabled)
     {
         Auction.AuctionList();
     }
     if (Mute.IsEnabled)
     {
         Mute.ClientMuteList();
         Mute.MuteList();
     }
     if (Jail.IsEnabled)
     {
         Jail.JailList();
     }
     //always load the website last
     if (WebsiteServer.IsEnabled && !WebsiteServer.DirFound)
     {
         WebsiteServer.CheckDir();
     }
     if (WebsiteServer.IsRunning && !WebsiteServer.IsEnabled)
     {
         WebsiteServer.Unload();
     }
     if (!WebsiteServer.IsRunning && WebsiteServer.IsEnabled && WebsiteServer.DirFound)
     {
         WebsiteServer.Load();
     }
 }
Пример #2
0
 public static void Load(int _state)
 {
     if (_state == 1)
     {
         try
         {
             Log.Out(string.Format("[SERVERTOOLS] Checking for save directory {0}", API.ConfigPath));
             if (!Directory.Exists(API.ConfigPath))
             {
                 Directory.CreateDirectory(API.ConfigPath);
                 Log.Out(string.Format("[SERVERTOOLS] Created directory {0}", API.ConfigPath));
             }
             if (!Directory.Exists(API.ConfigPath + "/Logs/ChatLogs"))
             {
                 Directory.CreateDirectory(API.ConfigPath + "/Logs/ChatLogs");
             }
             if (!Directory.Exists(API.ConfigPath + "/Logs/DetectionLogs"))
             {
                 Directory.CreateDirectory(API.ConfigPath + "/Logs/DetectionLogs");
             }
             if (!Directory.Exists(API.ConfigPath + "/Logs/BountyLogs"))
             {
                 Directory.CreateDirectory(API.ConfigPath + "/Logs/BountyLogs");
             }
             if (!Directory.Exists(API.ConfigPath + "/Logs/AuctionLog"))
             {
                 Directory.CreateDirectory(API.ConfigPath + "/Logs/AuctionLogs");
             }
             if (!Directory.Exists(API.ConfigPath + "/Logs/BankLogs"))
             {
                 Directory.CreateDirectory(API.ConfigPath + "/Logs/BankLogs");
             }
             if (!Directory.Exists(API.ConfigPath + "/Logs/DupeLogs"))
             {
                 Directory.CreateDirectory(API.ConfigPath + "/Logs/DupeLogs");
             }
             if (!Directory.Exists(API.ConfigPath + "/Logs/PlayerLogs"))
             {
                 Directory.CreateDirectory(API.ConfigPath + "/Logs/PlayerLogs");
             }
             if (!Directory.Exists(API.ConfigPath + "/Logs/PlayerReports"))
             {
                 Directory.CreateDirectory(API.ConfigPath + "/Logs/PlayerReports");
             }
             if (!Directory.Exists(API.ConfigPath + "/Logs/PollLogs"))
             {
                 Directory.CreateDirectory(API.ConfigPath + "/Logs/PollLogs");
             }
             if (!Directory.Exists(API.ConfigPath + "/Logs/ChatCommandLogs"))
             {
                 Directory.CreateDirectory(API.ConfigPath + "/Logs/ChatCommandLogs");
             }
             if (!Directory.Exists(API.ConfigPath + "/Logs/DamageLogs"))
             {
                 Directory.CreateDirectory(API.ConfigPath + "/Logs/DamageLogs");
             }
             if (!Directory.Exists(API.ConfigPath + "/Logs/BlockLogs"))
             {
                 Directory.CreateDirectory(API.ConfigPath + "/Logs/BlockLogs");
             }
             if (!Directory.Exists(API.ConfigPath + "/Logs/ConsoleCommandLogs"))
             {
                 Directory.CreateDirectory(API.ConfigPath + "/Logs/ConsoleCommandLogs");
             }
             if (!Directory.Exists(API.ConfigPath + "/Logs/WebsiteLogs"))
             {
                 Directory.CreateDirectory(API.ConfigPath + "/Logs/WebsiteLogs");
             }
             if (!Directory.Exists(API.ConfigPath + "/Logs/OutputLogs"))
             {
                 Directory.CreateDirectory(API.ConfigPath + "/Logs/OutputLogs");
             }
         }
         catch (XmlException e)
         {
             Log.Out(string.Format("[SERVERTOOLS] Error in creation of directory {0}. Error = {1}", API.ConfigPath, e.Message));
         }
         Load(2);
     }
     else if (_state == 2)
     {
         try
         {
             StateManager.Awake();
         }
         catch (XmlException e)
         {
             Log.Out("[SERVERTOOLS] Failed to load the persistent database bin file. Restart the server and check for errors. Error = {0}", e.Message);
         }
         Load(3);
     }
     else if (_state == 3)
     {
         try
         {
             LoadConfig.Load();
         }
         catch (XmlException e)
         {
             Log.Out("[SERVERTOOLS] Failed to load the configuration file. Error = {0}", e.Message);
         }
         Load(4);
     }
     else if (_state == 4)
     {
         try
         {
             Mods.Load();
         }
         catch (XmlException e)
         {
             Log.Out("[SERVERTOOLS] Failed to load the tools. Restart the server and check for errors. Error = {0}", e.Message);
         }
         Load(5);
     }
     else if (_state == 5)
     {
         try
         {
             LoadTriggers.LoadXml();
         }
         catch (XmlException e)
         {
             Log.Out("[SERVERTOOLS] Failed to load the EventTriggers.xml. Check for errors in the file. Error = {0}", e.Message);
         }
         Load(6);
     }
     else if (_state == 6)
     {
         try
         {
             Phrases.Load();
         }
         catch (XmlException e)
         {
             Log.Out("[SERVERTOOLS] Failed to load the Phrases.xml. Restart the server and check for errors. Error = {0}", e.Message);
         }
         try
         {
             HowToSetup.Load();
         }
         catch (XmlException e)
         {
             Log.Out("[SERVERTOOLS] Failed to load the HowToSetup.xml. Error = {0}", e.Message);
         }
         Load(7);
     }
     else if (_state == 7)
     {
         if (Fps.IsEnabled)
         {
             try
             {
                 Fps.SetTarget();
             }
             catch (XmlException e)
             {
                 Log.Out("[SERVERTOOLS] Failed to set the target fps. Error = {0}", e.Message);
             }
         }
         Load(8);
     }
     else if (_state == 8)
     {
         Log.Out(string.Format("[SERVERTOOLS] Deleting old logs"));
         int      _daysBeforeDeleted = Days_Before_Log_Delete * -1;
         string[] files = Directory.GetFiles(API.ConfigPath + "/Logs/DetectionLogs");
         if (files != null && files.Length > 0)
         {
             foreach (string file in files)
             {
                 FileInfo fi = new FileInfo(file);
                 if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                 {
                     fi.Delete();
                 }
             }
         }
         files = Directory.GetFiles(API.ConfigPath + "/Logs/BountyLogs");
         if (files != null && files.Length > 0)
         {
             foreach (string file in files)
             {
                 FileInfo fi = new FileInfo(file);
                 if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                 {
                     fi.Delete();
                 }
             }
         }
         files = Directory.GetFiles(API.ConfigPath + "/Logs/AuctionLogs");
         if (files != null && files.Length > 0)
         {
             foreach (string file in files)
             {
                 FileInfo fi = new FileInfo(file);
                 if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                 {
                     fi.Delete();
                 }
             }
         }
         files = Directory.GetFiles(API.ConfigPath + "/Logs/BankLogs");
         if (files != null && files.Length > 0)
         {
             foreach (string file in files)
             {
                 FileInfo fi = new FileInfo(file);
                 if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                 {
                     fi.Delete();
                 }
             }
         }
         files = Directory.GetFiles(API.ConfigPath + "/Logs/DupeLogs");
         if (files != null && files.Length > 0)
         {
             foreach (string file in files)
             {
                 FileInfo fi = new FileInfo(file);
                 if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                 {
                     fi.Delete();
                 }
             }
         }
         files = Directory.GetFiles(API.ConfigPath + "/Logs/PlayerLogs");
         if (files != null && files.Length > 0)
         {
             foreach (string file in files)
             {
                 FileInfo fi = new FileInfo(file);
                 if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                 {
                     fi.Delete();
                 }
             }
         }
         files = Directory.GetFiles(API.ConfigPath + "/Logs/PlayerReports");
         if (files != null && files.Length > 0)
         {
             foreach (string file in files)
             {
                 FileInfo fi = new FileInfo(file);
                 if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                 {
                     fi.Delete();
                 }
             }
         }
         files = Directory.GetFiles(API.ConfigPath + "/Logs/PollLogs");
         if (files != null && files.Length > 0)
         {
             foreach (string file in files)
             {
                 FileInfo fi = new FileInfo(file);
                 if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                 {
                     fi.Delete();
                 }
             }
         }
         files = Directory.GetFiles(API.ConfigPath + "/Logs/ChatLogs");
         if (files != null && files.Length > 0)
         {
             foreach (string file in files)
             {
                 FileInfo fi = new FileInfo(file);
                 if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                 {
                     fi.Delete();
                 }
             }
         }
         files = Directory.GetFiles(API.ConfigPath + "/Logs/ChatCommandLogs");
         if (files != null && files.Length > 0)
         {
             foreach (string file in files)
             {
                 FileInfo fi = new FileInfo(file);
                 if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                 {
                     fi.Delete();
                 }
             }
         }
         files = Directory.GetFiles(API.ConfigPath + "/Logs/DamageLogs");
         if (files != null && files.Length > 0)
         {
             foreach (string file in files)
             {
                 FileInfo fi = new FileInfo(file);
                 if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                 {
                     fi.Delete();
                 }
             }
         }
         files = Directory.GetFiles(API.ConfigPath + "/Logs/BlockLogs");
         if (files != null && files.Length > 0)
         {
             foreach (string file in files)
             {
                 FileInfo fi = new FileInfo(file);
                 if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                 {
                     fi.Delete();
                 }
             }
         }
         files = Directory.GetFiles(API.ConfigPath + "/Logs/ConsoleCommandLogs");
         if (files != null && files.Length > 0)
         {
             foreach (string file in files)
             {
                 FileInfo fi = new FileInfo(file);
                 if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                 {
                     fi.Delete();
                 }
             }
         }
         files = Directory.GetFiles(API.ConfigPath + "/Logs/WebsiteLogs");
         if (files != null && files.Length > 0)
         {
             foreach (string file in files)
             {
                 FileInfo fi = new FileInfo(file);
                 if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                 {
                     fi.Delete();
                 }
             }
         }
         files = Directory.GetFiles(API.ConfigPath + "/Logs/OutputLogs");
         if (files != null && files.Length > 0)
         {
             foreach (string file in files)
             {
                 FileInfo fi = new FileInfo(file);
                 if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                 {
                     fi.Delete();
                 }
             }
         }
         Log.Out(string.Format("[SERVERTOOLS] Log clean up completed"));
         Load(9);
     }
     else if (_state == 9)
     {
         RestartVote.Startup = true;
         Load(10);
     }
     else if (_state == 10)
     {
         Track.Cleanup();
         Load(11);
     }
     else if (_state == 11)
     {
         CountryBan.FileCheck();
         Load(12);
     }
     else if (_state == 12)
     {
         Timers.LogAlert();
         Timers.LoadAlert();
     }
 }
Пример #3
0
        public static void Load()
        {
            Timers.TimerStart();
            Timers.Timer2Start();
            if (CountryBan.IsEnabled)
            {
                CountryBan.Load();
            }
            string    _sql    = "SELECT pollOpen FROM Polls WHERE pollOpen = 'true'";
            DataTable _result = SQL.TQuery(_sql);

            if (_result.Rows.Count > 0)
            {
                PollConsole.Check();
            }
            _result.Dispose();
            if (ClanManager.IsEnabled)
            {
                ClanManager.GetClans();
                ClanManager.BuildList();
            }
            if (!ClanManager.IsEnabled)
            {
                ClanManager.Clans.Clear();
                ClanManager.ClanMember.Clear();
            }
            if (!InfoTicker.IsEnabled && InfoTicker.IsRunning)
            {
                InfoTicker.Unload();
            }
            if (InfoTicker.IsEnabled && !InfoTicker.IsRunning)
            {
                InfoTicker.Load();
            }
            if (Gimme.IsRunning && !Gimme.IsEnabled)
            {
                Gimme.Unload();
            }
            if (!Gimme.IsRunning && Gimme.IsEnabled)
            {
                Gimme.Load();
            }
            if (Badwords.IsRunning && !Badwords.IsEnabled)
            {
                Badwords.Unload();
            }
            if (!Badwords.IsRunning && Badwords.IsEnabled)
            {
                Badwords.Load();
            }
            if (!LoginNotice.IsRunning && LoginNotice.IsEnabled)
            {
                LoginNotice.Load();
            }
            if (LoginNotice.IsRunning && !LoginNotice.IsEnabled)
            {
                LoginNotice.Unload();
            }
            if (!Zones.IsRunning && Zones.IsEnabled)
            {
                Zones.Load();
            }
            if (Zones.IsRunning && !Zones.IsEnabled)
            {
                Zones.Unload();
            }
            if (!VoteReward.IsRunning && VoteReward.IsEnabled)
            {
                VoteReward.Load();
            }
            if (VoteReward.IsRunning && !VoteReward.IsEnabled)
            {
                VoteReward.Unload();
            }
            if (!Watchlist.IsRunning && Watchlist.IsEnabled)
            {
                Watchlist.Load();
            }
            if (Watchlist.IsRunning && !Watchlist.IsEnabled)
            {
                Watchlist.Unload();
            }
            if (!ReservedSlots.IsRunning && ReservedSlots.IsEnabled)
            {
                ReservedSlots.Load();
            }
            if (ReservedSlots.IsRunning && !ReservedSlots.IsEnabled)
            {
                ReservedSlots.Unload();
            }
            if (!StartingItems.IsRunning && StartingItems.IsEnabled)
            {
                StartingItems.Load();
            }
            if (StartingItems.IsRunning && !StartingItems.IsEnabled)
            {
                StartingItems.Unload();
            }
            if (!Travel.IsRunning && Travel.IsEnabled)
            {
                Travel.Load();
            }
            if (Travel.IsRunning && !Travel.IsEnabled)
            {
                Travel.Unload();
            }
            if (!Shop.IsRunning && Shop.IsEnabled)
            {
                Shop.Load();
            }
            if (Shop.IsRunning && !Shop.IsEnabled)
            {
                Shop.Unload();
            }
            if (!Motd.IsRunning && Motd.IsEnabled)
            {
                Motd.Load();
            }
            if (Motd.IsRunning && !Motd.IsEnabled)
            {
                Motd.Unload();
            }
            if (InventoryCheck.IsRunning && !InventoryCheck.IsEnabled)
            {
                InventoryCheck.Unload();
            }
            if (!InventoryCheck.IsRunning && InventoryCheck.IsEnabled)
            {
                InventoryCheck.Load();
            }
            if (HighPingKicker.IsEnabled)
            {
                HighPingKicker.Load();
            }
            if (CredentialCheck.IsRunning && !CredentialCheck.IsEnabled)
            {
                CredentialCheck.Unload();
            }
            if (!CredentialCheck.IsRunning && CredentialCheck.IsEnabled)
            {
                CredentialCheck.Load();
            }
            if (CustomCommands.IsRunning && !CustomCommands.IsEnabled)
            {
                CustomCommands.Unload();
            }
            if (!CustomCommands.IsRunning && CustomCommands.IsEnabled)
            {
                CustomCommands.Load();
            }
            if (DupeLog.IsRunning && !DupeLog.IsEnabled)
            {
                DupeLog.Unload();
            }
            if (!DupeLog.IsRunning && DupeLog.IsEnabled)
            {
                DupeLog.Load();
            }
            if (ChatColorPrefix.IsRunning && !ChatColorPrefix.IsEnabled)
            {
                ChatColorPrefix.Unload();
            }
            if (!ChatColorPrefix.IsRunning && ChatColorPrefix.IsEnabled)
            {
                ChatColorPrefix.Load();
            }
            if (LoadTriggers.IsRunning)
            {
                LoadTriggers.Unload();
            }
            if (!LoadTriggers.IsRunning)
            {
                LoadTriggers.Load();
            }
            if (MutePlayer.IsEnabled)
            {
                MutePlayer.MuteList();
            }
            if (Jail.IsEnabled)
            {
                Jail.JailList();
            }
            if (AutoShutdown.IsEnabled)
            {
                AutoShutdown.ShutdownTime();
            }
        }
Пример #4
0
        public static void Load()
        {
            Timers.TimerStart();
            Timers.Timer2Start();
            string    _sql    = "SELECT pollOpen FROM Polls WHERE pollOpen = 'true'";
            DataTable _result = SQL.TypeQuery(_sql);

            if (_result.Rows.Count > 0)
            {
                PollConsole.Check();
            }
            _result.Dispose();
            if (!ClanManager.IsEnabled)
            {
                ClanManager.Clans.Clear();
                ClanManager.ClanMember.Clear();
            }
            if (!InfoTicker.IsEnabled && InfoTicker.IsRunning)
            {
                InfoTicker.Unload();
            }
            if (InfoTicker.IsEnabled && !InfoTicker.IsRunning)
            {
                InfoTicker.Load();
            }
            if (Gimme.IsRunning && !Gimme.IsEnabled)
            {
                Gimme.Unload();
            }
            if (!Gimme.IsRunning && Gimme.IsEnabled)
            {
                Gimme.Load();
            }
            if (Badwords.IsRunning && !Badwords.IsEnabled)
            {
                Badwords.Unload();
            }
            if (!Badwords.IsRunning && Badwords.IsEnabled)
            {
                Badwords.Load();
            }
            if (!LoginNotice.IsRunning && LoginNotice.IsEnabled)
            {
                LoginNotice.Load();
            }
            if (LoginNotice.IsRunning && !LoginNotice.IsEnabled)
            {
                LoginNotice.Unload();
            }
            if (!Zones.IsRunning && Zones.IsEnabled)
            {
                Zones.Load();
            }
            if (Zones.IsRunning && !Zones.IsEnabled)
            {
                Zones.Unload();
            }
            if (!VoteReward.IsRunning && VoteReward.IsEnabled)
            {
                VoteReward.Load();
            }
            if (VoteReward.IsRunning && !VoteReward.IsEnabled)
            {
                VoteReward.Unload();
            }
            if (!Watchlist.IsRunning && Watchlist.IsEnabled)
            {
                Watchlist.Load();
            }
            if (Watchlist.IsRunning && !Watchlist.IsEnabled)
            {
                Watchlist.Unload();
            }
            if (!ReservedSlots.IsRunning && ReservedSlots.IsEnabled)
            {
                ReservedSlots.Load();
            }
            if (ReservedSlots.IsRunning && !ReservedSlots.IsEnabled)
            {
                ReservedSlots.Unload();
            }
            if (!StartingItems.IsRunning && StartingItems.IsEnabled)
            {
                StartingItems.Load();
            }
            if (StartingItems.IsRunning && !StartingItems.IsEnabled)
            {
                StartingItems.Unload();
            }
            if (!Travel.IsRunning && Travel.IsEnabled)
            {
                Travel.Load();
            }
            if (Travel.IsRunning && !Travel.IsEnabled)
            {
                Travel.Unload();
            }
            if (!Shop.IsRunning && Shop.IsEnabled)
            {
                Shop.Load();
            }
            if (Shop.IsRunning && !Shop.IsEnabled)
            {
                Shop.Unload();
            }
            if (!Motd.IsRunning && Motd.IsEnabled)
            {
                Motd.Load();
            }
            if (Motd.IsRunning && !Motd.IsEnabled)
            {
                Motd.Unload();
            }
            if (InventoryCheck.IsRunning && !InventoryCheck.IsEnabled)
            {
                InventoryCheck.Unload();
            }
            if (!InventoryCheck.IsRunning && InventoryCheck.IsEnabled)
            {
                InventoryCheck.Load();
            }
            if (HighPingKicker.IsEnabled)
            {
                HighPingKicker.Load();
            }
            if (CredentialCheck.IsRunning && !CredentialCheck.IsEnabled)
            {
                CredentialCheck.Unload();
            }
            if (!CredentialCheck.IsRunning && CredentialCheck.IsEnabled)
            {
                CredentialCheck.Load();
            }
            if (CustomCommands.IsRunning && !CustomCommands.IsEnabled)
            {
                CustomCommands.Unload();
            }
            if (!CustomCommands.IsRunning && CustomCommands.IsEnabled)
            {
                CustomCommands.Load();
            }
            if (DupeLog.IsRunning && !DupeLog.IsEnabled)
            {
                DupeLog.Unload();
            }
            if (!DupeLog.IsRunning && DupeLog.IsEnabled)
            {
                DupeLog.Load();
            }
            if (ChatColorPrefix.IsRunning && !ChatColorPrefix.IsEnabled)
            {
                ChatColorPrefix.Unload();
            }
            if (!ChatColorPrefix.IsRunning && ChatColorPrefix.IsEnabled)
            {
                ChatColorPrefix.Load();
            }
            if (KillNotice.IsRunning && !KillNotice.IsEnabled)
            {
                KillNotice.Unload();
            }
            if (!KillNotice.IsRunning && KillNotice.IsEnabled)
            {
                KillNotice.Load();
            }
            if (!Prayer.IsRunning && Prayer.IsEnabled)
            {
                Prayer.Load();
            }
            if (Prayer.IsRunning && !Prayer.IsEnabled)
            {
                Prayer.Unload();
            }
            if (LoadTriggers.IsRunning)
            {
                LoadTriggers.Unload();
            }
            if (!LoadTriggers.IsRunning)
            {
                LoadTriggers.Load();
            }
            if (ProtectedSpace.IsRunning)
            {
                ProtectedSpace.Unload();
            }
            if (!ProtectedSpace.IsRunning)
            {
                ProtectedSpace.Load();
            }
            if (ClanManager.IsEnabled)
            {
                ClanManager.ClanList();
            }
            if (AuctionBox.IsEnabled)
            {
                AuctionBox.AuctionList();
            }
            if (Mute.IsEnabled)
            {
                Mute.MuteList();
            }
            if (Jail.IsEnabled)
            {
                Jail.JailList();
            }
            if (BattleLogger.IsEnabled && !BattleLogger.LogFound && !string.IsNullOrEmpty(Utils.GetApplicationScratchPath()))
            {
                if (!GamePrefs.GetString(EnumGamePrefs.ServerDisabledNetworkProtocols).ToLower().Contains("litenetlib"))
                {
                    BattleLogger.LogDirectory = Utils.GetApplicationScratchPath();
                    BattleLogger.ConfirmLog();
                }
                else
                {
                    Log.Out("--------------------------------------------------------------------------");
                    Log.Out("[SERVERTOOLS] Unable to verify log file. Battle_Loggers has been disabled.");
                    Log.Out("[SERVERTOOLS] Network protocol litenetlib is required for this tool.");
                    Log.Out("--------------------------------------------------------------------");
                }
            }
            PatchTools.ApplyPatches();
        }
Пример #5
0
        public static void Load()
        {
            Confirm.Exec();
            PatchTools.ApplyPatches();
            if (!LoadTriggers.IsRunning)
            {
                LoadTriggers.Load();
            }
            Timers.TimerStart();
            string    _sql    = "SELECT pollOpen FROM Polls WHERE pollOpen = 'true'";
            DataTable _result = SQL.TypeQuery(_sql);

            if (_result.Rows.Count > 0)
            {
                PollConsole.Check();
            }
            _result.Dispose();
            if (!ClanManager.IsEnabled)
            {
                ClanManager.Clans.Clear();
                ClanManager.ClanMember.Clear();
            }
            if (!InfoTicker.IsEnabled && InfoTicker.IsRunning)
            {
                InfoTicker.Unload();
            }
            if (InfoTicker.IsEnabled && !InfoTicker.IsRunning)
            {
                InfoTicker.Load();
            }
            if (Gimme.IsRunning && !Gimme.IsEnabled)
            {
                Gimme.Unload();
            }
            if (!Gimme.IsRunning && Gimme.IsEnabled)
            {
                Gimme.Load();
            }
            if (Badwords.IsRunning && !Badwords.IsEnabled)
            {
                Badwords.Unload();
            }
            if (!Badwords.IsRunning && Badwords.IsEnabled)
            {
                Badwords.Load();
            }
            if (!LoginNotice.IsRunning && LoginNotice.IsEnabled)
            {
                LoginNotice.Load();
            }
            if (LoginNotice.IsRunning && !LoginNotice.IsEnabled)
            {
                LoginNotice.Unload();
            }
            if (!Zones.IsRunning && Zones.IsEnabled)
            {
                Zones.Load();
            }
            if (Zones.IsRunning && !Zones.IsEnabled)
            {
                Zones.Unload();
            }
            if (!VoteReward.IsRunning && VoteReward.IsEnabled)
            {
                VoteReward.Load();
            }
            if (VoteReward.IsRunning && !VoteReward.IsEnabled)
            {
                VoteReward.Unload();
            }
            if (!Watchlist.IsRunning && Watchlist.IsEnabled)
            {
                Watchlist.Load();
            }
            if (Watchlist.IsRunning && !Watchlist.IsEnabled)
            {
                Watchlist.Unload();
            }
            if (!ReservedSlots.IsRunning && ReservedSlots.IsEnabled)
            {
                ReservedSlots.Load();
            }
            if (ReservedSlots.IsRunning && !ReservedSlots.IsEnabled)
            {
                ReservedSlots.Unload();
            }
            if (!StartingItems.IsRunning && StartingItems.IsEnabled)
            {
                StartingItems.Load();
            }
            if (StartingItems.IsRunning && !StartingItems.IsEnabled)
            {
                StartingItems.Unload();
            }
            if (!Travel.IsRunning && Travel.IsEnabled)
            {
                Travel.Load();
            }
            if (Travel.IsRunning && !Travel.IsEnabled)
            {
                Travel.Unload();
            }
            if (!Shop.IsRunning && Shop.IsEnabled)
            {
                Shop.Load();
            }
            if (Shop.IsRunning && !Shop.IsEnabled)
            {
                Shop.Unload();
            }
            if (!Motd.IsRunning && Motd.IsEnabled)
            {
                Motd.Load();
            }
            if (Motd.IsRunning && !Motd.IsEnabled)
            {
                Motd.Unload();
            }
            if (InvalidItems.IsRunning && !InvalidItems.IsEnabled)
            {
                InvalidItems.Unload();
            }
            if (!InvalidItems.IsRunning && InvalidItems.IsEnabled)
            {
                InvalidItems.Load();
            }
            if (HighPingKicker.IsRunning && !HighPingKicker.IsEnabled)
            {
                HighPingKicker.Unload();
            }
            if (!HighPingKicker.IsRunning && HighPingKicker.IsEnabled)
            {
                HighPingKicker.Load();
            }
            if (CredentialCheck.IsRunning && !CredentialCheck.IsEnabled)
            {
                CredentialCheck.Unload();
            }
            if (!CredentialCheck.IsRunning && CredentialCheck.IsEnabled)
            {
                CredentialCheck.Load();
            }
            if (CustomCommands.IsRunning && !CustomCommands.IsEnabled)
            {
                CustomCommands.Unload();
            }
            if (!CustomCommands.IsRunning && CustomCommands.IsEnabled)
            {
                CustomCommands.Load();
            }
            if (DupeLog.IsRunning && !DupeLog.IsEnabled)
            {
                DupeLog.Unload();
            }
            if (!DupeLog.IsRunning && DupeLog.IsEnabled)
            {
                DupeLog.Load();
            }
            if (ChatColorPrefix.IsRunning && !ChatColorPrefix.IsEnabled)
            {
                ChatColorPrefix.Unload();
            }
            if (!ChatColorPrefix.IsRunning && ChatColorPrefix.IsEnabled)
            {
                ChatColorPrefix.Load();
            }
            if (KillNotice.IsRunning && !KillNotice.IsEnabled)
            {
                KillNotice.Unload();
            }
            if (!KillNotice.IsRunning && KillNotice.IsEnabled)
            {
                KillNotice.Load();
            }
            if (Prayer.IsRunning && !Prayer.IsEnabled)
            {
                Prayer.Unload();
            }
            if (!Prayer.IsRunning && Prayer.IsEnabled)
            {
                Prayer.Load();
            }
            if (BloodmoonWarrior.IsRunning && !BloodmoonWarrior.IsEnabled)
            {
                BloodmoonWarrior.Unload();
            }
            if (!BloodmoonWarrior.IsRunning && BloodmoonWarrior.IsEnabled)
            {
                BloodmoonWarrior.Load();
            }
            if (ProtectedSpaces.IsRunning && !ProtectedSpaces.IsEnabled)
            {
                ProtectedSpaces.Unload();
            }
            if (!ProtectedSpaces.IsRunning && ProtectedSpaces.IsEnabled)
            {
                ProtectedSpaces.Load();
            }
            if (ClanManager.IsEnabled)
            {
                ClanManager.ClanList();
            }
            if (AuctionBox.IsEnabled)
            {
                AuctionBox.AuctionList();
            }
            if (Mute.IsEnabled)
            {
                Mute.ClientMuteList();
                Mute.MuteList();
            }
            if (Jail.IsEnabled)
            {
                Jail.JailList();
            }
            //always load the website last
            if (WebsiteServer.IsEnabled && !WebsiteServer.DirFound)
            {
                WebsiteServer.CheckDir();
            }
            if (WebsiteServer.IsRunning && !WebsiteServer.IsEnabled)
            {
                WebsiteServer.Unload();
            }
            if (!WebsiteServer.IsRunning && WebsiteServer.IsEnabled && WebsiteServer.DirFound)
            {
                WebsiteServer.Load();
            }
        }
Пример #6
0
        public static void Load(int _state)
        {
            if (_state == 1)
            {
                try
                {
                    Log.Out(string.Format("[ServerTools] Checking for save directory {0}", API.ConfigPath));
                    if (!Directory.Exists(API.ConfigPath))
                    {
                        Directory.CreateDirectory(API.ConfigPath);
                        Log.Out(string.Format("[ServerTools] Created directory {0}", API.ConfigPath));
                    }
                    else
                    {
                        Log.Out("[ServerTools] Directory found");
                    }
                    Log.Out(string.Format("[ServerTools] Checking for logs directory {0}", API.ConfigPath + "/Logs/ChatLogs"));
                    if (!Directory.Exists(API.ConfigPath + "/Logs/ChatLogs"))
                    {
                        Directory.CreateDirectory(API.ConfigPath + "/Logs/ChatLogs");
                        Log.Out(string.Format("[ServerTools] Created directory {0}", API.ConfigPath + "/Logs/ChatLogs"));
                    }
                    else
                    {
                        Log.Out("[ServerTools] Directory found");
                    }
                    Log.Out(string.Format("[ServerTools] Checking for logs directory {0}", API.ConfigPath + "/Logs/DetectionLogs"));
                    if (!Directory.Exists(API.ConfigPath + "/Logs/DetectionLogs"))
                    {
                        Directory.CreateDirectory(API.ConfigPath + "/Logs/DetectionLogs");
                        Log.Out(string.Format("[ServerTools] Created directory {0}", API.ConfigPath + "/Logs/DetectionLogs"));
                    }
                    else
                    {
                        Log.Out("[ServerTools] Directory found");
                    }
                    Log.Out(string.Format("[ServerTools] Checking for logs directory {0}", API.ConfigPath + "/Logs/BountyLogs"));
                    if (!Directory.Exists(API.ConfigPath + "/Logs/BountyLogs"))
                    {
                        Directory.CreateDirectory(API.ConfigPath + "/Logs/BountyLogs");
                        Log.Out(string.Format("[ServerTools] Created directory {0}", API.ConfigPath + "/Logs/BountyLogs"));
                    }
                    else
                    {
                        Log.Out("[ServerTools] Directory found");
                    }
                    Log.Out(string.Format("[ServerTools] Checking for logs directory {0}", API.ConfigPath + "/Logs/AuctionLog"));
                    if (!Directory.Exists(API.ConfigPath + "/Logs/AuctionLog"))
                    {
                        Directory.CreateDirectory(API.ConfigPath + "/Logs/AuctionLog");
                        Log.Out(string.Format("[ServerTools] Created directory {0}", API.ConfigPath + "/Logs/AuctionLog"));
                    }
                    else
                    {
                        Log.Out("[ServerTools] Directory found");
                    }
                    Log.Out(string.Format("[ServerTools] Checking for logs directory {0}", API.ConfigPath + "/Logs/BankLogs"));
                    if (!Directory.Exists(API.ConfigPath + "/Logs/BankLogs"))
                    {
                        Directory.CreateDirectory(API.ConfigPath + "/Logs/BankLogs");
                        Log.Out(string.Format("[ServerTools] Created directory {0}", API.ConfigPath + "/Logs/BankLogs"));
                    }
                    else
                    {
                        Log.Out("[ServerTools] Directory found");
                    }
                    Log.Out(string.Format("[ServerTools] Checking for logs directory {0}", API.ConfigPath + "/Logs/DupeLogs"));
                    if (!Directory.Exists(API.ConfigPath + "/Logs/DupeLogs"))
                    {
                        Directory.CreateDirectory(API.ConfigPath + "/Logs/DupeLogs");
                        Log.Out(string.Format("[ServerTools] Created directory {0}", API.ConfigPath + "/Logs/DupeLogs"));
                    }
                    else
                    {
                        Log.Out("[ServerTools] Directory found");
                    }
                    Log.Out(string.Format("[ServerTools] Checking for logs directory {0}", API.ConfigPath + "/Logs/PlayerLogs"));
                    if (!Directory.Exists(API.ConfigPath + "/Logs/PlayerLogs"))
                    {
                        Directory.CreateDirectory(API.ConfigPath + "/Logs/PlayerLogs");
                        Log.Out(string.Format("[ServerTools] Created directory {0}", API.ConfigPath + "/Logs/PlayerLogs"));
                    }
                    else
                    {
                        Log.Out("[ServerTools] Directory found");
                    }
                    Log.Out(string.Format("[ServerTools] Checking for logs directory {0}", API.ConfigPath + "/Logs/PlayerReports"));
                    if (!Directory.Exists(API.ConfigPath + "/Logs/PlayerReports"))
                    {
                        Directory.CreateDirectory(API.ConfigPath + "/Logs/PlayerReports");
                        Log.Out(string.Format("[ServerTools] Created directory {0}", API.ConfigPath + "/Logs/PlayerReports"));
                    }
                    else
                    {
                        Log.Out("[ServerTools] Directory found");
                    }
                    Log.Out(string.Format("[ServerTools] Checking for logs directory {0}", API.ConfigPath + "/Logs/PollLogs"));
                    if (!Directory.Exists(API.ConfigPath + "/Logs/PollLogs"))
                    {
                        Directory.CreateDirectory(API.ConfigPath + "/Logs/PollLogs");
                        Log.Out(string.Format("[ServerTools] Created directory {0}", API.ConfigPath + "/Logs/PollLogs"));
                    }
                    else
                    {
                        Log.Out("[ServerTools] Directory found");
                    }


                    string[] files = Directory.GetFiles(API.ConfigPath + "/Logs/DetectionLogs");
                    int      _daysBeforeDeleted = (Days_Before_Log_Delete * -1);
                    foreach (string file in files)
                    {
                        FileInfo fi = new FileInfo(file);
                        if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                        {
                            fi.Delete();
                        }
                    }
                    files = Directory.GetFiles(API.ConfigPath + "/Logs/BountyLogs");
                    foreach (string file in files)
                    {
                        FileInfo fi = new FileInfo(file);
                        if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                        {
                            fi.Delete();
                        }
                    }
                    files = Directory.GetFiles(API.ConfigPath + "/Logs/AuctionLog");
                    foreach (string file in files)
                    {
                        FileInfo fi = new FileInfo(file);
                        if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                        {
                            fi.Delete();
                        }
                    }
                    files = Directory.GetFiles(API.ConfigPath + "/Logs/BankLogs");
                    foreach (string file in files)
                    {
                        FileInfo fi = new FileInfo(file);
                        if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                        {
                            fi.Delete();
                        }
                    }
                    files = Directory.GetFiles(API.ConfigPath + "/Logs/DupeLogs");
                    foreach (string file in files)
                    {
                        FileInfo fi = new FileInfo(file);
                        if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                        {
                            fi.Delete();
                        }
                    }
                    files = Directory.GetFiles(API.ConfigPath + "/Logs/PlayerLogs");
                    foreach (string file in files)
                    {
                        FileInfo fi = new FileInfo(file);
                        if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                        {
                            fi.Delete();
                        }
                    }
                    files = Directory.GetFiles(API.ConfigPath + "/Logs/PlayerReports");
                    foreach (string file in files)
                    {
                        FileInfo fi = new FileInfo(file);
                        if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                        {
                            fi.Delete();
                        }
                    }
                    files = Directory.GetFiles(API.ConfigPath + "/Logs/PollLogs");
                    foreach (string file in files)
                    {
                        FileInfo fi = new FileInfo(file);
                        if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                        {
                            fi.Delete();
                        }
                    }
                }
                catch (XmlException e)
                {
                    Log.Out(string.Format("[ServerTools] Error in creation of directory {0}. Error = {1}", API.ConfigPath, e.Message));
                }
                Load(2);
            }
            if (_state == 2)
            {
                try
                {
                    LoadConfig.Load();
                }
                catch (XmlException e)
                {
                    Log.Out("[ServerTools] Failed to load the configuration file. Error = {0}", e.Message);
                }
                Load(3);
            }
            if (_state == 3)
            {
                try
                {
                    SQL.Connect();
                }
                catch (XmlException e)
                {
                    Log.Out("[ServerTools] Failed to connect to an sql database. ST requires this to operate. Error = {0}", e.Message);
                }
                Load(4);
            }
            if (_state == 4)
            {
                try
                {
                    Mods.Load();
                }
                catch (XmlException e)
                {
                    Log.Out("[ServerTools] Failed to load the tools. Restart the server and check for errors. Error = {0}", e.Message);
                }
                Load(5);
            }
            if (_state == 5)
            {
                try
                {
                    LoadTriggers.LoadXml();
                }
                catch (XmlException e)
                {
                    Log.Out("[ServerTools] Failed to load the EventTriggers.xml. Check for errors in the file. Error = {0}", e.Message);
                }
                Load(6);
            }
            if (_state == 6)
            {
                try
                {
                    Phrases.Load();
                }
                catch (XmlException e)
                {
                    Log.Out("[ServerTools] Failed to load the Phrases.xml. Restart the server and check for errors. Error = {0}", e.Message);
                }
                try
                {
                    HowToSetup.Load();
                }
                catch (XmlException e)
                {
                    Log.Out("[ServerTools] Failed to load the HowToSetup.xml. Error = {0}", e.Message);
                }
                Load(7);
            }
            if (_state == 7)
            {
                if (Fps.IsEnabled)
                {
                    try
                    {
                        Fps.SetTarget();
                    }
                    catch (XmlException e)
                    {
                        Log.Out("[ServerTools] Failed to set the target fps. Error = {0}", e.Message);
                    }
                }
                Load(8);
            }
            if (_state == 8)
            {
                Timers.LogAlert();
                Timers.LoadAlert();
                Load(9);
            }
            if (_state == 9)
            {
                RestartVote.Startup = true;
            }
        }