Skip to content

Commit

Permalink
Small bugfix for item counts not appearing correctly and stack splits…
Browse files Browse the repository at this point in the history
… showing when they aren't supposed to.
  • Loading branch information
Cidan committed Sep 2, 2024
1 parent 748fc3a commit 5b8641c
Showing 1 changed file with 24 additions and 5 deletions.
29 changes: 24 additions & 5 deletions views/gridview.lua
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,31 @@ local function GridView(view, ctx, bag, slotInfo, callback)
not stackInfo then
-- If stacking is not allowed, create a new button
CreateButton(ctx, view, item.slotkey)
elseif stackInfo.rootItem ~= item.slotkey and view.itemsByBagAndSlot[stackInfo.rootItem] ~= nil then
UpdateButton(ctx, view, stackInfo.rootItem)
elseif stackInfo.rootItem ~= item.slotkey and view.itemsByBagAndSlot[stackInfo.rootItem] == nil then
CreateButton(ctx, view, stackInfo.rootItem)
else
CreateButton(ctx, view, item.slotkey)
-- Handle if this is the only item in the stack.
if next(stackInfo.slotkeys) == nil then
if view.itemsByBagAndSlot[stackInfo.rootItem] then
UpdateButton(ctx, view, stackInfo.rootItem)
else
CreateButton(ctx, view, stackInfo.rootItem)
end
else
local found = false
for slotkey in pairs(stackInfo.slotkeys) do
if view.itemsByBagAndSlot[slotkey] then
UpdateButton(ctx, view, slotkey)
found = true
break
end
end
if not found then
if view.itemsByBagAndSlot[stackInfo.rootItem] then
UpdateButton(ctx, view, stackInfo.rootItem)
else
CreateButton(ctx, view, stackInfo.rootItem)
end
end
end
end
end

Expand Down

0 comments on commit 5b8641c

Please sign in to comment.