Fix IsComplete returning 0 when all objectives are finished
The inline ternary short-circuited to 0 as soon as objectives[1] existed, regardless of whether all objectives were done. This caused quests using consumable key items (e.g. Cold Iron Key for quest 12843) to incorrectly return IsComplete=0 after using the key, since the key is no longer in the bag (CheckQuestSourceItem=false) and questLogEntry.isComplete is not set by the server until after explicit turn-in. Now iterates questLogEntry.objectives and returns 1 if all are finished, so PopulateObjectiveNotes routes to AddFinisher correctly.
This commit is contained in:
+21
-1
@@ -1078,10 +1078,30 @@ function QuestieDB.IsComplete(questId)
|
|||||||
if has questLogEntry.isComplete then return questLogEntry.isComplete
|
if has questLogEntry.isComplete then return questLogEntry.isComplete
|
||||||
if no objectives and an item is needed but not obtained then return 0
|
if no objectives and an item is needed but not obtained then return 0
|
||||||
if no objectives then return 1
|
if no objectives then return 1
|
||||||
|
if all objectives are finished then return 1
|
||||||
return 0
|
return 0
|
||||||
--]]
|
--]]
|
||||||
|
|
||||||
return questLogEntry and (questLogEntry.isComplete or (questLogEntry.objectives[1] and 0) or (#questLogEntry.objectives == 0 and noQuestItem and 0) or 1) or 0
|
if not questLogEntry then return 0 end
|
||||||
|
if questLogEntry.isComplete then return questLogEntry.isComplete end
|
||||||
|
|
||||||
|
local objectives = questLogEntry.objectives
|
||||||
|
if not objectives or #objectives == 0 then
|
||||||
|
return (noQuestItem and 0) or 1
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Check if every objective is finished. Some quests consume their source item (e.g. Cold Iron Key)
|
||||||
|
-- so CheckQuestSourceItem returns false even though all objectives are done. We should not return 0
|
||||||
|
-- in that case because it causes Questie to draw the item-drop NPC on the map instead of the finisher.
|
||||||
|
local allDone = true
|
||||||
|
for _, obj in ipairs(objectives) do
|
||||||
|
if not obj.finished then
|
||||||
|
allDone = false
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return allDone and 1 or 0
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param self Quest
|
---@param self Quest
|
||||||
|
|||||||
Reference in New Issue
Block a user