TrinityCore
Loading...
Searching...
No Matches
ConditionMgr Class Reference

#include <ConditionMgr.h>

Classes

struct  ConditionTypeInfo
 

Public Member Functions

void LoadConditions (bool isReload=false)
 
bool isConditionTypeValid (Condition *cond) const
 
uint32 GetSearcherTypeMaskForConditionList (ConditionContainer const &conditions) const
 
bool IsObjectMeetToConditions (WorldObject *object, ConditionContainer const &conditions) const
 
bool IsObjectMeetToConditions (WorldObject *object1, WorldObject *object2, ConditionContainer const &conditions) const
 
bool IsObjectMeetToConditions (ConditionSourceInfo &sourceInfo, ConditionContainer const &conditions) const
 
bool IsObjectMeetingNotGroupedConditions (ConditionSourceType sourceType, uint32 entry, ConditionSourceInfo &sourceInfo) const
 
bool IsObjectMeetingNotGroupedConditions (ConditionSourceType sourceType, uint32 entry, WorldObject *target0, WorldObject *target1=nullptr, WorldObject *target2=nullptr) const
 
bool HasConditionsForNotGroupedEntry (ConditionSourceType sourceType, uint32 entry) const
 
bool IsObjectMeetingSpellClickConditions (uint32 creatureId, uint32 spellId, WorldObject *clicker, WorldObject *target) const
 
ConditionContainer const * GetConditionsForSpellClickEvent (uint32 creatureId, uint32 spellId) const
 
bool IsObjectMeetingVehicleSpellConditions (uint32 creatureId, uint32 spellId, Player *player, Unit *vehicle) const
 
bool IsObjectMeetingSmartEventConditions (int32 entryOrGuid, uint32 eventId, uint32 sourceType, Unit *unit, WorldObject *baseObject) const
 
bool IsObjectMeetingVendorItemConditions (uint32 creatureId, uint32 itemId, Player *player, Creature *vendor) const
 
bool IsSpellUsedInSpellClickConditions (uint32 spellId) const
 

Static Public Member Functions

static ConditionMgr * instance ()
 
static bool CanHaveSourceGroupSet (ConditionSourceType sourceType)
 
static bool CanHaveSourceIdSet (ConditionSourceType sourceType)
 

Static Public Attributes

static char const *const StaticSourceTypeData [CONDITION_SOURCE_TYPE_MAX]
 
static ConditionTypeInfo const StaticConditionTypeData [CONDITION_MAX]
 

Private Member Functions

 ConditionMgr ()
 
 ~ConditionMgr ()
 
bool isSourceTypeValid (Condition *cond) const
 
bool addToLootTemplate (Condition *cond, LootTemplate *loot) const
 
bool addToGossipMenus (Condition *cond) const
 
bool addToGossipMenuItems (Condition *cond) const
 
bool addToSpellImplicitTargetConditions (Condition *cond) const
 
bool IsObjectMeetToConditionList (ConditionSourceInfo &sourceInfo, ConditionContainer const &conditions) const
 
void Clean ()
 

Static Private Member Functions

static void LogUselessConditionValue (Condition const *cond, uint8 index, uint32 value)
 
static void LogUselessConditionValue (Condition const *cond, uint8 index, std::string_view value)
 

Private Attributes

std::vector< Condition * > AllocatedMemoryStore
 
ConditionEntriesByTypeArray ConditionStore
 
ConditionReferenceContainer ConditionReferenceStore
 
ConditionEntriesByCreatureIdMap VehicleSpellConditionStore
 
ConditionEntriesByCreatureIdMap SpellClickEventConditionStore
 
ConditionEntriesByCreatureIdMap NpcVendorConditionContainerStore
 
SmartEventConditionContainer SmartEventConditionStore
 
std::unordered_set< uint32 > SpellsUsedInSpellClickConditions
 

Detailed Description

Definition at line 267 of file ConditionMgr.h.

Constructor & Destructor Documentation

◆ ConditionMgr()

ConditionMgr::ConditionMgr ( )
private

Definition at line 839 of file ConditionMgr.cpp.

◆ ~ConditionMgr()

ConditionMgr::~ConditionMgr ( )
private

