Quantcast

4.9

Munglunch [10-06-14 - 21:03]
4.9
Filename
Interface/AddOns/SVUI/packages/bag/SVBag.lua
Interface/AddOns/SVUI/packages/bag/tools/breakstuff.lua
Interface/AddOns/SVUI/packages/dock/SVDock.lua
Interface/AddOns/SVUI/packages/unit/elements/tags.lua
Interface/AddOns/SVUI/scripts/ego.lua
Interface/AddOns/SVUI_ConfigOMatic/components/bag.lua
Interface/AddOns/SVUI_ConfigOMatic/components/dock.lua
Interface/AddOns/SVUI_LogOMatic/SVUI_LogOMatic.lua
Interface/AddOns/SVUI_StyleOMatic/components/addons/Skada.lua
diff --git a/Interface/AddOns/SVUI/packages/bag/SVBag.lua b/Interface/AddOns/SVUI/packages/bag/SVBag.lua
index 421cc81..618b218 100644
--- a/Interface/AddOns/SVUI/packages/bag/SVBag.lua
+++ b/Interface/AddOns/SVUI/packages/bag/SVBag.lua
@@ -61,7 +61,7 @@ local ICON_PURCHASE = [[Interface\AddOns\SVUI\assets\artwork\Icons\BAGS-PURCHASE
 local ICON_VENDOR = [[Interface\AddOns\SVUI\assets\artwork\Icons\BAGS-VENDOR]]
 local numBagFrame = NUM_BAG_FRAMES + 1;
 local gearSet, gearList = {}, {};
-local internalTimer, SetBagHooks;
+local internalTimer;
 local RefProfessionColors = {
 	[0x0008] = {224/255,187/255,74/255},
 	[0x0010] = {74/255,77/255,224/255},
@@ -190,31 +190,13 @@ end
 CORE FUNCTIONS
 ##########################################################
 ]]--
-function MOD:GetContainerFrame(isBank, isReagent)
-	if(type(isBank) == "boolean" and isBank == true) then
-		if(type(isReagent) == "boolean" and isReagent == true and self.ReagentFrame) then
-			return self.ReagentFrame
-		elseif(self.BankFrame) then
-			return self.BankFrame
-		end
-	end
-	return self.BagFrame
-end
-
-function MOD:DisableBlizzard()
-	BankFrame:UnregisterAllEvents()
-	for h = 1, NUM_CONTAINER_FRAMES do
-		_G["ContainerFrame"..h]:Die()
-	end
-end
-
 function MOD:INVENTORY_SEARCH_UPDATE()
-	for _, bag in pairs(self.BagFrames)do
-		for _, bagID in ipairs(bag.BagIDs)do
-			for i = 1, GetContainerNumSlots(bagID)do
-				local _, _, _, _, _, _, _, n = GetContainerItemInfo(bagID, i)
-				local item = bag.Bags[bagID][i]
-				if item:IsShown()then
+	for _, frame in pairs(self.BagFrames) do
+		for id, bag in ipairs(frame.Bags) do
+			for i = 1, GetContainerNumSlots(id) do
+				local _, _, _, _, _, _, _, n = GetContainerItemInfo(id, i)
+				local item = bag[i]
+				if(item and item:IsShown()) then
 					if n then
 						SetItemButtonDesaturated(item, 1, 1, 1, 1)
 						item:SetAlpha(0.4)
@@ -228,10 +210,10 @@ function MOD:INVENTORY_SEARCH_UPDATE()
 	end
 end

-function MOD:RefreshSlot(bag, slotID)
-	if self.Bags[bag] and self.Bags[bag].numSlots ~= GetContainerNumSlots(bag) or not self.Bags[bag] or not self.Bags[bag][slotID] then return end
-	local slot, _ = self.Bags[bag][slotID], nil;
-	local bagType = self.Bags[bag].bagFamily;
+local SlotUpdate = function(self, slotID)
+	if(not self[slotID]) then return end
+	local slot, _ = self[slotID], nil;
+	local bagType = self.bagFamily;
 	local texture, count, locked = GetContainerItemInfo(bag, slotID)
 	local itemLink = GetContainerItemLink(bag, slotID);
 	local key;
@@ -276,229 +258,239 @@ function MOD:RefreshSlot(bag, slotID)
 	SetItemButtonDesaturated(slot, locked, 0.5, 0.5, 0.5)
 end

-function MOD:RefreshBagSlots(bag)
-	if(not bag) then return end
-	for i = 1, GetContainerNumSlots(bag)do
-		if self.RefreshSlot then
-			self:RefreshSlot(bag, i)
-		else
-			self:GetParent():RefreshSlot(bag, i)
+local RefreshSlots = function(self, bagID)
+	local id = bagID or self:GetID()
+	if(not id or (not self.SlotUpdate)) then return end
+	local maxcount = GetContainerNumSlots(id)
+	for i = 1, maxcount do
+		self:SlotUpdate(i)
+	end
+end
+
+local BagMenu_OnEnter = function(self)
+	local parent = self.parent
+	if(not parent) then return end
+	for id, bag in ipairs(parent.Bags) do
+		local numSlots = GetContainerNumSlots(id)
+		for i = 1, numSlots do
+			if bag[i] then
+				if id == self.id then
+					bag[i]:SetAlpha(1)
+				else
+					bag[i]:SetAlpha(0.1)
+				end
+			end
 		end
 	end
 end

-function MOD:RefreshBagsSlots()
-	for _, bag in ipairs(self.BagIDs)do
-		if self.Bags[bag] then
-			self.Bags[bag]:RefreshBagSlots(bag)
+local BagMenu_OnLeave = function(self)
+	local parent = self.parent
+	if(not parent) then return end
+	for id, bag in ipairs(parent.Bags) do
+		local numSlots = GetContainerNumSlots(id)
+		for i = 1, numSlots do
+			if bag[i] then
+				bag[i]:SetAlpha(1)
+			end
 		end
-	end
-end
+	end
+end

-function MOD:RefreshCD()
-	for _, bag in ipairs(self.BagIDs)do
-		for i = 1, GetContainerNumSlots(bag)do
-			local start, duration, enable = GetContainerItemCooldown(bag, i)
-			if self.Bags[bag] and self.Bags[bag][i] then
-				CooldownFrame_SetTimer(self.Bags[bag][i].cooldown, start, duration, enable)
+local ContainerFrame_UpdateCooldowns = function(self)
+	for id, bag in ipairs(self.Bags) do
+		for i = 1, GetContainerNumSlots(id)do
+			local start, duration, enable = GetContainerItemCooldown(id, i)
+			if(bag[i]) then
+				CooldownFrame_SetTimer(bag[i].cooldown, start, duration, enable)
 				if duration > 0 and enable == 0 then
-					SetItemButtonTextureVertexColor(self.Bags[bag][i], 0.4, 0.4, 0.4)
+					SetItemButtonTextureVertexColor(bag[i], 0.4, 0.4, 0.4)
 				else
-					SetItemButtonTextureVertexColor(self.Bags[bag][i], 1, 1, 1)
+					SetItemButtonTextureVertexColor(bag[i], 1, 1, 1)
 				end
 			end
 		end
 	end
 end

-function MOD:UseSlotFading(this)
-	for _, id in ipairs(this.BagIDs)do
-		if this.Bags[id] then
-			local numSlots = GetContainerNumSlots(id)
-			for i = 1, numSlots do
-				if this.Bags[id][i] then
-					if id == self.id then
-						this.Bags[id][i]:SetAlpha(1)
-					else
-						this.Bags[id][i]:SetAlpha(0.1)
-					end
-				end
-			end
-		end
-	end
+local ContainerFrame_UpdateBags = function(self)
+	for id, bag in ipairs(self.Bags) do
+		bag:RefreshSlots(id)
+	end
 end

-function MOD:FlushSlotFading(this)
-	for _, id in ipairs(this.BagIDs)do
-		if this.Bags[id] then
-			local numSlots = GetContainerNumSlots(id)
-			for i = 1, numSlots do
-				if this.Bags[id][i] then
-					this.Bags[id][i]:SetAlpha(1)
-				end
-			end
-		end
-	end
-end
+local ContainerFrame_UpdateLayout = function(self)
+	if SV.db.SVBag.enable ~= true then return; end

-function MOD:Layout(isBank, isReagent)
-	if SV.db.SVBag.enable ~= true then return; end
-	local f = MOD:GetContainerFrame(isBank, isReagent);
-	if not f then return; end
+	local isBank = self.isBank
+	local isReagent = self.isReagent
 	local buttonSize = isBank and SV.db.SVBag.bankSize or SV.db.SVBag.bagSize;
-	local buttonSpacing = 8;
+	local buttonSpacing, numContainerRows = 8, 0;
 	local containerWidth = (SV.db.SVBag.alignToChat == true and (isBank and (SV.db.SVDock.dockLeftWidth - 14) or (SV.db.SVDock.dockRightWidth - 14))) or (isBank and SV.db.SVBag.bankWidth) or SV.db.SVBag.bagWidth
 	local numContainerColumns = floor(containerWidth / (buttonSize + buttonSpacing));
 	local holderWidth = ((buttonSize + buttonSpacing) * numContainerColumns) - buttonSpacing;
-	local numContainerRows = 0;
-	local bottomPadding = (containerWidth - holderWidth) / 2;
-	f.holderFrame:Width(holderWidth);
-	f.totalSlots = 0;
-	local lastButton;
-	local lastRowButton;
-	local lastContainerButton;
-	local globalName;
+	local bottomPadding = (containerWidth - holderWidth) * 0.5;
+	local lastButton, lastRowButton, globalName;
 	local numContainerSlots, fullContainerSlots = GetNumBankSlots();
-	for i, bagID in ipairs(f.BagIDs) do
-		if (not isReagent and (not isBank and bagID <= 3) or (isBank and bagID ~= -1 and numContainerSlots >= 1 and not (i - 1 > numContainerSlots)))  then
-			if not f.ContainerHolder[i] then
-				if isBank then
-					globalName = "SVUI_BankBag" .. (bagID - 4);
-					f.ContainerHolder[i] = NewFrame("CheckButton", globalName, f.ContainerHolder, "BankItemButtonBagTemplate")
+
+	self.holderFrame:Width(holderWidth);
+	self.totalSlots = 0;
+
+	for i, bagID in ipairs(self.BagIDs) do
+		if(not isReagent)  then
+			if((not isBank and bagID <= 3) or (isBank and bagID ~= -1 and numContainerSlots >= 1 and not ((i - 1) > numContainerSlots)))  then
+
+				self.BagMenu:Size(((buttonSize + buttonSpacing) * (isBank and i - 1 or i)) + buttonSpacing, buttonSize + (buttonSpacing * 2))
+
+				if(not self.BagMenu[i]) then
+					if isBank then
+						globalName = "SVUI_BankBag" .. (bagID - 4);
+						self.BagMenu[i] = NewFrame("CheckButton", globalName, self.BagMenu, "BankItemButtonBagTemplate")
+					else
+						globalName = "SVUI_MainBag" .. bagID .. "Slot";
+						self.BagMenu[i] = NewFrame("CheckButton", globalName, self.BagMenu, "BagSlotButtonTemplate")
+					end
+
+					self.BagMenu[i].parent = self;
+					self.BagMenu[i].id = isBank and bagID or bagID + 1;
+
+					self.BagMenu[i]:SetNormalTexture("")
+					self.BagMenu[i]:SetCheckedTexture("")
+					self.BagMenu[i]:SetPushedTexture("")
+					self.BagMenu[i]:SetScript("OnClick", nil)
+					self.BagMenu[i]:SetID(isBank and bagID or (bagID + 1))
+
+					self.BagMenu[i].iconTexture = _G[self.BagMenu[i]:GetName().."IconTexture"];
+					self.BagMenu[i].iconTexture:FillInner()
+					self.BagMenu[i].iconTexture:SetTexCoord(0.1, 0.9, 0.1, 0.9)
+
+					self.BagMenu[i]:HookScript("OnEnter", BagMenu_OnEnter)
+					self.BagMenu[i]:HookScript("OnLeave", BagMenu_OnLeave)
+
+					if(isBank and (not self.BagMenu[i].tooltipText)) then
+						self.BagMenu[i].tooltipText = ""
+					end
+				end
+
+				self.BagMenu[i]:Size(buttonSize)
+				self.BagMenu[i]:ClearAllPoints()
+
+				if (isBank and i == 2) or (not isBank and i == 1) then
+					self.BagMenu[i]:SetPoint("BOTTOMLEFT", self.BagMenu, "BOTTOMLEFT", buttonSpacing, buttonSpacing)
 				else
-					globalName = "SVUI_MainBag" .. bagID .. "Slot";
-					f.ContainerHolder[i] = NewFrame("CheckButton", globalName, f.ContainerHolder, "BagSlotButtonTemplate")
+					self.BagMenu[i]:SetPoint("LEFT", self.BagMenu[i - 1], "RIGHT", buttonSpacing, 0)
 				end
-				--f.ContainerHolder[i]:SetSlotTemplate(true, 2, 4, 4, true)
-				f.ContainerHolder[i]:SetNormalTexture("")
-				f.ContainerHolder[i]:SetCheckedTexture(nil)
-				f.ContainerHolder[i]:SetPushedTexture("")
-				f.ContainerHolder[i]:SetScript("OnClick", nil)
-				f.ContainerHolder[i].id = isBank and bagID or bagID + 1;
-				f.ContainerHolder[i]:SetID(isBank and bagID or (bagID + 1))
-				f.ContainerHolder[i]:HookScript("OnEnter", function(self) MOD.UseSlotFading(self, f) end)
-				f.ContainerHolder[i]:HookScript("OnLeave", function(self) MOD.FlushSlotFading(self, f) end)
-				if(isBank and (not f.ContainerHolder[i].tooltipText)) then
-					f.ContainerHolder[i].tooltipText = ""
-				end
-				f.ContainerHolder[i].iconTexture = _G[f.ContainerHolder[i]:GetName().."IconTexture"];
-				f.ContainerHolder[i].iconTexture:FillInner()
-				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 and f.ContainerHolder[i].GetInventorySlot) then
-				BankFrameItemButton_Update(f.ContainerHolder[i])
-				BankFrameItemButton_UpdateLocked(f.ContainerHolder[i])
-			end
-			f.ContainerHolder[i]:Size(buttonSize)
-			f.ContainerHolder[i]:ClearAllPoints()
-			if (isBank and i == 2) or (not isBank and i == 1) then
-				f.ContainerHolder[i]:SetPoint("BOTTOMLEFT", f.ContainerHolder, "BOTTOMLEFT", buttonSpacing, buttonSpacing)
-			else
-				f.ContainerHolder[i]:SetPoint("LEFT", lastContainerButton, "RIGHT", buttonSpacing, 0)
-			end
-			lastContainerButton = f.ContainerHolder[i];
+			end
 		end

 		local numSlots = GetContainerNumSlots(bagID);

