Core/Entities: Add new functions: Unit::GetReactionTo and Unit::GetFactionReactionTo for more direct reaction checks than Unit::IsFriendly/HostileTo (those functions have many duplicated code and have many checks unrelated to unit reaction).
This commit is contained in:
1 parent
af05915b9e
commit
e07535c3e3
6 files changed
+166
-5
No files matched your search
@@ -39,6 +39,29 @@ ReputationRank ReputationMgr::ReputationToRank(int32 standing)
|
||||
return MIN_REPUTATION_RANK;
|
||||
}
|
||||
|
||||
bool ReputationMgr::IsAtWar(uint32 faction_id) const
|
||||
{
|
||||
FactionEntry const* factionEntry = sFactionStore.LookupEntry(faction_id);
|
||||
|
||||
if (!factionEntry)
|
||||
{
|
||||
sLog->outError("ReputationMgr::IsAtWar: Can't get AtWat flag of %s for unknown faction (faction id) #%u.", m_player->GetName(), faction_id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return IsAtWar(factionEntry);
|
||||
}
|
||||
|
||||
bool ReputationMgr::IsAtWar(FactionEntry const* factionEntry) const
|
||||
{
|
||||
if (!factionEntry)
|
||||
return false;
|
||||
|
||||
if (FactionState const* factionState = GetState(factionEntry))
|
||||
return (factionState->Flags & FACTION_FLAG_AT_WAR);
|
||||
return false;
|
||||
}
|
||||
|
||||
int32 ReputationMgr::GetReputation(uint32 faction_id) const
|
||||
{
|
||||
FactionEntry const* factionEntry = sFactionStore.LookupEntry(faction_id);
|
||||
|
||||
Reference in new issue
Block a user