Пример #1
0
 public static bool BattleLog(ClientInfo _cInfo)
 {
     try
     {
         EntityPlayer _player = PersistentOperations.GetEntityPlayer(_cInfo.playerId);
         if (_player != null)
         {
             List <EntityPlayer> _players = PersistentOperations.PlayerList();
             if (_players != null)
             {
                 for (int i = 0; i < _players.Count; i++)
                 {
                     EntityPlayer _player2 = _players[i];
                     if (_player2 != null && _player2 != _player)
                     {
                         EntityPlayer _damageTarget  = (EntityPlayer)_player.GetDamagedTarget();
                         EntityPlayer _attackTarget  = (EntityPlayer)_player.GetAttackTarget();
                         EntityPlayer _damageTarget2 = (EntityPlayer)_player2.GetDamagedTarget();
                         EntityPlayer _attackTarget2 = (EntityPlayer)_player2.GetAttackTarget();
                         if ((_damageTarget != null && _damageTarget == _player2 && !_damageTarget.IsFriendsWith(_player2)) ||
                             (_attackTarget != null && _attackTarget == _player2 && !_attackTarget.IsFriendsWith(_player2)) ||
                             (_damageTarget2 != null && _damageTarget2 == _player && !_damageTarget2.IsFriendsWith(_player)) ||
                             (_attackTarget2 != null && _attackTarget2 == _player && !_damageTarget2.IsFriendsWith(_player)))
                         {
                             float _distance = _player2.GetDistanceSq(_player);
                             if (_distance <= 80f)
                             {
                                 Timers.BattleLogTool(_cInfo.playerId);
                             }
                         }
                     }
                 }
             }
         }
         BattleLogger.Players.Remove(_cInfo.playerId);
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in API.BattleLog: {0}.", e.Message));
     }
     return(true);
 }
Пример #2
0
 private static void GameShutdown()
 {
     try
     {
         PersistentOperations.Shutdown_Initiated = true;
         if (WebAPI.IsEnabled && WebAPI.IsRunning)
         {
             WebAPI.Unload();
         }
         Timers.CoreTimerStop();
         RegionReset.Exec();
         Phrases.Unload();
         CommandList.Unload();
         OutputLog.Shutdown();
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in API.GameShutdown: {0}", e.Message));
     }
 }
Пример #3
0
 public static void NewPlayerExec1(ClientInfo _cInfo)
 {
     try
     {
         if (GameManager.Instance.World.Players.dict.ContainsKey(_cInfo.entityId))
         {
             EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId];
             if (_player != null)
             {
                 if (_player.IsSpawned() && _player.IsAlive())
                 {
                     if (NewSpawnTele.IsEnabled && NewSpawnTele.New_Spawn_Tele_Position != "0,0,0")
                     {
                         NewSpawnTele.TeleNewSpawn(_cInfo, _player);
                         if (StartingItems.IsEnabled && StartingItems.ItemList.Count > 0)
                         {
                             Timers.NewPlayerStartingItemsTimer(_cInfo);
                         }
                         else
                         {
                             NewPlayerExec3(_cInfo, _player);
                         }
                     }
                     else
                     {
                         NewPlayerExec2(_cInfo);
                     }
                 }
                 else
                 {
                     Timers.NewPlayerExecTimer(_cInfo);
                 }
             }
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in API.NewPlayerExec1: {0}", e.Message));
     }
 }
Пример #4
0
 public static void ProcessCommand(ClientInfo _cInfo, string _command)
 {
     try
     {
         if (_command.Contains("^"))
         {
             List <string> _commands = _command.Split('^').ToList();
             for (int i = 0; i < _commands.Count; i++)
             {
                 string _commandTrimmed = _commands[i].Trim();
                 if (_commandTrimmed.StartsWith("{Delay}"))
                 {
                     string[] _commandSplit = _commandTrimmed.Split(' ');
                     if (int.TryParse(_commandSplit[1], out int _time))
                     {
                         _commands.RemoveRange(0, i + 1);
                         Timers.Zone_SingleUseTimer(_time, _cInfo.CrossplatformId.CombinedString, _commands);
                         return;
                     }
                     else
                     {
                         Log.Out(string.Format("[SERVERTOOLS] Zone command error. Unable to commit delay with improper integer: {0}", _command));
                     }
                 }
                 else
                 {
                     Command(_cInfo, _commandTrimmed);
                 }
             }
         }
         else
         {
             Command(_cInfo, _command);
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in Zones.ProcessCommand: {0}", e.Message));
     }
 }
Пример #5
0
 public static void NewPlayerExec2(ClientInfo _cInfo, EntityPlayer _player)
 {
     try
     {
         if (_player.IsSpawned() && _player.IsAlive())
         {
             if (StartingItems.IsEnabled && StartingItems.ItemList.Count > 0)
             {
                 StartingItems.SpawnItems(_cInfo);
             }
             NewPlayerExec3(_cInfo, _player);
         }
         else
         {
             Timers.NewPlayerStartingItemsTimer(_cInfo, _player);
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in API.NewPlayerExec2: {0}.", e.Message));
     }
 }
Пример #6
0
 public static void Disconnect(ClientInfo _cInfo, string[] _stats)
 {
     try
     {
         if (_cInfo != null)
         {
             Phrases.Dict.TryGetValue(594, out string _phrase594);
             _phrase594 = _phrase594.Replace("{PlayerName}", _stats[0]);
             _phrase594 = _phrase594.Replace("{PlayTime}", _stats[1]);
             _phrase594 = _phrase594.Replace("{PlayerKills}", _stats[2]);
             _phrase594 = _phrase594.Replace("{ZombieKills}", _stats[3]);
             _phrase594 = _phrase594.Replace("{Deaths}", _stats[4]);
             _phrase594 = _phrase594.Replace("{Score}", _stats[5]);
             ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase594 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
             Timers.DisconnectHardcorePlayer(_cInfo);
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in Hardcore.Disconnect: {0}", e.Message));
     }
 }
 public void Save()
 {
     try
     {
         if (!Saving)
         {
             Saving = true;
             Stream          stream     = File.Open(filepath, FileMode.Create, FileAccess.ReadWrite);
             BinaryFormatter bFormatter = new BinaryFormatter();
             bFormatter.Serialize(stream, this);
             stream.Close();
         }
         else
         {
             Timers.SaveDelay();
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Exception in PersistentContainer.Save: {0}", e.Message));
     }
     Saving = false;
 }
Пример #8
0
        public static void RemoveCurrency(string _steamid, int _amount)
        {
            int        count = 0;
            ClientInfo cInfo = PersistentOperations.GetClientInfoFromNameOrId(_steamid);

            if (cInfo != null)
            {
                EntityPlayer player = PersistentOperations.GetEntityPlayer(cInfo.entityId);
                if (player != null)
                {
                    if (player.IsSpawned())
                    {
                        count = GetCurrency(cInfo.CrossplatformId.CombinedString);
                        if (count > _amount)
                        {
                            count -= _amount;
                            ItemStack stack = new ItemStack(ItemClass.GetItem(PersistentOperations.Currency_Item, false), count);
                            if (stack != null)
                            {
                                UpdateRequired.Add(cInfo.entityId, count);
                                GameEventManager.Current.HandleAction("action_currency", null, player, false, "");
                                cInfo.SendPackage(NetPackageManager.GetPackage <NetPackageGameEventResponse>().Setup("action_currency", cInfo.playerName, "", "", NetPackageGameEventResponse.ResponseTypes.Approved));
                            }
                        }
                        else if (count == _amount)
                        {
                            GameEventManager.Current.HandleAction("action_currency", null, player, false, "");
                            cInfo.SendPackage(NetPackageManager.GetPackage <NetPackageGameEventResponse>().Setup("action_currency", cInfo.playerName, "", "", NetPackageGameEventResponse.ResponseTypes.Approved));
                        }
                    }
                    else
                    {
                        Timers.Wallet_Remove_SingleUseTimer(cInfo.CrossplatformId.CombinedString, count);
                    }
                }
            }
        }
Пример #9
0
 public static void ZoneCommandDelayed(string _playerId, List <string> _commands)
 {
     try
     {
         ClientInfo cInfo = PersistentOperations.GetClientInfoFromNameOrId(_playerId);
         if (cInfo != null)
         {
             for (int i = 0; i < _commands.Count; i++)
             {
                 string _commandTrimmed = _commands[i].Trim();
                 if (_commandTrimmed.StartsWith("{Delay}"))
                 {
                     string[] _commandSplit = _commandTrimmed.Split(' ');
                     if (int.TryParse(_commandSplit[1], out int _time))
                     {
                         _commands.RemoveRange(0, i + 1);
                         Timers.Zone_SingleUseTimer(_time, cInfo.CrossplatformId.CombinedString, _commands);
                         return;
                     }
                     else
                     {
                         Log.Out(string.Format("[SERVERTOOLS] Zone command error. Unable to commit delay with improper integer: {0}", _commands));
                     }
                 }
                 else
                 {
                     Command(cInfo, _commandTrimmed);
                 }
             }
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in Zones.ZoneCommandDelayed: {0}", e.Message));
     }
 }
Пример #10
0
 public static void PlayerDisconnected(ClientInfo _cInfo, bool _bShutdown)
 {
     try
     {
         if (_cInfo != null)
         {
             if (_bShutdown)
             {
                 Log.Out("[SERVERTOOLS] Server shutdown, player disconnected.");
             }
             else if (BattleLogger.IsEnabled && BattleLogger.Exit.Contains(_cInfo.playerId))
             {
                 string _ip = _cInfo.ip;
                 if (_ip.Contains(":"))
                 {
                     _ip = _ip.Split(':').First();
                 }
                 Timers.BattleLogDelay(_cInfo, _ip);
                 Log.Out("[SERVERTOOLS] Player disconnected");
             }
             else
             {
                 Log.Out("[SERVERTOOLS] Player disconnected");
             }
             if (!string.IsNullOrEmpty(_cInfo.playerId) && _cInfo.entityId != -1)
             {
                 if (FriendTeleport.Dict.ContainsKey(_cInfo.entityId))
                 {
                     FriendTeleport.Dict.Remove(_cInfo.entityId);
                     FriendTeleport.Dict1.Remove(_cInfo.entityId);
                 }
                 if (FriendTeleport.Dict.ContainsKey(_cInfo.entityId))
                 {
                     FriendTeleport.Dict.Remove(_cInfo.entityId);
                 }
                 if (FriendTeleport.Dict1.ContainsKey(_cInfo.entityId))
                 {
                     FriendTeleport.Dict1.Remove(_cInfo.entityId);
                 }
                 if (Wallet.IsEnabled && Wallet.Session_Bonus > 0)
                 {
                     if (PersistentOperations.Session.TryGetValue(_cInfo.playerId, out DateTime _time))
                     {
                         TimeSpan varTime           = DateTime.Now - _time;
                         double   fractionalMinutes = varTime.TotalMinutes;
                         int      _timepassed       = (int)fractionalMinutes;
                         if (_timepassed > 60)
                         {
                             int _sessionBonus = _timepassed / 60 * Wallet.Session_Bonus;
                             if (_sessionBonus > 0)
                             {
                                 Wallet.AddCoinsToWallet(_cInfo.playerId, _sessionBonus);
                             }
                         }
                         int _timePlayed = PersistentContainer.Instance.Players[_cInfo.playerId].TotalTimePlayed;
                         PersistentContainer.Instance.Players[_cInfo.playerId].TotalTimePlayed = _timePlayed + _timepassed;
                         PersistentContainer.Instance.Save();
                     }
                 }
                 if (PersistentOperations.Session.ContainsKey(_cInfo.playerId))
                 {
                     PersistentOperations.Session.Remove(_cInfo.playerId);
                 }
                 if (PersistentOperations.PvEViolations.ContainsKey(_cInfo.entityId))
                 {
                     PersistentOperations.PvEViolations.Remove(_cInfo.entityId);
                 }
                 if (Bank.TransferId.ContainsKey(_cInfo.playerId))
                 {
                     Bank.TransferId.Remove(_cInfo.playerId);
                 }
                 if (Zones.ZoneInfo.ContainsKey(_cInfo.entityId))
                 {
                     Zones.ZoneInfo.Remove(_cInfo.entityId);
                 }
                 if (Zones.Forgive.ContainsKey(_cInfo.entityId))
                 {
                     Zones.Forgive.Remove(_cInfo.entityId);
                 }
                 if (Zones.Victim.ContainsKey(_cInfo.entityId))
                 {
                     Zones.Victim.Remove(_cInfo.entityId);
                 }
                 if (Zones.Reminder.ContainsKey(_cInfo.entityId))
                 {
                     Zones.Reminder.Remove(_cInfo.entityId);
                 }
                 if (Zones.ZonePvE.Contains(_cInfo.entityId))
                 {
                     Zones.ZonePvE.Remove(_cInfo.entityId);
                 }
                 if (BloodmoonWarrior.WarriorList.Contains(_cInfo.playerId))
                 {
                     BloodmoonWarrior.WarriorList.Remove(_cInfo.playerId);
                 }
                 if (BattleLogger.Exit.Contains(_cInfo.playerId))
                 {
                     BattleLogger.Exit.Remove(_cInfo.playerId);
                 }
                 if (BattleLogger.ExitPos.ContainsKey(_cInfo.playerId))
                 {
                     BattleLogger.ExitPos.Remove(_cInfo.playerId);
                 }
                 if (KillNotice.Damage.ContainsKey(_cInfo.entityId))
                 {
                     KillNotice.Damage.Remove(_cInfo.entityId);
                 }
                 if (PlayerChecks.Flag.ContainsKey(_cInfo.entityId))
                 {
                     PlayerChecks.Flag.Remove(_cInfo.entityId);
                 }
                 if (Teleportation.Teleporting.Contains(_cInfo.entityId))
                 {
                     Teleportation.Teleporting.Remove(_cInfo.entityId);
                 }
             }
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in API.PlayerDisconnected: {0}", e.Message));
     }
 }
Пример #11
0
 private static void PlayerSpawnedInWorld(ClientInfo _cInfo, RespawnType _respawnReason, Vector3i _pos)//Spawning player
 {
     try
     {
         if (_cInfo != null && _cInfo.playerId != null)
         {
             if (CredentialCheck.IsEnabled && !CredentialCheck.AccCheck(_cInfo))
             {
                 SdtdConsole.Instance.ExecuteSync(string.Format("ban add {0} 1 years \"Auto detection has banned you for false credentials. Contact an admin if this is a mistake\"", _cInfo.playerId), null);
                 return;
             }
             if (CountryBan.IsEnabled && CountryBan.IsCountryBanned(_cInfo))
             {
                 SdtdConsole.Instance.ExecuteSync(string.Format("ban add {0} 1 years \"Auto detection has banned you for country IP region\"", _cInfo.playerId), null);
                 return;
             }
             PersistentContainer.Instance.Players[_cInfo.playerId].LastJoined = DateTime.Now;
             if (GameManager.Instance.World.Players.dict.ContainsKey(_cInfo.entityId))
             {
                 EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId];
                 if (_player != null)
                 {
                     PersistentContainer.Instance.Players[_cInfo.playerId].PlayerName = _cInfo.playerName;
                     PersistentOperations.SessionTime(_cInfo);
                     if (_respawnReason == RespawnType.EnterMultiplayer)//New player spawning. Game bug can trigger this incorrectly
                     {
                         if (_player.distanceWalked < 1 && _player.totalTimePlayed <= 1)
                         {
                             Timers.NewPlayerTimer(_cInfo);
                         }
                         else
                         {
                             OldPlayerJoined(_cInfo, _player);
                         }
                     }
                     else if (_respawnReason == RespawnType.JoinMultiplayer)//Old player spawning
                     {
                         if (_player.distanceWalked < 1 && _player.totalTimePlayed <= 10)
                         {
                             Timers.NewPlayerTimer(_cInfo);
                         }
                         else
                         {
                             OldPlayerJoined(_cInfo, _player);
                         }
                     }
                     else if (_respawnReason == RespawnType.Died)//Player died, respawning
                     {
                         PlayerDied(_cInfo);
                     }
                     else if (_respawnReason == RespawnType.Teleport)
                     {
                         if (Teleportation.Teleporting.Contains(_cInfo.entityId))
                         {
                             Teleportation.Teleporting.Remove(_cInfo.entityId);
                         }
                     }
                 }
                 if (ExitCommand.IsEnabled && !ExitCommand.Players.ContainsKey(_cInfo.entityId) && GameManager.Instance.adminTools.GetUserPermissionLevel(_cInfo) > ExitCommand.Admin_Level)
                 {
                     ExitCommand.Players.Add(_cInfo.entityId, _player.position);
                 }
             }
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in API.PlayerSpawnedInWorld: {0}", e.Message));
     }
 }
Пример #12
0
 public static void PlayerDisconnected(ClientInfo _cInfo, bool _bShutdown)
 {
     try
     {
         if (_cInfo != null)
         {
             if (!string.IsNullOrEmpty(_cInfo.playerId) && _cInfo.entityId != -1)
             {
                 Log.Out(string.Format("[SERVERTOOLS] Player {0} disconnected", _cInfo.playerId));
                 if (ExitCommand.IsEnabled && ExitCommand.Players.ContainsKey(_cInfo.entityId) && !_bShutdown)
                 {
                     Timers.ExitWithoutCommand(_cInfo, _cInfo.ip);
                 }
                 if (FriendTeleport.Dict.ContainsKey(_cInfo.entityId))
                 {
                     FriendTeleport.Dict.Remove(_cInfo.entityId);
                     FriendTeleport.Dict1.Remove(_cInfo.entityId);
                 }
                 if (FriendTeleport.Dict.ContainsKey(_cInfo.entityId))
                 {
                     FriendTeleport.Dict.Remove(_cInfo.entityId);
                 }
                 if (FriendTeleport.Dict1.ContainsKey(_cInfo.entityId))
                 {
                     FriendTeleport.Dict1.Remove(_cInfo.entityId);
                 }
                 if (Wallet.IsEnabled && Wallet.Session_Bonus > 0)
                 {
                     if (PersistentOperations.Session.TryGetValue(_cInfo.playerId, out DateTime _time))
                     {
                         TimeSpan varTime           = DateTime.Now - _time;
                         double   fractionalMinutes = varTime.TotalMinutes;
                         int      _timepassed       = (int)fractionalMinutes;
                         if (_timepassed > 60)
                         {
                             int _sessionBonus = _timepassed / 60 * Wallet.Session_Bonus;
                             if (_sessionBonus > 0)
                             {
                                 Wallet.AddCoinsToWallet(_cInfo.playerId, _sessionBonus);
                             }
                         }
                         int _timePlayed = PersistentContainer.Instance.Players[_cInfo.playerId].TotalTimePlayed;
                         PersistentContainer.Instance.Players[_cInfo.playerId].TotalTimePlayed = _timePlayed + _timepassed;
                         PersistentContainer.DataChange = true;
                     }
                 }
                 if (PersistentOperations.Session.ContainsKey(_cInfo.playerId))
                 {
                     PersistentOperations.Session.Remove(_cInfo.playerId);
                 }
                 if (PersistentOperations.PvEViolations.ContainsKey(_cInfo.entityId))
                 {
                     PersistentOperations.PvEViolations.Remove(_cInfo.entityId);
                 }
                 if (Bank.TransferId.ContainsKey(_cInfo.playerId))
                 {
                     Bank.TransferId.Remove(_cInfo.playerId);
                 }
                 if (Zones.ZoneInfo.ContainsKey(_cInfo.entityId))
                 {
                     Zones.ZoneInfo.Remove(_cInfo.entityId);
                 }
                 if (Zones.Forgive.ContainsKey(_cInfo.entityId))
                 {
                     Zones.Forgive.Remove(_cInfo.entityId);
                 }
                 if (Zones.Victim.ContainsKey(_cInfo.entityId))
                 {
                     Zones.Victim.Remove(_cInfo.entityId);
                 }
                 if (Zones.Reminder.ContainsKey(_cInfo.entityId))
                 {
                     Zones.Reminder.Remove(_cInfo.entityId);
                 }
                 if (Zones.ZonePvE.Contains(_cInfo.entityId))
                 {
                     Zones.ZonePvE.Remove(_cInfo.entityId);
                 }
                 if (BloodmoonWarrior.WarriorList.Contains(_cInfo.playerId))
                 {
                     BloodmoonWarrior.WarriorList.Remove(_cInfo.playerId);
                 }
                 if (KillNotice.Damage.ContainsKey(_cInfo.entityId))
                 {
                     KillNotice.Damage.Remove(_cInfo.entityId);
                 }
                 if (PlayerChecks.Flag.ContainsKey(_cInfo.entityId))
                 {
                     PlayerChecks.Flag.Remove(_cInfo.entityId);
                 }
                 if (Teleportation.Teleporting.Contains(_cInfo.entityId))
                 {
                     Teleportation.Teleporting.Remove(_cInfo.entityId);
                 }
                 if (PlayerChecks.Movement.ContainsKey(_cInfo.entityId))
                 {
                     PlayerChecks.Movement.Remove(_cInfo.entityId);
                 }
             }
             else
             {
                 Log.Out("[SERVERTOOLS] Player disconnected");
             }
         }
         else
         {
             Log.Out("[SERVERTOOLS] Amorphous blob with no client information disconnected");
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in API.PlayerDisconnected: {0}", e.Message));
     }
 }
Пример #13
0
        public static void Load()
        {
            if (!Directory.Exists(API.ConfigPath))
            {
                Directory.CreateDirectory(API.ConfigPath);
                Log.Out(string.Format("[SERVERTOOLS] Created new directory '{0}'", API.ConfigPath));
            }
            else
            {
                Log.Out(string.Format("[SERVERTOOLS] Located directory '{0}'", API.ConfigPath));
            }
            if (!Directory.Exists(API.ConfigPath + "/Logs/ChatLogs"))
            {
                Directory.CreateDirectory(API.ConfigPath + "/Logs/ChatLogs");
            }
            if (!Directory.Exists(API.ConfigPath + "/Logs/DetectionLogs"))
            {
                Directory.CreateDirectory(API.ConfigPath + "/Logs/DetectionLogs");
            }
            if (!Directory.Exists(API.ConfigPath + "/Logs/BountyLogs"))
            {
                Directory.CreateDirectory(API.ConfigPath + "/Logs/BountyLogs");
            }
            if (!Directory.Exists(API.ConfigPath + "/Logs/AuctionLog"))
            {
                Directory.CreateDirectory(API.ConfigPath + "/Logs/AuctionLogs");
            }
            if (!Directory.Exists(API.ConfigPath + "/Logs/BankLogs"))
            {
                Directory.CreateDirectory(API.ConfigPath + "/Logs/BankLogs");
            }
            if (!Directory.Exists(API.ConfigPath + "/Logs/DupeLogs"))
            {
                Directory.CreateDirectory(API.ConfigPath + "/Logs/DupeLogs");
            }
            if (!Directory.Exists(API.ConfigPath + "/Logs/PlayerLogs"))
            {
                Directory.CreateDirectory(API.ConfigPath + "/Logs/PlayerLogs");
            }
            if (!Directory.Exists(API.ConfigPath + "/Logs/PlayerReports"))
            {
                Directory.CreateDirectory(API.ConfigPath + "/Logs/PlayerReports");
            }
            if (!Directory.Exists(API.ConfigPath + "/Logs/PollLogs"))
            {
                Directory.CreateDirectory(API.ConfigPath + "/Logs/PollLogs");
            }
            if (!Directory.Exists(API.ConfigPath + "/Logs/ChatCommandLogs"))
            {
                Directory.CreateDirectory(API.ConfigPath + "/Logs/ChatCommandLogs");
            }
            if (!Directory.Exists(API.ConfigPath + "/Logs/DamageLogs"))
            {
                Directory.CreateDirectory(API.ConfigPath + "/Logs/DamageLogs");
            }
            if (!Directory.Exists(API.ConfigPath + "/Logs/BlockLogs"))
            {
                Directory.CreateDirectory(API.ConfigPath + "/Logs/BlockLogs");
            }
            if (!Directory.Exists(API.ConfigPath + "/Logs/ConsoleCommandLogs"))
            {
                Directory.CreateDirectory(API.ConfigPath + "/Logs/ConsoleCommandLogs");
            }
            if (!Directory.Exists(API.ConfigPath + "/Logs/WebPanelLogs"))
            {
                Directory.CreateDirectory(API.ConfigPath + "/Logs/WebPanelLogs");
            }
            if (!Directory.Exists(API.ConfigPath + "/Logs/OutputLogs"))
            {
                Directory.CreateDirectory(API.ConfigPath + "/Logs/OutputLogs");
            }
            if (!Directory.Exists(API.GamePath + "/Mods/ServerTools/Config"))
            {
                Directory.CreateDirectory(API.GamePath + "/Mods/ServerTools/Config");
            }
            if (!Directory.Exists(API.GamePath + "/Mods/ServerTools/Config/XUi"))
            {
                Directory.CreateDirectory(API.GamePath + "/Mods/ServerTools/Config/XUi");
            }

            StateManager.Awake();

            RunTimePatch.PatchAll();

            Config.Load();
            Log.Out("[SERVERTOOLS] Running ServerTools v.{0}", Config.Version);

            CommandList.BuildList();
            CommandList.Load();

            PersistentOperations.SetFolders();
            PersistentOperations.CreateCustomXUi();
            PersistentOperations.GetCurrencyName();
            PersistentOperations.EntityIdList();
            PersistentOperations.Player_Killing_Mode = GamePrefs.GetInt(EnumGamePrefs.PlayerKillingMode);

            Mods.Load();

            Phrases.Load();

            HowToSetup.Load();

            if (Fps.IsEnabled)
            {
                Fps.SetTarget();
            }

            if (SleeperRespawn.IsEnabled)
            {
                try
                {
                    SingletonMonoBehaviour <SdtdConsole> .Instance.ExecuteSync(string.Format("sleeperreset"), null);
                }
                catch (XmlException e)
                {
                    Log.Out("[SERVERTOOLS] Failed to reset sleeper spawn points. Error = {0}", e.Message);
                }
            }
            try
            {
                DeleteFiles("DetectionLogs");
                DeleteFiles("BountyLogs");
                DeleteFiles("AuctionLogs");
                DeleteFiles("BankLogs");
                DeleteFiles("DupeLogs");
                DeleteFiles("PlayerLogs");
                DeleteFiles("PlayerReports");
                DeleteFiles("PollLogs");
                DeleteFiles("ChatLogs");
                DeleteFiles("ChatCommandLogs");
                DeleteFiles("DamageLogs");
                DeleteFiles("BlockLogs");
                DeleteFiles("ConsoleCommandLogs");
                DeleteFiles("WebPanelLogs");
                DeleteFiles("OutputLogs");
                Log.Out(string.Format("[SERVERTOOLS] Xml log clean up complete"));
            }
            catch (XmlException e)
            {
                Log.Out("[SERVERTOOLS] Failed to delete old logs. Error = {0}", e.Message);
            }

            if (PersistentContainer.Instance.WorldSeed == 0)
            {
                PersistentContainer.Instance.WorldSeed = GameManager.Instance.World.Seed;
                PersistentContainer.DataChange         = true;
            }
            else if (PersistentContainer.Instance.WorldSeed != GameManager.Instance.World.Seed)
            {
                PersistentContainer.Instance.WorldSeed = GameManager.Instance.World.Seed;
                PersistentContainer.DataChange         = true;
                if (!CleanBin.IsEnabled && PersistentContainer.Instance.Players.IDs.Count > 0)
                {
                    Log.Out("[SERVERTOOLS] Detected a new world. You have old ServerTools data saved from the last map. Run the Clean_Bin tool to remove the data of your choice");
                }
            }

            if (PersistentContainer.Instance.Connections == null)
            {
                Dictionary <string, byte[]> connections = new Dictionary <string, byte[]>();
                PersistentContainer.Instance.Connections = connections;
                Dictionary <string, DateTime> timeOuts = new Dictionary <string, DateTime>();
                PersistentContainer.Instance.ConnectionTimeOut = timeOuts;
                PersistentContainer.DataChange = true;
            }

            if (CleanBin.IsEnabled)
            {
                CleanBin.Exec();
                Log.Out("[SERVERTOOLS] ServerTools.bin has been cleaned. The tool will now disable automatically");
                CleanBin.IsEnabled = false;
                Config.WriteXml();
                Config.LoadXml();
            }

            Track.Cleanup();

            DroppedBagProtection.BuildList();
            BlackJack.BuildDeck();

            ActiveTools.Exec(true);

            Timers.Thirty_Second_Delay();
            Timers.PersistentDataSave();
        }
Пример #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 static void AddCurrency(string _id, int _amount)
        {
            ClientInfo cInfo = PersistentOperations.GetClientInfoFromNameOrId(_id);

            if (cInfo != null)
            {
                EntityPlayer player = PersistentOperations.GetEntityPlayer(cInfo.entityId);
                if (player != null)
                {
                    if (player.IsSpawned())
                    {
                        ItemValue itemValue = ItemClass.GetItem(PersistentOperations.Currency_Item, false);
                        if (itemValue != null)
                        {
                            List <int> stackList = new List <int>();
                            int        maxStack  = itemValue.ItemClass.Stacknumber.Value;
                            if (_amount > maxStack)
                            {
                                for (int i = 0; i < 100; i++)
                                {
                                    if (_amount > maxStack)
                                    {
                                        _amount = _amount - maxStack;
                                        stackList.Add(maxStack);
                                    }
                                    else
                                    {
                                        stackList.Add(_amount);
                                        break;
                                    }
                                }
                            }
                            else
                            {
                                stackList.Add(_amount);
                            }
                            for (int i = 0; i < stackList.Count; i++)
                            {
                                World      world      = GameManager.Instance.World;
                                EntityItem entityItem = (EntityItem)EntityFactory.CreateEntity(new EntityCreationData
                                {
                                    entityClass     = EntityClass.FromString("item"),
                                    id              = EntityFactory.nextEntityID++,
                                    itemStack       = new ItemStack(itemValue, stackList[i]),
                                    pos             = world.Players.dict[cInfo.entityId].position,
                                    rot             = new Vector3(20f, 0f, 20f),
                                    lifetime        = 60f,
                                    belongsPlayerId = cInfo.entityId
                                });
                                world.SpawnEntityInWorld(entityItem);
                                cInfo.SendPackage(NetPackageManager.GetPackage <NetPackageEntityCollect>().Setup(entityItem.entityId, cInfo.entityId));
                                world.RemoveEntity(entityItem.entityId, EnumRemoveEntityReason.Despawned);
                            }
                        }
                    }
                    else
                    {
                        Timers.Wallet_Add_SingleUseTimer(cInfo.CrossplatformId.CombinedString, _amount);
                    }
                }
            }
            else
            {
                PersistentContainer.Instance.Players[cInfo.CrossplatformId.CombinedString].PlayerWallet += _amount;
                PersistentContainer.DataChange = true;
            }
        }
Пример #16
0
 private static void GameShutdown()
 {
     StateManager.Shutdown();
     Timers.Timer2Stop();
     StopServer.Shutdown = true;
 }
Пример #17
0
 public static void PlayerDisconnected(ClientInfo _cInfo, bool _bShutdown)
 {
     try
     {
         if (_cInfo != null && _cInfo.CrossplatformId != null)
         {
             string id = _cInfo.CrossplatformId.CombinedString;
             Log.Out(string.Format("[SERVERTOOLS] Player with id '{0}' '{1}' disconnected", _cInfo.PlatformId.CombinedString, id));
             if (ExitCommand.IsEnabled && ExitCommand.Players.ContainsKey(_cInfo.entityId) && !_bShutdown)
             {
                 Timers.ExitWithoutCommand(_cInfo, _cInfo.ip);
             }
             if (FriendTeleport.Dict.ContainsKey(_cInfo.entityId))
             {
                 FriendTeleport.Dict.Remove(_cInfo.entityId);
                 FriendTeleport.Dict1.Remove(_cInfo.entityId);
             }
             if (FriendTeleport.Dict.ContainsKey(_cInfo.entityId))
             {
                 FriendTeleport.Dict.Remove(_cInfo.entityId);
             }
             if (FriendTeleport.Dict1.ContainsKey(_cInfo.entityId))
             {
                 FriendTeleport.Dict1.Remove(_cInfo.entityId);
             }
             if (Wallet.IsEnabled && Wallet.Session_Bonus > 0)
             {
                 if (PersistentOperations.Session.TryGetValue(id, out DateTime time))
                 {
                     TimeSpan varTime           = DateTime.Now - time;
                     double   fractionalMinutes = varTime.TotalMinutes;
                     int      timepassed        = (int)fractionalMinutes;
                     if (timepassed > 60)
                     {
                         int sessionBonus = timepassed / 60 * Wallet.Session_Bonus;
                         if (sessionBonus > 0)
                         {
                             Wallet.AddCurrency(id, sessionBonus);
                         }
                     }
                     int timePlayed = PersistentContainer.Instance.Players[id].TotalTimePlayed;
                     PersistentContainer.Instance.Players[id].TotalTimePlayed = timePlayed + timepassed;
                     PersistentContainer.DataChange = true;
                 }
             }
             if (Bank.TransferId.ContainsKey(id))
             {
                 Bank.TransferId.Remove(id);
             }
             if (Zones.ZonePlayer.ContainsKey(_cInfo.entityId))
             {
                 Zones.ZonePlayer.Remove(_cInfo.entityId);
             }
             if (Zones.Reminder.ContainsKey(_cInfo.entityId))
             {
                 Zones.Reminder.Remove(_cInfo.entityId);
             }
             if (BloodmoonWarrior.WarriorList.Contains(_cInfo.entityId))
             {
                 BloodmoonWarrior.WarriorList.Remove(_cInfo.entityId);
                 BloodmoonWarrior.KilledZombies.Remove(_cInfo.entityId);
             }
             if (Teleportation.Teleporting.Contains(_cInfo.entityId))
             {
                 Teleportation.Teleporting.Remove(_cInfo.entityId);
             }
             if (LevelUp.PlayerLevels.ContainsKey(_cInfo.entityId))
             {
                 LevelUp.PlayerLevels.Remove(_cInfo.entityId);
             }
             if (KillNotice.Damage.ContainsKey(_cInfo.entityId))
             {
                 KillNotice.Damage.Remove(_cInfo.entityId);
             }
             if (InfiniteAmmo.Dict.ContainsKey(_cInfo.entityId))
             {
                 InfiniteAmmo.Dict.Remove(_cInfo.entityId);
             }
             if (PersistentOperations.NewPlayerQue.Contains(_cInfo))
             {
                 PersistentOperations.NewPlayerQue.Remove(_cInfo);
             }
             if (PersistentOperations.BlockChatCommands.Contains(_cInfo))
             {
                 PersistentOperations.BlockChatCommands.Remove(_cInfo);
             }
             if (PersistentOperations.Session.ContainsKey(id))
             {
                 PersistentOperations.Session.Remove(id);
             }
         }
         else
         {
             Log.Out("[SERVERTOOLS] Player disconnected");
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in API.PlayerDisconnected: {0}", e.Message));
     }
 }
Пример #18
0
        public static void Load(int _state)
        {
            if (_state == 1)
            {
                try
                {
                    Log.Out(string.Format("[ServerTools] Checking for save directory {0}", API.ConfigPath));
                    if (!Directory.Exists(API.ConfigPath))
                    {
                        Directory.CreateDirectory(API.ConfigPath);
                        Log.Out(string.Format("[ServerTools] Created directory {0}", API.ConfigPath));
                    }
                    else
                    {
                        Log.Out("[ServerTools] Directory found");
                    }
                    Log.Out(string.Format("[ServerTools] Checking for logs directory {0}", API.ConfigPath + "/Logs/ChatLogs"));
                    if (!Directory.Exists(API.ConfigPath + "/Logs/ChatLogs"))
                    {
                        Directory.CreateDirectory(API.ConfigPath + "/Logs/ChatLogs");
                        Log.Out(string.Format("[ServerTools] Created directory {0}", API.ConfigPath + "/Logs/ChatLogs"));
                    }
                    else
                    {
                        Log.Out("[ServerTools] Directory found");
                    }
                    Log.Out(string.Format("[ServerTools] Checking for logs directory {0}", API.ConfigPath + "/Logs/DetectionLogs"));
                    if (!Directory.Exists(API.ConfigPath + "/Logs/DetectionLogs"))
                    {
                        Directory.CreateDirectory(API.ConfigPath + "/Logs/DetectionLogs");
                        Log.Out(string.Format("[ServerTools] Created directory {0}", API.ConfigPath + "/Logs/DetectionLogs"));
                    }
                    else
                    {
                        Log.Out("[ServerTools] Directory found");
                    }
                    Log.Out(string.Format("[ServerTools] Checking for logs directory {0}", API.ConfigPath + "/Logs/BountyLogs"));
                    if (!Directory.Exists(API.ConfigPath + "/Logs/BountyLogs"))
                    {
                        Directory.CreateDirectory(API.ConfigPath + "/Logs/BountyLogs");
                        Log.Out(string.Format("[ServerTools] Created directory {0}", API.ConfigPath + "/Logs/BountyLogs"));
                    }
                    else
                    {
                        Log.Out("[ServerTools] Directory found");
                    }
                    Log.Out(string.Format("[ServerTools] Checking for logs directory {0}", API.ConfigPath + "/Logs/AuctionLog"));
                    if (!Directory.Exists(API.ConfigPath + "/Logs/AuctionLog"))
                    {
                        Directory.CreateDirectory(API.ConfigPath + "/Logs/AuctionLog");
                        Log.Out(string.Format("[ServerTools] Created directory {0}", API.ConfigPath + "/Logs/AuctionLog"));
                    }
                    else
                    {
                        Log.Out("[ServerTools] Directory found");
                    }
                    Log.Out(string.Format("[ServerTools] Checking for logs directory {0}", API.ConfigPath + "/Logs/BankLogs"));
                    if (!Directory.Exists(API.ConfigPath + "/Logs/BankLogs"))
                    {
                        Directory.CreateDirectory(API.ConfigPath + "/Logs/BankLogs");
                        Log.Out(string.Format("[ServerTools] Created directory {0}", API.ConfigPath + "/Logs/BankLogs"));
                    }
                    else
                    {
                        Log.Out("[ServerTools] Directory found");
                    }
                    Log.Out(string.Format("[ServerTools] Checking for logs directory {0}", API.ConfigPath + "/Logs/DupeLogs"));
                    if (!Directory.Exists(API.ConfigPath + "/Logs/DupeLogs"))
                    {
                        Directory.CreateDirectory(API.ConfigPath + "/Logs/DupeLogs");
                        Log.Out(string.Format("[ServerTools] Created directory {0}", API.ConfigPath + "/Logs/DupeLogs"));
                    }
                    else
                    {
                        Log.Out("[ServerTools] Directory found");
                    }
                    Log.Out(string.Format("[ServerTools] Checking for logs directory {0}", API.ConfigPath + "/Logs/PlayerLogs"));
                    if (!Directory.Exists(API.ConfigPath + "/Logs/PlayerLogs"))
                    {
                        Directory.CreateDirectory(API.ConfigPath + "/Logs/PlayerLogs");
                        Log.Out(string.Format("[ServerTools] Created directory {0}", API.ConfigPath + "/Logs/PlayerLogs"));
                    }
                    else
                    {
                        Log.Out("[ServerTools] Directory found");
                    }
                    Log.Out(string.Format("[ServerTools] Checking for logs directory {0}", API.ConfigPath + "/Logs/PlayerReports"));
                    if (!Directory.Exists(API.ConfigPath + "/Logs/PlayerReports"))
                    {
                        Directory.CreateDirectory(API.ConfigPath + "/Logs/PlayerReports");
                        Log.Out(string.Format("[ServerTools] Created directory {0}", API.ConfigPath + "/Logs/PlayerReports"));
                    }
                    else
                    {
                        Log.Out("[ServerTools] Directory found");
                    }
                    Log.Out(string.Format("[ServerTools] Checking for logs directory {0}", API.ConfigPath + "/Logs/PollLogs"));
                    if (!Directory.Exists(API.ConfigPath + "/Logs/PollLogs"))
                    {
                        Directory.CreateDirectory(API.ConfigPath + "/Logs/PollLogs");
                        Log.Out(string.Format("[ServerTools] Created directory {0}", API.ConfigPath + "/Logs/PollLogs"));
                    }
                    else
                    {
                        Log.Out("[ServerTools] Directory found");
                    }


                    string[] files = Directory.GetFiles(API.ConfigPath + "/Logs/DetectionLogs");
                    int      _daysBeforeDeleted = (Days_Before_Log_Delete * -1);
                    foreach (string file in files)
                    {
                        FileInfo fi = new FileInfo(file);
                        if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                        {
                            fi.Delete();
                        }
                    }
                    files = Directory.GetFiles(API.ConfigPath + "/Logs/BountyLogs");
                    foreach (string file in files)
                    {
                        FileInfo fi = new FileInfo(file);
                        if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                        {
                            fi.Delete();
                        }
                    }
                    files = Directory.GetFiles(API.ConfigPath + "/Logs/AuctionLog");
                    foreach (string file in files)
                    {
                        FileInfo fi = new FileInfo(file);
                        if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                        {
                            fi.Delete();
                        }
                    }
                    files = Directory.GetFiles(API.ConfigPath + "/Logs/BankLogs");
                    foreach (string file in files)
                    {
                        FileInfo fi = new FileInfo(file);
                        if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                        {
                            fi.Delete();
                        }
                    }
                    files = Directory.GetFiles(API.ConfigPath + "/Logs/DupeLogs");
                    foreach (string file in files)
                    {
                        FileInfo fi = new FileInfo(file);
                        if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                        {
                            fi.Delete();
                        }
                    }
                    files = Directory.GetFiles(API.ConfigPath + "/Logs/PlayerLogs");
                    foreach (string file in files)
                    {
                        FileInfo fi = new FileInfo(file);
                        if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                        {
                            fi.Delete();
                        }
                    }
                    files = Directory.GetFiles(API.ConfigPath + "/Logs/PlayerReports");
                    foreach (string file in files)
                    {
                        FileInfo fi = new FileInfo(file);
                        if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                        {
                            fi.Delete();
                        }
                    }
                    files = Directory.GetFiles(API.ConfigPath + "/Logs/PollLogs");
                    foreach (string file in files)
                    {
                        FileInfo fi = new FileInfo(file);
                        if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                        {
                            fi.Delete();
                        }
                    }
                }
                catch (XmlException e)
                {
                    Log.Out(string.Format("[ServerTools] Error in creation of directory {0}. Error = {1}", API.ConfigPath, e.Message));
                }
                Load(2);
            }
            if (_state == 2)
            {
                try
                {
                    LoadConfig.Load();
                }
                catch (XmlException e)
                {
                    Log.Out("[ServerTools] Failed to load the configuration file. Error = {0}", e.Message);
                }
                Load(3);
            }
            if (_state == 3)
            {
                try
                {
                    SQL.Connect();
                }
                catch (XmlException e)
                {
                    Log.Out("[ServerTools] Failed to connect to an sql database. ST requires this to operate. Error = {0}", e.Message);
                }
                Load(4);
            }
            if (_state == 4)
            {
                try
                {
                    Mods.Load();
                }
                catch (XmlException e)
                {
                    Log.Out("[ServerTools] Failed to load the tools. Restart the server and check for errors. Error = {0}", e.Message);
                }
                Load(5);
            }
            if (_state == 5)
            {
                try
                {
                    LoadTriggers.LoadXml();
                }
                catch (XmlException e)
                {
                    Log.Out("[ServerTools] Failed to load the EventTriggers.xml. Check for errors in the file. Error = {0}", e.Message);
                }
                Load(6);
            }
            if (_state == 6)
            {
                try
                {
                    Phrases.Load();
                }
                catch (XmlException e)
                {
                    Log.Out("[ServerTools] Failed to load the Phrases.xml. Restart the server and check for errors. Error = {0}", e.Message);
                }
                try
                {
                    HowToSetup.Load();
                }
                catch (XmlException e)
                {
                    Log.Out("[ServerTools] Failed to load the HowToSetup.xml. Error = {0}", e.Message);
                }
                Load(7);
            }
            if (_state == 7)
            {
                if (Fps.IsEnabled)
                {
                    try
                    {
                        Fps.SetTarget();
                    }
                    catch (XmlException e)
                    {
                        Log.Out("[ServerTools] Failed to set the target fps. Error = {0}", e.Message);
                    }
                }
                Load(8);
            }
            if (_state == 8)
            {
                Timers.LogAlert();
                Timers.LoadAlert();
                Load(9);
            }
            if (_state == 9)
            {
                RestartVote.Startup = true;
            }
        }
 public static void CommandDelay(ClientInfo _cInfo, string _message, int[] _c1)
 {
     try
     {
         if (_c1[0] < 21 && _c1[1] > 0)
         {
             if (_c1[0] == 1)
             {
                 PersistentContainer.Instance.Players[_cInfo.playerId].CustomCommand1 = DateTime.Now;
             }
             else if (_c1[0] == 2)
             {
                 PersistentContainer.Instance.Players[_cInfo.playerId].CustomCommand2 = DateTime.Now;
             }
             else if (_c1[0] == 3)
             {
                 PersistentContainer.Instance.Players[_cInfo.playerId].CustomCommand3 = DateTime.Now;
             }
             else if (_c1[0] == 4)
             {
                 PersistentContainer.Instance.Players[_cInfo.playerId].CustomCommand4 = DateTime.Now;
             }
             else if (_c1[0] == 5)
             {
                 PersistentContainer.Instance.Players[_cInfo.playerId].CustomCommand5 = DateTime.Now;
             }
             else if (_c1[0] == 6)
             {
                 PersistentContainer.Instance.Players[_cInfo.playerId].CustomCommand6 = DateTime.Now;
             }
             else if (_c1[0] == 7)
             {
                 PersistentContainer.Instance.Players[_cInfo.playerId].CustomCommand7 = DateTime.Now;
             }
             else if (_c1[0] == 8)
             {
                 PersistentContainer.Instance.Players[_cInfo.playerId].CustomCommand8 = DateTime.Now;
             }
             else if (_c1[0] == 9)
             {
                 PersistentContainer.Instance.Players[_cInfo.playerId].CustomCommand9 = DateTime.Now;
             }
             else if (_c1[0] == 10)
             {
                 PersistentContainer.Instance.Players[_cInfo.playerId].CustomCommand10 = DateTime.Now;
             }
             else if (_c1[0] == 11)
             {
                 PersistentContainer.Instance.Players[_cInfo.playerId].CustomCommand11 = DateTime.Now;
             }
             else if (_c1[0] == 12)
             {
                 PersistentContainer.Instance.Players[_cInfo.playerId].CustomCommand12 = DateTime.Now;
             }
             else if (_c1[0] == 13)
             {
                 PersistentContainer.Instance.Players[_cInfo.playerId].CustomCommand13 = DateTime.Now;
             }
             else if (_c1[0] == 14)
             {
                 PersistentContainer.Instance.Players[_cInfo.playerId].CustomCommand14 = DateTime.Now;
             }
             else if (_c1[0] == 15)
             {
                 PersistentContainer.Instance.Players[_cInfo.playerId].CustomCommand15 = DateTime.Now;
             }
             else if (_c1[0] == 16)
             {
                 PersistentContainer.Instance.Players[_cInfo.playerId].CustomCommand16 = DateTime.Now;
             }
             else if (_c1[0] == 17)
             {
                 PersistentContainer.Instance.Players[_cInfo.playerId].CustomCommand17 = DateTime.Now;
             }
             else if (_c1[0] == 18)
             {
                 PersistentContainer.Instance.Players[_cInfo.playerId].CustomCommand18 = DateTime.Now;
             }
             else if (_c1[0] == 19)
             {
                 PersistentContainer.Instance.Players[_cInfo.playerId].CustomCommand19 = DateTime.Now;
             }
             else if (_c1[0] == 20)
             {
                 PersistentContainer.Instance.Players[_cInfo.playerId].CustomCommand20 = DateTime.Now;
             }
             PersistentContainer.Instance.Save();
         }
         string[] _r;
         if (Dict.TryGetValue(_message, out _r))
         {
             string[] _commandsSplit = _r[0].Split('^');
             for (int i = 0; i < _commandsSplit.Length; i++)
             {
                 string _commandTrimmed = _commandsSplit[i].Trim();
                 if (_commandTrimmed.StartsWith("{Delay}"))
                 {
                     if (i < _commandsSplit.Length)
                     {
                         string _commandsRebuilt = "";
                         for (int j = i; j < _commandsSplit.Length; j++)
                         {
                             string _delayedCommandTrimmed = _commandsSplit[j].Trim();
                             if (j == i + 1)
                             {
                                 _commandsRebuilt = _delayedCommandTrimmed;
                             }
                             else
                             {
                                 _commandsRebuilt = _commandsRebuilt + " ^ " + _delayedCommandTrimmed;
                             }
                         }
                         string _timeString = _commandTrimmed.Split(' ').Skip(1).First();
                         int    _time       = 5;
                         int.TryParse(_timeString, out _time);
                         Timers.SingleUseTimer(_time, _cInfo.playerId, _commandsRebuilt);
                     }
                     return;
                 }
                 else
                 {
                     CommandExec(_cInfo, _commandTrimmed);
                 }
             }
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in CustomCommand.CommandDelay: {0}.", e));
     }
 }
Пример #20
0
 private static void PlayerSpawnedInWorld(ClientInfo _cInfo, RespawnType _respawnReason, Vector3i _pos)//Spawning player
 {
     try
     {
         if (_cInfo != null && _cInfo.playerId.Length == 17)
         {
             if (CredentialCheck.IsEnabled && !CredentialCheck.AccCheck(_cInfo))
             {
                 SdtdConsole.Instance.ExecuteSync(string.Format("ban add {0} 1 years \"Auto detection has banned you for false credentials. Contact an admin if this is a mistake\"", _cInfo.playerId), null);
                 return;
             }
             if (CountryBan.IsEnabled && CountryBan.IsCountryBanned(_cInfo))
             {
                 SdtdConsole.Instance.ExecuteSync(string.Format("ban add {0} 1 years \"Auto detection has banned you for country IP region\"", _cInfo.playerId), null);
                 return;
             }
             PersistentContainer.Instance.Players[_cInfo.playerId].LastJoined = DateTime.Now;
             if (_respawnReason == RespawnType.EnterMultiplayer)//New player spawning. Game bug has returning players trigger this on server restarts
             {
                 PersistentContainer.Instance.Players[_cInfo.playerId].PlayerName = _cInfo.playerName;
                 PersistentOperations.SessionTime(_cInfo);
                 if (!PersistentContainer.Instance.Players[_cInfo.playerId].OldPlayer)
                 {
                     Timers.NewPlayerExecTimer(_cInfo);
                 }
                 else
                 {
                     OldPlayerJoined(_cInfo);
                 }
             }
             else if (_respawnReason == RespawnType.JoinMultiplayer)//Old player spawning
             {
                 PersistentContainer.Instance.Players[_cInfo.playerId].PlayerName = _cInfo.playerName;
                 PersistentOperations.SessionTime(_cInfo);
                 if (!PersistentContainer.Instance.Players[_cInfo.playerId].OldPlayer)
                 {
                     Timers.NewPlayerExecTimer(_cInfo);
                 }
                 else
                 {
                     OldPlayerJoined(_cInfo);
                 }
             }
             else if (_respawnReason == RespawnType.Died)//Player died, respawning
             {
                 PersistentOperations.SessionTime(_cInfo);
                 PlayerDied(_cInfo);
             }
             else if (_respawnReason == RespawnType.Teleport)
             {
                 if (Teleportation.Teleporting.Contains(_cInfo.entityId))
                 {
                     Teleportation.Teleporting.Remove(_cInfo.entityId);
                 }
             }
             if (BattleLogger.IsEnabled && !BattleLogger.Exit.Contains(_cInfo.playerId) && GameManager.Instance.adminTools.GetUserPermissionLevel(_cInfo) > BattleLogger.Admin_Level)
             {
                 BattleLogger.Exit.Add(_cInfo.playerId);
             }
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in API.PlayerSpawnedInWorld: {0}", e.Message));
     }
 }
Пример #21
0
 private static void PlayerSpawnedInWorld(ClientInfo _cInfo, RespawnType _respawnReason, Vector3i _pos)//Spawning player
 {
     try
     {
         if (_cInfo != null)
         {
             if (_respawnReason == RespawnType.EnterMultiplayer)//New player spawned
             {
                 PersistentContainer.Instance.Players[_cInfo.playerId].PlayerName = _cInfo.playerName;
                 PersistentContainer.Instance.Save();
                 PersistentOperations.SessionTime(_cInfo);
                 Timers.NewPlayerExecTimer(_cInfo);
             }
             else if (_respawnReason == RespawnType.JoinMultiplayer)//Old player spawned
             {
                 PersistentContainer.Instance.Players[_cInfo.playerId].PlayerName = _cInfo.playerName;
                 PersistentContainer.Instance.Save();
                 PersistentOperations.SessionTime(_cInfo);
                 if (!PersistentContainer.Instance.Players[_cInfo.playerId].OldPlayer)
                 {
                     Timers.NewPlayerExecTimer(_cInfo);
                 }
                 else
                 {
                     if (Hardcore.IsEnabled && !Hardcore.Optional)
                     {
                         string    _sql    = string.Format("SELECT * FROM Hardcore WHERE steamid = '{0}'", _cInfo.playerId);
                         DataTable _result = SQL.TypeQuery(_sql);
                         if (_result.Rows.Count == 0)
                         {
                             EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId];
                             if (_player != null)
                             {
                                 int    _deaths     = XUiM_Player.GetDeaths(_player);
                                 string _playerName = SQL.EscapeString(_cInfo.playerName);
                                 SQL.FastQuery(string.Format("INSERT INTO Hardcore (steamid, playerName, deaths) VALUES ('{0}', '{1}', {2})", _cInfo.playerId, _playerName, _deaths), null);
                             }
                         }
                         _result.Dispose();
                     }
                     if (LoginNotice.IsEnabled && LoginNotice.dict.ContainsKey(_cInfo.playerId))
                     {
                         LoginNotice.PlayerNotice(_cInfo);
                     }
                     if (Motd.IsEnabled)
                     {
                         Motd.Send(_cInfo);
                     }
                     if (Bloodmoon.IsEnabled)
                     {
                         Bloodmoon.Exec(_cInfo);
                     }
                     if (AutoShutdown.IsEnabled && AutoShutdown.Alert_On_Login)
                     {
                         AutoShutdown.NextShutdown(_cInfo);
                     }
                     if (Hardcore.IsEnabled)
                     {
                         if (!Hardcore.Optional)
                         {
                             Hardcore.Alert(_cInfo);
                         }
                         else if (PersistentContainer.Instance.Players[_cInfo.playerId].Hardcore)
                         {
                             Hardcore.Alert(_cInfo);
                         }
                     }
                     if (BattleLogger.IsEnabled)
                     {
                         BattleLogger.AlertPlayer(_cInfo);
                     }
                     if (PollConsole.IsEnabled)
                     {
                         string _sql = "SELECT pollOpen FROM Polls WHERE pollOpen = 'true'";
                         if (!string.IsNullOrEmpty(_sql))
                         {
                             DataTable _result = SQL.TypeQuery(_sql);
                             if (_result.Rows.Count > 0 && !PollConsole.PolledYes.Contains(_cInfo.playerId) && !PollConsole.PolledNo.Contains(_cInfo.playerId))
                             {
                                 PollConsole.Message(_cInfo);
                             }
                             _result.Dispose();
                         }
                     }
                     if (Event.Open)
                     {
                         if (Event.PlayersTeam.ContainsKey(_cInfo.playerId))
                         {
                             string _sql = string.Format("SELECT eventRespawn FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
                             if (!string.IsNullOrEmpty(_sql))
                             {
                                 DataTable _result1      = SQL.TypeQuery(_sql);
                                 bool      _eventRespawn = false;
                                 if (_result1.Rows.Count > 0)
                                 {
                                     bool.TryParse(_result1.Rows[0].ItemArray.GetValue(0).ToString(), out _eventRespawn);
                                 }
                                 _result1.Dispose();
                                 if (_eventRespawn)
                                 {
                                     Event.Died(_cInfo);
                                 }
                                 else
                                 {
                                     _sql = string.Format("SELECT return, eventSpawn FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
                                     DataTable _result2 = SQL.TypeQuery(_sql);
                                     bool      _return1 = false, _return2 = false;
                                     if (_result2.Rows.Count > 0)
                                     {
                                         bool.TryParse(_result2.Rows[0].ItemArray.GetValue(0).ToString(), out _return1);
                                         bool.TryParse(_result2.Rows[0].ItemArray.GetValue(1).ToString(), out _return2);
                                     }
                                     _result2.Dispose();
                                     if (_return1)
                                     {
                                         if (_return2)
                                         {
                                             _sql = string.Format("UPDATE Players SET eventSpawn = 'false' WHERE steamid = '{0}'", _cInfo.playerId);
                                             SQL.FastQuery(_sql, "API");
                                         }
                                         _sql = string.Format("UPDATE Players SET return = 'false' WHERE steamid = '{0}'", _cInfo.playerId);
                                         SQL.FastQuery(_sql, "API");
                                         Event.EventSpawn(_cInfo);
                                     }
                                     else if (_return2)
                                     {
                                         Event.EventSpawn(_cInfo);
                                     }
                                 }
                             }
                         }
                     }
                     if (ClanManager.IsEnabled)
                     {
                         List <string[]> _clanRequests = PersistentContainer.Instance.Players[_cInfo.playerId].ClanRequestToJoin;
                         if (_clanRequests != null && _clanRequests.Count > 0)
                         {
                             string[] _request    = _clanRequests[0];
                             string   _playerName = _request[1];
                             ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + "There is a request to join the group from " + _playerName + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                         }
                     }
                 }
             }
             else if (_respawnReason == RespawnType.Died)//Player Died
             {
                 PersistentOperations.SessionTime(_cInfo);
                 if (Bloodmoon.IsEnabled && Bloodmoon.Show_On_Respawn)
                 {
                     Bloodmoon.Exec(_cInfo);
                 }
                 if (BattleLogger.IsEnabled)
                 {
                     BattleLogger.AlertPlayer(_cInfo);
                 }
                 if (Event.Open)
                 {
                     if (!Event.PlayersTeam.ContainsKey(_cInfo.playerId))
                     {
                         string _sql = string.Format("SELECT return, eventSpawn FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
                         if (!string.IsNullOrEmpty(_sql))
                         {
                             DataTable _result1 = SQL.TypeQuery(_sql);
                             bool      _return1 = false, _return2 = false;
                             if (_result1.Rows.Count > 0)
                             {
                                 bool.TryParse(_result1.Rows[0].ItemArray.GetValue(0).ToString(), out _return1);
                                 bool.TryParse(_result1.Rows[0].ItemArray.GetValue(1).ToString(), out _return2);
                             }
                             _result1.Dispose();
                             if (_return1)
                             {
                                 if (_return2)
                                 {
                                     _sql = string.Format("UPDATE Players SET eventSpawn = 'false' WHERE steamid = '{0}'", _cInfo.playerId);
                                     SQL.FastQuery(_sql, "API");
                                 }
                                 _sql = string.Format("UPDATE Players SET return = 'false' WHERE steamid = '{0}'", _cInfo.playerId);
                                 SQL.FastQuery(_sql, "API");
                                 Event.EventSpawn(_cInfo);
                                 return;
                             }
                         }
                     }
                     else
                     {
                         string _sql = string.Format("SELECT eventRespawn FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
                         if (!string.IsNullOrEmpty(_sql))
                         {
                             DataTable _result       = SQL.TypeQuery(_sql);
                             bool      _eventRespawn = false;
                             if (_result.Rows.Count > 0)
                             {
                                 bool.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _eventRespawn);
                             }
                             _result.Dispose();
                             if (_eventRespawn)
                             {
                                 Event.Died(_cInfo);
                                 return;
                             }
                             else
                             {
                                 _sql = string.Format("SELECT return, eventSpawn FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
                                 DataTable _result1 = SQL.TypeQuery(_sql);
                                 bool      _return1 = false, _return2 = false;
                                 if (_result1.Rows.Count > 0)
                                 {
                                     bool.TryParse(_result1.Rows[0].ItemArray.GetValue(0).ToString(), out _return1);
                                     bool.TryParse(_result1.Rows[0].ItemArray.GetValue(1).ToString(), out _return2);
                                 }
                                 _result1.Dispose();
                                 if (_return1)
                                 {
                                     if (_return2)
                                     {
                                         _sql = string.Format("UPDATE Players SET eventSpawn = 'false' WHERE steamid = '{0}'", _cInfo.playerId);
                                         SQL.FastQuery(_sql, "API");
                                     }
                                     _sql = string.Format("UPDATE Players SET return = 'false' WHERE steamid = '{0}'", _cInfo.playerId);
                                     SQL.FastQuery(_sql, "API");
                                     Event.EventSpawn(_cInfo);
                                     return;
                                 }
                                 else if (_return2)
                                 {
                                     Event.EventSpawn(_cInfo);
                                     return;
                                 }
                             }
                         }
                     }
                 }
                 else
                 {
                     string _sql = string.Format("SELECT return, eventSpawn FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
                     if (!string.IsNullOrEmpty(_sql))
                     {
                         DataTable _result1 = SQL.TypeQuery(_sql);
                         bool      _return1 = false, _return2 = false;
                         if (_result1.Rows.Count > 0)
                         {
                             bool.TryParse(_result1.Rows[0].ItemArray.GetValue(0).ToString(), out _return1);
                             bool.TryParse(_result1.Rows[0].ItemArray.GetValue(1).ToString(), out _return2);
                         }
                         _result1.Dispose();
                         if (_return1)
                         {
                             if (_return2)
                             {
                                 _sql = string.Format("UPDATE Players SET eventSpawn = 'false' WHERE steamid = '{0}'", _cInfo.playerId);
                                 SQL.FastQuery(_sql, "API");
                             }
                             _sql = string.Format("UPDATE Players SET return = 'false' WHERE steamid = '{0}'", _cInfo.playerId);
                             SQL.FastQuery(_sql, "API");
                             Event.EventSpawn(_cInfo);
                             return;
                         }
                     }
                 }
                 if (Wallet.IsEnabled)
                 {
                     if (Wallet.Lose_On_Death)
                     {
                         Wallet.ClearWallet(_cInfo);
                     }
                     else if (Wallet.Deaths > 0)
                     {
                         Wallet.SubtractCoinsFromWallet(_cInfo.playerId, Wallet.Deaths);
                     }
                 }
                 if (Hardcore.IsEnabled)
                 {
                     if (!Hardcore.Optional)
                     {
                         Hardcore.Check(_cInfo);
                     }
                     else if (PersistentContainer.Instance.Players[_cInfo.playerId].Hardcore)
                     {
                         Hardcore.Check(_cInfo);
                     }
                 }
                 if (Zones.IsEnabled && Zones.Victim.ContainsKey(_cInfo.entityId))
                 {
                     string _response = " type {CommandPrivate}{Command50} to teleport back to your death position. There is a time limit.";
                     _response = _response.Replace("{CommandPrivate}", ChatHook.Command_Private);
                     _response = _response.Replace("{Command50}", Zones.Command50);
                     ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _response + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                     PersistentContainer.Instance.Players[_cInfo.playerId].ZoneDeathTime = DateTime.Now;
                     PersistentContainer.Instance.Save();
                     if (Zones.Forgive.ContainsKey(_cInfo.entityId))
                     {
                         string _response2 = " type {CommandPrivate}{Command55} to release your killer from jail.";
                         _response2 = _response2.Replace("{CommandPrivate}", ChatHook.Command_Private);
                         _response2 = _response2.Replace("{Command55}", Jail.Command55);
                         ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _response2 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                     }
                 }
             }
             else if (_respawnReason == RespawnType.Teleport)
             {
             }
             string _ip = _cInfo.ip;
             if (_ip.Contains(":"))
             {
                 _ip = _ip.Split(':').First();
             }
             if (!string.IsNullOrEmpty(_ip) && BattleLogger.IsEnabled && BattleLogger.LogFound && !StopServer.StopServerCountingDown && !StopServer.Shutdown && GameManager.Instance.adminTools.GetAdminToolsClientInfo(_cInfo.playerId).PermissionLevel > BattleLogger.Admin_Level)
             {
                 if (!BattleLogger.Players.ContainsKey(_cInfo.playerId))
                 {
                     BattleLogger.Players.Add(_cInfo.playerId, _cInfo.ip);
                 }
                 else
                 {
                     string _recordedIp;
                     BattleLogger.Players.TryGetValue(_cInfo.playerId, out _recordedIp);
                     if (_recordedIp != _ip)
                     {
                         BattleLogger.Players[_cInfo.playerId] = _ip;
                     }
                 }
             }
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in API.PlayerSpawnedInWorld: {0}.", e.Message));
     }
 }
Пример #22
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();
            }
        }
Пример #23
0
 public static void Stop()
 {
     Log.Out("[SERVERTOOLS] Running shutdown.");
     Timers.Timer2Stop();
     UnityEngine.Application.Quit();
 }
Пример #24
0
 public static void Load(int _state)
 {
     if (_state == 1)
     {
         try
         {
             Log.Out(string.Format("[SERVERTOOLS] Checking for save directory {0}", API.ConfigPath));
             if (!Directory.Exists(API.ConfigPath))
             {
                 Directory.CreateDirectory(API.ConfigPath);
                 Log.Out(string.Format("[SERVERTOOLS] Created directory {0}", API.ConfigPath));
             }
             if (!Directory.Exists(API.ConfigPath + "/Logs/ChatLogs"))
             {
                 Directory.CreateDirectory(API.ConfigPath + "/Logs/ChatLogs");
             }
             if (!Directory.Exists(API.ConfigPath + "/Logs/DetectionLogs"))
             {
                 Directory.CreateDirectory(API.ConfigPath + "/Logs/DetectionLogs");
             }
             if (!Directory.Exists(API.ConfigPath + "/Logs/BountyLogs"))
             {
                 Directory.CreateDirectory(API.ConfigPath + "/Logs/BountyLogs");
             }
             if (!Directory.Exists(API.ConfigPath + "/Logs/AuctionLog"))
             {
                 Directory.CreateDirectory(API.ConfigPath + "/Logs/AuctionLogs");
             }
             if (!Directory.Exists(API.ConfigPath + "/Logs/BankLogs"))
             {
                 Directory.CreateDirectory(API.ConfigPath + "/Logs/BankLogs");
             }
             if (!Directory.Exists(API.ConfigPath + "/Logs/DupeLogs"))
             {
                 Directory.CreateDirectory(API.ConfigPath + "/Logs/DupeLogs");
             }
             if (!Directory.Exists(API.ConfigPath + "/Logs/PlayerLogs"))
             {
                 Directory.CreateDirectory(API.ConfigPath + "/Logs/PlayerLogs");
             }
             if (!Directory.Exists(API.ConfigPath + "/Logs/PlayerReports"))
             {
                 Directory.CreateDirectory(API.ConfigPath + "/Logs/PlayerReports");
             }
             if (!Directory.Exists(API.ConfigPath + "/Logs/PollLogs"))
             {
                 Directory.CreateDirectory(API.ConfigPath + "/Logs/PollLogs");
             }
             if (!Directory.Exists(API.ConfigPath + "/Logs/ChatCommandLogs"))
             {
                 Directory.CreateDirectory(API.ConfigPath + "/Logs/ChatCommandLogs");
             }
             if (!Directory.Exists(API.ConfigPath + "/Logs/DamageLogs"))
             {
                 Directory.CreateDirectory(API.ConfigPath + "/Logs/DamageLogs");
             }
             if (!Directory.Exists(API.ConfigPath + "/Logs/BlockLogs"))
             {
                 Directory.CreateDirectory(API.ConfigPath + "/Logs/BlockLogs");
             }
             if (!Directory.Exists(API.ConfigPath + "/Logs/ConsoleCommandLogs"))
             {
                 Directory.CreateDirectory(API.ConfigPath + "/Logs/ConsoleCommandLogs");
             }
             if (!Directory.Exists(API.ConfigPath + "/Logs/WebsiteLogs"))
             {
                 Directory.CreateDirectory(API.ConfigPath + "/Logs/WebsiteLogs");
             }
             if (!Directory.Exists(API.ConfigPath + "/Logs/OutputLogs"))
             {
                 Directory.CreateDirectory(API.ConfigPath + "/Logs/OutputLogs");
             }
         }
         catch (XmlException e)
         {
             Log.Out(string.Format("[SERVERTOOLS] Error in creation of directory {0}. Error = {1}", API.ConfigPath, e.Message));
         }
         Load(2);
     }
     else if (_state == 2)
     {
         try
         {
             StateManager.Awake();
         }
         catch (XmlException e)
         {
             Log.Out("[SERVERTOOLS] Failed to load the persistent database bin file. Restart the server and check for errors. Error = {0}", e.Message);
         }
         Load(3);
     }
     else if (_state == 3)
     {
         try
         {
             LoadConfig.Load();
         }
         catch (XmlException e)
         {
             Log.Out("[SERVERTOOLS] Failed to load the configuration file. Error = {0}", e.Message);
         }
         Load(4);
     }
     else if (_state == 4)
     {
         try
         {
             Mods.Load();
         }
         catch (XmlException e)
         {
             Log.Out("[SERVERTOOLS] Failed to load the tools. Restart the server and check for errors. Error = {0}", e.Message);
         }
         Load(5);
     }
     else if (_state == 5)
     {
         try
         {
             LoadTriggers.LoadXml();
         }
         catch (XmlException e)
         {
             Log.Out("[SERVERTOOLS] Failed to load the EventTriggers.xml. Check for errors in the file. Error = {0}", e.Message);
         }
         Load(6);
     }
     else if (_state == 6)
     {
         try
         {
             Phrases.Load();
         }
         catch (XmlException e)
         {
             Log.Out("[SERVERTOOLS] Failed to load the Phrases.xml. Restart the server and check for errors. Error = {0}", e.Message);
         }
         try
         {
             HowToSetup.Load();
         }
         catch (XmlException e)
         {
             Log.Out("[SERVERTOOLS] Failed to load the HowToSetup.xml. Error = {0}", e.Message);
         }
         Load(7);
     }
     else if (_state == 7)
     {
         if (Fps.IsEnabled)
         {
             try
             {
                 Fps.SetTarget();
             }
             catch (XmlException e)
             {
                 Log.Out("[SERVERTOOLS] Failed to set the target fps. Error = {0}", e.Message);
             }
         }
         Load(8);
     }
     else if (_state == 8)
     {
         Log.Out(string.Format("[SERVERTOOLS] Deleting old logs"));
         int      _daysBeforeDeleted = Days_Before_Log_Delete * -1;
         string[] files = Directory.GetFiles(API.ConfigPath + "/Logs/DetectionLogs");
         if (files != null && files.Length > 0)
         {
             foreach (string file in files)
             {
                 FileInfo fi = new FileInfo(file);
                 if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                 {
                     fi.Delete();
                 }
             }
         }
         files = Directory.GetFiles(API.ConfigPath + "/Logs/BountyLogs");
         if (files != null && files.Length > 0)
         {
             foreach (string file in files)
             {
                 FileInfo fi = new FileInfo(file);
                 if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                 {
                     fi.Delete();
                 }
             }
         }
         files = Directory.GetFiles(API.ConfigPath + "/Logs/AuctionLogs");
         if (files != null && files.Length > 0)
         {
             foreach (string file in files)
             {
                 FileInfo fi = new FileInfo(file);
                 if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                 {
                     fi.Delete();
                 }
             }
         }
         files = Directory.GetFiles(API.ConfigPath + "/Logs/BankLogs");
         if (files != null && files.Length > 0)
         {
             foreach (string file in files)
             {
                 FileInfo fi = new FileInfo(file);
                 if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                 {
                     fi.Delete();
                 }
             }
         }
         files = Directory.GetFiles(API.ConfigPath + "/Logs/DupeLogs");
         if (files != null && files.Length > 0)
         {
             foreach (string file in files)
             {
                 FileInfo fi = new FileInfo(file);
                 if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                 {
                     fi.Delete();
                 }
             }
         }
         files = Directory.GetFiles(API.ConfigPath + "/Logs/PlayerLogs");
         if (files != null && files.Length > 0)
         {
             foreach (string file in files)
             {
                 FileInfo fi = new FileInfo(file);
                 if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                 {
                     fi.Delete();
                 }
             }
         }
         files = Directory.GetFiles(API.ConfigPath + "/Logs/PlayerReports");
         if (files != null && files.Length > 0)
         {
             foreach (string file in files)
             {
                 FileInfo fi = new FileInfo(file);
                 if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                 {
                     fi.Delete();
                 }
             }
         }
         files = Directory.GetFiles(API.ConfigPath + "/Logs/PollLogs");
         if (files != null && files.Length > 0)
         {
             foreach (string file in files)
             {
                 FileInfo fi = new FileInfo(file);
                 if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                 {
                     fi.Delete();
                 }
             }
         }
         files = Directory.GetFiles(API.ConfigPath + "/Logs/ChatLogs");
         if (files != null && files.Length > 0)
         {
             foreach (string file in files)
             {
                 FileInfo fi = new FileInfo(file);
                 if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                 {
                     fi.Delete();
                 }
             }
         }
         files = Directory.GetFiles(API.ConfigPath + "/Logs/ChatCommandLogs");
         if (files != null && files.Length > 0)
         {
             foreach (string file in files)
             {
                 FileInfo fi = new FileInfo(file);
                 if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                 {
                     fi.Delete();
                 }
             }
         }
         files = Directory.GetFiles(API.ConfigPath + "/Logs/DamageLogs");
         if (files != null && files.Length > 0)
         {
             foreach (string file in files)
             {
                 FileInfo fi = new FileInfo(file);
                 if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                 {
                     fi.Delete();
                 }
             }
         }
         files = Directory.GetFiles(API.ConfigPath + "/Logs/BlockLogs");
         if (files != null && files.Length > 0)
         {
             foreach (string file in files)
             {
                 FileInfo fi = new FileInfo(file);
                 if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                 {
                     fi.Delete();
                 }
             }
         }
         files = Directory.GetFiles(API.ConfigPath + "/Logs/ConsoleCommandLogs");
         if (files != null && files.Length > 0)
         {
             foreach (string file in files)
             {
                 FileInfo fi = new FileInfo(file);
                 if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                 {
                     fi.Delete();
                 }
             }
         }
         files = Directory.GetFiles(API.ConfigPath + "/Logs/WebsiteLogs");
         if (files != null && files.Length > 0)
         {
             foreach (string file in files)
             {
                 FileInfo fi = new FileInfo(file);
                 if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                 {
                     fi.Delete();
                 }
             }
         }
         files = Directory.GetFiles(API.ConfigPath + "/Logs/OutputLogs");
         if (files != null && files.Length > 0)
         {
             foreach (string file in files)
             {
                 FileInfo fi = new FileInfo(file);
                 if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                 {
                     fi.Delete();
                 }
             }
         }
         Log.Out(string.Format("[SERVERTOOLS] Log clean up completed"));
         Load(9);
     }
     else if (_state == 9)
     {
         RestartVote.Startup = true;
         Load(10);
     }
     else if (_state == 10)
     {
         Track.Cleanup();
         Load(11);
     }
     else if (_state == 11)
     {
         CountryBan.FileCheck();
         Load(12);
     }
     else if (_state == 12)
     {
         Timers.LogAlert();
         Timers.LoadAlert();
     }
 }
Пример #25
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();
     }
 }
Пример #26
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();
            }
        }
Пример #27
0
        public static void Load()
        {
            try
            {
                Log.Out(string.Format("[SERVERTOOLS] Checking for save directory {0}", API.ConfigPath));
                if (!Directory.Exists(API.ConfigPath))
                {
                    Directory.CreateDirectory(API.ConfigPath);
                    Log.Out(string.Format("[SERVERTOOLS] Created directory {0}", API.ConfigPath));
                }
                if (!Directory.Exists(API.ConfigPath + "/Logs/ChatLogs"))
                {
                    Directory.CreateDirectory(API.ConfigPath + "/Logs/ChatLogs");
                }
                if (!Directory.Exists(API.ConfigPath + "/Logs/DetectionLogs"))
                {
                    Directory.CreateDirectory(API.ConfigPath + "/Logs/DetectionLogs");
                }
                if (!Directory.Exists(API.ConfigPath + "/Logs/BountyLogs"))
                {
                    Directory.CreateDirectory(API.ConfigPath + "/Logs/BountyLogs");
                }
                if (!Directory.Exists(API.ConfigPath + "/Logs/AuctionLog"))
                {
                    Directory.CreateDirectory(API.ConfigPath + "/Logs/AuctionLogs");
                }
                if (!Directory.Exists(API.ConfigPath + "/Logs/BankLogs"))
                {
                    Directory.CreateDirectory(API.ConfigPath + "/Logs/BankLogs");
                }
                if (!Directory.Exists(API.ConfigPath + "/Logs/DupeLogs"))
                {
                    Directory.CreateDirectory(API.ConfigPath + "/Logs/DupeLogs");
                }
                if (!Directory.Exists(API.ConfigPath + "/Logs/PlayerLogs"))
                {
                    Directory.CreateDirectory(API.ConfigPath + "/Logs/PlayerLogs");
                }
                if (!Directory.Exists(API.ConfigPath + "/Logs/PlayerReports"))
                {
                    Directory.CreateDirectory(API.ConfigPath + "/Logs/PlayerReports");
                }
                if (!Directory.Exists(API.ConfigPath + "/Logs/PollLogs"))
                {
                    Directory.CreateDirectory(API.ConfigPath + "/Logs/PollLogs");
                }
                if (!Directory.Exists(API.ConfigPath + "/Logs/ChatCommandLogs"))
                {
                    Directory.CreateDirectory(API.ConfigPath + "/Logs/ChatCommandLogs");
                }
                if (!Directory.Exists(API.ConfigPath + "/Logs/DamageLogs"))
                {
                    Directory.CreateDirectory(API.ConfigPath + "/Logs/DamageLogs");
                }
                if (!Directory.Exists(API.ConfigPath + "/Logs/BlockLogs"))
                {
                    Directory.CreateDirectory(API.ConfigPath + "/Logs/BlockLogs");
                }
                if (!Directory.Exists(API.ConfigPath + "/Logs/ConsoleCommandLogs"))
                {
                    Directory.CreateDirectory(API.ConfigPath + "/Logs/ConsoleCommandLogs");
                }
                if (!Directory.Exists(API.ConfigPath + "/Logs/WebsiteLogs"))
                {
                    Directory.CreateDirectory(API.ConfigPath + "/Logs/WebsiteLogs");
                }
                if (!Directory.Exists(API.ConfigPath + "/Logs/OutputLogs"))
                {
                    Directory.CreateDirectory(API.ConfigPath + "/Logs/OutputLogs");
                }
            }
            catch (XmlException e)
            {
                Log.Out(string.Format("[SERVERTOOLS] Error in creation of directory {0}. Error = {1}", API.ConfigPath, e.Message));
            }

            try
            {
                StateManager.Awake();
            }
            catch (XmlException e)
            {
                Log.Out("[SERVERTOOLS] Failed to load the persistent database bin file. Restart the server and check for errors. Error = {0}", e.Message);
            }

            try
            {
                Config.Load();
            }
            catch (XmlException e)
            {
                Log.Out("[SERVERTOOLS] Failed to load the configuration file. Error = {0}", e.Message);
            }

            try
            {
                Mods.Load();
            }
            catch (XmlException e)
            {
                Log.Out("[SERVERTOOLS] Failed to load the tools. Restart the server and check for errors. Error = {0}", e.Message);
            }

            try
            {
                Triggers.LoadXml();
            }
            catch (XmlException e)
            {
                Log.Out("[SERVERTOOLS] Failed to load the EventTriggers.xml. Check for errors in the file. Error = {0}", e.Message);
            }

            try
            {
                Phrases.Load();
            }
            catch (XmlException e)
            {
                Log.Out("[SERVERTOOLS] Failed to load the Phrases.xml. Restart the server and check for errors. Error = {0}", e.Message);
            }

            try
            {
                HowToSetup.Load();
            }
            catch (XmlException e)
            {
                Log.Out("[SERVERTOOLS] Failed to load the HowToSetup.xml. Error = {0}", e.Message);
            }

            if (Fps.IsEnabled)
            {
                try
                {
                    Fps.SetTarget();
                }
                catch (XmlException e)
                {
                    Log.Out("[SERVERTOOLS] Failed to set the target fps. Error = {0}", e.Message);
                }
            }

            if (SleeperRespawn.IsEnabled)
            {
                try
                {
                    SdtdConsole.Instance.ExecuteSync(string.Format("sleeperreset"), null);
                }
                catch (XmlException e)
                {
                    Log.Out("[SERVERTOOLS] Failed to reset sleeper spawn points. Error = {0}", e.Message);
                }
            }

            try
            {
                Log.Out(string.Format("[SERVERTOOLS] Deleting old logs"));
                int      _daysBeforeDeleted = Days_Before_Log_Delete * -1;
                string[] files = Directory.GetFiles(API.ConfigPath + "/Logs/DetectionLogs");
                if (files != null && files.Length > 0)
                {
                    foreach (string file in files)
                    {
                        FileInfo fi = new FileInfo(file);
                        if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                        {
                            fi.Delete();
                        }
                    }
                }
                files = Directory.GetFiles(API.ConfigPath + "/Logs/BountyLogs");
                if (files != null && files.Length > 0)
                {
                    foreach (string file in files)
                    {
                        FileInfo fi = new FileInfo(file);
                        if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                        {
                            fi.Delete();
                        }
                    }
                }
                files = Directory.GetFiles(API.ConfigPath + "/Logs/AuctionLogs");
                if (files != null && files.Length > 0)
                {
                    foreach (string file in files)
                    {
                        FileInfo fi = new FileInfo(file);
                        if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                        {
                            fi.Delete();
                        }
                    }
                }
                files = Directory.GetFiles(API.ConfigPath + "/Logs/BankLogs");
                if (files != null && files.Length > 0)
                {
                    foreach (string file in files)
                    {
                        FileInfo fi = new FileInfo(file);
                        if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                        {
                            fi.Delete();
                        }
                    }
                }
                files = Directory.GetFiles(API.ConfigPath + "/Logs/DupeLogs");
                if (files != null && files.Length > 0)
                {
                    foreach (string file in files)
                    {
                        FileInfo fi = new FileInfo(file);
                        if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                        {
                            fi.Delete();
                        }
                    }
                }
                files = Directory.GetFiles(API.ConfigPath + "/Logs/PlayerLogs");
                if (files != null && files.Length > 0)
                {
                    foreach (string file in files)
                    {
                        FileInfo fi = new FileInfo(file);
                        if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                        {
                            fi.Delete();
                        }
                    }
                }
                files = Directory.GetFiles(API.ConfigPath + "/Logs/PlayerReports");
                if (files != null && files.Length > 0)
                {
                    foreach (string file in files)
                    {
                        FileInfo fi = new FileInfo(file);
                        if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                        {
                            fi.Delete();
                        }
                    }
                }
                files = Directory.GetFiles(API.ConfigPath + "/Logs/PollLogs");
                if (files != null && files.Length > 0)
                {
                    foreach (string file in files)
                    {
                        FileInfo fi = new FileInfo(file);
                        if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                        {
                            fi.Delete();
                        }
                    }
                }
                files = Directory.GetFiles(API.ConfigPath + "/Logs/ChatLogs");
                if (files != null && files.Length > 0)
                {
                    foreach (string file in files)
                    {
                        FileInfo fi = new FileInfo(file);
                        if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                        {
                            fi.Delete();
                        }
                    }
                }
                files = Directory.GetFiles(API.ConfigPath + "/Logs/ChatCommandLogs");
                if (files != null && files.Length > 0)
                {
                    foreach (string file in files)
                    {
                        FileInfo fi = new FileInfo(file);
                        if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                        {
                            fi.Delete();
                        }
                    }
                }
                files = Directory.GetFiles(API.ConfigPath + "/Logs/DamageLogs");
                if (files != null && files.Length > 0)
                {
                    foreach (string file in files)
                    {
                        FileInfo fi = new FileInfo(file);
                        if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                        {
                            fi.Delete();
                        }
                    }
                }
                files = Directory.GetFiles(API.ConfigPath + "/Logs/BlockLogs");
                if (files != null && files.Length > 0)
                {
                    foreach (string file in files)
                    {
                        FileInfo fi = new FileInfo(file);
                        if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                        {
                            fi.Delete();
                        }
                    }
                }
                files = Directory.GetFiles(API.ConfigPath + "/Logs/ConsoleCommandLogs");
                if (files != null && files.Length > 0)
                {
                    foreach (string file in files)
                    {
                        FileInfo fi = new FileInfo(file);
                        if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                        {
                            fi.Delete();
                        }
                    }
                }
                files = Directory.GetFiles(API.ConfigPath + "/Logs/WebsiteLogs");
                if (files != null && files.Length > 0)
                {
                    foreach (string file in files)
                    {
                        FileInfo fi = new FileInfo(file);
                        if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                        {
                            fi.Delete();
                        }
                    }
                }
                files = Directory.GetFiles(API.ConfigPath + "/Logs/OutputLogs");
                if (files != null && files.Length > 0)
                {
                    foreach (string file in files)
                    {
                        FileInfo fi = new FileInfo(file);
                        if (fi.CreationTime < DateTime.Now.AddDays(_daysBeforeDeleted))
                        {
                            fi.Delete();
                        }
                    }
                }
                Log.Out(string.Format("[SERVERTOOLS] Log clean up completed"));
            }
            catch (XmlException e)
            {
                Log.Out("[SERVERTOOLS] Failed to delete old logs. Error = {0}", e.Message);
            }

            PersistentOperations.EntityIdList();

            RestartVote.Cycle = true;

            Track.Cleanup();

            CountryBan.FileCheck();

            Timers.LogAlert();
            Timers.LoadAlert();
        }
Пример #28
0
        public static void Load()
        {
            try
            {
                Log.Out(string.Format("[SERVERTOOLS] Checking for save directory {0}", API.ConfigPath));
                if (!Directory.Exists(API.ConfigPath))
                {
                    Directory.CreateDirectory(API.ConfigPath);
                    Log.Out(string.Format("[SERVERTOOLS] Created directory {0}", API.ConfigPath));
                }
                if (!Directory.Exists(API.ConfigPath + "/Logs/ChatLogs"))
                {
                    Directory.CreateDirectory(API.ConfigPath + "/Logs/ChatLogs");
                }
                if (!Directory.Exists(API.ConfigPath + "/Logs/DetectionLogs"))
                {
                    Directory.CreateDirectory(API.ConfigPath + "/Logs/DetectionLogs");
                }
                if (!Directory.Exists(API.ConfigPath + "/Logs/BountyLogs"))
                {
                    Directory.CreateDirectory(API.ConfigPath + "/Logs/BountyLogs");
                }
                if (!Directory.Exists(API.ConfigPath + "/Logs/AuctionLog"))
                {
                    Directory.CreateDirectory(API.ConfigPath + "/Logs/AuctionLogs");
                }
                if (!Directory.Exists(API.ConfigPath + "/Logs/BankLogs"))
                {
                    Directory.CreateDirectory(API.ConfigPath + "/Logs/BankLogs");
                }
                if (!Directory.Exists(API.ConfigPath + "/Logs/DupeLogs"))
                {
                    Directory.CreateDirectory(API.ConfigPath + "/Logs/DupeLogs");
                }
                if (!Directory.Exists(API.ConfigPath + "/Logs/PlayerLogs"))
                {
                    Directory.CreateDirectory(API.ConfigPath + "/Logs/PlayerLogs");
                }
                if (!Directory.Exists(API.ConfigPath + "/Logs/PlayerReports"))
                {
                    Directory.CreateDirectory(API.ConfigPath + "/Logs/PlayerReports");
                }
                if (!Directory.Exists(API.ConfigPath + "/Logs/PollLogs"))
                {
                    Directory.CreateDirectory(API.ConfigPath + "/Logs/PollLogs");
                }
                if (!Directory.Exists(API.ConfigPath + "/Logs/ChatCommandLogs"))
                {
                    Directory.CreateDirectory(API.ConfigPath + "/Logs/ChatCommandLogs");
                }
                if (!Directory.Exists(API.ConfigPath + "/Logs/DamageLogs"))
                {
                    Directory.CreateDirectory(API.ConfigPath + "/Logs/DamageLogs");
                }
                if (!Directory.Exists(API.ConfigPath + "/Logs/BlockLogs"))
                {
                    Directory.CreateDirectory(API.ConfigPath + "/Logs/BlockLogs");
                }
                if (!Directory.Exists(API.ConfigPath + "/Logs/ConsoleCommandLogs"))
                {
                    Directory.CreateDirectory(API.ConfigPath + "/Logs/ConsoleCommandLogs");
                }
                if (!Directory.Exists(API.ConfigPath + "/Logs/WebPanelLogs"))
                {
                    Directory.CreateDirectory(API.ConfigPath + "/Logs/WebPanelLogs");
                }
                if (!Directory.Exists(API.ConfigPath + "/Logs/OutputLogs"))
                {
                    Directory.CreateDirectory(API.ConfigPath + "/Logs/OutputLogs");
                }
            }
            catch (XmlException e)
            {
                Log.Out(string.Format("[SERVERTOOLS] Error in creation of directory @ {0}. Error = {1}", API.ConfigPath, e.Message));
            }

            try
            {
                StateManager.Awake();
            }
            catch (XmlException e)
            {
                Log.Out("[SERVERTOOLS] Failed to load the persistent database bin file. Restart the server and check for errors. Error = {0}", e.Message);
            }

            try
            {
                Config.Load();
            }
            catch (XmlException e)
            {
                Log.Out("[SERVERTOOLS] Failed to load the configuration file. Error = {0}", e.Message);
            }

            try
            {
                Mods.Load();
            }
            catch (XmlException e)
            {
                Log.Out("[SERVERTOOLS] Failed to load the tools. Restart the server and check for errors. Error = {0}", e.Message);
            }

            try
            {
                Triggers.LoadXml();
            }
            catch (XmlException e)
            {
                Log.Out("[SERVERTOOLS] Failed to load the EventTriggers.xml. Check for errors in the file. Error = {0}", e.Message);
            }

            try
            {
                Phrases.Load();
            }
            catch (XmlException e)
            {
                Log.Out("[SERVERTOOLS] Failed to load the Phrases.xml. Restart the server and check for errors. Error = {0}", e.Message);
            }

            try
            {
                HowToSetup.Load();
            }
            catch (XmlException e)
            {
                Log.Out("[SERVERTOOLS] Failed to load the HowToSetup.xml. Error = {0}", e.Message);
            }

            if (Fps.IsEnabled)
            {
                try
                {
                    Fps.SetTarget();
                }
                catch (XmlException e)
                {
                    Log.Out("[SERVERTOOLS] Failed to set the target fps. Error = {0}", e.Message);
                }
            }

            if (SleeperRespawn.IsEnabled)
            {
                try
                {
                    SdtdConsole.Instance.ExecuteSync(string.Format("sleeperreset"), null);
                }
                catch (XmlException e)
                {
                    Log.Out("[SERVERTOOLS] Failed to reset sleeper spawn points. Error = {0}", e.Message);
                }
            }
            try
            {
                DeleteFiles("DetectionLogs");
                DeleteFiles("BountyLogs");
                DeleteFiles("AuctionLogs");
                DeleteFiles("BankLogs");
                DeleteFiles("DupeLogs");
                DeleteFiles("PlayerLogs");
                DeleteFiles("PlayerReports");
                DeleteFiles("PollLogs");
                DeleteFiles("ChatLogs");
                DeleteFiles("ChatCommandLogs");
                DeleteFiles("DamageLogs");
                DeleteFiles("BlockLogs");
                DeleteFiles("ConsoleCommandLogs");
                DeleteFiles("WebPanelLogs");
                DeleteFiles("OutputLogs");
                Log.Out(string.Format("[SERVERTOOLS] Log clean up completed"));
            }
            catch (XmlException e)
            {
                Log.Out("[SERVERTOOLS] Failed to delete old logs. Error = {0}", e.Message);
            }

            PersistentOperations.EntityIdList();
            CountryBan.BuildList();

            RestartVote.Cycle = true;

            Track.Cleanup();

            Timers.LogAlert();
            Timers.LoadAlert();
            Timers.PersistentDataSave();
        }