questitem: add option to disable features

This commit is contained in:
shagu
2020-07-05 22:39:53 +02:00
parent 6826937db5
commit 11bc84524f
3 changed files with 15 additions and 1 deletions
+2
View File
@@ -576,6 +576,8 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("tooltip", "compare", "basestats", "1")
pfUI:UpdateConfig("tooltip", "compare", "showalways", "0")
pfUI:UpdateConfig("tooltip", "vendor", "showalways", "0")
pfUI:UpdateConfig("tooltip", "questitem", "showquest", "1")
pfUI:UpdateConfig("tooltip", "questitem", "showcount", "0")
pfUI:UpdateConfig("tooltip", "statusbar", "texture", "Interface\\AddOns\\pfUI\\img\\bar")
pfUI:UpdateConfig("chat", "text", "input_width", "0")
+2
View File
@@ -2004,6 +2004,8 @@ pfUI:RegisterModule("gui", "vanilla:tbc", function ()
CreateConfig(nil, T["Compare Item Base Stats"], C.tooltip.compare, "basestats", "checkbox")
CreateConfig(nil, T["Always Show Item Comparison"], C.tooltip.compare, "showalways", "checkbox")
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")
end)
CreateGUIEntry(T["Castbar"], nil, function()
+11 -1
View File
@@ -3,6 +3,9 @@ pfUI:RegisterModule("questitem", function ()
local itemcache = {}
local function AddTooltip(frame, item)
-- abort if questitem is disabled
if C.tooltip.questitem.showquest ~= "1" then return end
-- check if we can replace the questitem string
local replace = nil
if frame and _G[frame:GetName().."TextLeft2"] then
@@ -42,7 +45,7 @@ pfUI:RegisterModule("questitem", function ()
local color = GetDifficultyColor(level)
-- read item counts
if itemcache[item] and itemcache[item] ~= false then
if C.tooltip.questitem.showcount == "1" and itemcache[item] and itemcache[item] ~= false then
local _, _, required = strfind(string.lower(questlog[itemcache[item]]), "_"..string.lower(item).."_(.-)_")
if required then
quest = string.format("%s |cffaaaaaa[%s/%s]", quest, (GetItemCount(item) or 0), required)
@@ -70,6 +73,8 @@ pfUI:RegisterModule("questitem", function ()
end)
pfUI.questitem:SetScript("OnUpdate", function()
if C.tooltip.questitem.showquest ~= "1" then return end
-- skip if nothing to do
if not this.run or GetTime() < this.run then return end
@@ -118,6 +123,11 @@ pfUI:RegisterModule("questitem", function ()
this.run = nil
end)
-- reload quest entries on config change
pfUI.questitem.UpdateConfig = function()
pfUI.questitem.run = GetTime() + .5
end
-- add to regular tooltips
pfUI.questitem.tooltip = CreateFrame("Frame", "pfQuestItems", GameTooltip )
pfUI.questitem.tooltip:SetScript("OnShow", function()