Definition at line 841 of file ConditionMgr.cpp.

References Clean().

Member Function Documentation

◆ addToGossipMenuItems()

bool ConditionMgr::addToGossipMenuItems ( Condition *  cond) const
private

◆ addToGossipMenus()

bool ConditionMgr::addToGossipMenus ( Condition *  cond) const
private

◆ addToLootTemplate()

bool ConditionMgr::addToLootTemplate ( Condition *  cond,
LootTemplate *  loot 
) const
private

◆ addToSpellImplicitTargetConditions()

◆ CanHaveSourceGroupSet()

◆ CanHaveSourceIdSet()

bool ConditionMgr::CanHaveSourceIdSet ( ConditionSourceType  sourceType)
static

Definition at line 976 of file ConditionMgr.cpp.

References CONDITION_SOURCE_TYPE_SMART_EVENT.

Referenced by LoadConditions(), and Condition::ToString().

◆ Clean()

◆ GetConditionsForSpellClickEvent()

ConditionContainer const * ConditionMgr::GetConditionsForSpellClickEvent ( uint32  creatureId,
uint32  spellId 
) const

Definition at line 1027 of file ConditionMgr.cpp.

References SpellClickEventConditionStore, and TC_LOG_DEBUG.

◆ GetSearcherTypeMaskForConditionList()

uint32 ConditionMgr::GetSearcherTypeMaskForConditionList ( ConditionContainer const &  conditions) const

◆ HasConditionsForNotGroupedEntry()

bool ConditionMgr::HasConditionsForNotGroupedEntry ( ConditionSourceType  sourceType,
uint32  entry 
) const

◆ instance()

ConditionMgr * ConditionMgr::instance ( )
static

Definition at line 1095 of file ConditionMgr.cpp.

References instance().

Referenced by instance().

◆ isConditionTypeValid()

bool ConditionMgr::isConditionTypeValid ( Condition *  cond) const

Definition at line 1920 of file ConditionMgr.cpp.

References ALLIANCE, CLASSMASK_ALL_PLAYABLE, COMP_TYPE_MAX, CONDITION_ACHIEVEMENT, CONDITION_ACTIVE_EVENT, CONDITION_ALIVE, CONDITION_AREAID, CONDITION_AURA, CONDITION_BATTLE_PET_COUNT, CONDITION_CHARMED, CONDITION_CLASS, CONDITION_CREATURE_TYPE, CONDITION_DAILY_QUEST_DONE, CONDITION_DIFFICULTY_ID, CONDITION_DISTANCE_TO, CONDITION_DRUNKENSTATE, CONDITION_GAMEMASTER, CONDITION_GENDER, CONDITION_GROUP_STATUS, CONDITION_HP_PCT, CONDITION_HP_VAL, CONDITION_IN_WATER, CONDITION_INSTANCE_INFO, CONDITION_ITEM, CONDITION_ITEM_EQUIPPED, CONDITION_LABEL, CONDITION_LEVEL, CONDITION_MAPID, CONDITION_MAX, CONDITION_NEAR_CREATURE, CONDITION_NEAR_GAMEOBJECT, CONDITION_NONE, CONDITION_OBJECT_ENTRY_GUID, CONDITION_PET_TYPE, CONDITION_PHASEMASK, CONDITION_PLAYER_CONDITION, CONDITION_PRIVATE_OBJECT, CONDITION_QUEST_COMPLETE, CONDITION_QUEST_NONE, CONDITION_QUEST_OBJECTIVE_PROGRESS, CONDITION_QUESTREWARDED, CONDITION_QUESTSTATE, CONDITION_QUESTTAKEN, CONDITION_RACE, CONDITION_REACTION_TO, CONDITION_REALM_ACHIEVEMENT, CONDITION_RELATION_TO, CONDITION_REPUTATION_RANK, CONDITION_SCENARIO_STEP, CONDITION_SCENE_IN_PROGRESS, CONDITION_SKILL, CONDITION_SPAWNMASK, CONDITION_SPELL, CONDITION_STAND_STATE, CONDITION_STRING_ID, CONDITION_TAXI, CONDITION_TEAM, CONDITION_TERRAIN_SWAP, CONDITION_TITLE, CONDITION_TYPE_MASK, CONDITION_UNIT_STATE, CONDITION_WORLD_STATE, CONDITION_ZONEID, Condition::ConditionStringValue1, Condition::ConditionTarget, Condition::ConditionType, Condition::ConditionValue1, Condition::ConditionValue2, Condition::ConditionValue3, CREATURE_TYPE_GAS_CLOUD, creatureData, DRUNKEN_SMASHED, EFFECT_2, Condition::GetMaxAvailableConditionTargets(), ConditionMgr::ConditionTypeInfo::HasConditionStringValue1, ConditionMgr::ConditionTypeInfo::HasConditionValue1, ConditionMgr::ConditionTypeInfo::HasConditionValue2, ConditionMgr::ConditionTypeInfo::HasConditionValue3, HORDE, Player::IsValidGender(), LogUselessConditionValue(), MAX_DIFFICULTY, MAX_PET_TYPE, MAX_QUEST_STATUS, NotInGroupOrNotInRaid, AreaTableEntry::ParentAreaID, RACEMASK_ALL_PLAYABLE, RELATION_MAX, Quest::RequiredNpcOrGo, Quest::RequiredNpcOrGoCount, sAchievementStore, sAreaTableStore, sCharTitlesStore, sFactionStore, sGameEventMgr, sMapStore, sObjectMgr, SPAWNMASK_RAID_ALL, sSkillLineStore, sSpellMgr, StaticConditionTypeData, sWorld, TC_LOG_ERROR, Condition::ToString(), TYPEID_CORPSE, TYPEID_GAMEOBJECT, TYPEID_PLAYER, TYPEID_UNIT, TYPEMASK_CORPSE, TYPEMASK_GAMEOBJECT, TYPEMASK_PLAYER, TYPEMASK_UNIT, UNIT_STAND_STATE_SUBMERGED, and UNIT_STATE_ALL_STATE_SUPPORTED.

