From 71e172c4d0f0bf9d1aa6328bf3b5c4622c42021a Mon Sep 17 00:00:00 2001 From: Xurkon Date: Fri, 12 Jun 2026 22:20:09 -0500 Subject: [PATCH] fix: sync native objective POIs with Questie icons --- Compat/Compat.lua | 12 +++++++ .../Options/IconsTab/QuestieOptionsIcons.lua | 22 +++--------- Modules/QuestieInit.lua | 1 + Modules/QuestieMenu/QuestieMenu.lua | 1 + .../QuestieBlizzardObjectivePOISync_spec.lua | 34 +++++++++++++++++++ 5 files changed, 52 insertions(+), 18 deletions(-) create mode 100644 Tests/QuestieBlizzardObjectivePOISync_spec.lua diff --git a/Compat/Compat.lua b/Compat/Compat.lua index 4547a65..ad07c7b 100644 --- a/Compat/Compat.lua +++ b/Compat/Compat.lua @@ -587,6 +587,18 @@ function QuestieCompat.GetQuestIDFromLogIndex(questLogIndex) return select(8, QuestieCompat.GetQuestLogTitle(questLogIndex)) end +---Keeps Blizzard/server objective POIs from drawing over Questie's objective icons. +---@param useQuestieObjectives boolean +function QuestieCompat.SyncBlizzardObjectivePOIs(useQuestieObjectives) + if GetCVar and GetCVar("questPOI") ~= nil and SetCVar then + SetCVar("questPOI", useQuestieObjectives and "0" or "1") + end + + if WorldMapQuestShowObjectives and WorldMapQuestShowObjectives.SetChecked then + WorldMapQuestShowObjectives:SetChecked(not useQuestieObjectives) + end +end + -- https://wowpedia.fandom.com/wiki/API_GetQuestLink -- Returns a QuestLink for a quest. -- Between patches 6.2 and 7.3.2 argument was changed to take a QuestID instead of a quest log index. diff --git a/Modules/Options/IconsTab/QuestieOptionsIcons.lua b/Modules/Options/IconsTab/QuestieOptionsIcons.lua index 51cd955..5a41553 100644 --- a/Modules/Options/IconsTab/QuestieOptionsIcons.lua +++ b/Modules/Options/IconsTab/QuestieOptionsIcons.lua @@ -266,6 +266,7 @@ function QuestieOptions.tabs.icons:Initialize() get = function() return Questie.db.profile.enableObjectives; end, set = function(info, value) Questie.db.profile.enableObjectives = value + QuestieCompat.SyncBlizzardObjectivePOIs(value) QuestieQuest:ToggleNotes(value) QuestieOptionsUtils.DetermineTheme() end, @@ -1334,12 +1335,7 @@ end function QuestieOptionsUtils.ExecuteTheme(info, value) Questie.db.profile.iconTheme = value if value == 'questie' then - if GetCVar("questPOI") then -- if wotlk objectives available - SetCVar("questPOI", "0") -- disable them - end - if WorldMapQuestShowObjectives then -- if wotlk blizzard objectives button exists - WorldMapQuestShowObjectives:SetChecked(false) -- uncheck it - end + QuestieCompat.SyncBlizzardObjectivePOIs(true) Questie.db.profile.enableObjectives = true Questie.db.profile.ICON_SLAY = Questie.icons["slay"] Questie.db.profile.ICON_LOOT = Questie.icons["loot"] @@ -1352,12 +1348,7 @@ function QuestieOptionsUtils.ExecuteTheme(info, value) Questie.db.profile.alwaysGlowMinimap = optionsDefaults.profile.alwaysGlowMinimap Questie.db.profile.clusterLevelHotzone = optionsDefaults.profile.clusterLevelHotzone elseif value == 'pfquest' then - if GetCVar("questPOI") then -- if wotlk objectives available - SetCVar("questPOI", "0") -- disable them - end - if WorldMapQuestShowObjectives then -- if wotlk blizzard objectives button exists - WorldMapQuestShowObjectives:SetChecked(false) -- uncheck it - end + QuestieCompat.SyncBlizzardObjectivePOIs(true) Questie.db.profile.enableObjectives = true Questie.db.profile.ICON_SLAY = Questie.icons["node"] Questie.db.profile.ICON_LOOT = Questie.icons["node"] @@ -1370,12 +1361,7 @@ function QuestieOptionsUtils.ExecuteTheme(info, value) Questie.db.profile.alwaysGlowMinimap = false Questie.db.profile.clusterLevelHotzone = 1 elseif value == 'blizzard' then - if GetCVar("questPOI") then -- if wotlk objectives available - SetCVar("questPOI", "1") -- enable them - end - if WorldMapQuestShowObjectives then -- if wotlk blizzard objectives button exists - WorldMapQuestShowObjectives:SetChecked(false) -- check it - end + QuestieCompat.SyncBlizzardObjectivePOIs(false) Questie.db.profile.enableObjectives = false Questie.db.profile.ICON_SLAY = Questie.icons["slay"] Questie.db.profile.ICON_LOOT = Questie.icons["loot"] diff --git a/Modules/QuestieInit.lua b/Modules/QuestieInit.lua index 26d802b..2ab3566 100644 --- a/Modules/QuestieInit.lua +++ b/Modules/QuestieInit.lua @@ -226,6 +226,7 @@ QuestieInit.Stages[1] = function() -- run as a coroutine end Questie:SetIcons() + QuestieCompat.SyncBlizzardObjectivePOIs(Questie.db.profile.enableObjectives) if QUESTIE_LOCALES_OVERRIDE ~= nil then l10n:InitializeLocaleOverride() diff --git a/Modules/QuestieMenu/QuestieMenu.lua b/Modules/QuestieMenu/QuestieMenu.lua index 158ffe9..ecf9932 100644 --- a/Modules/QuestieMenu/QuestieMenu.lua +++ b/Modules/QuestieMenu/QuestieMenu.lua @@ -302,6 +302,7 @@ function QuestieMenu:Show(hideDelay) tinsert(menuTable, { text= l10n("Objective"), func = function() local value = not Questie.db.profile.enableObjectives Questie.db.profile.enableObjectives = value + QuestieCompat.SyncBlizzardObjectivePOIs(value) QuestieQuest:ToggleNotes(value) QuestieQuest:SmoothReset() end, icon=QuestieLib.AddonPath.."Icons\\event.blp", notCheckable=false, checked=Questie.db.profile.enableObjectives, isNotRadio=true, keepShownOnClick=true}) diff --git a/Tests/QuestieBlizzardObjectivePOISync_spec.lua b/Tests/QuestieBlizzardObjectivePOISync_spec.lua new file mode 100644 index 0000000..b194fa7 --- /dev/null +++ b/Tests/QuestieBlizzardObjectivePOISync_spec.lua @@ -0,0 +1,34 @@ +local function read(path) + local f = assert(io.open(path, "r"), "cannot open " .. path) + local content = f:read("*a") + f:close() + return content +end + +local function has(content, needle) + return content:find(needle, 1, true) ~= nil +end + +describe("Blizzard objective POI sync", function() + local compat = read("Compat/Compat.lua") + local init = read("Modules/QuestieInit.lua") + local iconOptions = read("Modules/Options/IconsTab/QuestieOptionsIcons.lua") + local questieMenu = read("Modules/QuestieMenu/QuestieMenu.lua") + + it("disables native quest POIs when Questie objective icons are enabled", function() + local helperStart = assert(compat:find("function QuestieCompat.SyncBlizzardObjectivePOIs", 1, true)) + local helperEnd = assert(compat:find("-- https://wowpedia.fandom.com/wiki/API_GetQuestLink", helperStart, true)) + local helper = compat:sub(helperStart, helperEnd) + + assert.is_true(has(helper, "SetCVar(\"questPOI\", useQuestieObjectives and \"0\" or \"1\")")) + assert.is_true(has(helper, "WorldMapQuestShowObjectives:SetChecked(not useQuestieObjectives)")) + end) + + it("syncs native POIs on startup and objective ownership changes", function() + assert.is_true(has(init, "QuestieCompat.SyncBlizzardObjectivePOIs(Questie.db.profile.enableObjectives)")) + assert.is_true(has(iconOptions, "QuestieCompat.SyncBlizzardObjectivePOIs(value)")) + assert.is_true(has(iconOptions, "QuestieCompat.SyncBlizzardObjectivePOIs(true)")) + assert.is_true(has(iconOptions, "QuestieCompat.SyncBlizzardObjectivePOIs(false)")) + assert.is_true(has(questieMenu, "QuestieCompat.SyncBlizzardObjectivePOIs(value)")) + end) +end)