+		if not self.Bags[bagID] then
+			self.Bags[bagID] = NewFrame("Frame", self:GetName().."Bag"..bagID, self);
+			self.Bags[bagID]:SetID(bagID);
+			self.Bags[bagID].numSlots = numSlots;
+			self.Bags[bagID].SlotUpdate = SlotUpdate;
+			self.Bags[bagID].RefreshSlots = RefreshSlots;
+		end
+
+		local bag = self.Bags[bagID]
+
 		if numSlots > 0 then
-			if not f.Bags[bagID] then
-				f.Bags[bagID] = NewFrame("Frame", f:GetName().."Bag"..bagID, f);
-				f.Bags[bagID]:SetID(bagID);
-				f.Bags[bagID].RefreshBagSlots = MOD.RefreshBagSlots;
-				f.Bags[bagID].RefreshSlot = RefreshSlot;
-			end
-			f.Bags[bagID].numSlots = numSlots;
 			local btype = select(2, GetContainerNumFreeSlots(bagID));
 			if RefProfessionColors[btype] then
 				local r, g, b = unpack(RefProfessionColors[btype]);
-				f.Bags[bagID].bagFamily = {r, g, b};
-				f.Bags[bagID]:SetBackdropColor(r, g, b, 0.25)
-				f.Bags[bagID]:SetBackdropBorderColor(r, g, b, 1)
+				bag.bagFamily = {r, g, b};
+				bag:SetBackdropColor(r, g, b, 0.25)
+				bag:SetBackdropBorderColor(r, g, b, 1)
 			else
