Skip to content

Commit

Permalink
Pass count for reward container stackables
Browse files Browse the repository at this point in the history
  • Loading branch information
Codinablack committed Dec 1, 2024
1 parent a0a75ca commit 8bb2536
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/monster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1911,19 +1911,21 @@ void Monster::death(Creature*)

if (lootBlock.unique && mostScoreContributor == playerId) {
// Ensure that the mostScoreContributor can receive multiple unique items
auto lootItem = Item::CreateItem(lootBlock.id, uniform_random(1, lootBlock.countmax));
auto count = uniform_random(1, lootBlock.countmax);
auto lootItem = Item::CreateItem(lootBlock.id, count);
lootItem->setIntAttr(ITEM_ATTRIBUTE_DATE, currentTime);
lootItem->setIntAttr(ITEM_ATTRIBUTE_REWARDID, getMonster()->getID());
rewardContainer->internalAddThing(lootItem); // count not being passed, this is likely cause of broken stackables
rewardContainer->internalAddThing(count, lootItem);
hasLoot = true;
}
else if (!lootBlock.unique) {
// Normal loot distribution for non-unique items
if (uniform_random(1, MAX_LOOTCHANCE) <= adjustedChance) {
auto lootItem = Item::CreateItem(lootBlock.id, uniform_random(1, lootBlock.countmax));
auto count = uniform_random(1, lootBlock.countmax);
auto lootItem = Item::CreateItem(lootBlock.id, count);
lootItem->setIntAttr(ITEM_ATTRIBUTE_DATE, currentTime);
lootItem->setIntAttr(ITEM_ATTRIBUTE_REWARDID, getMonster()->getID());
rewardContainer->internalAddThing(lootItem); // count not being passed, this is likely cause of broken stackables
rewardContainer->internalAddThing(count, lootItem);
hasLoot = true;
}
}
Expand Down

0 comments on commit 8bb2536

Please sign in to comment.