public override void Execute(List <string> _params, CommandSenderInfo _senderInfo) { try { if (_params.Count < 1 && _params.Count > 3) { SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 1 to 3, found {0}", _params.Count)); return; } if (_params[0].ToLower().Equals("off")) { if (_params.Count != 1) { SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 1, found {0}", _params.Count)); return; } Bounties.IsEnabled = false; LoadConfig.WriteXml(); SdtdConsole.Instance.Output(string.Format("Bounties has been set to off")); return; } else if (_params[0].ToLower().Equals("on")) { if (_params.Count != 1) { SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 1, found {0}", _params.Count)); return; } Bounties.IsEnabled = true; LoadConfig.WriteXml(); SdtdConsole.Instance.Output(string.Format("Bounties has been set to on")); return; } else if (_params[0].ToLower().Equals("edit")) { if (_params.Count != 3) { SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 3, found {0}", _params.Count)); return; } int _value; if (!int.TryParse(_params[2], out _value)) { SdtdConsole.Instance.Output(string.Format("Must input a valid interger: {0}", _params[2])); return; } ClientInfo _cInfo = ConsoleHelper.ParseParamIdOrName(_params[1]); if (_cInfo != null) { Bounties.ConsoleEdit(_cInfo.playerId, _value); } else { SdtdConsole.Instance.Output(string.Format("No player found online with id or name: {0}. Checking steam id", _params[1])); if (_params[1].Length != 17) { SdtdConsole.Instance.Output(string.Format("Can not edit: Invalid steam id {0}", _params[1])); return; } Bounties.ConsoleEdit(_params[1], _value); } } else if (_params[0].ToLower().Equals("remove")) { if (_params.Count != 2) { SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 2, found {0}", _params.Count)); return; } ClientInfo _cInfo = ConsoleHelper.ParseParamIdOrName(_params[1]); if (_cInfo != null) { Bounties.ConsoleRemoveBounty(_cInfo.playerId); } else { SdtdConsole.Instance.Output(string.Format("No player found online with id or name: {0}. Checking steam id", _params[1])); if (_params[1].Length != 17) { SdtdConsole.Instance.Output(string.Format("Can not remove: Invalid steam id {0}", _params[1])); return; } Bounties.ConsoleRemoveBounty(_params[1]); } } else if (_params[0].ToLower().Equals("list")) { if (_params.Count != 1) { SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 1, found {0}", _params.Count)); return; } Bounties.ConsoleBountyList(); } else { SdtdConsole.Instance.Output(string.Format("Invalid argument {0}.", _params[0])); } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in BountiesConsole.Run: {0}.", e)); } }
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); }
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); }
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); }
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(); if (TeleportCheck.IsEnabled) { TeleportCheck.DetectionLogsDir(); } if (CountryBan.IsEnabled) { CountryBan.Load(); } if (FlightCheck.IsEnabled) { FlightCheck.DetectionLogsDir(); } if (HatchElevator.IsEnabled) { HatchElevator.DetectionLogsDir(); } if (PlayerLogs.IsEnabled) { PlayerLogs.PlayerLogsDir(); } if (InventoryCheck.IsEnabled) { InventoryCheck.PlayerLogsDir(); } if (Report.IsEnabled) { Report.ReportLogsDir(); } if (PlayerStatCheck.IsEnabled) { PlayerStatCheck.DetectionLogsDir(); } if (UndergroundCheck.IsEnabled) { UndergroundCheck.DetectionLogsDir(); } if (Zones.IsEnabled) { Zones.DetectionLogsDir(); } if (Bank.IsEnabled) { Bank.CreateFolder(); } if (AuctionBox.IsEnabled) { AuctionBox.CreateFolder(); } if (Bounties.IsEnabled) { Bounties.CreateFolder(); } if (CredentialCheck.IsEnabled) { CredentialCheck.CreateFolder(); } if (DupeLog.IsEnabled) { DupeLog.CreateFolder(); } PollConsole.CreateFolder(); string _sql = "SELECT pollOpen FROM Polls WHERE pollOpen = 'true'"; DataTable _result = SQL.TQuery(_sql); if (_result.Rows.Count > 0) { PollConsole.Check(); } _result.Dispose(); if (ClanManager.IsEnabled) { ClanManager.GetClans(); ClanManager.BuildList(); } if (!ClanManager.IsEnabled) { ClanManager.clans.Clear(); ClanManager.ClanMember.Clear(); } if (!InfoTicker.IsEnabled && InfoTicker.IsRunning) { InfoTicker.Unload(); } if (InfoTicker.IsEnabled && !InfoTicker.IsRunning) { InfoTicker.Load(); } if (Gimme.IsRunning && !Gimme.IsEnabled) { Gimme.Unload(); } if (!Gimme.IsRunning && Gimme.IsEnabled) { Gimme.Load(); } if (UndergroundCheck.IsRunning && !UndergroundCheck.IsEnabled) { UndergroundCheck.Unload(); } if (!UndergroundCheck.IsRunning && UndergroundCheck.IsEnabled) { UndergroundCheck.Load(); } if (Badwords.IsRunning && !Badwords.IsEnabled) { Badwords.Unload(); } if (!Badwords.IsRunning && Badwords.IsEnabled) { Badwords.Load(); } if (!LoginNotice.IsRunning && LoginNotice.IsEnabled) { LoginNotice.Load(); } if (LoginNotice.IsRunning && !LoginNotice.IsEnabled) { LoginNotice.Unload(); } if (!Zones.IsRunning && Zones.IsEnabled) { Zones.Load(); } if (Zones.IsRunning && !Zones.IsEnabled) { Zones.Unload(); } if (!VoteReward.IsRunning && VoteReward.IsEnabled) { VoteReward.Load(); } if (VoteReward.IsRunning && !VoteReward.IsEnabled) { VoteReward.Unload(); } if (!Watchlist.IsRunning && Watchlist.IsEnabled) { Watchlist.Load(); } if (Watchlist.IsRunning && !Watchlist.IsEnabled) { Watchlist.Unload(); } if (!ReservedSlots.IsRunning && ReservedSlots.IsEnabled) { ReservedSlots.Load(); } if (ReservedSlots.IsRunning && !ReservedSlots.IsEnabled) { ReservedSlots.Unload(); } if (!StartingItems.IsRunning && StartingItems.IsEnabled) { StartingItems.Load(); } if (StartingItems.IsRunning && !StartingItems.IsEnabled) { StartingItems.Unload(); } if (!Travel.IsRunning && Travel.IsEnabled) { Travel.Load(); } if (Travel.IsRunning && !Travel.IsEnabled) { Travel.Unload(); } if (!Shop.IsRunning && Shop.IsEnabled) { Shop.Load(); } if (Shop.IsRunning && !Shop.IsEnabled) { Shop.Unload(); } if (!Motd.IsRunning && Motd.IsEnabled) { Motd.Load(); } if (Motd.IsRunning && !Motd.IsEnabled) { Motd.Unload(); } if (InventoryCheck.IsRunning && !InventoryCheck.IsEnabled) { InventoryCheck.Unload(); } if (!InventoryCheck.IsRunning && InventoryCheck.IsEnabled) { InventoryCheck.Load(); } if (HighPingKicker.IsEnabled) { HighPingKicker.Load(); } if (CredentialCheck.IsRunning && !CredentialCheck.IsEnabled) { CredentialCheck.Unload(); } if (!CredentialCheck.IsRunning && CredentialCheck.IsEnabled) { CredentialCheck.Load(); } if (CustomCommands.IsRunning && !CustomCommands.IsEnabled) { CustomCommands.Unload(); } if (!CustomCommands.IsRunning && CustomCommands.IsEnabled) { CustomCommands.Load(); } if (DupeLog.IsRunning && !DupeLog.IsEnabled) { DupeLog.Unload(); } if (!DupeLog.IsRunning && DupeLog.IsEnabled) { DupeLog.Load(); } if (ChatColorPrefix.IsRunning && !ChatColorPrefix.IsEnabled) { ChatColorPrefix.Unload(); } if (!ChatColorPrefix.IsRunning && ChatColorPrefix.IsEnabled) { ChatColorPrefix.Load(); } if (MutePlayer.IsEnabled) { MutePlayer.MuteList(); } if (Jail.IsEnabled) { Jail.JailList(); } if (Animals.IsEnabled) { Animals.AnimalList(); } if (AutoShutdown.IsEnabled) { AutoShutdown.ShutdownTime(); } }
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); }