update Bags (needs more work)

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