-				f.Bags[bagID].bagFamily = false;
+				bag.bagFamily = false;
 			end
+
 			for i = 1, MAX_CONTAINER_ITEMS do
-				if f.Bags[bagID][i] then
-					f.Bags[bagID][i]:Hide();
+				if bag[i] then
+					bag[i]:Hide();
 				end
-			end
+			end
+
 			for slotID = 1, numSlots do
-				f.totalSlots = f.totalSlots + 1;
-				if not f.Bags[bagID][slotID] then
-					f.Bags[bagID][slotID] = NewFrame("CheckButton", f.Bags[bagID]:GetName().."Slot"..slotID, f.Bags[bagID], bagID == -1 and "BankItemButtonGenericTemplate" or "ContainerFrameItemButtonTemplate");
-					f.Bags[bagID][slotID]:SetNormalTexture(nil);
-					f.Bags[bagID][slotID]:SetCheckedTexture(nil);
-					f.Bags[bagID][slotID]:SetSlotTemplate(true, 2, 0, 0, true);
+				self.totalSlots = self.totalSlots + 1;
+				if not bag[slotID] then
+					bag[slotID] = NewFrame("CheckButton", bag:GetName().."Slot"..slotID, bag, bagID == -1 and "BankItemButtonGenericTemplate" or "ContainerFrameItemButtonTemplate");
+					bag[slotID]:SetNormalTexture(nil);
+					bag[slotID]:SetCheckedTexture(nil);
+					bag[slotID]:SetSlotTemplate(true, 2, 0, 0, true);

-					if(_G[f.Bags[bagID][slotID]:GetName().."NewItemTexture"]) then
-						_G[f.Bags[bagID][slotID]:GetName().."NewItemTexture"]:Hide()
+					if(_G[bag[slotID]:GetName().."NewItemTexture"]) then
+						_G[bag[slotID]:GetName().."NewItemTexture"]:Hide()
 					end

-					f.Bags[bagID][slotID].iconTexture = _G[f.Bags[bagID][slotID]:GetName().."IconTexture"];
-					f.Bags[bagID][slotID].iconTexture:FillInner(f.Bags[bagID][slotID]);
-					f.Bags[bagID][slotID].iconTexture:SetTexCoord(0.1, 0.9, 0.1, 0.9 );
-					f.Bags[bagID][slotID].cooldown = _G[f.Bags[bagID][slotID]:GetName().."Cooldown"];
-					SV.Timers:AddCooldown(f.Bags[bagID][slotID].cooldown)
-					f.Bags[bagID][slotID].bagID = bagID
-					f.Bags[bagID][slotID].slotID = slotID
+					bag[slotID].iconTexture = _G[bag[slotID]:GetName().."IconTexture"];
+					bag[slotID].iconTexture:FillInner(bag[slotID]);
+					bag[slotID].iconTexture:SetTexCoord(0.1, 0.9, 0.1, 0.9);
+					bag[slotID].cooldown = _G[bag[slotID]:GetName().."Cooldown"];
+
+					SV.Timers:AddCooldown(bag[slotID].cooldown)
+
+					bag[slotID].bagID = bagID
+					bag[slotID].slotID = slotID
 				end
-				f.Bags[bagID][slotID]:SetID(slotID);
-				f.Bags[bagID][slotID]:Size(buttonSize);
-				f:RefreshSlot(bagID, slotID);
-				if f.Bags[bagID][slotID]:GetPoint() then
-					f.Bags[bagID][slotID]:ClearAllPoints();
-				end
+
+				bag[slotID]:SetID(slotID);
+				bag[slotID]:Size(buttonSize);
+				self:SlotUpdate(bagID, slotID);
+
+				if bag[slotID]:GetPoint() then
+					bag[slotID]:ClearAllPoints();
+				end
+
 				if lastButton then
-					if (f.totalSlots - 1) % numContainerColumns == 0 then
-						f.Bags[bagID][slotID]:Point("TOP", lastRowButton, "BOTTOM", 0, -buttonSpacing);
-						lastRowButton = f.Bags[bagID][slotID];
+					if (self.totalSlots - 1) % numContainerColumns == 0 then
+						bag[slotID]:Point("TOP", lastRowButton, "BOTTOM", 0, -buttonSpacing);
+						lastRowButton = bag[slotID];
 						numContainerRows = numContainerRows + 1;
 					else
-						f.Bags[bagID][slotID]:Point("LEFT", lastButton, "RIGHT", buttonSpacing, 0);
+						bag[slotID]:Point("LEFT", lastButton, "RIGHT", buttonSpacing, 0);
 					end
 				else
-					f.Bags[bagID][slotID]:Point("TOPLEFT", f.holderFrame, "TOPLEFT");
-					lastRowButton = f.Bags[bagID][slotID];
+					bag[slotID]:Point("TOPLEFT", self.holderFrame, "TOPLEFT");
+					lastRowButton = bag[slotID];
 					numContainerRows = numContainerRows + 1;
-				end
-				lastButton = f.Bags[bagID][slotID];
+				end
+
+				lastButton = bag[slotID];
 			end
 		else
 			for i = 1, MAX_CONTAINER_ITEMS do
-				if f.Bags[bagID] and f.Bags[bagID][i] then
-					f.Bags[bagID][i]:Hide();
+				if(bag[i]) then
+					bag[i]:Hide();
 				end
-			end
-			if f.Bags[bagID] then
-				f.Bags[bagID].numSlots = numSlots;
-			end
-			if(self.isBank and not self.isReagent) then
-				if(self.ContainerHolder[i] and self.ContainerHolder[i].GetInventorySlot) then
-					BankFrameItemButton_Update(self.ContainerHolder[i])
-					BankFrameItemButton_UpdateLocked(self.ContainerHolder[i])
+			end
+
+			if(isBank and not isReagent) then
+				if(self.BagMenu[i] and self.BagMenu[i].GetInventorySlot) then
+					BankFrameItemButton_Update(self.BagMenu[i])
+					BankFrameItemButton_UpdateLocked(self.BagMenu[i])
 				end
 			end
 		end
 	end
-	f:Size(containerWidth, (((buttonSize + buttonSpacing) * numContainerRows) - buttonSpacing) + f.topOffset + f.bottomOffset);
+	self:Size(containerWidth, (((buttonSize + buttonSpacing) * numContainerRows) - buttonSpacing) + self.topOffset + self.bottomOffset);
 end

-function MOD:RefreshBags()
-	if MOD.BagFrame then
-		MOD:Layout(false)
+function MOD:RefreshBagFrames()
+	if self.BagFrame then
+		self.BagFrame:UpdateLayout()
 	end
-	if MOD.BankFrame then
-		MOD:Layout(true)
+	if self.BankFrame then
+		self.BankFrame:UpdateLayout()
 	end
-	if MOD.ReagentFrame then
-		MOD:Layout(true, true)
+	if self.ReagentFrame then
+		self.ReagentFrame:UpdateLayout()
 	end
 end

 function MOD:UpdateGoldText()
-	MOD.BagFrame.goldText:SetText(GetCoinTextureString(GetMoney(), 12))
+	self.BagFrame.goldText:SetText(GetCoinTextureString(GetMoney(), 12))
 end

 function MOD:VendorGrays(arg1, arg2, arg3)
@@ -775,29 +767,35 @@ do
 	end

 	local Container_OnEvent = function(self, event, ...)
-		if(event == "ITEM_LOCK_CHANGED" or event == "ITEM_UNLOCKED") then
-			self:RefreshSlot(...)
+		if(event == "ITEM_LOCK_CHANGED" or event == "ITEM_UNLOCKED") then
+			local bagID, slotID = ...
+			if(bagID and self.Bags[bagID]) then
+				self.Bags[bagID]:SlotUpdate(slotID)
+			end
 		elseif(event == "BAG_UPDATE" or event == "EQUIPMENT_SETS_CHANGED") then
 			BuildEquipmentMap()
-			for _, id in ipairs(self.BagIDs) do
+			for id, bag in ipairs(self.Bags) do
 				local numSlots = GetContainerNumSlots(id)
-				if(not self.Bags[id] and numSlots ~= 0 or self.Bags[id] and numSlots ~= self.Bags[id].numSlots) then
-					MOD:Layout(self.isBank, self.isReagent)
+				if(numSlots ~= bag.numSlots) then
+					self:UpdateLayout()
 					return
 				end
 				if(SV.db.SVGear.misc.setoverlay) then
 					for i = 1, numSlots do
-						if self.Bags[id] and self.Bags[id][i] then
-							UpdateEquipmentInfo(self.Bags[id][i], id, i)
+						if bag[i] then
+							UpdateEquipmentInfo(bag[i], id, i)
 						end
 					end
 				end
-			end
-			self:RefreshBagSlots(...)
+			end
+			local bagID = ...
+			if(bagID and self.Bags[bagID]) then
+				self.Bags[bagID]:RefreshSlots()
+			end
 		elseif(event == "BAG_UPDATE_COOLDOWN") then
-			self:RefreshCD()
+			self:RefreshCooldowns()
 		elseif(event == "PLAYERBANKSLOTS_CHANGED" or event == "PLAYERREAGENTBANKSLOTS_CHANGED") then
-			self:RefreshBagsSlots()
+			self:RefreshBags()
 		end
 	end

@@ -849,7 +847,7 @@ do
 		self:StopMovingOrSizing()
 	end
 	local Container_OnClick = function(self)
-		if IsControlKeyDown()then MOD:ModifyBags()end
+		if IsControlKeyDown() then MOD:ModifyBags() end
 	end
 	local Container_OnEnter = function(self)
 		GameTooltip:SetOwner(self,"ANCHOR_TOPLEFT",0,4)
@@ -860,59 +858,55 @@ do
 	end

 	function MOD:ToggleEquipmentOverlay()
-		local numSlots, container;
-		if(MOD.BagFrame) then
-			container = MOD.BagFrame
-			for _,id in ipairs(container.BagIDs) do
-				numSlots = GetContainerNumSlots(id)
+		if(self.BagFrame) then
+			for id,bag in ipairs(self.BagFrame.Bags) do
+				local numSlots = GetContainerNumSlots(id)
 				if(SV.db.SVGear.misc.setoverlay) then
 					for i=1,numSlots do
-						if container.Bags[id] and container.Bags[id][i] then
-							UpdateEquipmentInfo(container.Bags[id][i], id, i)
+						if bag[i] then
+							UpdateEquipmentInfo(bag[i], id, i)
 						end
 					end
 				else
 					for i=1,numSlots do
-						if(container.Bags[id] and container.Bags[id][i] and container.Bags[id][i].equipmentinfo) then
-							container.Bags[id][i].equipmentinfo:SetText()
+						if(bag and bag[i] and bag[i].equipmentinfo) then
+							bag[i].equipmentinfo:SetText()
 						end
 					end
 				end
 			end
 		end
-		if(MOD.BankFrame) then
-			container = MOD.BankFrame
-			for _,id in ipairs(container.BagIDs) do
-				numSlots = GetContainerNumSlots(id)
+		if(self.BankFrame) then
+			for id,bag in ipairs(self.BankFrame.Bags) do
+				local numSlots = GetContainerNumSlots(id)
 				if(SV.db.SVGear.misc.setoverlay) then
 					for i=1,numSlots do
-						if container.Bags[id] and container.Bags[id][i] then
-							UpdateEquipmentInfo(container.Bags[id][i], id, i)
+						if bag and bag[i] then
+							UpdateEquipmentInfo(bag[i], id, i)
 						end
 					end
 				else
 					for i=1,numSlots do
-						if(container.Bags[id] and container.Bags[id][i] and container.Bags[id][i].equipmentinfo) then
-							container.Bags[id][i].equipmentinfo:SetText()
+						if(bag and bag[i] and bag[i].equipmentinfo) then
+							bag[i].equipmentinfo:SetText()
 						end
 					end
 				end
 			end
 		end
-		if(MOD.ReagentFrame) then
-			container = MOD.ReagentFrame
-			for _,id in ipairs(container.BagIDs) do
-				numSlots = GetContainerNumSlots(id)
+		if(self.ReagentFrame) then
+			for id,bag in ipairs(self.ReagentFrame.Bags) do
+				local numSlots = GetContainerNumSlots(id)
 				if(SV.db.SVGear.misc.setoverlay) then
 					for i=1,numSlots do
-						if container.Bags[id] and container.Bags[id][i] then
-							UpdateEquipmentInfo(container.Bags[id][i], id, i)
+						if bag and bag[i] then
+							UpdateEquipmentInfo(bag[i], id, i)
 						end
 					end
 				else
 					for i=1,numSlots do
-						if(container.Bags[id] and container.Bags[id][i] and container.Bags[id][i].equipmentinfo) then
-							container.Bags[id][i].equipmentinfo:SetText()
+						if(bag and bag[i] and bag[i].equipmentinfo) then
+							bag[i].equipmentinfo:SetText()
 						end
 					end
 				end
@@ -927,10 +921,9 @@ do
 		local frame = NewFrame("Button", bagName, SV.UIParent)
 		frame:SetPanelTemplate("Container")
 		frame:SetFrameStrata("HIGH")
-		frame.RefreshSlot = MOD.RefreshSlot;
-		frame.RefreshBagsSlots = MOD.RefreshBagsSlots;
-		frame.RefreshBagSlots = MOD.RefreshBagSlots;
-		frame.RefreshCD = MOD.RefreshCD;
+		frame.UpdateLayout = ContainerFrame_UpdateLayout;
+		frame.RefreshBags = ContainerFrame_UpdateBags;
+		frame.RefreshCooldowns = ContainerFrame_UpdateCooldowns;

 		frame:RegisterEvent("ITEM_LOCK_CHANGED")
 		frame:RegisterEvent("ITEM_UNLOCKED")
