Пример #1
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();
        }
Пример #2
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();
            }
        }
Пример #3
0
 private static void Init(object sender, ElapsedEventArgs e)
 {
     if (!StopServer.Shutdown)
     {
         if (Jail.IsEnabled)
         {
             Jail.StatusCheck();
         }
         if (UnderWater.IsEnabled)
         {
             UnderWater.Exec();
         }
         timer2Second++;
         if (timer2Second >= 2)
         {
             if (WorldRadius.IsEnabled)
             {
                 WorldRadius.Exec();
             }
             if (Flying.IsEnabled)
             {
                 Flying.Exec();
             }
             timer2Second = 0;
         }
         timer5Second++;
         if (timer5Second >= 5)
         {
             if (Zones.IsEnabled)
             {
                 Zones.HostileCheck();
             }
             if (PlayerStatCheck.IsEnabled)
             {
                 PlayerStatCheck.PlayerStat();
             }
             timer5Second = 0;
         }
         timer10Second++;
         if (timer10Second >= 10)
         {
             if (EntityCleanup.IsEnabled)
             {
                 EntityCleanup.EntityCheck();
             }
             timer10Second = 0;
         }
         timer60Second++;
         if (timer60Second >= 60)
         {
             if (Jail.IsEnabled && Jail.Jailed.Count > 0)
             {
                 Jail.Clear();
             }
             if (Mute.IsEnabled && Mute.Mutes.Count > 0)
             {
                 Mute.Clear();
             }
             if (BloodmoonWarrior.IsEnabled)
             {
                 BloodmoonWarrior.Exec();
             }
             timer60Second = 0;
         }
         if (WeatherVote.IsEnabled && WeatherVote.VoteOpen)
         {
             _weatherVote++;
             if (_weatherVote >= 60)
             {
                 _weatherVote         = 0;
                 WeatherVote.VoteOpen = false;
                 WeatherVote.ProcessWeatherVote();
             }
         }
         if (RestartVote.IsEnabled && RestartVote.VoteOpen)
         {
             _restartVote++;
             if (_restartVote >= 60)
             {
                 _restartVote         = 0;
                 RestartVote.VoteOpen = false;
                 RestartVote.ProcessRestartVote();
             }
         }
         if (MuteVote.IsEnabled && MuteVote.VoteOpen)
         {
             _muteVote++;
             if (_muteVote >= 60)
             {
                 _muteVote         = 0;
                 MuteVote.VoteOpen = false;
                 MuteVote.ProcessMuteVote();
             }
         }
         if (KickVote.IsEnabled && KickVote.VoteOpen)
         {
             _kickVote++;
             if (_kickVote >= 60)
             {
                 _kickVote         = 0;
                 KickVote.VoteOpen = false;
                 KickVote.ProcessKickVote();
             }
         }
         if (Lottery.IsEnabled && Lottery.OpenLotto)
         {
             _lottery++;
             if (_lottery == 3300)
             {
                 Lottery.Alert();
             }
             if (_lottery >= 3600)
             {
                 _lottery = 0;
                 Lottery.StartLotto();
             }
         }
         else
         {
             _lottery = 0;
         }
         if (Hordes.IsEnabled)
         {
             _horde++;
             if (_horde >= 1200)
             {
                 _horde = 0;
                 Hordes.Exec();
             }
         }
         else
         {
             _horde = 0;
         }
         if (NightAlert.IsEnabled)
         {
             _nightAlert++;
             if (_nightAlert >= NightAlert.Delay * 60)
             {
                 _nightAlert = 0;
                 NightAlert.Exec();
             }
         }
         else
         {
             _nightAlert = 0;
         }
         if (Watchlist.IsEnabled)
         {
             _watchList++;
             if (_watchList >= Watchlist.Delay * 60)
             {
                 _watchList = 0;
                 Watchlist.CheckWatchlist();
             }
         }
         else
         {
             _watchList = 0;
         }
         if (Bloodmoon.IsEnabled & Bloodmoon.Auto_Show)
         {
             if (Bloodmoon.Delay > 0)
             {
                 _bloodmoon++;
                 if (_bloodmoon >= Bloodmoon.Delay * 60)
                 {
                     _bloodmoon = 0;
                     Bloodmoon.StatusCheck();
                 }
             }
         }
         else
         {
             _bloodmoon = 0;
         }
         if (PlayerLogs.IsEnabled & PlayerLogs.Delay > 0)
         {
             _playerLogs++;
             if (_playerLogs >= PlayerLogs.Delay)
             {
                 _playerLogs = 0;
                 PlayerLogs.Exec();
             }
         }
         else
         {
             _playerLogs = 0;
         }
         if (StopServer.StopServerCountingDown)
         {
             _stopServerCountDown++;
             if (_stopServerCountDown == 60)
             {
                 _stopServerCountDown = 0;
                 _stopServerCount--;
             }
             if (_stopServerCount == 0)
             {
                 _stopServerCountDown = 0;
                 StopServer.StopServerCountingDown = false;
                 StopServer.Stop();
             }
             if (_stopServerCount == 1 && _stopServerCountDown == 0)
             {
                 StopServer.StartShutdown3();
             }
             if (_stopServerCount > 1 && _stopServerCountDown == 0)
             {
                 StopServer.StartShutdown2(_stopServerCount);
             }
             if (StopServer.Kick_30_Seconds)
             {
                 if (_stopServerCount == 1 && _stopServerCountDown == 30)
                 {
                     StopServer.NoEntry = true;
                     StopServer.Kick30();
                 }
             }
             if (StopServer.Ten_Second_Countdown)
             {
                 if (_stopServerCount == 1 && _stopServerCountDown == 50)
                 {
                     StopServer.StartShutdown4();
                 }
                 if (_stopServerCount == 1 && _stopServerCountDown == 55)
                 {
                     StopServer.StartShutdown5();
                 }
                 if (_stopServerCount == 1 && _stopServerCountDown == 56)
                 {
                     StopServer.StartShutdown6();
                 }
                 if (_stopServerCount == 1 && _stopServerCountDown == 57)
                 {
                     StopServer.StartShutdown7();
                 }
                 if (_stopServerCount == 1 && _stopServerCountDown == 58)
                 {
                     StopServer.StartShutdown8();
                 }
                 if (_stopServerCount == 1 && _stopServerCountDown == 59)
                 {
                     StopServer.StartShutdown9();
                 }
             }
         }
         else
         {
             _stopServerCountDown = 0;
             _stopServerCount     = 0;
         }
         if (AutoSaveWorld.IsEnabled & AutoSaveWorld.Delay > 0)
         {
             _autoSaveWorld++;
             if (_autoSaveWorld >= AutoSaveWorld.Delay * 60)
             {
                 _autoSaveWorld = 0;
                 AutoSaveWorld.Save();
             }
         }
         else
         {
             _autoSaveWorld = 0;
         }
         if (AutoShutdown.IsEnabled && !AutoShutdown.Bloodmoon && !AutoShutdown.BloodmoonOver && !StopServer.StopServerCountingDown)
         {
             _autoShutdown++;
             if (!Event.Open && _autoShutdown >= AutoShutdown.Delay * 60)
             {
                 _autoShutdown = 0;
                 AutoShutdown.BloodmoonCheck();
             }
         }
         else
         {
             _autoShutdown = 0;
         }
         if (AutoShutdown.Bloodmoon)
         {
             _autoShutdownBloodmoon++;
             if (_autoShutdownBloodmoon >= 150)
             {
                 _autoShutdownBloodmoon = 0;
                 AutoShutdown.BloodmoonCheck();
             }
         }
         if (AutoShutdown.BloodmoonOver && !Event.Open)
         {
             _autoShutdownBloodmoonOver++;
             if (_autoShutdownBloodmoonOver == 1)
             {
                 AutoShutdown.BloodmoonOverAlert();
             }
             else if (_autoShutdownBloodmoonOver >= 900)
             {
                 _autoShutdownBloodmoonOver = 0;
                 AutoShutdown.BloodmoonOver = false;
                 AutoShutdown.Shutdown();
             }
         }
         if (InfoTicker.IsEnabled)
         {
             _infoTicker++;
             if (_infoTicker >= InfoTicker.Delay * 60)
             {
                 _infoTicker = 0;
                 InfoTicker.StatusCheck();
             }
         }
         else
         {
             _infoTicker = 0;
         }
         if (Event.Invited)
         {
             _eventInvitation++;
             if (_eventInvitation >= 900)
             {
                 _eventInvitation = 0;
                 Event.Invited    = false;
                 Event.CheckOpen();
             }
         }
         else
         {
             _eventInvitation = 0;
         }
         if (Event.Open)
         {
             _eventOpen++;
             if (_eventOpen == _eventTime / 2)
             {
                 Event.HalfTime();
             }
             if (_eventOpen == _eventTime - 300)
             {
                 Event.FiveMin();
             }
             if (_eventOpen >= _eventTime)
             {
                 _eventOpen = 0;
                 Event.EndEvent();
             }
         }
         else
         {
             _eventOpen = 0;
         }
         if (RestartVote.Startup)
         {
             _restartVote++;
             if (_restartVote >= 1800)
             {
                 RestartVote.Startup = false;
             }
         }
         else
         {
             _restartVote = 0;
         }
         if (Zones.IsEnabled & Zones.reminder.Count > 0)
         {
             _zoneReminder++;
             if (_zoneReminder >= Zones.Reminder_Delay * 60)
             {
                 _zoneReminder = 0;
                 Zones.Reminder();
             }
         }
         else
         {
             _zoneReminder = 0;
         }
         if (AutoBackup.IsEnabled)
         {
             _autoBackup++;
             if (_autoBackup >= AutoBackup.Delay * 60)
             {
                 _autoBackup = 0;
                 AutoBackup.Exec();
             }
         }
         else
         {
             _autoBackup = 0;
         }
         if (BreakTime.IsEnabled)
         {
             _breakTime++;
             if (_breakTime >= BreakTime.Break_Time * 60)
             {
                 _breakTime = 0;
                 BreakTime.Exec();
             }
         }
         else
         {
             _breakTime = 0;
         }
         if (Tracking.IsEnabled)
         {
             _tracking++;
             if (_tracking >= Tracking.Rate)
             {
                 _tracking = 0;
                 Tracking.Exec();
             }
         }
         else
         {
             _tracking = 0;
         }
         if (InventoryCheck.IsEnabled && InventoryCheck.Chest_Checker)
         {
             _inventoryCheck++;
             if (_inventoryCheck >= 300)
             {
                 _inventoryCheck = 0;
                 InventoryCheck.ChestCheck();
             }
         }
         else
         {
             _inventoryCheck = 0;
         }
         if (RealWorldTime.IsEnabled)
         {
             _realWorldTime++;
             if (_realWorldTime >= RealWorldTime.Delay * 60)
             {
                 _realWorldTime = 0;
                 RealWorldTime.Time();
             }
         }
         else
         {
             _realWorldTime = 0;
         }
     }
     else
     {
         _shutdownFailSafe++;
         if (_shutdownFailSafe >= 15)
         {
             _shutdownFailSafe = 0;
             StopServer.FailSafe();
         }
     }
 }
