18#ifndef TRINITY_CONDITIONMGR_H
19#define TRINITY_CONDITIONMGR_H
27#include <unordered_map>
28#include <unordered_set>
238 std::size_t GetHash()
const;
284 NegativeCondition =
false;
288 uint32 GetSearcherTypeMaskForCondition()
const;
290 uint32 GetMaxAvailableConditionTargets()
const;
296 template <
typename FormatContext>
297 static auto format(
Condition const& condition, FormatContext& ctx) ->
decltype(ctx.out());
318 void LoadConditions(
bool isReload =
false);
319 bool isConditionTypeValid(
Condition* cond)
const;
333 bool HasConditionsForSpellClickEvent(
uint32 creatureId,
uint32 spellId)
const;
334 bool IsObjectMeetingVehicleSpellConditions(
uint32 creatureId,
uint32 spellId,
Player const* player,
Unit const* vehicle)
const;
336 bool IsObjectMeetingVendorItemConditions(
uint32 creatureId,
uint32 itemId,
Player const* player,
Creature const* vendor)
const;
337 bool IsObjectMeetingPlayerChoiceResponseConditions(
uint32 playerChoiceId,
int32 playerChoiceResponseId,
Player const* player)
const;
339 bool IsSpellUsedInSpellClickConditions(
uint32 spellId)
const;
342 bool IsObjectMeetingTrainerSpellConditions(
uint32 trainerId,
uint32 spellId,
Player* player)
const;
343 bool IsObjectMeetingVisibilityByObjectIdConditions(
WorldObject const* obj,
WorldObject const* seer)
const;
346 static bool IsPlayerMeetingCondition(
Player const* player,
uint32 conditionId);
363 bool isSourceTypeValid(
Condition* cond)
const;
364 void addToLootTemplate(
ConditionId const&
id, std::shared_ptr<std::vector<Condition>> conditions,
LootTemplate* loot)
const;
365 void addToGossipMenus(
ConditionId const&
id, std::shared_ptr<std::vector<Condition>> conditions)
const;
366 void addToGossipMenuItems(
ConditionId const&
id, std::shared_ptr<std::vector<Condition>> conditions)
const;
367 void addToSpellImplicitTargetConditions(
Condition const& cond)
const;
368 void addToPhases(
ConditionId const&
id, std::shared_ptr<std::vector<Condition>> conditions)
const;
369 void addToGraveyardData(
ConditionId const&
id, std::shared_ptr<std::vector<Condition>> conditions)
const;
373 static void LogUselessConditionValue(
Condition const* cond,
uint8 index, std::string
const& value);
382#define sConditionMgr ConditionMgr::instance()
388 if (std::shared_ptr<std::vector<Condition>> conditions =
Conditions.lock())
389 return sConditionMgr->IsObjectMeetToConditions(
object, *conditions);
395 if (std::shared_ptr<std::vector<Condition>> conditions =
Conditions.lock())
396 return sConditionMgr->IsObjectMeetToConditions(object1, object2, *conditions);
402 if (std::shared_ptr<std::vector<Condition>> conditions =
Conditions.lock())
403 return sConditionMgr->IsObjectMeetToConditions(sourceInfo, *conditions);
409 if (std::shared_ptr<std::vector<Condition>> conditions =
Conditions.lock())
410 return conditions->empty();
std::vector< Condition > ConditionContainer
std::unordered_map< ConditionId, std::shared_ptr< ConditionContainer > > ConditionsByEntryMap
@ CONDITION_SOURCE_TYPE_MAX
@ CONDITION_SOURCE_TYPE_CONVERSATION_LINE
@ CONDITION_SOURCE_TYPE_VEHICLE_SPELL
@ CONDITION_SOURCE_TYPE_SKILL_LINE_ABILITY
@ CONDITION_SOURCE_TYPE_DISENCHANT_LOOT_TEMPLATE
@ CONDITION_SOURCE_TYPE_REFERENCE_LOOT_TEMPLATE
@ CONDITION_SOURCE_TYPE_TERRAIN_SWAP
@ CONDITION_SOURCE_TYPE_NPC_VENDOR
@ CONDITION_SOURCE_TYPE_GOSSIP_MENU_OPTION
@ CONDITION_SOURCE_TYPE_SPELL_CLICK_EVENT
@ CONDITION_SOURCE_TYPE_REFERENCE_CONDITION
@ CONDITION_SOURCE_TYPE_MAIL_LOOT_TEMPLATE
@ CONDITION_SOURCE_TYPE_PHASE
@ CONDITION_SOURCE_TYPE_SPELL_LOOT_TEMPLATE
@ CONDITION_SOURCE_TYPE_SMART_EVENT
@ CONDITION_SOURCE_TYPE_PLAYER_CHOICE_RESPONSE
@ CONDITION_SOURCE_TYPE_PICKPOCKETING_LOOT_TEMPLATE
@ CONDITION_SOURCE_TYPE_PROSPECTING_LOOT_TEMPLATE
@ CONDITION_SOURCE_TYPE_AREATRIGGER_CLIENT_TRIGGERED
@ CONDITION_SOURCE_TYPE_AREATRIGGER
@ CONDITION_SOURCE_TYPE_PLAYER_CONDITION
@ CONDITION_SOURCE_TYPE_SPAWN_GROUP
@ CONDITION_SOURCE_TYPE_SPELL
@ CONDITION_SOURCE_TYPE_FISHING_LOOT_TEMPLATE
@ CONDITION_SOURCE_TYPE_OBJECT_ID_VISIBILITY
@ CONDITION_SOURCE_TYPE_GOSSIP_MENU
@ CONDITION_SOURCE_TYPE_CREATURE_TEMPLATE_VEHICLE
@ CONDITION_SOURCE_TYPE_ITEM_LOOT_TEMPLATE
@ CONDITION_SOURCE_TYPE_SPELL_IMPLICIT_TARGET
@ CONDITION_SOURCE_TYPE_GRAVEYARD
@ CONDITION_SOURCE_TYPE_SKINNING_LOOT_TEMPLATE
@ CONDITION_SOURCE_TYPE_TRAINER_SPELL
@ CONDITION_SOURCE_TYPE_CREATURE_LOOT_TEMPLATE
@ CONDITION_SOURCE_TYPE_GAMEOBJECT_LOOT_TEMPLATE
@ CONDITION_SOURCE_TYPE_MILLING_LOOT_TEMPLATE
@ CONDITION_SOURCE_TYPE_SPELL_PROC
@ CONDITION_SOURCE_TYPE_QUEST_AVAILABLE
@ CONDITION_SOURCE_TYPE_NONE
@ CONDITION_SOURCE_TYPE_MAX_DB_ALLOWED
std::array< ConditionsByEntryMap, CONDITION_SOURCE_TYPE_MAX > ConditionEntriesByTypeArray
@ INSTANCE_INFO_BOSS_STATE
@ INSTANCE_INFO_GUID_DATA
@ CONDITION_NEAR_GAMEOBJECT
@ CONDITION_QUESTREWARDED
@ CONDITION_REALM_ACHIEVEMENT
@ CONDITION_QUEST_OBJECTIVE_PROGRESS
@ CONDITION_DAILY_QUEST_DONE
@ CONDITION_SPAWNMASK_DEPRECATED
@ CONDITION_INSTANCE_INFO
@ CONDITION_PRIVATE_OBJECT
@ CONDITION_OBJECT_ENTRY_GUID
@ CONDITION_DIFFICULTY_ID
@ CONDITION_SCENARIO_STEP
@ CONDITION_BATTLE_PET_COUNT
@ CONDITION_REPUTATION_RANK
@ CONDITION_QUEST_COMPLETE
@ CONDITION_OBJECT_ENTRY_GUID_LEGACY
@ CONDITION_ITEM_EQUIPPED
@ CONDITION_SCENE_IN_PROGRESS
@ CONDITION_PLAYER_CONDITION
@ CONDITION_NEAR_CREATURE
@ CONDITION_CREATURE_TYPE
@ CONDITION_TYPE_MASK_LEGACY
@ RELATION_IN_RAID_OR_PARTY
std::unordered_set< uint32 > SpellsUsedInSpellClickConditions
ConditionMgr(ConditionMgr &&)=delete
ConditionMgr & operator=(ConditionMgr &&)=delete
ConditionEntriesByTypeArray ConditionStore
ConditionMgr(ConditionMgr const &)=delete
ConditionMgr & operator=(ConditionMgr const &)=delete
bool operator==(ConditionId const &right) const =default
std::strong_ordering operator<=>(ConditionId const &right) const =default
bool HasConditionStringValue1
Condition const * mLastFailedCondition
std::array< WorldObject const *, MAX_CONDITION_TARGETS > mConditionTargets
Map const * mConditionMap
ConditionTypes ConditionType
std::string ConditionStringValue1
ConditionSourceType SourceType
bool Meets(WorldObject const *object1, WorldObject const *object2) const
std::weak_ptr< ConditionContainer > Conditions
bool Meets(ConditionSourceInfo &sourceInfo) const
bool Meets(WorldObject const *object) const
std::size_t operator()(ConditionId const &id) const noexcept