@@ -963,10 +956,10 @@ do
 		frame.holderFrame = NewFrame("Frame", nil, frame)
 		frame.holderFrame:Point("TOP", frame, "TOP", 0, -frame.topOffset)
 		frame.holderFrame:Point("BOTTOM", frame, "BOTTOM", 0, frame.bottomOffset)
-		frame.ContainerHolder = NewFrame("Button", bagName.."ContainerHolder", frame)
-		frame.ContainerHolder:Point("BOTTOMLEFT", frame, "TOPLEFT", 0, 1)
-		frame.ContainerHolder:SetFixedPanelTemplate("Transparent")
-		frame.ContainerHolder:Hide()
+		frame.BagMenu = NewFrame("Button", bagName.."BagMenu", frame)
+		frame.BagMenu:Point("BOTTOMLEFT", frame, "TOPLEFT", 0, 1)
+		frame.BagMenu:SetFixedPanelTemplate("Transparent")
+		frame.BagMenu:Hide()

 		frame.goldText = frame:CreateFontString(nil, "OVERLAY")
 		frame.goldText:SetFontTemplate(SV.Media.font.numbers)
@@ -1047,7 +1040,7 @@ do
 		frame.bagsButton:SetScript("OnEnter", Tooltip_Show)
 		frame.bagsButton:SetScript("OnLeave", Tooltip_Hide)
 		local BagBtn_OnClick = function()
-			ToggleFrame(frame.ContainerHolder)
+			ToggleFrame(frame.BagMenu)
 		end
 		frame.bagsButton:SetScript("OnClick", BagBtn_OnClick)

@@ -1101,10 +1094,9 @@ do
 		local frame = NewFrame("Button", bagName, isReagent and self.BankFrame or SV.UIParent)
 		frame:SetPanelTemplate(isReagent and "Action" or "Container")
 		frame:SetFrameStrata("HIGH")
-		frame.RefreshSlot = MOD.RefreshSlot;
-		frame.RefreshBagsSlots = MOD.RefreshBagsSlots;
-		frame.RefreshBagSlots = MOD.RefreshBagSlots;
-		frame.RefreshCD = MOD.RefreshCD;
+		frame.UpdateLayout = ContainerFrame_UpdateLayout;
+		frame.RefreshBags = ContainerFrame_UpdateBags;
+		frame.RefreshCooldowns = ContainerFrame_UpdateCooldowns;

 		frame:RegisterEvent("ITEM_LOCK_CHANGED")
 		frame:RegisterEvent("ITEM_UNLOCKED")
@@ -1141,10 +1133,10 @@ do
 		frame.holderFrame = NewFrame("Frame", nil, frame)
 		frame.holderFrame:Point("TOP", frame, "TOP", 0, -frame.topOffset)
 		frame.holderFrame:Point("BOTTOM", frame, "BOTTOM", 0, frame.bottomOffset)
-		frame.ContainerHolder = NewFrame("Button", bagName.."ContainerHolder", frame)
-		frame.ContainerHolder:Point("BOTTOMLEFT", frame, "TOPLEFT", 0, 1)
-		frame.ContainerHolder:SetFixedPanelTemplate("Transparent")
-		frame.ContainerHolder:Hide()
+		frame.BagMenu = NewFrame("Button", bagName.."BagMenu", frame)
+		frame.BagMenu:Point("BOTTOMLEFT", frame, "TOPLEFT", 0, 1)
+		frame.BagMenu:SetFixedPanelTemplate("Transparent")
+		frame.BagMenu:Hide()

 		frame.sortButton = NewFrame("Button", nil, frame)
 		frame.sortButton:Point("TOPRIGHT", frame, "TOP", 0, -10)
@@ -1196,7 +1188,7 @@ do
 			local BagBtn_OnClick = function()
 				local numSlots, _ = GetNumBankSlots()
 				if numSlots  >= 1 then
-					ToggleFrame(frame.ContainerHolder)
+					ToggleFrame(frame.BagMenu)
 				else
 					SV:StaticPopup_Show("NO_BANK_BAGS")
 				end
@@ -1273,13 +1265,13 @@ function MOD:RefreshTokens()
 		frame.bottomOffset = 8;
 		if frame.currencyButton:IsShown() then
 			frame.currencyButton:Hide()
-			MOD:Layout(false)
+			MOD.BagFrame:UpdateLayout()
 		end
 		return
 	elseif not frame.currencyButton:IsShown() then
 		frame.bottomOffset = 28;
 		frame.currencyButton:Show()
-		MOD:Layout(false)
+		MOD.BagFrame:UpdateLayout()
 	end
 	frame.bottomOffset = 28;
 	local set = frame.currencyButton;
@@ -1295,100 +1287,88 @@ function MOD:RefreshTokens()
 	end
 end

-do
-	local function OpenBags()
-		GameTooltip:Hide()
-		MOD.BagFrame:Show()
-		MOD.BagFrame:RefreshBagsSlots()
-		TTIP.GameTooltip_SetDefaultAnchor(GameTooltip)
-		MOD.BagFrame.editBox:SearchReset()
-	end

-	local function CloseBags()
-		GameTooltip:Hide()
-		MOD.BagFrame:Hide()
-		if(MOD.BankFrame) then
-			MOD.BankFrame:Hide()
-		end
-		if(MOD.ReagentFrame) then
-			MOD.ReagentFrame:Hide()
-		end
-		if(BreakStuffHandler and BreakStuffButton and BreakStuffButton.icon) then
-			BreakStuffHandler:MODIFIER_STATE_CHANGED()
-			BreakStuffHandler.ReadyToSmash = false
-			BreakStuffButton.ttText = "BreakStuff : OFF";
-			BreakStuffButton.icon:SetGradient("VERTICAL", 0.5, 0.53, 0.55, 0.8, 0.8, 1)
-		end
-		TTIP.GameTooltip_SetDefaultAnchor(GameTooltip)
-		MOD.BagFrame.editBox:SearchReset()
-	end
+local function _openBags()
+	GameTooltip:Hide()
+	MOD.BagFrame:Show()
+	MOD.BagFrame:RefreshBags()
+	TTIP.GameTooltip_SetDefaultAnchor(GameTooltip)
+	MOD.BagFrame.editBox:SearchReset()
+end

-	local function ToggleBags(id)
-		if id and GetContainerNumSlots(id)==0 then return end
-		if MOD.BagFrame:IsShown()then
-			CloseBags()
-		else
-			OpenBags()
-		end
+local function _closeBags()
+	GameTooltip:Hide()
+	MOD.BagFrame:Hide()
+	if(MOD.BankFrame) then
+		MOD.BankFrame:Hide()
 	end
-
-	local function ToggleBackpack()
-		if IsOptionFrameOpen()then return end
-		if IsBagOpen(0) then
-			OpenBags()
-		else
-			CloseBags()
-		end
+	if(MOD.ReagentFrame) then
+		MOD.ReagentFrame:Hide()
 	end
+	if(BreakStuffHandler and BreakStuffButton and BreakStuffButton.icon) then
+		BreakStuffHandler:MODIFIER_STATE_CHANGED()
+		BreakStuffHandler.ReadyToSmash = false
+		BreakStuffButton.ttText = "BreakStuff : OFF";
+		BreakStuffButton.icon:SetGradient("VERTICAL", 0.5, 0.53, 0.55, 0.8, 0.8, 1)
+	end
+	TTIP.GameTooltip_SetDefaultAnchor(GameTooltip)
+	MOD.BagFrame.editBox:SearchReset()
+end

-	function MOD:BANKFRAME_OPENED()
-		local hasReagent = (SV.GameVersion >= 60000)
-		if not MOD.BankFrame then
-			MOD:MakeBankOrReagent()
-			MOD:ModifyBags()
-		end
-		MOD:Layout(true)
+local function _toggleBags(id)
+	if id and GetContainerNumSlots(id)==0 then return end
+	if MOD.BagFrame:IsShown()then
+		_closeBags()
+	else
+		_openBags()
+	end
+end

