diff --git a/Core/Utils.lua b/Core/Utils.lua
index 8996402..fc4e925 100644
--- a/Core/Utils.lua
+++ b/Core/Utils.lua
@@ -5,14 +5,10 @@ local addon = Guda
local Utils = {}
addon.Modules.Utils = Utils
--- Format money (copper to gold/silver/copper string)
+-- Format money (copper to gold/silver/copper string) - WoW 1.12.1 version
function Utils:FormatMoney(copper, showZero)
if not copper or copper == 0 then
- if showZero then
- return "0|cFFFFD700g|r 0|cFFC0C0C0s|r 0|cFFFF6600c|r"
- else
- return "0|cFFC0C0C0s|r"
- end
+ return "0c"
end
local gold = math.floor(copper / 10000)
@@ -21,12 +17,12 @@ function Utils:FormatMoney(copper, showZero)
local str = ""
if gold > 0 then
- str = str .. gold .. "|cFFFFD700g|r "
+ str = str .. gold .. "g "
end
if silver > 0 or gold > 0 then
- str = str .. silver .. "|cFFC0C0C0s|r "
+ str = str .. silver .. "s "
end
- str = str .. bronze .. "|cFFFF6600c|r"
+ str = str .. bronze .. "c"
return str
end
diff --git a/UI/BagFrame.lua b/UI/BagFrame.lua
index 82fabaf..c7892b7 100644
--- a/UI/BagFrame.lua
+++ b/UI/BagFrame.lua
@@ -206,7 +206,7 @@ function BagFrame:ResizeFrame(currentRow, currentCol, columns)
local containerWidth = (columns * (buttonSize + spacing)) + 20
local containerHeight = (totalRows * (buttonSize + spacing)) + 20
local frameWidth = containerWidth + 20
- local frameHeight = containerHeight + 100 -- Title (40) + search (30) + footer (30)
+ local frameHeight = containerHeight + 120 -- Title (40) + search (30) + footer (50)
-- Minimum sizes
if containerWidth < 200 then
@@ -328,29 +328,80 @@ function BagFrame:PassesSearchFilter(itemData)
return matches
end
--- Update money display
+-- Update money display with colored text (WoW 1.12.1 version like pfUI)
function BagFrame:UpdateMoney()
local currentMoney = addon.Modules.MoneyTracker:GetCurrentMoney()
local moneyFrame = getglobal("Guda_BagFrame_MoneyFrame")
- -- Current character money only
- if not moneyFrame.text then
- moneyFrame.text = moneyFrame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
- moneyFrame.text:SetPoint("CENTER", moneyFrame, "CENTER", 0, 0)
+ if not moneyFrame then
+ addon:Debug("MoneyFrame not found!")
+ return
end
- moneyFrame.text:SetText(addon.Modules.Utils:FormatMoney(currentMoney))
+ -- Create text frame if it doesn't exist
+ if not moneyFrame.text then
+ moneyFrame.text = moneyFrame:CreateFontString(nil, "OVERLAY", "GameFontNormalLarge")
+ moneyFrame.text:SetPoint("CENTER", moneyFrame, "CENTER", 0, 0)
+ moneyFrame.text:SetJustifyH("CENTER")
+
+ -- Simple backdrop without border (better for mouse events)
+ moneyFrame:SetBackdrop({
+ bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
+ tile = true,
+ tileSize = 16,
+ edgeSize = 0,
+ insets = { left = 0, right = 0, top = 0, bottom = 0 }
+ })
+ moneyFrame:SetBackdropColor(0, 0, 0, 0.6)
+
+ -- Set hit rect to make entire frame area responsive to mouse
+ -- This ensures hovering anywhere in the 180x35 frame triggers OnEnter
+ moneyFrame:SetHitRectInsets(0, 0, 0, 0)
+
+ -- Raise frame level to ensure it's on top and can receive mouse events
+ moneyFrame:SetFrameLevel(moneyFrame:GetParent():GetFrameLevel() + 10)
+
+ moneyFrame:Show() -- Ensure frame is visible
+ end
+
+ -- Calculate gold, silver, copper
+ local gold = math.floor(currentMoney / 10000)
+ local silver = math.floor(mod(currentMoney, 10000) / 100)
+ local copper = mod(currentMoney, 100)
+
+ -- Create colored string like pfUI (white numbers, colored letters)
+ local moneyString = ""
+ if gold > 0 then
+ moneyString = moneyString .. "|cffffffff" .. gold .. "|cffffd700g"
+ end
+ if silver > 0 or gold > 0 then
+ moneyString = moneyString .. "|cffffffff " .. silver .. "|cffc7c7cfs"
+ end
+ moneyString = moneyString .. "|cffffffff " .. copper .. "|cffeda55fc"
+
+ moneyFrame.text:SetText(moneyString)
end
-- Money tooltip handler
function Guda_BagFrame_MoneyOnEnter(self)
- GameTooltip:SetOwner(self, "ANCHOR_BOTTOM")
+ if not self then return end
+
+ -- Anchor tooltip to TOPRIGHT - aligns tooltip's right edge with money container's right edge
+ GameTooltip:SetOwner(self, "ANCHOR_TOPRIGHT", 0, 0)
GameTooltip:ClearLines()
-- Get all characters and total
local chars = addon.Modules.DB:GetAllCharacters(true)
local totalMoney = addon.Modules.DB:GetTotalMoney(true)
- local currentPlayerName = addon.Modules.DB:GetPlayerFullName()
+
+ -- Header with faction/realm total
+ GameTooltip:AddDoubleLine(
+ "Faction/realm-wide gold:",
+ addon.Modules.Utils:FormatMoney(totalMoney),
+ 1, 0.82, 0,
+ 1, 1, 1
+ )
+ GameTooltip:AddLine(" ")
-- List each character with class-colored names
for _, char in ipairs(chars) do
@@ -371,15 +422,6 @@ function Guda_BagFrame_MoneyOnEnter(self)
)
end
- -- Add separator and total at the bottom
- GameTooltip:AddLine(" ")
- GameTooltip:AddDoubleLine(
- "Total:",
- addon.Modules.Utils:FormatMoney(totalMoney),
- 1, 0.82, 0,
- 1, 1, 1
- )
-
GameTooltip:Show()
end
diff --git a/UI/BagFrame.xml b/UI/BagFrame.xml
index 190b830..95d0cc8 100644
--- a/UI/BagFrame.xml
+++ b/UI/BagFrame.xml
@@ -67,7 +67,7 @@
-
+
@@ -343,10 +343,10 @@
-
+
-
+