mirror of
https://gitlab.com/2009scape/rt4-client.git
synced 2025-12-09 16:45:46 -07:00
ValUAdd Plugin
This commit is contained in:
parent
3e45689d6e
commit
3087845f1e
1 changed files with 31 additions and 0 deletions
31
plugin-playground/src/main/kotlin/ValUAdd/plugin.kt
Normal file
31
plugin-playground/src/main/kotlin/ValUAdd/plugin.kt
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
package ValUAdd
|
||||||
|
|
||||||
|
import plugin.Plugin
|
||||||
|
import plugin.annotations.PluginMeta
|
||||||
|
import plugin.api.API.SendMessage
|
||||||
|
import rt4.Inv
|
||||||
|
import rt4.ObjTypeList
|
||||||
|
import kotlin.math.round
|
||||||
|
|
||||||
|
@PluginMeta (
|
||||||
|
author = "bushtail",
|
||||||
|
description = "Quickly tally the value of your inventory with a command.",
|
||||||
|
version = 1.0
|
||||||
|
)
|
||||||
|
class plugin : Plugin() {
|
||||||
|
override fun ProcessCommand(commandStr: String, args: Array<out String>?) {
|
||||||
|
when(commandStr.toLowerCase()) {
|
||||||
|
"::valuadd" -> {
|
||||||
|
var value = 0
|
||||||
|
val inventory = Inv.objectContainerCache.get(93) as Inv
|
||||||
|
for(i in inventory.objectIds) {
|
||||||
|
if(i != -1) {
|
||||||
|
val obj = ObjTypeList.get(i)
|
||||||
|
value += round(obj.cost * 0.6).toInt()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SendMessage("Total HA value of inventory: $value GP")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue