This commit is contained in:
Crum
2019-01-12 02:18:46 -06:00
parent 79a61c59a8
commit eebdf23364
14 changed files with 417 additions and 251 deletions
+26 -2
View File
@@ -5,9 +5,11 @@ local DT = E:GetModule("DataTexts");
--Lua functions
local pairs = pairs
local join = string.join
local tinsert, wipe = table.insert, table.wipe
--WoW API / Variables
local GetMoney = GetMoney
local IsShiftKeyDown = IsShiftKeyDown
local RAID_CLASS_COLORS = RAID_CLASS_COLORS
local Profit = 0
local Spent = 0
@@ -20,6 +22,10 @@ local function OnEvent(self)
ElvDB.gold[E.myrealm] = ElvDB.gold[E.myrealm] or {}
ElvDB.gold[E.myrealm][E.myname] = ElvDB.gold[E.myrealm][E.myname] or NewMoney
ElvDB.class = ElvDB.class or {}
ElvDB.class[E.myrealm] = ElvDB.class[E.myrealm] or {}
ElvDB.class[E.myrealm][E.myname] = E.myclass
local OldMoney = ElvDB.gold[E.myrealm][E.myname] or NewMoney
local Change = NewMoney - OldMoney
@@ -44,28 +50,46 @@ local function OnClick(self)
end
end
local myGold = {}
local function OnEnter(self)
DT:SetupTooltip(self)
local style = E.db.datatexts.goldFormat or "BLIZZARD"
DT.tooltip:AddLine(L["Session:"])
DT.tooltip:AddDoubleLine(L["Earned:"], E:FormatMoney(Profit, style), 1, 1, 1, 1, 1, 1)
DT.tooltip:AddDoubleLine(L["Spent:"], E:FormatMoney(Spent, style), 1, 1, 1, 1, 1, 1)
if Profit < Spent then
DT.tooltip:AddDoubleLine(L["Deficit:"], E:FormatMoney(Profit - Spent, style), 1, 0, 0, 1, 1, 1)
elseif (Profit - Spent) > 0 then
DT.tooltip:AddDoubleLine(L["Profit:"], E:FormatMoney(Profit - Spent, style), 0, 1, 0, 1, 1, 1)
end
DT.tooltip:AddLine(" ")
local totalGold = 0;
DT.tooltip:AddLine(L["Character: "])
wipe(myGold)
for k in pairs(ElvDB.gold[E.myrealm]) do
if ElvDB.gold[E.myrealm][k] then
DT.tooltip:AddDoubleLine(k, E:FormatMoney(ElvDB.gold[E.myrealm][k], style), 1, 1, 1, 1, 1, 1)
totalGold = totalGold + ElvDB.gold[E.myrealm][k]
local class = ElvDB.class[E.myrealm][k] or "PRIEST"
local color = class and (CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[class] or RAID_CLASS_COLORS[class])
tinsert (myGold,
{
name = k,
amount = ElvDB.gold[E.myrealm][k],
amountText = E:FormatMoney(ElvDB.gold[E.myrealm][k], E.db.datatexts.goldFormat or "BLIZZARD", not E.db.datatexts.goldCoins),
r = color.r, g = color.g, b = color.b,
}
)
end
totalGold = totalGold + ElvDB.gold[E.myrealm][k]
end
for _, g in ipairs(myGold) do
DT.tooltip:AddDoubleLine(g.name == E.myname and g.name or g.name, g.amountText, g.r, g.g, g.b, 1, 1, 1)
end
DT.tooltip:AddLine(" ")