update tables

This commit is contained in:
Crum
2018-12-06 19:55:03 -06:00
parent cb90d0f1e5
commit 4d0cc6c85c
68 changed files with 705 additions and 597 deletions
+12 -12
View File
@@ -16,11 +16,11 @@ local resetInfoFormatter = join("", "|cffaaaaaa", L["Reset Data: Hold Shift + Ri
local function OnEvent(self)
local NewMoney = GetMoney()
ElvDB = ElvDB or {}
ElvDB["gold"] = ElvDB["gold"] or {}
ElvDB["gold"][E.myrealm] = ElvDB["gold"][E.myrealm] or {}
ElvDB["gold"][E.myrealm][E.myname] = ElvDB["gold"][E.myrealm][E.myname] or NewMoney
ElvDB.gold = ElvDB.gold or {}
ElvDB.gold[E.myrealm] = ElvDB.gold[E.myrealm] or {}
ElvDB.gold[E.myrealm][E.myname] = ElvDB.gold[E.myrealm][E.myname] or NewMoney
local OldMoney = ElvDB["gold"][E.myrealm][E.myname] or NewMoney
local OldMoney = ElvDB.gold[E.myrealm][E.myname] or NewMoney
local Change = NewMoney - OldMoney
if OldMoney > NewMoney then
@@ -31,7 +31,7 @@ local function OnEvent(self)
self.text:SetText(E:FormatMoney(NewMoney, E.db.datatexts.goldFormat or "BLIZZARD"))
ElvDB["gold"][E.myrealm][E.myname] = NewMoney
ElvDB.gold[E.myrealm][E.myname] = NewMoney
end
local function OnClick(self)
@@ -52,19 +52,19 @@ local function OnEnter(self)
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)
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)
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: "])
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]
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]
end
end
@@ -78,4 +78,4 @@ local function OnEnter(self)
DT.tooltip:Show()
end
DT:RegisterDatatext("Gold", {"PLAYER_ENTERING_WORLD", "PLAYER_MONEY", "SEND_MAIL_MONEY_CHANGED", "SEND_MAIL_COD_CHANGED", "PLAYER_TRADE_MONEY", "TRADE_MONEY_CHANGED"}, OnEvent, nil, OnClick, OnEnter, nil, L["Gold"])
DT:RegisterDatatext("Gold", {"PLAYER_ENTERING_WORLD", "PLAYER_MONEY", "SEND_MAIL_MONEY_CHANGED", "SEND_MAIL_COD_CHANGED", "PLAYER_TRADE_MONEY", "TRADE_MONEY_CHANGED"}, OnEvent, nil, OnClick, OnEnter, nil, L.gold)