From a1e4855071f96feb35e06ef7a887cc47e486dc82 Mon Sep 17 00:00:00 2001 From: Crum Date: Tue, 19 Dec 2017 23:45:32 -0600 Subject: [PATCH] update Bags (needs more work) --- 2/3/4/5/6/7/ElvUI/Modules/Bags/BagBar.lua | 62 ++++++++------- 2/3/4/5/6/7/ElvUI/Modules/Bags/Bags.lua | 97 +++++++++++------------ 2/3/4/5/6/7/ElvUI/Modules/Bags/Sort.lua | 18 ++--- 3 files changed, 87 insertions(+), 90 deletions(-) diff --git a/2/3/4/5/6/7/ElvUI/Modules/Bags/BagBar.lua b/2/3/4/5/6/7/ElvUI/Modules/Bags/BagBar.lua index d8715b4..66c6d86 100644 --- a/2/3/4/5/6/7/ElvUI/Modules/Bags/BagBar.lua +++ b/2/3/4/5/6/7/ElvUI/Modules/Bags/BagBar.lua @@ -14,7 +14,7 @@ local TOTAL_BAGS = NUM_BAG_FRAMES + 2 local ElvUIKeyRing = CreateFrame("CheckButton", "ElvUIKeyRingButton", UIParent, "ItemButtonTemplate") ElvUIKeyRing:RegisterForClicks("anyUp") -ElvUIKeyRing:StripTextures() +E:StripTextures(ElvUIKeyRing) ElvUIKeyRing:SetScript("OnClick", function() if CursorHasItem() then PutKeyInKeyRing() else ToggleKeyRing() end end) ElvUIKeyRing:SetScript("OnReceiveDrag", function() if CursorHasItem() then PutKeyInKeyRing() end end) ElvUIKeyRing:SetScript("OnEnter", function(self) GameTooltip:SetOwner(self, "ANCHOR_LEFT") local color = HIGHLIGHT_FONT_COLOR GameTooltip:SetText(KEYRING, color.r, color.g, color.b) GameTooltip:AddLine() end) @@ -36,12 +36,12 @@ function B:SkinBag(bag) local icon = _G[bag:GetName().."IconTexture"] bag.oldTex = icon:GetTexture() - bag:StripTextures() - bag:CreateBackdrop("Default", true) + E:StripTextures(bag) + E:CreateBackdrop(bag, "Default", true) bag.backdrop:SetAllPoints() - bag:StyleButton(true) + E:StyleButton(bag, true) icon:SetTexture(bag.oldTex) - icon:SetInside() + E:SetInside(icon) icon:SetTexCoord(unpack(E.TexCoords)) end @@ -67,49 +67,51 @@ function B:SizeAndPositionBagBar() ElvUIBags.backdrop:Hide() end - ElvUIKeyRingButton:Size(bagBarSize) + ElvUIKeyRingButton:SetWidth(bagBarSize) + ElvUIKeyRingButton:SetHeight(bagBarSize) ElvUIKeyRingButton:ClearAllPoints() - for i = 1, #ElvUIBags.buttons do + for i = 1, getn(ElvUIBags.buttons) do local button = ElvUIBags.buttons[i] local prevButton = ElvUIBags.buttons[i-1] - button:Size(E.db.bags.bagBar.size) + button:SetWidth(E.db.bags.bagBar.size) + button:SetHeight(E.db.bags.bagBar.size) button:ClearAllPoints() button:Show() if growthDirection == "HORIZONTAL" and sortDirection == "ASCENDING" then if i == 1 then - button:Point("LEFT", ElvUIBags, "LEFT", (showBackdrop and (backdropSpacing + E.Border) or 0), 0) + button:SetPoint("LEFT", ElvUIBags, "LEFT", (showBackdrop and (backdropSpacing + E.Border) or 0), 0) elseif prevButton then - button:Point("LEFT", prevButton, "RIGHT", buttonSpacing, 0) + button:SetPoint("LEFT", prevButton, "RIGHT", buttonSpacing, 0) end elseif growthDirection == "VERTICAL" and sortDirection == "ASCENDING" then if i == 1 then - button:Point("TOP", ElvUIBags, "TOP", 0, -(showBackdrop and (backdropSpacing + E.Border) or 0)) + button:SetPoint("TOP", ElvUIBags, "TOP", 0, -(showBackdrop and (backdropSpacing + E.Border) or 0)) elseif prevButton then - button:Point("TOP", prevButton, "BOTTOM", 0, -buttonSpacing) + button:SetPoint("TOP", prevButton, "BOTTOM", 0, -buttonSpacing) end elseif growthDirection == "HORIZONTAL" and sortDirection == "DESCENDING" then if i == 1 then - button:Point("RIGHT", ElvUIBags, "RIGHT", -(showBackdrop and (backdropSpacing + E.Border) or 0), 0) + button:SetPoint("RIGHT", ElvUIBags, "RIGHT", -(showBackdrop and (backdropSpacing + E.Border) or 0), 0) elseif prevButton then - button:Point("RIGHT", prevButton, "LEFT", -buttonSpacing, 0) + button:SetPoint("RIGHT", prevButton, "LEFT", -buttonSpacing, 0) end else if i == 1 then - button:Point("BOTTOM", ElvUIBags, "BOTTOM", 0, (showBackdrop and (backdropSpacing + E.Border) or 0)) + button:SetPoint("BOTTOM", ElvUIBags, "BOTTOM", 0, (showBackdrop and (backdropSpacing + E.Border) or 0)) elseif prevButton then - button:Point("BOTTOM", prevButton, "TOP", 0, buttonSpacing) + button:SetPoint("BOTTOM", prevButton, "TOP", 0, buttonSpacing) end end end if growthDirection == "HORIZONTAL" then - ElvUIBags:Width(bagBarSize*(TOTAL_BAGS) + buttonSpacing*(TOTAL_BAGS-1) + ((showBackdrop == true and (E.Border + backdropSpacing) or E.Spacing)*2)) - ElvUIBags:Height(bagBarSize + ((showBackdrop and (E.Border + backdropSpacing) or E.Spacing)*2)) + ElvUIBags:SetWidth(bagBarSize*(TOTAL_BAGS) + buttonSpacing*(TOTAL_BAGS-1) + ((showBackdrop == true and (E.Border + backdropSpacing) or E.Spacing)*2)) + ElvUIBags:SetHeight(bagBarSize + ((showBackdrop and (E.Border + backdropSpacing) or E.Spacing)*2)) else - ElvUIBags:Height(bagBarSize*(TOTAL_BAGS) + buttonSpacing*(TOTAL_BAGS-1) + ((showBackdrop == true and (E.Border + backdropSpacing) or E.Spacing)*2)) - ElvUIBags:Width(bagBarSize + ((showBackdrop and (E.Border + backdropSpacing) or E.Spacing)*2)) + ElvUIBags:SetHeight(bagBarSize*(TOTAL_BAGS) + buttonSpacing*(TOTAL_BAGS-1) + ((showBackdrop == true and (E.Border + backdropSpacing) or E.Spacing)*2)) + ElvUIBags:SetWidth(bagBarSize + ((showBackdrop and (E.Border + backdropSpacing) or E.Spacing)*2)) end end @@ -119,7 +121,7 @@ function B:LoadBagBar() local ElvUIBags = CreateFrame("Frame", "ElvUIBags", E.UIParent) ElvUIBags:SetPoint("TOPRIGHT", RightChatPanel, "TOPLEFT", -4, 0) ElvUIBags.buttons = {} - ElvUIBags:CreateBackdrop() + E:CreateBackdrop(ElvUIBags) ElvUIBags.backdrop:SetAllPoints() ElvUIBags:EnableMouse(true) ElvUIBags:SetScript("OnEnter", OnEnter) @@ -128,11 +130,11 @@ function B:LoadBagBar() MainMenuBarBackpackButton:SetParent(ElvUIBags) MainMenuBarBackpackButton.SetParent = E.dummy MainMenuBarBackpackButton:ClearAllPoints() - MainMenuBarBackpackButtonCount:FontTemplate(nil, 10) + E:FontTemplate(MainMenuBarBackpackButtonCount, nil, 10) MainMenuBarBackpackButtonCount:ClearAllPoints() - MainMenuBarBackpackButtonCount:Point("BOTTOMRIGHT", MainMenuBarBackpackButton, "BOTTOMRIGHT", -1, 4) - MainMenuBarBackpackButton:HookScript("OnEnter", OnEnter) - MainMenuBarBackpackButton:HookScript("OnLeave", OnLeave) + MainMenuBarBackpackButtonCount:SetPoint("BOTTOMRIGHT", MainMenuBarBackpackButton, "BOTTOMRIGHT", -1, 4) + HookScript(MainMenuBarBackpackButton, "OnEnter", OnEnter) + HookScript(MainMenuBarBackpackButton, "OnLeave", OnLeave) tinsert(ElvUIBags.buttons, MainMenuBarBackpackButton) self:SkinBag(MainMenuBarBackpackButton) @@ -147,13 +149,13 @@ function B:LoadBagBar() tinsert(ElvUIBags.buttons, b) end - ElvUIKeyRingButton:SetTemplate() - ElvUIKeyRingButton:StyleButton(true) - _G[ElvUIKeyRingButton:GetName().."IconTexture"]:SetInside() + E:SetTemplate(ElvUIKeyRingButton) + E:StyleButton(ElvUIKeyRingButton, true) + E:SetInside(_G[ElvUIKeyRingButton:GetName().."IconTexture"]) ElvUIKeyRingButton:SetParent(ElvUIBags) ElvUIKeyRingButton.SetParent = E.dummy - ElvUIKeyRingButton:HookScript("OnEnter", OnEnter) - ElvUIKeyRingButton:HookScript("OnLeave", OnLeave) + HookScript(ElvUIKeyRingButton, "OnEnter", OnEnter) + HookScript(ElvUIKeyRingButton, "OnLeave", OnLeave) tinsert(ElvUIBags.buttons, ElvUIKeyRingButton) self:SizeAndPositionBagBar() diff --git a/2/3/4/5/6/7/ElvUI/Modules/Bags/Bags.lua b/2/3/4/5/6/7/ElvUI/Modules/Bags/Bags.lua index 033046a..3841869 100644 --- a/2/3/4/5/6/7/ElvUI/Modules/Bags/Bags.lua +++ b/2/3/4/5/6/7/ElvUI/Modules/Bags/Bags.lua @@ -1,15 +1,15 @@ -local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB -local B = E:NewModule("Bags", "AceHook-3.0", "AceEvent-3.0", "AceTimer-3.0"); -local Search = LibStub("LibItemSearch-1.2", true); -local LIP = LibStub("ItemPrice-1.1", true); +local E, L, V, P, G = unpack(ElvUI) +local B = E:NewModule("Bags", "AceHook-3.0", "AceEvent-3.0", "AceTimer-3.0") +local Search = LibStub("LibItemSearch-1.2", true) +local LIP = LibStub("ItemPrice-1.1", true) --Cache global variables --Lua functions local _G = _G local type, ipairs, pairs, unpack, select, assert = type, ipairs, pairs, unpack, select, assert local tinsert = table.insert -local floor, ceil, mod = math.floor, math.ceil, math.mod -local len, sub, gsub, find = string.len, string.sub, string.gsub, string.find +local floor, ceil = math.floor, math.ceil +local len, sub, find = string.len, string.sub, string.find --WoW API / Variables local BankFrameItemButton_Update = BankFrameItemButton_Update local BankFrameItemButton_UpdateLocked = BankFrameItemButton_UpdateLocked @@ -19,7 +19,6 @@ local CreateFrame = CreateFrame local DeleteCursorItem = DeleteCursorItem local GetContainerItemCooldown = GetContainerItemCooldown local GetContainerItemInfo = GetContainerItemInfo -local GetContainerItemInfo = GetContainerItemInfo local GetContainerItemLink = GetContainerItemLink local GetContainerNumFreeSlots = GetContainerNumFreeSlots local GetContainerNumSlots = GetContainerNumSlots @@ -143,7 +142,7 @@ function B:UpdateSearch() SEARCH_STRING = searchString - --B:SetSearch(SEARCH_STRING) + B:SetSearch(SEARCH_STRING) B:SetGuildBankSearch(SEARCH_STRING) end @@ -155,10 +154,10 @@ function B:OpenEditbox() end function B:ResetAndClear() - local editbox = self:GetParent().editBox or self + local editbox = this:GetParent().editBox or this if editbox then editbox:SetText(SEARCH) end - self:ClearFocus() + this:ClearFocus() B:SearchReset() end @@ -233,7 +232,7 @@ function B:UpdateItemLevelDisplay() for slotID = 1, GetContainerNumSlots(bagID) do local slot = bagFrame.Bags[bagID][slotID] if(slot and slot.itemLevel) then - slot.itemLevel:FontTemplate(E.LSM:Fetch("font", E.db.bags.itemLevelFont), E.db.bags.itemLevelFontSize, E.db.bags.itemLevelFontOutline) + E:FontTemplate(slot.itemLevel, E.LSM:Fetch("font", E.db.bags.itemLevelFont), E.db.bags.itemLevelFontSize, E.db.bags.itemLevelFontOutline) end end end @@ -253,7 +252,7 @@ function B:UpdateCountDisplay() for slotID = 1, GetContainerNumSlots(bagID) do local slot = bagFrame.Bags[bagID][slotID] if(slot and slot.Count) then - slot.Count:FontTemplate(E.LSM:Fetch("font", E.db.bags.countFont), E.db.bags.countFontSize, E.db.bags.countFontOutline) + E:FontTemplate(slot.Count, E.LSM:Fetch("font", E.db.bags.countFont), E.db.bags.countFontSize, E.db.bags.countFontOutline) slot.Count:SetTextColor(color.r, color.g, color.b) end end @@ -268,7 +267,7 @@ function B:UpdateSlot(bagID, slotID) if (self.Bags[bagID] and self.Bags[bagID].numSlots ~= GetContainerNumSlots(bagID)) or not self.Bags[bagID] or not self.Bags[bagID][slotID] then return end local slot, _ = self.Bags[bagID][slotID], nil - --local bagType = self.Bags[bagID].type + local bagType = self.Bags[bagID].type local texture, count, locked = GetContainerItemInfo(bagID, slotID) local clink = GetContainerItemLink(bagID, slotID) @@ -442,8 +441,8 @@ function B:Layout(isBank) f.ContainerHolder[i]:SetCheckedTexture("") f.ContainerHolder[i]:SetPushedTexture("") f.ContainerHolder[i].id = isBank and bagID or bagID + 1 - HookScript(f.ContainerHolder[i], "OnEnter", function() B.SetSlotAlphaForBag(thid, f) end) - HookScript(f.ContainerHolder[i], "OnLeave", function() B.ResetSlotAlphaForBags(thid, f) end) + HookScript(f.ContainerHolder[i], "OnEnter", function() B.SetSlotAlphaForBag(this, f) end) + HookScript(f.ContainerHolder[i], "OnLeave", function() B.ResetSlotAlphaForBags(this, f) end) if isBank then f.ContainerHolder[i]:SetID(bagID) @@ -457,8 +456,8 @@ function B:Layout(isBank) f.ContainerHolder[i].iconTexture:SetTexCoord(unpack(E.TexCoords)) end - f.ContainerHolder:SetWidth(((buttonSize + buttonSpacing) * (isBank and i - 1 or i)) + buttonSpacing,buttonSize + (buttonSpacing * 2)) - f.ContainerHolder:SetHeight(((buttonSize + buttonSpacing) * (isBank and i - 1 or i)) + buttonSpacing,buttonSize + (buttonSpacing * 2)) + f.ContainerHolder:SetWidth(((buttonSize + buttonSpacing) * (isBank and i - 1 or i)) + buttonSpacing) + f.ContainerHolder:SetHeight(buttonSize + (buttonSpacing * 2)) if isBank then BankFrameItemButton_Update(f.ContainerHolder[i]) @@ -488,7 +487,7 @@ function B:Layout(isBank) end f.Bags[bagID].numSlots = numSlots - --f.Bags[bagID].type = select(2, GetContainerNumFreeSlots(bagID)) + -- f.Bags[bagID].type = select(2, GetContainerNumFreeSlots(bagID)) --Hide unused slots for i = 1, MAX_CONTAINER_ITEMS do @@ -714,7 +713,7 @@ function B:OnEvent() this:UpdateBagSlots(arg1, arg2) if(B:IsSearching()) then - -- B:SetSearch(SEARCH_STRING) + B:SetSearch(SEARCH_STRING) end elseif event == "BAG_UPDATE_COOLDOWN" then if not this:IsShown() then return end @@ -725,7 +724,8 @@ function B:OnEvent() end function B:UpdateGoldText() - self.BagFrame.goldText:SetText(E:FormatMoney(GetMoney(), E.db["bags"].moneyFormat, not E.db["bags"].moneyCoins)) + -- self.BagFrame.goldText:SetText(E:FormatMoney(GetMoney(), E.db["bags"].moneyFormat, not E.db["bags"].moneyCoins)) + self.BagFrame.goldText:SetText(E:FormatMoney(GetMoney(), "SMART", true)) end function B:GetGraysValue() @@ -735,10 +735,10 @@ function B:GetGraysValue() for s = 0, GetContainerNumSlots(b) do local l = GetContainerItemLink(b, s) if l and find(l,"ff9d9d9d") then - local p = LIP:GetSellValue(l) * select(2, GetContainerItemInfo(b, s)) - if(select(3, GetItemInfo(l)) == 0 and p > 0) then - c = c + p - end + -- local p = LIP:GetSellValue(l) * select(2, GetContainerItemInfo(b, s)) + -- if(select(3, GetItemInfo(l)) == 0 and p > 0) then + -- c = c + p + -- end end end end @@ -837,10 +837,10 @@ function B:ContructContainerFrame(name, isBank) f:SetMovable(true) f:RegisterForDrag("LeftButton", "RightButton") - f:RegisterForClicks("LeftButtonUp", "RightButtonUp") - f:SetScript("OnDragStart", function() if IsShiftKeyDown() then this:StartMoving() end end) + f:RegisterForClicks("AnyUp") + f:SetScript("OnDragStart", function() if(IsShiftKeyDown()) then this:StartMoving() end end) f:SetScript("OnDragStop", function() this:StopMovingOrSizing() end) - f:SetScript("OnClick", function() if IsControlKeyDown() then B.PostBagMove(this.mover) end end) + f:SetScript("OnClick", function() if(IsControlKeyDown()) then B.PostBagMove(this.mover) end end) f:SetScript("OnEnter", function() GameTooltip:SetOwner(this, "ANCHOR_TOPLEFT", 0, 4) GameTooltip:ClearLines() @@ -878,15 +878,15 @@ function B:ContructContainerFrame(name, isBank) E:SetTemplate(f.sortButton) f.sortButton:SetPoint("RIGHT", f.bagText, "LEFT", -5, E.Border * 2) f.sortButton:SetNormalTexture("Interface\\AddOns\\ElvUI\\media\\textures\\INV_Pet_RatCage") - --f.sortButton:GetNormalTexture():SetTexCoord(unpack(E.TexCoords)) - --E:SetInside(f.sortButton:GetNormalTexture()) + f.sortButton:GetNormalTexture():SetTexCoord(unpack(E.TexCoords)) + f.sortButton:GetNormalTexture():SetInside() f.sortButton:SetPushedTexture("Interface\\AddOns\\ElvUI\\media\\textures\\INV_Pet_RatCage") - --f.sortButton:GetPushedTexture():SetTexCoord(unpack(E.TexCoords)) - --E:SetInside(f.sortButton:GetPushedTexture()) + f.sortButton:GetPushedTexture():SetTexCoord(unpack(E.TexCoords)) + f.sortButton:GetPushedTexture():SetInside() f.sortButton:SetDisabledTexture("Interface\\AddOns\\ElvUI\\media\\textures\\INV_Pet_RatCage") - --f.sortButton:GetDisabledTexture():SetTexCoord(unpack(E.TexCoords)) - --E:SetInside(f.sortButton:GetDisabledTexture()) - --f.sortButton:GetDisabledTexture():SetDesaturated(true) + f.sortButton:GetDisabledTexture():SetTexCoord(unpack(E.TexCoords)) + f.sortButton:GetDisabledTexture():SetInside() + f.sortButton:GetDisabledTexture():SetDesaturated(true) E:StyleButton(f.sortButton, nil, true) f.sortButton.ttText = L["Sort Bags"] f.sortButton:SetScript("OnEnter", self.Tooltip_Show) @@ -993,15 +993,15 @@ function B:ContructContainerFrame(name, isBank) E:SetTemplate(f.sortButton) f.sortButton:SetPoint("RIGHT", f.goldText, "LEFT", -5, E.Border * 2) f.sortButton:SetNormalTexture("Interface\\AddOns\\ElvUI\\media\\textures\\INV_Pet_RatCage") - --f.sortButton:GetNormalTexture():SetTexCoord(unpack(E.TexCoords)) - --E:SetInside(f.sortButton:GetNormalTexture()) + -- f.sortButton:GetNormalTexture():SetTexCoord(unpack(E.TexCoords)) + -- E:SetInside(f.sortButton:GetNormalTexture()) f.sortButton:SetPushedTexture("Interface\\AddOns\\ElvUI\\media\\textures\\INV_Pet_RatCage") - --f.sortButton:GetPushedTexture():SetTexCoord(unpack(E.TexCoords)) - --E:SetInside(f.sortButton:GetPushedTexture()) + -- f.sortButton:GetPushedTexture():SetTexCoord(unpack(E.TexCoords)) + -- E:SetInside(f.sortButton:GetPushedTexture()) f.sortButton:SetDisabledTexture("Interface\\AddOns\\ElvUI\\media\\textures\\INV_Pet_RatCage") - --f.sortButton:GetDisabledTexture():SetTexCoord(unpack(E.TexCoords)) - --E:SetInside(f.sortButton:GetDisabledTexture()) - --f.sortButton:GetDisabledTexture():SetDesaturated(true) + -- f.sortButton:GetDisabledTexture():SetTexCoord(unpack(E.TexCoords)) + -- E:SetInside(f.sortButton:GetDisabledTexture()) + -- f.sortButton:GetDisabledTexture():SetDesaturated(true) E:StyleButton(f.sortButton, nil, true) f.sortButton.ttText = L["Sort Bags"] f.sortButton:SetScript("OnEnter", self.Tooltip_Show) @@ -1193,10 +1193,6 @@ function B:PLAYERBANKBAGSLOTS_CHANGED() self:Layout(true) end -function B:GUILDBANKBAGSLOTS_CHANGED() - self:SetGuildBankSearch(SEARCH_STRING) -end - function B:CloseBank() if not self.BankFrame then return end -- WHY???, WHO KNOWS! self.BankFrame:Hide() @@ -1212,10 +1208,10 @@ function B:PostBagMove() if not x then return end if(y > (screenHeight / 2)) then - --self:SetText(self.textGrowDown) + self:SetText(self.textGrowDown) self.POINT = ((x > (screenWidth/2)) and "TOPRIGHT" or "TOPLEFT") else - --self:SetText(self.textGrowUp) + self:SetText(self.textGrowUp) self.POINT = ((x > (screenWidth/2)) and "BOTTOMRIGHT" or "BOTTOMLEFT") end @@ -1233,7 +1229,7 @@ function B:PostBagMove() end function B:Initialize() - --self:LoadBagBar() + -- self:LoadBagBar() local BagFrameHolder = CreateFrame("Frame", nil, E.UIParent) BagFrameHolder:SetWidth(200) @@ -1244,7 +1240,7 @@ function B:Initialize() BagFrameHolder:SetPoint("BOTTOMRIGHT", RightChatPanel, "BOTTOMRIGHT", -(E.Border*2), 22 + E.Border*4 - E.Spacing*2) E:CreateMover(BagFrameHolder, "ElvUIBagMover", L["Bag Mover"], nil, nil, B.PostBagMove) - -- self:SecureHook("UpdateContainerFrameAnchors") + self:SecureHook("UpdateContainerFrameAnchors") return end @@ -1272,7 +1268,7 @@ function B:Initialize() self.BagFrame = self:ContructContainerFrame("ElvUI_ContainerFrame") --Hook onto Blizzard Functions - --self:SecureHook("ToggleBackpack") + self:SecureHook("ToggleBackpack") self:SecureHook("ToggleBag", "ToggleBags") self:SecureHook("OpenBackpack", "OpenBags") self:SecureHook("CloseAllBags", "CloseBags") @@ -1284,7 +1280,6 @@ function B:Initialize() E.Bags = self self:DisableBlizzard() - self:RegisterEvent("GUILDBANKBAGSLOTS_CHANGED") self:RegisterEvent("PLAYER_MONEY", "UpdateGoldText") self:RegisterEvent("PLAYER_ENTERING_WORLD", "UpdateGoldText") self:RegisterEvent("PLAYER_TRADE_MONEY", "UpdateGoldText") diff --git a/2/3/4/5/6/7/ElvUI/Modules/Bags/Sort.lua b/2/3/4/5/6/7/ElvUI/Modules/Bags/Sort.lua index f2be4c3..5c85922 100644 --- a/2/3/4/5/6/7/ElvUI/Modules/Bags/Sort.lua +++ b/2/3/4/5/6/7/ElvUI/Modules/Bags/Sort.lua @@ -281,7 +281,7 @@ end local function IterateBackwards(bagList, i) i = i + 1 local step = 1 - for ii = #bagList, 1, -1 do + for ii = getn(bagList), 1, -1 do local bag = bagList[ii] local slots = B:GetNumSlots(bag, bagRole) if i > slots + step then @@ -466,7 +466,7 @@ function B.Stack(sourceBags, targetBags, canMove) local sourceSlot = B:Encode_BagSlot(bag, slot) local itemID = bagIDs[sourceSlot] if itemID and targetItems[itemID] and canMove(itemID, bag, slot) then - for i = #targetSlots, 1, -1 do + for i = getn(targetSlots), 1, -1 do local targetedSlot = targetSlots[i] if bagIDs[sourceSlot] and bagIDs[targetedSlot] == itemID and targetedSlot ~= sourceSlot and not (bagStacks[targetedSlot] == bagMaxStacks[targetedSlot]) and not sourceUsed[targetedSlot] then B:AddMove(sourceSlot, targetedSlot) @@ -503,7 +503,7 @@ local function buildBlacklist(...) if(find(entry, "%[") and find(entry, "%]")) then entry = match(entry, "%[(.*)%]") end - blackListQueries[#blackListQueries+1] = entry + blackListQueries[getn(blackListQueries)+1] = entry end end end @@ -583,7 +583,7 @@ function B.FillBags(from, to) tinsert(specialtyBags, bag) end end - if #specialtyBags > 0 then + if getn(specialtyBags) > 0 then B:Fill(from, specialtyBags) end @@ -608,7 +608,7 @@ function B.Fill(sourceBags, targetBags, reverse, canMove) end for _, bag, slot in B.IterateBags(sourceBags, not reverse, "withdraw") do - if #emptySlots == 0 then break end + if getn(emptySlots) == 0 then break end local bagSlot = B:Encode_BagSlot(bag, slot) local targetBag = B:Decode_BagSlot(emptySlots[1]) local link = B:GetItemLink(bag, slot) @@ -661,7 +661,7 @@ function B:StartStacking() twipe(bagQualities) twipe(moveTracker) - if #moves > 0 then + if getn(moves) > 0 then self.SortUpdateTimer:Show() else B:StopStacking() @@ -792,8 +792,8 @@ function B:DoMoves() twipe(moveTracker) local success, moveID, targetID, moveSource, moveTarget, wasGuild - if #moves > 0 then - for i = #moves, 1, -1 do + if getn(moves) > 0 then + for i = getn(moves), 1, -1 do success, moveID, moveSource, targetID, moveTarget, wasGuild = B:DoMove(moves[i]) if not success then WAIT_TIME = wasGuild and 0.3 or 0.1 @@ -838,7 +838,7 @@ function B:CommandDecorator(func, groupsDefaults) end twipe(bagGroups) - if not groups or #groups == 0 then + if not groups or getn(groups) == 0 then groups = groupsDefaults end for bags in (groups or ""):gmatch("[^%s]+") do