diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp index 6dc03c7e3..8077e41d6 100644 --- a/src/Mobs/Monster.cpp +++ b/src/Mobs/Monster.cpp @@ -5,6 +5,7 @@ #include "../Root.h" #include "../Server.h" #include "../ClientHandle.h" +#include "../Items/ItemHandler.h" #include "../World.h" #include "../EffectID.h" #include "../Entities/Player.h" @@ -1093,7 +1094,13 @@ std::unique_ptr cMonster::NewMonsterFromType(eMonsterType a_MobType) void cMonster::AddRandomDropItem(cItems & a_Drops, unsigned int a_Min, unsigned int a_Max, short a_Item, short a_ItemHealth) { - auto Count = GetRandomProvider().RandInt(static_cast(a_Min), static_cast(a_Max)); + auto Count = GetRandomProvider().RandInt(a_Min, a_Max); + auto MaxStackSize = static_cast(ItemHandler(a_Item)->GetMaxStackSize()); + while (Count > MaxStackSize) + { + a_Drops.emplace_back(a_Item, MaxStackSize, a_ItemHealth); + Count -= MaxStackSize; + } if (Count > 0) { a_Drops.emplace_back(a_Item, Count, a_ItemHealth);