Quantcast

fix to cache

Munglunch [10-02-14 - 20:22]
fix to cache
Filename
Interface/AddOns/SVUI/libs/LibSuperVillain-1.0/LibSuperVillain-1.0.lua
Interface/AddOns/SVUI/packages/bag/SVBag.lua
Interface/AddOns/SVUI/system/mentalo.lua
Interface/AddOns/SVUI/system/slash.lua
diff --git a/Interface/AddOns/SVUI/libs/LibSuperVillain-1.0/LibSuperVillain-1.0.lua b/Interface/AddOns/SVUI/libs/LibSuperVillain-1.0/LibSuperVillain-1.0.lua
index feddff9..7facab1 100644
--- a/Interface/AddOns/SVUI/libs/LibSuperVillain-1.0/LibSuperVillain-1.0.lua
+++ b/Interface/AddOns/SVUI/libs/LibSuperVillain-1.0/LibSuperVillain-1.0.lua
@@ -85,10 +85,6 @@ local PluginString = ""
 local AllowedIndexes, LoadOnDemand = {},{};
 local Callbacks, ScriptQueue = {},{};

-AllowedIndexes.G = {}
-AllowedIndexes.C = {}
-AllowedIndexes.P = {}
-
 local playerClass = select(2,UnitClass("player"));

 local INFO_FORMAT = "|cffFFFF00%s|r\n        |cff33FF00Version: %s|r |cff0099FFby %s|r";
@@ -452,16 +448,6 @@ function lib:UpdateDatabase(event)
                 removedefaults(sv[k], src[k])
             end
         end
-        for k,v in pairs(CACHE_SV) do
-            if(not AllowedIndexes.C[k]) then
-                CACHE_SV[k] = nil
-            end
-        end
-        for k,v in pairs(GLOBAL_SV) do
-            if(not AllowedIndexes.G[k]) then
-                GLOBAL_SV[k] = nil
-            end
-        end
     elseif(event == "ACTIVE_TALENT_GROUP_CHANGED") then
         if(PROFILE_SV.SAFEDATA and PROFILE_SV.SAFEDATA.dualSpecEnabled) then
             SOURCE_KEY = GetSpecialization() or 1
@@ -498,7 +484,6 @@ end

 function lib:NewCache(index)
     index = index or CoreObject.Schema
-    AllowedIndexes.C[index] = index
     if(not CACHE_SV[index]) then
         CACHE_SV[index] = {}
     end
@@ -507,7 +492,6 @@ end

 function lib:NewGlobal(index)
     index = index or CoreObject.Schema
-    AllowedIndexes.G[index] = index
     if(not GLOBAL_SV[index]) then
         GLOBAL_SV[index] = {}
     end
