From 97730e14ad346b2f3e3acbfd513325f3ff0b2921 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Wed, 22 Dec 2021 20:30:31 -0500 Subject: [PATCH] Core/Conditions: Sync CONDITION_QUEST_OBJECTIVE_PROGRESS implementation Port From (https://github.com/TrinityCore/TrinityCore/commit/3d3d255a47725398fd4d011a1a01eee141691ec4) --- Source/Framework/Constants/ConditionConst.cs | 2 +- Source/Game/Conditions/Condition.cs | 6 +++--- Source/Game/Conditions/ConditionManager.cs | 10 ++++++++-- sql/updates/world/master/2021_12_11_22_world.sql | 4 ++++ 4 files changed, 16 insertions(+), 6 deletions(-) create mode 100644 sql/updates/world/master/2021_12_11_22_world.sql diff --git a/Source/Framework/Constants/ConditionConst.cs b/Source/Framework/Constants/ConditionConst.cs index 8d1ca5b21..e02af6b49 100644 --- a/Source/Framework/Constants/ConditionConst.cs +++ b/Source/Framework/Constants/ConditionConst.cs @@ -67,7 +67,7 @@ namespace Framework.Constants PetType = 45, // mask 0 0 true if player has a pet of given type(s) Taxi = 46, // 0 0 0 true if player is on taxi 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) - ObjectiveComplete = 48, // ID 0 0 true if player has ID objective complete, but quest not yet rewarded + ObjectiveProgress = 48, // ID 0 0 true if player has ID objective complete, but quest not yet rewarded DifficultyId = 49, // Difficulty 0 0 true is map has difficulty id Gamemaster = 50, // canBeGM 0 0 true if player is gamemaster (or can be gamemaster) ObjectEntryGuid = 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 diff --git a/Source/Game/Conditions/Condition.cs b/Source/Game/Conditions/Condition.cs index 1e290daf3..2c79ca801 100644 --- a/Source/Game/Conditions/Condition.cs +++ b/Source/Game/Conditions/Condition.cs @@ -357,7 +357,7 @@ namespace Game.Conditions } break; } - case ConditionTypes.ObjectiveComplete: + case ConditionTypes.ObjectiveProgress: { if (player) { @@ -373,7 +373,7 @@ namespace Game.Conditions if (slot >= SharedConst.MaxQuestLogSize) break; - condMeets = (!player.GetQuestRewardStatus(questObj.QuestID) && player.IsQuestObjectiveComplete(slot, quest, questObj)); + condMeets = player.GetQuestSlotObjectiveData(slot, questObj) == ConditionValue3; } break; } @@ -502,7 +502,7 @@ namespace Game.Conditions mask |= GridMapTypeMask.AreaTrigger; break; case ConditionTypes.DailyQuestDone: - case ConditionTypes.ObjectiveComplete: + case ConditionTypes.ObjectiveProgress: mask |= GridMapTypeMask.Player; break; default: diff --git a/Source/Game/Conditions/ConditionManager.cs b/Source/Game/Conditions/ConditionManager.cs index afe0528cf..d59eebb77 100644 --- a/Source/Game/Conditions/ConditionManager.cs +++ b/Source/Game/Conditions/ConditionManager.cs @@ -1625,7 +1625,7 @@ namespace Game } break; } - case ConditionTypes.ObjectiveComplete: + case ConditionTypes.ObjectiveProgress: { QuestObjective obj = Global.ObjectMgr.GetQuestObjective(cond.ConditionValue1); if (obj == null) @@ -1633,6 +1633,12 @@ namespace Game Log.outError(LogFilter.Sql, "{0} points to non-existing quest objective ({1}), skipped.", cond.ToString(true), cond.ConditionValue1); return false; } + int limit = obj.IsStoringFlag() ? 1 : obj.Amount; + if (cond.ConditionValue3 > limit) + { + Log.outError(LogFilter.Sql, $"{cond.ToString(true)} has quest objective count {cond.ConditionValue3} in value3, but quest objective {cond.ConditionValue1} has a maximum objective count of {limit}, skipped."); + return false; + } break; } case ConditionTypes.PetType: @@ -2573,7 +2579,7 @@ namespace Game new ConditionTypeInfo("Pet type", true, false, false), new ConditionTypeInfo("On Taxi", false,false, false), new ConditionTypeInfo("Quest state mask", true, true, false), - new ConditionTypeInfo("Objective Complete", true, false, false), + new ConditionTypeInfo("Quest objective progress", true, false, true), new ConditionTypeInfo("Map Difficulty", true, false, false), new ConditionTypeInfo("Is Gamemaster", true, false, false), new ConditionTypeInfo("Object Entry or Guid", true, true, true), diff --git a/sql/updates/world/master/2021_12_11_22_world.sql b/sql/updates/world/master/2021_12_11_22_world.sql new file mode 100644 index 000000000..f1d3a4396 --- /dev/null +++ b/sql/updates/world/master/2021_12_11_22_world.sql @@ -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;