fix: replace select eight lookups

This commit is contained in:
Xurkon
2026-06-04 21:58:54 -05:00
parent f8b3972e70
commit c85370de0b
4 changed files with 23 additions and 9 deletions
+2 -1
View File
@@ -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
+4 -2
View File
@@ -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
+2 -2
View File
@@ -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.
+15 -4
View File
@@ -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()