mirror of
https://github.com/brues-code/pfUI.git
synced 2026-09-27 09:56:03 +00:00
panel: add shift shortcut to reset all gold totals
This commit is contained in:
+17
-1
@@ -267,6 +267,20 @@ pfUI:RegisterModule("panel", "vanilla:tbc", function()
|
||||
local widget = CreateFrame("Frame", "pfPanelWidgetGold", UIParent)
|
||||
widget:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||
widget:RegisterEvent("PLAYER_MONEY")
|
||||
widget.Click = function()
|
||||
if IsShiftKeyDown() then
|
||||
-- read current data
|
||||
local realm = GetRealmName()
|
||||
local unit = UnitName("player")
|
||||
local money = GetMoney()
|
||||
|
||||
-- reset gold value and hide tooltip
|
||||
pfUI_cache["gold"][realm] = { [unit] = money }
|
||||
GameTooltip:Hide()
|
||||
else
|
||||
OpenAllBags()
|
||||
end
|
||||
end
|
||||
widget.Tooltip = function()
|
||||
local gold = floor(GetMoney()/ 10000)
|
||||
local silver = floor(mod((GetMoney()/100),100))
|
||||
@@ -296,6 +310,8 @@ pfUI:RegisterModule("panel", "vanilla:tbc", function()
|
||||
GameTooltip:AddDoubleLine("|cffffffff","")
|
||||
GameTooltip:AddDoubleLine(T["This Session"] .. ":", dmod .. CreateGoldString(math.abs(pfUI.panel.diffMoney)))
|
||||
GameTooltip:AddDoubleLine(T["Total Gold"] .. ":", CreateGoldString(totalgold))
|
||||
GameTooltip:AddLine(" ")
|
||||
GameTooltip:AddLine(T["Shift-Click to reset all money totals"], .5, .5, .5, 1)
|
||||
GameTooltip:Show()
|
||||
end
|
||||
widget:SetScript("OnEvent", function()
|
||||
@@ -310,7 +326,7 @@ pfUI:RegisterModule("panel", "vanilla:tbc", function()
|
||||
pfUI_cache["gold"][realm] = pfUI_cache["gold"][realm] or {}
|
||||
pfUI_cache["gold"][realm][unit] = money
|
||||
|
||||
pfUI.panel:OutputPanel("gold", goldstr, widget.Tooltip, OpenAllBags)
|
||||
pfUI.panel:OutputPanel("gold", goldstr, widget.Tooltip, widget.Click)
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user