eqcompare: collapse basestats/extendedstats checkboxes into a mode dropdown

Replace the two-checkbox arrangement (Compare Base Stats + Compare
Extended Stats, with the latter gated on the former) with a single
"Item Comparison" dropdown offering Off / Base / Extended. Migrate
existing configs.

Also route CreateConfig's value-change sites through pfUI.events
("config:changed", category, config) so callers can react to arbitrary
setting changes without frame-specific plumbing. Use it here to grey
out "Always Show Item Comparison" when the mode is Off.
This commit is contained in:
Brues
2026-07-02 03:05:56 -05:00
parent 0f97e8b0bd
commit 6570afb70a
3 changed files with 46 additions and 24 deletions
+16 -2
View File
@@ -751,8 +751,7 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("tooltip", nil, "movespeed", "0")
pfUI:UpdateConfig("tooltip", nil, "alpha", "0.8")
pfUI:UpdateConfig("tooltip", nil, "alwaysperc", "0")
pfUI:UpdateConfig("tooltip", "compare", "basestats", "1")
pfUI:UpdateConfig("tooltip", "compare", "extendedstats", "1")
pfUI:UpdateConfig("tooltip", "compare", "mode", "extended")
pfUI:UpdateConfig("tooltip", "compare", "showalways", "0")
pfUI:UpdateConfig("tooltip", "vendor", "showalways", "1")
pfUI:UpdateConfig("tooltip", "questitem", "showquest", "1")
@@ -1373,6 +1372,21 @@ function pfUI:MigrateConfig()
end
end
-- migrate tooltip.compare.basestats + extendedstats into a single mode dropdown
if pfUI_config.tooltip and pfUI_config.tooltip.compare then
local cmp = pfUI_config.tooltip.compare
if cmp.basestats or cmp.extendedstats then
if cmp.basestats == "0" then
cmp.mode = "off"
elseif cmp.extendedstats == "0" then
cmp.mode = "base"
else
cmp.mode = "extended"
end
cmp.basestats = nil
cmp.extendedstats = nil
end
end
-- Remove "Show only own debuffs" from unitframes and nameplates
-- (feature was removed; only Target Debuff Bar in buffwatch keeps it)
+3 -2
View File
@@ -252,12 +252,13 @@ pfUI:RegisterModule("eqcompare", function ()
AddHeader(ShoppingTooltip2)
end
if C.tooltip.compare.basestats == "1" then
local mode = C.tooltip.compare.mode
if mode ~= "off" then
local equippedLink = GetInventoryItemLink("player", slotID)
if newLink and equippedLink then
local delta = C_Item.GetItemStatDelta(equippedLink, newLink)
if delta then
if C.tooltip.compare.extendedstats == "1" then
if mode == "extended" then
local keys = {}
for _, k in ipairs(BASE_STAT_KEYS) do table.insert(keys, k) end
for _, k in ipairs(EXTENDED_STAT_KEYS) do table.insert(keys, k) end
+27 -20
View File
@@ -1,5 +1,5 @@
pfUI:RegisterModule("gui", function ()
local Reload, U, CreateConfig, CreateTabFrame, CreateArea, CreateGUIEntry, EntryUpdate, MakeDependent
local Reload, U, CreateConfig, CreateTabFrame, CreateArea, CreateGUIEntry, EntryUpdate
-- "searchDB" gets populated when CreateConfig is called. The table holds
-- information about the title, its parent buttons and the frame itself:
@@ -212,6 +212,7 @@ pfUI:RegisterModule("gui", function ()
if not this:GetParent():IsShown() then
category[config] = r .. "," .. g .. "," .. b .. "," .. a
if ufunc then ufunc() else pfUI.gui.settingChanged = true end
pfUI.events:TriggerEvent("config:changed", category, config)
end
end
@@ -278,6 +279,7 @@ pfUI:RegisterModule("gui", function ()
if this:GetText() ~= this:GetParent().category[this:GetParent().config] then
this:GetParent().category[this:GetParent().config] = this:GetText()
if ufunc then ufunc() else pfUI.gui.settingChanged = true end
pfUI.events:TriggerEvent("config:changed", category, config)
end
this:SetTextColor(.2,1,.8,1)
else
@@ -328,6 +330,7 @@ pfUI:RegisterModule("gui", function ()
end
if ufunc then ufunc() else pfUI.gui.settingChanged = true end
pfUI.events:TriggerEvent("config:changed", category, config)
end)
if category[config] == "1" then frame.input:SetChecked() end
@@ -360,6 +363,7 @@ pfUI:RegisterModule("gui", function ()
if category and category[config] ~= value then
category[config] = value
if ufunc then ufunc() else pfUI.gui.settingChanged = true end
pfUI.events:TriggerEvent("config:changed", category, config)
end
end
@@ -394,6 +398,7 @@ pfUI:RegisterModule("gui", function ()
end
category[config] = newconf
if ufunc then ufunc() else pfUI.gui.settingChanged = true end
pfUI.events:TriggerEvent("config:changed", category, config)
frame.input:UpdateMenu()
end)
@@ -409,6 +414,7 @@ pfUI:RegisterModule("gui", function ()
CreateQuestionDialog(T["New entry:"], function()
category[config] = category[config] .. "#" .. this:GetParent().input:GetText()
if ufunc then ufunc() else pfUI.gui.settingChanged = true end
pfUI.events:TriggerEvent("config:changed", category, config)
frame.input:UpdateMenu()
end, false, true)
end)
@@ -594,24 +600,9 @@ pfUI:RegisterModule("gui", function ()
CreateBackdropShadow(pfUI.gui)
table.insert(UISpecialFrames, "pfConfigGUI")
function MakeDependent(child, parent)
local function refresh()
if parent.input:GetChecked() then
child.input:Enable()
child.caption:SetTextColor(1, 1, 1)
else
child.input:Disable()
child.caption:SetTextColor(0.5, 0.5, 0.5)
end
end
refresh()
HookScript(parent.input, "OnClick", refresh)
end
-- make some locals available to thirdparty
pfUI.gui.Reload = Reload
pfUI.gui.CreateConfig = CreateConfig
pfUI.gui.MakeDependent = MakeDependent
pfUI.gui.CreateGUIEntry = CreateGUIEntry
pfUI.gui.UpdaterFunctions = U
@@ -2763,10 +2754,26 @@ pfUI:RegisterModule("gui", function ()
CreateConfig(nil, T["Show Movement Speed"], C.tooltip, "movespeed", "checkbox")
CreateConfig(nil, T["Custom Transparency"], C.tooltip, "alpha")
CreateConfig(nil, T["Status Bar Texture"], C.tooltip.statusbar, "texture", "dropdown", pfUI.gui.dropdowns.uf_bartexture)
local baseCompare = CreateConfig(nil, T["Compare Item Base Stats"], C.tooltip.compare, "basestats", "checkbox")
local extCompare = CreateConfig(nil, T["Compare Extended Stats (AP/Crit/etc.)"], C.tooltip.compare, "extendedstats", "checkbox")
MakeDependent(extCompare, baseCompare)
CreateConfig(nil, T["Always Show Item Comparison"], C.tooltip.compare, "showalways", "checkbox")
CreateConfig(nil, T["Item Comparison"], C.tooltip.compare, "mode", "dropdown", {
"off:"..(T["Off"] or "Off"),
"base:"..(T["Base Stats"] or "Base Stats"),
"extended:"..(T["Extended Stats"] or "Extended Stats"),
})
local showAlways = CreateConfig(nil, T["Always Show Item Comparison"], C.tooltip.compare, "showalways", "checkbox")
local function gate()
local on = C.tooltip.compare.mode ~= "off"
if on then
showAlways.input:Enable()
showAlways.caption:SetTextColor(1, 1, 1)
else
showAlways.input:Disable()
showAlways.caption:SetTextColor(0.5, 0.5, 0.5)
end
end
gate()
pfUI.events:RegisterCallback("config:changed", function(_, cat, key)
if cat == C.tooltip.compare and key == "mode" then gate() end
end, "eqcompare-showalways-gate")
CreateConfig(nil, T["Always Show Extended Vendor Values"], C.tooltip.vendor, "showalways", "checkbox")
CreateConfig(U["questitem"], T["Show Related Quest On Questitems"], C.tooltip.questitem, "showquest", "checkbox")
CreateConfig(U["questitem"], T["Show Required Questitem Count"], C.tooltip.questitem, "showcount", "checkbox")