Core/Reputation: fix forced reputation auras with neutral. closes #5790
This commit is contained in:
@@ -12266,19 +12266,21 @@ bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell, Wo
|
||||
if (GetReactionTo(target) == REP_NEUTRAL &&
|
||||
target->GetReactionTo(this) == REP_NEUTRAL)
|
||||
{
|
||||
if (
|
||||
!(target->GetTypeId() == TYPEID_PLAYER && GetTypeId() == TYPEID_PLAYER) &&
|
||||
!(target->GetTypeId() == TYPEID_UNIT && GetTypeId() == TYPEID_UNIT)
|
||||
)
|
||||
if (!(target->GetTypeId() == TYPEID_PLAYER && GetTypeId() == TYPEID_PLAYER) &&
|
||||
!(target->GetTypeId() == TYPEID_UNIT && GetTypeId() == TYPEID_UNIT))
|
||||
{
|
||||
Player const* player = target->GetTypeId() == TYPEID_PLAYER ? target->ToPlayer() : ToPlayer();
|
||||
Unit const* creature = target->GetTypeId() == TYPEID_UNIT ? target : this;
|
||||
|
||||
if (FactionTemplateEntry const* factionTemplate = creature->getFactionTemplateEntry())
|
||||
if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionTemplate->faction))
|
||||
if (FactionState const* repState = player->GetReputationMgr().GetState(factionEntry))
|
||||
if (!(repState->Flags & FACTION_FLAG_AT_WAR))
|
||||
return false;
|
||||
{
|
||||
if (!(player->GetReputationMgr().GetForcedRankIfAny(factionTemplate)))
|
||||
if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionTemplate->faction))
|
||||
if (FactionState const* repState = player->GetReputationMgr().GetState(factionEntry))
|
||||
if (!(repState->Flags & FACTION_FLAG_AT_WAR))
|
||||
return false;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user