Skip to content

Commit

Permalink
Fix error that occured when not all bag slots were equipped with bags
Browse files Browse the repository at this point in the history
  • Loading branch information
kaelonR committed Nov 23, 2022
1 parent 69ea07f commit 1c885ab
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 6 additions & 1 deletion BuyEmAll/BuyEmAll.lua
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,19 @@ function BuyEmAll:MerchantFrame_OnHide(...)
return self.OrigMerchantFrame_OnHide(...);
end

function BuyEmAll:HasBagEquippedInSlot(slotID)
local inventorySlotId = GetInventorySlotInfo("Bag" .. (slotID - 1) .. "Slot");
return GetInventoryItemID("player", inventorySlotId) ~= nil;
end

function BuyEmAll:GetFreeBagSpace(itemID)
local canFit = 0;
local itemType = GetItemFamily(itemID);
local stackSize = select(8, GetItemInfo(itemID));

for currentBag = 0, 4 do
local freeSpace, bagType = C_Container.GetContainerNumFreeSlots(currentBag);
if (bagType == 0 or bagType == itemType or bit.band(itemType, bagType) == bagType) then
if (bagType == 0 or (BuyEmAll:HasBagEquippedInSlot(currentBag) and (bagType == itemType or bit.band(itemType, bagType) == bagType))) then
canFit = canFit + (freeSpace * stackSize);

local totalBagSlots = C_Container.GetContainerNumSlots(currentBag);
Expand Down
5 changes: 4 additions & 1 deletion BuyEmAll/Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
v3.5.15
v3.5.16
- Fix error that occured when not all bag slots were equipped with bags

v3.5.15
- Update french localisation file (thanks to KarlitosVII on GitHub)

v3.5.14
Expand Down

0 comments on commit 1c885ab

Please sign in to comment.