-		if(hasReagent and not MOD.ReagentFrame) then
-			MOD:MakeBankOrReagent(true)
-			MOD:Layout(true, true)
-		end
-
-		MOD.BankFrame:Show()
-		MOD.BankFrame:RefreshBagsSlots()
-		MOD.BagFrame:Show()
-		MOD.BagFrame:RefreshBagsSlots()
-		MOD.RefreshTokens()
+local function _toggleBackpack()
+	if IsOptionFrameOpen()then return end
+	if IsBagOpen(0) then
+		_openBags()
+	else
+		_closeBags()
+	end
+end
+
+function MOD:BANKFRAME_OPENED()
+	local hasReagent = (SV.GameVersion >= 60000)
+	if not self.BankFrame then
+		self:MakeBankOrReagent()
+		self:ModifyBags()
 	end
+	self.BankFrame:UpdateLayout()

-	function MOD:BANKFRAME_CLOSED()
-		if(MOD.BankFrame and MOD.BankFrame:IsShown()) then
-			MOD.BankFrame:Hide()
-		end
-		if(MOD.ReagentFrame and MOD.ReagentFrame:IsShown()) then
-			MOD.ReagentFrame:Hide()
-		end
+	if(hasReagent and not self.ReagentFrame) then
+		self:MakeBankOrReagent(true)
+		self.ReagentFrame:UpdateLayout()
 	end
+
+	self.BankFrame:Show()
+	self.BankFrame:RefreshBags()
+	self.BagFrame:Show()
+	self.BagFrame:RefreshBags()
+	self.RefreshTokens()
+end

-	function SetBagHooks()
-		NewHook("OpenAllBags", OpenBags)
-		NewHook("CloseAllBags", CloseBags)
-		NewHook("ToggleBag", ToggleBags)
-		NewHook("ToggleAllBags", ToggleBackpack)
-		NewHook("ToggleBackpack", ToggleBackpack)
-		NewHook("BackpackTokenFrame_Update", MOD.RefreshTokens)
-		MOD:RegisterEvent("BANKFRAME_OPENED")
-		MOD:RegisterEvent("BANKFRAME_CLOSED")
+function MOD:BANKFRAME_CLOSED()
+	if(self.BankFrame and self.BankFrame:IsShown()) then
+		self.BankFrame:Hide()
 	end
-end
+	if(self.ReagentFrame and self.ReagentFrame:IsShown()) then
+		self.ReagentFrame:Hide()
+	end
+end

 function MOD:PLAYERBANKBAGSLOTS_CHANGED()
-	MOD:Layout(true)
+	self.BankFrame:UpdateLayout()
 end

 function MOD:PLAYER_ENTERING_WORLD()
 	self:UpdateGoldText()
-	self.BagFrame:RefreshBagsSlots()
+	self.BagFrame:RefreshBags()
 end
 --[[
 ##########################################################
@@ -1397,7 +1377,7 @@ BUILD FUNCTION / UPDATE
 ]]--
 function MOD:ReLoad()
 	if not SV.db.SVBag.enable then return end
-	self:Layout();
+	self.BagFrame:UpdateLayout();
 	self:ModifyBags();
 	self:ModifyBagBar();
 end
@@ -1408,20 +1388,36 @@ function MOD:Load()
 	end
 	if not SV.db.SVBag.enable then return end
 	self:ModifyBagBar()
-	SV.bags = self;
 	self.BagFrames = {}
 	self:MakeBags()
-	SetBagHooks()
 	self:ModifyBags()
-	self:Layout(false)
-	self:DisableBlizzard()
-	SV.Timers:ExecuteTimer(MOD.BreakStuffLoader, 5)
+	self.BagFrame:UpdateLayout()
+
+	BankFrame:UnregisterAllEvents()
+	for i = 1, NUM_CONTAINER_FRAMES do
+		local frame = _G["ContainerFrame"..i]
+		if(frame) then frame:Die() end
+	end
+
+	SV.Timers:ExecuteTimer(self.BreakStuffLoader, 5)
+
+	NewHook("OpenAllBags", _openBags)
+	NewHook("CloseAllBags", _closeBags)
+	NewHook("ToggleBag", _toggleBags)
+	NewHook("ToggleAllBags", _toggleBackpack)
+	NewHook("ToggleBackpack", _toggleBackpack)
+	NewHook("BackpackTokenFrame_Update", self.RefreshTokens)
+
+	self:RegisterEvent("BANKFRAME_OPENED")
+	self:RegisterEvent("BANKFRAME_CLOSED")
 	self:RegisterEvent("INVENTORY_SEARCH_UPDATE")
 	self:RegisterEvent("PLAYER_MONEY", "UpdateGoldText")
 	self:RegisterEvent("PLAYER_ENTERING_WORLD")
 	self:RegisterEvent("PLAYER_TRADE_MONEY", "UpdateGoldText")
 	self:RegisterEvent("TRADE_MONEY_CHANGED", "UpdateGoldText")
 	if(SV.GameVersion >= 60000) then self:RegisterEvent("PLAYERBANKBAGSLOTS_CHANGED"); end
+
 	StackSplitFrame:SetFrameStrata("DIALOG")
-	self.BagFrame:RefreshBagsSlots()
+
+	self.BagFrame:RefreshBags()
 end
\ No newline at end of file
diff --git a/Interface/AddOns/SVUI/packages/bag/tools/breakstuff.lua b/Interface/AddOns/SVUI/packages/bag/tools/breakstuff.lua
index ff08004..3668d80 100644
--- a/Interface/AddOns/SVUI/packages/bag/tools/breakstuff.lua
+++ b/Interface/AddOns/SVUI/packages/bag/tools/breakstuff.lua
@@ -217,7 +217,7 @@ local BreakStuff_OnClick = function(self)
 		if(not MOD.BagFrame:IsShown()) then
 			GameTooltip:Hide()
 			MOD.BagFrame:Show()
-			MOD.BagFrame:RefreshBagsSlots()
+			MOD.BagFrame:RefreshBags()
 			TTIP.GameTooltip_SetDefaultAnchor(GameTooltip,self)
 		end
 	end
diff --git a/Interface/AddOns/SVUI/packages/dock/SVDock.lua b/Interface/AddOns/SVUI/packages/dock/SVDock.lua
index 080b9eb..3f38d15 100644
--- a/Interface/AddOns/SVUI/packages/dock/SVDock.lua
+++ b/Interface/AddOns/SVUI/packages/dock/SVDock.lua
@@ -642,8 +642,7 @@ do
 		SuperDockMacroBar:Size(width, height)
 	end

-	local function CreateMacroToolButton(proName, proID, itemID, size)
-		if proName == "Mining" then proName = "Smelting" end
+	local function CreateMacroToolButton(proName, proID, itemID, size)
 		local data = TOOL_DATA[proID]
 		if(not data) then return end
 		local button = CreateFrame("Button", ("%s_MacroBarButton"):format(itemID), SuperDockMacroBar, "SecureActionButtonTemplate")
@@ -659,6 +658,8 @@ do
 		button.itemId = itemID;
 		button.TText = proName;

+		if proID == 186 then proName = "Smelting" end
+
 		if(data[5]) then
 			local rightClick
 			button:RegisterForClicks("AnyDown")
diff --git a/Interface/AddOns/SVUI/packages/unit/elements/tags.lua b/Interface/AddOns/SVUI/packages/unit/elements/tags.lua
index 8737477..91fa938 100644
--- a/Interface/AddOns/SVUI/packages/unit/elements/tags.lua
+++ b/Interface/AddOns/SVUI/packages/unit/elements/tags.lua
@@ -56,10 +56,12 @@ LOCAL FUNCTIONS
 ##########################################################
 ]]--
 local function Hex(r, g, b)
-	if type(r) == "table" then
+	if(not r) then
+		r, g, b = 1, 1, 1;
+	elseif type(r) == "table" then
 		if r.r then r, g, b = r.r, r.g, r.b else r, g, b = unpack(r) end
 	end
-	return format("|cff%02x%02x%02x", r*255, g*255, b*255)
+	return ("|cff%02x%02x%02x"):format(r*255, g*255, b*255)
 end

 local function TruncateString(value)
@@ -82,22 +84,28 @@ local function SetTagStyle(style, min, max)
 		if result <= 0 then
 			return ""
 		else
-			return format("-%s", TruncateString(result))
+			return ("-%s")format(TruncateString(result))
 		end
-	elseif style == "PERCENT" then
-		result = format("%s%%", format("%.1f", min / max * 100))
+	elseif style == "PERCENT" then
+		local prct = min / max * 100
+		result = ("%.1f"):format(prct)
+		result = ("%s%%"):format(result)
 		result = result:gsub(".0%%", "%%")
 		return result
 	elseif style == "CURRENT" or ((style == "CURRENT_MAX" or style == "CURRENT_MAX_PERCENT" or style == "CURRENT_PERCENT") and min == max) then
-		return format("%s", TruncateString(min))
+		return ("%s"):format(TruncateString(min))
 	elseif style == "CURRENT_MAX" then
-		return format("%s - %s", TruncateString(min), TruncateString(max))
-	elseif style == "CURRENT_PERCENT" then
-		result = format("%s - %s%%", TruncateString(min), format("%.1f", min / max * 100))
+		return ("%s - %s"):format(TruncateString(min), TruncateString(max))
+	elseif style == "CURRENT_PERCENT" then
+		local prct = min / max * 100
+		result = ("%.1f"):format(prct)
+		result = ("%s - %s%%"):format(TruncateString(min), result)
 		result = result:gsub(".0%%", "%%")
 		return result
-	elseif style == "CURRENT_MAX_PERCENT" then
-		result = format("%s - %s - %s%%", TruncateString(min), TruncateString(max), format("%.1f", min / max * 100))
+	elseif style == "CURRENT_MAX_PERCENT" then
+		local prct = min / max * 100
+		result = ("%.1f"):format(prct)
+		result = ("%s - %s - %s%%"):format(TruncateString(min), TruncateString(max), result)
 		result = result:gsub(".0%%", "%%")
 		return result
 	end
@@ -413,7 +421,7 @@ oUF_Villain.Tags.Methods["classpower"] = function()
 	else
 		local color = Hex(r, g, b)
 		local amt = SetTagStyle("CURRENT", currentPower, maxPower)
-		return format("%s%s ", color, amt)
+		return ("%s%s "):format(color, amt)
 	end
 end

@@ -425,7 +433,7 @@ oUF_Villain.Tags.Methods["altpower"] = function(unit)
 			r, g, b = 1, 1, 1
 		end
 		local color = Hex(r, g, b)
-		return format("%s%s ", color, power)
+		return ("%s%s "):format(color, power)
 	else
 		return " "
 	end
diff --git a/Interface/AddOns/SVUI/scripts/ego.lua b/Interface/AddOns/SVUI/scripts/ego.lua
index 4cbf1b5..45a8b51 100644
--- a/Interface/AddOns/SVUI/scripts/ego.lua
+++ b/Interface/AddOns/SVUI/scripts/ego.lua
@@ -31,16 +31,24 @@ GET ADDON DATA
 local SV = select(2, ...)
 local L = SV.L

-local EgoFrame = CreateFrame("Frame", "EgoFrame", UIParent);
+local EgoFrame = CreateFrame("PlayerModel", "SVUI_EgoModel", UIParent);

 local LaunchPopup = function(self, emote)
 	local size = SVUIParent:GetHeight()
-	self.Model:Show()
+	self:Show()
 	self.anim[2]:SetOffset(size, -size)
 	self.anim[2]:SetOffset(0, 0)
 	self.anim:Play()
-	self.Model:SetAnimation(emote)
-end
+	self:SetAnimation(emote)
+end
+
+local ResetPosition = function(self)
+	local size = SVUIParent:GetHeight()
+	self:SetPoint("TOP", SV.UIParent, "TOP", 0, 0)
+	self:SetWidth(size)
+	self:SetHeight(size)
+	self:SetUnit("player")
+end

 local Ego_OnEvent = function(self, event)
 	if event == "ACHIEVEMENT_EARNED" then
@@ -74,14 +82,9 @@ local function LoadSVEgo()
 	EgoFrame:SetPoint("TOP", SV.UIParent, "TOP", 0, 0)
 	EgoFrame:SetWidth(size)
 	EgoFrame:SetHeight(size)
+	EgoFrame:SetUnit("player")
 	EgoFrame.LaunchPopup = LaunchPopup
-
-	local model = CreateFrame("PlayerModel", "EgoFrameModel", EgoFrame)
-	model:SetAllPoints(EgoFrame)
-	model:SetUnit("player")
-	model:Hide()
-
-	EgoFrame.Model = model
+	EgoFrame.ResetPosition = ResetPosition

 	SV.Animate:Slide(EgoFrame, size, -size, true, 1.5)
 	EgoFrame:SetAlpha(0)
@@ -89,6 +92,8 @@ local function LoadSVEgo()

 	SLASH_SVUI_BADASS1="/badass"
 	SlashCmdList["SVUI_BADASS"] = BeAwesome;
+
+	EgoFrame:Show()
 end

 SV:NewScript(LoadSVEgo)
