Quantcast

4.6.5

Steven Jackson [09-29-14 - 05:33]
4.6.5
Filename
Interface/AddOns/SVUI/packages/stats/SVStats.lua
Interface/AddOns/SVUI/packages/stats/stats/gold.lua
Interface/AddOns/SVUI/packages/stats/stats/tokens.lua
Interface/AddOns/SVUI_StyleOMatic/addons/thirdparty/Altoholic.lua
diff --git a/Interface/AddOns/SVUI/packages/stats/SVStats.lua b/Interface/AddOns/SVUI/packages/stats/SVStats.lua
index 47af1ad..7cbc2b2 100644
--- a/Interface/AddOns/SVUI/packages/stats/SVStats.lua
+++ b/Interface/AddOns/SVUI/packages/stats/SVStats.lua
@@ -679,16 +679,18 @@ function MOD:ReLoad()
 end

 function MOD:Load()
-	local SVUI_Global = _G.SVUI_Global
 	local hexHighlight = SV:HexColor("highlight") or "FFFFFF"
 	local hexClass = classColor.colorStr
 	BGStatString = "|cff" .. hexHighlight .. "%s: |c" .. hexClass .. "%s|r";
-	SVUI_Global.Accountant = SVUI_Global.Accountant or {};
-	SVUI_Global.Accountant[playerRealm] = SVUI_Global.Accountant[playerRealm] or {};
-	SVUI_Global.Accountant[playerRealm]["gold"] = SVUI_Global.Accountant[playerRealm]["gold"] or {};
-	SVUI_Global.Accountant[playerRealm]["gold"][playerName] = SVUI_Global.Accountant[playerRealm]["gold"][playerName] or 0;
-	SVUI_Global.Accountant[playerRealm]["tokens"] = SVUI_Global.Accountant[playerRealm]["tokens"] or {};
-	SVUI_Global.Accountant[playerRealm]["tokens"][playerName] = SVUI_Global.Accountant[playerRealm]["tokens"][playerName] or 738;
+
+	self.Accountant = SVLib:NewGlobal("Accountant")
+
+	self.Accountant = self.Accountant or {};
+	self.Accountant[playerRealm] = self.Accountant[playerRealm] or {};
+	self.Accountant[playerRealm]["gold"] = self.Accountant[playerRealm]["gold"] or {};
+	self.Accountant[playerRealm]["gold"][playerName] = self.Accountant[playerRealm]["gold"][playerName] or 0;
+	self.Accountant[playerRealm]["tokens"] = self.Accountant[playerRealm]["tokens"] or {};
+	self.Accountant[playerRealm]["tokens"][playerName] = self.Accountant[playerRealm]["tokens"][playerName] or 738;

 	LoadStatBroker()

diff --git a/Interface/AddOns/SVUI/packages/stats/stats/gold.lua b/Interface/AddOns/SVUI/packages/stats/stats/gold.lua
index 5619fd8..5b8d727 100644
--- a/Interface/AddOns/SVUI/packages/stats/stats/gold.lua
+++ b/Interface/AddOns/SVUI/packages/stats/stats/gold.lua
@@ -101,7 +101,7 @@ end
 local function Gold_OnEvent(self, event,...)
 	if not IsLoggedIn() then return end
 	local current = GetMoney()
-	recorded = SVUI_Global.Accountant[playerRealm]["gold"][playerName] or GetMoney();
+	recorded = MOD.Accountant[playerRealm]["gold"][playerName] or GetMoney();
 	local adjusted = current - recorded;
 	if recorded > current then
 		loss = loss - adjusted
@@ -109,13 +109,13 @@ local function Gold_OnEvent(self, event,...)
 		gains = gains + adjusted
 	end
 	self.text:SetText(FormatCurrency(current, MOD.db.shortGold))
-	SVUI_Global.Accountant[playerRealm]["gold"][playerName] = GetMoney()
+	MOD.Accountant[playerRealm]["gold"][playerName] = GetMoney()
 end

 local function Gold_OnClick(self, button)
 	if IsLeftControlKeyDown() and IsShiftKeyDown() then