Пример #4
0
 private static void Exec()
 {
     PersistentOperations.PlayerCheck();
     if (Jail.IsEnabled)
     {
         Jail.StatusCheck();
     }
     if (_twoSecondTick >= 2)
     {
         _twoSecondTick = 0;
         if (WorldRadius.IsEnabled)
         {
             WorldRadius.Exec();
         }
         if (PlayerChecks.GodEnabled || PlayerChecks.FlyEnabled || PlayerChecks.SpectatorEnabled || PlayerChecks.WaterEnabled)
         {
             PlayerChecks.Exec();
         }
     }
     if (_fiveSecondTick >= 5)
     {
         _fiveSecondTick = 0;
         if (Zones.IsEnabled)
         {
             Zones.HostileCheck();
         }
         if (PlayerStats.IsEnabled)
         {
             PlayerStats.Exec();
         }
     }
     if (_tenSecondTick >= 10)
     {
         _tenSecondTick = 0;
         if (EntityCleanup.IsEnabled)
         {
             EntityCleanup.EntityCheck();
         }
         EventSchedule.Exec();
     }
     if (_twentySecondTick >= 20)
     {
         _twentySecondTick = 0;
         if (Track.IsEnabled)
         {
             Track.Exec();
         }
     }
     if (_oneMinTick >= 60)
     {
         _oneMinTick = 0;
         if (Jail.IsEnabled && Jail.Jailed.Count > 0)
         {
             Jail.Clear();
         }
         if (Mute.IsEnabled && Mute.Mutes.Count > 0)
         {
             Mute.Clear();
         }
         if (BloodmoonWarrior.IsEnabled)
         {
             BloodmoonWarrior.Exec();
         }
     }
     if (_fiveMinTick >= 300)
     {
         _fiveMinTick = 0;
         StateManager.Save();
         if (InvalidItems.Check_Storage)
         {
             InvalidItems.CheckStorage();
         }
     }
     if (WeatherVote.IsEnabled && WeatherVote.VoteOpen)
     {
         _weatherVote++;
         if (_weatherVote >= 60)
         {
             _weatherVote         = 0;
             WeatherVote.VoteOpen = false;
             WeatherVote.ProcessWeatherVote();
         }
     }
     if (RestartVote.IsEnabled && RestartVote.VoteOpen)
     {
         _restartVote++;
         if (_restartVote >= 60)
         {
             _restartVote         = 0;
             RestartVote.VoteOpen = false;
             RestartVote.ProcessRestartVote();
         }
     }
     if (MuteVote.IsEnabled && MuteVote.VoteOpen)
     {
         _muteVote++;
         if (_muteVote >= 60)
         {
             _muteVote         = 0;
             MuteVote.VoteOpen = false;
             MuteVote.ProcessMuteVote();
         }
     }
     if (KickVote.IsEnabled && KickVote.VoteOpen)
     {
         _kickVote++;
         if (_kickVote >= 60)
         {
             _kickVote         = 0;
             KickVote.VoteOpen = false;
             KickVote.ProcessKickVote();
         }
     }
     if (Lottery.IsEnabled && Lottery.OpenLotto)
     {
         _lottery++;
         if (_lottery == 3300)
         {
             Lottery.Alert();
         }
         if (_lottery >= 3600)
         {
             _lottery = 0;
             Lottery.StartLotto();
         }
     }
     else
     {
         _lottery = 0;
     }
     if (Hordes.IsEnabled)
     {
         _horde++;
         if (_horde >= 1200)
         {
             _horde = 0;
             Hordes.Exec();
         }
     }
     else
     {
         _horde = 0;
     }
     if (StopServer.ShuttingDown)
     {
         _stopServerSeconds++;
         if (_stopServerSeconds >= 60)
         {
             _stopServerSeconds = 0;
             StopServerMinutes--;
             if (StopServerMinutes > 1)
             {
                 StopServer.TimeRemaining(StopServerMinutes);
             }
             else if (StopServerMinutes == 1)
             {
                 StopServer.OneMinuteRemains();
             }
             else if (StopServerMinutes == 0)
             {
                 StopServer.ShuttingDown = false;
                 StopServer.Stop();
             }
         }
         if (_stopServerSeconds == 30 && StopServerMinutes == 1)
         {
             StopServer.Kick30();
         }
     }
     else
     {
         _stopServerSeconds = 0;
     }
     if (Event.Invited)
     {
         _eventInvitation++;
         if (_eventInvitation >= 900)
         {
             _eventInvitation = 0;
             Event.Invited    = false;
             Event.CheckOpen();
         }
     }
     if (Event.Open)
     {
         _eventOpen++;
         if (_eventOpen == _eventTime / 2)
         {
             Event.HalfTime();
         }
         if (_eventOpen == _eventTime - 300)
         {
             Event.FiveMin();
         }
         if (_eventOpen >= _eventTime)
         {
             _eventOpen = 0;
             Event.EndEvent();
         }
     }
     else
     {
         _eventOpen = 0;
     }
     if (RestartVote.Cycle)
     {
         _restartVoteCycle++;
         if (_restartVoteCycle >= 1800)
         {
             RestartVote.Cycle = false;
         }
     }
 }
Пример #5
0
 public static void Load()
 {
     PatchTools.ApplyPatches();
     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 (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
 private static void Exec()
 {
     if (!StopServer.ShuttingDown)
     {
         PersistentOperations.PlayerCheck();
         if (Jail.IsEnabled)
         {
             Jail.StatusCheck();
         }
         if (TwoSecondTick >= 2)
         {
             TwoSecondTick = 0;
             if (WorldRadius.IsEnabled)
             {
                 WorldRadius.Exec();
             }
             if (PlayerChecks.GodEnabled || PlayerChecks.FlyEnabled || PlayerChecks.SpectatorEnabled || PlayerChecks.WaterEnabled)
             {
                 PlayerChecks.Exec();
             }
         }
         if (FiveSecondTick >= 5)
         {
             FiveSecondTick = 0;
             if (Zones.IsEnabled)
             {
                 Zones.HostileCheck();
             }
             if (PlayerStats.IsEnabled)
             {
                 PlayerStats.Exec();
             }
         }
         if (TenSecondTick >= 10)
         {
             TenSecondTick = 0;
             if (EntityCleanup.IsEnabled)
             {
                 EntityCleanup.EntityCheck();
             }
         }
         if (SixtySecondTick >= 60)
         {
             SixtySecondTick = 0;
             if (Jail.IsEnabled && Jail.Jailed.Count > 0)
             {
                 Jail.Clear();
             }
             if (Mute.IsEnabled && Mute.Mutes.Count > 0)
             {
                 Mute.Clear();
             }
             if (BloodmoonWarrior.IsEnabled)
             {
                 BloodmoonWarrior.Exec();
             }
         }
         if (WeatherVote.IsEnabled && WeatherVote.VoteOpen)
         {
             _weatherVote++;
             if (_weatherVote >= 60)
             {
                 _weatherVote         = 0;
                 WeatherVote.VoteOpen = false;
                 WeatherVote.ProcessWeatherVote();
             }
         }
         if (RestartVote.IsEnabled && RestartVote.VoteOpen)
         {
             _restartVote++;
             if (_restartVote >= 60)
             {
                 _restartVote         = 0;
                 RestartVote.VoteOpen = false;
                 RestartVote.ProcessRestartVote();
             }
         }
         if (MuteVote.IsEnabled && MuteVote.VoteOpen)
         {
             _muteVote++;
             if (_muteVote >= 60)
             {
                 _muteVote         = 0;
                 MuteVote.VoteOpen = false;
                 MuteVote.ProcessMuteVote();
             }
         }
         if (KickVote.IsEnabled && KickVote.VoteOpen)
         {
             _kickVote++;
             if (_kickVote >= 60)
             {
                 _kickVote         = 0;
                 KickVote.VoteOpen = false;
                 KickVote.ProcessKickVote();
             }
         }
         if (Lottery.IsEnabled && Lottery.OpenLotto)
         {
             _lottery++;
             if (_lottery == 3300)
             {
                 Lottery.Alert();
             }
             if (_lottery >= 3600)
             {
                 _lottery = 0;
                 Lottery.StartLotto();
             }
         }
         else
         {
             _lottery = 0;
         }
         if (Hordes.IsEnabled)
         {
             _horde++;
             if (_horde >= 1200)
             {
                 _horde = 0;
                 Hordes.Exec();
             }
         }
         else
         {
             _horde = 0;
         }
         if (NightAlert.IsEnabled)
         {
             _nightAlert++;
             if (_nightAlert >= NightAlert.Delay * 60)
             {
                 _nightAlert = 0;
                 NightAlert.Exec();
             }
         }
         else
         {
             _nightAlert = 0;
         }
         if (Watchlist.IsEnabled)
         {
             _watchList++;
             if (_watchList >= Watchlist.Delay * 60)
             {
                 _watchList = 0;
                 Watchlist.CheckWatchlist();
             }
         }
         else
         {
             _watchList = 0;
         }
         if (Bloodmoon.IsEnabled & Bloodmoon.Auto_Show)
         {
             if (Bloodmoon.Delay > 0)
             {
                 _bloodmoon++;
                 if (_bloodmoon >= Bloodmoon.Delay * 60)
                 {
                     _bloodmoon = 0;
                     Bloodmoon.StatusCheck();
                 }
             }
         }
         else
         {
             _bloodmoon = 0;
         }
         if (PlayerLogs.IsEnabled & PlayerLogs.Delay > 0)
         {
             _playerLogs++;
             if (_playerLogs >= PlayerLogs.Delay)
             {
                 _playerLogs = 0;
                 PlayerLogs.Exec();
             }
         }
         else
         {
             _playerLogs = 0;
         }
         if (StopServer.CountingDown)
         {
             StopServerSeconds++;
             if (StopServerSeconds == 60)
             {
                 StopServerSeconds = 0;
                 StopServerMinutes--;
             }
             if (StopServerMinutes == 0)
             {
                 StopServerSeconds       = 0;
                 StopServer.CountingDown = false;
                 StopServer.Stop();
             }
             if (StopServerMinutes == 1 && StopServerSeconds == 0)
             {
                 StopServer.StartShutdown3();
             }
             if (StopServerMinutes > 1 && StopServerSeconds == 0)
             {
                 StopServer.StartShutdown2(StopServerMinutes);
             }
             if (StopServerMinutes == 1 && StopServerSeconds == 30)
             {
                 StopServer.Kick30();
             }
         }
         if (AutoSaveWorld.IsEnabled & AutoSaveWorld.Delay > 0)
         {
             _autoSaveWorld++;
             if (_autoSaveWorld >= AutoSaveWorld.Delay * 60)
             {
                 _autoSaveWorld = 0;
                 AutoSaveWorld.Save();
             }
         }
         else
         {
             _autoSaveWorld = 0;
         }
         if (Shutdown.IsEnabled && !StopServer.CountingDown)
         {
             if (Shutdown.BloodmoonOver && !Event.Open)
             {
                 _shutdownBloodmoonOver++;
                 if (_shutdownBloodmoonOver >= 900)
                 {
                     _shutdownBloodmoonOver = 0;
                     Shutdown.BloodmoonOver = false;
                     Shutdown.Stop();
                 }
             }
             else if (!Shutdown.Bloodmoon)
             {
                 _shutdown++;
                 if (_shutdown >= Shutdown.Delay * 60)
                 {
                     if (Event.Open)
                     {
                         if (!Event.OperatorWarned)
                         {
                             Event.OperatorWarned = true;
                             ClientInfo _cInfo = ConsoleHelper.ParseParamIdOrName(Event.Operator);
                             if (_cInfo != null)
                             {
                                 ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + "A scheduled shutdown is set to begin but is on hold until the event ends" + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                             }
                         }
                     }
                     else
                     {
                         _shutdown = 0;
                         Shutdown.BloodmoonCheck();
                     }
                 }
             }
             else if (Shutdown.Bloodmoon)
             {
                 _shutdownBloodmoon++;
                 if (_shutdownBloodmoon >= 150)
                 {
                     _shutdownBloodmoon = 0;
                     Shutdown.BloodmoonCheck();
                 }
             }
         }
         else
         {
             _shutdown = 0;
         }
         if (InfoTicker.IsEnabled)
         {
             _infoTicker++;
             if (_infoTicker >= InfoTicker.Delay * 60)
             {
                 _infoTicker = 0;
                 InfoTicker.Exec();
             }
         }
         else
         {
             _infoTicker = 0;
         }
         if (Event.Invited)
         {
             _eventInvitation++;
             if (_eventInvitation >= 900)
             {
                 _eventInvitation = 0;
                 Event.Invited    = false;
                 Event.CheckOpen();
             }
         }
         else
         {
             _eventInvitation = 0;
         }
         if (Event.Open)
         {
             _eventOpen++;
             if (_eventOpen == _eventTime / 2)
             {
                 Event.HalfTime();
             }
             if (_eventOpen == _eventTime - 300)
             {
                 Event.FiveMin();
             }
             if (_eventOpen >= _eventTime)
             {
                 _eventOpen = 0;
                 Event.EndEvent();
             }
         }
         else
         {
             _eventOpen = 0;
         }
         if (RestartVote.Startup)
         {
             _restartVoteStart++;
             if (_restartVoteStart >= 1800)
             {
                 RestartVote.Startup = false;
             }
         }
         else
         {
             _restartVoteStart = 0;
         }
         if (Zones.IsEnabled & Zones.Reminder.Count > 0)
         {
             _zoneReminder++;
             if (_zoneReminder >= Zones.Reminder_Delay * 60)
             {
                 _zoneReminder = 0;
                 Zones.ReminderExec();
             }
         }
         else
         {
             _zoneReminder = 0;
         }
         if (AutoBackup.IsEnabled)
         {
             _autoBackup++;
             if (_autoBackup >= AutoBackup.Delay * 60)
             {
                 _autoBackup = 0;
                 AutoBackup.Exec();
             }
         }
         else
         {
             _autoBackup = 0;
         }
         if (BreakTime.IsEnabled)
         {
             _breakTime++;
             if (_breakTime >= BreakTime.Break_Time * 60)
             {
                 _breakTime = 0;
                 BreakTime.Exec();
             }
         }
         else
         {
             _breakTime = 0;
         }
         if (Track.IsEnabled)
         {
             _tracking++;
             if (_tracking >= 20)
             {
                 _tracking = 0;
                 Track.Exec();
             }
         }
         else
         {
             _tracking = 0;
         }
         if (InvalidItems.IsEnabled && InvalidItems.Check_Storage)
         {
             _invalidItems++;
             if (_invalidItems >= 300)
             {
                 _invalidItems = 0;
                 InvalidItems.CheckStorage();
             }
         }
         else
         {
             _invalidItems = 0;
         }
         if (RealWorldTime.IsEnabled)
         {
             _realWorldTime++;
             if (_realWorldTime >= RealWorldTime.Delay * 60)
             {
                 _realWorldTime = 0;
                 RealWorldTime.Time();
             }
         }
         else
         {
             _realWorldTime = 0;
         }
     }
 }