diff --git a/Modules/Quest/QuestEventHandler.lua b/Modules/Quest/QuestEventHandler.lua index bf47028..c87b9bd 100644 --- a/Modules/Quest/QuestEventHandler.lua +++ b/Modules/Quest/QuestEventHandler.lua @@ -237,7 +237,8 @@ end ---@param questLogIndex number ---@param questId number function _QuestEventHandler:QuestAccepted(questLogIndex, questId) - questId = questId or select(8, GetQuestLogTitle(questLogIndex)) + local _, _, _, _, _, _, _, questLogQuestId = GetQuestLogTitle(questLogIndex) + questId = questId or questLogQuestId Questie:Debug(Questie.DEBUG_DEVELOP, "[Quest Event] QUEST_ACCEPTED", questLogIndex, questId) if questLog[questId] and questLog[questId].timer then diff --git a/Modules/QuestiePlayer.lua b/Modules/QuestiePlayer.lua index 5f5ba0b..9689051 100644 --- a/Modules/QuestiePlayer.lua +++ b/Modules/QuestiePlayer.lua @@ -120,7 +120,8 @@ function QuestiePlayer:GetCurrentZoneId() return uiMapId end - return ZoneDB.instanceIdToUiMapId[select(8, GetInstanceInfo())] + local _, _, _, _, _, _, _, instanceMapID = GetInstanceInfo() + return ZoneDB.instanceIdToUiMapId[instanceMapID] end function QuestiePlayer:GetCurrentUiMapId() @@ -129,7 +130,8 @@ function QuestiePlayer:GetCurrentUiMapId() if uiMapId then return uiMapId end - return ZoneDB.instanceIdToUiMapId[select(8, GetInstanceInfo())] + local _, _, _, _, _, _, _, instanceMapID = GetInstanceInfo() + return ZoneDB.instanceIdToUiMapId[instanceMapID] end ---@return number diff --git a/Modules/Tracker/QuestieTracker.lua b/Modules/Tracker/QuestieTracker.lua index be3cc90..f456ef1 100644 --- a/Modules/Tracker/QuestieTracker.lua +++ b/Modules/Tracker/QuestieTracker.lua @@ -413,7 +413,7 @@ function QuestieTracker.Initialize() for i = 1, questsWatched do local questIndex = GetQuestIndexForWatch(i) if questIndex then - local questId = select(8, GetQuestLogTitle(questIndex)) + local _, _, _, _, _, _, _, questId = GetQuestLogTitle(questIndex) if questId then tempQuestIDs[i] = questId end @@ -2277,7 +2277,7 @@ function QuestieTracker:HookBaseTracker() -- Intercept and return a Questie boolean value IsQuestWatched = function(index) - local questId = select(8, GetQuestLogTitle(index)) + local _, _, _, _, _, _, _, questId = GetQuestLogTitle(index) if questId == 0 then -- When an objective progresses in TBC "index" is the questId, but when a quest is manually added to the quest watch -- (e.g. shift clicking it in the quest log) "index" is the questLogIndex. diff --git a/Tests/AuditFindings_spec.lua b/Tests/AuditFindings_spec.lua index 0838df2..e7a600c 100644 --- a/Tests/AuditFindings_spec.lua +++ b/Tests/AuditFindings_spec.lua @@ -197,10 +197,21 @@ describe("Audit Pass 9 - file-by-file findings (snapshot at HEAD)", function() assert.is_true(has(d, "if(dbItem and dbItem.name and (not dbItem.Hidden)) then")) end) - it("[N5] select(8, GetInstanceInfo()) left in QuestiePlayer (5.0 rewrite unfinished)", function() - assert.is_true(has(read("Modules/QuestiePlayer.lua"), "select(8, GetInstanceInfo())")) - -- QuestieLearner was rewritten away from it: - assert.is_true(has(read("Modules/QuestieLearner.lua"), "Lua 5.0 compat")) + it("[N5] explicit unpack replaced select(8, ...) in live quest/instance lookups", function() + local player = read("Modules/QuestiePlayer.lua") + local handler = read("Modules/Quest/QuestEventHandler.lua") + local tracker = read("Modules/Tracker/QuestieTracker.lua") + + assert.is_true(has(player, "local _, _, _, _, _, _, _, instanceMapID = GetInstanceInfo()")) + assert.is_false(has(player, "select(8, GetInstanceInfo())")) + + assert.is_true(has(handler, "local _, _, _, _, _, _, _, questLogQuestId = GetQuestLogTitle(questLogIndex)")) + assert.is_false(has(handler, "select(8, GetQuestLogTitle(questLogIndex))")) + + assert.is_true(has(tracker, "local _, _, _, _, _, _, _, questId = GetQuestLogTitle(questIndex)")) + assert.is_true(has(tracker, "local _, _, _, _, _, _, _, questId = GetQuestLogTitle(index)")) + assert.is_false(has(tracker, "select(8, GetQuestLogTitle(questIndex))")) + assert.is_false(has(tracker, "select(8, GetQuestLogTitle(index))")) end) it("[9.1->11.1] CORRECTED: % modulo IS used (the 'avoided' claim was wrong)", function()