Skip to content

Commit

Permalink
Reagent bag and bank bag fixes. (#806)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cidan authored Nov 22, 2022
1 parent 5b0d33e commit 5bca2bc
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
1 change: 1 addition & 0 deletions Localization.lua
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ L["ENGINEERING_BAG_TAG"] = "Eg"
L["KEYRING_TAG"] = "Ke"
L["GEM_BAG_TAG"] = "Ge"
L["MINING_BAG_TAG"] = "Mi"
L["REAGENT_BAG_TAG"] = "Re"
L["TACKLE_BOX_TAG"] = "Fi"
L["COOKING_BAR_TAG"] = "Co"

Expand Down
4 changes: 3 additions & 1 deletion core/Bags.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ local OpenAllBags = _G.OpenAllBags
local CloseAllBags = _G.CloseAllBags
local IsBagOpen = _G.IsBagOpen
local CloseBankFrame = _G.CloseBankFrame
local SortBags = C_Container and C_Container.SortBags or SortBags
local SortBags = C_Container and _G.C_Container.SortBags or _G.SortBags
local SortBankBags = C_Container and _G.C_Container.SortBankBags or _G.SortBankBags
local SortReagentBankBags = C_Container and _G.C_Container.SortReagentBankBags or _G.SortReagentBankBags
local ipairs = _G.ipairs
local pairs = _G.pairs
local setmetatable = _G.setmetatable
Expand Down
21 changes: 15 additions & 6 deletions core/Constants.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,32 @@ addon.isWrath = WOW_PROJECT_ID == WOW_PROJECT_WRATH_CLASSIC

--<GLOBALS
local _G = _G
local BACKPACK_CONTAINER = _G.BACKPACK_CONTAINER
local BANK_CONTAINER = _G.BANK_CONTAINER
local REAGENTBANK_CONTAINER = _G.REAGENTBANK_CONTAINER
local BACKPACK_CONTAINER = _G.BACKPACK_CONTAINER or ( Enum.BagIndex and Enum.BagIndex.Backpack ) or 0
local REAGENTBAG_CONTAINER = ( Enum.BagIndex and Enum.BagIndex.REAGENTBAG_CONTAINER ) or 5
local BANK_CONTAINER = _G.BANK_CONTAINER or ( Enum.BagIndex and Enum.BagIndex.Bank ) or -1
local REAGENTBANK_CONTAINER = _G.REAGENTBANK_CONTAINER or ( Enum.BagIndex and Enum.BagIndex.Reagentbank ) or -3
local NUM_BAG_SLOTS = _G.NUM_BAG_SLOTS
local NUM_REAGENTBAG_SLOTS = _G.NUM_REAGENTBAG_SLOTS
local NUM_TOTAL_EQUIPPED_BAG_SLOTS = _G.NUM_TOTAL_EQUIPPED_BAG_SLOTS
local NUM_BANKBAGSLOTS = _G.NUM_BANKBAGSLOTS
local pairs = _G.pairs
--GLOBALS>

-- Backpack and bags
local BAGS = { [BACKPACK_CONTAINER] = BACKPACK_CONTAINER }
for i = 1, NUM_BAG_SLOTS do BAGS[i] = i end

local BANK = {}
local BANK_ONLY = {}
local REAGENTBANK_ONLY = {}

if addon.isRetail then
-- Base nank bags

-- Bags
for i = 1, NUM_TOTAL_EQUIPPED_BAG_SLOTS do BAGS[i] = i end

-- Base bank bags
BANK_ONLY = { [BANK_CONTAINER] = BANK_CONTAINER }
for i = NUM_BAG_SLOTS + 1, NUM_BAG_SLOTS + NUM_BANKBAGSLOTS do BANK_ONLY[i] = i end
for i = NUM_TOTAL_EQUIPPED_BAG_SLOTS + 1, NUM_TOTAL_EQUIPPED_BAG_SLOTS + NUM_BANKBAGSLOTS do BANK_ONLY[i] = i end

--- Reagent bank bags
REAGENTBANK_ONLY = { [REAGENTBANK_CONTAINER] = REAGENTBANK_CONTAINER }
Expand All @@ -59,6 +65,7 @@ if addon.isRetail then
for id in pairs(bags) do BANK[id] = id end
end
else
for i = 1, NUM_BAG_SLOTS do BAGS[i] = i end
BANK = { [BANK_CONTAINER] = BANK_CONTAINER }
for i = NUM_BAG_SLOTS + 1, NUM_BAG_SLOTS + NUM_BANKBAGSLOTS do BANK[i] = i end
end
Expand Down Expand Up @@ -90,6 +97,7 @@ addon.FAMILY_TAGS = {
[0x00100] = L["KEYRING_TAG"], -- Keyring
[0x00200] = L["GEM_BAG_TAG"], -- Gem Bag
[0x00400] = L["MINING_BAG_TAG"], -- Mining Bag
[0x00800] = L["REAGENT_BAG_TAG"], -- Player Reagent Bag
[0x08000] = L["TACKLE_BOX_TAG"], -- Tackle Box
[0x10000] = L["COOKING_BAR_TAG"], -- Refrigerator
--@noloc]]
Expand All @@ -107,6 +115,7 @@ addon.FAMILY_ICONS = {
[0x00100] = [[Interface\Icons\INV_Misc_Key_14]], -- Keyring
[0x00200] = [[Interface\Icons\INV_Misc_Gem_BloodGem_01]], -- Gem Bag
[0x00400] = [[Interface\Icons\Trade_Mining]], -- Mining Bag
[0x00800] = 4549254, -- Player Reagent Bag
[0x08000] = [[Interface\Icons\Trade_Fishing]], -- Tackle Box
[0x10000] = [[Interface\Icons\INV_Misc_Bag_Cooking]], -- Refrigerator
}
Expand Down
3 changes: 2 additions & 1 deletion core/Core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ local L = addon.L
--<GLOBALS
local _G = _G
local ADDON_LOAD_FAILED = _G.ADDON_LOAD_FAILED
local BANK_CONTAINER = _G.BANK_CONTAINER
local BANK_CONTAINER = _G.BANK_CONTAINER or ( Enum.BagIndex and Enum.BagIndex.Bank ) or -1
local REAGENTBAG_CONTAINER = ( Enum.BagIndex and Enum.BagIndex.REAGENTBAG_CONTAINER ) or 5
local CloseWindows = _G.CloseWindows
local CreateFrame = _G.CreateFrame
local format = _G.format
Expand Down

0 comments on commit 5bca2bc

Please sign in to comment.