コード例 #1
0
 public override void PlayerLogin(ClientInfo _cInfo, string _compatibilityVersion)
 {
     if (ReservedSlots.IsEnabled)
     {
         ReservedSlots.CheckReservedSlot(_cInfo);
     }
 }
コード例 #2
0
ファイル: Lobby.cs プロジェクト: pharrisee/7dtd-ServerTools
 public static void Exec(ClientInfo _cInfo)
 {
     if (Reserved_Only && ReservedSlots.IsEnabled && !ReservedSlots.ReservedCheck(_cInfo.PlatformId, _cInfo.CrossplatformId))
     {
         Phrases.Dict.TryGetValue("Lobby9", out string phrase);
         ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
         return;
     }
     if (Delay_Between_Uses < 1)
     {
         if (Wallet.IsEnabled && Command_Cost >= 1)
         {
             CommandCost(_cInfo);
         }
         else
         {
             LobbyTele(_cInfo);
         }
     }
     else
     {
         DateTime lastLobby = DateTime.Now;
         if (PersistentContainer.Instance.Players[_cInfo.CrossplatformId.CombinedString].LastLobby != null)
         {
             lastLobby = PersistentContainer.Instance.Players[_cInfo.CrossplatformId.CombinedString].LastLobby;
         }
         TimeSpan varTime           = DateTime.Now - lastLobby;
         double   fractionalMinutes = varTime.TotalMinutes;
         int      timepassed        = (int)fractionalMinutes;
         if (ReservedSlots.IsEnabled && ReservedSlots.Reduced_Delay)
         {
             if (ReservedSlots.Dict.ContainsKey(_cInfo.PlatformId.CombinedString) || ReservedSlots.Dict.ContainsKey(_cInfo.CrossplatformId.CombinedString))
             {
                 if (ReservedSlots.Dict.TryGetValue(_cInfo.PlatformId.CombinedString, out DateTime dt))
                 {
                     if (DateTime.Now < dt)
                     {
                         int delay = Delay_Between_Uses / 2;
                         Time(_cInfo, timepassed, delay);
                         return;
                     }
                 }
                 else if (ReservedSlots.Dict.TryGetValue(_cInfo.CrossplatformId.CombinedString, out dt))
                 {
                     if (DateTime.Now < dt)
                     {
                         int delay = Delay_Between_Uses / 2;
                         Time(_cInfo, timepassed, delay);
                         return;
                     }
                 }
             }
         }
         Time(_cInfo, timepassed, Delay_Between_Uses);
     }
 }
コード例 #3
0
 public static void Exec(ClientInfo _cInfo)
 {
     if (Donor_Only && ReservedSlots.IsEnabled && !ReservedSlots.ReservedCheck(_cInfo.playerId))
     {
         Phrases.Dict.TryGetValue(249, out string _phrase249);
         ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase249 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
         return;
     }
     if (Delay_Between_Uses < 1)
     {
         if (Wallet.IsEnabled && Command_Cost >= 1)
         {
             CommandCost(_cInfo);
         }
         else
         {
             LobbyTele(_cInfo);
         }
     }
     else
     {
         DateTime _lastLobby = DateTime.Now;
         if (PersistentContainer.Instance.Players[_cInfo.playerId].LastLobby != null)
         {
             _lastLobby = PersistentContainer.Instance.Players[_cInfo.playerId].LastLobby;
         }
         TimeSpan varTime           = DateTime.Now - _lastLobby;
         double   fractionalMinutes = varTime.TotalMinutes;
         int      _timepassed       = (int)fractionalMinutes;
         if (ReservedSlots.IsEnabled && ReservedSlots.Reduced_Delay)
         {
             if (ReservedSlots.Dict.ContainsKey(_cInfo.playerId))
             {
                 DateTime _dt;
                 ReservedSlots.Dict.TryGetValue(_cInfo.playerId, out _dt);
                 if (DateTime.Now < _dt)
                 {
                     int _delay = Delay_Between_Uses / 2;
                     Time(_cInfo, _timepassed, _delay);
                     return;
                 }
             }
         }
         Time(_cInfo, _timepassed, Delay_Between_Uses);
     }
 }
コード例 #4
0
 public override void PlayerLogin(ClientInfo _cInfo, string _compatibilityVersion)
 {
     if (StopServer.NoEntry)
     {
         int    _seconds = (60 - Timers._sSCD);
         string _phrase452;
         if (!Phrases.Dict.TryGetValue(452, out _phrase452))
         {
             _phrase452 = "Shutdown is in {Minutes} minutes {Seconds} seconds. Please come back after the server restarts.";
         }
         _phrase452 = _phrase452.Replace("{Minutes}", Timers._sSC.ToString());
         _phrase452 = _phrase452.Replace("{Seconds}", _seconds.ToString());
         SdtdConsole.Instance.ExecuteSync(string.Format("kick {0} \"{1}\"", _cInfo.entityId, _phrase452), (ClientInfo)null);
     }
     if (ReservedSlots.IsEnabled)
     {
         ReservedSlots.CheckReservedSlot(_cInfo);
     }
 }
コード例 #5
0
 public static void Exec(ClientInfo _cInfo)
 {
     if (Donor_Only && ReservedSlots.IsEnabled && !ReservedSlots.ReservedCheck(_cInfo.playerId))
     {
         ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + " this command is locked to donors only" + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
         return;
     }
     if (Delay_Between_Uses < 1)
     {
         if (Wallet.IsEnabled && Command_Cost >= 1)
         {
             CommandCost(_cInfo);
         }
         else
         {
             MarketTele(_cInfo);
         }
     }
     else
     {
         DateTime _lastMarket       = PersistentContainer.Instance.Players[_cInfo.playerId].LastMarket;
         TimeSpan varTime           = DateTime.Now - _lastMarket;
         double   fractionalMinutes = varTime.TotalMinutes;
         int      _timepassed       = (int)fractionalMinutes;
         if (ReservedSlots.IsEnabled && ReservedSlots.Reduced_Delay)
         {
             if (ReservedSlots.Dict.ContainsKey(_cInfo.playerId))
             {
                 DateTime _dt;
                 ReservedSlots.Dict.TryGetValue(_cInfo.playerId, out _dt);
                 if (DateTime.Now < _dt)
                 {
                     int _delay = Delay_Between_Uses / 2;
                     Time(_cInfo, _timepassed, _delay);
                     return;
                 }
             }
         }
         Time(_cInfo, _timepassed, Delay_Between_Uses);
     }
 }
コード例 #6
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();
     }
 }
コード例 #7
0
 public static bool FullServer(string _playerId, string _playerName, string _compatibilityVersion)
 {
     try
     {
         ulong _num;
         if (!Steam.Masterserver.Server.GameServerInitialized || !GameManager.Instance.gameStateManager.IsGameStarted() ||
             GameStats.GetInt(EnumGameStats.GameState) == 2 || string.IsNullOrEmpty(_playerName) ||
             string.IsNullOrEmpty(_playerId) || string.IsNullOrEmpty(_playerId) || !ulong.TryParse(_playerId, out _num) ||
             !string.Equals(Constants.cCompatibilityVersion, _compatibilityVersion, StringComparison.Ordinal))
         {
             return(true);
         }
         List <ClientInfo> list = PersistentOperations.ClientList();
         for (int i = 0; i < list.Count; i++)
         {
             ClientInfo clientInfo = list[i];
             if (clientInfo != null && clientInfo.playerId == _playerId)
             {
                 return(true);
             }
         }
         ClientInfo _cInfoClientToKick = null;
         if (ReservedSlots.AdminCheck(_playerId))
         {
             ClientInfo    _cInfoReservedToKick = null;
             int           _clientSession       = int.MinValue;
             int           _reservedSession     = int.MinValue;
             List <string> _sessionList         = new List <string>(PersistentOperations.Session.Keys);
             if (_sessionList == null)
             {
                 return(true);
             }
             for (int i = 0; i < _sessionList.Count; i++)
             {
                 string     _player = _sessionList[i];
                 ClientInfo _cInfo2 = ConnectionManager.Instance.Clients.ForPlayerId(_player);
                 if (_cInfo2 != null && _playerId != _cInfo2.playerId)
                 {
                     if (ReservedSlots.AdminCheck(_cInfo2.playerId))
                     {
                         continue;
                     }
                     else if (ReservedSlots.ReservedCheck(_cInfo2.playerId))
                     {
                         DateTime _dateTime;
                         if (PersistentOperations.Session.TryGetValue(_cInfo2.playerId, out _dateTime))
                         {
                             TimeSpan varTime           = DateTime.Now - _dateTime;
                             double   fractionalMinutes = varTime.TotalMinutes;
                             int      _timepassed       = (int)fractionalMinutes;
                             if (_timepassed > _reservedSession)
                             {
                                 _reservedSession     = _timepassed;
                                 _cInfoReservedToKick = _cInfo2;
                             }
                         }
                     }
                     else
                     {
                         DateTime _dateTime;
                         if (PersistentOperations.Session.TryGetValue(_cInfo2.playerId, out _dateTime))
                         {
                             TimeSpan varTime           = DateTime.Now - _dateTime;
                             double   fractionalMinutes = varTime.TotalMinutes;
                             int      _timepassed       = (int)fractionalMinutes;
                             if (_timepassed > _clientSession)
                             {
                                 _clientSession     = _timepassed;
                                 _cInfoClientToKick = _cInfo2;
                             }
                         }
                     }
                 }
             }
             if (_cInfoClientToKick != null)
             {
                 API.PlayerDisconnected(_cInfoClientToKick, true);
                 string _phrase20;
                 if (!Phrases.Dict.TryGetValue(20, out _phrase20))
                 {
                     _phrase20 = "{ServerResponseName}- The server is full. You were kicked by the reservation system to open a slot";
                 }
                 _phrase20 = _phrase20.Replace("{ServerResponseName}", LoadConfig.Server_Response_Name);
                 SdtdConsole.Instance.ExecuteSync(string.Format("kick {0} \"{1}\"", _cInfoClientToKick.playerId, _phrase20), (ClientInfo)null);
                 EntityPlayer entityPlayer = (EntityPlayer)GameManager.Instance.World.GetEntity(_cInfoClientToKick.entityId);
                 if (entityPlayer != null)
                 {
                     if (_cInfoClientToKick.entityId != -1)
                     {
                         Log.Out("Player {0} disconnected after {1} minutes", new object[]
                         {
                             GameUtils.SafeStringFormat(entityPlayer.EntityName),
                             ((Time.timeSinceLevelLoad - entityPlayer.CreationTimeSinceLevelLoad) / 60f).ToCultureInvariantString("0.0")
                         });
                     }
                     entityPlayer.OnEntityUnload();
                 }
                 GC.Collect();
                 MemoryPools.Cleanup();
                 PersistentPlayerData persistentPlayerData = PersistentOperations.GetPersistentPlayerData(_cInfoClientToKick.playerId);
                 if (persistentPlayerData != null)
                 {
                     persistentPlayerData.LastLogin = DateTime.Now;
                     persistentPlayerData.EntityId  = -1;
                 }
                 PersistentOperations.SavePersistentPlayerDataXML();
                 GameManager.Instance.World.aiDirector.RemoveEntity(entityPlayer);
                 GameManager.Instance.World.RemoveEntity(entityPlayer.entityId, EnumRemoveEntityReason.Unloaded);
                 ConnectionManager.Instance.Clients.Remove(_cInfoClientToKick);
                 return(true);
             }
             else if (_cInfoReservedToKick != null)
             {
                 API.PlayerDisconnected(_cInfoReservedToKick, true);
                 string _phrase20;
                 if (!Phrases.Dict.TryGetValue(20, out _phrase20))
                 {
                     _phrase20 = "{ServerResponseName}- The server is full. You were kicked by the reservation system to open a slot";
                 }
                 _phrase20 = _phrase20.Replace("{ServerResponseName}", LoadConfig.Server_Response_Name);
                 SdtdConsole.Instance.ExecuteSync(string.Format("kick {0} \"{1}\"", _cInfoReservedToKick.playerId, _phrase20), (ClientInfo)null);
                 EntityPlayer entityPlayer = (EntityPlayer)GameManager.Instance.World.GetEntity(_cInfoReservedToKick.entityId);
                 if (entityPlayer != null)
                 {
                     if (_cInfoReservedToKick.entityId != -1)
                     {
                         Log.Out("Player {0} disconnected after {1} minutes", new object[]
                         {
                             GameUtils.SafeStringFormat(entityPlayer.EntityName),
                             ((Time.timeSinceLevelLoad - entityPlayer.CreationTimeSinceLevelLoad) / 60f).ToCultureInvariantString("0.0")
                         });
                     }
                     entityPlayer.OnEntityUnload();
                 }
                 GC.Collect();
                 MemoryPools.Cleanup();
                 PersistentPlayerData persistentPlayerData = PersistentOperations.GetPersistentPlayerData(_cInfoReservedToKick.playerId);
                 if (persistentPlayerData != null)
                 {
                     persistentPlayerData.LastLogin = DateTime.Now;
                     persistentPlayerData.EntityId  = -1;
                 }
                 PersistentOperations.SavePersistentPlayerDataXML();
                 GameManager.Instance.World.aiDirector.RemoveEntity(entityPlayer);
                 GameManager.Instance.World.RemoveEntity(entityPlayer.entityId, EnumRemoveEntityReason.Unloaded);
                 ConnectionManager.Instance.Clients.Remove(_cInfoReservedToKick);
                 return(true);
             }
         }
         else if (ReservedSlots.ReservedCheck(_playerId))
         {
             int           _clientSession = int.MinValue;
             List <string> _sessionList   = new List <string>(PersistentOperations.Session.Keys);
             if (_sessionList == null)
             {
                 return(true);
             }
             for (int i = 0; i < _sessionList.Count; i++)
             {
                 string     _player = _sessionList[i];
                 ClientInfo _cInfo2 = ConnectionManager.Instance.Clients.ForPlayerId(_player);
                 if (_cInfo2 != null && _playerId != _cInfo2.playerId)
                 {
                     if (ReservedSlots.AdminCheck(_cInfo2.playerId))
                     {
                         continue;
                     }
                     else if (ReservedSlots.ReservedCheck(_cInfo2.playerId))
                     {
                         continue;
                     }
                     else
                     {
                         DateTime _dateTime;
                         if (PersistentOperations.Session.TryGetValue(_cInfo2.playerId, out _dateTime))
                         {
                             TimeSpan varTime           = DateTime.Now - _dateTime;
                             double   fractionalMinutes = varTime.TotalMinutes;
                             int      _timepassed       = (int)fractionalMinutes;
                             if (_timepassed > _clientSession)
                             {
                                 _clientSession     = _timepassed;
                                 _cInfoClientToKick = _cInfo2;
                             }
                         }
                     }
                 }
             }
             if (_cInfoClientToKick != null)
             {
                 API.PlayerDisconnected(_cInfoClientToKick, true);
                 string _phrase20;
                 if (!Phrases.Dict.TryGetValue(20, out _phrase20))
                 {
                     _phrase20 = "{ServerResponseName}- The server is full. You were kicked by the reservation system to open a slot";
                 }
                 _phrase20 = _phrase20.Replace("{ServerResponseName}", LoadConfig.Server_Response_Name);
                 SdtdConsole.Instance.ExecuteSync(string.Format("kick {0} \"{1}\"", _cInfoClientToKick.playerId, _phrase20), (ClientInfo)null);
                 EntityPlayer entityPlayer = (EntityPlayer)GameManager.Instance.World.GetEntity(_cInfoClientToKick.entityId);
                 if (entityPlayer != null)
                 {
                     if (_cInfoClientToKick.entityId != -1)
                     {
                         Log.Out("Player {0} disconnected after {1} minutes", new object[]
                         {
                             GameUtils.SafeStringFormat(entityPlayer.EntityName),
                             ((Time.timeSinceLevelLoad - entityPlayer.CreationTimeSinceLevelLoad) / 60f).ToCultureInvariantString("0.0")
                         });
                     }
                     entityPlayer.OnEntityUnload();
                 }
                 GC.Collect();
                 MemoryPools.Cleanup();
                 PersistentPlayerData persistentPlayerData = PersistentOperations.GetPersistentPlayerData(_cInfoClientToKick.playerId);
                 if (persistentPlayerData != null)
                 {
                     persistentPlayerData.LastLogin = DateTime.Now;
                     persistentPlayerData.EntityId  = -1;
                 }
                 PersistentOperations.SavePersistentPlayerDataXML();
                 GameManager.Instance.World.aiDirector.RemoveEntity(entityPlayer);
                 GameManager.Instance.World.RemoveEntity(entityPlayer.entityId, EnumRemoveEntityReason.Unloaded);
                 ConnectionManager.Instance.Clients.Remove(_cInfoClientToKick);
                 return(true);
             }
         }
         else if (ReservedSlots.Session_Time > 0)
         {
             int           _session     = int.MinValue;
             List <string> _sessionList = new List <string>(PersistentOperations.Session.Keys);
             if (_sessionList == null)
             {
                 return(true);
             }
             for (int i = 0; i < _sessionList.Count; i++)
             {
                 string     _player = _sessionList[i];
                 ClientInfo _cInfo2 = ConnectionManager.Instance.Clients.ForPlayerId(_player);
                 if (_cInfo2 != null && _playerId != _cInfo2.playerId)
                 {
                     if (ReservedSlots.AdminCheck(_cInfo2.playerId))
                     {
                         continue;
                     }
                     else if (ReservedSlots.ReservedCheck(_cInfo2.playerId))
                     {
                         continue;
                     }
                     else
                     {
                         DateTime _dateTime;
                         if (PersistentOperations.Session.TryGetValue(_cInfo2.playerId, out _dateTime))
                         {
                             TimeSpan varTime           = DateTime.Now - _dateTime;
                             double   fractionalMinutes = varTime.TotalMinutes;
                             int      _timepassed       = (int)fractionalMinutes;
                             if (_timepassed >= ReservedSlots.Session_Time && _timepassed > _session)
                             {
                                 _session           = _timepassed;
                                 _cInfoClientToKick = _cInfo2;
                             }
                         }
                     }
                 }
             }
             if (_session > int.MinValue)
             {
                 ReservedSlots.Kicked.Add(_cInfoClientToKick.playerId, DateTime.Now);
                 API.PlayerDisconnected(_cInfoClientToKick, true);
                 string _phrase20;
                 if (!Phrases.Dict.TryGetValue(20, out _phrase20))
                 {
                     _phrase20 = "{ServerResponseName}- The server is full. You were kicked by the reservation system to open a slot";
                 }
                 _phrase20 = _phrase20.Replace("{ServerResponseName}", LoadConfig.Server_Response_Name);
                 SdtdConsole.Instance.ExecuteSync(string.Format("kick {0} \"{1}\"", _cInfoClientToKick.playerId, _phrase20), (ClientInfo)null);
                 EntityPlayer entityPlayer = (EntityPlayer)GameManager.Instance.World.GetEntity(_cInfoClientToKick.entityId);
                 if (entityPlayer != null)
                 {
                     if (_cInfoClientToKick.entityId != -1)
                     {
                         Log.Out("Player {0} disconnected after {1} minutes", new object[]
                         {
                             GameUtils.SafeStringFormat(entityPlayer.EntityName),
                             ((Time.timeSinceLevelLoad - entityPlayer.CreationTimeSinceLevelLoad) / 60f).ToCultureInvariantString("0.0")
                         });
                     }
                     entityPlayer.OnEntityUnload();
                 }
                 GC.Collect();
                 MemoryPools.Cleanup();
                 PersistentPlayerData persistentPlayerData = PersistentOperations.GetPersistentPlayerData(_cInfoClientToKick.playerId);
                 if (persistentPlayerData != null)
                 {
                     persistentPlayerData.LastLogin = DateTime.Now;
                     persistentPlayerData.EntityId  = -1;
                 }
                 PersistentOperations.SavePersistentPlayerDataXML();
                 GameManager.Instance.World.aiDirector.RemoveEntity(entityPlayer);
                 GameManager.Instance.World.RemoveEntity(entityPlayer.entityId, EnumRemoveEntityReason.Unloaded);
                 ConnectionManager.Instance.Clients.Remove(_cInfoClientToKick);
                 return(true);
             }
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in ReservedSlots.FullServer: {0}.", e.Message));
     }
     return(true);
 }
コード例 #8
0
 public override void Execute(List <string> _params, CommandSenderInfo _senderInfo)
 {
     try
     {
         if (_params.Count != 2 && _params.Count != 8)
         {
             SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 2 or 8, found {0}", _params.Count));
             return;
         }
         if (_params[0].ToLower().Equals("remove"))
         {
             if (_params.Count == 2)
             {
                 if (!ReservedSlots.Dict.ContainsKey(_params[1]))
                 {
                     SdtdConsole.Instance.Output(string.Format("Can not remove id from the reserved slots list. {0} is not in the list.", _params[1]));
                 }
                 else
                 {
                     ReservedSlots.Dict.Remove(_params[1]);
                     SdtdConsole.Instance.Output(string.Format("Removed id {0} from the reserved slots list.", _params[1]));
                 }
                 if (!ChatColorPrefix.Dict.ContainsKey(_params[1]))
                 {
                     SdtdConsole.Instance.Output(string.Format("Can not remove id from the chat color prefix list. {0} is not in the list.", _params[1]));
                 }
                 else
                 {
                     ChatColorPrefix.Dict.Remove(_params[1]);
                     SdtdConsole.Instance.Output(string.Format("Removed id {0} from the chat color prefix list.", _params[1]));
                 }
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 2, found {0}.", _params.Count));
             }
         }
         else if (_params[0].ToLower().Equals("add"))
         {
             ClientInfo _cInfo = ConsoleHelper.ParseParamIdOrName(_params[1]);
             if (_cInfo == null)
             {
                 if (_params[1].Length == 17)
                 {
                     _cInfo = PersistentOperations.GetClientInfoFromSteamId(_params[1]);
                     if (_cInfo == null)
                     {
                         SdtdConsole.Instance.Output(string.Format("Can not find player data attached to {0}", _params[1]));
                         return;
                     }
                 }
                 else
                 {
                     if (int.TryParse(_params[1], out int _entId))
                     {
                         _cInfo = PersistentOperations.GetClientInfoFromEntityId(_entId);
                         if (_cInfo == null)
                         {
                             SdtdConsole.Instance.Output(string.Format("Can not find player data attached to {0}", _params[1]));
                             return;
                         }
                     }
                     else
                     {
                         SdtdConsole.Instance.Output(string.Format("Can not find player data attached to {0}", _params[1]));
                         return;
                     }
                 }
             }
             if (_params.Count == 8)
             {
                 foreach (var group in ChatColorPrefix.Dict)
                 {
                     if (group.Value[1] == _params[3])
                     {
                         SdtdConsole.Instance.Output(string.Format("Can not add id {0} to the chat color prefix list. Group {1} already exists on the list. Create a new entry or add them to this group", _cInfo.playerId, _params[3]));
                         return;
                     }
                 }
                 if (!_params[5].Contains("[") || !_params[5].Contains("]"))
                 {
                     SdtdConsole.Instance.Output(string.Format("Invalid days to expire: {0}", _params[7]));
                     return;
                 }
                 double _daysToExpire;
                 if (!double.TryParse(_params[7], out _daysToExpire))
                 {
                     SdtdConsole.Instance.Output(string.Format("Invalid days to expire: {0}", _params[7]));
                     return;
                 }
                 DateTime _expireDate;
                 if (_daysToExpire > 0d)
                 {
                     _expireDate = DateTime.Now.AddDays(_daysToExpire);
                 }
                 else
                 {
                     _expireDate = DateTime.Now.AddDays(18250d);
                 }
                 if (ReservedSlots.Dict.ContainsKey(_params[1]))
                 {
                     ReservedSlots.Dict[_params[1]]  = _expireDate;
                     ReservedSlots.Dict1[_params[1]] = _params[2];
                     SdtdConsole.Instance.Output(string.Format("Updated id {0}, with the name of {1}, expiring on {2} from the Reserved Slots list.", _params[1], _params[2], _expireDate.ToString()));
                 }
                 else
                 {
                     ReservedSlots.Dict.Add(_params[1], _expireDate);
                     ReservedSlots.Dict1.Add(_params[1], _params[2]);
                     SdtdConsole.Instance.Output(string.Format("Added id {0}, with the name of {1} expiring on {2} from the Reserved Slots list.", _params[1], _params[2], _expireDate.ToString()));
                 }
                 ReservedSlots.UpdateXml();
                 string[] _c = new string[] { _params[2], _params[3], _params[4], _params[5], _params[6] };
                 if (ChatColorPrefix.Dict.ContainsKey(_params[1]))
                 {
                     ChatColorPrefix.Dict[_params[1]]  = _c;
                     ChatColorPrefix.Dict1[_params[1]] = _expireDate;
                     SdtdConsole.Instance.Output(string.Format("Updated id {0}, with the name of {1} to the group {2} using prefix {3}, name color {4} and prefix color {5} that expires {6} to the chat color prefix list.", _cInfo.playerId, _params[2], _params[3], _params[4], _params[5], _params[6], _expireDate.ToString()));
                 }
                 else
                 {
                     ChatColorPrefix.Dict.Add(_params[1], _c);
                     ChatColorPrefix.Dict1.Add(_params[1], _expireDate);
                     SdtdConsole.Instance.Output(string.Format("Added id {0}, with the name of {1} to the group {2} using prefix {3}, name color {4} and prefix color {5} that expires {6} to the chat color prefix list.", _cInfo.playerId, _params[2], _params[3], _params[4], _params[5], _params[6], _expireDate.ToString()));
                 }
                 ChatColorPrefix.UpdateXml();
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 8, found {0}.", _params.Count));
             }
         }
         else
         {
             SdtdConsole.Instance.Output(string.Format("Invalid argument {0}", _params[0]));
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in DonorConsole.Execute: {0}", e.Message));
     }
 }
コード例 #9
0
 public static void Init(object sender, ElapsedEventArgs e)
 {
     if (FlightCheck.IsEnabled)
     {
         if ((int)GameManager.Instance.fps.Counter > 5)
         {
             FlightCheck.AutoFlightCheck();
         }
     }
     if (HatchElevator.IsEnabled)
     {
         HatchElevator.AutoHatchCheck();
     }
     if (UndergroundCheck.IsEnabled)
     {
         if ((int)GameManager.Instance.fps.Counter > 5)
         {
             UndergroundCheck.AutoUndergroundCheck();
         }
     }
     if (Jail.IsEnabled)
     {
         Jail.StatusCheck();
     }
     if (Bounties.IsEnabled || KillNotice.IsEnabled || DeathSpot.IsEnabled || Zones.IsEnabled || Event.Open)
     {
         Players.Exec();
     }
     if (Jail.Jailed.Count > 0)
     {
         _jR++;
         if (_jR >= 60)
         {
             _jR = 0;
             Jail.Clear();
         }
     }
     else
     {
         _jR = 0;
     }
     if (WeatherVote.IsEnabled)
     {
         if (WeatherVote.VoteOpen)
         {
             _wV++;
             if (_wV >= 30)
             {
                 _wV = 0;
                 WeatherVote.CallForVote2();
             }
         }
     }
     else
     {
         _wV = 0;
     }
     if (MutePlayer.IsEnabled && MutePlayer.Mutes.Count > 0)
     {
         _mC++;
         if (_mC >= 60)
         {
             _mC = 0;
             MutePlayer.Clear();
         }
     }
     else
     {
         _mC = 0;
     }
     if (RealWorldTime.IsEnabled)
     {
         _rWT++;
         if (_rWT >= Real_Time_Delay * 60)
         {
             _rWT = 0;
             RealWorldTime.Time();
         }
     }
     else
     {
         _rWT = 0;
     }
     if (Lottery.IsEnabled && Lottery.OpenLotto)
     {
         _l++;
         if (_l == 3300)
         {
             Lottery.Alert();
         }
         if (_l >= 3600)
         {
             _l = 0;
             Lottery.StartLotto();
         }
     }
     else
     {
         _l = 0;
     }
     if (RestartVote.IsEnabled)
     {
         if (RestartVote.VoteOpen)
         {
             _rV++;
             if (_rV >= 30)
             {
                 _rV = 0;
                 RestartVote.CallForVote2();
             }
         }
     }
     else
     {
         _rV = 0;
     }
     if (NightVote.IsEnabled)
     {
         if (NightVote.VoteOpen)
         {
             _nV++;
             if (_nV >= 30)
             {
                 _nV = 0;
                 NightVote.VoteCount();
             }
         }
     }
     else
     {
         _nV = 0;
     }
     if (MuteVote.IsEnabled)
     {
         if (MuteVote.VoteOpen)
         {
             _mV++;
             if (_mV >= 30)
             {
                 _mV = 0;
                 MuteVote.VoteCount();
             }
         }
     }
     else
     {
         _mV = 0;
     }
     if (KickVote.IsEnabled)
     {
         if (KickVote.VoteOpen)
         {
             _kV++;
             if (_kV >= 30)
             {
                 _kV = 0;
                 KickVote.VoteCount();
             }
         }
     }
     else
     {
         _kV = 0;
     }
     if (Hordes.IsEnabled)
     {
         _h++;
         if (_h >= 1200)
         {
             _h = 0;
             Hordes.Exec();
         }
     }
     else
     {
         _h = 0;
     }
     if (EntityCleanup.IsEnabled && (EntityCleanup.BlockIsEnabled || EntityCleanup.FallingTreeEnabled || EntityCleanup.Underground || EntityCleanup.Bikes))
     {
         _eC++;
         if (_eC >= 10)
         {
             _eC = 0;
             EntityCleanup.EntityCheck();
         }
     }
     else
     {
         _eC = 0;
     }
     if (Zones.IsEnabled)
     {
         _rE++;
         if (_rE >= 5)
         {
             _rE = 0;
             EntityCleanup.ZombieCheck();
         }
     }
     else
     {
         _rE = 0;
     }
     if (NightAlert.IsEnabled)
     {
         _nA++;
         if (_nA >= Night_Time_Delay * 60)
         {
             _nA = 0;
             NightAlert.Exec();
         }
     }
     else
     {
         _nA = 0;
     }
     if (Watchlist.IsEnabled)
     {
         _wL++;
         if (_wL >= Alert_Delay * 60)
         {
             _wL = 0;
             Watchlist.CheckWatchlist();
         }
     }
     else
     {
         _wL = 0;
     }
     if (PlayerStatCheck.IsEnabled)
     {
         _pSC++;
         if (_pSC >= 2)
         {
             _pSC = 0;
             PlayerStatCheck.PlayerStat();
         }
     }
     else
     {
         _pSC = 0;
     }
     if (ReservedSlots.IsEnabled)
     {
         _rS++;
         if (_rS >= 120)
         {
             _rS = 0;
             int _playerCount = ConnectionManager.Instance.ClientCount();
             if (_playerCount >= API.MaxPlayers - ReservedSlots.Admin_Slots)
             {
                 ReservedSlots.OpenSlot();
             }
         }
     }
     else
     {
         _rS = 0;
     }
     if (Bloodmoon.IsEnabled & Bloodmoon.Auto_Show)
     {
         if (Auto_Show_Bloodmoon_Delay > 0)
         {
             _b++;
             if (_b >= Auto_Show_Bloodmoon_Delay * 60)
             {
                 _b = 0;
                 Bloodmoon.StatusCheck();
             }
         }
     }
     else
     {
         _b = 0;
     }
     if (PlayerLogs.IsEnabled & Player_Log_Interval > 0)
     {
         _pL++;
         if (_pL >= Player_Log_Interval)
         {
             _pL = 0;
             PlayerLogs.Exec();
         }
     }
     else
     {
         _pL = 0;
     }
     if (StopServer.stopServerCountingDown)
     {
         _sSCD++;
         if (_sSCD == 60)
         {
             _sSCD = 0;
             _sSC--;
         }
         if (_sSC == 0)
         {
             _sSCD = 0;
             StopServer.stopServerCountingDown = false;
             StopServer.Stop();
         }
         if (_sSC == 1 && _sSCD == 0)
         {
             StopServer.StartShutdown3();
         }
         if (_sSC > 1 && _sSCD == 0)
         {
             StopServer.StartShutdown2(_sSC);
         }
         if (StopServer.Kick_30_Seconds)
         {
             if (_sSC == 1 && _sSCD == 30)
             {
                 StopServer.Kick30();
             }
         }
         if (StopServer.Ten_Second_Countdown)
         {
             if (_sSC == 1 && _sSCD == 50)
             {
                 StopServer.StartShutdown4();
             }
             if (_sSC == 1 && _sSCD == 55)
             {
                 StopServer.StartShutdown5();
             }
             if (_sSC == 1 && _sSCD == 56)
             {
                 StopServer.StartShutdown6();
             }
             if (_sSC == 1 && _sSCD == 57)
             {
                 StopServer.StartShutdown7();
             }
             if (_sSC == 1 && _sSCD == 58)
             {
                 StopServer.StartShutdown8();
             }
             if (_sSC == 1 && _sSCD == 59)
             {
                 StopServer.StartShutdown9();
             }
         }
     }
     else
     {
         _sSCD = 0;
         _sSC  = 0;
     }
     if (AutoSaveWorld.IsEnabled & Delay_Between_World_Saves > 0)
     {
         _wSD++;
         if (_wSD >= Delay_Between_World_Saves * 60)
         {
             _wSD = 0;
             AutoSaveWorld.Save();
         }
     }
     else
     {
         _wSD = 0;
     }
     if (AutoShutdown.IsEnabled && !AutoShutdown.Bloodmoon && !StopServer.stopServerCountingDown)
     {
         _sD++;
         if (!Event.Open && _sD >= Shutdown_Delay * 60)
         {
             _sD = 0;
             AutoShutdown.CheckBloodmoon();
         }
     }
     else
     {
         _sD = 0;
     }
     if (AutoShutdown.Bloodmoon)
     {
         _aSB++;
         if (_aSB >= 1800)
         {
             _aSB = 0;
             AutoShutdown.CheckBloodmoon();
         }
     }
     else
     {
         _aSB = 0;
     }
     if (InfoTicker.IsEnabled)
     {
         _iT++;
         if (_iT >= Infoticker_Delay * 60)
         {
             _iT = 0;
             InfoTicker.StatusCheck();
         }
     }
     else
     {
         _iT = 0;
     }
     if (WorldRadius.IsEnabled)
     {
         _wR++;
         if (_wR >= 2)
         {
             _wR = 0;
             WorldRadius.Exec();
         }
     }
     else
     {
         _wR = 0;
     }
     if (VoteReward.IsEnabled && VoteReward.QueOpen)
     {
         _vR++;
         if (_vR >= 60)
         {
             _vR = 0;
             VoteReward.que.Clear();
             VoteReward.QueOpen    = false;
             VoteReward.RewardOpen = true;
         }
     }
     else
     {
         _vR = 0;
     }
     if (Event.Invited)
     {
         _eI++;
         if (_eI >= 900)
         {
             _eI           = 0;
             Event.Invited = false;
             Event.CheckOpen();
         }
     }
     else
     {
         _eI = 0;
     }
     if (Event.Open)
     {
         _eO++;
         if (_eO == _eventTime / 2)
         {
             Event.HalfTime();
         }
         if (_eO == _eventTime - 300)
         {
             Event.FiveMin();
         }
         if (_eO >= _eventTime)
         {
             _eO = 0;
             Event.EndEvent();
         }
     }
     else
     {
         _eO = 0;
     }
     if (RestartVote.Startup)
     {
         _rVS++;
         if (_rVS >= 1800)
         {
             RestartVote.Startup = false;
         }
     }
     else
     {
         _rVS = 0;
     }
     if (Zones.IsEnabled & Zones.reminder.Count > 0)
     {
         _zR++;
         if (_zR >= Zones.Reminder_Delay)
         {
             _zR = 0;
             Zones.Reminder();
         }
     }
     else
     {
         _zR = 0;
     }
 }
コード例 #10
0
 public override void Execute(List <string> _params, CommandSenderInfo _senderInfo)
 {
     try
     {
         if (_params.Count < 1 || _params.Count > 4)
         {
             SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 1 to 4, found {0}", _params.Count));
             return;
         }
         if (_params[0].ToLower().Equals("add"))
         {
             if (_params.Count != 4)
             {
                 SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 4, found {0}.", _params.Count));
                 return;
             }
             if (_params[1].Length != 17)
             {
                 SdtdConsole.Instance.Output(string.Format("Can not add SteamId: Invalid SteamId {0}", _params[1]));
                 return;
             }
             if (ReservedSlots.Dict.ContainsKey(_params[1]))
             {
                 SdtdConsole.Instance.Output(string.Format("Can not add SteamId. {0} is already in the Reserved Slots list.", _params[1]));
                 return;
             }
             double _daysToExpire;
             if (!double.TryParse(_params[3], out _daysToExpire))
             {
                 SdtdConsole.Instance.Output(string.Format("Invalid days to expire: {0}", _params[3]));
                 return;
             }
             DateTime _expireDate;
             if (_daysToExpire > 0d)
             {
                 _expireDate = DateTime.Now.AddDays(_daysToExpire);
             }
             else
             {
                 _expireDate = DateTime.Now.AddDays(18250d);
             }
             ReservedSlots.Dict.Add(_params[1], _expireDate);
             ReservedSlots.Dict1.Add(_params[1], _params[2]);
             SdtdConsole.Instance.Output(string.Format("Added SteamId {0} with the name of {1} that expires on {2} to the Reserved Slots list.", _params[1], _params[2], _expireDate.ToString()));
             ReservedSlots.UpdateXml();
         }
         else if (_params[0].ToLower().Equals("remove"))
         {
             if (_params.Count != 2)
             {
                 SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 2, found {0}", _params.Count));
                 return;
             }
             if (!ReservedSlots.Dict.ContainsKey(_params[1]))
             {
                 SdtdConsole.Instance.Output(string.Format("SteamId {0} was not found.", _params[1]));
                 return;
             }
             ReservedSlots.Dict.Remove(_params[1]);
             ReservedSlots.Dict1.Remove(_params[1]);
             SdtdConsole.Instance.Output(string.Format("Removed SteamId {0} from Reserved Slots list.", _params[1]));
             ReservedSlots.UpdateXml();
         }
         else if (_params[0].ToLower().Equals("list"))
         {
             if (_params.Count != 1)
             {
                 SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 1, found {0}.", _params.Count));
                 return;
             }
             if (ReservedSlots.Dict.Count < 1)
             {
                 SdtdConsole.Instance.Output("There are no steamIds on the Reserved Slots list.");
                 return;
             }
             foreach (KeyValuePair <string, DateTime> _key in ReservedSlots.Dict)
             {
                 string _name;
                 if (ReservedSlots.Dict1.TryGetValue(_key.Key, out _name))
                 {
                     SdtdConsole.Instance.Output(string.Format("{0} {1} {2}", _key.Key, _name, _key.Value));
                 }
             }
         }
         else
         {
             SdtdConsole.Instance.Output(string.Format("Invalid argument {0}.", _params[0]));
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in ReservedSlot.Run: {0}.", e));
     }
 }
コード例 #11
0
        public static void Load()
        {
            Timers.TimerStart();
            if (TeleportCheck.IsEnabled)
            {
                TeleportCheck.DetectionLogsDir();
            }
            if (CountryBan.IsEnabled)
            {
                CountryBan.Load();
            }
            if (FlightCheck.IsEnabled)
            {
                FlightCheck.DetectionLogsDir();
            }
            if (HatchElevator.IsEnabled)
            {
                HatchElevator.DetectionLogsDir();
            }
            if (PlayerLogs.IsEnabled)
            {
                PlayerLogs.PlayerLogsDir();
            }
            if (InventoryCheck.IsEnabled)
            {
                InventoryCheck.PlayerLogsDir();
            }
            if (Report.IsEnabled)
            {
                Report.ReportLogsDir();
            }
            if (PlayerStatCheck.IsEnabled)
            {
                PlayerStatCheck.DetectionLogsDir();
            }
            if (UndergroundCheck.IsEnabled)
            {
                UndergroundCheck.DetectionLogsDir();
            }
            if (Zones.IsEnabled)
            {
                Zones.DetectionLogsDir();
            }
            if (Bank.IsEnabled)
            {
                Bank.CreateFolder();
            }
            if (AuctionBox.IsEnabled)
            {
                AuctionBox.CreateFolder();
            }
            if (Bounties.IsEnabled)
            {
                Bounties.CreateFolder();
            }
            if (CredentialCheck.IsEnabled)
            {
                CredentialCheck.CreateFolder();
            }
            if (DupeLog.IsEnabled)
            {
                DupeLog.CreateFolder();
            }
            PollConsole.CreateFolder();
            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 (UndergroundCheck.IsRunning && !UndergroundCheck.IsEnabled)
            {
                UndergroundCheck.Unload();
            }
            if (!UndergroundCheck.IsRunning && UndergroundCheck.IsEnabled)
            {
                UndergroundCheck.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 (MutePlayer.IsEnabled)
            {
                MutePlayer.MuteList();
            }
            if (Jail.IsEnabled)
            {
                Jail.JailList();
            }
            if (Animals.IsEnabled)
            {
                Animals.AnimalList();
            }
            if (AutoShutdown.IsEnabled)
            {
                AutoShutdown.ShutdownTime();
            }
        }
コード例 #12
0
        public override void Execute(List <string> _params, CommandSenderInfo _senderInfo)
        {
            try
            {
                if (_params.Count != 2 && _params.Count != 3 && _params.Count != 6)
                {
                    SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Wrong number of arguments, expected 2, 3 or 6, found '{0}'", _params.Count));

                    return;
                }
                if (_params[0].ToLower().Equals("add"))
                {
                    string     id = "", playerName = "";
                    ClientInfo cInfo = ConsoleHelper.ParseParamIdOrName(_params[1]);
                    if (cInfo != null)
                    {
                        id         = cInfo.CrossplatformId.CombinedString;
                        playerName = cInfo.playerName;
                    }
                    else if (_params[1].Contains("EOS_"))
                    {
                        PersistentPlayerData ppd = PersistentOperations.GetPersistentPlayerDataFromId(_params[1]);
                        if (ppd != null)
                        {
                            id         = ppd.UserIdentifier.CombinedString;
                            playerName = ppd.PlayerName;
                        }
                        else
                        {
                            SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Unable to locate player data for '{0}'", _params[1]));

                            return;
                        }
                    }
                    else
                    {
                        SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Invalid id '{0}'. Use their EOS id when offline", _params[1]));

                        return;
                    }
                    if (_params.Count == 3)
                    {
                        if (!double.TryParse(_params[2], out double daysToExpire))
                        {
                            SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Unable to add player. Invalid days to expire '{0}'", _params[2]));

                            return;
                        }
                        DateTime expiryDate;
                        if (daysToExpire > 0d)
                        {
                            expiryDate = DateTime.Now.AddDays(daysToExpire);
                        }
                        else
                        {
                            expiryDate = DateTime.Now.AddDays(18250d);
                        }
                        if (ChatColor.IsEnabled)
                        {
                            string[] c = new string[] { playerName, "", "", "" };
                            if (ChatColor.ExpireDate.ContainsKey(id))
                            {
                                ChatColor.ExpireDate.TryGetValue(id, out DateTime oldDate);
                                if (daysToExpire > 0d)
                                {
                                    oldDate.AddDays(daysToExpire);
                                }
                                else
                                {
                                    oldDate.AddDays(18250d);
                                }
                                ChatColor.Players[id]    = c;
                                ChatColor.ExpireDate[id] = oldDate;
                                SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Added id '{0}' named '{1}' using no colors or prefix. Expiration set to '{2}' on the chat color list", id, playerName, expiryDate.ToString()));

                                ChatColor.UpdateXml();
                            }
                            else
                            {
                                ChatColor.Players.Add(id, c);
                                ChatColor.ExpireDate.Add(id, expiryDate);
                                SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Added id '{0}' named '{1}' using no colors or prefix. Expiration set to '{2}' on the chat color list", id, playerName, expiryDate.ToString()));

                                ChatColor.UpdateXml();
                            }
                        }
                        else
                        {
                            SingletonMonoBehaviour <SdtdConsole> .Instance.Output("[SERVERTOOLS] Chat color is not enabled. Unable to add player to list");
                        }
                        if (ReservedSlots.IsEnabled)
                        {
                            if (ReservedSlots.Dict.ContainsKey(id))
                            {
                                ReservedSlots.Dict.TryGetValue(id, out DateTime oldDate);
                                if (daysToExpire > 0d)
                                {
                                    oldDate.AddDays(daysToExpire);
                                }
                                else
                                {
                                    oldDate.AddDays(18250d);
                                }
                                ReservedSlots.Dict[id]  = oldDate;
                                ReservedSlots.Dict1[id] = playerName;
                                ReservedSlots.UpdateXml();
                                SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Added id '{0}' with name '{1}'. Expiration set to '{2}' on the reserved list", id, playerName, expiryDate.ToString()));
                            }
                            else
                            {
                                ReservedSlots.Dict.Add(id, expiryDate);
                                ReservedSlots.Dict1.Add(id, playerName);
                                ReservedSlots.UpdateXml();
                                SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Added id '{0}' with name '{1}'. Expiration set to '{2}' on the reserved list", id, playerName, expiryDate.ToString()));
                            }
                        }
                        else
                        {
                            SingletonMonoBehaviour <SdtdConsole> .Instance.Output("[SERVERTOOLS] Reserved slots is not enabled. Unable to add player to list");
                        }
                    }
                    else if (_params.Count == 6)
                    {
                        if (!double.TryParse(_params[5], out double daysToExpire))
                        {
                            SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Invalid days to expire '{0}'", _params[5]));

                            return;
                        }
                        DateTime expiryDate;
                        if (daysToExpire > 0d)
                        {
                            expiryDate = DateTime.Now.AddDays(daysToExpire);
                        }
                        else
                        {
                            expiryDate = DateTime.Now.AddDays(18250d);
                        }
                        if (ChatColor.IsEnabled)
                        {
                            string colorTag1;
                            if (ColorList.Colors.ContainsKey(_params[2].ToLower()))
                            {
                                ColorList.Colors.TryGetValue(_params[2].ToLower(), out colorTag1);
                            }
                            else
                            {
                                colorTag1 = _params[2].ToUpper();
                                if (colorTag1 != "" && !colorTag1.StartsWith("["))
                                {
                                    colorTag1 = colorTag1.Insert(0, "[");
                                    colorTag1 = colorTag1.Insert(colorTag1.Length, "]");
                                }
                            }
                            string colorTag2;
                            if (ColorList.Colors.ContainsKey(_params[4].ToLower()))
                            {
                                ColorList.Colors.TryGetValue(_params[4].ToLower(), out colorTag2);
                            }
                            else
                            {
                                colorTag2 = _params[4].ToUpper();
                                if (colorTag2 != "" && !colorTag2.StartsWith("["))
                                {
                                    colorTag2 = colorTag2.Insert(0, "[");
                                    colorTag2 = colorTag2.Insert(colorTag2.Length, "]");
                                }
                            }
                            string[] c = new string[] { playerName, colorTag1, _params[3], colorTag2 };
                            if (ChatColor.ExpireDate.ContainsKey(id))
                            {
                                ChatColor.ExpireDate.TryGetValue(id, out DateTime oldDate);
                                if (daysToExpire > 0d)
                                {
                                    oldDate.AddDays(daysToExpire);
                                }
                                else
                                {
                                    oldDate.AddDays(18250d);
                                }
                                ChatColor.Players[id]    = c;
                                ChatColor.ExpireDate[id] = oldDate;
                                SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Added player id '{0}' with name '{1}' using color '{2}' and prefix '{3}' using color '{4}'. Expiration set to '{5}' on the chat color list", id, playerName, colorTag1, _params[3], colorTag2, expiryDate.ToString()));

                                ChatColor.UpdateXml();
                            }
                            else
                            {
                                ChatColor.Players.Add(id, c);
                                ChatColor.ExpireDate.Add(id, expiryDate);
                                SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Added player id '{0}' with name '{1}' using color '{2}' and prefix '{3}' using color '{4}'. Expiration set to '{5}' on the chat color list", id, playerName, colorTag1, _params[3], colorTag2, expiryDate.ToString()));

                                ChatColor.UpdateXml();
                            }
                        }
                        else
                        {
                            SingletonMonoBehaviour <SdtdConsole> .Instance.Output("[SERVERTOOLS] Chat color is not enabled. Unable to add player to list");
                        }
                        if (ReservedSlots.IsEnabled)
                        {
                            if (ReservedSlots.Dict.ContainsKey(id))
                            {
                                ReservedSlots.Dict.TryGetValue(id, out DateTime oldDate);
                                if (daysToExpire > 0d)
                                {
                                    oldDate.AddDays(daysToExpire);
                                }
                                else
                                {
                                    oldDate.AddDays(18250d);
                                }
                                ReservedSlots.Dict[id]  = oldDate;
                                ReservedSlots.Dict1[id] = playerName;
                                ReservedSlots.UpdateXml();
                                SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Added player id '{0}' with name '{1}'. Expiration set to '{2}' on the reserved list", id, playerName, expiryDate.ToString()));
                            }
                            else
                            {
                                ReservedSlots.Dict.Add(id, expiryDate);
                                ReservedSlots.Dict1.Add(id, playerName);
                                ReservedSlots.UpdateXml();
                                SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Added player id '{0}' with name '{1}'. Expiration set to '{2}' on the reserved list", id, playerName, expiryDate.ToString()));
                            }
                        }
                        else
                        {
                            SingletonMonoBehaviour <SdtdConsole> .Instance.Output("[SERVERTOOLS] Reserved slots is not enabled. Unable to add player to list");
                        }
                    }
                    else
                    {
                        SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Wrong number of arguments, expected 3 or 6, found '{0}'", _params.Count));

                        return;
                    }
                }
                else if (_params[0].ToLower().Equals("edit"))
                {
                    if (_params.Count != 3)
                    {
                        SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Wrong number of arguments, expected 3, found '{0}'", _params.Count));

                        return;
                    }
                    string     steamId = "";
                    ClientInfo cInfo   = ConsoleHelper.ParseParamIdOrName(_params[1]);
                    if (cInfo != null)
                    {
                        steamId = cInfo.PlatformId.ReadablePlatformUserIdentifier;
                    }
                    else
                    {
                        steamId = _params[1];
                    }
                    if (!double.TryParse(_params[2], out double daysToExpire))
                    {
                        SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Unable to edit player. Invalid days to expire: '{0}'", _params[2]));

                        return;
                    }
                    DateTime expiryDate;
                    if (daysToExpire > 0d)
                    {
                        expiryDate = DateTime.Now.AddDays(daysToExpire);
                    }
                    else
                    {
                        expiryDate = DateTime.Now.AddDays(18250d);
                    }
                    if (ChatColor.ExpireDate.ContainsKey(steamId))
                    {
                        ChatColor.ExpireDate[steamId] = expiryDate;
                        ChatColor.UpdateXml();
                        SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Edited player id '{0}'. Expiry set to '{1}' on the reserved slots list", steamId, expiryDate));
                    }
                    if (ReservedSlots.Dict.ContainsKey(steamId))
                    {
                        ReservedSlots.Dict[steamId] = expiryDate;
                        ReservedSlots.UpdateXml();
                        SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Edited player id '{0}'. Expiry set to '{1}' on the reserved slots list", steamId, expiryDate));
                    }
                    return;
                }
                else if (_params[0].ToLower().Equals("remove"))
                {
                    if (_params.Count != 2)
                    {
                        SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Wrong number of arguments, expected 2, found '{0}'", _params.Count));

                        return;
                    }
                    string     steamId = "";
                    ClientInfo cInfo   = ConsoleHelper.ParseParamIdOrName(_params[1]);
                    if (cInfo != null)
                    {
                        steamId = cInfo.PlatformId.ReadablePlatformUserIdentifier;
                    }
                    else
                    {
                        steamId = _params[1];
                    }
                    if (ChatColor.Players.ContainsKey(steamId))
                    {
                        ChatColor.Players.Remove(steamId);
                        ChatColor.ExpireDate.Remove(steamId);
                        SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Removed player id '{0}' from the chat color prefix list", steamId));
                    }
                    if (ReservedSlots.Dict.ContainsKey(steamId))
                    {
                        ReservedSlots.Dict.Remove(steamId);
                        SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Removed player id '{0}' from the reserved slots list", steamId));
                    }
                    return;
                }
                else
                {
                    SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Invalid argument '{0}'", _params[0]));
                }
            }
            catch (Exception e)
            {
                Log.Out(string.Format("[SERVERTOOLS] Error in DonorConsole.Execute: {0}", e.Message));
            }
        }
コード例 #13
0
 public override void Execute(List <string> _params, CommandSenderInfo _senderInfo)
 {
     try
     {
         if (_params[0].ToLower().Equals("remove"))
         {
             if (_params.Count == 2)
             {
                 if (!ReservedSlots.Dict.ContainsKey(_params[1]))
                 {
                     SdtdConsole.Instance.Output(string.Format("Can not remove Id from the reserved slots list. {0} is not in the list.", _params[1]));
                 }
                 else
                 {
                     ReservedSlots.Dict.Remove(_params[1]);
                     SdtdConsole.Instance.Output(string.Format("Remove Id {0} from the reserved slots list.", _params[1]));
                 }
                 if (!ChatColorPrefix.dict.ContainsKey(_params[1]))
                 {
                     SdtdConsole.Instance.Output(string.Format("Can not remove Id from the chat color prefix list. {0} is not in the list.", _params[1]));
                 }
                 else
                 {
                     ChatColorPrefix.dict.Remove(_params[1]);
                     SdtdConsole.Instance.Output(string.Format("Remove Id {0} from the chat color prefix list.", _params[1]));
                 }
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 2, found {0}.", _params.Count));
             }
         }
         else if (_params[0].ToLower().Equals("add"))
         {
             if (_params.Count == 7)
             {
                 if (ReservedSlots.Dict.ContainsKey(_params[1]))
                 {
                     SdtdConsole.Instance.Output(string.Format("Can not add Id to the reserved slots list. {0} is in the list.", _params[1]));
                 }
                 else
                 {
                     double _daysToExpire;
                     if (!double.TryParse(_params[6], out _daysToExpire))
                     {
                         SdtdConsole.Instance.Output(string.Format("Invalid days to expire: {0}", _params[6]));
                         return;
                     }
                     DateTime _expireDate;
                     if (_daysToExpire > 0d)
                     {
                         _expireDate = DateTime.Now.AddDays(_daysToExpire);
                     }
                     else
                     {
                         _expireDate = DateTime.Now.AddDays(18250d);
                     }
                     ReservedSlots.Dict.Add(_params[1], _expireDate);
                     ReservedSlots.Dict1.Add(_params[1], _params[2]);
                     SdtdConsole.Instance.Output(string.Format("Added Id {0} with the name of {1} that expires on {2} to the Reserved Slots list.", _params[1], _params[2], _expireDate.ToString()));
                     ReservedSlots.UpdateXml();
                 }
                 if (ChatColorPrefix.dict.ContainsKey(_params[1]))
                 {
                     SdtdConsole.Instance.Output(string.Format("Can not add Id to the chat color prefix list. {0} is in the list.", _params[1]));
                 }
                 else
                 {
                     double _daysToExpire;
                     if (!double.TryParse(_params[6], out _daysToExpire))
                     {
                         SdtdConsole.Instance.Output(string.Format("Invalid days to expire: {0}", _params[6]));
                         return;
                     }
                     DateTime _expireDate;
                     if (_daysToExpire > 0d)
                     {
                         _expireDate = DateTime.Now.AddDays(_daysToExpire);
                     }
                     else
                     {
                         _expireDate = DateTime.Now.AddDays(18250d);
                     }
                     string _color = "";
                     if (!_params[5].StartsWith("["))
                     {
                         _color = "[" + _params[5] + "]";
                     }
                     else
                     {
                         _color = _params[5];
                     }
                     string[] _c = new string[] { _params[2], _params[3], _params[4], _color };
                     ChatColorPrefix.dict.Add(_params[1], _c);
                     ChatColorPrefix.dict1.Add(_params[1], _expireDate);
                     SdtdConsole.Instance.Output(string.Format("Added Id {0} with the name of {1} to the group {2} with prefix {3} and color {4} that expires {5} to the chat color prefix list.", _params[1], _params[2], _params[3], _params[4], _color, _expireDate.ToString()));
                     ChatColorPrefix.UpdateXml();
                 }
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 7, found {0}.", _params.Count));
             }
         }
         else
         {
             SdtdConsole.Instance.Output(string.Format("Invalid argument {0}", _params[0]));
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in DonorConsole.Execute: {0}", e));
     }
 }
コード例 #14
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();
        }
コード例 #15
0
 public void PlayerSpawning(ClientInfo _cInfo, int _chunkViewDim, PlayerProfile _playerProfile)
 {
     if (_cInfo != null)
     {
         if (CountryBan.IsEnabled && _cInfo.ip != "127.0.0.1" && !_cInfo.ip.StartsWith("192.168"))
         {
             if (CountryBan.IsCountryBanned(_cInfo))
             {
                 return;
             }
         }
         string    _sql    = string.Format("SELECT steamid FROM Players WHERE steamid = '{0}'", _cInfo.playerId);;
         DataTable _result = SQL.TQuery(_sql);
         string    _name   = SQL.EscapeString(_cInfo.playerName);
         if (_result.Rows.Count == 0)
         {
             _sql = string.Format("INSERT INTO Players (steamid, playername, last_joined) VALUES ('{0}', '{1}', '{2}')", _cInfo.playerId, _name, DateTime.Now);
         }
         else
         {
             _sql = string.Format("UPDATE Players SET playername = '{0}', last_joined = '{1}' WHERE steamid = '{2}'", _name, DateTime.Now, _cInfo.playerId);
         }
         _result.Dispose();
         SQL.FastQuery(_sql);
         if (StopServer.NoEntry)
         {
             int    _seconds = (60 - Timers._sSCD);
             string _phrase452;
             if (!Phrases.Dict.TryGetValue(452, out _phrase452))
             {
                 _phrase452 = "Shutdown is in {Minutes} minutes {Seconds} seconds. Please come back after the server restarts.";
             }
             _phrase452 = _phrase452.Replace("{Minutes}", Timers._sSC.ToString());
             _phrase452 = _phrase452.Replace("{Seconds}", _seconds.ToString());
             SdtdConsole.Instance.ExecuteSync(string.Format("kick {0} \"{1}\"", _cInfo.entityId, _phrase452), (ClientInfo)null);
         }
         if (ReservedSlots.IsEnabled)
         {
             if (ReservedSlots.Kicked.ContainsKey(_cInfo.playerName))
             {
                 DateTime _dateTime;
                 ReservedSlots.Kicked.TryGetValue(_cInfo.playerId, out _dateTime);
                 TimeSpan varTime           = DateTime.Now - _dateTime;
                 double   fractionalMinutes = varTime.TotalMinutes;
                 int      _timepassed       = (int)fractionalMinutes;
                 if (_timepassed >= 5)
                 {
                     int    _timeleft = 5 - _timepassed;
                     string _phrase22;
                     if (!Phrases.Dict.TryGetValue(22, out _phrase22))
                     {
                         _phrase22 = "Sorry {PlayerName} you have reached the max session time. Please wait {TimeRemaining} minutes before rejoining.";
                     }
                     _phrase22 = _phrase22.Replace("{PlayerName}", _cInfo.playerName);
                     _phrase22 = _phrase22.Replace("{TimeRemaining}", _timeleft.ToString());
                     SdtdConsole.Instance.ExecuteSync(string.Format("kick {0} \"{1}\"", _cInfo.playerId, _phrase22), (ClientInfo)null);
                 }
                 else
                 {
                     ReservedSlots.CheckReservedSlot(_cInfo);
                 }
             }
             else
             {
                 ReservedSlots.CheckReservedSlot(_cInfo);
             }
         }
         if (CredentialCheck.IsEnabled)
         {
             CredentialCheck.AccCheck(_cInfo);
         }
         if (Motd.IsEnabled && !Motd.Show_On_Respawn)
         {
             Motd.Send(_cInfo);
         }
         if (AutoShutdown.IsEnabled)
         {
             if (AutoShutdown.Alert_On_Login)
             {
                 AutoShutdown.CheckNextShutdown(_cInfo, false);
             }
         }
         if (Bloodmoon.Show_On_Login && !Bloodmoon.Show_On_Respawn)
         {
             Bloodmoon.GetBloodmoon(_cInfo, false);
         }
         if (LoginNotice.IsEnabled)
         {
             LoginNotice.PlayerCheck(_cInfo);
         }
         Players.SessionTime(_cInfo);
     }
 }
コード例 #16
0
 public override void Execute(List <string> _params, CommandSenderInfo _senderInfo)
 {
     try
     {
         if (_params.Count != 1 && _params.Count != 2 && _params.Count != 4)
         {
             SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Wrong number of arguments, expected 1, 2 or 4, found {0}", _params.Count));
             return;
         }
         if (_params[0].ToLower().Equals("off"))
         {
             if (ReservedSlots.IsEnabled)
             {
                 ReservedSlots.IsEnabled = false;
                 Config.WriteXml();
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Reserved slots has been set to off"));
                 return;
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Reserved slots is already off"));
                 return;
             }
         }
         else if (_params[0].ToLower().Equals("on"))
         {
             if (!ReservedSlots.IsEnabled)
             {
                 ReservedSlots.IsEnabled = true;
                 Config.WriteXml();
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Reserved slots has been set to on"));
                 return;
             }
             else
             {
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Reserved slots is already on"));
                 return;
             }
         }
         else if (_params[0].ToLower().Equals("add"))
         {
             if (_params.Count != 4)
             {
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Wrong number of arguments, expected 4, found {0}", _params.Count));
                 return;
             }
             if (_params[1].Length < 1 || _params[1].Length > 17)
             {
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Can not add Id: Invalid Id {0}", _params[1]));
                 return;
             }
             if (ReservedSlots.Dict.ContainsKey(_params[1]))
             {
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Can not add Id. {0} is already in the Reserved slots list", _params[1]));
                 return;
             }
             double _daysToExpire;
             if (!double.TryParse(_params[3], out _daysToExpire))
             {
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Invalid days to expire: {0}", _params[3]));
                 return;
             }
             DateTime _expireDate;
             if (_daysToExpire > 0d)
             {
                 _expireDate = DateTime.Now.AddDays(_daysToExpire);
             }
             else
             {
                 _expireDate = DateTime.Now.AddDays(18250d);
             }
             ReservedSlots.Dict.Add(_params[1], _expireDate);
             ReservedSlots.Dict1.Add(_params[1], _params[2]);
             ReservedSlots.UpdateXml();
             SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Added Id {0} with the name of {1} that expires on {2} to the Reserved slots list", _params[1], _params[2], _expireDate.ToString()));
         }
         else if (_params[0].ToLower().Equals("remove"))
         {
             if (_params.Count != 2)
             {
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Wrong number of arguments, expected 2, found {0}", _params.Count));
                 return;
             }
             if (_params[1].Length < 1 || _params[1].Length > 17)
             {
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Can not remove Id: Invalid Id {0}", _params[1]));
                 return;
             }
             ClientInfo _cInfo = ConsoleHelper.ParseParamIdOrName(_params[1]);
             if (_cInfo != null)
             {
                 if (!ReservedSlots.Dict.ContainsKey(_cInfo.playerId))
                 {
                     SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Id {0} was not found on the Reserved slots list", _params[1]));
                     return;
                 }
                 ReservedSlots.Dict.Remove(_cInfo.playerId);
                 ReservedSlots.Dict1.Remove(_cInfo.playerId);
                 ReservedSlots.UpdateXml();
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Removed Id {0} from Reserved slots list", _params[1]));
             }
             else
             {
                 if (ReservedSlots.Dict.ContainsKey(_params[1]))
                 {
                     ReservedSlots.Dict.Remove(_params[1]);
                     ReservedSlots.Dict1.Remove(_params[1]);
                     SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Removed Id {0} from Reserved slots list", _params[1]));
                     ReservedSlots.UpdateXml();
                 }
                 else
                 {
                     SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Id {0} was not found on the Reserved slots list", _params[1]));
                 }
             }
         }
         else if (_params[0].ToLower().Equals("list"))
         {
             if (_params.Count != 1)
             {
                 SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Wrong number of arguments, expected 1, found {0}", _params.Count));
                 return;
             }
             if (ReservedSlots.Dict.Count == 0)
             {
                 SdtdConsole.Instance.Output("[SERVERTOOLS] There are no players on the Reserved slots list");
                 return;
             }
             else
             {
                 foreach (var _key in ReservedSlots.Dict)
                 {
                     string _name;
                     if (ReservedSlots.Dict1.TryGetValue(_key.Key, out _name))
                     {
                         SdtdConsole.Instance.Output(string.Format("{0} {1} {2}", _key.Key, _name, _key.Value));
                     }
                 }
             }
         }
         else
         {
             SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Invalid argument {0}", _params[0]));
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in ReservedSlotConsole.Execute: {0}", e.Message));
     }
 }
コード例 #17
0
        public override void Execute(List <string> _params, CommandSenderInfo _senderInfo)
        {
            try
            {
                if (_params.Count < 1 || _params.Count > 3)
                {
                    SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Wrong number of arguments, expected 1 to 3, found '{0}'", _params.Count));

                    return;
                }
                if (_params[0].ToLower().Equals("off"))
                {
                    if (ReservedSlots.IsEnabled)
                    {
                        ReservedSlots.IsEnabled = false;
                        Config.WriteXml();
                        Config.LoadXml();
                        SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Reserved slots has been set to off"));

                        return;
                    }
                    else
                    {
                        SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Reserved slots is already off"));

                        return;
                    }
                }
                else if (_params[0].ToLower().Equals("on"))
                {
                    if (!ReservedSlots.IsEnabled)
                    {
                        ReservedSlots.IsEnabled = true;
                        Config.WriteXml();
                        Config.LoadXml();
                        SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Reserved slots has been set to on"));

                        return;
                    }
                    else
                    {
                        SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Reserved slots is already on"));

                        return;
                    }
                }
                else if (_params[0].ToLower().Equals("add"))
                {
                    if (_params.Count != 3)
                    {
                        SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Wrong number of arguments, expected 3, found '{0}'", _params.Count));

                        return;
                    }
                    string     id = "", playerName = "";
                    ClientInfo cInfo = PersistentOperations.GetClientInfoFromNameOrId(_params[1]);
                    if (cInfo != null)
                    {
                        id         = cInfo.CrossplatformId.CombinedString;
                        playerName = cInfo.playerName;
                    }
                    else
                    {
                        PersistentPlayerData ppd = PersistentOperations.GetPersistentPlayerDataFromId(_params[1]);
                        if (ppd != null)
                        {
                            id         = ppd.UserIdentifier.CombinedString;
                            playerName = ppd.PlayerName;
                        }
                        else
                        {
                            SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Unable to locate '{0}' online or offline. Use EOS id for offline player", _params[1]));

                            return;
                        }
                    }
                    if (ReservedSlots.Dict.ContainsKey(id))
                    {
                        SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Can not add id '{0}'. Id is already on the reserved slots list", id));

                        return;
                    }
                    if (!double.TryParse(_params[2], out double daysToExpire))
                    {
                        SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Invalid days to expire '{0}'", _params[2]));

                        return;
                    }
                    DateTime expireDate;
                    if (daysToExpire > 0d)
                    {
                        expireDate = DateTime.Now.AddDays(daysToExpire);
                    }
                    else
                    {
                        expireDate = DateTime.Now.AddDays(18250d);
                    }
                    ReservedSlots.Dict.Add(id, expireDate);
                    ReservedSlots.Dict1.Add(id, playerName);
                    ReservedSlots.UpdateXml();
                    SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Added id '{0}' named '{1}' with expiry '{2}' to the reserved slots list", id, playerName, expireDate.ToString()));

                    return;
                }
                else if (_params[0].ToLower().Equals("edit"))
                {
                    if (_params.Count != 3)
                    {
                        SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Wrong number of arguments, expected 3, found '{0}'", _params.Count));

                        return;
                    }
                    string     id = "", playerName = "";
                    ClientInfo cInfo = PersistentOperations.GetClientInfoFromNameOrId(_params[1]);
                    if (cInfo != null)
                    {
                        id         = cInfo.CrossplatformId.CombinedString;
                        playerName = cInfo.playerName;
                    }
                    else if (_params[1].Contains("_"))
                    {
                        PersistentPlayerData ppd = PersistentOperations.GetPersistentPlayerDataFromId(_params[1]);
                        if (ppd != null)
                        {
                            id         = ppd.UserIdentifier.CombinedString;
                            playerName = ppd.PlayerName;
                        }
                        else
                        {
                            SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Unable to locate '{0}' online or offline. Use EOS id for offline players", _params[1]));

                            return;
                        }
                    }
                    if (!ReservedSlots.Dict.ContainsKey(id))
                    {
                        SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Can not edit id '{0}'. This id is not on the reserved slots list", id));

                        return;
                    }
                    if (!double.TryParse(_params[2], out double daysToExpire))
                    {
                        SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Invalid days to expire '{0}'", _params[2]));

                        return;
                    }
                    DateTime expireDate;
                    if (daysToExpire > 0d)
                    {
                        expireDate = DateTime.Now.AddDays(daysToExpire);
                    }
                    else
                    {
                        expireDate = DateTime.Now.AddDays(18250d);
                    }
                    ReservedSlots.Dict[id]  = expireDate;
                    ReservedSlots.Dict1[id] = playerName;
                    ReservedSlots.UpdateXml();
                    SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Edited id '{0}' named '{1}' to expiry '{2}' on the reserved slots list", id, playerName, expireDate.ToString()));

                    return;
                }
                else if (_params[0].ToLower().Equals("remove"))
                {
                    if (_params.Count != 2)
                    {
                        SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Wrong number of arguments, expected 2, found '{0}'", _params.Count));

                        return;
                    }
                    string     id    = "";
                    ClientInfo cInfo = PersistentOperations.GetClientInfoFromNameOrId(_params[1]);
                    if (cInfo != null)
                    {
                        id = cInfo.CrossplatformId.CombinedString;
                    }
                    else if (_params[1].Contains("_"))
                    {
                        PersistentPlayerData ppd = PersistentOperations.GetPersistentPlayerDataFromId(_params[1]);
                        if (ppd != null)
                        {
                            id = ppd.UserIdentifier.CombinedString;
                        }
                    }
                    if (ReservedSlots.Dict.ContainsKey(id))
                    {
                        ReservedSlots.Dict.Remove(id);
                        ReservedSlots.Dict1.Remove(id);
                        ReservedSlots.UpdateXml();
                        SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Removed id '{0}' from the reserved slots list", id));

                        return;
                    }
                    else
                    {
                        SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Unable to remove id '{0}'. Id was not on the reserved slots list", _params[1]));

                        return;
                    }
                }
                else if (_params[0].ToLower().Equals("list"))
                {
                    if (_params.Count != 1)
                    {
                        SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Wrong number of arguments, expected 1, found '{0}'", _params.Count));

                        return;
                    }
                    if (ReservedSlots.Dict.Count == 0)
                    {
                        SingletonMonoBehaviour <SdtdConsole> .Instance.Output("[SERVERTOOLS] There are no players on the Reserved slots list");

                        return;
                    }
                    else
                    {
                        foreach (var key in ReservedSlots.Dict)
                        {
                            if (ReservedSlots.Dict1.TryGetValue(key.Key, out string name))
                            {
                                SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Id '{0}' named '{1}' expires '{2}'", key.Key, name, key.Value));
                            }
                        }
                    }
                }
                else
                {
                    SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Invalid argument '{0}'", _params[0]));
                }
            }
            catch (Exception e)
            {
                Log.Out(string.Format("[SERVERTOOLS] Error in ReservedSlotConsole.Execute: {0}", e.Message));
            }
        }
コード例 #18
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();
            }
        }