-		SVUI_Global.Accountant[playerRealm]["gold"] = {};
-		SVUI_Global.Accountant[playerRealm]["gold"][playerName] = GetMoney();
+		MOD.Accountant[playerRealm]["gold"] = {};
+		MOD.Accountant[playerRealm]["gold"][playerName] = GetMoney();
 		Gold_OnEvent(self)
 		MOD.tooltip:Hide()
 	else
@@ -134,7 +134,7 @@ local function Gold_OnEnter(self)
 		MOD.tooltip:AddDoubleLine(L["Profit:"],FormatCurrency(gains - loss),0,1,0,1,1,1)
 	end
 	MOD.tooltip:AddLine(" ")
-	local cash = SVUI_Global.Accountant[playerRealm]["gold"][playerName];
+	local cash = MOD.Accountant[playerRealm]["gold"][playerName];
 	MOD.tooltip:AddLine(L[playerName..": "])
 	MOD.tooltip:AddDoubleLine(L["Total: "], FormatCurrency(cash), 1,1,1,1,1,1)
 	MOD.tooltip:AddLine(" ")
@@ -159,8 +159,8 @@ MOD:Extend('Gold', StatEvents, Gold_OnEvent, nil, Gold_OnClick, Gold_OnEnter);
 function MOD:LoadServerGold()
 	local SVUI_Global = _G.SVUI_Global
 	local totalGold = 0;
-	for name,amount in pairs(SVUI_Global.Accountant[playerRealm]["gold"])do
-		if SVUI_Global.Accountant[playerRealm]["gold"][name] then
+	for name,amount in pairs(self.Accountant[playerRealm]["gold"])do
+		if self.Accountant[playerRealm]["gold"][name] then
 			serverGold[name] = amount;
 			totalGold = totalGold + amount
 		end
diff --git a/Interface/AddOns/SVUI/packages/stats/stats/tokens.lua b/Interface/AddOns/SVUI/packages/stats/stats/tokens.lua
index 16f0da8..6ecdfd2 100644
--- a/Interface/AddOns/SVUI/packages/stats/stats/tokens.lua
+++ b/Interface/AddOns/SVUI/packages/stats/stats/tokens.lua
@@ -80,7 +80,7 @@ end

 local function TokensEventHandler(self, event,...)
     if not IsLoggedIn() or not self then return end
-    local id = SVUI_Global.Accountant[playerRealm]["tokens"][playerName];
+    local id = MOD.Accountant[playerRealm]["tokens"][playerName];
     local _, current, tex = GetCurrencyInfo(id)
     local currentText = ("\124T%s:12\124t %s"):format(tex, current);
     self.text:SetText(currentText)
@@ -90,7 +90,7 @@ local function AddToTokenMenu(id)
 	local name, _, tex, _, _, _, _ = GetCurrencyInfo(id)
 	local itemName = "\124T"..tex..":12\124t "..name;
 	local fn = function()
-		SVUI_Global.Accountant[playerRealm]["tokens"][playerName] = id;
+		MOD.Accountant[playerRealm]["tokens"][playerName] = id;
 		TokensEventHandler(TokenParent)
 	end
 	tinsert(TokenMenuList, {text = itemName, func = fn});
diff --git a/Interface/AddOns/SVUI_StyleOMatic/addons/thirdparty/Altoholic.lua b/Interface/AddOns/SVUI_StyleOMatic/addons/thirdparty/Altoholic.lua
index 7de7600..350c8a4 100644
--- a/Interface/AddOns/SVUI_StyleOMatic/addons/thirdparty/Altoholic.lua
+++ b/Interface/AddOns/SVUI_StyleOMatic/addons/thirdparty/Altoholic.lua
@@ -39,8 +39,9 @@ ALTOHOLIC
 ]]--
 local function ColorAltoBorder(self)
 	if self.border then
-		local r, g, b = self.border:GetVertexColor()
 		local Backdrop = self.backdrop or self.Backdrop
+		if not Backdrop then return end
+		local r, g, b = self.border:GetVertexColor()
 		Backdrop:SetBackdropBorderColor(r, g, b, 1)
 	end
 end