18#ifndef TRINITY_CONDITIONMGR_H
19#define TRINITY_CONDITIONMGR_H
26#include <unordered_map>
27#include <unordered_set>
281 NegativeCondition =
false;
285 uint32 GetSearcherTypeMaskForCondition()
const;
287 uint32 GetMaxAvailableConditionTargets()
const;
289 std::string
ToString(
bool ext =
false)
const;
305 void LoadConditions(
bool isReload =
false);
306 bool isConditionTypeValid(
Condition* cond)
const;
320 bool HasConditionsForSpellClickEvent(
uint32 creatureId,
uint32 spellId)
const;
321 bool IsObjectMeetingVehicleSpellConditions(
uint32 creatureId,
uint32 spellId,
Player const* player,
Unit const* vehicle)
const;
323 bool IsObjectMeetingVendorItemConditions(
uint32 creatureId,
uint32 itemId,
Player const* player,
Creature const* vendor)
const;
325 bool IsSpellUsedInSpellClickConditions(
uint32 spellId)
const;
328 bool IsObjectMeetingTrainerSpellConditions(
uint32 trainerId,
uint32 spellId,
Player* player)
const;
329 bool IsObjectMeetingVisibilityByObjectIdConditions(
WorldObject const* obj,
WorldObject const* seer)
const;
332 static bool IsPlayerMeetingCondition(
Player const* player,
uint32 conditionId);
349 bool isSourceTypeValid(
Condition* cond)
const;
350 void addToLootTemplate(
ConditionId const&
id, std::shared_ptr<std::vector<Condition>> conditions,
LootTemplate* loot)
const;
351 void addToGossipMenus(
ConditionId const&
id, std::shared_ptr<std::vector<Condition>> conditions)
const;
352 void addToGossipMenuItems(
ConditionId const&
id, std::shared_ptr<std::vector<Condition>> conditions)
const;
353 void addToSpellImplicitTargetConditions(
Condition const& cond)
const;
354 void addToPhases(
ConditionId const&
id, std::shared_ptr<std::vector<Condition>> conditions)
const;
355 void addToGraveyardData(
ConditionId const&
id, std::shared_ptr<std::vector<Condition>> conditions)
const;
359 static void LogUselessConditionValue(
Condition const* cond,
uint8 index, std::string_view value);
368#define sConditionMgr ConditionMgr::instance()
374 if (std::shared_ptr<std::vector<Condition>> conditions =
Conditions.lock())
375 return sConditionMgr->IsObjectMeetToConditions(
object, *conditions);
381 if (std::shared_ptr<std::vector<Condition>> conditions =
Conditions.lock())
382 return sConditionMgr->IsObjectMeetToConditions(object1, object2, *conditions);
388 if (std::shared_ptr<std::vector<Condition>> conditions =
Conditions.lock())
389 return sConditionMgr->IsObjectMeetToConditions(sourceInfo, *conditions);
395 if (std::shared_ptr<std::vector<Condition>> conditions =
Conditions.lock())
396 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_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_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
ConditionEntriesByTypeArray ConditionStore
TC_COMMON_API char const * GetHash()
std::string ToString(Type &&val, Params &&... params)
bool operator==(ConditionId const &right) const =default
std::strong_ordering operator<=>(ConditionId const &right) const =default
bool HasConditionStringValue1
Condition const * mLastFailedCondition
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