Added ::items command

Added missing 6th colour variant of kitten/cat
Fixed duplicated interaction implementations
This commit is contained in:
Player Name
2026-04-19 10:12:29 +00:00
committed by Ryan
parent 5a76a71d21
commit 095f53114e
7 changed files with 65 additions and 56 deletions
@@ -50,15 +50,14 @@ class EmptyOptionListener : InteractionListener {
POTION(Items.POTION_195, Items.VIAL_229, "You empty the vial.", Sounds.LIQUID_2401),
BURNT_STEW(Items.BURNT_STEW_2005, Items.BOWL_1923, "You empty the contents of the bowl onto the floor.", Sounds.LIQUID_2401),
NETTLE_TEA(Items.NETTLE_TEA_4239, Items.BOWL_1923, "You empty the contents of the bowl onto the floor.", Sounds.LIQUID_2401),
CUP_OF_TEA(Items.CUP_OF_TEA_4242, Items.EMPTY_CUP_1980, "You empty the cup of tea.", Sounds.LIQUID_2401),
NETTLE_WATER(Items.NETTLE_WATER_4237, Items.BOWL_1923, "You empty the contents of the bowl onto the floor.", Sounds.LIQUID_2401),
NETTLE_TEA_MILKY(Items.NETTLE_TEA_4240, Items.BOWL_1923, "You empty the contents of the bowl onto the floor.", Sounds.LIQUID_2401),
NETTLE_TEA_CUP(Items.CUP_OF_TEA_4242, Items.EMPTY_CUP_1980, "You empty the contents of the cup onto the floor.", Sounds.LIQUID_2401),
NETTLE_TEA_CUP(Items.CUP_OF_TEA_4242, Items.EMPTY_CUP_1980, "You empty the cup of tea.", Sounds.LIQUID_2401),
NETTLE_TEA_CUP_MILKY(Items.CUP_OF_TEA_4243, Items.EMPTY_CUP_1980, "You empty the contents of the cup onto the floor.", Sounds.LIQUID_2401),
TEA_CUP_WATER(Items.CUP_OF_WATER_4458, Items.EMPTY_CUP_1980, "You empty the contents of the cup onto the floor.", Sounds.LIQUID_2401),
TEA_CUP_HOT_WATER(Items.CUP_OF_HOT_WATER_4460, Items.EMPTY_CUP_1980, "You empty the contents of the cup onto the floor.", Sounds.LIQUID_2401),
NETTLE_TEA_PORCELAIN(Items.CUP_OF_TEA_4245, Items.PORCELAIN_CUP_4244, "You empty the contents of the cup onto the floor.", Sounds.LIQUID_2401),
NETTLE_TEA_PORCELAIN_MILKY(Items.CUP_OF_TEA_4246, Items.PORCELAIN_CUP_4244, "You empty the contents of the cup onto the floor.", Sounds.LIQUID_2401),
NETTLE_WATER(Items.NETTLE_WATER_4237, Items.BOWL_1923, "You empty the contents of the bowl onto the floor.", Sounds.LIQUID_2401),
NETTLE_TEA_MILKY(Items.NETTLE_TEA_4240, Items.BOWL_1923, "You empty the contents of the bowl onto the floor.", Sounds.LIQUID_2401),
TEA_CUP_WATER(Items.CUP_OF_WATER_4458, Items.EMPTY_CUP_1980, "You empty the contents of the cup onto the floor.", Sounds.LIQUID_2401),
TEA_CUP_HOT_WATER(Items.CUP_OF_HOT_WATER_4460, Items.EMPTY_CUP_1980, "You empty the contents of the cup onto the floor.", Sounds.LIQUID_2401),
BUILDERS_TEA1(Items.CUP_OF_TEA_7730, Items.EMPTY_CUP_7728, "You empty the contents of the cup onto the floor.", Sounds.LIQUID_2401),
BUILDERS_TEA1_MILKY(Items.CUP_OF_TEA_7731, Items.EMPTY_CUP_7728, "You empty the contents of the cup onto the floor.", Sounds.LIQUID_2401),
BUILDERS_TEA2(Items.CUP_OF_TEA_7733, Items.PORCELAIN_CUP_7732, "You empty the contents of the cup onto the floor.", Sounds.LIQUID_2401),
@@ -0,0 +1,32 @@
package content.global.handlers.item
import content.data.LightSource
import core.api.*
import core.game.interaction.InteractionListener
import core.game.interaction.IntType
import org.rs09.consts.Items
import kotlin.collections.toIntArray
class LightSourceListeners : InteractionListener {
override fun defineListeners() {
val lightSourceProducts = LightSource.values().map { it.product.id }.toIntArray()
on(lightSourceProducts, ITEM, "drop") { player, light ->
val active = LightSource.getActiveLightSource(player).product.id
if (player.location.isInRegion(10648) && light.id == active) { //Temple of Ikov dungeon
sendMessage(player, "Dropping the " + LightSource.getActiveLightSource(player).product.name.lowercase() + " would leave you without a light source.")
return@on false
}
val removed = removeItem(player, light.id)
if (removed) {
var droppedId = light.id
if (light.id == Items.MINING_HELMET_5013) {
droppedId = Items.MINING_HELMET_5014
sendMessage(player, "The helmet goes out as you drop it.")
}
produceGroundItem(player, droppedId)
}
return@on true
}
}
}
@@ -1,17 +0,0 @@
package content.global.handlers.item
import core.api.*
import core.game.interaction.InteractionListener
import core.game.interaction.IntType
import org.rs09.consts.Items
class MiningHelmetListener : InteractionListener {
override fun defineListeners() {
on(Items.MINING_HELMET_5013, IntType.ITEM, "drop") { player, _ ->
val removed = removeItem(player, Items.MINING_HELMET_5013)
if (removed) produceGroundItem(player, Items.MINING_HELMET_5014)
sendMessage(player, "The helmet goes out as you drop it.")
return@on true
}
}
}
@@ -1,18 +0,0 @@
package content.global.skill.cooking
import org.rs09.consts.Items
import core.api.replaceSlot
import core.api.removeItem
import core.game.interaction.IntType
import core.game.interaction.InteractionListener
import core.game.node.item.Item
class NettleWaterListener : InteractionListener {
override fun defineListeners() {
onUseWith(IntType.ITEM, Items.BOWL_OF_WATER_1921, Items.NETTLES_4241) { player, used, with ->
replaceSlot(player, used.asItem().slot, Item(Items.NETTLE_WATER_4237), used.asItem())
removeItem(player, with.asItem())
return@onUseWith true
}
}
}
@@ -137,20 +137,6 @@ class TempleOfIkovListeners : InteractionListener {
teleport(player, Location.create(2649, 9804, 0))
}
// don't let light extinguish or cape take off
val lightSourceProducts = LightSource.values().map { it.product.id }.toIntArray()
on(lightSourceProducts, ITEM, "drop") { player, light ->
val active = LightSource.getActiveLightSource(player).product.id
if (player.location.isInRegion(10648) && light.id == active) {
sendMessage(player, "Dropping the " + LightSource.getActiveLightSource(player).product.name.lowercase() + " would leave you without a light source.")
return@on false
}
val removed = removeItem(player, light.id)
if (removed) produceGroundItem(player, light.id)
return@on true
}
// B: Attach lever, authentic if you log out, the lever is lost, and you have to do that bridge again
onUseWith(SCENERY, Items.LEVER_83, Scenery.LEVER_BRACKET_86) { player, used, with ->
removeItem(player, used)
@@ -420,7 +420,7 @@ public final class GertrudeDialogue extends DialoguePlugin {
* @return the item.
*/
public Item getKitten() {
return new Item(RandomFunction.random(1555, 1560));
return new Item(RandomFunction.random(1555, 1561));
}
@Override
@@ -81,6 +81,33 @@ class SpawnCommandSet : CommandSet(Privilege.ADMIN){
player.inventory.add(item)
}
/**
* Spawns multiple items with the given ID
*/
define("items", usage = "::items <lt>start-id<gt> <lt>end-id<gt> [amount]", description = "Loops through item ids from 'start-id' to 'end-id' and spawns 'amount' of them in your inventory."){player,args ->
if (args.size < 3) {
reject(player,"You must specify start and end item ids.")
return@define
}
val start = args[1].toIntOrNull() ?: return@define
val end = args[2].toIntOrNull() ?: return@define
var amount = (args.getOrNull(3) ?: "1").toInt()
for (id in start..end) {
if (id > Cache.getItemDefinitionsSize()) {
reject(player,"Item ID '$id' out of range.")
return@define
}
val item = Item(id, amount)
val max = player.inventory.getMaximumAdd(item)
if (amount > max) {
amount = max
}
item.setAmount(amount)
player.inventory.add(item)
}
}
/**
* Spawn object with given ID at the player's location
*/