\ No newline at end of file
diff --git a/Interface/AddOns/SVUI_ConfigOMatic/components/bag.lua b/Interface/AddOns/SVUI_ConfigOMatic/components/bag.lua
index ee248ce..66c0b59 100644
--- a/Interface/AddOns/SVUI_ConfigOMatic/components/bag.lua
+++ b/Interface/AddOns/SVUI_ConfigOMatic/components/bag.lua
@@ -82,7 +82,7 @@ SV.Options.args.SVBag = {
 							min = 15,
 							max = 45,
 							step = 1,
-							set = function(a,b)MOD:ChangeDBVar(b,a[#a])MOD:Layout()end
+							set = function(a,b) MOD:ChangeDBVar(b,a[#a]) MOD.BagFrame:UpdateLayout() end
 						},
 						bankSize = {
 							order = 2,
@@ -92,7 +92,7 @@ SV.Options.args.SVBag = {
 							min = 15,
 							max = 45,
 							step = 1,
-							set = function(a,b)MOD:ChangeDBVar(b,a[#a])MOD:Layout(true)end
+							set = function(a,b) MOD:ChangeDBVar(b,a[#a]) MOD.BankFrame:UpdateLayout() end
 						},
 						sortInverted = {
 							order = 3,
@@ -108,7 +108,7 @@ SV.Options.args.SVBag = {
 							min = 150,
 							max = 700,
 							step = 1,
-							set = function(a,b)MOD:ChangeDBVar(b,a[#a])MOD:Layout()end,
+							set = function(a,b) MOD:ChangeDBVar(b,a[#a]) MOD.BagFrame:UpdateLayout() end,
 							disabled = function()return SV.db.SVBag.alignToChat end
 						},
 						bankWidth = {
@@ -119,8 +119,8 @@ SV.Options.args.SVBag = {
 							min = 150,
 							max = 700,
 							step = 1,
-							set = function(a,b)MOD:ChangeDBVar(b,a[#a])MOD:Layout(true)end,
-							disabled = function()return SV.db.SVBag.alignToChat end
+							set = function(a,b) MOD:ChangeDBVar(b,a[#a]) MOD.BankFrame:UpdateLayout() end,
+							disabled = function() return SV.db.SVBag.alignToChat end
 						},
 						currencyFormat = {
 							order = 6,
@@ -131,7 +131,7 @@ SV.Options.args.SVBag = {
 								["ICON"] = L["Icons Only"],
 								["ICON_TEXT"] = L["Icons and Text"]
 							},
-							set = function(a,b)MOD:ChangeDBVar(b,a[#a])MOD:RefreshTokens()end
+							set = function(a,b)MOD:ChangeDBVar(b,a[#a]) MOD:RefreshTokens() end
 						},
 						bagTools = {
 							order = 7,
@@ -163,7 +163,7 @@ SV.Options.args.SVBag = {
 							type = "toggle",
 							name = L["Align To Chat"],
 							desc = L["Align the width of the bag frame to fit inside the chat box."],
-							set = function(a,b)MOD:ChangeDBVar(b,a[#a])MOD:Layout()MOD:Layout(true)end
+							set = function(a,b)MOD:ChangeDBVar(b,a[#a]) MOD:ModifyBags() end
 						},
 						bags = {
 							order = 2,
diff --git a/Interface/AddOns/SVUI_ConfigOMatic/components/dock.lua b/Interface/AddOns/SVUI_ConfigOMatic/components/dock.lua
index 9e71d08..f25e565 100644
--- a/Interface/AddOns/SVUI_ConfigOMatic/components/dock.lua
+++ b/Interface/AddOns/SVUI_ConfigOMatic/components/dock.lua
@@ -230,8 +230,8 @@ SV.Options.args.SVDock.args["rightDockGroup"] = {
 				MOD:ChangeDBVar(value,key[#key]);
 				MOD:UpdateSuperDock(true)
 				CHAT:RefreshChatFrames(true)
-				BAG:Layout()
-				BAG:Layout(true)
+				BAG.BagFrame:UpdateLayout()
+				BAG.BankFrame:UpdateLayout()
 			end,
 		},
 		quest = {
diff --git a/Interface/AddOns/SVUI_LogOMatic/SVUI_LogOMatic.lua b/Interface/AddOns/SVUI_LogOMatic/SVUI_LogOMatic.lua
index a12c511..2dad6ed 100644
--- a/Interface/AddOns/SVUI_LogOMatic/SVUI_LogOMatic.lua
+++ b/Interface/AddOns/SVUI_LogOMatic/SVUI_LogOMatic.lua
@@ -67,10 +67,10 @@ PLUGIN.HasAltInventory = false;
 LOCAL FUNCTIONS
 ##########################################################
 ]]--
-local RefreshLoggedSlot = function(self, bag, slotID, save)
-	if self.Bags[bag] and self.Bags[bag].numSlots ~= GetContainerNumSlots(bag) or not self.Bags[bag] or not self.Bags[bag][slotID] then return end
-	local slot, _ = self.Bags[bag][slotID], nil;
-	local bagType = self.Bags[bag].bagFamily;
+local RefreshLoggedSlot = function(self, slotID, save)
+	if(not self[slotID]) then return end
+	local slot, _ = self[slotID], nil;
+	local bagType = self.bagFamily;
 	local texture, count, locked = GetContainerItemInfo(bag, slotID)
 	local itemLink = GetContainerItemLink(bag, slotID);
 	local key;
@@ -119,30 +119,25 @@ local RefreshLoggedSlot = function(self, bag, slotID, save)
 	SetItemButtonDesaturated(slot, locked, 0.5, 0.5, 0.5)
 end

-local RefreshLoggedBagSlots = function(self, bag, save)
-	if(not bag) then return end
-	for i = 1, GetContainerNumSlots(bag)do
-		local container = self
-		if not self.RefreshSlot then
-			container = self:GetParent()
-		end
-		RefreshLoggedSlot(container, bag, i, save)
+local RefreshLoggedSlots = function(self, bagID, save)
+	local id = bagID or self:GetID()
+	if(not id or (not self.SlotUpdate)) then return end
+	local maxcount = GetContainerNumSlots(id)
+	for i = 1, maxcount do
+		RefreshLoggedSlot(self, i, save)
 	end
 end

-local RefreshLoggedBagsSlots = function(self)
-	for _,bag in ipairs(self.BagIDs)do
-		local container = self.Bags[bag]
-		if container then
-			if PLUGIN.myStash[bag] then
-				twipe(PLUGIN.myStash[bag])
-			else
-				PLUGIN.myStash[bag] = {};
-			end
-			RefreshLoggedBagSlots(container, bag, true)
-		end
+local RefreshLoggedBags = function(self)
+	for id,bag in ipairs(self.Bags)do
+		if PLUGIN.myStash[id] then
+			twipe(PLUGIN.myStash[id])
+		else
+			PLUGIN.myStash[id] = {};
+		end
+		RefreshLoggedSlots(bag, id, true)
 	end
-	for bag,items in pairs(PLUGIN.myStash) do
+	for id,items in pairs(PLUGIN.myStash) do
 		for id,amt in pairs(items) do
 			PLUGIN.BagItemCache[id] = PLUGIN.BagItemCache[id] or {}
 			PLUGIN.BagItemCache[id][nameKey] = amt
@@ -173,7 +168,7 @@ CORE FUNCTIONS
 function PLUGIN:AppendBankFunctions()
 	local BAGS = SV.SVBag;
 	if(BAGS.BankFrame) then
-		BAGS.BankFrame.RefreshBagsSlots = RefreshLoggedBagsSlots
+		BAGS.BankFrame.RefreshBags = RefreshLoggedBags
 	end
 end
 --[[
@@ -233,9 +228,9 @@ function PLUGIN:Load()
 	if SV.db.SVBag.enable then
 		local BAGS = SV.SVBag;
 		if BAGS.BagFrame then
-			BAGS.BagFrame.RefreshBagsSlots = RefreshLoggedBagsSlots;
+			BAGS.BagFrame.RefreshBags = RefreshLoggedBags;
 			NewHook(BAGS, "MakeBankOrReagent", self.AppendBankFunctions);
-			RefreshLoggedBagsSlots(BAGS.BagFrame)
+			RefreshLoggedBags(BAGS.BagFrame)
 		end
 	end
 	if SV.db.SVTip.enable then
diff --git a/Interface/AddOns/SVUI_StyleOMatic/components/addons/Skada.lua b/Interface/AddOns/SVUI_StyleOMatic/components/addons/Skada.lua
index 502fa9b..b13fdd8 100644
--- a/Interface/AddOns/SVUI_StyleOMatic/components/addons/Skada.lua
+++ b/Interface/AddOns/SVUI_StyleOMatic/components/addons/Skada.lua
@@ -65,8 +65,8 @@ local function skada_panel_loader(holder, window)
   window.db.spark=false;
   window.db.barslocked = true;
   window.bargroup:ClearAllPoints()
-  window.bargroup:SetPoint('BOTTOMLEFT',holder,'BOTTOMLEFT',0,0)
-  window.bargroup:SetParent(holder)
+  window.bargroup:SetPoint('BOTTOMLEFT', holder, 'BOTTOMLEFT', 0, 0)
+  window.bargroup:SetParent(UIParent)
   window.bargroup:SetFrameStrata('LOW')

   local bgroup = window.bargroup.backdrop;
@@ -76,6 +76,7 @@ local function skada_panel_loader(holder, window)
   end

   bars:ApplySettings(window)
+  window.bargroup:SetParent(holder)
 end

 function STYLE:Docklet_Skada()