mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-20 21:40:27 -07:00
Added: giveitem, removeitem, removeitemall to the command list
Minor correction in CommandSet.kt to print the message, not the string array Removed most/all return@'s inside of each CommandSet
This commit is contained in:
parent
31cc74b336
commit
ccf0e04d3e
12 changed files with 258 additions and 113 deletions
|
|
@ -22,7 +22,6 @@ class AnimationCommandSet : CommandSet(Command.Privilege.ADMIN) {
|
||||||
define("anim"){ player, args ->
|
define("anim"){ player, args ->
|
||||||
if (args.size < 2) {
|
if (args.size < 2) {
|
||||||
reject(player, "Syntax error: ::anim <Animation ID>")
|
reject(player, "Syntax error: ::anim <Animation ID>")
|
||||||
return@define
|
|
||||||
}
|
}
|
||||||
val animation = Animation(args[1].toInt())
|
val animation = Animation(args[1].toInt())
|
||||||
player.animate(animation)
|
player.animate(animation)
|
||||||
|
|
@ -34,12 +33,11 @@ class AnimationCommandSet : CommandSet(Command.Privilege.ADMIN) {
|
||||||
define("loopanim"){ player, args ->
|
define("loopanim"){ player, args ->
|
||||||
if (args.size < 2) {
|
if (args.size < 2) {
|
||||||
reject(player, "Syntax error: ::loopanim <Animation ID> <Loop Amount>")
|
reject(player, "Syntax error: ::loopanim <Animation ID> <Loop Amount>")
|
||||||
return@define
|
|
||||||
}
|
}
|
||||||
val start = toInteger(args[1])
|
val start = toInteger(args[1])
|
||||||
var end = toInteger((args[2]))
|
var end = toInteger((args[2]))
|
||||||
if (end > 25) {
|
if (end > 25) {
|
||||||
player.sendMessage("Really...? $end times...? Looping 25 times instead.")
|
notify(player, "Really...? $end times...? Looping 25 times instead.")
|
||||||
end = 25
|
end = 25
|
||||||
}
|
}
|
||||||
GameWorld.Pulser.submit(object : Pulse(3, player) {
|
GameWorld.Pulser.submit(object : Pulse(3, player) {
|
||||||
|
|
@ -57,14 +55,12 @@ class AnimationCommandSet : CommandSet(Command.Privilege.ADMIN) {
|
||||||
define("ranim"){ player, args ->
|
define("ranim"){ player, args ->
|
||||||
if (args.size < 2) {
|
if (args.size < 2) {
|
||||||
reject(player, "Syntax error: ::ranim <Render Animation ID>")
|
reject(player, "Syntax error: ::ranim <Render Animation ID>")
|
||||||
return@define
|
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
player.appearance.setAnimations(Animation.create(args[1].toInt()))
|
player.appearance.setAnimations(Animation.create(args[1].toInt()))
|
||||||
player.appearance.sync()
|
player.appearance.sync()
|
||||||
} catch (e: NumberFormatException) {
|
} catch (e: NumberFormatException) {
|
||||||
reject(player, "Syntax error: ::ranim <Render Animation ID>")
|
reject(player, "Syntax error: ::ranim <Render Animation ID>")
|
||||||
return@define
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,16 +50,14 @@ class BottingCommandSet : CommandSet(Command.Privilege.STANDARD) {
|
||||||
}
|
}
|
||||||
if(args.size < 2){
|
if(args.size < 2){
|
||||||
reject(player,"Usage: ::script identifier")
|
reject(player,"Usage: ::script identifier")
|
||||||
return@define
|
|
||||||
}
|
}
|
||||||
val identifier = args[1]
|
val identifier = args[1]
|
||||||
val script = PlayerScripts.identifierMap[identifier]
|
val script = PlayerScripts.identifierMap[identifier]
|
||||||
if(script == null){
|
if(script == null){
|
||||||
reject(player,"Invalid script identifier")
|
reject(player,"Invalid script identifier")
|
||||||
return@define
|
|
||||||
}
|
}
|
||||||
player.interfaceManager.close()
|
player.interfaceManager.close()
|
||||||
GeneralBotCreator(script.clazz.newInstance() as Script,player,true)
|
GeneralBotCreator(script!!.clazz.newInstance() as Script,player,true)
|
||||||
player.sendMessage(colorize("%RStarting script..."))
|
player.sendMessage(colorize("%RStarting script..."))
|
||||||
player.sendMessage(colorize("%RTo stop the script, do ::stopscript or log out."))
|
player.sendMessage(colorize("%RTo stop the script, do ::stopscript or log out."))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ abstract class CommandSet(val defaultPrivilege: Command.Privilege) : Plugin<Any?
|
||||||
*/
|
*/
|
||||||
fun reject(player: Player, vararg message: String){
|
fun reject(player: Player, vararg message: String){
|
||||||
for(msg in message) {
|
for(msg in message) {
|
||||||
player.sendMessage(colorize("%R$message"))
|
player.sendMessage(colorize("%R$msg"))
|
||||||
}
|
}
|
||||||
throw IllegalStateException()
|
throw IllegalStateException()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,13 +13,12 @@ class ConfigCommandSet : CommandSet(Command.Privilege.ADMIN){
|
||||||
define("sconfigrange"){player, args ->
|
define("sconfigrange"){player, args ->
|
||||||
if (args.size < 3) {
|
if (args.size < 3) {
|
||||||
reject(player, "usage: sconfigrange idlo idhi")
|
reject(player, "usage: sconfigrange idlo idhi")
|
||||||
return@define
|
|
||||||
}
|
}
|
||||||
val idlo = args[1].toIntOrNull() ?: return@define
|
val idlo = args[1].toIntOrNull() ?: reject(player, "INCORRECT ID LOW")
|
||||||
val idhi = args[2].toIntOrNull() ?: return@define
|
val idhi = args[2].toIntOrNull() ?: reject(player, "INCORRECT ID HIGH")
|
||||||
for (idsend in idlo until idhi) {
|
for (idsend in (idlo as Int) until (idhi as Int)) {
|
||||||
player.configManager.set(idsend, Integer.MAX_VALUE)
|
player.configManager.set(idsend, Integer.MAX_VALUE)
|
||||||
player.packetDispatch.sendMessage("Config: $idsend value: " + Integer.MAX_VALUE)
|
notify(player,"Config: $idsend value: " + Integer.MAX_VALUE)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -29,13 +28,12 @@ class ConfigCommandSet : CommandSet(Command.Privilege.ADMIN){
|
||||||
define("sconfigrange0"){player, args ->
|
define("sconfigrange0"){player, args ->
|
||||||
if (args.size < 3) {
|
if (args.size < 3) {
|
||||||
reject(player, "usage: sconfigrange0 idlo idhi")
|
reject(player, "usage: sconfigrange0 idlo idhi")
|
||||||
return@define
|
|
||||||
}
|
}
|
||||||
val idlo = args[1].toIntOrNull() ?: return@define
|
val idlo = args[1].toIntOrNull() ?: reject(player, "INCORRECT ID LOW")
|
||||||
val idhi = args[2].toIntOrNull() ?: return@define
|
val idhi = args[2].toIntOrNull() ?: reject(player, "INCORRECT ID HIGH")
|
||||||
for (idsend in idlo until idhi) {
|
for (idsend in (idlo as Int) until (idhi as Int)) {
|
||||||
player.configManager.set(idsend, 0)
|
player.configManager.set(idsend, 0)
|
||||||
player.packetDispatch.sendMessage("Config: $idsend value: 0")
|
notify(player,"Config: $idsend value: 0")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -47,8 +45,8 @@ class ConfigCommandSet : CommandSet(Command.Privilege.ADMIN){
|
||||||
reject(player, "usage: iface id")
|
reject(player, "usage: iface id")
|
||||||
return@define
|
return@define
|
||||||
}
|
}
|
||||||
val id = args[1].toIntOrNull() ?: return@define
|
val id = args[1].toIntOrNull() ?: reject(player, "INVALID INTERFACE ID")
|
||||||
player.interfaceManager.openComponent(id)
|
player.interfaceManager.openComponent(id as Int)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -24,7 +24,6 @@ class FunCommandSet : CommandSet(Command.Privilege.ADMIN) {
|
||||||
define("npcareaanim") { player, args ->
|
define("npcareaanim") { player, args ->
|
||||||
if (args.size < 3) {
|
if (args.size < 3) {
|
||||||
reject(player, "Syntax error: ::npcareaanim <Animation ID> <String>")
|
reject(player, "Syntax error: ::npcareaanim <Animation ID> <String>")
|
||||||
return@define
|
|
||||||
}
|
}
|
||||||
npcs = RegionManager.getLocalNpcs(player.location, 10)
|
npcs = RegionManager.getLocalNpcs(player.location, 10)
|
||||||
for (n in npcs) {
|
for (n in npcs) {
|
||||||
|
|
@ -49,11 +48,10 @@ class FunCommandSet : CommandSet(Command.Privilege.ADMIN) {
|
||||||
val pnpc_id = args[1].toIntOrNull()
|
val pnpc_id = args[1].toIntOrNull()
|
||||||
if(pnpc_id == null){
|
if(pnpc_id == null){
|
||||||
reject(player, "<npcid> must be a valid integer.")
|
reject(player, "<npcid> must be a valid integer.")
|
||||||
return@define
|
|
||||||
}
|
}
|
||||||
|
|
||||||
player.appearance.transformNPC(pnpc_id)
|
player.appearance.transformNPC(pnpc_id!!)
|
||||||
player.sendMessage("Transformed into NPC $pnpc_id")
|
notify(player,"Transformed into NPC $pnpc_id")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -69,7 +67,7 @@ class FunCommandSet : CommandSet(Command.Privilege.ADMIN) {
|
||||||
*/
|
*/
|
||||||
define("invis"){ player, _ ->
|
define("invis"){ player, _ ->
|
||||||
player.isInvisible = !player.isInvisible
|
player.isInvisible = !player.isInvisible
|
||||||
player.sendMessage("You are now ${if (player.isInvisible) "invisible" else "visible"} to others.")
|
notify(player,"You are now ${if (player.isInvisible) "invisible" else "visible"} to others.")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -78,7 +76,7 @@ class FunCommandSet : CommandSet(Command.Privilege.ADMIN) {
|
||||||
*/
|
*/
|
||||||
define("1hit"){ player, _ ->
|
define("1hit"){ player, _ ->
|
||||||
player.setAttribute("1hko", !player.getAttribute("1hko", false))
|
player.setAttribute("1hko", !player.getAttribute("1hko", false))
|
||||||
player.sendMessage("1-hit KO mode " + if (player.getAttribute("1hko", false)) "on." else "off.")
|
notify(player,"1-hit KO mode " + if (player.getAttribute("1hko", false)) "on." else "off.")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -87,7 +85,7 @@ class FunCommandSet : CommandSet(Command.Privilege.ADMIN) {
|
||||||
*/
|
*/
|
||||||
define("god"){ player, _ ->
|
define("god"){ player, _ ->
|
||||||
player.setAttribute("godMode", !player.getAttribute("godMode", false))
|
player.setAttribute("godMode", !player.getAttribute("godMode", false))
|
||||||
player.sendMessage("God mode ${if (player.getAttribute("godMode", false)) "enabled." else "disabled."}")
|
notify(player,"God mode ${if (player.getAttribute("godMode", false)) "enabled." else "disabled."}")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -97,7 +95,7 @@ class FunCommandSet : CommandSet(Command.Privilege.ADMIN) {
|
||||||
define("mrboneswildride"){ player, _ ->
|
define("mrboneswildride"){ player, _ ->
|
||||||
val boneMode = !player.getAttribute("boneMode",false)
|
val boneMode = !player.getAttribute("boneMode",false)
|
||||||
player.setAttribute("boneMode", boneMode)
|
player.setAttribute("boneMode", boneMode)
|
||||||
player.sendMessage("Bone Mode ${if (boneMode) "<col=00ff00>ENGAGED</col>." else "<col=ff0000>POWERING DOWN</col>."}")
|
notify(player,"Bone Mode ${if (boneMode) "<col=00ff00>ENGAGED</col>." else "<col=ff0000>POWERING DOWN</col>."}")
|
||||||
player.appearance.rideCart(boneMode)
|
player.appearance.rideCart(boneMode)
|
||||||
if (player.appearance.isRidingMinecart) {
|
if (player.appearance.isRidingMinecart) {
|
||||||
var i = 0
|
var i = 0
|
||||||
|
|
@ -118,6 +116,5 @@ class FunCommandSet : CommandSet(Command.Privilege.ADMIN) {
|
||||||
define("makeover", Command.Privilege.MODERATOR){ player, _ ->
|
define("makeover", Command.Privilege.MODERATOR){ player, _ ->
|
||||||
CharacterDesign.open(player)
|
CharacterDesign.open(player)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -65,14 +65,14 @@ class MiscCommandSet : CommandSet(Command.Privilege.ADMIN){
|
||||||
* Tells the player to use loc
|
* Tells the player to use loc
|
||||||
*/
|
*/
|
||||||
define("pos", Command.Privilege.STANDARD){ player, _->
|
define("pos", Command.Privilege.STANDARD){ player, _->
|
||||||
player.packetDispatch.sendMessage("Do you mean ::loc?")
|
notify(player, "Do you mean ::loc?")
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tells the player to use loc
|
* Tells the player to use loc
|
||||||
*/
|
*/
|
||||||
define("coords", Command.Privilege.STANDARD){ player, _->
|
define("coords", Command.Privilege.STANDARD){ player, _->
|
||||||
player.packetDispatch.sendMessage("Do you mean ::loc?")
|
notify(player, "Do you mean ::loc?")
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -98,8 +98,7 @@ class MiscCommandSet : CommandSet(Command.Privilege.ADMIN){
|
||||||
define("players", Command.Privilege.STANDARD){ player, _ ->
|
define("players", Command.Privilege.STANDARD){ player, _ ->
|
||||||
val rights = player.rights.ordinal
|
val rights = player.rights.ordinal
|
||||||
if (player!!.interfaceManager.isOpened && player.interfaceManager.opened.id != Components.QUESTJOURNAL_SCROLL_275 || player.locks.isMovementLocked || player.locks.isTeleportLocked) {
|
if (player!!.interfaceManager.isOpened && player.interfaceManager.opened.id != Components.QUESTJOURNAL_SCROLL_275 || player.locks.isMovementLocked || player.locks.isTeleportLocked) {
|
||||||
player.sendMessage("Please finish what you're doing first.")
|
reject(player, "Please finish what you're doing first.")
|
||||||
return@define
|
|
||||||
}
|
}
|
||||||
player.interfaceManager.open(Component(Components.QUESTJOURNAL_SCROLL_275))
|
player.interfaceManager.open(Component(Components.QUESTJOURNAL_SCROLL_275))
|
||||||
var i = 0
|
var i = 0
|
||||||
|
|
@ -202,8 +201,7 @@ class MiscCommandSet : CommandSet(Command.Privilege.ADMIN){
|
||||||
*/
|
*/
|
||||||
define("reply", Command.Privilege.STANDARD){ player, _ ->
|
define("reply", Command.Privilege.STANDARD){ player, _ ->
|
||||||
if(player.interfaceManager.isOpened){
|
if(player.interfaceManager.isOpened){
|
||||||
player.sendMessage("<col=e74c3c>Please finish what you're doing first.")
|
reject(player, "<col=e74c3c>Please finish what you're doing first.")
|
||||||
return@define
|
|
||||||
}
|
}
|
||||||
if (player.attributes.containsKey("replyTo")) {
|
if (player.attributes.containsKey("replyTo")) {
|
||||||
player.setAttribute("keepDialogueAlive", true)
|
player.setAttribute("keepDialogueAlive", true)
|
||||||
|
|
@ -217,7 +215,7 @@ class MiscCommandSet : CommandSet(Command.Privilege.ADMIN){
|
||||||
})
|
})
|
||||||
player.dialogueInterpreter.sendMessageInput(StringUtils.formatDisplayName(replyTo))
|
player.dialogueInterpreter.sendMessageInput(StringUtils.formatDisplayName(replyTo))
|
||||||
} else {
|
} else {
|
||||||
player.packetDispatch.sendMessage("<col=3498db>You have not recieved any recent messages to which you can reply.")
|
reject(player, "<col=3498db>You have not recieved any recent messages to which you can reply.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -255,17 +253,16 @@ class MiscCommandSet : CommandSet(Command.Privilege.ADMIN){
|
||||||
* Set a specific skill to a specific level
|
* Set a specific skill to a specific level
|
||||||
*/
|
*/
|
||||||
define("setlevel"){player,args ->
|
define("setlevel"){player,args ->
|
||||||
if(args.size < 2) reject(player,"Usage: ::setlevel skillname level").also { return@define }
|
if(args.size < 2) reject(player,"Usage: ::setlevel skillname level")
|
||||||
val skillname = args[1]
|
val skillname = args[1]
|
||||||
val desiredLevel: Int? = args[2].toIntOrNull()
|
val desiredLevel: Int? = args[2].toIntOrNull()
|
||||||
if(desiredLevel == null){
|
if(desiredLevel == null){
|
||||||
reject(player, "Level must be an integer.")
|
reject(player, "Level must be an integer.")
|
||||||
return@define
|
|
||||||
}
|
}
|
||||||
if(desiredLevel > 99) reject(player,"Level must be 99 or lower.").also { return@define }
|
if(desiredLevel!! > 99) reject(player,"Level must be 99 or lower.")
|
||||||
val skill = Skills.getSkillByName(skillname)
|
val skill = Skills.getSkillByName(skillname)
|
||||||
|
|
||||||
if(skill < 0) reject(player, "Must use a valid skill name!").also { return@define }
|
if(skill < 0) reject(player, "Must use a valid skill name!")
|
||||||
|
|
||||||
player.skills.setStaticLevel(skill,desiredLevel)
|
player.skills.setStaticLevel(skill,desiredLevel)
|
||||||
player.skills.setLevel(skill,desiredLevel)
|
player.skills.setLevel(skill,desiredLevel)
|
||||||
|
|
@ -333,7 +330,6 @@ class MiscCommandSet : CommandSet(Command.Privilege.ADMIN){
|
||||||
define("setconfig"){player,args ->
|
define("setconfig"){player,args ->
|
||||||
if(args.size < 3){
|
if(args.size < 3){
|
||||||
reject(player,"Syntax: ::setconfig configID value")
|
reject(player,"Syntax: ::setconfig configID value")
|
||||||
return@define
|
|
||||||
}
|
}
|
||||||
val configID = args[1].toString().toInt()
|
val configID = args[1].toString().toInt()
|
||||||
val configValue = args[2].toString().toInt()
|
val configValue = args[2].toString().toInt()
|
||||||
|
|
@ -343,37 +339,35 @@ class MiscCommandSet : CommandSet(Command.Privilege.ADMIN){
|
||||||
define("getobjectvarp"){player,args ->
|
define("getobjectvarp"){player,args ->
|
||||||
if(args.size < 2){
|
if(args.size < 2){
|
||||||
reject(player,"Syntax: ::getobjectvarp objectid")
|
reject(player,"Syntax: ::getobjectvarp objectid")
|
||||||
return@define
|
|
||||||
}
|
}
|
||||||
val objectID = args[1].toInt()
|
val objectID = args[1].toInt()
|
||||||
player.sendMessage("${VarbitDefinition.forObjectID(ObjectDefinition.forId(objectID).varbitID).configId}")
|
notify(player, "${VarbitDefinition.forObjectID(ObjectDefinition.forId(objectID).varbitID).configId}")
|
||||||
}
|
}
|
||||||
|
|
||||||
define("togglexp",Command.Privilege.STANDARD){ player, args ->
|
define("togglexp",Command.Privilege.STANDARD){ player, args ->
|
||||||
val enabled = player.varpManager.get(2501).getVarbit(0)?.value == 1
|
val enabled = player.varpManager.get(2501).getVarbit(0)?.value == 1
|
||||||
player.varpManager.get(2501).setVarbit(0,if(enabled) 0 else 1).send(player)
|
player.varpManager.get(2501).setVarbit(0,if(enabled) 0 else 1).send(player)
|
||||||
player.sendMessage("XP drops are now " + colorize("%R" + if(!enabled) "ON." else "OFF."))
|
notify(player, "XP drops are now " + colorize("%R" + if(!enabled) "ON." else "OFF."))
|
||||||
player.varpManager.flagSave(2501)
|
player.varpManager.flagSave(2501)
|
||||||
}
|
}
|
||||||
|
|
||||||
define("xpconfig",Command.Privilege.STANDARD){player,args ->
|
define("xpconfig",Command.Privilege.STANDARD){player,args ->
|
||||||
if(args.size < 3){
|
if(args.size < 3){
|
||||||
reject(player,"Usage: ::xpconfig track|mode type")
|
reject(player,"Usage: ::xpconfig track|mode type",
|
||||||
reject(player,"Track types: total|recent")
|
"Track types: total|recent",
|
||||||
reject(player, "Mode types: instant|increment")
|
"Mode types: instant|increment",
|
||||||
reject(player,"Defaults: track - total, mode - increment")
|
"Defaults: track - total, mode - increment")
|
||||||
return@define
|
|
||||||
}
|
}
|
||||||
|
|
||||||
when(args[1]){
|
when(args[1]){
|
||||||
"track" -> when(args[2]){
|
"track" -> when(args[2]){
|
||||||
"total" -> {
|
"total" -> {
|
||||||
player.varpManager.get(2501).setVarbit(2,0).send(player)
|
player.varpManager.get(2501).setVarbit(2,0).send(player)
|
||||||
player.sendMessage("You are now tracking " + colorize("%RTOTAL") + " experience.")
|
notify(player,"You are now tracking " + colorize("%RTOTAL") + " experience.")
|
||||||
}
|
}
|
||||||
"recent" -> {
|
"recent" -> {
|
||||||
player.varpManager.get(2501).setVarbit(2,1).send(player)
|
player.varpManager.get(2501).setVarbit(2,1).send(player)
|
||||||
player.sendMessage("You are now tracking the " + colorize("%RMOST RECENT") + " skill's experience.")
|
notify(player,"You are now tracking the " + colorize("%RMOST RECENT") + " skill's experience.")
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
reject(player,"Usage: ::xpconfig track|mode type")
|
reject(player,"Usage: ::xpconfig track|mode type")
|
||||||
|
|
@ -387,11 +381,11 @@ class MiscCommandSet : CommandSet(Command.Privilege.ADMIN){
|
||||||
when(args[2]){
|
when(args[2]){
|
||||||
"instant" -> {
|
"instant" -> {
|
||||||
player.varpManager.get(2501).setVarbit(1,1).send(player)
|
player.varpManager.get(2501).setVarbit(1,1).send(player)
|
||||||
player.sendMessage("Your xp tracker now updates " + colorize("%RINSTANTLY") + ".")
|
notify(player,"Your xp tracker now updates " + colorize("%RINSTANTLY") + ".")
|
||||||
}
|
}
|
||||||
"increment" -> {
|
"increment" -> {
|
||||||
player.varpManager.get(2501).setVarbit(1,0).send(player)
|
player.varpManager.get(2501).setVarbit(1,0).send(player)
|
||||||
player.sendMessage("Your xp tracker now updates " + colorize("%RINCREMENTALLY") + ".")
|
notify(player,"Your xp tracker now updates " + colorize("%RINCREMENTALLY") + ".")
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
reject(player,"Usage: ::xpconfig track|mode type")
|
reject(player,"Usage: ::xpconfig track|mode type")
|
||||||
|
|
@ -419,14 +413,13 @@ class MiscCommandSet : CommandSet(Command.Privilege.ADMIN){
|
||||||
} else {
|
} else {
|
||||||
player.varpManager.get(2502).save = false
|
player.varpManager.get(2502).save = false
|
||||||
}
|
}
|
||||||
player.sendMessage("Slayer task tracker is now " + (if(disabled) colorize("%RON") else colorize("%ROFF")) + ".")
|
notify(player,"Slayer task tracker is now " + (if(disabled) colorize("%RON") else colorize("%ROFF")) + ".")
|
||||||
}
|
}
|
||||||
|
|
||||||
define("setvarbit",Command.Privilege.ADMIN){
|
define("setvarbit",Command.Privilege.ADMIN){
|
||||||
player,args ->
|
player,args ->
|
||||||
if(args.size < 4){
|
if(args.size < 4){
|
||||||
reject(player,"Usage: ::setvarbit index offset value")
|
reject(player,"Usage: ::setvarbit index offset value")
|
||||||
return@define
|
|
||||||
}
|
}
|
||||||
val index = args[1].toIntOrNull()
|
val index = args[1].toIntOrNull()
|
||||||
val offset = args[2].toIntOrNull()
|
val offset = args[2].toIntOrNull()
|
||||||
|
|
@ -434,10 +427,9 @@ class MiscCommandSet : CommandSet(Command.Privilege.ADMIN){
|
||||||
|
|
||||||
if(index == null || offset == null || value == null){
|
if(index == null || offset == null || value == null){
|
||||||
reject(player,"Usage ::setvarbit index offset value")
|
reject(player,"Usage ::setvarbit index offset value")
|
||||||
return@define
|
|
||||||
}
|
}
|
||||||
|
|
||||||
player.varpManager.get(index).setVarbit(offset,value).send(player)
|
player.varpManager.get(index!!).setVarbit(offset!!, value!!).send(player)
|
||||||
}
|
}
|
||||||
|
|
||||||
define("grow",Command.Privilege.ADMIN){player,_ ->
|
define("grow",Command.Privilege.ADMIN){player,_ ->
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package rs09.game.system.command.sets
|
package rs09.game.system.command.sets
|
||||||
|
|
||||||
|
import core.game.node.entity.player.Player
|
||||||
import rs09.game.system.command.Command
|
import rs09.game.system.command.Command
|
||||||
import core.game.system.task.Pulse
|
import core.game.system.task.Pulse
|
||||||
import rs09.game.world.GameWorld
|
import rs09.game.world.GameWorld
|
||||||
|
|
@ -18,6 +19,24 @@ class ModerationCommandSet : CommandSet(Command.Privilege.MODERATOR){
|
||||||
val MAX_JAIL_TIME = 1800 //Max jail time (in seconds)
|
val MAX_JAIL_TIME = 1800 //Max jail time (in seconds)
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Kick a player
|
||||||
|
* =============================================================================================================
|
||||||
|
*/
|
||||||
|
define("kick", Command.Privilege.ADMIN){ player, args ->
|
||||||
|
val playerToKick: Player? = Repository.getPlayerByName(args[1])
|
||||||
|
if (playerToKick != null) {
|
||||||
|
playerToKick.clear(true)
|
||||||
|
notify(player, "Player ${playerToKick.username} was kicked.")
|
||||||
|
} else {
|
||||||
|
reject(player, "ERROR REMOVING PLAYER.")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* =============================================================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Jail a player
|
* Jail a player
|
||||||
* =============================================================================================================
|
* =============================================================================================================
|
||||||
|
|
@ -25,25 +44,22 @@ class ModerationCommandSet : CommandSet(Command.Privilege.MODERATOR){
|
||||||
define("jail"){player,args ->
|
define("jail"){player,args ->
|
||||||
if(args.size < 3) {
|
if(args.size < 3) {
|
||||||
reject(player,"Usage: ::jail <seconds> <player>")
|
reject(player,"Usage: ::jail <seconds> <player>")
|
||||||
return@define
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val timeSeconds = args[1].toIntOrNull()
|
val timeSeconds = args[1].toIntOrNull()
|
||||||
if(timeSeconds == null){
|
if(timeSeconds == null){
|
||||||
reject(player, "<seconds> Must be a valid integer!")
|
reject(player, "<seconds> Must be a valid integer!")
|
||||||
return@define
|
|
||||||
}
|
}
|
||||||
if(timeSeconds > MAX_JAIL_TIME){
|
if(timeSeconds!! > MAX_JAIL_TIME){
|
||||||
reject(player, "Maximum jail time is $MAX_JAIL_TIME seconds.")
|
reject(player, "Maximum jail time is $MAX_JAIL_TIME seconds.")
|
||||||
return@define
|
|
||||||
}
|
}
|
||||||
val name = args.slice(2 until args.size).joinToString("_")
|
val name = args.slice(2 until args.size).joinToString("_")
|
||||||
val otherPlayer = Repository.getPlayerByName(name)
|
val otherPlayer = Repository.getPlayerByName(name)
|
||||||
if(otherPlayer == null){
|
if(otherPlayer == null){
|
||||||
reject(player, "Can not find $name in the player list!")
|
reject(player, "Can not find $name in the player list!")
|
||||||
return@define
|
|
||||||
}
|
}
|
||||||
player.sendMessage("Jailing ${otherPlayer.username} for $timeSeconds seconds.")
|
notify(player, "Jailing ${otherPlayer!!.username} for $timeSeconds seconds.")
|
||||||
|
notify(otherPlayer, "${player.username} has jailed you for $timeSeconds seconds.")
|
||||||
GameWorld.Pulser.submit(object : Pulse(3){
|
GameWorld.Pulser.submit(object : Pulse(3){
|
||||||
val originalLoc = otherPlayer.location
|
val originalLoc = otherPlayer.location
|
||||||
val releaseTime = System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(timeSeconds.toLong())
|
val releaseTime = System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(timeSeconds.toLong())
|
||||||
|
|
@ -62,7 +78,5 @@ class ModerationCommandSet : CommandSet(Command.Privilege.MODERATOR){
|
||||||
/**
|
/**
|
||||||
* =============================================================================================================
|
* =============================================================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -14,15 +14,13 @@ class MusicCommandSet : CommandSet(Command.Privilege.STANDARD){
|
||||||
define("playsong"){player,args ->
|
define("playsong"){player,args ->
|
||||||
if(args.size < 2){
|
if(args.size < 2){
|
||||||
reject(player,"Usage: ::playsong songID")
|
reject(player,"Usage: ::playsong songID")
|
||||||
return@define
|
|
||||||
}
|
}
|
||||||
val id = args[1].toIntOrNull()
|
val id = args[1].toIntOrNull()
|
||||||
if(id == null){
|
if(id == null){
|
||||||
reject(player,"Please use a valid integer for the song id.")
|
reject(player,"Please use a valid integer for the song id.")
|
||||||
return@define
|
|
||||||
}
|
}
|
||||||
player.musicPlayer.play(MusicEntry.forId(id))
|
player.musicPlayer.play(MusicEntry.forId(id!!))
|
||||||
player.sendMessage("Now playing song $id")
|
notify(player,"Now playing song $id")
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -31,12 +31,11 @@ class QuestCommandSet : CommandSet(Command.Privilege.ADMIN){
|
||||||
define("setqueststage"){player,args ->
|
define("setqueststage"){player,args ->
|
||||||
if (args.size < 2) {
|
if (args.size < 2) {
|
||||||
reject(player,"You must specify the index# of a quest, and a stage number")
|
reject(player,"You must specify the index# of a quest, and a stage number")
|
||||||
return@define
|
|
||||||
}
|
}
|
||||||
val quest = args[1].toIntOrNull() ?: return@define
|
val quest = args[1].toIntOrNull() ?: reject(player,"INVALID QUEST")
|
||||||
val stage = args[2].toIntOrNull() ?: return@define
|
val stage = args[2].toIntOrNull() ?: reject(player,"INVALID STAGE")
|
||||||
player.questRepository.setStage(player.questRepository.forIndex(quest), stage)
|
player.questRepository.setStage(player.questRepository.forIndex(quest as Int), stage as Int)
|
||||||
player.sendMessage("<col=209dff>Setting " + player.questRepository.forIndex(quest).name + " to stage $stage</col>")
|
notify(player, "<col=209dff>Setting " + player.questRepository.forIndex(quest).name + " to stage $stage</col>")
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ class SlayerCommandSet : CommandSet(Command.Privilege.ADMIN){
|
||||||
* Finishes a player's slayer task (the correct way)
|
* Finishes a player's slayer task (the correct way)
|
||||||
*/
|
*/
|
||||||
define("finishtask"){player,_ ->
|
define("finishtask"){player,_ ->
|
||||||
player.debug("Kill the npc that spawned to finish your task.")
|
notify(player, "Kill the npc that spawned to finish your task.")
|
||||||
player.slayer.amount = 1
|
player.slayer.amount = 1
|
||||||
val finisher = NPC(player.slayer.task.npcs[0], player.location)
|
val finisher = NPC(player.slayer.task.npcs[0], player.location)
|
||||||
finisher.isRespawn = false
|
finisher.isRespawn = false
|
||||||
|
|
@ -24,17 +24,15 @@ class SlayerCommandSet : CommandSet(Command.Privilege.ADMIN){
|
||||||
define("setslayerpoints"){player,args ->
|
define("setslayerpoints"){player,args ->
|
||||||
if(args.size < 2){
|
if(args.size < 2){
|
||||||
reject(player,"Usage: ::setslayerpoints amount")
|
reject(player,"Usage: ::setslayerpoints amount")
|
||||||
return@define
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val amount = args[1].toIntOrNull()
|
val amount = args[1].toIntOrNull()
|
||||||
if(amount == null){
|
if(amount == null){
|
||||||
reject(player,"Amount needs to be a valid integer!")
|
reject(player,"Amount needs to be a valid integer!")
|
||||||
return@define
|
|
||||||
}
|
}
|
||||||
|
|
||||||
player.slayer.slayerPoints = amount
|
player.slayer.slayerPoints = amount!!
|
||||||
player.sendMessage("Set slayer points to $amount.")
|
notify(player, "Set slayer points to $amount.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
package rs09.game.system.command.sets
|
package rs09.game.system.command.sets
|
||||||
|
|
||||||
|
import core.cache.Cache
|
||||||
|
import core.cache.def.Definition
|
||||||
|
import core.cache.def.impl.ItemDefinition
|
||||||
import core.game.node.entity.player.info.login.Response
|
import core.game.node.entity.player.info.login.Response
|
||||||
import core.game.node.entity.player.info.portal.PlayerSQLManager
|
import core.game.node.entity.player.info.portal.PlayerSQLManager
|
||||||
import core.game.node.item.Item
|
import core.game.node.item.Item
|
||||||
|
|
@ -8,14 +11,16 @@ import core.game.system.SystemState
|
||||||
import core.plugin.Initializable
|
import core.plugin.Initializable
|
||||||
import org.rs09.consts.Items
|
import org.rs09.consts.Items
|
||||||
import rs09.game.system.command.Command
|
import rs09.game.system.command.Command
|
||||||
|
import rs09.game.world.repository.Repository
|
||||||
|
import rs09.tools.getAmount
|
||||||
|
|
||||||
@Initializable
|
@Initializable
|
||||||
class SystemCommandSet : CommandSet(Command.Privilege.ADMIN){
|
class SystemCommandSet : CommandSet(Command.Privilege.ADMIN) {
|
||||||
override fun defineCommands() {
|
override fun defineCommands() {
|
||||||
/**
|
/**
|
||||||
* Start an update countdown
|
* Start an update countdown
|
||||||
*/
|
*/
|
||||||
define("update"){player,args ->
|
define("update") { player, args ->
|
||||||
if (args.size > 1) {
|
if (args.size > 1) {
|
||||||
SystemManager.getUpdater().setCountdown(args[1].toInt())
|
SystemManager.getUpdater().setCountdown(args[1].toInt())
|
||||||
}
|
}
|
||||||
|
|
@ -25,7 +30,7 @@ class SystemCommandSet : CommandSet(Command.Privilege.ADMIN){
|
||||||
/**
|
/**
|
||||||
* Cancel an update countdown
|
* Cancel an update countdown
|
||||||
*/
|
*/
|
||||||
define("cancelupdate"){player,_ ->
|
define("cancelupdate") { player, _ ->
|
||||||
SystemManager.getUpdater().cancel()
|
SystemManager.getUpdater().cancel()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -33,42 +38,199 @@ class SystemCommandSet : CommandSet(Command.Privilege.ADMIN){
|
||||||
/**
|
/**
|
||||||
* Allows a player to reset their password
|
* Allows a player to reset their password
|
||||||
*/
|
*/
|
||||||
define("resetpassword", Command.Privilege.STANDARD){ player, args ->
|
define("resetpassword", Command.Privilege.STANDARD) { player, args ->
|
||||||
if(args.size != 3){
|
if (args.size != 3) {
|
||||||
reject(player,"Usage: ::resetpassword current new")
|
reject(player, "Usage: ::resetpassword current new", "WARNING: THIS IS PERMANENT.", "WARNING: PASSWORD CAN NOT CONTAIN SPACES.")
|
||||||
reject(player,"WARNING: THIS IS PERMANENT.")
|
|
||||||
reject(player,"WARNING: PASSWORD CAN NOT CONTAIN SPACES.")
|
|
||||||
return@define
|
|
||||||
}
|
}
|
||||||
val oldPass = args[1]
|
val oldPass = args[1]
|
||||||
var newPass = args[2]
|
var newPass = args[2]
|
||||||
|
|
||||||
if(PlayerSQLManager.getCredentialResponse(player.details.username,oldPass) != Response.SUCCESSFUL){
|
if (PlayerSQLManager.getCredentialResponse(player.details.username, oldPass) != Response.SUCCESSFUL) {
|
||||||
reject(player,"INVALID PASSWORD!")
|
reject(player, "INVALID PASSWORD!")
|
||||||
return@define
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(newPass.length < 5 || newPass.length > 20){
|
if (newPass.length < 5 || newPass.length > 20) {
|
||||||
reject(player,"NEW PASSWORD MUST BE BETWEEN 5 AND 20 CHARACTERS")
|
reject(player, "NEW PASSWORD MUST BE BETWEEN 5 AND 20 CHARACTERS")
|
||||||
return@define
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(newPass == player.username){
|
if (newPass == player.username) {
|
||||||
reject(player,"PASSWORD CAN NOT BE SAME AS USERNAME.")
|
reject(player, "PASSWORD CAN NOT BE SAME AS USERNAME.")
|
||||||
return@define
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(newPass == oldPass){
|
if (newPass == oldPass) {
|
||||||
reject(player,"PASSWORDS CAN NOT BE THE SAME")
|
reject(player, "PASSWORDS CAN NOT BE THE SAME")
|
||||||
return@define
|
|
||||||
}
|
}
|
||||||
|
|
||||||
newPass = SystemManager.getEncryption().hashPassword(newPass)
|
newPass = SystemManager.getEncryption().hashPassword(newPass)
|
||||||
PlayerSQLManager.updatePassword(player.username.toLowerCase().replace(" ","_"),newPass)
|
PlayerSQLManager.updatePassword(player.username.toLowerCase().replace(" ", "_"), newPass)
|
||||||
reject(player,"Password updated successfully.")
|
notify(player, "Password updated successfully.")
|
||||||
}
|
}
|
||||||
|
|
||||||
define("potato"){player,_ ->
|
/**
|
||||||
|
* Allows an Administrator to reset a password
|
||||||
|
*/
|
||||||
|
define("setpasswordother", Command.Privilege.ADMIN) { player, args ->
|
||||||
|
if (args.size != 3) {
|
||||||
|
reject(player, "Usage: ::resetpasswordother user new", "WARNING: THIS IS PERMANENT.", "WARNING: PASSWORD CAN NOT CONTAIN SPACES.")
|
||||||
|
}
|
||||||
|
val otherUser = args[1]
|
||||||
|
var newPass = args[2]
|
||||||
|
|
||||||
|
if (PlayerSQLManager.hasSqlAccount(otherUser, "username")) {
|
||||||
|
|
||||||
|
if (newPass.length < 5 || newPass.length > 20) {
|
||||||
|
reject(player, "NEW PASSWORD MUST BE BETWEEN 5 AND 20 CHARACTERS")
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newPass == otherUser) {
|
||||||
|
reject(player, "PASSWORD CAN NOT BE SAME AS USERNAME.")
|
||||||
|
}
|
||||||
|
|
||||||
|
newPass = SystemManager.getEncryption().hashPassword(newPass)
|
||||||
|
PlayerSQLManager.updatePassword(otherUser.toLowerCase().replace(" ","_"),newPass)
|
||||||
|
notify(player, "Password updated successfully.")
|
||||||
|
|
||||||
|
} else {
|
||||||
|
reject(player, "USER DOES NOT EXIST!")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
define("giveitem", Command.Privilege.ADMIN) { player, args ->
|
||||||
|
if (args.size == 3 || args.size == 4) {
|
||||||
|
val victim = Repository.getPlayerByName(args[1])
|
||||||
|
val itemID = args[2].toIntOrNull()
|
||||||
|
val amount = args.getOrNull(3)?.toIntOrNull() ?: 1
|
||||||
|
|
||||||
|
if (victim == null) {
|
||||||
|
reject(player, "INVALID TARGET USERNAME.")
|
||||||
|
}
|
||||||
|
|
||||||
|
if (itemID == null || itemID <= 0 || itemID > ItemDefinition.getDefinitions().size) {
|
||||||
|
reject(player, "INVALID ITEM ID ENTERED.")
|
||||||
|
}
|
||||||
|
|
||||||
|
if (amount > Int.MAX_VALUE || amount <= 0) {
|
||||||
|
reject(player, "INVALID ITEM ID ENTERED.")
|
||||||
|
}
|
||||||
|
|
||||||
|
val item = Item(itemID!!, amount)
|
||||||
|
val invFull = victim!!.inventory.isFull
|
||||||
|
val syntax = if (amount > 1) "items" else "item"
|
||||||
|
|
||||||
|
if (invFull) {
|
||||||
|
victim.bank.add(item)
|
||||||
|
} else {
|
||||||
|
victim.inventory.add(item)
|
||||||
|
}
|
||||||
|
|
||||||
|
notify(player, "Successfully gave ${victim.username} $amount ${item.name}. ${if (invFull) "The $syntax were sent to their bank." else ""}")
|
||||||
|
notify(victim, "You received $amount ${item.name} from ${player.username}. ${if (invFull) "The $syntax were placed in your bank." else ""}")
|
||||||
|
|
||||||
|
} else {
|
||||||
|
reject(player, "WRONG USAGE. USE giveitem target itemID || giveitem target itemID amt")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
define("removeitem", Command.Privilege.ADMIN) { player, args ->
|
||||||
|
if (args.size == 4 || args.size == 5) {
|
||||||
|
val itemLoc = args[1].toLowerCase()
|
||||||
|
val victim = Repository.getPlayerByName(args[2])
|
||||||
|
val itemID = args[3].toIntOrNull()
|
||||||
|
var amount = args.getOrNull(4)?.toIntOrNull() ?: 1
|
||||||
|
|
||||||
|
if (victim == null) {
|
||||||
|
reject(player, "INVALID TARGET USERNAME.")
|
||||||
|
}
|
||||||
|
|
||||||
|
if (itemID == null || itemID <= 0 || itemID > ItemDefinition.getDefinitions().size) {
|
||||||
|
reject(player, "INVALID ITEM ID ENTERED.")
|
||||||
|
}
|
||||||
|
|
||||||
|
if (amount > Int.MAX_VALUE || amount <= 0) {
|
||||||
|
reject(player, "INVALID ITEM AMOUNT ENTERED.")
|
||||||
|
}
|
||||||
|
|
||||||
|
val item = Item(itemID!!, amount)
|
||||||
|
var totalItemAmount = 0
|
||||||
|
|
||||||
|
when (itemLoc) {
|
||||||
|
"i", "inv", "inventory" -> {
|
||||||
|
totalItemAmount = victim!!.inventory.getItem(item).amount
|
||||||
|
victim.inventory.remove(item)
|
||||||
|
}
|
||||||
|
"b", "bk", "bank" -> {
|
||||||
|
totalItemAmount = victim!!.bank.getItem(item).amount
|
||||||
|
victim.bank.remove(item)
|
||||||
|
}
|
||||||
|
"e", "equip", "equipment" -> {
|
||||||
|
totalItemAmount = victim!!.equipment.getItem(item).amount
|
||||||
|
victim.equipment.remove(item)
|
||||||
|
}
|
||||||
|
else -> reject(player, "INVALID ITEM LOCATION ENTERED. USE: ", "i, inv, inventory | b, bk, bank | e, equip, equipment")
|
||||||
|
}
|
||||||
|
|
||||||
|
if (amount > totalItemAmount) {
|
||||||
|
amount = totalItemAmount
|
||||||
|
}
|
||||||
|
|
||||||
|
notify(player, "Successfully removed $amount ${item.name} from ${victim!!.username}.")
|
||||||
|
notify(victim, "${player.username} removed $amount ${item.name} from your inventory.")
|
||||||
|
|
||||||
|
} else {
|
||||||
|
reject(player, "WRONG USAGE. USE removeitem itemLoc target itemID || removeitem itemLoc target itemID amt",
|
||||||
|
"ItemLoc: inv = inventory | equip = equipment | bank |")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
define("removeitemall", Command.Privilege.ADMIN) { player, args ->
|
||||||
|
if (args.size == 3) {
|
||||||
|
val victim = Repository.getPlayerByName(args[1])
|
||||||
|
val itemID = args[2].toIntOrNull()
|
||||||
|
|
||||||
|
if (victim == null) {
|
||||||
|
reject(player, "INVALID TARGET USERNAME.")
|
||||||
|
}
|
||||||
|
|
||||||
|
if (itemID == null || itemID <= 0 || itemID > ItemDefinition.getDefinitions().size) {
|
||||||
|
reject(player, "INVALID ITEM ID ENTERED.")
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Handles removing the non noted version */
|
||||||
|
val itemInv = Item(itemID!!)
|
||||||
|
/* Handles removing the noted version */
|
||||||
|
val itemNote = Item(itemInv.noteChange)
|
||||||
|
|
||||||
|
val untotal = victim!!.inventory.getAmount(itemID) + victim.bank.getAmount(itemID) +
|
||||||
|
victim.equipment.getAmount(itemID)
|
||||||
|
|
||||||
|
val nototal = victim.inventory.getAmount(itemNote) + victim.bank.getAmount(itemNote) +
|
||||||
|
victim.equipment.getAmount(itemNote)
|
||||||
|
|
||||||
|
val eqtotal = victim.equipment.getAmount(itemID) + victim.equipment.getAmount(itemNote)
|
||||||
|
|
||||||
|
val total = untotal + nototal + eqtotal
|
||||||
|
|
||||||
|
if (total == 0) {
|
||||||
|
reject(player, "USER HAS NONE OF THOSE ITEMS.")
|
||||||
|
}
|
||||||
|
|
||||||
|
victim.inventory.remove(Item(itemID, victim.inventory.getAmount(itemID)))
|
||||||
|
victim.bank.remove(Item(itemID, victim.bank.getAmount(itemID)))
|
||||||
|
victim.equipment.remove(Item(itemID, victim.equipment.getAmount(itemID)))
|
||||||
|
|
||||||
|
victim.inventory.remove(Item(itemInv.noteChange, victim.inventory.getAmount(itemNote)))
|
||||||
|
victim.bank.remove(Item(itemInv.noteChange, victim.bank.getAmount(itemNote)))
|
||||||
|
victim.equipment.remove(Item(itemInv.noteChange, victim.equipment.getAmount(itemNote)))
|
||||||
|
|
||||||
|
notify(player, "Successfully removed $total ${itemInv.name} from ${victim.username}.")
|
||||||
|
notify(victim, "${player.username} removed $total ${itemInv.name} from your account.")
|
||||||
|
|
||||||
|
} else {
|
||||||
|
reject(player, "WRONG USAGE. USE removeitemall target itemID")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
define("potato") { player, _ ->
|
||||||
player.inventory.add(Item(Items.ROTTEN_POTATO_5733))
|
player.inventory.add(Item(Items.ROTTEN_POTATO_5733))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,6 @@ class TeleportCommandSet : CommandSet(Command.Privilege.ADMIN){
|
||||||
}
|
}
|
||||||
if (args.size < 2) {
|
if (args.size < 2) {
|
||||||
reject(player,"syntax error: x, y, (optional) z")
|
reject(player,"syntax error: x, y, (optional) z")
|
||||||
return@define
|
|
||||||
}
|
}
|
||||||
player.properties.teleportLocation = Location.create(args[1].toInt(), args[2].toInt(), if (args.size > 3) args[3].toInt() else 0)
|
player.properties.teleportLocation = Location.create(args[1].toInt(), args[2].toInt(), if (args.size > 3) args[3].toInt() else 0)
|
||||||
}
|
}
|
||||||
|
|
@ -59,17 +58,14 @@ class TeleportCommandSet : CommandSet(Command.Privilege.ADMIN){
|
||||||
define("teleto"){player,args ->
|
define("teleto"){player,args ->
|
||||||
if (args.size < 1) {
|
if (args.size < 1) {
|
||||||
reject(player,"syntax error: name")
|
reject(player,"syntax error: name")
|
||||||
return@define
|
|
||||||
}
|
}
|
||||||
val n = args.slice(1 until args.size).joinToString("_")
|
val n = args.slice(1 until args.size).joinToString("_")
|
||||||
val target = Repository.getPlayerByName(n)
|
val target = Repository.getPlayerByName(n)
|
||||||
if (target == null) {
|
if (target == null) {
|
||||||
reject(player,"syntax error: name")
|
reject(player,"syntax error: name")
|
||||||
return@define
|
|
||||||
}
|
}
|
||||||
if (target.getAttribute<Any?>("fc_wave") != null) {
|
if (target!!.getAttribute<Any?>("fc_wave") != null) {
|
||||||
reject(player,"You cannot teleport to a player who is in the Fight Caves.")
|
reject(player,"You cannot teleport to a player who is in the Fight Caves.")
|
||||||
return@define
|
|
||||||
}
|
}
|
||||||
player.properties.teleportLocation = target.location
|
player.properties.teleportLocation = target.location
|
||||||
}
|
}
|
||||||
|
|
@ -81,17 +77,14 @@ class TeleportCommandSet : CommandSet(Command.Privilege.ADMIN){
|
||||||
define("teletome"){player,args ->
|
define("teletome"){player,args ->
|
||||||
if (args.size < 1) {
|
if (args.size < 1) {
|
||||||
reject(player,"syntax error: name")
|
reject(player,"syntax error: name")
|
||||||
return@define
|
|
||||||
}
|
}
|
||||||
val n = args.slice(1 until args.size).joinToString("_")
|
val n = args.slice(1 until args.size).joinToString("_")
|
||||||
val target = Repository.getPlayerByName(n)
|
val target = Repository.getPlayerByName(n)
|
||||||
if (target == null) {
|
if (target == null) {
|
||||||
reject(player,"syntax error: name")
|
reject(player,"syntax error: name")
|
||||||
return@define
|
|
||||||
}
|
}
|
||||||
if (target.getAttribute<Any?>("fc_wave") != null) {
|
if (target!!.getAttribute<Any?>("fc_wave") != null) {
|
||||||
reject(player,"You cannot teleport to a player who is in the Fight Caves.")
|
reject(player,"You cannot teleport to a player who is in the Fight Caves.")
|
||||||
return@define
|
|
||||||
}
|
}
|
||||||
target.properties.teleportLocation = player.location
|
target.properties.teleportLocation = player.location
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue