示例#1
0
 public override void PlayerSpawning(ClientInfo _cInfo, int _chunkViewDim, PlayerProfile _playerProfile)
 {
     if (CredentialCheck.IsEnabled)
     {
         CredentialCheck.AccCheck(_cInfo);
     }
     if (Motd.IsEnabled && !Motd.Show_On_Respawn)
     {
         Motd.Send(_cInfo);
     }
     if (AutoShutdown.IsEnabled)
     {
         if (AutoShutdown.Alert_On_Login)
         {
             AutoShutdown.CheckNextShutdown(_cInfo, false);
         }
     }
     if (Bloodmoon.Show_On_Login && !Bloodmoon.Show_On_Respawn)
     {
         Bloodmoon.GetBloodmoon(_cInfo, false);
     }
     if (LoginNotice.IsEnabled)
     {
         LoginNotice.PlayerCheck(_cInfo);
     }
     Players.SessionTime(_cInfo);
 }
示例#2
0
 public static void NewPlayerExec3(ClientInfo _cInfo, EntityPlayer _player)
 {
     try
     {
         if (NewPlayer.IsEnabled)
         {
             NewPlayer.Exec(_cInfo);
         }
         if (Motd.IsEnabled)
         {
             Motd.Send(_cInfo);
         }
         if (Bloodmoon.IsEnabled)
         {
             Bloodmoon.Exec(_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 (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)
             {
                 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);
             }
             else
             {
                 SQL.FastQuery(_sql = string.Format("UPDATE Hardcore SET deaths = {0} WHERE steamid = '{1}'", 0, _cInfo.playerId), "Hardcore");
             }
             _result.Dispose();
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in API.NewPlayerExec3: {0}.", e.Message));
     }
     PersistentContainer.Instance.Players[_cInfo.playerId].OldPlayer = true;
     PersistentContainer.Instance.Save();
 }
示例#3
0
        public static void NewPlayerExec()
        {
            ClientInfo   _cInfo  = Que[0];
            EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId];

            if (_cInfo != null && _player.IsSpawned())
            {
                if (Motd.IsEnabled & Motd.Show_On_Respawn)
                {
                    Motd.Send(_cInfo);
                }
                if (Bloodmoon.Show_On_Login && Bloodmoon.Show_On_Respawn)
                {
                    Bloodmoon.GetBloodmoon(_cInfo, false);
                }
                if (NewPlayer.IsEnabled)
                {
                    NewPlayer.Exec(_cInfo);
                }
                if (NewSpawnTele.IsEnabled)
                {
                    NewSpawnTele.TeleNewSpawn(_cInfo);
                }
                if (StartingItems.IsEnabled)
                {
                    if (!NewSpawnTele.IsEnabled)
                    {
                        StartingItems.StartingItemCheck(_cInfo);
                    }
                    else if (NewSpawnTele.IsEnabled && NewSpawnTele.New_Spawn_Tele_Position != "0,0,0")
                    {
                        StartingItems.Que.Add(_cInfo.playerId);
                    }
                    else if (NewSpawnTele.IsEnabled && NewSpawnTele.New_Spawn_Tele_Position == "0,0,0")
                    {
                        StartingItems.StartingItemCheck(_cInfo);
                    }
                }
                string    _sql     = "SELECT pollOpen FROM Polls WHERE pollOpen = 'true'";
                DataTable _result1 = SQL.TQuery(_sql);
                if (_result1.Rows.Count > 0 && !PollConsole.PolledYes.Contains(_cInfo.playerId) && !PollConsole.PolledNo.Contains(_cInfo.playerId))
                {
                    PollConsole.Message(_cInfo);
                }
                _result1.Dispose();
                if (Hardcore.IsEnabled)
                {
                    Hardcore.Announce(_cInfo);
                }
                string _name = SQL.EscapeString(_cInfo.playerName);
                _name = Regex.Replace(_name, @"[^\u0000-\u007F]+", string.Empty);
                _sql  = string.Format("UPDATE Players SET playername = '{0}', wallet = 0, playerSpentCoins = 0, sessionTime = 0, zkills = 0, kills = 0, deaths = 0 WHERE steamid = '{1}'", _name, _cInfo.playerId);
                SQL.FastQuery(_sql, "API");
                Que.RemoveAt(0);
            }
        }
示例#4
0
 public static void PlayerDied(ClientInfo _cInfo)
 {
     if (Bloodmoon.IsEnabled && Bloodmoon.Show_On_Respawn)
     {
         Bloodmoon.Exec(_cInfo);
     }
     if (BattleLogger.IsEnabled)
     {
         BattleLogger.AlertPlayer(_cInfo);
     }
     if (Event.Open && Event.Teams.ContainsKey(_cInfo.playerId))
     {
         Event.Respawn(_cInfo);
     }
     if (PersistentContainer.Instance.Players[_cInfo.playerId].EventOver)
     {
         Event.EventOver(_cInfo);
     }
     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 && PersistentContainer.Instance.Players[_cInfo.playerId].HardcoreEnabled)
     {
         EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId];
         if (_player != null)
         {
             Hardcore.Check(_cInfo, _player);
         }
     }
     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, LoadConfig.Chat_Response_Color + _response + "[-]", -1, 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, LoadConfig.Chat_Response_Color + _response2 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
         }
     }
 }
示例#5
0
        public static void PlayerDied(EntityAlive __instance)
        {
            ClientInfo cInfo = PersistentOperations.GetClientInfoFromEntityId(__instance.entityId);

            if (cInfo != null)
            {
                string id = cInfo.CrossplatformId.CombinedString;
                if (__instance.AttachedToEntity != null)
                {
                    __instance.Detach();
                }
                if (Died.IsEnabled)
                {
                    Died.PlayerKilled(__instance);
                }
                if (ProcessDamage.lastEntityKilled == cInfo.entityId)
                {
                    ProcessDamage.lastEntityKilled = 0;
                }
                if (Bloodmoon.IsEnabled && Bloodmoon.Show_On_Respawn)
                {
                    Bloodmoon.Exec(cInfo);
                }
                if (Event.Open && Event.Teams.ContainsKey(id))
                {
                    Event.Respawn(cInfo);
                }
                if (PersistentContainer.Instance.Players[id].EventOver)
                {
                    Event.EventOver(cInfo);
                }
                if (Hardcore.IsEnabled && PersistentContainer.Instance.Players[id].HardcoreEnabled)
                {
                    Hardcore.Check(cInfo, (EntityPlayer)__instance);
                }
                if (Zones.ZonePlayer.ContainsKey(cInfo.entityId))
                {
                    Zones.ZonePlayer.Remove(cInfo.entityId);
                }
                if (PlayerChecks.TwoSecondMovement.ContainsKey(cInfo.entityId))
                {
                    PlayerChecks.TwoSecondMovement.Remove(cInfo.entityId);
                }
                if (FlyingDetector.Flags.ContainsKey(cInfo.entityId))
                {
                    FlyingDetector.Flags.Remove(cInfo.entityId);
                }
                if (SpeedDetector.Flags.ContainsKey(cInfo.entityId))
                {
                    SpeedDetector.Flags.Remove(cInfo.entityId);
                }
            }
        }
示例#6
0
 public static void NewPlayerExec3(ClientInfo _cInfo, EntityPlayer _player)
 {
     try
     {
         if (NewPlayer.IsEnabled)
         {
             NewPlayer.Exec(_cInfo);
         }
         if (Motd.IsEnabled)
         {
             Motd.Send(_cInfo);
         }
         if (Bloodmoon.IsEnabled)
         {
             Bloodmoon.Exec(_cInfo);
         }
         if (BattleLogger.IsEnabled)
         {
             BattleLogger.AlertPlayer(_cInfo);
         }
         if (Poll.IsEnabled && PersistentContainer.Instance.PollOpen && !PersistentContainer.Instance.PollVote.ContainsKey(_cInfo.playerId))
         {
             Poll.Message(_cInfo);
         }
         if (Hardcore.IsEnabled)
         {
             if (Hardcore.Optional)
             {
                 if (PersistentContainer.Instance.Players[_cInfo.playerId].HardcoreEnabled)
                 {
                     Hardcore.Check(_cInfo, _player);
                 }
             }
             else if (!PersistentContainer.Instance.Players[_cInfo.playerId].HardcoreEnabled)
             {
                 string[] _hardcoreStats = { _cInfo.playerName, XUiM_Player.GetDeaths(_player).ToString(), "0" };
                 PersistentContainer.Instance.Players[_cInfo.playerId].HardcoreStats   = _hardcoreStats;
                 PersistentContainer.Instance.Players[_cInfo.playerId].HardcoreEnabled = true;
                 Hardcore.Check(_cInfo, _player);
             }
         }
         PersistentContainer.Instance.Players[_cInfo.playerId].OldPlayer = true;
         PersistentContainer.Instance.Save();
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in API.NewPlayerExec3: {0}", e.Message));
     }
 }
示例#7
0
 public static void ProcessPlayer(ClientInfo _cInfo, EntityPlayer _player)
 {
     try
     {
         string id = _cInfo.CrossplatformId.CombinedString;
         if (NewPlayer.IsEnabled)
         {
             NewPlayer.Exec(_cInfo);
         }
         if (Motd.IsEnabled)
         {
             Motd.Send(_cInfo);
         }
         if (Bloodmoon.IsEnabled)
         {
             Bloodmoon.Exec(_cInfo);
         }
         if (ExitCommand.IsEnabled)
         {
             ExitCommand.AlertPlayer(_cInfo);
         }
         if (Poll.IsEnabled && PersistentContainer.Instance.PollOpen && !PersistentContainer.Instance.PollVote.ContainsKey(id))
         {
             Poll.Message(_cInfo);
         }
         if (Hardcore.IsEnabled)
         {
             if (Hardcore.Optional)
             {
                 if (PersistentContainer.Instance.Players[id].HardcoreEnabled)
                 {
                     Hardcore.Check(_cInfo, _player);
                 }
             }
             else if (!PersistentContainer.Instance.Players[id].HardcoreEnabled)
             {
                 string[] hardcoreStats = { _cInfo.playerName, "0", "0" };
                 PersistentContainer.Instance.Players[id].HardcoreStats   = hardcoreStats;
                 PersistentContainer.Instance.Players[id].HardcoreEnabled = true;
                 PersistentContainer.DataChange = true;
                 Hardcore.Check(_cInfo, _player);
             }
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in API.ProcessPlayer: {0}", e.Message));
     }
 }
示例#8
0
 public override void PlayerSpawnedInWorld(ClientInfo _cInfo, RespawnType _respawnReason, Vector3i _pos)
 {
     if (Jail.IsEnabled)
     {
         Jail.CheckPlayer(_cInfo);
     }
     if (NewSpawnTele.IsEnabled)
     {
         NewSpawnTele.TeleNewSpawn(_cInfo);
     }
     if (Motd.IsEnabled)
     {
         Motd.Send(_cInfo);
     }
     if (Bloodmoon.ShowOnSpawn)
     {
         Bloodmoon.GetBloodmoon(_cInfo, false);
     }
 }
示例#9
0
 public static void OldPlayerJoined(ClientInfo _cInfo)
 {
     if (Hardcore.IsEnabled)
     {
         if (GameManager.Instance.World.Players.dict.ContainsKey(_cInfo.entityId))
         {
             EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId];
             if (_player != null)
             {
                 if (Hardcore.Optional)
                 {
                     if (PersistentContainer.Instance.Players[_cInfo.playerId].HardcoreEnabled)
                     {
                         Hardcore.Check(_cInfo, _player);
                     }
                 }
                 else if (!PersistentContainer.Instance.Players[_cInfo.playerId].HardcoreEnabled)
                 {
                     string[] _hardcoreStats = { _cInfo.playerName, XUiM_Player.GetDeaths(_player).ToString(), "0" };
                     PersistentContainer.Instance.Players[_cInfo.playerId].HardcoreStats   = _hardcoreStats;
                     PersistentContainer.Instance.Players[_cInfo.playerId].HardcoreEnabled = true;
                     Hardcore.Check(_cInfo, _player);
                 }
             }
         }
     }
     if (LoginNotice.IsEnabled && LoginNotice.dict.ContainsKey(_cInfo.playerId))
     {
         LoginNotice.PlayerNotice(_cInfo);
     }
     if (Motd.IsEnabled)
     {
         Motd.Send(_cInfo);
     }
     if (Bloodmoon.IsEnabled)
     {
         Bloodmoon.Exec(_cInfo);
     }
     if (Shutdown.IsEnabled && Shutdown.Alert_On_Login)
     {
         Shutdown.NextShutdown(_cInfo);
     }
     if (BattleLogger.IsEnabled)
     {
         BattleLogger.AlertPlayer(_cInfo);
     }
     if (Poll.IsEnabled && PersistentContainer.Instance.PollOpen && !PersistentContainer.Instance.PollVote.ContainsKey(_cInfo.playerId))
     {
         Poll.Message(_cInfo);
     }
     if (ClanManager.IsEnabled)
     {
         Dictionary <string, string> _clanRequests = PersistentContainer.Instance.Players[_cInfo.playerId].ClanRequestToJoin;
         if (_clanRequests != null && _clanRequests.Count > 0)
         {
             ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + "New clan requests from:[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
             foreach (var _request in _clanRequests)
             {
                 ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _request.Value + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
             }
         }
     }
     if (Event.Open && Event.Teams.ContainsKey(_cInfo.playerId) && PersistentContainer.Instance.Players[_cInfo.playerId].EventSpawn)
     {
         Event.Spawn(_cInfo);
     }
     else if (PersistentContainer.Instance.Players[_cInfo.playerId].EventSpawn)
     {
         PersistentContainer.Instance.Players[_cInfo.playerId].EventSpawn = false;
         PersistentContainer.Instance.Save();
     }
 }
示例#10
0
 public override void PlayerSpawnedInWorld(ClientInfo _cInfo, RespawnType _respawnReason, Vector3i _pos)
 {
     if (Motd.IsEnabled & Motd.Show_On_Respawn)
     {
         Motd.Send(_cInfo);
     }
     if (Bloodmoon.Show_On_Login && Bloodmoon.Show_On_Respawn)
     {
         Bloodmoon.GetBloodmoon(_cInfo, false);
     }
     if (_respawnReason == RespawnType.EnterMultiplayer)
     {
         if (NewSpawnTele.IsEnabled)
         {
             NewSpawnTele.TeleNewSpawn(_cInfo);
         }
         if (StartingItems.IsEnabled)
         {
             if (!NewSpawnTele.IsEnabled)
             {
                 StartingItems.StartingItemCheck(_cInfo);
             }
             else if (NewSpawnTele.New_Spawn_Tele_Position != "0,0,0")
             {
                 StartingItems.Que.Add(_cInfo.playerId);
             }
             else
             {
                 StartingItems.StartingItemCheck(_cInfo);
             }
         }
         if (PersistentContainer.Instance.PollOpen && !Poll.PolledYes.Contains(_cInfo.entityId) && !Poll.PolledNo.Contains(_cInfo.entityId))
         {
             Poll.Message(_cInfo);
         }
         if (Hardcore.IsEnabled)
         {
             Hardcore.Announce(_cInfo);
         }
         PersistentContainer.Instance.Players[_cInfo.playerId, true].SessionTime      = 0;
         PersistentContainer.Instance.Players[_cInfo.playerId, true].ZKills           = 0;
         PersistentContainer.Instance.Players[_cInfo.playerId, true].Deaths           = 0;
         PersistentContainer.Instance.Players[_cInfo.playerId, true].Kills            = 0;
         PersistentContainer.Instance.Players[_cInfo.playerId, true].PlayerSpentCoins = 0;
         PersistentContainer.Instance.Players[_cInfo.playerId, true].PlayerName       = _cInfo.playerName;
         PersistentContainer.Instance.Save();
     }
     if (_respawnReason == RespawnType.JoinMultiplayer)
     {
         EntityPlayer _player     = GameManager.Instance.World.Players.dict[_cInfo.entityId];
         int          _zCount     = XUiM_Player.GetZombieKills(_player);
         int          _deathCount = XUiM_Player.GetDeaths(_player);
         int          _killCount  = XUiM_Player.GetPlayerKills(_player);
         Players.FriendList(_cInfo);
         if (PersistentContainer.Instance.PollOpen && !Poll.PolledYes.Contains(_cInfo.entityId) && !Poll.PolledNo.Contains(_cInfo.entityId))
         {
             Poll.Message(_cInfo);
         }
         if (Hardcore.IsEnabled)
         {
             Hardcore.Check(_cInfo);
         }
         if (PersistentContainer.Instance.Players[_cInfo.playerId, true].EventReturn != null)
         {
             Event.OfflineReturn(_cInfo);
         }
         PersistentContainer.Instance.Players[_cInfo.playerId, true].ZKills     = _zCount;
         PersistentContainer.Instance.Players[_cInfo.playerId, true].Deaths     = _deathCount;
         PersistentContainer.Instance.Players[_cInfo.playerId, true].Kills      = _killCount;
         PersistentContainer.Instance.Players[_cInfo.playerId, true].PlayerName = _cInfo.playerName;
         PersistentContainer.Instance.Save();
     }
     if (_respawnReason == RespawnType.Died)
     {
         if (Hardcore.IsEnabled)
         {
             Hardcore.Check(_cInfo);
         }
         EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId];
         PersistentContainer.Instance.Players[_cInfo.playerId, true].Deaths = XUiM_Player.GetDeaths(_player);
         PersistentContainer.Instance.Save();
         if (Event.Open && Event.SpawnList.Contains(_cInfo.entityId))
         {
             Event.Died(_cInfo);
         }
         if (Zones.IsEnabled && Players.Victim.ContainsKey(_cInfo.entityId))
         {
             _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}Type /return to teleport back to your death position. There is a time limit.[-]", Config.Chat_Response_Color), Config.Server_Response_Name, false, "ServerTools", false));
             PersistentContainer.Instance.Players[_cInfo.playerId, true].RespawnTime = DateTime.Now;
             PersistentContainer.Instance.Save();
             if (Players.Forgive.ContainsKey(_cInfo.entityId))
             {
                 _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}Type /forgive to release your killer from jail.[-]", Config.Chat_Response_Color), Config.Server_Response_Name, false, "ServerTools", false));
             }
         }
     }
     if (_respawnReason == RespawnType.Teleport)
     {
         if (StartingItems.IsEnabled && StartingItems.Que.Contains(_cInfo.playerId))
         {
             StartingItems.StartingItemCheck(_cInfo);
             StartingItems.Que.Remove(_cInfo.playerId);
         }
         if (Players.NoFlight.Contains(_cInfo.entityId))
         {
             Players.NoFlight.Remove(_cInfo.entityId);
         }
         if (HatchElevator.IsEnabled)
         {
             HatchElevator.LastPositionY.Remove(_cInfo.entityId);
         }
     }
     if (Players.Dead.Contains(_cInfo.entityId))
     {
         Players.Dead.Remove(_cInfo.entityId);
     }
 }
示例#11
0
 public void PlayerSpawnedInWorld(ClientInfo _cInfo, RespawnType _respawnReason, Vector3i _pos)
 {
     if (_cInfo != null)
     {
         string _name = SQL.EscapeString(_cInfo.playerName);
         if (Motd.IsEnabled & Motd.Show_On_Respawn)
         {
             Motd.Send(_cInfo);
         }
         if (Bloodmoon.Show_On_Login && Bloodmoon.Show_On_Respawn)
         {
             Bloodmoon.GetBloodmoon(_cInfo, false);
         }
         if (_respawnReason == RespawnType.EnterMultiplayer)
         {
             if (NewPlayer.IsEnabled)
             {
                 NewPlayer.Exec(_cInfo);
             }
             if (NewSpawnTele.IsEnabled)
             {
                 NewSpawnTele.TeleNewSpawn(_cInfo);
             }
             if (StartingItems.IsEnabled)
             {
                 if (!NewSpawnTele.IsEnabled)
                 {
                     StartingItems.StartingItemCheck(_cInfo);
                 }
                 else if (NewSpawnTele.IsEnabled && NewSpawnTele.New_Spawn_Tele_Position != "0,0,0")
                 {
                     StartingItems.Que.Add(_cInfo.playerId);
                 }
                 else if (NewSpawnTele.IsEnabled && NewSpawnTele.New_Spawn_Tele_Position == "0,0,0")
                 {
                     StartingItems.StartingItemCheck(_cInfo);
                 }
             }
             string    _sql     = "SELECT pollOpen FROM Polls WHERE pollOpen = 'true'";
             DataTable _result1 = SQL.TQuery(_sql);
             if (_result1.Rows.Count > 0 && !PollConsole.PolledYes.Contains(_cInfo.playerId) && !PollConsole.PolledNo.Contains(_cInfo.playerId))
             {
                 PollConsole.Message(_cInfo);
             }
             _result1.Dispose();
             if (Hardcore.IsEnabled)
             {
                 Hardcore.Announce(_cInfo);
             }
             _sql = string.Format("UPDATE Players SET playername = '{0}', wallet = 0, playerSpentCoins = 0, sessionTime = 0, zkills = 0, kills = 0, deaths = 0 WHERE steamid = '{1}'", _name, _cInfo.playerId);
             SQL.FastQuery(_sql);
         }
         if (_respawnReason == RespawnType.JoinMultiplayer)
         {
             EntityPlayer _player     = GameManager.Instance.World.Players.dict[_cInfo.entityId];
             int          _zCount     = XUiM_Player.GetZombieKills(_player);
             int          _deathCount = XUiM_Player.GetDeaths(_player);
             int          _killCount  = XUiM_Player.GetPlayerKills(_player);
             string       _sql        = "SELECT pollOpen FROM Polls WHERE pollOpen = 'true'";
             DataTable    _result     = SQL.TQuery(_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))
                 {
                     if (Hardcore.IsEnabled)
                     {
                         Hardcore.Check(_cInfo);
                     }
                 }
                 else
                 {
                     _sql = string.Format("SELECT eventRespawn FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
                     DataTable _result1 = SQL.TQuery(_sql);
                     bool      _eventRespawn;
                     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.TQuery(_sql);
                         bool      _return1 = false, _return2 = false;
                         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);
                             }
                             _sql = string.Format("UPDATE Players SET return = 'false' WHERE steamid = '{0}'", _cInfo.playerId);
                             SQL.FastQuery(_sql);
                             Event.EventReturn(_cInfo);
                         }
                         else if (_return2)
                         {
                             Event.EventSpawn(_cInfo);
                         }
                     }
                 }
             }
             else
             {
                 if (Hardcore.IsEnabled)
                 {
                     Hardcore.Check(_cInfo);
                 }
             }
             _sql = string.Format("UPDATE Players SET playername = '{0}', zkills = {1}, kills = {2}, deaths = {3} WHERE steamid = '{4}'", _name, _zCount, _killCount, _deathCount, _cInfo.playerId);
             SQL.FastQuery(_sql);
             if (Mogul.IsEnabled)
             {
                 if (Wallet.IsEnabled)
                 {
                     int currentCoins = Wallet.GetcurrentCoins(_cInfo);
                     _sql = string.Format("UPDATE Players SET wallet = {0} WHERE steamid = '{1}'", currentCoins, _cInfo.playerId);
                     SQL.FastQuery(_sql);
                 }
             }
         }
         if (_respawnReason == RespawnType.Died)
         {
             EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId];
             if (Event.Open)
             {
                 if (!Event.PlayersTeam.ContainsKey(_cInfo.playerId))
                 {
                     if (Wallet.Lose_On_Death)
                     {
                         Wallet.ClearWallet(_cInfo);
                     }
                     if (Hardcore.IsEnabled)
                     {
                         Hardcore.Check(_cInfo);
                     }
                     string    _sql = string.Format("SELECT return, eventSpawn FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
                     DataTable _result1 = SQL.TQuery(_sql);
                     bool      _return1 = false, _return2 = false;
                     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);
                         }
                         _sql = string.Format("UPDATE Players SET return = 'false' WHERE steamid = '{0}'", _cInfo.playerId);
                         SQL.FastQuery(_sql);
                         Event.EventReturn(_cInfo);
                     }
                 }
                 else
                 {
                     string    _sql    = string.Format("SELECT eventRespawn FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
                     DataTable _result = SQL.TQuery(_sql);
                     bool      _eventRespawn;
                     bool.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _eventRespawn);
                     _result.Dispose();
                     if (_eventRespawn)
                     {
                         Event.Died(_cInfo);
                     }
                     else
                     {
                         _sql = string.Format("SELECT return, eventSpawn FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
                         DataTable _result1 = SQL.TQuery(_sql);
                         bool      _return1 = false, _return2 = false;
                         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);
                             }
                             _sql = string.Format("UPDATE Players SET return = 'false' WHERE steamid = '{0}'", _cInfo.playerId);
                             SQL.FastQuery(_sql);
                             Event.EventReturn(_cInfo);
                         }
                         else if (_return2)
                         {
                             Event.EventSpawn(_cInfo);
                         }
                     }
                 }
             }
             else
             {
                 if (Wallet.Lose_On_Death)
                 {
                     Wallet.ClearWallet(_cInfo);
                 }
                 if (Hardcore.IsEnabled)
                 {
                     Hardcore.Check(_cInfo);
                 }
                 string    _sql = string.Format("SELECT return, eventSpawn FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
                 DataTable _result1 = SQL.TQuery(_sql);
                 bool      _return1 = false, _return2 = false;
                 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);
                     }
                     _sql = string.Format("UPDATE Players SET return = 'false' WHERE steamid = '{0}'", _cInfo.playerId);
                     SQL.FastQuery(_sql);
                     Event.EventReturn(_cInfo);
                 }
             }
             string _sql2 = string.Format("UPDATE Players SET deaths = {0} WHERE steamid = '{1}'", XUiM_Player.GetDeaths(_player), _cInfo.playerId);
             SQL.FastQuery(_sql2);
             if (Zones.IsEnabled && Players.Victim.ContainsKey(_cInfo.entityId))
             {
                 ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + ", type /return to teleport back to your death position. There is a time limit.[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                 _sql2 = string.Format("UPDATE Players SET respawnTime = '{0}' WHERE steamid = '{1}'", DateTime.Now, _cInfo.playerId);
                 SQL.FastQuery(_sql2);
                 if (Players.Forgive.ContainsKey(_cInfo.entityId))
                 {
                     ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + ", type /forgive to release your killer from jail.[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                 }
             }
             if (Mogul.IsEnabled)
             {
                 if (Wallet.IsEnabled)
                 {
                     int currentCoins = Wallet.GetcurrentCoins(_cInfo);
                     _sql2 = string.Format("UPDATE Players SET wallet = {0} WHERE steamid = '{1}'", currentCoins, _cInfo.playerId);
                     SQL.FastQuery(_sql2);
                 }
             }
         }
         if (_respawnReason == RespawnType.Teleport)
         {
             if (StartingItems.IsEnabled && StartingItems.Que.Contains(_cInfo.playerId))
             {
                 StartingItems.StartingItemCheck(_cInfo);
                 StartingItems.Que.Remove(_cInfo.playerId);
             }
             if (Players.NoFlight.Contains(_cInfo.entityId))
             {
                 Players.NoFlight.Remove(_cInfo.entityId);
             }
             if (HatchElevator.IsEnabled)
             {
                 HatchElevator.LastPositionY.Remove(_cInfo.entityId);
             }
         }
         if (Players.Dead.Contains(_cInfo.entityId))
         {
             Players.Dead.Remove(_cInfo.entityId);
         }
     }
 }
示例#12
0
 public static void Exec() //Dictionary keys in schedule correspond to specific class in order to execute corresponding methods
 {
     try
     {
         foreach (var _event in Schedule.ToArray())
         {
             if (DateTime.Now >= _event.Value)
             {
                 if (_event.Key == "AutoBackup")
                 {
                     Add("AutoBackup", DateTime.Now.AddMinutes(AutoBackup.Delay));
                     AutoBackup.Exec();
                 }
                 else if (_event.Key == "AutoSaveWorld")
                 {
                     Add("AutoSaveWorld", DateTime.Now.AddMinutes(AutoSaveWorld.Delay));
                     AutoSaveWorld.Save();
                 }
                 else if (_event.Key == "Bloodmoon")
                 {
                     Add("Bloodmoon", DateTime.Now.AddMinutes(Bloodmoon.Delay));
                     Bloodmoon.StatusCheck();
                 }
                 else if (_event.Key == "BreakTime")
                 {
                     Add("BreakTime", DateTime.Now.AddMinutes(BreakTime.Delay));
                     BreakTime.Exec();
                 }
                 else if (_event.Key == "InfoTicker")
                 {
                     Add("InfoTicker", DateTime.Now.AddMinutes(InfoTicker.Delay));
                     InfoTicker.Exec();
                 }
                 else if (_event.Key == "NightAlert")
                 {
                     Add("NightAlert", DateTime.Now.AddMinutes(NightAlert.Delay));
                     NightAlert.Exec();
                 }
                 else if (_event.Key == "PlayerLogs")
                 {
                     Add("PlayerLogs", DateTime.Now.AddMinutes(PlayerLogs.Delay));
                     PlayerLogs.Exec();
                 }
                 else if (_event.Key == "RealWorldTime")
                 {
                     Add("RealWorldTime", DateTime.Now.AddMinutes(RealWorldTime.Delay));
                     RealWorldTime.Exec();
                 }
                 else if (_event.Key == "Watchlist")
                 {
                     Add("Watchlist", DateTime.Now.AddMinutes(Watchlist.Delay));
                     Watchlist.CheckWatchlist();
                 }
                 else if (_event.Key == "Zones")
                 {
                     Add("Zones", DateTime.Now.AddMinutes(Zones.Reminder_Delay));
                     Zones.ReminderExec();
                 }
                 else if (_event.Key == "Shutdown") //combines stop server tool to apply a countdown timer before shutdown
                 {
                     StopServer.PrepareShutdown();
                 }
             }
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in EventSchedule.Exec: {0}", e.Message));
     }
 }
示例#13
0
 public static void OldPlayerJoined(ClientInfo _cInfo, EntityPlayer _player)
 {
     try
     {
         string id = _cInfo.CrossplatformId.CombinedString;
         if (Hardcore.IsEnabled && PersistentContainer.Instance.Players[id] != null)
         {
             if (Hardcore.Optional)
             {
                 if (PersistentContainer.Instance.Players[id].HardcoreEnabled)
                 {
                     Hardcore.Check(_cInfo, _player);
                 }
             }
             else if (!PersistentContainer.Instance.Players[id].HardcoreEnabled)
             {
                 string[] hardcoreStats = { _cInfo.playerName, "0", "0" };
                 PersistentContainer.Instance.Players[id].HardcoreStats   = hardcoreStats;
                 PersistentContainer.Instance.Players[id].HardcoreEnabled = true;
                 PersistentContainer.DataChange = true;
                 Hardcore.Check(_cInfo, _player);
             }
         }
         if (LoginNotice.IsEnabled && LoginNotice.Dict1.ContainsKey(_cInfo.PlatformId.CombinedString) || LoginNotice.Dict1.ContainsKey(id))
         {
             LoginNotice.PlayerNotice(_cInfo);
         }
         if (Motd.IsEnabled)
         {
             Motd.Send(_cInfo);
         }
         if (Bloodmoon.IsEnabled)
         {
             Bloodmoon.Exec(_cInfo);
         }
         if (Shutdown.IsEnabled && Shutdown.Alert_On_Login)
         {
             Shutdown.NextShutdown(_cInfo);
         }
         if (ExitCommand.IsEnabled)
         {
             ExitCommand.AlertPlayer(_cInfo);
         }
         if (Poll.IsEnabled && PersistentContainer.Instance.PollOpen && !PersistentContainer.Instance.PollVote.ContainsKey(id))
         {
             Poll.Message(_cInfo);
         }
         if (ClanManager.IsEnabled && PersistentContainer.Instance.Players[id] != null)
         {
             Dictionary <string, string> clanRequests = PersistentContainer.Instance.Players[id].ClanRequestToJoin;
             if (clanRequests != null && clanRequests.Count > 0)
             {
                 ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + "New clan requests from:[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                 foreach (var request in clanRequests)
                 {
                     ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + request.Value + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                 }
             }
         }
         if (PersistentContainer.Instance.Players[id] != null)
         {
             if (PersistentContainer.Instance.Players[id].EventSpawn)
             {
                 PersistentContainer.Instance.Players[id].EventSpawn = false;
                 PersistentContainer.DataChange = true;
             }
             if (Wallet.IsEnabled && PersistentContainer.Instance.Players[id].PlayerWallet > 0)
             {
                 Wallet.AddCurrency(id, PersistentContainer.Instance.Players[id].PlayerWallet);
                 PersistentContainer.Instance.Players[id].PlayerWallet = 0;
                 PersistentContainer.DataChange = true;
             }
             if (PersistentContainer.Instance.Players[id].JailRelease)
             {
                 PersistentContainer.Instance.Players[id].JailRelease = false;
                 PersistentContainer.DataChange = true;
                 Vector3[] _pos = GameManager.Instance.World.GetRandomSpawnPointPositions(1);
                 _cInfo.SendPackage(NetPackageManager.GetPackage <NetPackageTeleportPlayer>().Setup(new Vector3(_pos[0].x, _pos[0].y + 1, _pos[0].z), null, false));
                 Phrases.Dict.TryGetValue("Jail2", out string phrase);
                 ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
             }
         }
         if (AutoPartyInvite.IsEnabled)
         {
             AutoPartyInvite.Exec(_cInfo, _player);
         }
         if (Event.Open && Event.Teams.ContainsKey(id) && PersistentContainer.Instance.Players[id] != null && PersistentContainer.Instance.Players[id].EventSpawn)
         {
             Event.Spawn(_cInfo);
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in API.OldPlayerJoined: {0}", e.Message));
     }
 }
示例#14
0
 private static void PlayerSpawnedInWorld(ClientInfo _cInfo, RespawnType _respawnReason, Vector3i _pos)//Spawning player
 {
     try
     {
         if (_cInfo != null)
         {
             string       id     = _cInfo.CrossplatformId.CombinedString;
             EntityPlayer player = PersistentOperations.GetEntityPlayer(_cInfo.entityId);
             if (player != null)
             {
                 if (_respawnReason == RespawnType.NewGame)
                 {
                     if (player.distanceWalked < 1 && player.totalTimePlayed <= 1 && !PersistentOperations.NewPlayerQue.Contains(_cInfo))
                     {
                         PersistentOperations.NewPlayerQue.Add(_cInfo);
                     }
                 }
                 else if (_respawnReason == RespawnType.LoadedGame)
                 {
                 }
                 else if (_respawnReason == RespawnType.EnterMultiplayer)
                 {
                     PersistentOperations.SessionTime(_cInfo);
                     PersistentContainer.Instance.Players[id].PlayerName = _cInfo.playerName;
                     PersistentContainer.Instance.Players[id].LastJoined = DateTime.Now;
                     PersistentContainer.DataChange = true;
                     if (player.AttachedToEntity != null)
                     {
                         player.Detach();
                     }
                     if (player.distanceWalked < 1 && player.totalTimePlayed <= 1 && !PersistentOperations.NewPlayerQue.Contains(_cInfo))
                     {
                         PersistentOperations.NewPlayerQue.Add(_cInfo);
                     }
                     else
                     {
                         OldPlayerJoined(_cInfo, player);
                     }
                 }
                 else if (_respawnReason == RespawnType.JoinMultiplayer)
                 {
                     PersistentOperations.SessionTime(_cInfo);
                     PersistentContainer.Instance.Players[id].PlayerName = _cInfo.playerName;
                     PersistentContainer.Instance.Players[id].LastJoined = DateTime.Now;
                     PersistentContainer.DataChange = true;
                     if (player.AttachedToEntity != null)
                     {
                         player.Detach();
                     }
                     if (player.distanceWalked < 1 && player.totalTimePlayed <= 1 && !PersistentOperations.NewPlayerQue.Contains(_cInfo))
                     {
                         PersistentOperations.NewPlayerQue.Add(_cInfo);
                     }
                     else
                     {
                         OldPlayerJoined(_cInfo, player);
                     }
                 }
                 else if (_respawnReason == RespawnType.Died)
                 {
                     if (player.AttachedToEntity != null)
                     {
                         player.Detach();
                     }
                     if (Zones.IsEnabled && Zones.ZonePlayer.ContainsKey(_cInfo.entityId))
                     {
                         Zones.ZonePlayer.TryGetValue(player.entityId, out string[] zone);
                         Zones.ZonePlayer.Remove(player.entityId);
                         Zones.Reminder.Remove(player.entityId);
                         if (zone[9] != PersistentOperations.Player_Killing_Mode.ToString())
                         {
                             _cInfo.SendPackage(NetPackageManager.GetPackage <NetPackageConsoleCmdClient>().Setup(string.Format("sgs PlayerKillingMode {0}", PersistentOperations.Player_Killing_Mode), true));
                         }
                         if (Zones.Zone_Message && zone[5] != "")
                         {
                             ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + zone[5] + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                         }
                         if (zone[7] != "")
                         {
                             Zones.ProcessCommand(_cInfo, zone[7]);
                         }
                     }
                     if (InfiniteAmmo.IsEnabled && InfiniteAmmo.Dict.ContainsKey(_cInfo.entityId))
                     {
                         InfiniteAmmo.Dict.Remove(_cInfo.entityId);
                     }
                     if (Bloodmoon.IsEnabled && Bloodmoon.Show_On_Respawn)
                     {
                         Bloodmoon.Exec(_cInfo);
                     }
                 }
                 else if (_respawnReason == RespawnType.Teleport)
                 {
                     if (Teleportation.Teleporting.Contains(_cInfo.entityId))
                     {
                         Teleportation.Teleporting.Remove(_cInfo.entityId);
                     }
                 }
                 if (PlayerChecks.TwoSecondMovement.ContainsKey(_cInfo.entityId))
                 {
                     PlayerChecks.TwoSecondMovement.Remove(_cInfo.entityId);
                 }
                 if (FlyingDetector.Flags.ContainsKey(_cInfo.entityId))
                 {
                     FlyingDetector.Flags.Remove(_cInfo.entityId);
                 }
                 if (SpeedDetector.Flags.ContainsKey(_cInfo.entityId))
                 {
                     SpeedDetector.Flags.Remove(_cInfo.entityId);
                 }
             }
             if (ExitCommand.IsEnabled && !ExitCommand.Players.ContainsKey(_cInfo.entityId) && (GameManager.Instance.adminTools.GetUserPermissionLevel(_cInfo.PlatformId) > ExitCommand.Admin_Level &&
                                                                                                GameManager.Instance.adminTools.GetUserPermissionLevel(_cInfo.CrossplatformId) > 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));
     }
 }
示例#15
0
 private static void Init(object sender, ElapsedEventArgs e)
 {
     if (!StopServer.Shutdown)
     {
         PersistentOperations.PlayerCheck();
         if (Jail.IsEnabled)
         {
             Jail.StatusCheck();
         }
         if (UnderWater.IsEnabled)
         {
             UnderWater.Exec();
         }
         timer2Second++;
         if (timer2Second >= 2)
         {
             if (WorldRadius.IsEnabled)
             {
                 WorldRadius.Exec();
             }
             if (Flying.IsEnabled)
             {
                 Flying.Exec();
             }
             timer2Second = 0;
         }
         timer5Second++;
         if (timer5Second >= 5)
         {
             if (Zones.IsEnabled)
             {
                 Zones.HostileCheck();
             }
             if (PlayerStatCheck.IsEnabled)
             {
                 PlayerStatCheck.PlayerStat();
             }
             timer5Second = 0;
         }
         timer10Second++;
         if (timer10Second >= 10)
         {
             if (EntityCleanup.IsEnabled)
             {
                 EntityCleanup.EntityCheck();
             }
             timer10Second = 0;
         }
         timer60Second++;
         if (timer60Second >= 60)
         {
             if (Jail.IsEnabled && Jail.Jailed.Count > 0)
             {
                 Jail.Clear();
             }
             if (Mute.IsEnabled && Mute.Mutes.Count > 0)
             {
                 Mute.Clear();
             }
             if (BloodmoonWarrior.IsEnabled)
             {
                 BloodmoonWarrior.Exec();
             }
             timer60Second = 0;
         }
         if (WeatherVote.IsEnabled && WeatherVote.VoteOpen)
         {
             _weatherVote++;
             if (_weatherVote >= 60)
             {
                 _weatherVote         = 0;
                 WeatherVote.VoteOpen = false;
                 WeatherVote.ProcessWeatherVote();
             }
         }
         if (RestartVote.IsEnabled && RestartVote.VoteOpen)
         {
             _restartVote++;
             if (_restartVote >= 60)
             {
                 _restartVote         = 0;
                 RestartVote.VoteOpen = false;
                 RestartVote.ProcessRestartVote();
             }
         }
         if (MuteVote.IsEnabled && MuteVote.VoteOpen)
         {
             _muteVote++;
             if (_muteVote >= 60)
             {
                 _muteVote         = 0;
                 MuteVote.VoteOpen = false;
                 MuteVote.ProcessMuteVote();
             }
         }
         if (KickVote.IsEnabled && KickVote.VoteOpen)
         {
             _kickVote++;
             if (_kickVote >= 60)
             {
                 _kickVote         = 0;
                 KickVote.VoteOpen = false;
                 KickVote.ProcessKickVote();
             }
         }
         if (Lottery.IsEnabled && Lottery.OpenLotto)
         {
             _lottery++;
             if (_lottery == 3300)
             {
                 Lottery.Alert();
             }
             if (_lottery >= 3600)
             {
                 _lottery = 0;
                 Lottery.StartLotto();
             }
         }
         else
         {
             _lottery = 0;
         }
         if (Hordes.IsEnabled)
         {
             _horde++;
             if (_horde >= 1200)
             {
                 _horde = 0;
                 Hordes.Exec();
             }
         }
         else
         {
             _horde = 0;
         }
         if (NightAlert.IsEnabled)
         {
             _nightAlert++;
             if (_nightAlert >= NightAlert.Delay * 60)
             {
                 _nightAlert = 0;
                 NightAlert.Exec();
             }
         }
         else
         {
             _nightAlert = 0;
         }
         if (Watchlist.IsEnabled)
         {
             _watchList++;
             if (_watchList >= Watchlist.Delay * 60)
             {
                 _watchList = 0;
                 Watchlist.CheckWatchlist();
             }
         }
         else
         {
             _watchList = 0;
         }
         if (Bloodmoon.IsEnabled & Bloodmoon.Auto_Show)
         {
             if (Bloodmoon.Delay > 0)
             {
                 _bloodmoon++;
                 if (_bloodmoon >= Bloodmoon.Delay * 60)
                 {
                     _bloodmoon = 0;
                     Bloodmoon.StatusCheck();
                 }
             }
         }
         else
         {
             _bloodmoon = 0;
         }
         if (PlayerLogs.IsEnabled & PlayerLogs.Delay > 0)
         {
             _playerLogs++;
             if (_playerLogs >= PlayerLogs.Delay)
             {
                 _playerLogs = 0;
                 PlayerLogs.Exec();
             }
         }
         else
         {
             _playerLogs = 0;
         }
         if (StopServer.StopServerCountingDown)
         {
             _stopServerCountDown++;
             if (_stopServerCountDown == 60)
             {
                 _stopServerCountDown = 0;
                 _stopServerCount--;
             }
             if (_stopServerCount == 0)
             {
                 _stopServerCountDown = 0;
                 StopServer.StopServerCountingDown = false;
                 StopServer.Stop();
             }
             if (_stopServerCount == 1 && _stopServerCountDown == 0)
             {
                 StopServer.StartShutdown3();
             }
             if (_stopServerCount > 1 && _stopServerCountDown == 0)
             {
                 StopServer.StartShutdown2(_stopServerCount);
             }
             if (StopServer.Kick_30_Seconds)
             {
                 if (_stopServerCount == 1 && _stopServerCountDown == 30)
                 {
                     StopServer.NoEntry = true;
                     StopServer.Kick30();
                 }
             }
             if (StopServer.Ten_Second_Countdown)
             {
                 if (_stopServerCount == 1 && _stopServerCountDown == 50)
                 {
                     StopServer.StartShutdown4();
                 }
                 if (_stopServerCount == 1 && _stopServerCountDown == 55)
                 {
                     StopServer.StartShutdown5();
                 }
                 if (_stopServerCount == 1 && _stopServerCountDown == 56)
                 {
                     StopServer.StartShutdown6();
                 }
                 if (_stopServerCount == 1 && _stopServerCountDown == 57)
                 {
                     StopServer.StartShutdown7();
                 }
                 if (_stopServerCount == 1 && _stopServerCountDown == 58)
                 {
                     StopServer.StartShutdown8();
                 }
                 if (_stopServerCount == 1 && _stopServerCountDown == 59)
                 {
                     StopServer.StartShutdown9();
                 }
             }
         }
         else
         {
             _stopServerCountDown = 0;
             _stopServerCount     = 0;
         }
         if (AutoSaveWorld.IsEnabled & AutoSaveWorld.Delay > 0)
         {
             _autoSaveWorld++;
             if (_autoSaveWorld >= AutoSaveWorld.Delay * 60)
             {
                 _autoSaveWorld = 0;
                 AutoSaveWorld.Save();
             }
         }
         else
         {
             _autoSaveWorld = 0;
         }
         if (AutoShutdown.IsEnabled && !AutoShutdown.Bloodmoon && !AutoShutdown.BloodmoonOver && !StopServer.StopServerCountingDown)
         {
             _autoShutdown++;
             if (!Event.Open && _autoShutdown >= AutoShutdown.Delay * 60)
             {
                 _autoShutdown = 0;
                 AutoShutdown.BloodmoonCheck();
             }
         }
         else
         {
             _autoShutdown = 0;
         }
         if (AutoShutdown.Bloodmoon)
         {
             _autoShutdownBloodmoon++;
             if (_autoShutdownBloodmoon >= 150)
             {
                 _autoShutdownBloodmoon = 0;
                 AutoShutdown.BloodmoonCheck();
             }
         }
         if (AutoShutdown.BloodmoonOver && !Event.Open)
         {
             _autoShutdownBloodmoonOver++;
             if (_autoShutdownBloodmoonOver == 1)
             {
                 AutoShutdown.BloodmoonOverAlert();
             }
             else if (_autoShutdownBloodmoonOver >= 900)
             {
                 _autoShutdownBloodmoonOver = 0;
                 AutoShutdown.BloodmoonOver = false;
                 AutoShutdown.Shutdown();
             }
         }
         if (InfoTicker.IsEnabled)
         {
             _infoTicker++;
             if (_infoTicker >= InfoTicker.Delay * 60)
             {
                 _infoTicker = 0;
                 InfoTicker.StatusCheck();
             }
         }
         else
         {
             _infoTicker = 0;
         }
         if (Event.Invited)
         {
             _eventInvitation++;
             if (_eventInvitation >= 900)
             {
                 _eventInvitation = 0;
                 Event.Invited    = false;
                 Event.CheckOpen();
             }
         }
         else
         {
             _eventInvitation = 0;
         }
         if (Event.Open)
         {
             _eventOpen++;
             if (_eventOpen == _eventTime / 2)
             {
                 Event.HalfTime();
             }
             if (_eventOpen == _eventTime - 300)
             {
                 Event.FiveMin();
             }
             if (_eventOpen >= _eventTime)
             {
                 _eventOpen = 0;
                 Event.EndEvent();
             }
         }
         else
         {
             _eventOpen = 0;
         }
         if (RestartVote.Startup)
         {
             _restartVote++;
             if (_restartVote >= 1800)
             {
                 RestartVote.Startup = false;
             }
         }
         else
         {
             _restartVote = 0;
         }
         if (Zones.IsEnabled & Zones.Reminder.Count > 0)
         {
             _zoneReminder++;
             if (_zoneReminder >= Zones.Reminder_Delay * 60)
             {
                 _zoneReminder = 0;
                 Zones.ReminderExec();
             }
         }
         else
         {
             _zoneReminder = 0;
         }
         if (AutoBackup.IsEnabled)
         {
             _autoBackup++;
             if (_autoBackup >= AutoBackup.Delay * 60)
             {
                 _autoBackup = 0;
                 AutoBackup.Exec();
             }
         }
         else
         {
             _autoBackup = 0;
         }
         if (BreakTime.IsEnabled)
         {
             _breakTime++;
             if (_breakTime >= BreakTime.Break_Time * 60)
             {
                 _breakTime = 0;
                 BreakTime.Exec();
             }
         }
         else
         {
             _breakTime = 0;
         }
         if (Tracking.IsEnabled)
         {
             _tracking++;
             if (_tracking >= Tracking.Rate)
             {
                 _tracking = 0;
                 Tracking.Exec();
             }
         }
         else
         {
             _tracking = 0;
         }
         if (InvalidItems.IsEnabled && InvalidItems.Check_Storage)
         {
             _invalidItems++;
             if (_invalidItems >= 300)
             {
                 _invalidItems = 0;
                 InvalidItems.CheckStorage();
             }
         }
         else
         {
             _invalidItems = 0;
         }
         if (RealWorldTime.IsEnabled)
         {
             _realWorldTime++;
             if (_realWorldTime >= RealWorldTime.Delay * 60)
             {
                 _realWorldTime = 0;
                 RealWorldTime.Time();
             }
         }
         else
         {
             _realWorldTime = 0;
         }
     }
 }
示例#16
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));
     }
 }
示例#17
0
 public static void Init(object sender, ElapsedEventArgs e)
 {
     if (FlightCheck.IsEnabled)
     {
         if ((int)GameManager.Instance.fps.Counter > 5)
         {
             FlightCheck.AutoFlightCheck();
         }
     }
     if (HatchElevator.IsEnabled)
     {
         HatchElevator.AutoHatchCheck();
     }
     if (UndergroundCheck.IsEnabled)
     {
         if ((int)GameManager.Instance.fps.Counter > 5)
         {
             UndergroundCheck.AutoUndergroundCheck();
         }
     }
     if (Jail.IsEnabled)
     {
         Jail.StatusCheck();
     }
     if (Bounties.IsEnabled || KillNotice.IsEnabled || DeathSpot.IsEnabled || Zones.IsEnabled || Event.Open)
     {
         Players.Exec();
     }
     if (Jail.Jailed.Count > 0)
     {
         _jR++;
         if (_jR >= 60)
         {
             _jR = 0;
             Jail.Clear();
         }
     }
     else
     {
         _jR = 0;
     }
     if (WeatherVote.IsEnabled)
     {
         if (WeatherVote.VoteOpen)
         {
             _wV++;
             if (_wV >= 30)
             {
                 _wV = 0;
                 WeatherVote.CallForVote2();
             }
         }
     }
     else
     {
         _wV = 0;
     }
     if (MutePlayer.IsEnabled && MutePlayer.Mutes.Count > 0)
     {
         _mC++;
         if (_mC >= 60)
         {
             _mC = 0;
             MutePlayer.Clear();
         }
     }
     else
     {
         _mC = 0;
     }
     if (RealWorldTime.IsEnabled)
     {
         _rWT++;
         if (_rWT >= Real_Time_Delay * 60)
         {
             _rWT = 0;
             RealWorldTime.Time();
         }
     }
     else
     {
         _rWT = 0;
     }
     if (Lottery.IsEnabled && Lottery.OpenLotto)
     {
         _l++;
         if (_l == 3300)
         {
             Lottery.Alert();
         }
         if (_l >= 3600)
         {
             _l = 0;
             Lottery.StartLotto();
         }
     }
     else
     {
         _l = 0;
     }
     if (RestartVote.IsEnabled)
     {
         if (RestartVote.VoteOpen)
         {
             _rV++;
             if (_rV >= 30)
             {
                 _rV = 0;
                 RestartVote.CallForVote2();
             }
         }
     }
     else
     {
         _rV = 0;
     }
     if (NightVote.IsEnabled)
     {
         if (NightVote.VoteOpen)
         {
             _nV++;
             if (_nV >= 30)
             {
                 _nV = 0;
                 NightVote.VoteCount();
             }
         }
     }
     else
     {
         _nV = 0;
     }
     if (MuteVote.IsEnabled)
     {
         if (MuteVote.VoteOpen)
         {
             _mV++;
             if (_mV >= 30)
             {
                 _mV = 0;
                 MuteVote.VoteCount();
             }
         }
     }
     else
     {
         _mV = 0;
     }
     if (KickVote.IsEnabled)
     {
         if (KickVote.VoteOpen)
         {
             _kV++;
             if (_kV >= 30)
             {
                 _kV = 0;
                 KickVote.VoteCount();
             }
         }
     }
     else
     {
         _kV = 0;
     }
     if (Hordes.IsEnabled)
     {
         _h++;
         if (_h >= 1200)
         {
             _h = 0;
             Hordes.Exec();
         }
     }
     else
     {
         _h = 0;
     }
     if (EntityCleanup.IsEnabled && (EntityCleanup.BlockIsEnabled || EntityCleanup.FallingTreeEnabled || EntityCleanup.Underground || EntityCleanup.Bikes))
     {
         _eC++;
         if (_eC >= 10)
         {
             _eC = 0;
             EntityCleanup.EntityCheck();
         }
     }
     else
     {
         _eC = 0;
     }
     if (Zones.IsEnabled)
     {
         _rE++;
         if (_rE >= 5)
         {
             _rE = 0;
             EntityCleanup.ZombieCheck();
         }
     }
     else
     {
         _rE = 0;
     }
     if (NightAlert.IsEnabled)
     {
         _nA++;
         if (_nA >= Night_Time_Delay * 60)
         {
             _nA = 0;
             NightAlert.Exec();
         }
     }
     else
     {
         _nA = 0;
     }
     if (Watchlist.IsEnabled)
     {
         _wL++;
         if (_wL >= Alert_Delay * 60)
         {
             _wL = 0;
             Watchlist.CheckWatchlist();
         }
     }
     else
     {
         _wL = 0;
     }
     if (PlayerStatCheck.IsEnabled)
     {
         _pSC++;
         if (_pSC >= 2)
         {
             _pSC = 0;
             PlayerStatCheck.PlayerStat();
         }
     }
     else
     {
         _pSC = 0;
     }
     if (ReservedSlots.IsEnabled)
     {
         _rS++;
         if (_rS >= 120)
         {
             _rS = 0;
             int _playerCount = ConnectionManager.Instance.ClientCount();
             if (_playerCount >= API.MaxPlayers - ReservedSlots.Admin_Slots)
             {
                 ReservedSlots.OpenSlot();
             }
         }
     }
     else
     {
         _rS = 0;
     }
     if (Bloodmoon.IsEnabled & Bloodmoon.Auto_Show)
     {
         if (Auto_Show_Bloodmoon_Delay > 0)
         {
             _b++;
             if (_b >= Auto_Show_Bloodmoon_Delay * 60)
             {
                 _b = 0;
                 Bloodmoon.StatusCheck();
             }
         }
     }
     else
     {
         _b = 0;
     }
     if (PlayerLogs.IsEnabled & Player_Log_Interval > 0)
     {
         _pL++;
         if (_pL >= Player_Log_Interval)
         {
             _pL = 0;
             PlayerLogs.Exec();
         }
     }
     else
     {
         _pL = 0;
     }
     if (StopServer.stopServerCountingDown)
     {
         _sSCD++;
         if (_sSCD == 60)
         {
             _sSCD = 0;
             _sSC--;
         }
         if (_sSC == 0)
         {
             _sSCD = 0;
             StopServer.stopServerCountingDown = false;
             StopServer.Stop();
         }
         if (_sSC == 1 && _sSCD == 0)
         {
             StopServer.StartShutdown3();
         }
         if (_sSC > 1 && _sSCD == 0)
         {
             StopServer.StartShutdown2(_sSC);
         }
         if (StopServer.Kick_30_Seconds)
         {
             if (_sSC == 1 && _sSCD == 30)
             {
                 StopServer.Kick30();
             }
         }
         if (StopServer.Ten_Second_Countdown)
         {
             if (_sSC == 1 && _sSCD == 50)
             {
                 StopServer.StartShutdown4();
             }
             if (_sSC == 1 && _sSCD == 55)
             {
                 StopServer.StartShutdown5();
             }
             if (_sSC == 1 && _sSCD == 56)
             {
                 StopServer.StartShutdown6();
             }
             if (_sSC == 1 && _sSCD == 57)
             {
                 StopServer.StartShutdown7();
             }
             if (_sSC == 1 && _sSCD == 58)
             {
                 StopServer.StartShutdown8();
             }
             if (_sSC == 1 && _sSCD == 59)
             {
                 StopServer.StartShutdown9();
             }
         }
     }
     else
     {
         _sSCD = 0;
         _sSC  = 0;
     }
     if (AutoSaveWorld.IsEnabled & Delay_Between_World_Saves > 0)
     {
         _wSD++;
         if (_wSD >= Delay_Between_World_Saves * 60)
         {
             _wSD = 0;
             AutoSaveWorld.Save();
         }
     }
     else
     {
         _wSD = 0;
     }
     if (AutoShutdown.IsEnabled && !AutoShutdown.Bloodmoon && !StopServer.stopServerCountingDown)
     {
         _sD++;
         if (!Event.Open && _sD >= Shutdown_Delay * 60)
         {
             _sD = 0;
             AutoShutdown.CheckBloodmoon();
         }
     }
     else
     {
         _sD = 0;
     }
     if (AutoShutdown.Bloodmoon)
     {
         _aSB++;
         if (_aSB >= 1800)
         {
             _aSB = 0;
             AutoShutdown.CheckBloodmoon();
         }
     }
     else
     {
         _aSB = 0;
     }
     if (InfoTicker.IsEnabled)
     {
         _iT++;
         if (_iT >= Infoticker_Delay * 60)
         {
             _iT = 0;
             InfoTicker.StatusCheck();
         }
     }
     else
     {
         _iT = 0;
     }
     if (WorldRadius.IsEnabled)
     {
         _wR++;
         if (_wR >= 2)
         {
             _wR = 0;
             WorldRadius.Exec();
         }
     }
     else
     {
         _wR = 0;
     }
     if (VoteReward.IsEnabled && VoteReward.QueOpen)
     {
         _vR++;
         if (_vR >= 60)
         {
             _vR = 0;
             VoteReward.que.Clear();
             VoteReward.QueOpen    = false;
             VoteReward.RewardOpen = true;
         }
     }
     else
     {
         _vR = 0;
     }
     if (Event.Invited)
     {
         _eI++;
         if (_eI >= 900)
         {
             _eI           = 0;
             Event.Invited = false;
             Event.CheckOpen();
         }
     }
     else
     {
         _eI = 0;
     }
     if (Event.Open)
     {
         _eO++;
         if (_eO == _eventTime / 2)
         {
             Event.HalfTime();
         }
         if (_eO == _eventTime - 300)
         {
             Event.FiveMin();
         }
         if (_eO >= _eventTime)
         {
             _eO = 0;
             Event.EndEvent();
         }
     }
     else
     {
         _eO = 0;
     }
     if (RestartVote.Startup)
     {
         _rVS++;
         if (_rVS >= 1800)
         {
             RestartVote.Startup = false;
         }
     }
     else
     {
         _rVS = 0;
     }
     if (Zones.IsEnabled & Zones.reminder.Count > 0)
     {
         _zR++;
         if (_zR >= Zones.Reminder_Delay)
         {
             _zR = 0;
             Zones.Reminder();
         }
     }
     else
     {
         _zR = 0;
     }
 }
示例#18
0
 private static void Exec()
 {
     if (!StopServer.ShuttingDown)
     {
         PersistentOperations.PlayerCheck();
         if (Jail.IsEnabled)
         {
             Jail.StatusCheck();
         }
         if (TwoSecondTick >= 2)
         {
             TwoSecondTick = 0;
             if (WorldRadius.IsEnabled)
             {
                 WorldRadius.Exec();
             }
             if (PlayerChecks.GodEnabled || PlayerChecks.FlyEnabled || PlayerChecks.SpectatorEnabled || PlayerChecks.WaterEnabled)
             {
                 PlayerChecks.Exec();
             }
         }
         if (FiveSecondTick >= 5)
         {
             FiveSecondTick = 0;
             if (Zones.IsEnabled)
             {
                 Zones.HostileCheck();
             }
             if (PlayerStats.IsEnabled)
             {
                 PlayerStats.Exec();
             }
         }
         if (TenSecondTick >= 10)
         {
             TenSecondTick = 0;
             if (EntityCleanup.IsEnabled)
             {
                 EntityCleanup.EntityCheck();
             }
         }
         if (SixtySecondTick >= 60)
         {
             SixtySecondTick = 0;
             if (Jail.IsEnabled && Jail.Jailed.Count > 0)
             {
                 Jail.Clear();
             }
             if (Mute.IsEnabled && Mute.Mutes.Count > 0)
             {
                 Mute.Clear();
             }
             if (BloodmoonWarrior.IsEnabled)
             {
                 BloodmoonWarrior.Exec();
             }
         }
         if (WeatherVote.IsEnabled && WeatherVote.VoteOpen)
         {
             _weatherVote++;
             if (_weatherVote >= 60)
             {
                 _weatherVote         = 0;
                 WeatherVote.VoteOpen = false;
                 WeatherVote.ProcessWeatherVote();
             }
         }
         if (RestartVote.IsEnabled && RestartVote.VoteOpen)
         {
             _restartVote++;
             if (_restartVote >= 60)
             {
                 _restartVote         = 0;
                 RestartVote.VoteOpen = false;
                 RestartVote.ProcessRestartVote();
             }
         }
         if (MuteVote.IsEnabled && MuteVote.VoteOpen)
         {
             _muteVote++;
             if (_muteVote >= 60)
             {
                 _muteVote         = 0;
                 MuteVote.VoteOpen = false;
                 MuteVote.ProcessMuteVote();
             }
         }
         if (KickVote.IsEnabled && KickVote.VoteOpen)
         {
             _kickVote++;
             if (_kickVote >= 60)
             {
                 _kickVote         = 0;
                 KickVote.VoteOpen = false;
                 KickVote.ProcessKickVote();
             }
         }
         if (Lottery.IsEnabled && Lottery.OpenLotto)
         {
             _lottery++;
             if (_lottery == 3300)
             {
                 Lottery.Alert();
             }
             if (_lottery >= 3600)
             {
                 _lottery = 0;
                 Lottery.StartLotto();
             }
         }
         else
         {
             _lottery = 0;
         }
         if (Hordes.IsEnabled)
         {
             _horde++;
             if (_horde >= 1200)
             {
                 _horde = 0;
                 Hordes.Exec();
             }
         }
         else
         {
             _horde = 0;
         }
         if (NightAlert.IsEnabled)
         {
             _nightAlert++;
             if (_nightAlert >= NightAlert.Delay * 60)
             {
                 _nightAlert = 0;
                 NightAlert.Exec();
             }
         }
         else
         {
             _nightAlert = 0;
         }
         if (Watchlist.IsEnabled)
         {
             _watchList++;
             if (_watchList >= Watchlist.Delay * 60)
             {
                 _watchList = 0;
                 Watchlist.CheckWatchlist();
             }
         }
         else
         {
             _watchList = 0;
         }
         if (Bloodmoon.IsEnabled & Bloodmoon.Auto_Show)
         {
             if (Bloodmoon.Delay > 0)
             {
                 _bloodmoon++;
                 if (_bloodmoon >= Bloodmoon.Delay * 60)
                 {
                     _bloodmoon = 0;
                     Bloodmoon.StatusCheck();
                 }
             }
         }
         else
         {
             _bloodmoon = 0;
         }
         if (PlayerLogs.IsEnabled & PlayerLogs.Delay > 0)
         {
             _playerLogs++;
             if (_playerLogs >= PlayerLogs.Delay)
             {
                 _playerLogs = 0;
                 PlayerLogs.Exec();
             }
         }
         else
         {
             _playerLogs = 0;
         }
         if (StopServer.CountingDown)
         {
             StopServerSeconds++;
             if (StopServerSeconds == 60)
             {
                 StopServerSeconds = 0;
                 StopServerMinutes--;
             }
             if (StopServerMinutes == 0)
             {
                 StopServerSeconds       = 0;
                 StopServer.CountingDown = false;
                 StopServer.Stop();
             }
             if (StopServerMinutes == 1 && StopServerSeconds == 0)
             {
                 StopServer.StartShutdown3();
             }
             if (StopServerMinutes > 1 && StopServerSeconds == 0)
             {
                 StopServer.StartShutdown2(StopServerMinutes);
             }
             if (StopServerMinutes == 1 && StopServerSeconds == 30)
             {
                 StopServer.Kick30();
             }
         }
         if (AutoSaveWorld.IsEnabled & AutoSaveWorld.Delay > 0)
         {
             _autoSaveWorld++;
             if (_autoSaveWorld >= AutoSaveWorld.Delay * 60)
             {
                 _autoSaveWorld = 0;
                 AutoSaveWorld.Save();
             }
         }
         else
         {
             _autoSaveWorld = 0;
         }
         if (Shutdown.IsEnabled && !StopServer.CountingDown)
         {
             if (Shutdown.BloodmoonOver && !Event.Open)
             {
                 _shutdownBloodmoonOver++;
                 if (_shutdownBloodmoonOver >= 900)
                 {
                     _shutdownBloodmoonOver = 0;
                     Shutdown.BloodmoonOver = false;
                     Shutdown.Stop();
                 }
             }
             else if (!Shutdown.Bloodmoon)
             {
                 _shutdown++;
                 if (_shutdown >= Shutdown.Delay * 60)
                 {
                     if (Event.Open)
                     {
                         if (!Event.OperatorWarned)
                         {
                             Event.OperatorWarned = true;
                             ClientInfo _cInfo = ConsoleHelper.ParseParamIdOrName(Event.Operator);
                             if (_cInfo != null)
                             {
                                 ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + "A scheduled shutdown is set to begin but is on hold until the event ends" + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null);
                             }
                         }
                     }
                     else
                     {
                         _shutdown = 0;
                         Shutdown.BloodmoonCheck();
                     }
                 }
             }
             else if (Shutdown.Bloodmoon)
             {
                 _shutdownBloodmoon++;
                 if (_shutdownBloodmoon >= 150)
                 {
                     _shutdownBloodmoon = 0;
                     Shutdown.BloodmoonCheck();
                 }
             }
         }
         else
         {
             _shutdown = 0;
         }
         if (InfoTicker.IsEnabled)
         {
             _infoTicker++;
             if (_infoTicker >= InfoTicker.Delay * 60)
             {
                 _infoTicker = 0;
                 InfoTicker.Exec();
             }
         }
         else
         {
             _infoTicker = 0;
         }
         if (Event.Invited)
         {
             _eventInvitation++;
             if (_eventInvitation >= 900)
             {
                 _eventInvitation = 0;
                 Event.Invited    = false;
                 Event.CheckOpen();
             }
         }
         else
         {
             _eventInvitation = 0;
         }
         if (Event.Open)
         {
             _eventOpen++;
             if (_eventOpen == _eventTime / 2)
             {
                 Event.HalfTime();
             }
             if (_eventOpen == _eventTime - 300)
             {
                 Event.FiveMin();
             }
             if (_eventOpen >= _eventTime)
             {
                 _eventOpen = 0;
                 Event.EndEvent();
             }
         }
         else
         {
             _eventOpen = 0;
         }
         if (RestartVote.Cycle)
         {
             _restartVoteCycle++;
             if (_restartVoteCycle >= 1800)
             {
                 RestartVote.Cycle = false;
             }
         }
         else
         {
             _restartVoteCycle = 0;
         }
         if (Zones.IsEnabled & Zones.Reminder.Count > 0)
         {
             _zoneReminder++;
             if (_zoneReminder >= Zones.Reminder_Delay * 60)
             {
                 _zoneReminder = 0;
                 Zones.ReminderExec();
             }
         }
         else
         {
             _zoneReminder = 0;
         }
         if (AutoBackup.IsEnabled)
         {
             _autoBackup++;
             if (_autoBackup >= AutoBackup.Delay * 60)
             {
                 _autoBackup = 0;
                 AutoBackup.Exec();
             }
         }
         else
         {
             _autoBackup = 0;
         }
         if (BreakTime.IsEnabled)
         {
             _breakTime++;
             if (_breakTime >= BreakTime.Break_Time * 60)
             {
                 _breakTime = 0;
                 BreakTime.Exec();
             }
         }
         else
         {
             _breakTime = 0;
         }
         if (Track.IsEnabled)
         {
             _tracking++;
             if (_tracking >= 20)
             {
                 _tracking = 0;
                 Track.Exec();
             }
         }
         else
         {
             _tracking = 0;
         }
         if (InvalidItems.IsEnabled && InvalidItems.Check_Storage)
         {
             _invalidItems++;
             if (_invalidItems >= 300)
             {
                 _invalidItems = 0;
                 InvalidItems.CheckStorage();
             }
         }
         else
         {
             _invalidItems = 0;
         }
         if (RealWorldTime.IsEnabled)
         {
             _realWorldTime++;
             if (_realWorldTime >= RealWorldTime.Delay * 60)
             {
                 _realWorldTime = 0;
                 RealWorldTime.Time();
             }
         }
         else
         {
             _realWorldTime = 0;
         }
     }
 }
示例#19
0
 public static void OldPlayerJoined(ClientInfo _cInfo, EntityPlayer _player)
 {
     try
     {
         if (Hardcore.IsEnabled)
         {
             if (GameManager.Instance.World.Players.dict.ContainsKey(_cInfo.entityId))
             {
                 if (Hardcore.Optional)
                 {
                     if (PersistentContainer.Instance.Players[_cInfo.playerId].HardcoreEnabled)
                     {
                         Hardcore.Check(_cInfo, _player);
                     }
                 }
                 else if (!PersistentContainer.Instance.Players[_cInfo.playerId].HardcoreEnabled)
                 {
                     string[] _hardcoreStats = { _cInfo.playerName, XUiM_Player.GetDeaths(_player).ToString(), "0" };
                     PersistentContainer.Instance.Players[_cInfo.playerId].HardcoreStats   = _hardcoreStats;
                     PersistentContainer.Instance.Players[_cInfo.playerId].HardcoreEnabled = true;
                     PersistentContainer.DataChange = true;
                     Hardcore.Check(_cInfo, _player);
                 }
             }
         }
         if (LoginNotice.IsEnabled && LoginNotice.dict.ContainsKey(_cInfo.playerId))
         {
             LoginNotice.PlayerNotice(_cInfo);
         }
         if (Motd.IsEnabled)
         {
             Motd.Send(_cInfo);
         }
         if (Bloodmoon.IsEnabled)
         {
             Bloodmoon.Exec(_cInfo);
         }
         if (Shutdown.IsEnabled && Shutdown.Alert_On_Login)
         {
             Shutdown.NextShutdown(_cInfo);
         }
         if (ExitCommand.IsEnabled)
         {
             ExitCommand.AlertPlayer(_cInfo);
         }
         if (Poll.IsEnabled && PersistentContainer.Instance.PollOpen && !PersistentContainer.Instance.PollVote.ContainsKey(_cInfo.playerId))
         {
             Poll.Message(_cInfo);
         }
         if (ClanManager.IsEnabled)
         {
             Dictionary <string, string> _clanRequests = PersistentContainer.Instance.Players[_cInfo.playerId].ClanRequestToJoin;
             if (_clanRequests != null && _clanRequests.Count > 0)
             {
                 ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + "New clan requests from:[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                 foreach (var _request in _clanRequests)
                 {
                     ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _request.Value + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                 }
             }
         }
         //If they are in a clan, check if we should get them into a party
         ClanManager.checkClanParty(_cInfo, _player);
         if (Event.Open && Event.Teams.ContainsKey(_cInfo.playerId) && PersistentContainer.Instance.Players[_cInfo.playerId].EventSpawn)
         {
             Event.Spawn(_cInfo);
         }
         else if (PersistentContainer.Instance.Players[_cInfo.playerId].EventSpawn)
         {
             PersistentContainer.Instance.Players[_cInfo.playerId].EventSpawn = false;
             PersistentContainer.DataChange = true;
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in API.OldPlayerJoined: {0}", e.Message));
     }
 }
示例#20
0
 public void PlayerSpawning(ClientInfo _cInfo, int _chunkViewDim, PlayerProfile _playerProfile)
 {
     if (_cInfo != null)
     {
         if (CountryBan.IsEnabled && _cInfo.ip != "127.0.0.1" && !_cInfo.ip.StartsWith("192.168"))
         {
             if (CountryBan.IsCountryBanned(_cInfo))
             {
                 return;
             }
         }
         string    _sql    = string.Format("SELECT steamid FROM Players WHERE steamid = '{0}'", _cInfo.playerId);;
         DataTable _result = SQL.TQuery(_sql);
         string    _name   = SQL.EscapeString(_cInfo.playerName);
         if (_result.Rows.Count == 0)
         {
             _sql = string.Format("INSERT INTO Players (steamid, playername, last_joined) VALUES ('{0}', '{1}', '{2}')", _cInfo.playerId, _name, DateTime.Now);
         }
         else
         {
             _sql = string.Format("UPDATE Players SET playername = '{0}', last_joined = '{1}' WHERE steamid = '{2}'", _name, DateTime.Now, _cInfo.playerId);
         }
         _result.Dispose();
         SQL.FastQuery(_sql);
         if (StopServer.NoEntry)
         {
             int    _seconds = (60 - Timers._sSCD);
             string _phrase452;
             if (!Phrases.Dict.TryGetValue(452, out _phrase452))
             {
                 _phrase452 = "Shutdown is in {Minutes} minutes {Seconds} seconds. Please come back after the server restarts.";
             }
             _phrase452 = _phrase452.Replace("{Minutes}", Timers._sSC.ToString());
             _phrase452 = _phrase452.Replace("{Seconds}", _seconds.ToString());
             SdtdConsole.Instance.ExecuteSync(string.Format("kick {0} \"{1}\"", _cInfo.entityId, _phrase452), (ClientInfo)null);
         }
         if (ReservedSlots.IsEnabled)
         {
             if (ReservedSlots.Kicked.ContainsKey(_cInfo.playerName))
             {
                 DateTime _dateTime;
                 ReservedSlots.Kicked.TryGetValue(_cInfo.playerId, out _dateTime);
                 TimeSpan varTime           = DateTime.Now - _dateTime;
                 double   fractionalMinutes = varTime.TotalMinutes;
                 int      _timepassed       = (int)fractionalMinutes;
                 if (_timepassed >= 5)
                 {
                     int    _timeleft = 5 - _timepassed;
                     string _phrase22;
                     if (!Phrases.Dict.TryGetValue(22, out _phrase22))
                     {
                         _phrase22 = "Sorry {PlayerName} you have reached the max session time. Please wait {TimeRemaining} minutes before rejoining.";
                     }
                     _phrase22 = _phrase22.Replace("{PlayerName}", _cInfo.playerName);
                     _phrase22 = _phrase22.Replace("{TimeRemaining}", _timeleft.ToString());
                     SdtdConsole.Instance.ExecuteSync(string.Format("kick {0} \"{1}\"", _cInfo.playerId, _phrase22), (ClientInfo)null);
                 }
                 else
                 {
                     ReservedSlots.CheckReservedSlot(_cInfo);
                 }
             }
             else
             {
                 ReservedSlots.CheckReservedSlot(_cInfo);
             }
         }
         if (CredentialCheck.IsEnabled)
         {
             CredentialCheck.AccCheck(_cInfo);
         }
         if (Motd.IsEnabled && !Motd.Show_On_Respawn)
         {
             Motd.Send(_cInfo);
         }
         if (AutoShutdown.IsEnabled)
         {
             if (AutoShutdown.Alert_On_Login)
             {
                 AutoShutdown.CheckNextShutdown(_cInfo, false);
             }
         }
         if (Bloodmoon.Show_On_Login && !Bloodmoon.Show_On_Respawn)
         {
             Bloodmoon.GetBloodmoon(_cInfo, false);
         }
         if (LoginNotice.IsEnabled)
         {
             LoginNotice.PlayerCheck(_cInfo);
         }
         Players.SessionTime(_cInfo);
     }
 }
示例#21
0
        public static void Exec()
        {
            try
            {
                if (Schedule.Count > 0)
                {
                    foreach (var entry in Schedule.ToArray())
                    {
                        switch (entry.Key)
                        {
                        case "AutoBackup":
                            if (DateTime.Now >= entry.Value)
                            {
                                autoBackup = "";
                                AutoBackup.SetDelay();
                                AutoBackup.Exec();
                            }
                            continue;

                        case "AutoSaveWorld":
                            if (DateTime.Now >= entry.Value)
                            {
                                autoSaveWorld = "";
                                AutoSaveWorld.SetDelay();
                                AutoSaveWorld.Save();
                            }
                            continue;

                        case "Bloodmoon":
                            if (DateTime.Now >= entry.Value)
                            {
                                bloodmoon = "";
                                Bloodmoon.SetDelay();
                                Bloodmoon.StatusCheck();
                            }
                            continue;

                        case "BreakTime":
                            if (DateTime.Now >= entry.Value)
                            {
                                breakTime = "";
                                BreakTime.SetDelay();
                                BreakTime.Exec();
                            }
                            continue;

                        case "InfoTicker":
                            if (DateTime.Now >= entry.Value)
                            {
                                infoTicker = "";
                                InfoTicker.SetDelay();
                                InfoTicker.Exec();
                            }
                            continue;

                        case "NightAlert":
                            if (DateTime.Now >= entry.Value)
                            {
                                nightAlert = "";
                                NightAlert.SetDelay();
                                NightAlert.Exec();
                            }
                            continue;

                        case "PlayerLogs":
                            if (DateTime.Now >= entry.Value)
                            {
                                playerLogs = "";
                                PlayerLogs.SetDelay();
                                PlayerLogs.Exec();
                            }
                            continue;

                        case "RealWorldTime":
                            if (DateTime.Now >= entry.Value)
                            {
                                realWorldTime = "";
                                RealWorldTime.SetDelay();
                                RealWorldTime.Exec();
                            }
                            continue;

                        case "Shutdown":
                            if (DateTime.Now >= entry.Value)
                            {
                                Remove("Shutdown");
                                Shutdown.PrepareShutdown();
                            }
                            continue;

                        case "WatchList":
                            if (DateTime.Now >= entry.Value)
                            {
                                watchList = "";
                                WatchList.SetDelay();
                                WatchList.Exec();
                            }
                            continue;

                        case "Zones":
                            if (DateTime.Now >= entry.Value)
                            {
                                zones = "";
                                Zones.SetDelay();
                                Zones.ReminderExec();
                            }
                            continue;
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Log.Out(string.Format("[SERVERTOOLS] Error in EventSchedule.Exec: {0}", e.Message));
            }
        }