Referenced by LoadConditions().

◆ IsObjectMeetingNotGroupedConditions() [1/2]

bool ConditionMgr::IsObjectMeetingNotGroupedConditions ( ConditionSourceType  sourceType,
uint32  entry,
ConditionSourceInfo &  sourceInfo 
) const

◆ IsObjectMeetingNotGroupedConditions() [2/2]

bool ConditionMgr::IsObjectMeetingNotGroupedConditions ( ConditionSourceType  sourceType,
uint32  entry,
WorldObject *  target0,
WorldObject *  target1 = nullptr,
WorldObject *  target2 = nullptr 
) const

Definition at line 996 of file ConditionMgr.cpp.

References IsObjectMeetingNotGroupedConditions().

◆ IsObjectMeetingSmartEventConditions()

bool ConditionMgr::IsObjectMeetingSmartEventConditions ( int32  entryOrGuid,
uint32  eventId,
uint32  sourceType,
Unit *  unit,
WorldObject *  baseObject 
) const

◆ IsObjectMeetingSpellClickConditions()

bool ConditionMgr::IsObjectMeetingSpellClickConditions ( uint32  creatureId,
uint32  spellId,
WorldObject *  clicker,
WorldObject *  target 
) const

◆ IsObjectMeetingVehicleSpellConditions()

bool ConditionMgr::IsObjectMeetingVehicleSpellConditions ( uint32  creatureId,
uint32  spellId,
Player *  player,
Unit *  vehicle 
) const

◆ IsObjectMeetingVendorItemConditions()

bool ConditionMgr::IsObjectMeetingVendorItemConditions ( uint32  creatureId,
uint32  itemId,
Player *  player,
Creature *  vendor 
) const

◆ IsObjectMeetToConditionList()

bool ConditionMgr::IsObjectMeetToConditionList ( ConditionSourceInfo &  sourceInfo,
ConditionContainer const &  conditions 
) const
private

Find ElseGroup in ElseGroupStore

If not found, add an entry in the store and set to true (placeholder)

If another condition in this group was unmatched before this, don't bother checking (the group is false anyway)

Definition at line 886 of file ConditionMgr.cpp.

References ConditionReferenceStore, IsObjectMeetToConditionList(), and TC_LOG_DEBUG.

Referenced by IsObjectMeetToConditionList(), and IsObjectMeetToConditions().

◆ IsObjectMeetToConditions() [1/3]

bool ConditionMgr::IsObjectMeetToConditions ( ConditionSourceInfo &  sourceInfo,
ConditionContainer const &  conditions 
) const

Definition at line 944 of file ConditionMgr.cpp.

References IsObjectMeetToConditionList(), and TC_LOG_DEBUG.

◆ IsObjectMeetToConditions() [2/3]

◆ IsObjectMeetToConditions() [3/3]

bool ConditionMgr::IsObjectMeetToConditions ( WorldObject *  object1,
WorldObject *  object2,
ConditionContainer const &  conditions 
) const

Definition at line 938 of file ConditionMgr.cpp.

References IsObjectMeetToConditions().

◆ isSourceTypeValid()

bool ConditionMgr::isSourceTypeValid ( Condition *  cond) const
private

Definition at line 1524 of file ConditionMgr.cpp.

References CONDITION_SOURCE_TYPE_AREATRIGGER, CONDITION_SOURCE_TYPE_AREATRIGGER_CLIENT_TRIGGERED, CONDITION_SOURCE_TYPE_CONVERSATION_LINE, CONDITION_SOURCE_TYPE_CREATURE_LOOT_TEMPLATE, CONDITION_SOURCE_TYPE_CREATURE_TEMPLATE_VEHICLE, CONDITION_SOURCE_TYPE_DISENCHANT_LOOT_TEMPLATE, CONDITION_SOURCE_TYPE_FISHING_LOOT_TEMPLATE, CONDITION_SOURCE_TYPE_GAMEOBJECT_LOOT_TEMPLATE, CONDITION_SOURCE_TYPE_GOSSIP_MENU, CONDITION_SOURCE_TYPE_GOSSIP_MENU_OPTION, CONDITION_SOURCE_TYPE_GRAVEYARD, CONDITION_SOURCE_TYPE_ITEM_LOOT_TEMPLATE, CONDITION_SOURCE_TYPE_MAIL_LOOT_TEMPLATE, CONDITION_SOURCE_TYPE_MAX, CONDITION_SOURCE_TYPE_MILLING_LOOT_TEMPLATE, CONDITION_SOURCE_TYPE_NONE, CONDITION_SOURCE_TYPE_NPC_VENDOR, CONDITION_SOURCE_TYPE_PHASE, CONDITION_SOURCE_TYPE_PICKPOCKETING_LOOT_TEMPLATE, CONDITION_SOURCE_TYPE_PROSPECTING_LOOT_TEMPLATE, CONDITION_SOURCE_TYPE_QUEST_AVAILABLE, CONDITION_SOURCE_TYPE_REFERENCE_LOOT_TEMPLATE, CONDITION_SOURCE_TYPE_SKINNING_LOOT_TEMPLATE, CONDITION_SOURCE_TYPE_SMART_EVENT, CONDITION_SOURCE_TYPE_SPELL, CONDITION_SOURCE_TYPE_SPELL_CLICK_EVENT, CONDITION_SOURCE_TYPE_SPELL_IMPLICIT_TARGET, CONDITION_SOURCE_TYPE_SPELL_LOOT_TEMPLATE, CONDITION_SOURCE_TYPE_SPELL_PROC, CONDITION_SOURCE_TYPE_TERRAIN_SWAP, CONDITION_SOURCE_TYPE_VEHICLE_SPELL, SpellInfo::GetEffects(), LootStore::GetLootForConditionFill(), LootStore::HaveLootFor(), LootTemplate::isReference(), LootTemplates_Creature, LootTemplates_Disenchant, LootTemplates_Fishing, LootTemplates_Gameobject, LootTemplates_Item, LootTemplates_Mail, LootTemplates_Milling, LootTemplates_Pickpocketing, LootTemplates_Prospecting, LootTemplates_Reference, LootTemplates_Skinning, LootTemplates_Spell, MAX_EFFECT_MASK, sAreaTriggerStore, sObjectMgr, Condition::SourceEntry, Condition::SourceGroup, Condition::SourceType, SPELL_EFFECT_APPLY_AREA_AURA_ENEMY, SPELL_EFFECT_APPLY_AREA_AURA_FRIEND, SPELL_EFFECT_APPLY_AREA_AURA_OWNER, SPELL_EFFECT_APPLY_AREA_AURA_PARTY, SPELL_EFFECT_APPLY_AREA_AURA_PET, SPELL_EFFECT_APPLY_AREA_AURA_RAID, SPELL_EFFECT_PERSISTENT_AREA_AURA, sSpellMgr, TARGET_SELECT_CATEGORY_AREA, TARGET_SELECT_CATEGORY_CONE, TARGET_SELECT_CATEGORY_NEARBY, TARGET_SELECT_CATEGORY_TRAJ, TC_LOG_ERROR, and Condition::ToString().

