Core/Conditions: Sync CONDITION_QUEST_OBJECTIVE_PROGRESS implementation with 3.3.5

This commit is contained in:
Shauren
2021-12-11 16:04:29 +01:00
parent a032d84cf4
commit 3d3d255a47
3 changed files with 68 additions and 58 deletions

View File

@@ -0,0 +1,4 @@
UPDATE `conditions` SET `ConditionValue3`=1 WHERE `ConditionTypeOrReference`=48 AND `ConditionValue1`=395159;
UPDATE `conditions` SET `ConditionValue3`=1 WHERE `ConditionTypeOrReference`=48 AND `ConditionValue1`=395215;
UPDATE `conditions` SET `ConditionValue3`=1 WHERE `ConditionTypeOrReference`=48 AND `ConditionValue1`=406783;
UPDATE `conditions` SET `ConditionValue3`=1 WHERE `ConditionTypeOrReference`=48 AND `ConditionValue1`=406784;

View File

@@ -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:

View File

@@ -102,7 +102,7 @@ enum ConditionTypes
CONDITION_PET_TYPE = 45, // mask 0 0 true if player has a pet of given type(s)
CONDITION_TAXI = 46, // 0 0 0 true if player is on taxi
CONDITION_QUESTSTATE = 47, // quest_id state_mask 0 true if player is in any of the provided quest states for the quest (1 = not taken, 2 = completed, 8 = in progress, 32 = failed, 64 = rewarded)
CONDITION_QUEST_OBJECTIVE_COMPLETE = 48, // ID 0 0 true if player has ID objective complete, but quest not yet rewarded
CONDITION_QUEST_OBJECTIVE_PROGRESS = 48, // ID 0 0 true if player has ID objective complete, but quest not yet rewarded
CONDITION_DIFFICULTY_ID = 49, // Difficulty 0 0 true is map has difficulty id
CONDITION_GAMEMASTER = 50, // canBeGM 0 0 true if player is gamemaster (or can be gamemaster)
CONDITION_OBJECT_ENTRY_GUID = 51, // TypeID entry guid true if object is type TypeID and the entry is 0 or matches entry of the object or matches guid of the object