Esempio n. 1
0
 private static bool GameMessage(ClientInfo _cInfo, EnumGameMessages _type, string _msg, string _mainName, bool _localizeMain, string _secondaryName, bool _localizeSecondary)
 {
     try
     {
         if (_cInfo != null && _type == EnumGameMessages.EntityWasKilled)
         {
             EntityPlayer player = PersistentOperations.GetEntityPlayer(_cInfo.entityId);
             if (player != null)
             {
                 if (KillNotice.IsEnabled && (KillNotice.Zombie_Kills || KillNotice.Animal_Kills) && string.IsNullOrEmpty(_secondaryName))
                 {
                     if (KillNotice.Damage.ContainsKey(player.entityId))
                     {
                         KillNotice.Damage.TryGetValue(player.entityId, out int[] damage);
                         EntityZombie zombie = PersistentOperations.GetZombie(damage[0]);
                         if (zombie != null)
                         {
                             KillNotice.ZombieKilledPlayer(zombie, player, _cInfo, damage[1]);
                         }
                         else
                         {
                             EntityAnimal animal = PersistentOperations.GetAnimal(damage[0]);
                             if (animal != null)
                             {
                                 KillNotice.AnimalKilledPlayer(animal, player, _cInfo, damage[1]);
                             }
                         }
                     }
                 }
             }
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in API.GameMessage: {0}", e.Message));
     }
     return(true);
 }
 public static void Load()
 {
     if (!RunTimePatch.Applied)
     {
         RunTimePatch.PatchAll();
     }
     if (!Timers.IsRunning)
     {
         Timers.TimerStart();
     }
     if (!LoadTriggers.IsRunning)
     {
         LoadTriggers.Load();
     }
     if (Poll.IsEnabled && PersistentContainer.Instance.PollOpen)
     {
         Poll.CheckTime();
     }
     if (!ClanManager.IsEnabled)
     {
         ClanManager.Clans.Clear();
         ClanManager.ClanMember.Clear();
     }
     if (!InfoTicker.IsEnabled && InfoTicker.IsRunning)
     {
         InfoTicker.Unload();
     }
     if (InfoTicker.IsEnabled && !InfoTicker.IsRunning)
     {
         InfoTicker.Load();
     }
     if (Gimme.IsRunning && !Gimme.IsEnabled)
     {
         Gimme.Unload();
     }
     if (!Gimme.IsRunning && Gimme.IsEnabled)
     {
         Gimme.Load();
     }
     if (Badwords.IsRunning && !Badwords.IsEnabled)
     {
         Badwords.Unload();
     }
     if (!Badwords.IsRunning && Badwords.IsEnabled)
     {
         Badwords.Load();
     }
     if (!LoginNotice.IsRunning && LoginNotice.IsEnabled)
     {
         LoginNotice.Load();
     }
     if (LoginNotice.IsRunning && !LoginNotice.IsEnabled)
     {
         LoginNotice.Unload();
     }
     if (!Zones.IsRunning && Zones.IsEnabled)
     {
         Zones.Load();
     }
     if (Zones.IsRunning && !Zones.IsEnabled)
     {
         Zones.Unload();
     }
     if (!VoteReward.IsRunning && VoteReward.IsEnabled)
     {
         VoteReward.Load();
     }
     if (VoteReward.IsRunning && !VoteReward.IsEnabled)
     {
         VoteReward.Unload();
     }
     if (!Watchlist.IsRunning && Watchlist.IsEnabled)
     {
         Watchlist.Load();
     }
     if (Watchlist.IsRunning && !Watchlist.IsEnabled)
     {
         Watchlist.Unload();
     }
     if (!ReservedSlots.IsRunning && ReservedSlots.IsEnabled)
     {
         ReservedSlots.Load();
     }
     if (ReservedSlots.IsRunning && !ReservedSlots.IsEnabled)
     {
         ReservedSlots.Unload();
     }
     if (!StartingItems.IsRunning && StartingItems.IsEnabled)
     {
         StartingItems.Load();
     }
     if (StartingItems.IsRunning && !StartingItems.IsEnabled)
     {
         StartingItems.Unload();
     }
     if (!Travel.IsRunning && Travel.IsEnabled)
     {
         Travel.Load();
     }
     if (Travel.IsRunning && !Travel.IsEnabled)
     {
         Travel.Unload();
     }
     if (!Shop.IsRunning && Shop.IsEnabled)
     {
         Shop.Load();
     }
     if (Shop.IsRunning && !Shop.IsEnabled)
     {
         Shop.Unload();
     }
     if (!Motd.IsRunning && Motd.IsEnabled)
     {
         Motd.Load();
     }
     if (Motd.IsRunning && !Motd.IsEnabled)
     {
         Motd.Unload();
     }
     if (InvalidItems.IsRunning && !InvalidItems.IsEnabled)
     {
         InvalidItems.Unload();
     }
     if (!InvalidItems.IsRunning && InvalidItems.IsEnabled)
     {
         InvalidItems.Load();
     }
     if (HighPingKicker.IsRunning && !HighPingKicker.IsEnabled)
     {
         HighPingKicker.Unload();
     }
     if (!HighPingKicker.IsRunning && HighPingKicker.IsEnabled)
     {
         HighPingKicker.Load();
     }
     if (CredentialCheck.IsRunning && !CredentialCheck.IsEnabled)
     {
         CredentialCheck.Unload();
     }
     if (!CredentialCheck.IsRunning && CredentialCheck.IsEnabled)
     {
         CredentialCheck.Load();
     }
     if (CustomCommands.IsRunning && !CustomCommands.IsEnabled)
     {
         CustomCommands.Unload();
     }
     if (!CustomCommands.IsRunning && CustomCommands.IsEnabled)
     {
         CustomCommands.Load();
     }
     if (DupeLog.IsRunning && !DupeLog.IsEnabled)
     {
         DupeLog.Unload();
     }
     if (!DupeLog.IsRunning && DupeLog.IsEnabled)
     {
         DupeLog.Load();
     }
     if (ChatColorPrefix.IsRunning && !ChatColorPrefix.IsEnabled)
     {
         ChatColorPrefix.Unload();
     }
     if (!ChatColorPrefix.IsRunning && ChatColorPrefix.IsEnabled)
     {
         ChatColorPrefix.Load();
     }
     if (KillNotice.IsRunning && !KillNotice.IsEnabled)
     {
         KillNotice.Unload();
     }
     if (!KillNotice.IsRunning && KillNotice.IsEnabled)
     {
         KillNotice.Load();
     }
     if (Prayer.IsRunning && !Prayer.IsEnabled)
     {
         Prayer.Unload();
     }
     if (!Prayer.IsRunning && Prayer.IsEnabled)
     {
         Prayer.Load();
     }
     if (BloodmoonWarrior.IsRunning && !BloodmoonWarrior.IsEnabled)
     {
         BloodmoonWarrior.Unload();
     }
     if (!BloodmoonWarrior.IsRunning && BloodmoonWarrior.IsEnabled)
     {
         BloodmoonWarrior.Load();
     }
     if (ProtectedSpaces.IsRunning && !ProtectedSpaces.IsEnabled)
     {
         ProtectedSpaces.Unload();
     }
     if (!ProtectedSpaces.IsRunning && ProtectedSpaces.IsEnabled)
     {
         ProtectedSpaces.Load();
     }
     if (ClanManager.IsEnabled)
     {
         ClanManager.ClanList();
     }
     if (Auction.IsEnabled)
     {
         Auction.AuctionList();
     }
     if (Mute.IsEnabled)
     {
         Mute.ClientMuteList();
         Mute.MuteList();
     }
     if (Jail.IsEnabled)
     {
         Jail.JailList();
     }
     //always load the website last
     if (WebsiteServer.IsEnabled && !WebsiteServer.DirFound)
     {
         WebsiteServer.CheckDir();
     }
     if (WebsiteServer.IsRunning && !WebsiteServer.IsEnabled)
     {
         WebsiteServer.Unload();
     }
     if (!WebsiteServer.IsRunning && WebsiteServer.IsEnabled && WebsiteServer.DirFound)
     {
         WebsiteServer.Load();
     }
 }
Esempio n. 3
0
 private static bool GameMessage(ClientInfo _cInfo, EnumGameMessages _type, string _msg, string _mainName, bool _localizeMain, string _secondaryName, bool _localizeSecondary)
 {
     try
     {
         if (_type == EnumGameMessages.EntityWasKilled && _cInfo != null)
         {
             EntityPlayer _player1 = GameManager.Instance.World.Players.dict[_cInfo.entityId];
             if (_player1 != null)
             {
                 bool _notice = false;
                 if (!string.IsNullOrEmpty(_secondaryName) && _mainName != _secondaryName)
                 {
                     ClientInfo _cInfo2 = ConsoleHelper.ParseParamIdOrName(_secondaryName);
                     if (_cInfo2 != null)
                     {
                         EntityPlayer _player2 = GameManager.Instance.World.Players.dict[_cInfo2.entityId];
                         if (_player2 != null)
                         {
                             if (KillNotice.IsEnabled && _player2.IsAlive())
                             {
                                 string _holdingItem = _player2.inventory.holdingItem.Name;
                                 if (!string.IsNullOrEmpty(_holdingItem))
                                 {
                                     ItemValue _itemValue = ItemClass.GetItem(_holdingItem, true);
                                     if (_itemValue.type != ItemValue.None.type)
                                     {
                                         _holdingItem = _itemValue.ItemClass.GetLocalizedItemName() ?? _itemValue.ItemClass.GetItemName();
                                         KillNotice.Notice(_cInfo, _cInfo2, _holdingItem);
                                         _notice = true;
                                     }
                                 }
                             }
                             if (Zones.IsEnabled)
                             {
                                 Zones.Check(_cInfo, _cInfo2);
                             }
                             if (Bounties.IsEnabled)
                             {
                                 Bounties.PlayerKilled(_player1, _player2, _cInfo, _cInfo2);
                             }
                             if (Wallet.IsEnabled)
                             {
                                 if (Wallet.PVP && Wallet.Player_Kills > 0)
                                 {
                                     Wallet.AddCoinsToWallet(_cInfo2.playerId, Wallet.Player_Kills);
                                 }
                                 else if (Wallet.Player_Kills > 0)
                                 {
                                     Wallet.SubtractCoinsFromWallet(_cInfo2.playerId, Wallet.Player_Kills);
                                 }
                             }
                         }
                     }
                 }
                 if (DeathSpot.IsEnabled)
                 {
                     DeathSpot.PlayerKilled(_player1);
                 }
                 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");
                 }
                 if (_notice)
                 {
                     return(false);
                 }
             }
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in API.GameMessage: {0}.", e.Message));
     }
     return(true);
 }
Esempio n. 4
0
 private static bool GameMessage(ClientInfo _cInfo, EnumGameMessages _type, string _msg, string _mainName, bool _localizeMain, string _secondaryName, bool _localizeSecondary)
 {
     try
     {
         if (_type == EnumGameMessages.EntityWasKilled && _cInfo != null && GameManager.Instance.World.Players.dict.ContainsKey(_cInfo.entityId))
         {
             EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId];
             if (_player != null)
             {
                 if (DeathSpot.IsEnabled)
                 {
                     DeathSpot.PlayerKilled(_player);
                 }
                 if (!string.IsNullOrEmpty(_secondaryName) && !string.IsNullOrEmpty(_mainName) && _mainName != _secondaryName)
                 {
                     ClientInfo _cInfo2 = ConsoleHelper.ParseParamIdOrName(_secondaryName);
                     if (_cInfo2 != null && GameManager.Instance.World.Players.dict.ContainsKey(_cInfo2.entityId))
                     {
                         EntityPlayer _player2 = GameManager.Instance.World.Players.dict[_cInfo2.entityId];
                         if (_player2 != null)
                         {
                             if (Bounties.IsEnabled)
                             {
                                 Bounties.PlayerKilled(_player, _player2, _cInfo, _cInfo2);
                             }
                             if (Wallet.IsEnabled)
                             {
                                 if (Wallet.PVP && Wallet.Player_Kills > 0)
                                 {
                                     Wallet.AddCoinsToWallet(_cInfo2.playerId, Wallet.Player_Kills);
                                 }
                                 else if (Wallet.Player_Kills > 0)
                                 {
                                     Wallet.SubtractCoinsFromWallet(_cInfo2.playerId, Wallet.Player_Kills);
                                 }
                             }
                             if (KillNotice.IsEnabled && _player2.IsAlive())
                             {
                                 string _holdingItem = _player2.inventory.holdingItem.Name;
                                 if (!string.IsNullOrEmpty(_holdingItem))
                                 {
                                     ItemValue _itemValue = ItemClass.GetItem(_holdingItem, true);
                                     if (_itemValue.type != ItemValue.None.type)
                                     {
                                         _holdingItem = _itemValue.ItemClass.GetItemName();
                                         KillNotice.Exec(_cInfo, _player, _cInfo2, _player2, _holdingItem);
                                         return(false);
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in API.GameMessage: {0}", e.Message));
     }
     return(true);
 }
Esempio n. 5
0
 private static bool GameMessage(ClientInfo _cInfo, EnumGameMessages _type, string _msg, string _mainName, bool _localizeMain, string _secondaryName, bool _localizeSecondary)
 {
     try
     {
         if (_type == EnumGameMessages.EntityWasKilled && _cInfo != null && GameManager.Instance.World.Players.dict.ContainsKey(_cInfo.entityId))
         {
             EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId];
             if (_player != null)
             {
                 if (PlayerChecks.FlyEnabled && PlayerChecks.Movement.ContainsKey(_cInfo.entityId))
                 {
                     PlayerChecks.Movement.Remove(_cInfo.entityId);
                 }
                 if (Died.IsEnabled)
                 {
                     Died.PlayerKilled(_player);
                 }
                 if (KillNotice.IsEnabled)
                 {
                     if (KillNotice.Zombie_Kills && string.IsNullOrEmpty(_secondaryName))
                     {
                         List <Entity> Entities = GameManager.Instance.World.Entities.list;
                         for (int i = 0; i < Entities.Count; i++)
                         {
                             EntityAlive _entityAlive = Entities[i] as EntityAlive;
                             if (_entityAlive != null && _entityAlive.GetAttackTarget() == _player && _entityAlive.entityId != _player.entityId)
                             {
                                 if (KillNotice.Show_Level)
                                 {
                                     Phrases.Dict.TryGetValue(545, out string _phrase545);
                                     _phrase545 = _phrase545.Replace("{PlayerName}", _cInfo.playerName);
                                     _phrase545 = _phrase545.Replace("{Level}", _player.Progression.Level.ToString());
                                     _phrase545 = _phrase545.Replace("{ZombieName}", _entityAlive.EntityName);
                                     ChatHook.ChatMessage(null, Config.Chat_Response_Color + _phrase545 + "[-]", -1, Config.Server_Response_Name, EChatType.Global, null);
                                 }
                                 else
                                 {
                                     Phrases.Dict.TryGetValue(546, out string _phrase546);
                                     _phrase546 = _phrase546.Replace("{PlayerName}", _cInfo.playerName);
                                     _phrase546 = _phrase546.Replace("{ZombieName}", _entityAlive.EntityName);
                                     ChatHook.ChatMessage(null, Config.Chat_Response_Color + _phrase546 + "[-]", -1, Config.Server_Response_Name, EChatType.Global, null);
                                 }
                             }
                         }
                     }
                     else if (KillNotice.PvP && !string.IsNullOrEmpty(_secondaryName) && _mainName != _secondaryName)
                     {
                         ClientInfo _cInfo2 = ConsoleHelper.ParseParamIdOrName(_secondaryName);
                         if (_cInfo2 != null && GameManager.Instance.World.Players.dict.ContainsKey(_cInfo2.entityId))
                         {
                             EntityPlayer _player2 = GameManager.Instance.World.Players.dict[_cInfo2.entityId];
                             if (_player2 != null)
                             {
                                 if (KillNotice.IsEnabled && _player2.IsAlive())
                                 {
                                     string _holdingItem = _player2.inventory.holdingItem.GetItemName();
                                     if (!string.IsNullOrEmpty(_holdingItem))
                                     {
                                         ItemValue _itemValue = ItemClass.GetItem(_holdingItem, true);
                                         if (_itemValue.type != ItemValue.None.type)
                                         {
                                             KillNotice.Exec(_cInfo, _player, _cInfo2, _player2, _holdingItem);
                                             return(false);
                                         }
                                     }
                                 }
                                 if (Wallet.IsEnabled)
                                 {
                                     if (Wallet.PVP && Wallet.Player_Kills > 0)
                                     {
                                         Wallet.AddCoinsToWallet(_cInfo2.playerId, Wallet.Player_Kills);
                                     }
                                     else if (Wallet.Player_Kills > 0)
                                     {
                                         Wallet.SubtractCoinsFromWallet(_cInfo2.playerId, Wallet.Player_Kills);
                                     }
                                 }
                                 if (Bounties.IsEnabled)
                                 {
                                     Bounties.PlayerKilled(_player, _player2, _cInfo, _cInfo2);
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in API.GameMessage: {0}", e.Message));
     }
     return(true);
 }
Esempio n. 6
0
 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;
     }
 }
        public static void Load()
        {
            Timers.TimerStart();
            Timers.Timer2Start();
            string    _sql    = "SELECT pollOpen FROM Polls WHERE pollOpen = 'true'";
            DataTable _result = SQL.TypeQuery(_sql);

            if (_result.Rows.Count > 0)
            {
                PollConsole.Check();
            }
            _result.Dispose();
            if (!ClanManager.IsEnabled)
            {
                ClanManager.Clans.Clear();
                ClanManager.ClanMember.Clear();
            }
            if (!InfoTicker.IsEnabled && InfoTicker.IsRunning)
            {
                InfoTicker.Unload();
            }
            if (InfoTicker.IsEnabled && !InfoTicker.IsRunning)
            {
                InfoTicker.Load();
            }
            if (Gimme.IsRunning && !Gimme.IsEnabled)
            {
                Gimme.Unload();
            }
            if (!Gimme.IsRunning && Gimme.IsEnabled)
            {
                Gimme.Load();
            }
            if (Badwords.IsRunning && !Badwords.IsEnabled)
            {
                Badwords.Unload();
            }
            if (!Badwords.IsRunning && Badwords.IsEnabled)
            {
                Badwords.Load();
            }
            if (!LoginNotice.IsRunning && LoginNotice.IsEnabled)
            {
                LoginNotice.Load();
            }
            if (LoginNotice.IsRunning && !LoginNotice.IsEnabled)
            {
                LoginNotice.Unload();
            }
            if (!Zones.IsRunning && Zones.IsEnabled)
            {
                Zones.Load();
            }
            if (Zones.IsRunning && !Zones.IsEnabled)
            {
                Zones.Unload();
            }
            if (!VoteReward.IsRunning && VoteReward.IsEnabled)
            {
                VoteReward.Load();
            }
            if (VoteReward.IsRunning && !VoteReward.IsEnabled)
            {
                VoteReward.Unload();
            }
            if (!Watchlist.IsRunning && Watchlist.IsEnabled)
            {
                Watchlist.Load();
            }
            if (Watchlist.IsRunning && !Watchlist.IsEnabled)
            {
                Watchlist.Unload();
            }
            if (!ReservedSlots.IsRunning && ReservedSlots.IsEnabled)
            {
                ReservedSlots.Load();
            }
            if (ReservedSlots.IsRunning && !ReservedSlots.IsEnabled)
            {
                ReservedSlots.Unload();
            }
            if (!StartingItems.IsRunning && StartingItems.IsEnabled)
            {
                StartingItems.Load();
            }
            if (StartingItems.IsRunning && !StartingItems.IsEnabled)
            {
                StartingItems.Unload();
            }
            if (!Travel.IsRunning && Travel.IsEnabled)
            {
                Travel.Load();
            }
            if (Travel.IsRunning && !Travel.IsEnabled)
            {
                Travel.Unload();
            }
            if (!Shop.IsRunning && Shop.IsEnabled)
            {
                Shop.Load();
            }
            if (Shop.IsRunning && !Shop.IsEnabled)
            {
                Shop.Unload();
            }
            if (!Motd.IsRunning && Motd.IsEnabled)
            {
                Motd.Load();
            }
            if (Motd.IsRunning && !Motd.IsEnabled)
            {
                Motd.Unload();
            }
            if (InventoryCheck.IsRunning && !InventoryCheck.IsEnabled)
            {
                InventoryCheck.Unload();
            }
            if (!InventoryCheck.IsRunning && InventoryCheck.IsEnabled)
            {
                InventoryCheck.Load();
            }
            if (HighPingKicker.IsEnabled)
            {
                HighPingKicker.Load();
            }
            if (CredentialCheck.IsRunning && !CredentialCheck.IsEnabled)
            {
                CredentialCheck.Unload();
            }
            if (!CredentialCheck.IsRunning && CredentialCheck.IsEnabled)
            {
                CredentialCheck.Load();
            }
            if (CustomCommands.IsRunning && !CustomCommands.IsEnabled)
            {
                CustomCommands.Unload();
            }
            if (!CustomCommands.IsRunning && CustomCommands.IsEnabled)
            {
                CustomCommands.Load();
            }
            if (DupeLog.IsRunning && !DupeLog.IsEnabled)
            {
                DupeLog.Unload();
            }
            if (!DupeLog.IsRunning && DupeLog.IsEnabled)
            {
                DupeLog.Load();
            }
            if (ChatColorPrefix.IsRunning && !ChatColorPrefix.IsEnabled)
            {
                ChatColorPrefix.Unload();
            }
            if (!ChatColorPrefix.IsRunning && ChatColorPrefix.IsEnabled)
            {
                ChatColorPrefix.Load();
            }
            if (KillNotice.IsRunning && !KillNotice.IsEnabled)
            {
                KillNotice.Unload();
            }
            if (!KillNotice.IsRunning && KillNotice.IsEnabled)
            {
                KillNotice.Load();
            }
            if (!Prayer.IsRunning && Prayer.IsEnabled)
            {
                Prayer.Load();
            }
            if (Prayer.IsRunning && !Prayer.IsEnabled)
            {
                Prayer.Unload();
            }
            if (LoadTriggers.IsRunning)
            {
                LoadTriggers.Unload();
            }
            if (!LoadTriggers.IsRunning)
            {
                LoadTriggers.Load();
            }
            if (ProtectedSpace.IsRunning)
            {
                ProtectedSpace.Unload();
            }
            if (!ProtectedSpace.IsRunning)
            {
                ProtectedSpace.Load();
            }
            if (ClanManager.IsEnabled)
            {
                ClanManager.ClanList();
            }
            if (AuctionBox.IsEnabled)
            {
                AuctionBox.AuctionList();
            }
            if (Mute.IsEnabled)
            {
                Mute.MuteList();
            }
            if (Jail.IsEnabled)
            {
                Jail.JailList();
            }
            if (BattleLogger.IsEnabled && !BattleLogger.LogFound && !string.IsNullOrEmpty(Utils.GetApplicationScratchPath()))
            {
                if (!GamePrefs.GetString(EnumGamePrefs.ServerDisabledNetworkProtocols).ToLower().Contains("litenetlib"))
                {
                    BattleLogger.LogDirectory = Utils.GetApplicationScratchPath();
                    BattleLogger.ConfirmLog();
                }
                else
                {
                    Log.Out("--------------------------------------------------------------------------");
                    Log.Out("[SERVERTOOLS] Unable to verify log file. Battle_Loggers has been disabled.");
                    Log.Out("[SERVERTOOLS] Network protocol litenetlib is required for this tool.");
                    Log.Out("--------------------------------------------------------------------");
                }
            }
            PatchTools.ApplyPatches();
        }
Esempio n. 8
0
        public static void Load()
        {
            Confirm.Exec();
            PatchTools.ApplyPatches();
            if (!LoadTriggers.IsRunning)
            {
                LoadTriggers.Load();
            }
            Timers.TimerStart();
            string    _sql    = "SELECT pollOpen FROM Polls WHERE pollOpen = 'true'";
            DataTable _result = SQL.TypeQuery(_sql);

            if (_result.Rows.Count > 0)
            {
                PollConsole.Check();
            }
            _result.Dispose();
            if (!ClanManager.IsEnabled)
            {
                ClanManager.Clans.Clear();
                ClanManager.ClanMember.Clear();
            }
            if (!InfoTicker.IsEnabled && InfoTicker.IsRunning)
            {
                InfoTicker.Unload();
            }
            if (InfoTicker.IsEnabled && !InfoTicker.IsRunning)
            {
                InfoTicker.Load();
            }
            if (Gimme.IsRunning && !Gimme.IsEnabled)
            {
                Gimme.Unload();
            }
            if (!Gimme.IsRunning && Gimme.IsEnabled)
            {
                Gimme.Load();
            }
            if (Badwords.IsRunning && !Badwords.IsEnabled)
            {
                Badwords.Unload();
            }
            if (!Badwords.IsRunning && Badwords.IsEnabled)
            {
                Badwords.Load();
            }
            if (!LoginNotice.IsRunning && LoginNotice.IsEnabled)
            {
                LoginNotice.Load();
            }
            if (LoginNotice.IsRunning && !LoginNotice.IsEnabled)
            {
                LoginNotice.Unload();
            }
            if (!Zones.IsRunning && Zones.IsEnabled)
            {
                Zones.Load();
            }
            if (Zones.IsRunning && !Zones.IsEnabled)
            {
                Zones.Unload();
            }
            if (!VoteReward.IsRunning && VoteReward.IsEnabled)
            {
                VoteReward.Load();
            }
            if (VoteReward.IsRunning && !VoteReward.IsEnabled)
            {
                VoteReward.Unload();
            }
            if (!Watchlist.IsRunning && Watchlist.IsEnabled)
            {
                Watchlist.Load();
            }
            if (Watchlist.IsRunning && !Watchlist.IsEnabled)
            {
                Watchlist.Unload();
            }
            if (!ReservedSlots.IsRunning && ReservedSlots.IsEnabled)
            {
                ReservedSlots.Load();
            }
            if (ReservedSlots.IsRunning && !ReservedSlots.IsEnabled)
            {
                ReservedSlots.Unload();
            }
            if (!StartingItems.IsRunning && StartingItems.IsEnabled)
            {
                StartingItems.Load();
            }
            if (StartingItems.IsRunning && !StartingItems.IsEnabled)
            {
                StartingItems.Unload();
            }
            if (!Travel.IsRunning && Travel.IsEnabled)
            {
                Travel.Load();
            }
            if (Travel.IsRunning && !Travel.IsEnabled)
            {
                Travel.Unload();
            }
            if (!Shop.IsRunning && Shop.IsEnabled)
            {
                Shop.Load();
            }
            if (Shop.IsRunning && !Shop.IsEnabled)
            {
                Shop.Unload();
            }
            if (!Motd.IsRunning && Motd.IsEnabled)
            {
                Motd.Load();
            }
            if (Motd.IsRunning && !Motd.IsEnabled)
            {
                Motd.Unload();
            }
            if (InvalidItems.IsRunning && !InvalidItems.IsEnabled)
            {
                InvalidItems.Unload();
            }
            if (!InvalidItems.IsRunning && InvalidItems.IsEnabled)
            {
                InvalidItems.Load();
            }
            if (HighPingKicker.IsRunning && !HighPingKicker.IsEnabled)
            {
                HighPingKicker.Unload();
            }
            if (!HighPingKicker.IsRunning && HighPingKicker.IsEnabled)
            {
                HighPingKicker.Load();
            }
            if (CredentialCheck.IsRunning && !CredentialCheck.IsEnabled)
            {
                CredentialCheck.Unload();
            }
            if (!CredentialCheck.IsRunning && CredentialCheck.IsEnabled)
            {
                CredentialCheck.Load();
            }
            if (CustomCommands.IsRunning && !CustomCommands.IsEnabled)
            {
                CustomCommands.Unload();
            }
            if (!CustomCommands.IsRunning && CustomCommands.IsEnabled)
            {
                CustomCommands.Load();
            }
            if (DupeLog.IsRunning && !DupeLog.IsEnabled)
            {
                DupeLog.Unload();
            }
            if (!DupeLog.IsRunning && DupeLog.IsEnabled)
            {
                DupeLog.Load();
            }
            if (ChatColorPrefix.IsRunning && !ChatColorPrefix.IsEnabled)
            {
                ChatColorPrefix.Unload();
            }
            if (!ChatColorPrefix.IsRunning && ChatColorPrefix.IsEnabled)
            {
                ChatColorPrefix.Load();
            }
            if (KillNotice.IsRunning && !KillNotice.IsEnabled)
            {
                KillNotice.Unload();
            }
            if (!KillNotice.IsRunning && KillNotice.IsEnabled)
            {
                KillNotice.Load();
            }
            if (Prayer.IsRunning && !Prayer.IsEnabled)
            {
                Prayer.Unload();
            }
            if (!Prayer.IsRunning && Prayer.IsEnabled)
            {
                Prayer.Load();
            }
            if (BloodmoonWarrior.IsRunning && !BloodmoonWarrior.IsEnabled)
            {
                BloodmoonWarrior.Unload();
            }
            if (!BloodmoonWarrior.IsRunning && BloodmoonWarrior.IsEnabled)
            {
                BloodmoonWarrior.Load();
            }
            if (ProtectedSpaces.IsRunning && !ProtectedSpaces.IsEnabled)
            {
                ProtectedSpaces.Unload();
            }
            if (!ProtectedSpaces.IsRunning && ProtectedSpaces.IsEnabled)
            {
                ProtectedSpaces.Load();
            }
            if (ClanManager.IsEnabled)
            {
                ClanManager.ClanList();
            }
            if (AuctionBox.IsEnabled)
            {
                AuctionBox.AuctionList();
            }
            if (Mute.IsEnabled)
            {
                Mute.ClientMuteList();
                Mute.MuteList();
            }
            if (Jail.IsEnabled)
            {
                Jail.JailList();
            }
            //always load the website last
            if (WebsiteServer.IsEnabled && !WebsiteServer.DirFound)
            {
                WebsiteServer.CheckDir();
            }
            if (WebsiteServer.IsRunning && !WebsiteServer.IsEnabled)
            {
                WebsiteServer.Unload();
            }
            if (!WebsiteServer.IsRunning && WebsiteServer.IsEnabled && WebsiteServer.DirFound)
            {
                WebsiteServer.Load();
            }
        }
Esempio n. 9
0
        public static void Exec()
        {
            DP = false;
            List <EntityPlayer> _playerList = GameManager.Instance.World.Players.list;

            for (int i = 0; i < _playerList.Count; i++)
            {
                EntityPlayer _player = _playerList[i];
                if (_player != null)
                {
                    ClientInfo _cInfo = ConnectionManager.Instance.Clients.ForEntityId(_player.entityId);
                    if (_cInfo != null)
                    {
                        if (_player.IsDead())
                        {
                            DP = true;
                            if (!Dead.Contains(_player.entityId))
                            {
                                Dead.Add(_player.entityId);
                                if (Event.Open && Event.PlayersTeam.ContainsKey(_cInfo.playerId))
                                {
                                    string _sql = string.Format("UPDATE Players SET eventRespawn = 'true' WHERE steamid = '{0}'", _cInfo.playerId);
                                    SQL.FastQuery(_sql);
                                }
                                if (!DeathTime.ContainsKey(_player.entityId))
                                {
                                    Vector3 _position  = _player.GetPosition();
                                    int     x          = (int)_position.x;
                                    int     y          = (int)_position.y;
                                    int     z          = (int)_position.z;
                                    string  _dposition = x + "," + y + "," + z;
                                    DeathTime.Add(_player.entityId, DateTime.Now);
                                    LastDeathPos.Add(_player.entityId, _dposition);
                                }
                                else
                                {
                                    Vector3 _position  = _player.GetPosition();
                                    int     x          = (int)_position.x;
                                    int     y          = (int)_position.y;
                                    int     z          = (int)_position.z;
                                    string  _dposition = x + "," + y + "," + z;
                                    DeathTime[_player.entityId]    = DateTime.Now;
                                    LastDeathPos[_player.entityId] = _dposition;
                                }
                                for (int j = 0; j < _playerList.Count; j++)
                                {
                                    EntityPlayer _player2 = _playerList[j];
                                    Entity       _target  = _player2.GetDamagedTarget();
                                    if (_target == _player && _player != _player2)
                                    {
                                        _player2.ClearDamagedTarget();
                                        ClientInfo _cInfo2 = ConnectionManager.Instance.Clients.ForEntityId(_player2.entityId);
                                        if (_cInfo != null && _cInfo2 != null)
                                        {
                                            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)
                                            {
                                                if (!_player.IsFriendsWith(_player2) && !_player2.IsFriendsWith(_player))
                                                {
                                                    if (ClanManager.IsEnabled)
                                                    {
                                                        if (ClanManager.ClanMember.Contains(_cInfo.playerId) && ClanManager.ClanMember.Contains(_cInfo2.playerId))
                                                        {
                                                            string    _sql1     = string.Format("SELECT clanname FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
                                                            DataTable _result1  = SQL.TQuery(_sql1);
                                                            string    _clanName = _result1.Rows[0].ItemArray.GetValue(0).ToString();
                                                            _result1.Dispose();
                                                            _sql1 = string.Format("SELECT clanname FROM Players WHERE steamid = '{0}'", _cInfo2.playerId);
                                                            DataTable _result2   = SQL.TQuery(_sql1);
                                                            string    _clanName2 = _result2.Rows[0].ItemArray.GetValue(0).ToString();
                                                            _result2.Dispose();
                                                            Player p2 = PersistentContainer.Instance.Players[_cInfo2.playerId, false];
                                                            if (_clanName != "Unknown" && _clanName2 != "Unknown")
                                                            {
                                                                if (_clanName == _clanName2)
                                                                {
                                                                    return;
                                                                }
                                                            }
                                                        }
                                                    }
                                                    string    _sql    = string.Format("SELECT bounty, bountyHunter FROM Players WHERE steamid = '{0}'", _cInfo.playerId);
                                                    DataTable _result = SQL.TQuery(_sql);
                                                    int       _bounty;
                                                    int       _hunterCountVictim;
                                                    int.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _bounty);
                                                    int.TryParse(_result.Rows[0].ItemArray.GetValue(1).ToString(), out _hunterCountVictim);
                                                    _result.Dispose();
                                                    if (_bounty > 0)
                                                    {
                                                        _sql = string.Format("SELECT playerSpentCoins, bountyHunter FROM Players WHERE steamid = '{0}'", _cInfo2.playerId);
                                                        DataTable _result2 = SQL.TQuery(_sql);
                                                        int       _playerSpentCoins;
                                                        int       _hunterCountKiller;
                                                        int.TryParse(_result2.Rows[0].ItemArray.GetValue(0).ToString(), out _playerSpentCoins);
                                                        int.TryParse(_result2.Rows[0].ItemArray.GetValue(1).ToString(), out _hunterCountKiller);
                                                        _result2.Dispose();
                                                        if (Bounties.Bonus > 0 && _hunterCountVictim >= Bounties.Bonus)
                                                        {
                                                            _sql = string.Format("UPDATE Players SET playerSpentCoins = {0}, bountyHunter = {1} WHERE steamid = '{2}'", _playerSpentCoins + _bounty + Bounties.Bonus, _hunterCountKiller + 1, _cInfo2.playerId);
                                                            SQL.FastQuery(_sql);
                                                        }
                                                        else
                                                        {
                                                            _sql = string.Format("UPDATE Players SET playerSpentCoins = {0}, bountyHunter = {1} WHERE steamid = '{2}'", _playerSpentCoins + _bounty, _hunterCountKiller + 1, _cInfo2.playerId);
                                                            SQL.FastQuery(_sql);
                                                        }
                                                        _sql = string.Format("UPDATE Players SET bounty = 0, bountyHunter = 0 WHERE steamid = '{0}'", _cInfo.playerId);
                                                        SQL.FastQuery(_sql);
                                                        string _phrase912;
                                                        if (!Phrases.Dict.TryGetValue(912, out _phrase912))
                                                        {
                                                            _phrase912 = "{PlayerName} is a bounty hunter! {Victim} was snuffed out.";
                                                        }
                                                        _phrase912 = _phrase912.Replace("{PlayerName}", _cInfo2.playerName);
                                                        _phrase912 = _phrase912.Replace("{Victim}", _cInfo.playerName);
                                                        ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase912, -1, LoadConfig.Server_Response_Name, EChatType.Global, null);
                                                        using (StreamWriter sw = new StreamWriter(filepath, true))
                                                        {
                                                            sw.WriteLine(string.Format("{0}: {1} is a bounty hunter! {2} was snuffed out. Bounty was worth {3}", DateTime.Now, _cInfo2.playerName, _cInfo.playerName, _bounty));
                                                            sw.WriteLine();
                                                            sw.Flush();
                                                            sw.Close();
                                                        }
                                                    }
                                                    if (Bounties.Kill_Streak > 0)
                                                    {
                                                        if (KillStreak.ContainsKey(_cInfo.entityId))
                                                        {
                                                            KillStreak.Remove(_cInfo.entityId);
                                                            using (StreamWriter sw = new StreamWriter(filepath, true))
                                                            {
                                                                sw.WriteLine(string.Format("{0}: Player {1} kill streak has come to an end by {2}.", DateTime.Now, _cInfo.playerName, _cInfo2.playerName));
                                                                sw.WriteLine();
                                                                sw.Flush();
                                                                sw.Close();
                                                            }
                                                        }
                                                        if (KillStreak.ContainsKey(_cInfo2.entityId))
                                                        {
                                                            int _value;
                                                            if (KillStreak.TryGetValue(_cInfo2.entityId, out _value))
                                                            {
                                                                int _newValue = _value + 1;
                                                                KillStreak[_cInfo2.entityId] = _newValue;
                                                                if (_newValue == Bounties.Kill_Streak)
                                                                {
                                                                    string _phrase913;
                                                                    if (!Phrases.Dict.TryGetValue(913, out _phrase913))
                                                                    {
                                                                        _phrase913 = "{PlayerName} is on a kill streak! Their bounty has increased.";
                                                                    }
                                                                    _phrase913 = _phrase913.Replace("{PlayerName}", _cInfo2.playerName);
                                                                    ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase913, -1, LoadConfig.Server_Response_Name, EChatType.Global, null);
                                                                }
                                                                if (_newValue >= Bounties.Kill_Streak)
                                                                {
                                                                    _sql = string.Format("SELECT bounty FROM Players WHERE steamid = '{0}'", _cInfo2.playerId);
                                                                    DataTable _result3 = SQL.TQuery(_sql);
                                                                    int       _oldBounty;
                                                                    int.TryParse(_result3.Rows[0].ItemArray.GetValue(0).ToString(), out _oldBounty);
                                                                    _result3.Dispose();
                                                                    _sql = string.Format("UPDATE Players SET bounty = {0} WHERE steamid = '{1}'", _oldBounty + Bounties.Bonus, _cInfo.playerId);
                                                                    SQL.FastQuery(_sql);
                                                                    using (StreamWriter sw = new StreamWriter(filepath, true))
                                                                    {
                                                                        sw.WriteLine(string.Format("{0}: {1} is on a kill streak of {2}. Their bounty has increased.", DateTime.Now, _cInfo2.playerName, _newValue));
                                                                        sw.WriteLine();
                                                                        sw.Flush();
                                                                        sw.Close();
                                                                    }
                                                                }
                                                            }
                                                        }
                                                        else
                                                        {
                                                            KillStreak.Add(_cInfo2.entityId, 1);
                                                        }
                                                    }
                                                }
                                            }
                                            if (Zones.IsEnabled)
                                            {
                                                Zones.Check(_cInfo2, _cInfo);
                                            }
                                        }
                                    }
                                }
                                if (Wallet.IsEnabled && Wallet.Lose_On_Death)
                                {
                                    World     world   = GameManager.Instance.World;
                                    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);
                                    }
                                }
                                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);
                                }
                            }
                        }
                        else
                        {
                            if (Zones.IsEnabled)
                            {
                                ZoneCheck(_cInfo, _player);
                            }
                        }
                    }
                }
            }
            if (!DP)
            {
                _counter++;
                if (_counter >= 6)
                {
                    _counter = 0;
                    for (int i = 0; i < _playerList.Count; i++)
                    {
                        EntityPlayer _player = _playerList[i];
                        if (_player != null)
                        {
                            _player.ClearDamagedTarget();
                        }
                    }
                }
            }
            else
            {
                _counter = 0;
            }
        }
Esempio n. 10
0
 public static bool Exec(NetPackageDamageEntity __instance)
 {
     try
     {
         Entity victim = PersistentOperations.GetEntity(entityId(__instance));
         if (victim != null)
         {
             Entity attacker = PersistentOperations.GetEntity(attackerEntityId(__instance));
             if (attacker != null)
             {
                 if (victim is EntityPlayer)
                 {
                     ClientInfo cInfoVictim = PersistentOperations.GetClientInfoFromEntityId(victim.entityId);
                     if (cInfoVictim != null)
                     {
                         EntityPlayer victimPlayer = victim as EntityPlayer;
                         if (attacker is EntityPlayer)
                         {
                             ClientInfo cInfoAttacker = PersistentOperations.GetClientInfoFromEntityId(attacker.entityId);
                             if (cInfoAttacker != null)
                             {
                                 EntityPlayer attackingPlayer = attacker as EntityPlayer;
                                 if (attackingItem(__instance) != null)
                                 {
                                     if (DamageDetector.IsEnabled && !DamageDetector.IsValidPvP(victim as EntityPlayer, cInfoAttacker, strength(__instance), attackingItem(__instance)))
                                     {
                                         return(true);
                                     }
                                     if (InfiniteAmmo.IsEnabled && attackingItem(__instance).ItemClass.IsGun())
                                     {
                                         int slot = attackingPlayer.inventory.holdingItemIdx;
                                         if (InfiniteAmmo.Exec(cInfoAttacker, attackingPlayer, slot, attackingItem(__instance)))
                                         {
                                             return(true);
                                         }
                                     }
                                 }
                                 else
                                 {
                                     return(true);
                                 }
                                 if (NewPlayerProtection.IsEnabled)
                                 {
                                     if (NewPlayerProtection.IsProtected(victimPlayer))
                                     {
                                         Phrases.Dict.TryGetValue("NewPlayerProtection2", out string phrase);
                                         ChatHook.ChatMessage(cInfoAttacker, Config.Chat_Response_Color + phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                                         return(true);
                                     }
                                     else if (NewPlayerProtection.IsProtected(attackingPlayer))
                                     {
                                         Phrases.Dict.TryGetValue("NewPlayerProtection1", out string phrase);
                                         ChatHook.ChatMessage(cInfoVictim, Config.Chat_Response_Color + phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                                         return(true);
                                     }
                                 }
                                 //if (Zones.IsEnabled && !Zones.IsValid(cInfoVictim, cInfoAttacker))
                                 //{
                                 //    return true;
                                 //}
                                 if (Lobby.IsEnabled && Lobby.PvE && (Lobby.LobbyPlayers.Contains(victimPlayer.entityId) || Lobby.LobbyPlayers.Contains(attackingPlayer.entityId)))
                                 {
                                     Lobby.PvEViolation(cInfoAttacker);
                                     return(true);
                                 }
                                 if (Market.IsEnabled && Market.PvE && (Market.MarketPlayers.Contains(victimPlayer.entityId) || Market.MarketPlayers.Contains(attackingPlayer.entityId)))
                                 {
                                     Market.PvEViolation(cInfoAttacker);
                                     return(true);
                                 }
                                 float distance = attackingPlayer.GetDistance(victimPlayer);
                                 using (StreamWriter sw = new StreamWriter(Filepath, true, Encoding.UTF8))
                                 {
                                     sw.WriteLine(string.Format("{0}: '{1}' '{2}' named '{3}' @ '{4}' hit '{5}' '{6}' named '{7}' @ '{8}' using '{9}' for '{10}' damage. Distance '{11}'", DateTime.Now, cInfoAttacker.PlatformId.CombinedString, cInfoAttacker.CrossplatformId.CombinedString, cInfoAttacker.playerName, cInfoAttacker.latestPlayerData.ecd.pos, cInfoVictim.PlatformId.CombinedString, cInfoVictim.CrossplatformId.CombinedString, cInfoVictim.playerName, cInfoVictim.latestPlayerData.ecd.pos, attackingItem(__instance).ItemClass.GetLocalizedItemName() ?? attackingItem(__instance).ItemClass.GetItemName(), strength(__instance), distance));
                                     sw.WriteLine();
                                     sw.Flush();
                                     sw.Close();
                                 }
                                 if (bFatal(__instance) && victimPlayer.IsAlive() && lastEntityKilled != victimPlayer.entityId)
                                 {
                                     lastEntityKilled = victimPlayer.entityId;
                                     if (KillNotice.IsEnabled && KillNotice.PvP)
                                     {
                                         KillNotice.PlayerKilledPlayer(cInfoVictim, victimPlayer, cInfoAttacker, attackingPlayer, attackingItem(__instance), strength(__instance));
                                     }
                                     if (Bounties.IsEnabled)
                                     {
                                         Bounties.PlayerKilled(victimPlayer, attackingPlayer, cInfoVictim, cInfoAttacker);
                                     }
                                     if (Wallet.IsEnabled && Wallet.PVP && Wallet.Player_Kill > 0)
                                     {
                                         Wallet.AddCurrency(cInfoAttacker.CrossplatformId.CombinedString, Wallet.Player_Kill);
                                     }
                                     if (MagicBullet.IsEnabled && !MagicBullet.Kill.Contains(cInfoAttacker.entityId))
                                     {
                                         MagicBullet.Kill.Add(cInfoAttacker.entityId);
                                     }
                                 }
                             }
                         }
                         else if (attacker is EntityZombie)
                         {
                             if (NewPlayerProtection.IsEnabled && NewPlayerProtection.IsProtected(victimPlayer))
                             {
                                 return(true);
                             }
                             if (KillNotice.IsEnabled && KillNotice.Zombie_Kills)
                             {
                                 int[] attack = new int[] { attacker.entityId, strength(__instance) };
                                 if (KillNotice.Damage.ContainsKey(victim.entityId))
                                 {
                                     KillNotice.Damage[victim.entityId] = attack;
                                 }
                                 else
                                 {
                                     KillNotice.Damage.Add(victim.entityId, attack);
                                 }
                             }
                         }
                         else if (attacker is EntityAnimal)
                         {
                             if (NewPlayerProtection.IsEnabled && NewPlayerProtection.IsProtected(victimPlayer))
                             {
                                 return(true);
                             }
                             if (KillNotice.IsEnabled && KillNotice.Animal_Kills)
                             {
                                 int[] attack = new int[] { attacker.entityId, strength(__instance) };
                                 if (KillNotice.Damage.ContainsKey(victim.entityId))
                                 {
                                     KillNotice.Damage[victim.entityId] = attack;
                                 }
                                 else
                                 {
                                     KillNotice.Damage.Add(victim.entityId, attack);
                                 }
                             }
                         }
                     }
                 }
                 else if (victim is EntityZombie && attacker is EntityPlayer)
                 {
                     ClientInfo cInfoAttacker = PersistentOperations.GetClientInfoFromEntityId(attacker.entityId);
                     if (cInfoAttacker != null)
                     {
                         EntityPlayer attackingPlayer = attacker as EntityPlayer;
                         if (attackingItem(__instance) != null)
                         {
                             if (DamageDetector.IsEnabled && !DamageDetector.IsValidEntityDamage(attackingPlayer, cInfoAttacker, strength(__instance), attackingItem(__instance)))
                             {
                                 return(true);
                             }
                             if (InfiniteAmmo.IsEnabled && attackingItem(__instance).ItemClass.IsGun())
                             {
                                 int slot = attackingPlayer.inventory.holdingItemIdx;
                                 if (InfiniteAmmo.Exec(cInfoAttacker, attackingPlayer, slot, attackingItem(__instance)))
                                 {
                                     return(true);
                                 }
                             }
                             if (bFatal(__instance) && victim.IsAlive() && lastEntityKilled != victim.entityId)
                             {
                                 lastEntityKilled = victim.entityId;
                                 if (Wallet.IsEnabled && Wallet.Zombie_Kill > 0)
                                 {
                                     Wallet.AddCurrency(cInfoAttacker.CrossplatformId.CombinedString, Wallet.Zombie_Kill);
                                 }
                                 if (BloodmoonWarrior.IsEnabled && BloodmoonWarrior.BloodmoonStarted && BloodmoonWarrior.WarriorList.Contains(cInfoAttacker.entityId))
                                 {
                                     if (BloodmoonWarrior.KilledZombies.TryGetValue(cInfoAttacker.entityId, out int killedZ))
                                     {
                                         BloodmoonWarrior.KilledZombies[cInfoAttacker.entityId] += 1;
                                     }
                                     else
                                     {
                                         BloodmoonWarrior.KilledZombies.Add(cInfoAttacker.entityId, 1);
                                     }
                                 }
                             }
                         }
                         else
                         {
                             return(true);
                         }
                         if (PersistentOperations.IsBloodmoon() && Market.IsEnabled && Market.MarketPlayers.Contains(cInfoAttacker.entityId))
                         {
                             Phrases.Dict.TryGetValue("Market12", out string phrase);
                             ChatHook.ChatMessage(cInfoAttacker, Config.Chat_Response_Color + phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                             return(true);
                         }
                         if (PersistentOperations.IsBloodmoon() && Lobby.IsEnabled && Lobby.LobbyPlayers.Contains(cInfoAttacker.entityId))
                         {
                             Phrases.Dict.TryGetValue("Lobby12", out string phrase);
                             ChatHook.ChatMessage(cInfoAttacker, Config.Chat_Response_Color + phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                             return(true);
                         }
                         int distance = (int)attackingPlayer.GetDistance(victim);
                         using (StreamWriter sw = new StreamWriter(Filepath, true, Encoding.UTF8))
                         {
                             sw.WriteLine(string.Format("{0}: '{1}' '{2}' named '{3}' @ '{4}' hit '{5}' named '{6}' @ '{7}' using '{8}' for '{9}' damage. Distance '{10}'", DateTime.Now, cInfoAttacker.PlatformId.CombinedString, cInfoAttacker.CrossplatformId.CombinedString, cInfoAttacker.playerName, cInfoAttacker.latestPlayerData.ecd.pos, victim.entityId, victim.EntityClass.entityClassName, victim.position, attackingItem(__instance).ItemClass.GetLocalizedItemName() ?? attackingItem(__instance).ItemClass.GetItemName(), strength(__instance), distance));
                             sw.WriteLine();
                             sw.Flush();
                             sw.Close();
                         }
                     }
                 }
                 else if (victim is EntityAnimal && attacker is EntityPlayer)
                 {
                     ClientInfo cInfoAttacker = PersistentOperations.GetClientInfoFromEntityId(attacker.entityId);
                     if (cInfoAttacker != null)
                     {
                         EntityPlayer attackingPlayer = attacker as EntityPlayer;
                         if (attackingItem(__instance) != null)
                         {
                             if (DamageDetector.IsEnabled && !DamageDetector.IsValidEntityDamage(attackingPlayer, cInfoAttacker, strength(__instance), attackingItem(__instance)))
                             {
                                 return(true);
                             }
                             if (InfiniteAmmo.IsEnabled && attackingItem(__instance).ItemClass.IsGun())
                             {
                                 int slot = attackingPlayer.inventory.holdingItemIdx;
                                 if (InfiniteAmmo.Exec(cInfoAttacker, attackingPlayer, slot, attackingItem(__instance)))
                                 {
                                     return(true);
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in ProcessDamage.Exec: {0}", e.Message));
     }
     return(false);
 }