Referenced by LoadConditions().

◆ IsSpellUsedInSpellClickConditions()

bool ConditionMgr::IsSpellUsedInSpellClickConditions ( uint32  spellId) const

Definition at line 1090 of file ConditionMgr.cpp.

References SpellsUsedInSpellClickConditions.

◆ LoadConditions()

void ConditionMgr::LoadConditions ( bool  isReload = false)

TODO: PAIR_32 ?

Definition at line 1101 of file ConditionMgr.cpp.

References addToGossipMenuItems(), addToGossipMenus(), addToLootTemplate(), addToSpellImplicitTargetConditions(), AllocatedMemoryStore, CanHaveSourceGroupSet(), CanHaveSourceIdSet(), Clean(), CONDITION_AURA, CONDITION_SOURCE_TYPE_CREATURE_LOOT_TEMPLATE, CONDITION_SOURCE_TYPE_DISENCHANT_LOOT_TEMPLATE, CONDITION_SOURCE_TYPE_FISHING_LOOT_TEMPLATE, CONDITION_SOURCE_TYPE_GAMEOBJECT_LOOT_TEMPLATE, CONDITION_SOURCE_TYPE_GOSSIP_MENU, CONDITION_SOURCE_TYPE_GOSSIP_MENU_OPTION, CONDITION_SOURCE_TYPE_ITEM_LOOT_TEMPLATE, CONDITION_SOURCE_TYPE_MAIL_LOOT_TEMPLATE, CONDITION_SOURCE_TYPE_MILLING_LOOT_TEMPLATE, CONDITION_SOURCE_TYPE_NPC_VENDOR, CONDITION_SOURCE_TYPE_PICKPOCKETING_LOOT_TEMPLATE, CONDITION_SOURCE_TYPE_PROSPECTING_LOOT_TEMPLATE, CONDITION_SOURCE_TYPE_REFERENCE_LOOT_TEMPLATE, CONDITION_SOURCE_TYPE_SKINNING_LOOT_TEMPLATE, CONDITION_SOURCE_TYPE_SMART_EVENT, CONDITION_SOURCE_TYPE_SPELL, CONDITION_SOURCE_TYPE_SPELL_CLICK_EVENT, CONDITION_SOURCE_TYPE_SPELL_IMPLICIT_TARGET, CONDITION_SOURCE_TYPE_SPELL_LOOT_TEMPLATE, CONDITION_SOURCE_TYPE_VEHICLE_SPELL, ConditionReferenceStore, ConditionStore, Condition::ConditionStringValue1, Condition::ConditionTarget, Condition::ConditionType, Condition::ConditionValue1, Condition::ConditionValue2, Condition::ConditionValue3, Condition::ElseGroup, Condition::ErrorTextId, Condition::ErrorType, Field::GetBool(), Field::GetInt32(), LootStore::GetLootForConditionFill(), getMSTime(), GetMSTimeDiffToNow(), Field::GetString(), Field::GetUInt32(), Field::GetUInt8(), isConditionTypeValid(), isSourceTypeValid(), LootTemplates_Creature, LootTemplates_Disenchant, LootTemplates_Fishing, LootTemplates_Gameobject, LootTemplates_Item, LootTemplates_Mail, LootTemplates_Milling, LootTemplates_Pickpocketing, LootTemplates_Prospecting, LootTemplates_Reference, LootTemplates_Skinning, LootTemplates_Spell, Condition::NegativeCondition, NpcVendorConditionContainerStore, Condition::ReferenceId, LootStore::ResetConditions(), Condition::ScriptId, SmartEventConditionStore, sObjectMgr, Condition::SourceEntry, Condition::SourceGroup, Condition::SourceId, Condition::SourceType, SpellClickEventConditionStore, SpellsUsedInSpellClickConditions, sSpellMgr, TC_LOG_ERROR, TC_LOG_INFO, Condition::ToString(), VehicleSpellConditionStore, and WorldDatabase.

