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 questLogIndex number
---@param questId number ---@param questId number
function _QuestEventHandler:QuestAccepted(questLogIndex, questId) 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) Questie:Debug(Questie.DEBUG_DEVELOP, "[Quest Event] QUEST_ACCEPTED", questLogIndex, questId)
if questLog[questId] and questLog[questId].timer then if questLog[questId] and questLog[questId].timer then
+4 -2
View File
@@ -120,7 +120,8 @@ function QuestiePlayer:GetCurrentZoneId()
return uiMapId return uiMapId
end end
return ZoneDB.instanceIdToUiMapId[select(8, GetInstanceInfo())] local _, _, _, _, _, _, _, instanceMapID = GetInstanceInfo()
return ZoneDB.instanceIdToUiMapId[instanceMapID]
end end
function QuestiePlayer:GetCurrentUiMapId() function QuestiePlayer:GetCurrentUiMapId()
@@ -129,7 +130,8 @@ function QuestiePlayer:GetCurrentUiMapId()
if uiMapId then if uiMapId then
return uiMapId return uiMapId
end end
return ZoneDB.instanceIdToUiMapId[select(8, GetInstanceInfo())] local _, _, _, _, _, _, _, instanceMapID = GetInstanceInfo()
return ZoneDB.instanceIdToUiMapId[instanceMapID]
end end
---@return number ---@return number
+2 -2
View File
@@ -413,7 +413,7 @@ function QuestieTracker.Initialize()
for i = 1, questsWatched do for i = 1, questsWatched do
local questIndex = GetQuestIndexForWatch(i) local questIndex = GetQuestIndexForWatch(i)
if questIndex then if questIndex then
local questId = select(8, GetQuestLogTitle(questIndex)) local _, _, _, _, _, _, _, questId = GetQuestLogTitle(questIndex)
if questId then if questId then
tempQuestIDs[i] = questId tempQuestIDs[i] = questId
end end
@@ -2277,7 +2277,7 @@ function QuestieTracker:HookBaseTracker()
-- Intercept and return a Questie boolean value -- Intercept and return a Questie boolean value
IsQuestWatched = function(index) IsQuestWatched = function(index)
local questId = select(8, GetQuestLogTitle(index)) local _, _, _, _, _, _, _, questId = GetQuestLogTitle(index)
if questId == 0 then 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 -- 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. -- (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")) assert.is_true(has(d, "if(dbItem and dbItem.name and (not dbItem.Hidden)) then"))
end) end)
it("[N5] select(8, GetInstanceInfo()) left in QuestiePlayer (5.0 rewrite unfinished)", function() it("[N5] explicit unpack replaced select(8, ...) in live quest/instance lookups", function()
assert.is_true(has(read("Modules/QuestiePlayer.lua"), "select(8, GetInstanceInfo())")) local player = read("Modules/QuestiePlayer.lua")
-- QuestieLearner was rewritten away from it: local handler = read("Modules/Quest/QuestEventHandler.lua")
assert.is_true(has(read("Modules/QuestieLearner.lua"), "Lua 5.0 compat")) 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) end)
it("[9.1->11.1] CORRECTED: % modulo IS used (the 'avoided' claim was wrong)", function() it("[9.1->11.1] CORRECTED: % modulo IS used (the 'avoided' claim was wrong)", function()