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
+1 -1
View File
@@ -65,6 +65,6 @@ local function ValueColorUpdate(hex)
OnEvent(lastPanel)
end
end
E["valueColorUpdateFuncs"][ValueColorUpdate] = true
E.valueColorUpdateFuncs[ValueColorUpdate] = true
DT:RegisterDatatext("Armor", {"UNIT_RESISTANCES"}, OnEvent, nil, nil, OnEnter, nil, ARMOR)
+1 -1
View File
@@ -61,6 +61,6 @@ local function ValueColorUpdate(hex)
OnEvent(lastPanel)
end
end
E["valueColorUpdateFuncs"][ValueColorUpdate] = true
E.valueColorUpdateFuncs[ValueColorUpdate] = true
DT:RegisterDatatext("Attack Power", {"UNIT_ATTACK_POWER", "UNIT_RANGED_ATTACK_POWER"}, OnEvent, nil, nil, OnEnter, nil, ATTACK_POWER_TOOLTIP)
+1 -1
View File
@@ -122,6 +122,6 @@ local function ValueColorUpdate(hex)
OnEvent(lastPanel)
end
end
E["valueColorUpdateFuncs"][ValueColorUpdate] = true
E.valueColorUpdateFuncs[ValueColorUpdate] = true
DT:RegisterDatatext("Avoidance", {"COMBAT_RATING_UPDATE", "PLAYER_TARGET_CHANGED"}, OnEvent, nil, nil, OnEnter, nil, L["Avoidance Breakdown"])
+27 -27
View File
@@ -110,7 +110,7 @@ end
local function ValueColorUpdate(newHex)
hex = newHex
end
E["valueColorUpdateFuncs"][ValueColorUpdate] = true
E.valueColorUpdateFuncs[ValueColorUpdate] = true
function DT:GetDataPanelPoint(panel, i, numPoints)
if(numPoints == 1) then
@@ -119,9 +119,9 @@ function DT:GetDataPanelPoint(panel, i, numPoints)
if(i == 1) then
return "CENTER", panel, "CENTER"
elseif(i == 2) then
return "RIGHT", panel.dataPanels["middle"], "LEFT", -4, 0
return "RIGHT", panel.dataPanels.middle, "LEFT", -4, 0
elseif(i == 3) then
return "LEFT", panel.dataPanels["middle"], "RIGHT", 4, 0
return "LEFT", panel.dataPanels.middle, "RIGHT", 4, 0
end
end
end
@@ -180,12 +180,12 @@ end
function DT:AssignPanelToDataText(panel, data)
panel.name = ""
if data["name"] then
panel.name = data["name"]
if data.name then
panel.name = data.name
end
if data["events"] then
for _, event in pairs(data["events"]) do
if data.events then
for _, event in pairs(data.events) do
-- random error 132
if event == "PLAYER_ENTERING_WORLD" then
event = "PLAYER_LOGIN"
@@ -194,35 +194,35 @@ function DT:AssignPanelToDataText(panel, data)
end
end
if data["eventFunc"] then
if data.eventFunc then
panel:SetScript("OnEvent", function()
data["eventFunc"](this, event)
data.eventFunc(this, event)
end)
data["eventFunc"](panel, "ELVUI_FORCE_RUN")
data.eventFunc(panel, "ELVUI_FORCE_RUN")
end
if data["onUpdate"] then
if data.onUpdate then
panel:SetScript("OnUpdate", function()
data["onUpdate"](this, arg1)
data.onUpdate(this, arg1)
end)
data["onUpdate"](panel, 20000)
data.onUpdate(panel, 20000)
end
if data["onClick"] then
if data.onClick then
panel:SetScript("OnClick", function()
data["onClick"](this)
data.onClick(this)
end)
end
if data["onEnter"] then
if data.onEnter then
panel:SetScript("OnEnter", function()
data["onEnter"](this)
data.onEnter(this)
end)
end
if data["onLeave"] then
if data.onLeave then
panel:SetScript("OnLeave", function()
data["onLeave"](this)
data.onLeave(this)
end)
else
panel:SetScript("OnLeave", DT.Data_OnLeave)
@@ -285,33 +285,33 @@ function DT:RegisterDatatext(name, events, eventFunc, updateFunc, clickFunc, onE
error("Cannot register datatext no name was provided.")
end
DT.RegisteredDataTexts[name]["name"] = name
DT.RegisteredDataTexts[name].name = name
if type(events) ~= "table" and events ~= nil then
error("Events must be registered as a table.")
else
DT.RegisteredDataTexts[name]["events"] = events
DT.RegisteredDataTexts[name]["eventFunc"] = eventFunc
DT.RegisteredDataTexts[name].events = events
DT.RegisteredDataTexts[name].eventFunc = eventFunc
end
if updateFunc and type(updateFunc) == "function" then
DT.RegisteredDataTexts[name]["onUpdate"] = updateFunc
DT.RegisteredDataTexts[name].onUpdate = updateFunc
end
if clickFunc and type(clickFunc) == "function" then
DT.RegisteredDataTexts[name]["onClick"] = clickFunc
DT.RegisteredDataTexts[name].onClick = clickFunc
end
if onEnterFunc and type(onEnterFunc) == "function" then
DT.RegisteredDataTexts[name]["onEnter"] = onEnterFunc
DT.RegisteredDataTexts[name].onEnter = onEnterFunc
end
if onLeaveFunc and type(onLeaveFunc) == "function" then
DT.RegisteredDataTexts[name]["onLeave"] = onLeaveFunc
DT.RegisteredDataTexts[name].onLeave = onLeaveFunc
end
if localizedName and type(localizedName) == "string" then
DT.RegisteredDataTexts[name]["localizedName"] = localizedName
DT.RegisteredDataTexts[name].localizedName = localizedName
end
end
+1 -1
View File
@@ -73,6 +73,6 @@ local function ValueColorUpdate(hex)
OnEvent(lastPanel, "ELVUI_COLOR_UPDATE")
end
end
E["valueColorUpdateFuncs"][ValueColorUpdate] = true
E.valueColorUpdateFuncs[ValueColorUpdate] = true
DT:RegisterDatatext("Durability", {"PLAYER_ENTERING_WORLD", "UPDATE_INVENTORY_ALERTS", "MERCHANT_SHOW"}, OnEvent, nil, OnClick, OnEnter, nil, DURABILITY)
+1 -1
View File
@@ -172,6 +172,6 @@ local function ValueColorUpdate(hex)
OnEvent(lastPanel, "ELVUI_COLOR_UPDATE")
end
end
E["valueColorUpdateFuncs"][ValueColorUpdate] = true
E.valueColorUpdateFuncs[ValueColorUpdate] = true
DT:RegisterDatatext("Friends", {"PLAYER_LOGIN", "FRIENDLIST_UPDATE", "CHAT_MSG_SYSTEM"}, OnEvent, nil, OnClick, OnEnter, nil, FRIENDS)
+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)
+1 -1
View File
@@ -229,6 +229,6 @@ local function ValueColorUpdate(hex)
OnEvent(lastPanel, "ELVUI_COLOR_UPDATE")
end
end
E["valueColorUpdateFuncs"][ValueColorUpdate] = true
E.valueColorUpdateFuncs[ValueColorUpdate] = true
DT:RegisterDatatext("Guild", {"PLAYER_ENTERING_WORLD", "GUILD_ROSTER_UPDATE", "PLAYER_GUILD_UPDATE", "GUILD_MOTD"}, OnEvent, nil, OnClick, OnEnter, nil, GUILD)
+1 -1
View File
@@ -89,6 +89,6 @@ local function ValueColorUpdate(hex)
OnUpdate(lastPanel, 20000)
end
end
E["valueColorUpdateFuncs"][ValueColorUpdate] = true
E.valueColorUpdateFuncs[ValueColorUpdate] = true
DT:RegisterDatatext("Time", nil, nil, OnUpdate, OnClick, OnEnter, OnLeave)