From 1e5ada15afbc83b61d8d81c3e7b27ae422bfcc54 Mon Sep 17 00:00:00 2001 From: psyopcutie Date: Mon, 13 Jul 2026 00:21:59 +0200 Subject: [PATCH] updated ::expression and added ::expressions --- .../command/sets/DevelopmentCommandSet.kt | 76 +++++++++++++++++-- 1 file changed, 71 insertions(+), 5 deletions(-) diff --git a/Server/src/main/core/game/system/command/sets/DevelopmentCommandSet.kt b/Server/src/main/core/game/system/command/sets/DevelopmentCommandSet.kt index 0e3f3ef36..c6a3baa56 100644 --- a/Server/src/main/core/game/system/command/sets/DevelopmentCommandSet.kt +++ b/Server/src/main/core/game/system/command/sets/DevelopmentCommandSet.kt @@ -43,6 +43,7 @@ import content.global.activity.penguinhns.PenguinManager.Companion.spawner import content.global.activity.penguinhns.PenguinManager.Companion.tagMapping import content.global.activity.penguinhns.PenguinManager.Companion.updateStoreFile import core.ServerStore.Companion.toJSONArray +import core.game.interaction.QueueStrength import org.rs09.consts.NPCs @Initializable @@ -369,11 +370,76 @@ class DevelopmentCommandSet : CommandSet(Privilege.ADMIN) { setAttribute(player, "draw-intersect", !getAttribute(player, "draw-intersect", false)) } - define("expression", Privilege.ADMIN, "::expression id", "Visualizes chathead animations from ID.") { player, args -> - if(args.size != 2) - reject(player, "Usage: ::expression id") - val id = args[1].toIntOrNull() ?: 9804 - player.dialogueInterpreter.sendDialogues(player, id, "Expression ID: $id") + define("expression", Privilege.ADMIN, "::expression expression id [npc id]", "Visualizes chathead animations from ID. Works with ::pnpc") { player, args -> + if (args.size !in 2..3 || args[1].toIntOrNull() == null || (args.size == 3 && args[2].toIntOrNull() == null)) { + reject(player, "Usage: ::expression expression id [npc id]") + return@define + } + + val id = args[1].toInt() + val explicitNpcId = args.getOrNull(2)?.toIntOrNull() + + when { + explicitNpcId != null -> player.dialogueInterpreter.sendDialogues( + explicitNpcId, + id, + "Expression ID: $id" + ) + + player.appearance.isNpc -> player.dialogueInterpreter.sendDialogues( + player.appearance.npcId, + id, + "Expression ID: $id" + ) + + else -> player.dialogueInterpreter.sendDialogues(player, id, "Expression ID: $id") + } + } + + define("expressions", Privilege.ADMIN, "::expressions expression id expression id [duration] [npc id]", "Cycles chathead animations from expression id to id") { player, args -> + if (args.size !in 3..5 || args[1].toIntOrNull() == null || args[2].toIntOrNull() == null || (args.size >= 4 && args[3].toIntOrNull() == null) || (args.size == 5 && args[4].toIntOrNull() == null)) { + reject(player, "Usage: ::expressions expression id expression id [duration] [npc id]") + return@define + } + + val expressionFrom = args[1].toInt() + val expressionTo = args[2].toInt() + val expressionDelay = (args.getOrNull(3) ?: "5").toInt() + val explicitNpcId = args.getOrNull(4)?.toIntOrNull() + + queueScript(player, 1, QueueStrength.WEAK) { stage: Int -> + val expressionId = expressionFrom + stage + + when { + explicitNpcId != null -> player.dialogueInterpreter.sendDialogues( + explicitNpcId, + expressionId, + "Expression ID: $expressionId" + ) + + player.appearance.isNpc -> + player.dialogueInterpreter.sendDialogues( + player.appearance.npcId, + expressionId, + "Expression ID: $expressionId" + ) + + else -> + player.dialogueInterpreter.sendDialogues( + player, + expressionId, + "Expression ID: $expressionId" + ) + } + + notify(player, "Expression ID: $expressionId") + + if (expressionId == expressionTo) { + return@queueScript stopExecuting(player) + } + + return@queueScript delayScript(player, expressionDelay) + } } define("timers", Privilege.ADMIN, "::timers", "Print out timers") { player, args ->