示例#1
0
 public static void PlayerCheck()
 {
     try
     {
         if (!IsRunning)
         {
             IsRunning = true;
             List <ClientInfo> _cInfoList = PersistentOperations.ClientList();
             if (_cInfoList != null && _cInfoList.Count > 0)
             {
                 for (int i = 0; i < _cInfoList.Count; i++)
                 {
                     ClientInfo _cInfo = _cInfoList[i];
                     if (_cInfo != null && !string.IsNullOrEmpty(_cInfo.playerId) && _cInfo.entityId > 0)
                     {
                         EntityPlayer _player = PersistentOperations.GetEntityPlayer(_cInfo.playerId);
                         if (_player != null)
                         {
                             if (!_player.IsDead())
                             {
                                 if (_player.IsSpawned() && _player.IsAlive() && !Teleportation.Teleporting.Contains(_cInfo.entityId))
                                 {
                                     if (Zones.IsEnabled)
                                     {
                                         Zones.ZoneCheck(_cInfo, _player);
                                     }
                                     if (Lobby.IsEnabled && Lobby.LobbyPlayers.Contains(_cInfo.entityId))
                                     {
                                         Lobby.LobbyCheck(_cInfo, _player);
                                     }
                                     if (Market.IsEnabled && Market.MarketPlayers.Contains(_cInfo.entityId))
                                     {
                                         Market.MarketCheck(_cInfo, _player);
                                     }
                                 }
                             }
                             else if (BloodmoonWarrior.IsEnabled && BloodmoonWarrior.WarriorList.Contains(_cInfo.playerId))
                             {
                                 BloodmoonWarrior.WarriorList.Remove(_cInfo.playerId);
                                 BloodmoonWarrior.KilledZombies.Remove(_cInfo.playerId);
                             }
                         }
                     }
                 }
             }
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in PersistentOperations.PlayerCheck: {0}", e.Message));
     }
     IsRunning = false;
 }