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:339
uint32 factionFlags
Definition: DBCStructure.h:933

References FACTION_TEMPLATE_FLAG_ATTACK_PVP_ACTIVE_PLAYERS, and factionFlags.

◆ IsFriendlyTo()

bool FactionTemplateEntry::IsFriendlyTo ( FactionTemplateEntry const &  entry) const
inline
943 {
944 // Xinef: Always friendly to self faction
945 if (faction == entry.faction)
946 return true;
947
948 if (entry.faction)
949 {
950 for (unsigned int i : enemyFaction)
951 if (i == entry.faction)
952 return false;
953 for (unsigned int i : friendFaction)
954 if (i == entry.faction)
955 return true;
956 }
957 return (friendlyMask & entry.ourMask) || (ourMask & entry.friendlyMask);
958 }
uint32 faction
Definition: DBCStructure.h:932
uint32 friendlyMask
Definition: DBCStructure.h:935
uint32 ourMask
Definition: DBCStructure.h:934
uint32 friendFaction[MAX_FACTION_RELATIONS]
Definition: DBCStructure.h:938
uint32 enemyFaction[MAX_FACTION_RELATIONS]
Definition: DBCStructure.h:937

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

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

◆ IsHostileTo()

bool FactionTemplateEntry::IsHostileTo ( FactionTemplateEntry const &  entry) const
inline
960 {
961 if (entry.faction)
962 {
963 for (unsigned int i : enemyFaction)
964 if (i == entry.faction)
965 return true;
966 for (unsigned int i : friendFaction)
967 if (i == entry.faction)
968 return false;
969 }
970 return (hostileMask & entry.ourMask) != 0;
971 }
uint32 hostileMask
Definition: DBCStructure.h:936

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

Referenced by Unit::GetFactionReactionTo().

◆ IsHostileToPlayers()

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

References FACTION_MASK_PLAYER, and hostileMask.

Referenced by Unit::IsHostileToPlayers().

◆ IsNeutralToAll()

bool FactionTemplateEntry::IsNeutralToAll ( ) const
inline
974 {
975 for (unsigned int i : enemyFaction)
976 if (i != 0)
977 return false;
978 return hostileMask == 0 && friendlyMask == 0;
979 }

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

Referenced by IsFriendlyTo(), and IsNeutralToAll().

◆ hostileMask

uint32 FactionTemplateEntry::hostileMask

◆ ID

uint32 FactionTemplateEntry::ID

◆ ourMask