@@ -801,7 +785,7 @@ function lib:NewPlugin(addonName, addonObject)
     if(not PLUGINS) then PLUGINS = {} end

     PLUGINS[#PLUGINS+1] = schema
-    AllowedIndexes.P[schema] = schema
+    AllowedIndexes[schema] = schema

     local infoString = SetPluginString(addonName)
     local oldString = PluginString
@@ -879,7 +863,7 @@ local Core_NewPackage = function(self, schema, header)
     if(not MODULES) then MODULES = {} end
     MODULES[#MODULES+1] = schema

-    AllowedIndexes.P[schema] = schema
+    AllowedIndexes[schema] = schema

     local addonName = ("SVUI [%s]"):format(schema)

@@ -993,9 +977,6 @@ function lib:Initialize()
         GLOBAL_SV.profileKeys[k] = k
     end

-    AllowedIndexes.G["profileKeys"] = "profileKeys"
-    AllowedIndexes.G["profiles"] = "profiles"
-
     --CACHE SAVED VARIABLES
     if not _G[CACHE_FILENAME] then _G[CACHE_FILENAME] = {} end
     CACHE_SV = _G[CACHE_FILENAME]
@@ -1033,7 +1014,7 @@ function lib:Initialize()
                     tablecopy(v, PROFILE_SV.STORED[1][coreSchema])
                 elseif(k == "media" or k == "filter") then
                     PROFILE_SV.STORED[1][coreSchema][k] = v
-                elseif(AllowedIndexes.P[k]) then
+                elseif(AllowedIndexes[k]) then
                     PROFILE_SV.STORED[1][k] = v
                 end
             end
diff --git a/Interface/AddOns/SVUI/packages/bag/SVBag.lua b/Interface/AddOns/SVUI/packages/bag/SVBag.lua
index 1070fdf..98d7083 100644
--- a/Interface/AddOns/SVUI/packages/bag/SVBag.lua
+++ b/Interface/AddOns/SVUI/packages/bag/SVBag.lua
@@ -390,7 +390,7 @@ function MOD:Layout(isBank, isReagent)
 				f.ContainerHolder[i].iconTexture:SetTexCoord(0.1, 0.9, 0.1, 0.9 )
 			end
 			f.ContainerHolder:Size(((buttonSize + buttonSpacing) * (isBank and i - 1 or i)) + buttonSpacing, buttonSize + (buttonSpacing * 2))
-			if isBank then
+			if(isBank and f.ContainerHolder[i].GetInventorySlot) then
 				BankFrameItemButton_Update(f.ContainerHolder[i])
 				BankFrameItemButton_UpdateLocked(f.ContainerHolder[i])
 			end
@@ -479,7 +479,7 @@ function MOD:Layout(isBank, isReagent)
 				f.Bags[bagID].numSlots = numSlots;
 			end
 			if(self.isBank and not self.isReagent) then
-				if self.ContainerHolder[i] then
+				if(self.ContainerHolder[i] and self.ContainerHolder[i].GetInventorySlot) then
 					BankFrameItemButton_Update(self.ContainerHolder[i])
 					BankFrameItemButton_UpdateLocked(self.ContainerHolder[i])
 				end
diff --git a/Interface/AddOns/SVUI/system/mentalo.lua b/Interface/AddOns/SVUI/system/mentalo.lua
index e7c7761..2c26bed 100644
--- a/Interface/AddOns/SVUI/system/mentalo.lua
+++ b/Interface/AddOns/SVUI/system/mentalo.lua
@@ -39,7 +39,6 @@ local L = SV.L;
 local Mentalo = {}

 Mentalo.Frames = {}
-Mentalo.Anchors = {}

 local MentaloUpdateHandler = CreateFrame("Frame", nil)

@@ -612,10 +611,7 @@ function Mentalo:HasMoved(frame)
 end

 function Mentalo:SaveMovable(frame)
-	if not _G[frame] then return end
-	if not self.Anchors then
-		self.Anchors = {}
-	end
+	if(not _G[frame] or not self.Anchors) then return end
 	self.Anchors[frame] = CurrentPosition(_G[frame])
 end

@@ -671,8 +667,10 @@ function Mentalo:Reset(request)
 					end
 				end
 			end
+		end
+		if(self.Anchors) then
+			self.Anchors = {}
 		end
-		wipe(self.Anchors)
 	else
 		for name, _ in pairs(self.Frames)do
 			if self.Frames[name]["point"] then
@@ -684,7 +682,7 @@ function Mentalo:Reset(request)
 							local u, v, w, x, y = split("\031", self.Frames[name]["point"])
 							frame:ClearAllPoints()
 							frame:SetPoint(u, v, w, x, y)
-							if self.Anchors then
+							if(self.Anchors and self.Anchors[name]) then
 								self.Anchors[name] = nil
 							end
 							if (self.Frames[name]["postdrag"] ~= nil and type(self.Frames[name]["postdrag"]) == "function")then
diff --git a/Interface/AddOns/SVUI/system/slash.lua b/Interface/AddOns/SVUI/system/slash.lua
index 43def94..efe033d 100644
--- a/Interface/AddOns/SVUI/system/slash.lua
+++ b/Interface/AddOns/SVUI/system/slash.lua
@@ -58,10 +58,6 @@ local function SVUIMasterCommand(msg)
 			MOD.ForceHideBGStats = nil;
 			MOD:Generate()
 			SV:AddonMessage(L['Battleground statistics will now show again if you are inside a battleground.'])
-		elseif (msg == "toasty" or msg == "kombat") then
-			SV:ToastyKombat()
-		elseif (msg == "lol") then
-			PlaySoundFile("Sound\\Character\\Human\\HumanVocalFemale\\HumanFemalePissed04.wav")
 		else
 			SV:ToggleConfig()
 		end
@@ -151,6 +147,16 @@ do
 		end
 	end
 end
+
+SLASH_KOMBAT1 = "/kombat"
+SlashCmdList["KOMBAT"] = function(msg)
+	SV:ToastyKombat()
+end
+
+SLASH_LOLWUT1 = "/lolwut"
+SlashCmdList["LOLWUT"] = function(msg)
+	PlaySoundFile("Sound\\Character\\Human\\HumanVocalFemale\\HumanFemalePissed04.wav")
+end
 --[[
 ##########################################################
 LOAD ALL SLASH FUNCTIONS