mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2026-08-01 14:39:13 -06:00
Merge branch 'new-commands' into 'master'
Added new commands: heat, expressions, gfxs, panims, ianims, sanims. See merge request 2009scape/2009scape!2490
This commit is contained in:
commit
38c7450c44
4 changed files with 4417 additions and 17 deletions
|
|
@ -74,6 +74,9 @@ public final class DesertZone extends MapZone implements Plugin<Object> {
|
|||
* @param p the <code>Player</code>.
|
||||
*/
|
||||
private static void effect(Player p) {
|
||||
if (p.getAttribute("/save:desert-heat-disabled", false)) {
|
||||
return;
|
||||
}
|
||||
p.setAttribute("desert-delay", GameWorld.getTicks() + getDelay(p));
|
||||
evaporate(p);
|
||||
if (drink(p)) {
|
||||
|
|
|
|||
|
|
@ -1,18 +1,17 @@
|
|||
package core.game.system.command.sets
|
||||
|
||||
import core.api.animate
|
||||
import core.api.delayScript
|
||||
import core.api.queueScript
|
||||
import core.api.stopExecuting
|
||||
import core.api.*
|
||||
import core.game.interaction.QueueStrength
|
||||
import core.game.node.entity.npc.NPC
|
||||
import core.game.system.task.Pulse
|
||||
import core.game.world.update.flag.context.Animation
|
||||
import core.plugin.Initializable
|
||||
import core.game.system.command.CommandPlugin.Companion.toInteger
|
||||
import core.game.system.command.Privilege
|
||||
import core.game.system.config.HumanoidAnimationIds
|
||||
import core.game.system.task.Pulse
|
||||
import core.game.world.GameWorld
|
||||
import java.util.*
|
||||
import core.game.world.map.Location
|
||||
import core.game.world.update.flag.context.Animation
|
||||
import core.game.world.update.flag.context.Graphics
|
||||
import core.plugin.Initializable
|
||||
|
||||
@Initializable
|
||||
class AnimationCommandSet : CommandSet(Privilege.ADMIN) {
|
||||
|
|
@ -26,22 +25,22 @@ class AnimationCommandSet : CommandSet(Privilege.ADMIN) {
|
|||
*/
|
||||
define("anim", Privilege.ADMIN, "::anim <lt>Animation ID<gt>", "Plays the animation with the given ID."){ player, args ->
|
||||
if (args.size < 2) {
|
||||
reject(player, "Syntax error: ::anim <Animation ID>")
|
||||
reject(player, "Syntax error: ::anim <lt>Animation ID<gt>")
|
||||
}
|
||||
val animation = Animation(args[1].toInt())
|
||||
player.animate(animation)
|
||||
}
|
||||
|
||||
define("anims", Privilege.ADMIN, "::anims <From Animation ID> <To Animation ID> <(opt) Duration Per Animation>", "Plays animations from the From ID to the To ID, with a delay of 3 between animations, unless specified otherwise"){ player, args ->
|
||||
define("anims", Privilege.ADMIN, "::anims <lt>From Animation ID<gt> <lt>To Animation ID<gt> <lt>(opt) Duration Per Animation<gt>", "Plays animations from the From ID to the To ID, with a delay of 3 between animations, unless specified otherwise"){ player, args ->
|
||||
|
||||
if (args.size < 3) {
|
||||
reject(player, "Syntax error: ::anims <From Animation ID> <To Animation ID> <(opt) Duration Per Animation>")
|
||||
reject(player, "Syntax error: ::anims <lt>From Animation ID<gt> <lt>To Animation ID<gt> <lt>(opt) Duration Per Animation<gt>")
|
||||
}
|
||||
val animationFrom = args[1].toInt()
|
||||
val animationTo = args[2].toInt()
|
||||
val animationDelay = (args.getOrNull(3) ?: "3").toInt()
|
||||
|
||||
queueScript(player, 1, QueueStrength.STRONG) { stage: Int ->
|
||||
queueScript(player, 1, QueueStrength.WEAK) { stage: Int ->
|
||||
val animationId = animationFrom + stage
|
||||
animate(player, animationId, true)
|
||||
notify(player, "Playing animation $animationId")
|
||||
|
|
@ -54,6 +53,119 @@ class AnimationCommandSet : CommandSet(Privilege.ADMIN) {
|
|||
}
|
||||
}
|
||||
|
||||
/** Same as ::anims but only plays animations compatible with the player/humanoid skeleton. */
|
||||
define("panims", Privilege.ADMIN, "::panims <lt>From Animation ID<gt> <lt>To Animation ID<gt> <lt>(opt) Duration Per Animation<gt>", "Same as ::anims but only plays animations compatible with the player/humanoid skeleton."){ player, args ->
|
||||
|
||||
if (args.size < 3) {
|
||||
reject(player, "Syntax error: ::panims <lt>From Animation ID<gt> <lt>To Animation ID<gt> <lt>(opt) Duration Per Animation<gt>")
|
||||
}
|
||||
val animationFrom = args[1].toInt()
|
||||
val animationTo = args[2].toInt()
|
||||
val animationDelay = (args.getOrNull(3) ?: "3").toInt()
|
||||
var animationId = animationFrom
|
||||
|
||||
queueScript(player, 1, QueueStrength.WEAK) {
|
||||
while (animationId <= animationTo && !HumanoidAnimationIds.contains(animationId)) {
|
||||
animationId++
|
||||
}
|
||||
|
||||
if (animationId > animationTo) {
|
||||
return@queueScript stopExecuting(player)
|
||||
}
|
||||
|
||||
animate(player, animationId, true)
|
||||
notify(player, "Playing player animation $animationId")
|
||||
|
||||
animationId++
|
||||
|
||||
return@queueScript delayScript(player, animationDelay)
|
||||
}
|
||||
}
|
||||
|
||||
/** Cycles graphics on the player. */
|
||||
define("gfxs", Privilege.ADMIN, "::gfxs <lt>From Graphic ID<gt> <lt>To Graphic ID<gt> <lt>(opt) Duration<gt> <lt>(opt) Height<gt>", "Cycles graphics on the player.") { player, args ->
|
||||
if (args.size !in 3..5) {
|
||||
reject(player, "Syntax error: ::gfxs <lt>From Graphic ID<gt> <lt>To Graphic ID<gt> <lt>(opt) Duration<gt> <lt>(opt) Height<gt>")
|
||||
}
|
||||
|
||||
val graphicsFrom = args[1].toInt()
|
||||
val graphicsTo = args[2].toInt()
|
||||
val graphicsDelay = (args.getOrNull(3) ?: "3").toInt()
|
||||
val graphicsHeight = (args.getOrNull(4) ?: "0").toInt()
|
||||
|
||||
var graphicsId = graphicsFrom
|
||||
|
||||
queueScript(player, 1, QueueStrength.WEAK) {
|
||||
visualize(player, -1, Graphics(graphicsId, graphicsHeight))
|
||||
notify(player, "Playing graphics $graphicsId")
|
||||
|
||||
if (graphicsId == graphicsTo) {
|
||||
return@queueScript stopExecuting(player)
|
||||
}
|
||||
|
||||
graphicsId++
|
||||
return@queueScript delayScript(player, graphicsDelay)
|
||||
}
|
||||
}
|
||||
|
||||
/** Cycles animations on an interface child. */
|
||||
define("ianims", Privilege.ADMIN, "::ianims <lt>Interface ID<gt> <lt>Child ID<gt> <lt>From Animation ID<gt> <lt>To Animation ID<gt> <lt>(opt) Duration<gt>", "Cycles animations on an interface child.") { player, args ->
|
||||
if (args.size !in 4..6) {
|
||||
reject(player, "Syntax error: ::ianims <lt>Interface ID<gt> <lt>Child ID<gt> <lt>From Animation ID<gt> <lt>To Animation ID<gt> <lt>(opt) Duration<gt>")
|
||||
}
|
||||
|
||||
val interfaceId = args[1].toInt()
|
||||
val childId = args[2].toInt()
|
||||
val animationFrom = args[3].toInt()
|
||||
val animationTo = args.getOrNull(4)?.toInt() ?: animationFrom
|
||||
val animationDelay = (args.getOrNull(5) ?: "3").toInt()
|
||||
var animationId = animationFrom
|
||||
|
||||
openInterface(player, interfaceId)
|
||||
|
||||
queueScript(player, 1, QueueStrength.WEAK) {
|
||||
animateInterface(player, interfaceId, childId, animationId)
|
||||
notify(player, "Playing interface animation $animationId on $interfaceId:$childId")
|
||||
|
||||
if (animationId == animationTo) {
|
||||
return@queueScript stopExecuting(player)
|
||||
}
|
||||
|
||||
animationId++
|
||||
return@queueScript delayScript(player, animationDelay)
|
||||
}
|
||||
}
|
||||
|
||||
/** Cycles animations on a scenery object. */
|
||||
define("sanims", Privilege.ADMIN, "::sanims <lt>From Animation ID<gt> <lt>To Animation ID<gt> <lt>X<gt> <lt>Y<gt> <lt>(opt) Duration<gt>", "Cycles animations on scenery at the given tile.") { player, args ->
|
||||
if (args.size !in 5..6) {
|
||||
reject(player, "Syntax error: ::sanims <lt>From Animation ID<gt> <lt>To Animation ID<gt> <lt>X<gt> <lt>Y<gt> <lt>(opt) Duration<gt>")
|
||||
}
|
||||
|
||||
val animationFrom = args[1].toInt()
|
||||
val animationTo = args[2].toInt()
|
||||
val location = Location(args[3].toInt(), args[4].toInt(), player.location.z)
|
||||
val animationDelay = (args.getOrNull(5) ?: "3").toInt()
|
||||
val sceneryObject = getScenery(location) ?: run {
|
||||
reject(player, "No scenery found at $location.")
|
||||
return@define
|
||||
}
|
||||
|
||||
var animationId = animationFrom
|
||||
|
||||
queueScript(player, 1, QueueStrength.WEAK) {
|
||||
animateScenery(player, sceneryObject, animationId)
|
||||
notify(player, "Playing scenery animation $animationId on scenery ${sceneryObject.id}")
|
||||
|
||||
if (animationId == animationTo) {
|
||||
return@queueScript stopExecuting(player)
|
||||
}
|
||||
|
||||
animationId++
|
||||
return@queueScript delayScript(player, animationDelay)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Force the player to loop animation <Animation ID>
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -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 <lt>expression id<gt> <lt>(opt) npc id<gt>", "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 <lt>expression id<gt> <lt>(opt) npc id<gt>")
|
||||
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 <lt>expression id<gt> <lt>expression id<gt> <lt>(opt) duration<gt> <lt>(opt) npc id<gt>", "Cycles chathead animations from expression <lt>id<gt> to <lt>id<gt>") { 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 <lt>expression id<gt> <lt>expression id<gt> <lt>(opt) duration<gt> <lt>(opt) npc id<gt>")
|
||||
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 ->
|
||||
|
|
@ -508,5 +574,10 @@ class DevelopmentCommandSet : CommandSet(Privilege.ADMIN) {
|
|||
player.debug("Penguin spawned at:$pengCoords")
|
||||
}
|
||||
|
||||
define("heat", Privilege.ADMIN, "::heat", "Toggles desert heat damage.") { player, _ ->
|
||||
val disabled = !player.getAttribute("/save:desert-heat-disabled", false)
|
||||
player.setAttribute("/save:desert-heat-disabled", disabled)
|
||||
notify(player, "Desert heat is ${if (disabled) "disabled" else "enabled"}.")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
4214
Server/src/main/core/game/system/config/HumanoidAnimationIds.kt
Normal file
4214
Server/src/main/core/game/system/config/HumanoidAnimationIds.kt
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue