mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2026-08-28 05:45:10 -06:00
::gfxs & ::sanims also formatting
This commit is contained in:
parent
27da635075
commit
70b4c7e638
2 changed files with 70 additions and 18 deletions
|
|
@ -1,21 +1,17 @@
|
|||
package core.game.system.command.sets
|
||||
|
||||
import core.api.animate
|
||||
import core.api.animateInterface
|
||||
import core.api.delayScript
|
||||
import core.api.openInterface
|
||||
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) {
|
||||
|
|
@ -29,7 +25,7 @@ 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)
|
||||
|
|
@ -38,7 +34,7 @@ class AnimationCommandSet : CommandSet(Privilege.ADMIN) {
|
|||
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()
|
||||
|
|
@ -61,7 +57,7 @@ class AnimationCommandSet : CommandSet(Privilege.ADMIN) {
|
|||
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 <From Animation ID> <To Animation ID> <(opt) Duration Per Animation>")
|
||||
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()
|
||||
|
|
@ -86,10 +82,36 @@ class AnimationCommandSet : CommandSet(Privilege.ADMIN) {
|
|||
}
|
||||
}
|
||||
|
||||
/** 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.SOFT) {
|
||||
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 <Interface ID> <Child ID> <From Animation ID> <To Animation ID> <(opt) Duration>")
|
||||
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()
|
||||
|
|
@ -114,6 +136,36 @@ class AnimationCommandSet : CommandSet(Privilege.ADMIN) {
|
|||
}
|
||||
}
|
||||
|
||||
/** 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.SOFT) {
|
||||
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>
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -370,9 +370,9 @@ class DevelopmentCommandSet : CommandSet(Privilege.ADMIN) {
|
|||
setAttribute(player, "draw-intersect", !getAttribute(player, "draw-intersect", false))
|
||||
}
|
||||
|
||||
define("expression", Privilege.ADMIN, "::expression <lt>expression id<gt> [npc id]", "Visualizes chathead animations from ID. Works with ::pnpc") { player, args ->
|
||||
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> [npc id]")
|
||||
reject(player, "Usage: ::expression <lt>expression id<gt> <lt>(opt) npc id<gt>")
|
||||
return@define
|
||||
}
|
||||
|
||||
|
|
@ -396,9 +396,9 @@ class DevelopmentCommandSet : CommandSet(Privilege.ADMIN) {
|
|||
}
|
||||
}
|
||||
|
||||
define("expressions", Privilege.ADMIN, "::expressions <lt>expression id<gt> <lt>expression id<gt> [duration] [npc id]", "Cycles chathead animations from expression <lt>id<gt> to <lt>id<gt>") { player, args ->
|
||||
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> [duration] [npc id]")
|
||||
reject(player, "Usage: ::expressions <lt>expression id<gt> <lt>expression id<gt> <lt>(opt) duration<gt> <lt>(opt) npc id<gt>")
|
||||
return@define
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue