KamberQuests

KamberQuests

465 Downloads

The in-game map window changes the mapID being returned by C_QuestLog and thus changes which quests get tracked

Radbarn opened this issue ยท 0 comments

commented

We don't have any update triggers assigned to the world map window and so if the user supertracks quests while viewing a different zone it will cause a tracking reset to be called and start tracking quests in the zone being viewed.

two things -- add the world map being closed to the event triggers so we can do a quick tracking update
-- Register event handling
local frame = CreateFrame("Frame")
-- ... (your other registered events) ...
frame:RegisterEvent("WORLD_MAP_UPDATE") -- Add this line

frame:SetScript("OnEvent", function(self, event, ...)
-- ... (Your existing event handling logic) ...

if event == "WORLD_MAP_UPDATE" then
    if not WorldMapFrame:IsVisible() then -- Map was just closed
        UpdateQuestWatch() -- Refresh tracking
    end
end

end)

and second: if the world map is visible do NOT use C_QuestLog to check things. this will involve moving ALL isInZone checks to within the zone checking function

local function IsQuestInCurrentZone(questID)
currentMapID = currentMapID or C_Map.GetBestMapForUnit("player")

-- Function to check if the quest is in the zone based on map name
local function checkMapName(mapID)
    -- ... (your existing map name check logic remains the same) ...
end

-- Check map names first
if checkMapName(currentMapID) then return true end

-- Only fetch questMapID and perform further checks if the world map is NOT visible
if not WorldMapFrame:IsVisible() then
    questMapID = questMapID or C_QuestLog.GetMapForQuestPOIs()
    if checkMapName(questMapID) then return true end

    -- Function to check if the quest is in the zone based on quest list
    local function checkQuestList(mapID)
        if mapID then
            for _, questInfo in ipairs(C_QuestLog.GetQuestsOnMap(mapID)) do
                if questInfo.questID == questID then
                    return true
                end
            end
        end
    end

    -- Check quest lists if map names don't match
    return checkQuestList(currentMapID) or checkQuestList(questMapID)
end

-- If the world map is visible, don't rely on C_QuestLog for zone checks
return false 

end