mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-11 09:00:23 -07:00
Fixed bug causing some rewards to disappear instead of dropping when inventory fills up as a result of receiving the reward
This commit is contained in:
parent
5baa876a55
commit
f4163e733a
1 changed files with 8 additions and 1 deletions
|
|
@ -368,7 +368,14 @@ fun replaceSlot(player: Player, slot: Int, item: Item, currentItem: Item? = null
|
|||
*/
|
||||
fun addItemOrDrop(player: Player, id: Int, amount: Int = 1) {
|
||||
val item = Item(id, amount)
|
||||
if (!player.inventory.add(item)) GroundItemManager.create(item, player)
|
||||
if(amount == 1 || item.definition.isStackable) {
|
||||
if (!player.inventory.add(item)) GroundItemManager.create(item, player)
|
||||
} else {
|
||||
val singleItem = Item(id, 1)
|
||||
for(i in 0 until amount) {
|
||||
if(!player.inventory.add(singleItem)) GroundItemManager.create(singleItem, player)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue