ValUAdd Plugin

This commit is contained in:
bushtail 2023-08-14 23:32:52 -04:00
parent 3e45689d6e
commit 3087845f1e

View 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")
}
}
}
}