mirror of
https://github.com/mangosfour/server.git
synced 2025-12-16 22:37:02 +00:00
[11890] Fix Player::GetNPCIfCanInteractWith to consider forced reactions
This will fix ie quest 9410 A Spirit Guide Signed-off-by: Schmoozerd <schmoozerd@scriptdev2.com>
This commit is contained in:
parent
0fe4f21b6a
commit
3e552fc739
8 changed files with 35 additions and 45 deletions
|
|
@ -5443,18 +5443,14 @@ bool Unit::IsHostileTo(Unit const* unit) const
|
|||
}
|
||||
}
|
||||
// CvP forced reaction and reputation case
|
||||
else if(target->GetTypeId()==TYPEID_PLAYER)
|
||||
else if (target->GetTypeId()==TYPEID_PLAYER)
|
||||
{
|
||||
// forced reaction
|
||||
if(tester_faction->faction)
|
||||
if (tester_faction->faction)
|
||||
{
|
||||
if(ReputationRank const* force = ((Player*)target)->GetReputationMgr().GetForcedRankIfAny(tester_faction))
|
||||
return *force <= REP_HOSTILE;
|
||||
|
||||
// apply reputation state
|
||||
FactionEntry const* raw_tester_faction = sFactionStore.LookupEntry(tester_faction->faction);
|
||||
if(raw_tester_faction && raw_tester_faction->reputationListID >=0 )
|
||||
return ((Player const*)target)->GetReputationMgr().GetRank(raw_tester_faction) <= REP_HOSTILE;
|
||||
if (raw_tester_faction && raw_tester_faction->reputationListID >=0 )
|
||||
return ((Player const*)target)->GetReputationMgr().GetRank(raw_tester_faction, true) <= REP_HOSTILE;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -5555,18 +5551,14 @@ bool Unit::IsFriendlyTo(Unit const* unit) const
|
|||
}
|
||||
}
|
||||
// CvP forced reaction and reputation case
|
||||
else if(target->GetTypeId()==TYPEID_PLAYER)
|
||||
else if (target->GetTypeId()==TYPEID_PLAYER)
|
||||
{
|
||||
// forced reaction
|
||||
if(tester_faction->faction)
|
||||
if (tester_faction->faction)
|
||||
{
|
||||
if(ReputationRank const* force =((Player*)target)->GetReputationMgr().GetForcedRankIfAny(tester_faction))
|
||||
return *force >= REP_FRIENDLY;
|
||||
|
||||
// apply reputation state
|
||||
if(FactionEntry const* raw_tester_faction = sFactionStore.LookupEntry(tester_faction->faction))
|
||||
if(raw_tester_faction->reputationListID >=0 )
|
||||
return ((Player const*)target)->GetReputationMgr().GetRank(raw_tester_faction) >= REP_FRIENDLY;
|
||||
if (FactionEntry const* raw_tester_faction = sFactionStore.LookupEntry(tester_faction->faction))
|
||||
if (raw_tester_faction->reputationListID >=0 )
|
||||
return ((Player const*)target)->GetReputationMgr().GetRank(raw_tester_faction, true) >= REP_FRIENDLY;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue