Core/Unit: make neutral guards attack players involved in PvP

Fix https://github.com/TrinityCore/TrinityCore/issues/17635
This commit is contained in:
Léo Gautheron
2017-12-17 15:29:30 +01:00
committed by Aokromes
parent 4283252731
commit bdf2d697fa

View File

@@ -8430,6 +8430,9 @@ bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell, Wo
Player const* player = playerAffectingAttacker ? playerAffectingAttacker : playerAffectingTarget;
Unit const* creature = playerAffectingAttacker ? target : this;
if (creature->IsContestedGuard() && player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_CONTESTED_PVP))
return true;
if (FactionTemplateEntry const* factionTemplate = creature->GetFactionTemplateEntry())
{
if (!(player->GetReputationMgr().GetForcedRankIfAny(factionTemplate)))