diff options
author | Shauren <shauren.trinity@gmail.com> | 2021-12-11 16:04:29 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2021-12-11 16:13:45 +0100 |
commit | 3d3d255a47725398fd4d011a1a01eee141691ec4 (patch) | |
tree | 25e00aed50586ae0b10c00ada07c294476a37414 /src/server/game/Conditions/ConditionMgr.cpp | |
parent | a032d84cf4cf8aca262e6ca6352ad1e82b3e245f (diff) |
Core/Conditions: Sync CONDITION_QUEST_OBJECTIVE_PROGRESS implementation with 3.3.5
Diffstat (limited to 'src/server/game/Conditions/ConditionMgr.cpp')
-rw-r--r-- | src/server/game/Conditions/ConditionMgr.cpp | 120 |
1 files changed, 63 insertions, 57 deletions
diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index dcb67d0f631..b59fd335112 100644 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -87,59 +87,59 @@ char const* const ConditionMgr::StaticSourceTypeData[CONDITION_SOURCE_TYPE_MAX] ConditionMgr::ConditionTypeInfo const ConditionMgr::StaticConditionTypeData[CONDITION_MAX] = { - { "None", false, false, false }, - { "Aura", true, true, true }, - { "Item Stored", true, true, true }, - { "Item Equipped", true, false, false }, - { "Zone", true, false, false }, - { "Reputation", true, true, false }, - { "Team", true, false, false }, - { "Skill", true, true, false }, - { "Quest Rewarded", true, false, false }, - { "Quest Taken", true, false, false }, - { "Drunken", true, false, false }, - { "WorldState", true, true, false }, - { "Active Event", true, false, false }, - { "Instance Info", true, true, true }, - { "Quest None", true, false, false }, - { "Class", true, false, false }, - { "Race", true, false, false }, - { "Achievement", true, false, false }, - { "Title", true, false, false }, - { "SpawnMask", true, false, false }, - { "Gender", true, false, false }, - { "Unit State", true, false, false }, - { "Map", true, false, false }, - { "Area", true, false, false }, - { "CreatureType", true, false, false }, - { "Spell Known", true, false, false }, - { "Phase", true, false, false }, - { "Level", true, true, false }, - { "Quest Completed", true, false, false }, - { "Near Creature", true, true, true }, - { "Near GameObject", true, true, false }, - { "Object Entry or Guid", true, true, true }, - { "Object TypeMask", true, false, false }, - { "Relation", true, true, false }, - { "Reaction", true, true, false }, - { "Distance", true, true, true }, - { "Alive", false, false, false }, - { "Health Value", true, true, false }, - { "Health Pct", true, true, false }, - { "Realm Achievement", true, false, false }, - { "In Water", false, false, false }, - { "Terrain Swap", true, false, false }, - { "Sit/stand state", true, true, false }, - { "Daily Quest Completed",true, false, false }, - { "Charmed", false, false, false }, - { "Pet type", true, false, false }, - { "On Taxi", false, false, false }, - { "Quest state mask", true, true, false }, - { "Objective Complete", true, false, false }, - { "Map Difficulty", true, false, false }, - { "Is Gamemaster", true, false, false }, - { "Object Entry or Guid", true, true, true }, - { "Object TypeMask", true, false, false }, + { "None", false, false, false }, + { "Aura", true, true, true }, + { "Item Stored", true, true, true }, + { "Item Equipped", true, false, false }, + { "Zone", true, false, false }, + { "Reputation", true, true, false }, + { "Team", true, false, false }, + { "Skill", true, true, false }, + { "Quest Rewarded", true, false, false }, + { "Quest Taken", true, false, false }, + { "Drunken", true, false, false }, + { "WorldState", true, true, false }, + { "Active Event", true, false, false }, + { "Instance Info", true, true, true }, + { "Quest None", true, false, false }, + { "Class", true, false, false }, + { "Race", true, false, false }, + { "Achievement", true, false, false }, + { "Title", true, false, false }, + { "SpawnMask", true, false, false }, + { "Gender", true, false, false }, + { "Unit State", true, false, false }, + { "Map", true, false, false }, + { "Area", true, false, false }, + { "CreatureType", true, false, false }, + { "Spell Known", true, false, false }, + { "Phase", true, false, false }, + { "Level", true, true, false }, + { "Quest Completed", true, false, false }, + { "Near Creature", true, true, true }, + { "Near GameObject", true, true, false }, + { "Object Entry or Guid", true, true, true }, + { "Object TypeMask", true, false, false }, + { "Relation", true, true, false }, + { "Reaction", true, true, false }, + { "Distance", true, true, true }, + { "Alive", false, false, false }, + { "Health Value", true, true, false }, + { "Health Pct", true, true, false }, + { "Realm Achievement", true, false, false }, + { "In Water", false, false, false }, + { "Terrain Swap", true, false, false }, + { "Sit/stand state", true, true, false }, + { "Daily Quest Completed", true, false, false }, + { "Charmed", false, false, false }, + { "Pet type", true, false, false }, + { "On Taxi", false, false, false }, + { "Quest state mask", true, true, false }, + { "Quest objective progress", true, false, true }, + { "Map Difficulty", true, false, false }, + { "Is Gamemaster", true, false, false }, + { "Object Entry or Guid", true, true, true }, + { "Object TypeMask", true, false, false }, }; // Checks if object meets the condition @@ -524,7 +524,7 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) const } break; } - case CONDITION_QUEST_OBJECTIVE_COMPLETE: + case CONDITION_QUEST_OBJECTIVE_PROGRESS: { if (Player* player = object->ToPlayer()) { @@ -540,7 +540,7 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) const if (slot >= MAX_QUEST_LOG_SIZE) break; - condMeets = (!player->GetQuestRewardStatus(obj->QuestID) && player->IsQuestObjectiveComplete(slot, quest, *obj)); + condMeets = player->GetQuestSlotObjectiveData(slot, *obj) == int32(ConditionValue3); } break; } @@ -752,7 +752,7 @@ uint32 Condition::GetSearcherTypeMaskForCondition() const case CONDITION_QUESTSTATE: mask |= GRID_MAP_TYPE_MASK_PLAYER; break; - case CONDITION_QUEST_OBJECTIVE_COMPLETE: + case CONDITION_QUEST_OBJECTIVE_PROGRESS: mask |= GRID_MAP_TYPE_MASK_PLAYER; break; case CONDITION_DIFFICULTY_ID: @@ -2452,7 +2452,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) const } break; } - case CONDITION_QUEST_OBJECTIVE_COMPLETE: + case CONDITION_QUEST_OBJECTIVE_PROGRESS: { QuestObjective const* obj = sObjectMgr->GetQuestObjective(cond->ConditionValue1); if (!obj) @@ -2460,6 +2460,12 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) const TC_LOG_ERROR("sql.sql", "%s points to non-existing quest objective (%u), skipped.", cond->ToString(true).c_str(), cond->ConditionValue1); return false; } + int32 limit = obj->IsStoringFlag() ? 1 : obj->Amount; + if (int32(cond->ConditionValue3) > limit) + { + TC_LOG_ERROR("sql.sql", "%s has quest objective count %u in value3, but quest objective %u has a maximum objective count of %u, skipped.", cond->ToString(true).c_str(), cond->ConditionValue3, cond->ConditionValue1, limit); + return false; + } break; } case CONDITION_PET_TYPE: |