public static void PlayerCheck() { try { if (!IsRunning) { IsRunning = true; List <ClientInfo> _cInfoList = PersistentOperations.ClientList(); if (_cInfoList != null) { for (int i = 0; i < _cInfoList.Count; i++) { ClientInfo _cInfo = _cInfoList[i]; Log.Out(string.Format("[SERVERTOOLS] Test 1")); if (_cInfo != null && !string.IsNullOrEmpty(_cInfo.playerId) && _cInfo.entityId > 0) { Log.Out(string.Format("[SERVERTOOLS] Test 2")); EntityPlayer _player = PersistentOperations.GetEntityPlayer(_cInfo.playerId); if (_player != null) { Log.Out(string.Format("[SERVERTOOLS] Test 3")); if (!_player.IsDead()) { if (_player.IsSpawned() && _player.IsAlive()) { if (Zones.IsEnabled) { Zones.ZoneCheck(_cInfo, _player); } if (GodMode.IsEnabled) { GodMode.GodCheck(_cInfo); } } } else { if (BloodmoonWarrior.IsEnabled && BloodmoonWarrior.WarriorList.Contains(_cInfo.entityId)) { BloodmoonWarrior.WarriorList.Remove(_cInfo.entityId); BloodmoonWarrior.KilledZombies.Remove(_cInfo.entityId); } } } } } } } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in PersistentOperations.PlayerCheck: {0}.", e.Message)); } IsRunning = false; }
public static void CheckZone() { try { if (!ZoneRunning) { ZoneRunning = true; List <ClientInfo> clientList = ClientList(); if (clientList != null) { for (int i = 0; i < clientList.Count; i++) { ClientInfo cInfo = clientList[i]; if (cInfo != null && !Teleportation.Teleporting.Contains(cInfo.entityId)) { EntityPlayer player = GetEntityPlayer(cInfo.entityId); if (player != null && !player.IsDead() && player.IsSpawned() && player.position != null) { if (Zones.IsEnabled && Zones.ZoneList.Count > 0) { Zones.ZoneCheck(cInfo, player); } if (Lobby.IsEnabled && Lobby.LobbyPlayers.Contains(cInfo.entityId)) { Lobby.InsideLobby(cInfo, player); } if (Market.IsEnabled && Market.MarketPlayers.Contains(cInfo.entityId)) { Market.InsideMarket(cInfo, player); } } } } } } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in PersistentOperations.CheckZone: {0}", e.Message)); } ZoneRunning = false; }
public static void PlayerCheck() { if (!IsRunning2) { IsRunning2 = true; if (ConnectionManager.Instance.ClientCount() > 0) { List <EntityPlayer> EntityPlayerList = GameManager.Instance.World.Players.list; for (int i = 0; i < EntityPlayerList.Count; i++) { EntityPlayer _player = EntityPlayerList[i]; if (_player != null) { ClientInfo _cInfo = ConnectionManager.Instance.Clients.ForEntityId(_player.entityId); if (_cInfo != null) { if (!_player.IsDead() && _player.Spawned) { if (Zones.IsEnabled) { Zones.ZoneCheck(_cInfo, _player); } if (GodModeFlight.IsEnabled) { GodModeFlight.GodFlightCheck(_cInfo); } } else if (_player.IsDead()) { if (!Died.Contains(_player.entityId)) { Died.Add(_player.entityId); if (KillNotice.IsEnabled || Bounties.IsEnabled || Zones.IsEnabled) { for (int j = 0; j < EntityPlayerList.Count; j++) { EntityPlayer _player2 = EntityPlayerList[j]; if (_player != _player2) { ClientInfo _cInfo2 = ConnectionManager.Instance.Clients.ForEntityId(_player2.entityId); if (_cInfo2 != null) { Entity _target = _player2.GetDamagedTarget(); if (_player == _target) { if (KillNotice.IsEnabled) { string _holdingItem = _player2.inventory.holdingItem.Name; ItemValue _itemValue = ItemClass.GetItem(_holdingItem, true); if (_itemValue.type != ItemValue.None.type) { _holdingItem = _itemValue.ItemClass.GetLocalizedItemName() ?? _itemValue.ItemClass.Name; } KillNotice.Notice(_cInfo, _cInfo2, _holdingItem); } if (Bounties.IsEnabled) { Bounties.PlayerKilled(_player, _player2, _cInfo, _cInfo2); } if (Zones.IsEnabled) { Zones.Check(_cInfo, _cInfo2); } break; } } } } } if (DeathSpot.IsEnabled) { DeathSpot.PlayerKilled(_player); } if (Wallet.IsEnabled && Wallet.Lose_On_Death) { string _sql = string.Format("SELECT playerSpentCoins FROM Players WHERE steamid = '{0}'", _cInfo.playerId); DataTable _result = SQL.TQuery(_sql); int _playerSpentCoins; int.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _playerSpentCoins); _result.Dispose(); int _currentCoins = Wallet.GetcurrentCoins(_cInfo); if (_currentCoins >= 1) { _sql = string.Format("UPDATE Players SET playerSpentCoins = {0} WHERE steamid = '{1}'", _playerSpentCoins - _currentCoins, _cInfo.playerId); SQL.FastQuery(_sql, "Players"); } } if (Event.Open && Event.PlayersTeam.ContainsKey(_cInfo.playerId)) { string _sql = string.Format("UPDATE Players SET eventReturn = 'true' WHERE steamid = '{0}'", _cInfo.playerId); SQL.FastQuery(_sql, "Players"); } } } } } } } IsRunning2 = false; } }