fix: sync native objective POIs with Questie icons
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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"]
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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})
|
||||
|
||||
@@ -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)
|
||||
Reference in New Issue
Block a user