diff --git a/Core/Database.lua b/Core/Database.lua index 4c6d02f..d551830 100644 --- a/Core/Database.lua +++ b/Core/Database.lua @@ -65,17 +65,27 @@ function DB:Initialize() -- Initialize this character's data if not Guda_DB.characters[fullName] then + local localizedClass, englishClass = UnitClass("player") Guda_DB.characters[fullName] = { name = playerName, realm = playerRealm, faction = playerFaction, - class = UnitClass("player"), + class = localizedClass, + classToken = englishClass, -- English uppercase token for RAID_CLASS_COLORS level = UnitLevel("player"), money = 0, bags = {}, bank = {}, lastUpdate = time(), } + else + -- Migration: Add classToken to existing characters + local char = Guda_DB.characters[fullName] + if not char.classToken then + local localizedClass, englishClass = UnitClass("player") + char.classToken = englishClass + addon:Debug("Added classToken to existing character") + end end addon:Debug("Database initialized for %s", fullName) @@ -132,6 +142,7 @@ function DB:GetAllCharacters(sameFactionOnly) name = data.name, realm = data.realm, class = data.class, + classToken = data.classToken, -- English uppercase token for colors level = data.level, faction = data.faction, money = data.money, diff --git a/UI/BagFrame.lua b/UI/BagFrame.lua index 4e49734..82fabaf 100644 --- a/UI/BagFrame.lua +++ b/UI/BagFrame.lua @@ -352,18 +352,15 @@ function Guda_BagFrame_MoneyOnEnter(self) local totalMoney = addon.Modules.DB:GetTotalMoney(true) local currentPlayerName = addon.Modules.DB:GetPlayerFullName() - -- Header with faction/realm total - GameTooltip:AddLine("Faction/realm-wide gold:", 1, 0.82, 0, 1) - GameTooltip:AddLine(addon.Modules.Utils:FormatMoney(totalMoney), 1, 1, 1, 1) - GameTooltip:AddLine(" ") - - -- List each character + -- List each character with class-colored names for _, char in ipairs(chars) do + -- Get class color from WoW's built-in table using English class token + local classToken = char.classToken + local classColor = classToken and (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[classToken] local colorR, colorG, colorB = 0.7, 0.7, 0.7 - -- Highlight current character - if char.fullName == currentPlayerName then - colorR, colorG, colorB = 0, 1, 0.6 + if classColor then + colorR, colorG, colorB = classColor.r, classColor.g, classColor.b end GameTooltip:AddDoubleLine( @@ -374,6 +371,15 @@ 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