From 1335624c655b940513f736de497ec0d404060568 Mon Sep 17 00:00:00 2001 From: shagu Date: Thu, 7 Nov 2019 22:11:23 +0100 Subject: [PATCH] bags: fix amount of bankslots in tbc --- compat/tbc.lua | 1 + compat/vanilla.lua | 1 + modules/bags.lua | 10 ++++------ 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/compat/tbc.lua b/compat/tbc.lua index 2712acb4..aad0e207 100644 --- a/compat/tbc.lua +++ b/compat/tbc.lua @@ -26,6 +26,7 @@ COOLDOWN_FRAME_TYPE = "Cooldown" LOOT_BUTTON_FRAME_TYPE = "Button" PLAYER_BUFF_START_ID = 0 +MAX_BANK_SLOTS = 6 ACTIONBAR_SECURE_TEMPLATE_BAR = "SecureStateHeaderTemplate" ACTIONBAR_SECURE_TEMPLATE_BUTTON = "SecureActionButtonTemplate" diff --git a/compat/vanilla.lua b/compat/vanilla.lua index 29fa640e..e2a52f0b 100644 --- a/compat/vanilla.lua +++ b/compat/vanilla.lua @@ -26,6 +26,7 @@ COOLDOWN_FRAME_TYPE = "Model" LOOT_BUTTON_FRAME_TYPE = "LootButton" PLAYER_BUFF_START_ID = -1 +MAX_BANK_SLOTS = 6 ACTIONBAR_SECURE_TEMPLATE_BAR = nil ACTIONBAR_SECURE_TEMPLATE_BUTTON = nil diff --git a/modules/bags.lua b/modules/bags.lua index 6dc6110f..2a3d2775 100644 --- a/modules/bags.lua +++ b/modules/bags.lua @@ -442,7 +442,7 @@ pfUI:RegisterModule("bags", "vanilla:tbc", function () local position = "RIGHT" if frame == pfUI.bag.left then - min, max = 1, math.min(6, (GetNumBankSlots() or 0)) + min, max = 1, math.min(MAX_BANK_SLOTS, (GetNumBankSlots() or 0)) tpl = "BankItemButtonBagTemplate" name, append = "pfUIBankBBag", "" position = "LEFT" @@ -453,7 +453,7 @@ pfUI:RegisterModule("bags", "vanilla:tbc", function () CreateBackdropShadow(frame.bagslots) local extra = 0 - if frame == pfUI.bag.left and GetNumBankSlots() < 6 then extra = 1 end + if frame == pfUI.bag.left and GetNumBankSlots() < MAX_BANK_SLOTS then extra = 1 end local width = (frame.button_size/5*4 + default_border*2) * (max-min+1+extra) local height = default_border + (frame.button_size/5*4 + default_border) @@ -505,12 +505,10 @@ pfUI:RegisterModule("bags", "vanilla:tbc", function () frame.bagslots.slots[slot].frame:SetHeight(frame.button_size/5*4) frame.bagslots.slots[slot].frame:SetWidth(frame.button_size/5*4) - local id, texture = GetInventorySlotInfo("Bag" .. slot .. append) CreateBackdrop(frame.bagslots.slots[slot].frame, default_border) frame.bagslots.slots[slot].frame:Show() - local numSlots, full = GetNumBankSlots() - if ( slot <= numSlots ) then + if ( slot <= GetNumBankSlots() ) then frame.bagslots.slots[slot].frame.tooltipText = BANK_BAG else frame.bagslots.slots[slot].frame.tooltipText = BANK_BAG_PURCHASE @@ -518,7 +516,7 @@ pfUI:RegisterModule("bags", "vanilla:tbc", function () end if frame == pfUI.bag.left then - if GetNumBankSlots() < 6 then + if GetNumBankSlots() < MAX_BANK_SLOTS then if not frame.bagslots.buy then frame.bagslots.buy = CreateFrame("Button", "pfBagSlotBuy", frame.bagslots) end