◆ LogUselessConditionValue() [1/2]

void ConditionMgr::LogUselessConditionValue ( Condition const *  cond,
uint8  index,
std::string_view  value 
)
staticprivate

Definition at line 2475 of file ConditionMgr.cpp.

References TC_LOG_ERROR, and Condition::ToString().

◆ LogUselessConditionValue() [2/2]

void ConditionMgr::LogUselessConditionValue ( Condition const *  cond,
uint8  index,
uint32  value 
)
staticprivate

Definition at line 2470 of file ConditionMgr.cpp.

References TC_LOG_ERROR, and Condition::ToString().

Referenced by isConditionTypeValid().

Member Data Documentation

◆ AllocatedMemoryStore

std::vector<Condition*> ConditionMgr::AllocatedMemoryStore
private

Definition at line 319 of file ConditionMgr.h.

Referenced by Clean(), and LoadConditions().

◆ ConditionReferenceStore

ConditionReferenceContainer ConditionMgr::ConditionReferenceStore
private

◆ ConditionStore

ConditionEntriesByTypeArray ConditionMgr::ConditionStore
private

◆ NpcVendorConditionContainerStore

ConditionEntriesByCreatureIdMap ConditionMgr::NpcVendorConditionContainerStore
private

Definition at line 325 of file ConditionMgr.h.

Referenced by Clean(), IsObjectMeetingVendorItemConditions(), and LoadConditions().

◆ SmartEventConditionStore

SmartEventConditionContainer ConditionMgr::SmartEventConditionStore
private

Definition at line 326 of file ConditionMgr.h.

Referenced by Clean(), IsObjectMeetingSmartEventConditions(), and LoadConditions().

◆ SpellClickEventConditionStore

ConditionEntriesByCreatureIdMap ConditionMgr::SpellClickEventConditionStore
private

◆ SpellsUsedInSpellClickConditions

std::unordered_set<uint32> ConditionMgr::SpellsUsedInSpellClickConditions
private

Definition at line 328 of file ConditionMgr.h.

Referenced by Clean(), IsSpellUsedInSpellClickConditions(), and LoadConditions().

◆ StaticConditionTypeData

ConditionMgr::ConditionTypeInfo const ConditionMgr::StaticConditionTypeData
static

Definition at line 69 of file ConditionMgr.h.

Referenced by isConditionTypeValid(), and Condition::ToString().

◆ StaticSourceTypeData

char const *const ConditionMgr::StaticSourceTypeData
static
Initial value:
=
{
"None",
"Creature Loot",
"Disenchant Loot",
"Fishing Loot",
"GameObject Loot",
"Item Loot",
"Mail Loot",
"Milling Loot",
"Pickpocketing Loot",
"Prospecting Loot",
"Reference Loot",
"Skinning Loot",
"Spell Loot",
"Spell Impl. Target",
"Gossip Menu",
"Gossip Menu Option",
"Creature Vehicle",
"Spell Expl. Target",
"Spell Click Event",
"Quest Accept",
"Quest Show Mark",
"Vehicle Spell",
"SmartScript",
"Npc Vendor",
"Spell Proc",
"Terrain Swap",
"Phase"
}

Definition at line 38 of file ConditionMgr.h.

Referenced by Condition::ToString().

◆ VehicleSpellConditionStore

ConditionEntriesByCreatureIdMap ConditionMgr::VehicleSpellConditionStore
private

Definition at line 323 of file ConditionMgr.h.

Referenced by Clean(), IsObjectMeetingVehicleSpellConditions(), and LoadConditions().


The documentation for this class was generated from the following files: