92 "AreaTrigger Client Triggered",
94 "Object Visibility (by ID)",
101 { .
Name =
"None", .HasConditionValue1 =
false, .HasConditionValue2 =
false, .HasConditionValue3 =
false, .HasConditionStringValue1 =
false },
102 { .Name =
"Aura", .HasConditionValue1 =
true, .HasConditionValue2 =
true, .HasConditionValue3 =
true, .HasConditionStringValue1 =
false },
103 { .Name =
"Item Stored", .HasConditionValue1 =
true, .HasConditionValue2 =
true, .HasConditionValue3 =
true, .HasConditionStringValue1 =
false },
104 { .Name =
"Item Equipped", .HasConditionValue1 =
true, .HasConditionValue2 =
false, .HasConditionValue3 =
false, .HasConditionStringValue1 =
false },
105 { .Name =
"Zone", .HasConditionValue1 =
true, .HasConditionValue2 =
false, .HasConditionValue3 =
false, .HasConditionStringValue1 =
false },
106 { .Name =
"Reputation", .HasConditionValue1 =
true, .HasConditionValue2 =
true, .HasConditionValue3 =
false, .HasConditionStringValue1 =
false },
107 { .Name =
"Team", .HasConditionValue1 =
true, .HasConditionValue2 =
false, .HasConditionValue3 =
false, .HasConditionStringValue1 =
false },
108 { .Name =
"Skill", .HasConditionValue1 =
true, .HasConditionValue2 =
true, .HasConditionValue3 =
false, .HasConditionStringValue1 =
false },
109 { .Name =
"Quest Rewarded", .HasConditionValue1 =
true, .HasConditionValue2 =
false, .HasConditionValue3 =
false, .HasConditionStringValue1 =
false },
110 { .Name =
"Quest Taken", .HasConditionValue1 =
true, .HasConditionValue2 =
false, .HasConditionValue3 =
false, .HasConditionStringValue1 =
false },
111 { .Name =
"Drunken", .HasConditionValue1 =
true, .HasConditionValue2 =
false, .HasConditionValue3 =
false, .HasConditionStringValue1 =
false },
112 { .Name =
"WorldState", .HasConditionValue1 =
true, .HasConditionValue2 =
true, .HasConditionValue3 =
false, .HasConditionStringValue1 =
false },
113 { .Name =
"Active Event", .HasConditionValue1 =
true, .HasConditionValue2 =
false, .HasConditionValue3 =
false, .HasConditionStringValue1 =
false },
114 { .Name =
"Instance Info", .HasConditionValue1 =
true, .HasConditionValue2 =
true, .HasConditionValue3 =
true, .HasConditionStringValue1 =
false },
115 { .Name =
"Quest None", .HasConditionValue1 =
true, .HasConditionValue2 =
false, .HasConditionValue3 =
false, .HasConditionStringValue1 =
false },
116 { .Name =
"Class", .HasConditionValue1 =
true, .HasConditionValue2 =
false, .HasConditionValue3 =
false, .HasConditionStringValue1 =
false },
117 { .Name =
"Race", .HasConditionValue1 =
true, .HasConditionValue2 =
false, .HasConditionValue3 =
false, .HasConditionStringValue1 =
false },
118 { .Name =
"Achievement", .HasConditionValue1 =
true, .HasConditionValue2 =
false, .HasConditionValue3 =
false, .HasConditionStringValue1 =
false },
119 { .Name =
"Title", .HasConditionValue1 =
true, .HasConditionValue2 =
false, .HasConditionValue3 =
false, .HasConditionStringValue1 =
false },
120 { .Name =
"SpawnMask", .HasConditionValue1 =
true, .HasConditionValue2 =
false, .HasConditionValue3 =
false, .HasConditionStringValue1 =
false },
121 { .Name =
"Gender", .HasConditionValue1 =
true, .HasConditionValue2 =
false, .HasConditionValue3 =
false, .HasConditionStringValue1 =
false },
122 { .Name =
"Unit State", .HasConditionValue1 =
true, .HasConditionValue2 =
false, .HasConditionValue3 =
false, .HasConditionStringValue1 =
false },
123 { .Name =
"Map", .HasConditionValue1 =
true, .HasConditionValue2 =
false, .HasConditionValue3 =
false, .HasConditionStringValue1 =
false },
124 { .Name =
"Area", .HasConditionValue1 =
true, .HasConditionValue2 =
false, .HasConditionValue3 =
false, .HasConditionStringValue1 =
false },
125 { .Name =
"CreatureType", .HasConditionValue1 =
true, .HasConditionValue2 =
false, .HasConditionValue3 =
false, .HasConditionStringValue1 =
false },
126 { .Name =
"Spell Known", .HasConditionValue1 =
true, .HasConditionValue2 =
false, .HasConditionValue3 =
false, .HasConditionStringValue1 =
false },
127 { .Name =
"Phase", .HasConditionValue1 =
true, .HasConditionValue2 =
false, .HasConditionValue3 =
false, .HasConditionStringValue1 =
false },
128 { .Name =
"Level", .HasConditionValue1 =
true, .HasConditionValue2 =
true, .HasConditionValue3 =
false, .HasConditionStringValue1 =
false },
129 { .Name =
"Quest Completed", .HasConditionValue1 =
true, .HasConditionValue2 =
false, .HasConditionValue3 =
false, .HasConditionStringValue1 =
false },
130 { .Name =
"Near Creature", .HasConditionValue1 =
true, .HasConditionValue2 =
true, .HasConditionValue3 =
true, .HasConditionStringValue1 =
false },
131 { .Name =
"Near GameObject", .HasConditionValue1 =
true, .HasConditionValue2 =
true, .HasConditionValue3 =
false, .HasConditionStringValue1 =
false },
132 { .Name =
"Object Entry or Guid", .HasConditionValue1 =
true, .HasConditionValue2 =
true, .HasConditionValue3 =
true, .HasConditionStringValue1 =
false },
133 { .Name =
"Object TypeMask", .HasConditionValue1 =
true, .HasConditionValue2 =
false, .HasConditionValue3 =
false, .HasConditionStringValue1 =
false },
134 { .Name =
"Relation", .HasConditionValue1 =
true, .HasConditionValue2 =
true, .HasConditionValue3 =
false, .HasConditionStringValue1 =
false },
135 { .Name =
"Reaction", .HasConditionValue1 =
true, .HasConditionValue2 =
true, .HasConditionValue3 =
false, .HasConditionStringValue1 =
false },
136 { .Name =
"Distance", .HasConditionValue1 =
true, .HasConditionValue2 =
true, .HasConditionValue3 =
true, .HasConditionStringValue1 =
false },
137 { .Name =
"Alive", .HasConditionValue1 =
false, .HasConditionValue2 =
false, .HasConditionValue3 =
false, .HasConditionStringValue1 =
false },
138 { .Name =
"Health Value", .HasConditionValue1 =
true, .HasConditionValue2 =
true, .HasConditionValue3 =
false, .HasConditionStringValue1 =
false },
139 { .Name =
"Health Pct", .HasConditionValue1 =
true, .HasConditionValue2 =
true, .HasConditionValue3 =
false, .HasConditionStringValue1 =
false },
140 { .Name =
"Realm Achievement", .HasConditionValue1 =
true, .HasConditionValue2 =
false, .HasConditionValue3 =
false, .HasConditionStringValue1 =
false },
141 { .Name =
"In Water", .HasConditionValue1 =
false, .HasConditionValue2 =
false, .HasConditionValue3 =
false, .HasConditionStringValue1 =
false },
142 { .Name =
"Terrain Swap", .HasConditionValue1 =
true, .HasConditionValue2 =
false, .HasConditionValue3 =
false, .HasConditionStringValue1 =
false },
143 { .Name =
"Sit/stand state", .HasConditionValue1 =
true, .HasConditionValue2 =
true, .HasConditionValue3 =
false, .HasConditionStringValue1 =
false },
144 { .Name =
"Daily Quest Completed", .HasConditionValue1 =
true, .HasConditionValue2 =
false, .HasConditionValue3 =
false, .HasConditionStringValue1 =
false },
145 { .Name =
"Charmed", .HasConditionValue1 =
false, .HasConditionValue2 =
false, .HasConditionValue3 =
false, .HasConditionStringValue1 =
false },
146 { .Name =
"Pet type", .HasConditionValue1 =
true, .HasConditionValue2 =
false, .HasConditionValue3 =
false, .HasConditionStringValue1 =
false },
147 { .Name =
"On Taxi", .HasConditionValue1 =
false, .HasConditionValue2 =
false, .HasConditionValue3 =
false, .HasConditionStringValue1 =
false },
148 { .Name =
"Quest state mask", .HasConditionValue1 =
true, .HasConditionValue2 =
true, .HasConditionValue3 =
false, .HasConditionStringValue1 =
false },
149 { .Name =
"Quest objective progress", .HasConditionValue1 =
true, .HasConditionValue2 =
false, .HasConditionValue3 =
true, .HasConditionStringValue1 =
false },
150 { .Name =
"Map Difficulty", .HasConditionValue1 =
true, .HasConditionValue2 =
false, .HasConditionValue3 =
false, .HasConditionStringValue1 =
false },
151 { .Name =
"Is Gamemaster", .HasConditionValue1 =
true, .HasConditionValue2 =
false, .HasConditionValue3 =
false, .HasConditionStringValue1 =
false },
152 { .Name =
"Object Entry or Guid", .HasConditionValue1 =
true, .HasConditionValue2 =
true, .HasConditionValue3 =
true, .HasConditionStringValue1 =
false },
153 { .Name =
"Object TypeMask", .HasConditionValue1 =
true, .HasConditionValue2 =
false, .HasConditionValue3 =
false, .HasConditionStringValue1 =
false },
154 { .Name =
"BattlePet Species Learned", .HasConditionValue1 =
true, .HasConditionValue2 =
true, .HasConditionValue3 =
true, .HasConditionStringValue1 =
false },
155 { .Name =
"On Scenario Step", .HasConditionValue1 =
true, .HasConditionValue2 =
false, .HasConditionValue3 =
false, .HasConditionStringValue1 =
false },
156 { .Name =
"Scene In Progress", .HasConditionValue1 =
true, .HasConditionValue2 =
false, .HasConditionValue3 =
false, .HasConditionStringValue1 =
false },
157 { .Name =
"Player Condition", .HasConditionValue1 =
true, .HasConditionValue2 =
false, .HasConditionValue3 =
false, .HasConditionStringValue1 =
false },
158 { .Name =
"Private Object", .HasConditionValue1 =
false, .HasConditionValue2 =
false, .HasConditionValue3 =
false, .HasConditionStringValue1 =
false },
159 { .Name =
"String ID", .HasConditionValue1 =
false, .HasConditionValue2 =
false, .HasConditionValue3 =
false, .HasConditionStringValue1 =
true },
160 { .Name =
"Label", .HasConditionValue1 =
true, .HasConditionValue2 =
false, .HasConditionValue3 =
false, .HasConditionStringValue1 =
false },
188 std::size_t hashVal = 0;
202 bool condMeets =
false;
203 bool needsObject =
false;
216 if (
InstanceScript const* instance = instanceMap->GetInstanceScript())
237 ZoneScript const* zoneScript = bgMap->GetBattlegroundScript();
276 if (
Scenario const* scenario = instanceMap->GetInstanceScenario())
288 if (needsObject && !
object)
326 condMeets = (
ConditionValue2 & (1 << player->GetReputationMgr().GetRank(faction))) != 0;
469 condMeets = unit == toUnit;
513 condMeets = unit->IsAlive();
554 condMeets = unit->IsInWater();
569 condMeets = unit->IsStandState();
571 condMeets = unit->IsSitState();
584 condMeets = unit->IsCharmed();
590 if (
Pet const* pet = player->GetPet())
597 condMeets = player->IsInFlight();
640 condMeets = player->CanBeGameMaster();
642 condMeets = player->IsGameMaster();
657 condMeets = player->GetSceneMgr().GetActiveSceneCount(
ConditionValue1) > 0;
668 condMeets = !
object->GetPrivateObjectOwner().IsEmpty();
692 condMeets = !condMeets;
697 return condMeets &&
sScriptMgr->OnConditionCheck(
this, sourceInfo);
909 ABORT_MSG(
"Condition::GetSearcherTypeMaskForCondition - missing condition handling!");
939 std::ostringstream ss;
945 ss <<
" (Reference)";
976 if (conditions.empty())
979 std::map<uint32, uint32> elseGroupSearcherTypeMasks;
980 for (ConditionContainer::const_iterator i = conditions.begin(); i != conditions.end(); ++i)
983 ASSERT(i->isLoaded() &&
"ConditionMgr::GetSearcherTypeMaskForConditionList - not yet loaded condition found in list");
984 std::map<uint32, uint32>::const_iterator itr = elseGroupSearcherTypeMasks.find(i->ElseGroup);
986 if (itr == elseGroupSearcherTypeMasks.end())
989 else if (!itr->second)
1002 elseGroupSearcherTypeMasks[i->ElseGroup] &= i->GetSearcherTypeMaskForCondition();
1008 for (std::map<uint32, uint32>::const_iterator i = elseGroupSearcherTypeMasks.begin(); i != elseGroupSearcherTypeMasks.end(); ++i)
1017 std::map<uint32, bool> elseGroupStore;
1018 for (
Condition const& condition : conditions)
1020 TC_LOG_DEBUG(
"condition",
"ConditionMgr::IsPlayerMeetToConditionList {} val1: {}", condition.ToString(), condition.ConditionValue1);
1021 if (condition.isLoaded())
1024 std::map<uint32, bool>::iterator itr = elseGroupStore.try_emplace(condition.ElseGroup,
true).first;
1028 if (condition.ReferenceId)
1034 if (condition.NegativeCondition)
1035 condMeets = !condMeets;
1038 itr->second =
false;
1042 TC_LOG_DEBUG(
"condition",
"ConditionMgr::IsPlayerMeetToConditionList {} Reference template -{} not found",
1043 condition.ToString(), condition.ReferenceId);
1049 if (!condition.Meets(sourceInfo))
1050 itr->second =
false;
1054 for (std::map<uint32, bool>::const_iterator i = elseGroupStore.begin(); i != elseGroupStore.end(); ++i)
1075 if (conditions.empty())
1078 TC_LOG_DEBUG(
"condition",
"ConditionMgr::IsObjectMeetToConditions");
1121 switch (conditionType)
1149 TC_LOG_DEBUG(
"condition",
"GetConditionsForNotGroupedEntry: found conditions for type {} and entry {}",
uint32(sourceType), entry);
1182 TC_LOG_DEBUG(
"condition",
"IsObjectMeetingSpellClickConditions: found conditions for SpellClickEvent entry {} spell {}", creatureId, spellId);
1194 TC_LOG_DEBUG(
"condition",
"HasConditionsForSpellClickEvent: found conditions for SpellClickEvent entry {} spell {}", creatureId, spellId);
1205 TC_LOG_DEBUG(
"condition",
"GetConditionsForVehicleSpell: found conditions for Vehicle entry {} spell {}", creatureId, spellId);
1217 TC_LOG_DEBUG(
"condition",
"GetConditionsForSmartEvent: found conditions for Smart Event entry or guid {} eventId {}", entryOrGuid, eventId);
1229 TC_LOG_DEBUG(
"condition",
"GetConditionsForNpcVendor: found conditions for creature entry {} item {}", creatureId, itemId);
1245 return itr->second.get();
1254 TC_LOG_DEBUG(
"condition",
"IsObjectMeetingTrainerSpellConditions: found conditions for trainer id {} spell {}", trainerId, spellId);
1286 sSpellMgr->UnloadSpellInfoImplicitTargetConditionLists();
1291 QueryResult result =
WorldDatabase.Query(
"SELECT SourceTypeOrReferenceId, SourceGroup, SourceEntry, SourceId, ElseGroup, ConditionTypeOrReference, ConditionTarget, "
1292 "ConditionValue1, ConditionValue2, ConditionValue3, ConditionStringValue1, "
1293 "NegativeCondition, ErrorType, ErrorTextId, ScriptName FROM conditions");
1297 TC_LOG_INFO(
"server.loading",
">> Loaded 0 conditions. DB table `conditions` is empty!");
1305 auto [itr, inserted] =
ConditionStore[sourceType].try_emplace(
id,
nullptr);
1307 itr->second = std::make_shared<std::vector<Condition>>();
1313 Field* fields = result->Fetch();
1332 if (iConditionTypeOrReference >= 0)
1335 if (iSourceTypeOrReferenceId >= 0)
1338 if (iConditionTypeOrReference < 0)
1340 if (iConditionTypeOrReference == iSourceTypeOrReferenceId)
1342 TC_LOG_ERROR(
"sql.sql",
"Condition reference {} is referencing self, skipped", iSourceTypeOrReferenceId);
1348 char const* rowType =
"reference template";
1349 if (iSourceTypeOrReferenceId >= 0)
1350 rowType =
"reference";
1353 TC_LOG_ERROR(
"sql.sql",
"Condition {} {} has useless data in ConditionTarget ({})!", rowType, iSourceTypeOrReferenceId, cond.
ConditionTarget);
1355 TC_LOG_ERROR(
"sql.sql",
"Condition {} {} has useless data in value1 ({})!", rowType, iSourceTypeOrReferenceId, cond.
ConditionValue1);
1357 TC_LOG_ERROR(
"sql.sql",
"Condition {} {} has useless data in value2 ({})!", rowType, iSourceTypeOrReferenceId, cond.
ConditionValue2);
1359 TC_LOG_ERROR(
"sql.sql",
"Condition {} {} has useless data in value3 ({})!", rowType, iSourceTypeOrReferenceId, cond.
ConditionValue3);
1364 if (iSourceTypeOrReferenceId < 0)
1367 TC_LOG_ERROR(
"sql.sql",
"Condition reference template {} has useless data in SourceGroup ({})!", iSourceTypeOrReferenceId, cond.
SourceGroup);
1369 TC_LOG_ERROR(
"sql.sql",
"Condition reference template {} has useless data in SourceEntry ({})!", iSourceTypeOrReferenceId, cond.
SourceEntry);
1371 TC_LOG_ERROR(
"sql.sql",
"Condition reference template {} has useless data in SourceId ({})!", iSourceTypeOrReferenceId, cond.
SourceId);
1403 getOrInitConditions(cond.
SourceType, { cond.SourceGroup, cond.SourceEntry, cond.SourceId })->emplace_back(std::move(cond));
1406 while (result->NextRow());
1452 for (
Condition const& condition : *conditions)
1457 for (
Condition const& condition : *conditions)
1470 return std::any_of(conditions.begin(), conditions.end(), [&](
Condition const& condition)
1472 if (condition.ConditionType == CONDITION_PLAYER_CONDITION)
1474 if (condition.ConditionValue1 == playerConditionId)
1476 auto playerCondItr = store[CONDITION_SOURCE_TYPE_PLAYER_CONDITION].find({ 0, int32(condition.ConditionValue1), 0 });
1477 if (playerCondItr != store[CONDITION_SOURCE_TYPE_PLAYER_CONDITION].end())
1478 if (operator()(playerConditionId, *playerCondItr->second, store))
1483 auto refItr = store[CONDITION_SOURCE_TYPE_REFERENCE_CONDITION].find({ condition.ReferenceId, 0, 0 });
1485 if (
operator()(playerConditionId, *refItr->second, store))
1491 } isPlayerConditionIdUsedByCondition;
1495 if (isPlayerConditionIdUsedByCondition(
id.SourceEntry, *conditions, ConditionStore))
1497 TC_LOG_ERROR(
"sql.sql",
"[Condition SourceType: CONDITION_SOURCE_TYPE_PLAYER_CONDITION, SourceGroup: {}, SourceEntry: {}, SourceId: {}] "
1498 "has a circular reference to player condition id {}, removed all conditions for this SourceEntry!",
1499 id.SourceGroup,
id.SourceEntry,
id.SourceId,
id.SourceEntry);
1500 conditions->clear();
1511 for (
Condition const& condition : *conditions)
1512 TC_LOG_ERROR(
"sql.sql",
"{} LootTemplate {} not found.", condition.ToString(),
id.SourceGroup);
1519 for (
Condition const& condition : *conditions)
1520 TC_LOG_ERROR(
"sql.sql",
"{} Item {} not found in LootTemplate {}.", condition.ToString(),
id.SourceEntry,
id.SourceGroup);
1527 if (pMenuBounds.first != pMenuBounds.second)
1529 for (GossipMenusContainer::iterator itr = pMenuBounds.first; itr != pMenuBounds.second; ++itr)
1530 if (itr->second.MenuID ==
id.SourceGroup && (itr->second.TextID ==
uint32(
id.SourceEntry) ||
id.SourceEntry == 0))
1531 itr->second.Conditions = { conditions };
1536 for (
Condition const& condition : *conditions)
1537 TC_LOG_ERROR(
"sql.sql",
"{} GossipMenu {} not found.", condition.ToString(),
id.SourceGroup);
1543 for (
auto& [_, gossipMenuItem] : pMenuItemBounds)
1545 if (gossipMenuItem.MenuID ==
id.SourceGroup && gossipMenuItem.OrderIndex ==
uint32(
id.SourceEntry))
1547 gossipMenuItem.Conditions = { conditions };
1552 for (
Condition const& condition : *conditions)
1553 TC_LOG_ERROR(
"sql.sql",
"{} GossipMenuId {} Item {} not found.", condition.ToString(),
id.SourceGroup,
id.SourceEntry);
1560 uint32 conditionEffMask = cond.SourceGroup;
1561 std::list<uint32> sharedMasks;
1562 for (SpellEffectInfo const& spellEffectInfo : spellInfo->GetEffects())
1565 if (conditionEffMask & (1 << spellEffectInfo.EffectIndex))
1567 switch (cond.ConditionType)
1569 case CONDITION_OBJECT_ENTRY_GUID:
1571 uint32 implicitTargetMask = GetTargetFlagMask(spellEffectInfo.TargetA.GetObjectType()) | GetTargetFlagMask(spellEffectInfo.TargetB.GetObjectType());
1572 if ((implicitTargetMask & TARGET_FLAG_UNIT_MASK) && cond.ConditionValue1 != TYPEID_UNIT && cond.ConditionValue1 != TYPEID_PLAYER)
1574 TC_LOG_ERROR(
"sql.sql",
"{} in `condition` table - spell {} EFFECT_{} - "
1575 "target requires ConditionValue1 to be either TYPEID_UNIT ({}) or TYPEID_PLAYER ({})", cond.ToString(), spellInfo->Id, uint32(spellEffectInfo.EffectIndex), uint32(TYPEID_UNIT), uint32(TYPEID_PLAYER));
1579 if ((implicitTargetMask & TARGET_FLAG_GAMEOBJECT_MASK) && cond.ConditionValue1 != TYPEID_GAMEOBJECT)
1581 TC_LOG_ERROR(
"sql.sql",
"{} in `condition` table - spell {} EFFECT_{} - "
1582 "target requires ConditionValue1 to be TYPEID_GAMEOBJECT ({})", cond.ToString(), spellInfo->Id, uint32(spellEffectInfo.EffectIndex), uint32(TYPEID_GAMEOBJECT));
1586 if ((implicitTargetMask & TARGET_FLAG_CORPSE_MASK) && cond.ConditionValue1 != TYPEID_CORPSE)
1588 TC_LOG_ERROR(
"sql.sql",
"{} in `condition` table - spell {} EFFECT_{} - "
1589 "target requires ConditionValue1 to be TYPEID_CORPSE ({})", cond.ToString(), spellInfo->Id, uint32(spellEffectInfo.EffectIndex), uint32(TYPEID_CORPSE));
1600 auto itr = std::find_if(sharedMasks.begin(), sharedMasks.end(), [&](uint32 mask) { return !!(mask & (1 << spellEffectInfo.EffectIndex)); });
1601 if (itr != sharedMasks.end())
1605 uint32 sharedMask = 1 << spellEffectInfo.EffectIndex;
1606 for (size_t effIndex = spellEffectInfo.EffectIndex + 1; effIndex < spellInfo->GetEffects().size(); ++effIndex)
1607 if (spellInfo->GetEffect(SpellEffIndex(effIndex)).ImplicitTargetConditions == spellEffectInfo.ImplicitTargetConditions)
1608 sharedMask |= 1 << effIndex;
1610 sharedMasks.push_back(sharedMask);
1613 for (
uint32 effectMask : sharedMasks)
1616 if (
uint32 commonMask = effectMask & conditionEffMask)
1618 size_t firstEffIndex = 0;
1619 for (; firstEffIndex < spellInfo->
GetEffects().
size(); ++firstEffIndex)
1620 if ((1 << firstEffIndex) & effectMask)
1623 if (firstEffIndex >= spellInfo->
GetEffects().size())
1627 std::shared_ptr<ConditionContainer> sharedList = spellInfo->
GetEffect(
SpellEffIndex(firstEffIndex)).ImplicitTargetConditions;
1633 if (conditionEffMask != effectMask)
1635 TC_LOG_ERROR(
"sql.sql",
"{} in `condition` table, has incorrect SourceGroup {} (spell effectMask) set - "
1636 "effect masks are overlapping (all SourceGroup values having given bit set must be equal) - ignoring (Difficulty {}).",
1645 sharedList = std::make_shared<ConditionContainer>();
1646 bool assigned =
false;
1647 for (
size_t i = firstEffIndex; i < spellInfo->
GetEffects().
size(); ++i)
1649 if ((1 << i) & commonMask)
1659 sharedList->push_back(cond);
1668 if (!
id.SourceEntry)
1673 for (
uint32 areaId : phaseInfo->Areas)
1675 if (std::vector<PhaseAreaInfo>* phases =
const_cast<std::vector<PhaseAreaInfo>*
>(
sObjectMgr->GetPhasesForArea(areaId)))
1679 if (phase.PhaseInfo->Id ==
id.SourceGroup)
1681 phase.Conditions.insert(phase.Conditions.end(), conditions->begin(), conditions->end());
1692 else if (std::vector<PhaseAreaInfo>* phases =
const_cast<std::vector<PhaseAreaInfo>*
>(
sObjectMgr->GetPhasesForArea(
id.SourceEntry)))
1696 if (phase.PhaseInfo->Id ==
id.SourceGroup)
1698 phase.Conditions.insert(phase.Conditions.end(), conditions->begin(), conditions->end());
1704 for (
Condition const& condition : *conditions)
1705 TC_LOG_ERROR(
"sql.sql",
"{} Area {} does not have phase {}.", condition.ToString(),
id.SourceEntry,
id.SourceGroup);
1712 graveyard->Conditions = { conditions };
1716 for (
Condition const& condition : *conditions)
1717 TC_LOG_ERROR(
"sql.sql",
"{}, Graveyard {} does not have ghostzone {}.", condition.ToString(),
id.SourceEntry,
id.SourceGroup);
1728 TC_LOG_ERROR(
"sql.sql",
"{} SourceGroup in `condition` table, does not exist in `creature_loot_template`, ignoring.", cond->
ToString());
1737 TC_LOG_ERROR(
"sql.sql",
"{} SourceGroup in `condition` table, does not exist in `disenchant_loot_template`, ignoring.", cond->
ToString());
1746 TC_LOG_ERROR(
"sql.sql",
"{} SourceGroup in `condition` table, does not exist in `fishing_loot_template`, ignoring.", cond->
ToString());
1755 TC_LOG_ERROR(
"sql.sql",
"{} SourceGroup in `condition` table, does not exist in `gameobject_loot_template`, ignoring.", cond->
ToString());
1764 TC_LOG_ERROR(
"sql.sql",
"{} SourceGroup in `condition` table, does not exist in `item_loot_template`, ignoring.", cond->
ToString());
1773 TC_LOG_ERROR(
"sql.sql",
"{} SourceGroup in `condition` table, does not exist in `mail_loot_template`, ignoring.", cond->
ToString());
1782 TC_LOG_ERROR(
"sql.sql",
"{} SourceGroup in `condition` table, does not exist in `milling_loot_template`, ignoring.", cond->
ToString());
1791 TC_LOG_ERROR(
"sql.sql",
"{} SourceGroup in `condition` table, does not exist in `pickpocketing_loot_template`, ignoring.", cond->
ToString());
1800 TC_LOG_ERROR(
"sql.sql",
"{} SourceGroup in `condition` table, does not exist in `prospecting_loot_template`, ignoring.", cond->
ToString());
1809 TC_LOG_ERROR(
"sql.sql",
"{} SourceGroup in `condition` table, does not exist in `reference_loot_template`, ignoring.", cond->
ToString());
1818 TC_LOG_ERROR(
"sql.sql",
"{} SourceGroup in `condition` table, does not exist in `skinning_loot_template`, ignoring.", cond->
ToString());
1827 TC_LOG_ERROR(
"sql.sql",
"{} SourceGroup in `condition` table, does not exist in `spell_loot_template`, ignoring.", cond->
ToString());
1837 TC_LOG_ERROR(
"sql.sql",
"{} SourceEntry in `condition` table does not exist in `Spell.db2`, ignoring.", cond->
ToString());
1843 TC_LOG_ERROR(
"sql.sql",
"{} in `condition` table, has incorrect SourceGroup (spell effectMask) set, ignoring.", cond->
ToString());
1851 if (!((1 << spellEffectInfo.EffectIndex) & cond->
SourceGroup))
1854 if (spellEffectInfo.ChainTargets > 0)
1857 switch (spellEffectInfo.TargetA.GetSelectionCategory())
1869 switch (spellEffectInfo.TargetB.GetSelectionCategory())
1881 switch (spellEffectInfo.Effect)
1898 TC_LOG_ERROR(
"sql.sql",
"SourceEntry {} SourceGroup {} in `condition` table - spell {} does not have implicit targets of types: _AREA_, _CONE_, _NEARBY_, __CHAIN__ or is not SPELL_EFFECT_PERSISTENT_AREA_AURA or SPELL_EFFECT_APPLY_AREA_AURA_* for effect {}, SourceGroup needs correction, ignoring.", cond->
SourceEntry, origGroup, cond->
SourceEntry,
uint32(spellEffectInfo.EffectIndex));
1899 cond->
SourceGroup &= ~(1 << spellEffectInfo.EffectIndex);
1910 TC_LOG_ERROR(
"sql.sql",
"{} SourceEntry in `condition` table, does not exist in `creature_template`, ignoring.", cond->
ToString());
1921 TC_LOG_ERROR(
"sql.sql",
"{} SourceEntry in `condition` table does not exist in `Spell.db2`, ignoring.", cond->
ToString());
1929 TC_LOG_ERROR(
"sql.sql",
"{} SourceEntry specifies non-existing quest, skipped.", cond->
ToString());
1936 TC_LOG_ERROR(
"sql.sql",
"{} SourceGroup in `condition` table, does not exist in `creature_template`, ignoring.", cond->
ToString());
1942 TC_LOG_ERROR(
"sql.sql",
"{} SourceEntry in `condition` table does not exist in `Spell.db2`, ignoring.", cond->
ToString());
1949 TC_LOG_ERROR(
"sql.sql",
"{} SourceGroup in `condition` table, does not exist in `creature_template`, ignoring.", cond->
ToString());
1955 TC_LOG_ERROR(
"sql.sql",
"{} SourceEntry in `condition` table does not exist in `Spell.db2`, ignoring.", cond->
ToString());
1963 TC_LOG_ERROR(
"sql.sql",
"{} SourceGroup in `condition` table, does not exist in `creature_template`, ignoring.", cond->
ToString());
1969 TC_LOG_ERROR(
"sql.sql",
"{} SourceEntry in `condition` table, item does not exist, ignoring.", cond->
ToString());
1978 TC_LOG_ERROR(
"sql.sql",
"{} SourceEntry in `condition` table, does not exist in Map.db2, ignoring.", cond->
ToString());
1987 TC_LOG_ERROR(
"sql.sql",
"{} SourceEntry in `condition` table, does not exist in AreaTable.db2, ignoring.", cond->
ToString());
1995 TC_LOG_ERROR(
"sql.sql",
"{} SourceEntry in `condition` table, does not exist in `graveyard_zone`, ignoring.", cond->
ToString());
2002 TC_LOG_ERROR(
"sql.sql",
"{} in `condition` table, unexpected SourceEntry value (expected 0 or 1), ignoring.", cond->
ToString());
2005 if (!
sAreaTriggerDataStore->GetAreaTriggerTemplate({ uint32(cond->SourceGroup), cond->SourceEntry == 1 }))
2007 TC_LOG_ERROR(
"sql.sql",
"{} in `condition` table, does not exist in `areatrigger_template`, ignoring.", cond->
ToString());
2014 TC_LOG_ERROR(
"sql.sql",
"{} does not exist in `conversation_line_template`, ignoring.", cond->
ToString());
2021 TC_LOG_ERROR(
"sql.sql",
"{} SourceEntry in `condition` table, does not exists in AreaTrigger.db2, ignoring.", cond->
ToString());
2029 TC_LOG_ERROR(
"sql.sql",
"{} SourceGroup in `condition` table, does not exist in `trainer`, ignoring.", cond->
ToString());
2034 TC_LOG_ERROR(
"sql.sql",
"{} SourceEntry in `condition` table does not exist in `Spell.db2`, ignoring.", cond->
ToString());
2043 TC_LOG_ERROR(
"sql.sql",
"{} SourceGroup in `condition` table, is no valid object type, ignoring.", cond->
ToString());
2051 TC_LOG_ERROR(
"sql.sql",
"{} SourceEntry in `condition` table, does not exist in `creature_template`, ignoring.", cond->
ToString());
2059 TC_LOG_ERROR(
"sql.sql",
"{} SourceEntry in `condition` table, does not exist in `gameobject_template`, ignoring.", cond->
ToString());
2065 TC_LOG_ERROR(
"sql.sql",
"{} SourceGroup in `condition` table, uses unchecked type id, ignoring.", cond->
ToString());
2075 TC_LOG_ERROR(
"sql.sql",
"{} SourceEntry in `condition` table, does not exist in `spawn_group_template`, ignoring.", cond->
ToString());
2080 TC_LOG_ERROR(
"sql.sql",
"{} in `spawn_group_template` table cannot have SPAWNGROUP_FLAG_SYSTEM flags, ignoring.", cond->
ToString());
2091 TC_LOG_ERROR(
"sql.sql",
"{} Invalid ConditionSourceType in `condition` table, ignoring.", cond->
ToString());
2113 TC_LOG_ERROR(
"sql.sql",
"{} spell {} has non existing effect index ({}) (must be 0..{}), skipped.",
2120 TC_LOG_ERROR(
"sql.sql",
"{} spell {} effect index {} is not an aura, skipped.",
2137 TC_LOG_ERROR(
"sql.sql",
"{} Zero item count in ConditionValue2, skipped.", cond->
ToString(
true));
2255 if (!invalidRaceMask.
IsEmpty())
2516 TC_LOG_ERROR(
"sql.sql",
"{} using deprecated condition type CONDITION_SPAWNMASK.", cond->
ToString(
true));
2625 TC_LOG_ERROR(
"sql.sql",
"{} has invalid (greater than {}) value2 ({}), skipped.", cond->
ToString(
true),
2663 TC_LOG_ERROR(
"sql.sql",
"{} Invalid ConditionType in `condition` table, ignoring.", cond->
ToString());
2669 TC_LOG_ERROR(
"sql.sql",
"{} in `condition` table, has incorrect ConditionTarget set, ignoring.", cond->
ToString(
true));
2687 TC_LOG_ERROR(
"sql.sql",
"{} has useless data in ConditionValue{} ({})!", cond->
ToString(
true), index, value);
2692 TC_LOG_ERROR(
"sql.sql",
"{} has useless data in ConditionStringValue{} ({})!", cond->
ToString(
true), index, value);
2698 conditionsMap.clear();
2705 switch (comparisonType)
2708 return value1 == value2;
2710 return value1 != value2;
2712 return value1 > value2;
2714 return value1 >= value2;
2716 return value1 < value2;
2718 return value1 <= value2;
2725template<std::
size_t N>
2728 static_assert(N < 8,
"Logic array size must be equal to or less than 8");
2730 for (std::size_t i = 0; i < results.size(); ++i)
2731 if ((logic >> (16 + i)) & 1)
2734 bool result = results[0];
2735 for (std::size_t i = 1; i < results.size(); ++i)
2737 switch ((logic >> (2 * (i - 1))) & 3)
2740 result = result && results[i];
2743 result = result || results[i];
2772 if (!selectedRandomDungeon)
2776 if (
Quest const* quest =
sObjectMgr->GetQuestTemplate(reward->firstQuest))
2816 uint8 minLevel = condition->
Flags & 0x800 ? levels->MinLevelWithDelta : levels->MinLevel;
2818 if (!(condition->
Flags & 0x20))
2819 maxLevel = condition->
Flags & 0x800 ? levels->MaxLevelWithDelta : levels->MaxLevel;
2821 if (condition->
Flags & 0x80)
2823 if (minLevel && player->
GetLevel() >= minLevel && (!maxLevel || player->
GetLevel() <= maxLevel))
2826 if (maxLevel && player->
GetLevel() <= maxLevel && (!minLevel || player->
GetLevel() >= minLevel))
2831 if (minLevel && player->
GetLevel() < minLevel)
2834 if (maxLevel && player->
GetLevel() > maxLevel)
2872 std::array<bool, std::tuple_size_v<
decltype(condition->
SkillID)>> results;
2874 for (std::size_t i = 0; i < condition->
SkillID.size(); ++i)
2879 results[i] = skillValue != 0 && skillValue > condition->
MinSkill[i] && skillValue < condition->
MaxSkill[i];
2889 int32 languageSkill = 0;
2891 languageSkill = 300;
2895 languageSkill = std::max<int32>(languageSkill, player->
GetSkillValue(languageDesc.second.SkillId));
2898 if (condition->
MinLanguage && languageSkill < condition->MinLanguage)
2919 std::array<bool, std::tuple_size_v<
decltype(condition->
MinFactionID)> + 1> results;
2921 for (std::size_t i = 0; i < condition->
MinFactionID.size(); ++i)
3005 std::array<bool, std::tuple_size_v<
decltype(condition->
PrevQuestID)>> results;
3007 for (std::size_t i = 0; i < condition->
PrevQuestID.size(); ++i)
3016 std::array<bool, std::tuple_size_v<
decltype(condition->
CurrQuestID)>> results;
3018 for (std::size_t i = 0; i < condition->
CurrQuestID.size(); ++i)
3040 std::array<bool, std::tuple_size_v<
decltype(condition->
SpellID)>> results;
3042 for (std::size_t i = 0; i < condition->
SpellID.size(); ++i)
3050 if (condition->
ItemID[0])
3052 std::array<bool, std::tuple_size_v<
decltype(condition->
ItemID)>> results;
3054 for (std::size_t i = 0; i < condition->
ItemID.size(); ++i)
3055 if (condition->
ItemID[i])
3064 std::array<bool, std::tuple_size_v<
decltype(condition->
CurrencyID)>> results;
3066 for (std::size_t i = 0; i < condition->
CurrencyID.size(); ++i)
3076 for (std::size_t i = 0; i < condition->
Explored.size(); ++i)
3084 std::array<bool, std::tuple_size_v<
decltype(condition->
AuraSpellID)>> results;
3086 for (std::size_t i = 0; i < condition->
AuraSpellID.size(); ++i)
3101 if (condition->
Time[0])
3106 if (condition->
Time[1])
3121 if (!worldStateExpression)
3134 std::array<bool, std::tuple_size_v<
decltype(condition->
Achievement)>> results;
3136 for (std::size_t i = 0; i < condition->
Achievement.size(); ++i)
3152 std::array<bool, std::tuple_size_v<
decltype(condition->
LfgStatus)>> results;
3154 for (std::size_t i = 0; i < condition->
LfgStatus.size(); ++i)
3164 if (condition->
AreaID[0])
3166 std::array<bool, std::tuple_size_v<
decltype(condition->
AreaID)>> results;
3168 for (std::size_t i = 0; i < condition->
AreaID.size(); ++i)
3169 if (condition->
AreaID[i])
3197 std::array<bool, std::tuple_size_v<
decltype(condition->
QuestKillMonster)>> results;
3205 return objective.Type == QUEST_OBJECTIVE_MONSTER && uint32(objective.ObjectID) == condition->QuestKillMonster[i];
3250 return traitEntry.
Rank;
3255 std::array<bool, std::tuple_size_v<
decltype(condition->
TraitNodeEntryID)>> results;
3296 return irand(std::min(arg1, arg2), std::max(arg1, arg2));
3315 return localTime->tm_hour *
MINUTE + localTime->tm_min;
3321 return sRealmList->GetCurrentRealmId().Region;
3328 return currentHour <= 12 ? (currentHour ? currentHour : 12) : currentHour - 12;
3335 return difficulty->OldEnumValue;
3368 uint32 raidOrigin = 1135695600;
3370 raidOrigin = region->Raidorigin;
3372 return (now - raidOrigin) /
WEEK;
3506 std::mt19937 mt(arg2 ? arg2 : 1);
3507 return mt() % arg1 + 1;
3588 switch (operatorType)
3608 return leftValue != 0;
3612 switch (compareLogic)
3633 bool enabled = buffer.
read<
bool>();
3637 bool finalResult =
EvalRelOp(buffer, map);
3642 bool secondResult =
EvalRelOp(buffer, map);
3644 switch (resultLogic)
3653 if (buffer.
rpos() >= buffer.
size())
3673 return unit == otherUnit;
3704 }) !=
nullptr ? value : 0;
3709 }) !=
nullptr ? value : 0;
3714 }) !=
nullptr ? value : 0;
3719 }) !=
nullptr ? value : 0;
3724 }) !=
nullptr ? value : 0;
3729 }) !=
nullptr ? value : 0;
3734 }) !=
nullptr ? value : 0;
3762 float distance = std::max(unit->GetCombatReach() + attacker->GetCombatReach() + 1.3333334f, 5.0f);
3763 if (unit->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) || attacker->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED))
3765 return unit->GetExactDistSq(attacker) < distance * distance;
3811 float distance = std::max(unit->GetCombatReach() + attacker->GetCombatReach() + 1.3333334f, 5.0f);
3812 if (unit->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) || attacker->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED))
3814 return unit->GetExactDistSq(attacker) >= distance * distance;
3821 float distance = std::max(unit->
GetCombatReach() + target->GetCombatReach() + 1.3333334f, 5.0f);
3830 float distance = std::max(unit->
GetCombatReach() + target->GetCombatReach() + 1.3333334f, 5.0f);
3839 return unit->
HasSpell(value) ? value : 0;
3874 return unit->
HasAura(value) ? value : 0;
3909 return unit->
GetLevel() >= levelRange->MinLevel && unit->
GetLevel() <= levelRange->MaxLevel ? value : 0;
3924 }) !=
nullptr ? value : 0;
3944 meets = unitValue == condition->
Value[i];
3947 meets = unitValue != condition->
Value[i];
3950 meets = unitValue < condition->
Value[i];
3953 meets = unitValue <= condition->
Value[i];
3956 meets = unitValue > condition->
Value[i];
3959 meets = unitValue >= condition->
Value[i];
#define sAreaTriggerDataStore
bool PlayerConditionLogic(uint32 logic, std::array< bool, N > &results)
bool PlayerConditionCompare(int32 comparisonType, int32 value1, int32 value2)
int32 GetUnitConditionVariable(Unit const *unit, Unit const *otherUnit, UnitConditionVariable variable, int32 value)
bool EvalRelOp(ByteBuffer &buffer, Map const *map)
int32 EvalSingleValue(ByteBuffer &buffer, Map const *map)
ByteBuffer HexToBytes(const std::string &hex)
int32 EvalValue(ByteBuffer &buffer, Map const *map)
std::vector< Condition > ConditionContainer
@ 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
#define sConversationDataStore
DB2Storage< PhaseEntry > sPhaseStore("Phase.db2", &PhaseLoadInfo::Instance)
DB2Storage< DifficultyEntry > sDifficultyStore("Difficulty.db2", &DifficultyLoadInfo::Instance)
DB2Storage< SkillLineEntry > sSkillLineStore("SkillLine.db2", &SkillLineLoadInfo::Instance)
DB2Storage< AchievementEntry > sAchievementStore("Achievement.db2", &AchievementLoadInfo::Instance)
DB2Storage< MapEntry > sMapStore("Map.db2", &MapLoadInfo::Instance)
DB2Storage< WorldStateExpressionEntry > sWorldStateExpressionStore("WorldStateExpression.db2", &WorldStateExpressionLoadInfo::Instance)
DB2Storage< CharTitlesEntry > sCharTitlesStore("CharTitles.db2", &CharTitlesLoadInfo::Instance)
DB2Storage< ChrSpecializationEntry > sChrSpecializationStore("ChrSpecialization.db2", &ChrSpecializationLoadInfo::Instance)
DB2Storage< SceneScriptPackageEntry > sSceneScriptPackageStore("SceneScriptPackage.db2", &SceneScriptPackageLoadInfo::Instance)
DB2Storage< ScenarioStepEntry > sScenarioStepStore("ScenarioStep.db2", &ScenarioStepLoadInfo::Instance)
DB2Storage< BattlePetSpeciesEntry > sBattlePetSpeciesStore("BattlePetSpecies.db2", &BattlePetSpeciesLoadInfo::Instance)
DB2Storage< AreaTriggerEntry > sAreaTriggerStore("AreaTrigger.db2", &AreaTriggerLoadInfo::Instance)
DB2Storage< Cfg_RegionsEntry > sCfgRegionsStore("Cfg_Regions.db2", &CfgRegionsLoadInfo::Instance)
DB2Storage< PlayerConditionEntry > sPlayerConditionStore("PlayerCondition.db2", &PlayerConditionLoadInfo::Instance)
DB2Storage< AreaTableEntry > sAreaTableStore("AreaTable.db2", &AreaTableLoadInfo::Instance)
DB2Storage< FactionEntry > sFactionStore("Faction.db2", &FactionLoadInfo::Instance)
#define MAX_UNIT_CONDITION_VALUES
@ InLFGFirstRandomDungeon
@ HasHarmfulAuraCanceledByDamage
@ HasHarmfulAuraWithPeriodicDamage
@ LevelWithinContentTuning
@ NumberOfRangedAttackers
@ HasHarmfulAuraDispelType
@ HasHelpfulAuraDispelType
WorldStateExpressionFunctions
WorldStateExpressionValueType
WorldStateExpressionComparisonType
WorldStateExpressionLogic
WorldStateExpressionOperatorType
std::shared_ptr< ResultSet > QueryResult
DatabaseWorkerPool< WorldDatabaseConnection > WorldDatabase
Accessor to the world database.
bool IsHolidayActive(HolidayIds id)
@ GRID_MAP_TYPE_MASK_PLAYER
@ GRID_MAP_TYPE_MASK_CREATURE
@ GRID_MAP_TYPE_MASK_GAMEOBJECT
@ GRID_MAP_TYPE_MASK_CORPSE
@ GRID_MAP_TYPE_MASK_AREATRIGGER
#define TC_LOG_DEBUG(filterType__, message__,...)
#define TC_LOG_ERROR(filterType__, message__,...)
#define TC_LOG_INFO(filterType__, message__,...)
LootStore LootTemplates_Spell("spell_loot_template", "spell id (random item creating)", false)
LootStore LootTemplates_Skinning("skinning_loot_template", "creature skinning id", true)
LootStore LootTemplates_Gameobject("gameobject_loot_template", "gameobject entry", true)
LootStore LootTemplates_Item("item_loot_template", "item entry", true)
LootStore LootTemplates_Milling("milling_loot_template", "item entry (herb)", true)
LootStore LootTemplates_Reference("reference_loot_template", "reference id", false)
LootStore LootTemplates_Disenchant("disenchant_loot_template", "item disenchant id", true)
LootStore LootTemplates_Prospecting("prospecting_loot_template", "item entry (ore)", true)
LootStore LootTemplates_Creature("creature_loot_template", "creature entry", true)
LootStore LootTemplates_Pickpocketing("pickpocketing_loot_template", "creature pickpocket lootid", true)
LootStore LootTemplates_Mail("mail_loot_template", "mail template id", false)
LootStore LootTemplates_Fishing("fishing_loot_template", "area id", true)
#define NUM_CLIENT_OBJECT_TYPES
std::pair< GossipMenusContainer::iterator, GossipMenusContainer::iterator > GossipMenusMapBoundsNonConst
std::optional< T > Optional
Optional helper class to wrap optional values within.
@ EQUIPMENT_SLOT_MAINHAND
#define INVENTORY_SLOT_BAG_0
#define MAX_QUEST_LOG_SIZE
@ QUEST_STATUS_INCOMPLETE
int32 irand(int32 min, int32 max)
if(posix_memalign(&__mallocedMemory, __align, __size)) return NULL
@ CREATURE_TYPE_GAS_CLOUD
@ SPELL_EFFECT_APPLY_AREA_AURA_PARTY
@ SPELL_EFFECT_APPLY_AREA_AURA_FRIEND
@ SPELL_EFFECT_APPLY_AREA_AURA_PARTY_NONRANDOM
@ SPELL_EFFECT_APPLY_AURA_ON_PET
@ SPELL_EFFECT_APPLY_AREA_AURA_PET
@ SPELL_EFFECT_APPLY_AREA_AURA_RAID
@ SPELL_EFFECT_PERSISTENT_AREA_AURA
@ SPELL_EFFECT_APPLY_AREA_AURA_ENEMY
@ SPELL_EFFECT_APPLY_AREA_AURA_SUMMONS
@ SPELL_EFFECT_APPLY_AREA_AURA_OWNER
#define CLASSMASK_ALL_PLAYABLE
@ SPELL_AURA_PERIODIC_DAMAGE
@ SPELL_AURA_COMPREHEND_LANGUAGE
@ TARGET_SELECT_CATEGORY_CONE
@ TARGET_SELECT_CATEGORY_AREA
@ TARGET_SELECT_CATEGORY_NEARBY
@ TARGET_SELECT_CATEGORY_LINE
@ TARGET_SELECT_CATEGORY_TRAJ
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
@ UNIT_STAND_STATE_SUBMERGED
@ MOVEMENTFLAG_STRAFE_LEFT
@ MOVEMENTFLAG_STRAFE_RIGHT
@ UNIT_FLAG_PLAYER_CONTROLLED
@ UNIT_STATE_ALL_STATE_SUPPORTED
bool CompareValues(ComparisionType type, T val1, T val2)
constexpr std::underlying_type< E >::type AsUnderlyingType(E enumValue)
uint32 GetEffectMask() const
AuraApplication const * GetApplicationOfTarget(ObjectGuid guid) const
SpellInfo const * GetSpellInfo() const
bool isConditionTypeValid(Condition *cond) const
bool IsSpellUsedInSpellClickConditions(uint32 spellId) const
std::unordered_set< uint32 > SpellsUsedInSpellClickConditions
void addToLootTemplate(ConditionId const &id, std::shared_ptr< std::vector< Condition > > conditions, LootTemplate *loot) const
bool IsObjectMeetingVendorItemConditions(uint32 creatureId, uint32 itemId, Player const *player, Creature const *vendor) const
bool IsObjectMeetToConditions(WorldObject const *object, ConditionContainer const &conditions) const
bool isSourceTypeValid(Condition *cond) const
uint32 GetSearcherTypeMaskForConditionList(ConditionContainer const &conditions) const
bool IsObjectMeetingNotGroupedConditions(ConditionSourceType sourceType, uint32 entry, ConditionSourceInfo &sourceInfo) const
static ConditionMgr * instance()
static bool IsMeetingWorldStateExpression(Map const *map, WorldStateExpressionEntry const *expression)
void addToGraveyardData(ConditionId const &id, std::shared_ptr< std::vector< Condition > > conditions) const
bool HasConditionsForNotGroupedEntry(ConditionSourceType sourceType, uint32 entry) const
bool IsObjectMeetToConditionList(ConditionSourceInfo &sourceInfo, ConditionContainer const &conditions) const
bool IsObjectMeetingSpellClickConditions(uint32 creatureId, uint32 spellId, WorldObject const *clicker, WorldObject const *target) const
static bool IsUnitMeetingCondition(Unit const *unit, Unit const *otherUnit, UnitConditionEntry const *condition)
bool HasConditionsForSpellClickEvent(uint32 creatureId, uint32 spellId) const
static void LogUselessConditionValue(Condition const *cond, uint8 index, uint32 value)
bool IsMapMeetingNotGroupedConditions(ConditionSourceType sourceType, uint32 entry, Map const *map) const
bool IsObjectMeetingTrainerSpellConditions(uint32 trainerId, uint32 spellId, Player *player) const
ConditionEntriesByTypeArray ConditionStore
ConditionContainer const * GetConditionsForAreaTrigger(uint32 areaTriggerId, bool isServerSide) const
void addToSpellImplicitTargetConditions(Condition const &cond) const
static bool IsPlayerMeetingCondition(Player const *player, uint32 conditionId)
bool IsObjectMeetingVisibilityByObjectIdConditions(WorldObject const *obj, WorldObject const *seer) const
void addToPhases(ConditionId const &id, std::shared_ptr< std::vector< Condition > > conditions) const
bool IsObjectMeetingSmartEventConditions(int64 entryOrGuid, uint32 eventId, uint32 sourceType, Unit const *unit, WorldObject const *baseObject) const
static bool CanHaveSourceGroupSet(ConditionSourceType sourceType)
void addToGossipMenuItems(ConditionId const &id, std::shared_ptr< std::vector< Condition > > conditions) const
void addToGossipMenus(ConditionId const &id, std::shared_ptr< std::vector< Condition > > conditions) const
static char const *const StaticSourceTypeData[CONDITION_SOURCE_TYPE_MAX_DB_ALLOWED]
static uint32 GetPlayerConditionLfgValue(Player const *player, PlayerConditionLfgStatus status)
static bool CanHaveConditionType(ConditionSourceType sourceType, ConditionTypes conditionType)
static bool CanHaveSourceIdSet(ConditionSourceType sourceType)
static ConditionTypeInfo const StaticConditionTypeData[CONDITION_MAX]
bool IsObjectMeetingVehicleSpellConditions(uint32 creatureId, uint32 spellId, Player const *player, Unit const *vehicle) const
void LoadConditions(bool isReload=false)
bool HasLabel(int32 cretureLabel) const
static bool IsInArea(uint32 objectAreaId, uint32 areaId)
constexpr bool HasFlag(T flag) const
Class used to access individual fields of database query result.
std::string GetString() const
std::vector< GameEventData > GameEventDataMap
ItemTemplate const * GetTemplate() const
LootTemplate * GetLootForConditionFill(uint32 loot_id)
bool HaveLootFor(uint32 loot_id) const
bool LinkConditions(ConditionId const &id, ConditionsReference reference)
bool IsBattlegroundOrArena() const
BattlegroundMap * ToBattlegroundMap()
Difficulty GetDifficultyID() const
InstanceMap * ToInstanceMap()
WeatherState GetZoneWeather(uint32 zoneId) const
std::string ToString() const
static Creature * ToCreature(Object *o)
static Unit * ToUnit(Object *o)
static GameObject * ToGameObject(Object *o)
static ObjectGuid GetGUID(Object const *o)
static Player * ToPlayer(Object *o)
static bool InDbPhaseShift(WorldObject const *object, uint8 phaseUseFlags, uint16 phaseId, uint32 phaseGroupId)
ChrSpecialization GetPrimarySpecialization() const
UF::UpdateField< UF::PlayerData, int32(WowCS::EntityFragment::CGObject), TYPEID_PLAYER > m_playerData
Gender GetNativeGender() const override
uint16 GetSkillValue(uint32 skill) const
UF::UpdateField< UF::ActivePlayerData, int32(WowCS::EntityFragment::CGObject), TYPEID_ACTIVE_PLAYER > m_activePlayerData
uint16 FindQuestSlot(uint32 quest_id) const
bool IsQuestCompletedBitSet(uint32 questId) const
bool CanRewardQuest(Quest const *quest, bool msg) const
uint32 GetItemCount(uint32 item, bool inBankAlso=false, Item *skipItem=nullptr) const
bool HasAchieved(uint32 achievementId) const
WorldSession * GetSession() const
Item * GetItemByPos(uint16 pos) const
bool ModifierTreeSatisfied(uint32 modifierTreeId) const
bool HasExploredZone(uint32 areaId) const
bool IsGameMaster() const
QuestStatus GetQuestStatus(uint32 quest_id) const
static bool IsValidGender(uint8 Gender)
ReputationRank GetReputationRank(uint32 faction_id) const
bool HasSpell(uint32 spell) const override
Group * GetGroup(Optional< uint8 > partyIndex)
int32 GetQuestSlotObjectiveData(uint16 slot, QuestObjective const &objective) const
ChrSpecializationEntry const * GetPrimarySpecializationEntry() const
ReputationMgr & GetReputationMgr()
static DrunkenState GetDrunkenstateByValue(uint8 value)
uint32 GetCurrencyQuantity(uint32 id) const
QuestObjectives const & GetObjectives() const
ReputationRank const * GetForcedRankIfAny(FactionTemplateEntry const *factionTemplateEntry) const
::Difficulty const Difficulty
SpellSchoolMask GetSchoolMask() const
uint64 GetSpellMechanicMaskByEffectMask(uint32 effectMask) const
SpellEffectInfo const & GetEffect(SpellEffIndex index) const
std::vector< SpellEffectInfo > const & GetEffects() const
size_t GetThreatListSize() const
Utility class to enable range for loop syntax for multimap.equal_range uses.
uint32 GetChannelSpellId() const
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
float GetHealthPct() const
uint32 GetUnitMovementFlags() const
ThreatManager & GetThreatManager()
bool HasAuraTypeWithMiscvalue(AuraType auraType, int32 miscValue) const
std::array< ObjectGuid, MAX_SUMMON_SLOT > m_SummonSlot
uint32 GetClassMask() const
uint32 GetMountDisplayId() const
ObjectGuid GetOwnerGUID() const override
bool HasUnitFlag(UnitFlags flags) const
ObjectGuid GetCharmedGUID() const
float GetCombatReach() const override
int32 GetMaxPower(Powers power) const
ObjectGuid GetCharmerOrOwnerGUID() const override
virtual bool HasSpell(uint32) const
ObjectGuid GetCreatorGUID() const override
bool IsOnVehicle(Unit const *vehicle) const
uint32 GetCreatureType() const
bool HasNegativeAuraWithInterruptFlag(InterruptFlags flag, ObjectGuid guid=ObjectGuid::Empty) const
uint32 GetVirtualItemId(uint32 slot) const
uint32 GetAuraCount(uint32 spellId) const
ObjectGuid GetMinionGUID() const
bool HasUnitMovementFlag(uint32 f) const
AttackerSet const & getAttackers() const
bool HasAuraType(AuraType auraType) const
ObjectGuid GetCritterGUID() const
uint32 GetExtraUnitMovementFlags() const
int32 GetPower(Powers power) const
bool IsInRaidWith(Unit const *unit) const
float GetPowerPct(Powers power) const
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
ObjectGuid GetCharmerGUID() const
AuraApplication * GetAuraApplication(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraApplication *except=nullptr) const
bool IsInPartyWith(Unit const *unit) const
ObjectGuid GetTarget() const
Spell * GetCurrentSpell(CurrentSpellTypes spellType) const
constexpr uint32 GetMapId() const
bool IsValidAttackTarget(WorldObject const *target, SpellInfo const *bySpell=nullptr) const
ReputationRank GetReactionTo(WorldObject const *target) const
bool IsValidAssistTarget(WorldObject const *target, SpellInfo const *bySpell=nullptr) const
float GetDistance(WorldObject const *obj) const
uint8 GetExpansion() const
void SetPackedTime(uint32 packedTime)
bool IsInRange(WowTime const &from, WowTime const &to) const
virtual uint32 GetData(uint32) const
virtual uint64 GetData64(uint32) const
ObjectData const creatureData[]
@ DEFAULT_MAX_BATTLE_PETS_PER_SPECIES
WowTime const * GetWowTime()
tm const * GetDateAndTime()
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
TC_COMMON_API void HexStrToByteArray(std::string_view str, uint8 *out, size_t outlen, bool reverse=false)
constexpr TypeMask ConvertLegacyTypeMask(uint32 legacyTypeMask)
constexpr ::TypeID ConvertLegacyTypeID(TypeID legacyTypeID)
void hash_combine(std::size_t &seed, T const &val)
constexpr std::size_t size()
TC_PROTO_API ::google::protobuf::internal::ExtensionIdentifier< ::google::protobuf::FieldOptions, ::google::protobuf::internal::MessageTypeTraits< ::bgs::protocol::FieldRestriction >, 11, false > valid
EnumFlag< AreaFlags > GetFlags() const
EnumFlag< ChrSpecializationFlag > GetFlags() const
ChrSpecializationRole GetRole() const
std::size_t GetHash() const
bool HasConditionStringValue1
ConditionSourceInfo(WorldObject const *target0, WorldObject const *target1=nullptr, WorldObject const *target2=nullptr)
Condition const * mLastFailedCondition
WorldObject const * mConditionTargets[MAX_CONDITION_TARGETS]
Map const * mConditionMap
ConditionTypes ConditionType
std::string ToString(bool ext=false) const
std::string ConditionStringValue1
uint32 GetSearcherTypeMaskForCondition() const
ConditionSourceType SourceType
uint32 GetMaxAvailableConditionTargets() const
bool Meets(ConditionSourceInfo &sourceInfo) const
uint32 GetSubClass() const
std::array< int32, 4 > AuraSpellID
std::array< int32, 4 > TraitNodeEntryID
std::array< uint32, 4 > ItemCount
std::array< uint32, 2 > Time
uint16 WorldStateExpressionID
std::array< uint32, 4 > LfgValue
std::array< uint8, 4 > LfgCompare
std::array< uint16, 4 > MaxSkill
std::array< uint16, 4 > TraitNodeEntryMaxRank
std::array< uint16, 4 > Achievement
uint32 CurrentCompletedQuestLogic
std::array< int32, 4 > CurrentCompletedQuestID
std::array< uint8, 4 > LfgStatus
std::array< int32, 4 > PrevQuestID
std::array< int32, 4 > CurrQuestID
std::array< uint16, 4 > SkillID
int8 ChrSpecializationRole
std::array< int32, 2 > MovementFlags
std::array< uint16, 2 > Explored
uint16 MinAvgEquippedItemLevel
std::array< uint32, 3 > MinFactionID
std::array< uint32, 4 > CurrencyCount
std::array< uint8, 4 > AuraStacks
std::array< uint16, 4 > AreaID
int8 ChrSpecializationIndex
std::array< uint32, 6 > QuestKillMonster
std::array< uint16, 4 > MinSkill
std::array< uint8, 3 > MinReputation
std::array< uint16, 4 > TraitNodeEntryMinRank
std::array< int32, 4 > ItemID
Trinity::RaceMask< int64 > RaceMask
std::array< int32, 4 > SpellID
uint16 MaxAvgEquippedItemLevel
uint32 TraitNodeEntryLogic
std::array< uint32, 4 > CurrencyID
float GetExactDist(float x, float y, float z) const
constexpr float GetExactDistSq(float x, float y, float z) const
bool IsStoringFlag() const
constexpr bool HasRace(uint8 raceId) const
constexpr bool IsEmpty() const
UpdateField< int32, 4, 6 > Type
DynamicUpdateField< UF::TraitEntry, 0, 1 > Entries
UpdateField< int32, 0, 3 > ID
UpdateField< int32, 8, 10 > CombatConfigFlags
EnumFlag< UnitConditionFlags > GetFlags() const
std::array< int32, MAX_UNIT_CONDITION_VALUES > Value
std::array< uint8, MAX_UNIT_CONDITION_VALUES > Variable
std::array< uint8, MAX_UNIT_CONDITION_VALUES > Op