Ejemplo n.º 1
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);
 }
Ejemplo n.º 2
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);
 }