diff --git a/data/libs/functions/container.lua b/data/libs/functions/container.lua index 30131fec934..5b85e297872 100644 --- a/data/libs/functions/container.lua +++ b/data/libs/functions/container.lua @@ -13,10 +13,18 @@ function Container:addLoot(loot) goto continue end if iType:isStackable() or iType:getCharges() ~= 0 then - local tmpItem = self:addItem(itemId, item.count, INDEX_WHEREEVER, FLAG_NOLIMIT) - if not tmpItem then - logger.warn("Container:addLoot: failed to add item: {}, to corpse {} with id {}", ItemType(itemId):getName(), self:getName(), self:getId()) - goto continue + local stackSize = iType:getStackSize() + local remainingCount = item.count + + while remainingCount > 0 do + local countToAdd = math.min(remainingCount, stackSize) + local tmpItem = self:addItem(itemId, countToAdd, INDEX_WHEREEVER, FLAG_NOLIMIT) + if not tmpItem then + logger.warn("Container:addLoot: failed to add stackable item: {}, to corpse {} with id {}", ItemType(itemId):getName(), self:getName(), self:getId()) + goto continue + end + + remainingCount = remainingCount - countToAdd end else for i = 1, item.count do diff --git a/data/scripts/eventcallbacks/monster/ondroploot_wealth_duplex.lua b/data/scripts/eventcallbacks/monster/ondroploot_wealth_duplex.lua index add4273dad7..008352174f4 100644 --- a/data/scripts/eventcallbacks/monster/ondroploot_wealth_duplex.lua +++ b/data/scripts/eventcallbacks/monster/ondroploot_wealth_duplex.lua @@ -29,7 +29,7 @@ function callback.monsterOnDropLoot(monster, corpse) local wealthDuplex = Concoction.find(Concoction.Ids.WealthDuplex) if not wealthDuplex then - logger.warn("[Monster:onDropLoot] - Could not find WealthDuplex concoction.") + logger.debug("[Monster:onDropLoot] - Could not find WealthDuplex concoction.") return end local chance = 0