mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-20 05:20:22 -07:00
Bloated toads no longer bankable
Implemented releasing bloated toads Updated ContentAPI slightly so that removeAll has more similarity to removeItem function and can be called in the same way
This commit is contained in:
parent
338bf3ab70
commit
a9fd970e06
3 changed files with 16 additions and 2 deletions
|
|
@ -30667,6 +30667,7 @@
|
|||
"id": "2874"
|
||||
},
|
||||
{
|
||||
"bankable": "false",
|
||||
"examine": "An inflated toad.",
|
||||
"durability": null,
|
||||
"name": "Bloated toad",
|
||||
|
|
|
|||
|
|
@ -1122,14 +1122,15 @@ fun adjustLevel(entity: Entity, skill: Int, amount: Int) {
|
|||
* @param item the item to remove. Can be an Item object or an ID.
|
||||
* @param container the Container to remove the item from. An enum exists for this called Container. Ex: Container.BANK
|
||||
*/
|
||||
fun <T> removeAll(player: Player, item: T, container: Container) {
|
||||
fun <T> removeAll(player: Player, item: T, container: Container = Container.INVENTORY): Boolean {
|
||||
item ?: return false
|
||||
val it = when (item) {
|
||||
is Item -> item.id
|
||||
is Int -> item
|
||||
else -> throw IllegalStateException("Invalid value passed as item")
|
||||
}
|
||||
|
||||
when (container) {
|
||||
return when (container) {
|
||||
Container.EQUIPMENT -> player.equipment.remove(Item(it, amountInEquipment(player, it)))
|
||||
Container.BANK -> {
|
||||
val amountInPrimary = amountInBank(player, it, false)
|
||||
|
|
|
|||
|
|
@ -150,5 +150,17 @@ class BloatedToadListeners : InteractionListener, StartupListener, Commands {
|
|||
}
|
||||
return@on true
|
||||
}
|
||||
|
||||
on(Items.BLOATED_TOAD_2875, ITEM, "release") { player, used ->
|
||||
removeItem(player, used.asItem())
|
||||
sendPlayerDialogue(player, "Free the fat toadsies!")
|
||||
return@on true
|
||||
}
|
||||
|
||||
on(Items.BLOATED_TOAD_2875, ITEM, "release all") { player, used ->
|
||||
removeAll(player, used.asItem())
|
||||
sendPlayerDialogue(player, "Free the fat toadsies!")
|
||||
return@on true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue