AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
FactionTemplateEntry Struct Reference

#include "DBCStructure.h"

Public Member Functions

bool IsFriendlyTo (FactionTemplateEntry const &entry) const
 
bool IsHostileTo (FactionTemplateEntry const &entry) const
 
bool IsHostileToPlayers () const
 
bool IsNeutralToAll () const
 
bool IsContestedGuardFaction () const
 

Public Attributes

uint32 ID
 
uint32 faction
 
uint32 factionFlags
 
uint32 ourMask
 
uint32 friendlyMask
 
uint32 hostileMask
 
uint32 enemyFaction [MAX_FACTION_RELATIONS]
 
uint32 friendFaction [MAX_FACTION_RELATIONS]
 

Detailed Description

Member Function Documentation

◆ IsContestedGuardFaction()

bool FactionTemplateEntry::IsContestedGuardFaction ( ) const
inline
@ FACTION_TEMPLATE_FLAG_ATTACK_PVP_ACTIVE_PLAYERS
Definition: DBCEnums.h:331
uint32 factionFlags
Definition: DBCStructure.h:941

References FACTION_TEMPLATE_FLAG_ATTACK_PVP_ACTIVE_PLAYERS, and factionFlags.

◆ IsFriendlyTo()

bool FactionTemplateEntry::IsFriendlyTo ( FactionTemplateEntry const &  entry) const
inline
951 {
952 // Xinef: Always friendly to self faction
953 if (faction == entry.faction)
954 return true;
955
956 if (entry.faction)
957 {
958 for (unsigned int i : enemyFaction)
959 if (i == entry.faction)
960 return false;
961 for (unsigned int i : friendFaction)
962 if (i == entry.faction)
963 return true;
964 }
965 return (friendlyMask & entry.ourMask) || (ourMask & entry.friendlyMask);
966 }
uint32 faction
Definition: DBCStructure.h:940
uint32 friendlyMask
Definition: DBCStructure.h:943
uint32 ourMask
Definition: DBCStructure.h:942
uint32 friendFaction[MAX_FACTION_RELATIONS]
Definition: DBCStructure.h:946
uint32 enemyFaction[MAX_FACTION_RELATIONS]
Definition: DBCStructure.h:945

References enemyFaction, faction, friendFaction, friendlyMask, and ourMask.

Referenced by Player::CanUseBattlegroundObject(), Spell::EffectGameObjectDamage(), Unit::GetFactionReactionTo(), and Unit::PatchValuesUpdate().

◆ IsHostileTo()

bool FactionTemplateEntry::IsHostileTo ( FactionTemplateEntry const &  entry) const
inline
968 {
969 if (entry.faction)
970 {
971 for (unsigned int i : enemyFaction)
972 if (i == entry.faction)
973 return true;
974 for (unsigned int i : friendFaction)
975 if (i == entry.faction)
976 return false;
977 }
978 return (hostileMask & entry.ourMask) != 0;
979 }
uint32 hostileMask
Definition: DBCStructure.h:944

References enemyFaction, faction, friendFaction, hostileMask, and ourMask.

Referenced by Unit::GetFactionReactionTo().

◆ IsHostileToPlayers()

bool FactionTemplateEntry::IsHostileToPlayers ( ) const
inline
980{ return (hostileMask & FACTION_MASK_PLAYER) != 0; }
@ FACTION_MASK_PLAYER
Definition: DBCEnums.h:337

References FACTION_MASK_PLAYER, and hostileMask.

Referenced by Unit::IsHostileToPlayers().

◆ IsNeutralToAll()

bool FactionTemplateEntry::IsNeutralToAll ( ) const
inline
982 {
983 for (unsigned int i : enemyFaction)
984 if (i != 0)
985 return false;
986 return hostileMask == 0 && friendlyMask == 0;
987 }

References enemyFaction, friendlyMask, and hostileMask.

Referenced by Unit::IsNeutralToAll().

Member Data Documentation

◆ enemyFaction

uint32 FactionTemplateEntry::enemyFaction[MAX_FACTION_RELATIONS]

◆ faction

◆ factionFlags

uint32 FactionTemplateEntry::factionFlags

◆ friendFaction

uint32 FactionTemplateEntry::friendFaction[MAX_FACTION_RELATIONS]

Referenced by IsFriendlyTo(), and IsHostileTo().

◆ friendlyMask

uint32 FactionTemplateEntry::friendlyMask

◆ hostileMask

uint32 FactionTemplateEntry::hostileMask

◆ ID

uint32 FactionTemplateEntry::ID

◆ ourMask