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:942

References FACTION_TEMPLATE_FLAG_ATTACK_PVP_ACTIVE_PLAYERS, and factionFlags.

◆ IsFriendlyTo()

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

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
969 {
970 if (entry.faction)
971 {
972 for (unsigned int i : enemyFaction)
973 if (i == entry.faction)
974 return true;
975 for (unsigned int i : friendFaction)
976 if (i == entry.faction)
977 return false;
978 }
979 return (hostileMask & entry.ourMask) != 0;
980 }
uint32 hostileMask
Definition: DBCStructure.h:945

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

Referenced by Unit::GetFactionReactionTo().

◆ IsHostileToPlayers()

bool FactionTemplateEntry::IsHostileToPlayers ( ) const
inline
981{ 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
983 {
984 for (unsigned int i : enemyFaction)
985 if (i != 0)
986 return false;
987 return hostileMask == 0 && friendlyMask == 0;
988 }

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