public static void PlayerDied(EntityAlive __instance) { ClientInfo cInfo = PersistentOperations.GetClientInfoFromEntityId(__instance.entityId); if (cInfo != null) { string id = cInfo.CrossplatformId.CombinedString; if (__instance.AttachedToEntity != null) { __instance.Detach(); } if (Died.IsEnabled) { Died.PlayerKilled(__instance); } if (ProcessDamage.lastEntityKilled == cInfo.entityId) { ProcessDamage.lastEntityKilled = 0; } if (Bloodmoon.IsEnabled && Bloodmoon.Show_On_Respawn) { Bloodmoon.Exec(cInfo); } if (Event.Open && Event.Teams.ContainsKey(id)) { Event.Respawn(cInfo); } if (PersistentContainer.Instance.Players[id].EventOver) { Event.EventOver(cInfo); } if (Hardcore.IsEnabled && PersistentContainer.Instance.Players[id].HardcoreEnabled) { Hardcore.Check(cInfo, (EntityPlayer)__instance); } if (Zones.ZonePlayer.ContainsKey(cInfo.entityId)) { Zones.ZonePlayer.Remove(cInfo.entityId); } if (PlayerChecks.TwoSecondMovement.ContainsKey(cInfo.entityId)) { PlayerChecks.TwoSecondMovement.Remove(cInfo.entityId); } if (FlyingDetector.Flags.ContainsKey(cInfo.entityId)) { FlyingDetector.Flags.Remove(cInfo.entityId); } if (SpeedDetector.Flags.ContainsKey(cInfo.entityId)) { SpeedDetector.Flags.Remove(cInfo.entityId); } } }
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); }