on_global_item_pickup {
if (player.inventory.contains(Items.CLUE_SCROLL_BEGINNER) || player.bank.contains(Items.CLUE_SCROLL_BEGINNER)) {
val inventoryTransaction = player.attr[GROUNDITEM_PICKUP_TRANSACTION]?.get() ?: return@on_global_item_pickup
val transactionItem = inventoryTransaction.items.first()
if (transactionItem.item.id == Items.CLUE_SCROLL_BEGINNER) {
player.message("You already have a clue scroll of this tier.")
inventoryTransaction.revert(player.inventory)
}
}
}
Current Behavior
Using the above code, when picking up a beginner clue scroll with one already in your inventory or bank, the ground item will despawn and the player message will be sent and the transaction reverted.
Expected Behavior
The ground item should not despawn, it should stay on the ground allowing the player to drop their current clue scroll and pick up the other.
Steps to Reproduce the Problem
Add code snippet above
Spawn two beginner clue scrolls
Drop one and pick it back up with the other still in your inventory
Current Behavior
Using the above code, when picking up a beginner clue scroll with one already in your inventory or bank, the ground item will despawn and the player message will be sent and the transaction reverted.
Expected Behavior
The ground item should not despawn, it should stay on the ground allowing the player to drop their current clue scroll and pick up the other.
Steps to Reproduce the Problem