mirror of
https://github.com/mangosfour/server.git
synced 2025-12-18 19:37:01 +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
|
|
@ -1749,18 +1749,14 @@ bool GameObject::IsHostileTo(Unit const* unit) const
|
|||
return false;
|
||||
|
||||
// GvP forced reaction and reputation case
|
||||
if(unit->GetTypeId()==TYPEID_PLAYER)
|
||||
if (unit->GetTypeId()==TYPEID_PLAYER)
|
||||
{
|
||||
// forced reaction
|
||||
if(tester_faction->faction)
|
||||
if (tester_faction->faction)
|
||||
{
|
||||
if(ReputationRank const* force = ((Player*)unit)->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*)unit)->GetReputationMgr().GetRank(raw_tester_faction) <= REP_HOSTILE;
|
||||
if (raw_tester_faction && raw_tester_faction->reputationListID >=0 )
|
||||
return ((Player const*)unit)->GetReputationMgr().GetRank(raw_tester_faction, true) <= REP_HOSTILE;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1792,18 +1788,14 @@ bool GameObject::IsFriendlyTo(Unit const* unit) const
|
|||
return false;
|
||||
|
||||
// GvP forced reaction and reputation case
|
||||
if(unit->GetTypeId()==TYPEID_PLAYER)
|
||||
if (unit->GetTypeId()==TYPEID_PLAYER)
|
||||
{
|
||||
// forced reaction
|
||||
if(tester_faction->faction)
|
||||
if (tester_faction->faction)
|
||||
{
|
||||
if(ReputationRank const* force =((Player*)unit)->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*)unit)->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*)unit)->GetReputationMgr().GetRank(raw_tester_faction, true) >= REP_FRIENDLY;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue