Removed lots of dead code

This commit is contained in:
Ceikry
2022-09-17 16:28:52 +00:00
parent f406b8aa98
commit d2283e6716
396 changed files with 1117 additions and 19344 deletions
+2 -2
View File
@@ -259,7 +259,7 @@ abstract class Cutscene(val player: Player) {
try {
endActions?.invoke()
} catch (e: Exception) {
SystemLogger.logErr("There's some bad nasty code in ${this::class.java.simpleName} end actions!")
SystemLogger.logErr(this::class.java, "There's some bad nasty code in ${this::class.java.simpleName} end actions!")
e.printStackTrace()
}
return true
@@ -347,7 +347,7 @@ abstract class Cutscene(val player: Player) {
fun logCutscene(message: String)
{
if(ServerConstants.LOG_CUTSCENE)
SystemLogger.logInfo("[CUTSCENE: ${this.javaClass.simpleName}] $message")
SystemLogger.logInfo(this::class.java, "$message")
}
fun clearNPCs() {
+7 -5
View File
@@ -689,7 +689,7 @@ fun openDialogue(player: Player, dialogue: Any, vararg args: Any) {
is Int -> player.dialogueInterpreter.open(dialogue, *args)
is DialogueFile -> player.dialogueInterpreter.open(dialogue, *args)
is SkillDialogueHandler -> dialogue.open()
else -> SystemLogger.logErr("Invalid object type passed to openDialogue() -> ${dialogue.javaClass.simpleName}")
else -> SystemLogger.logErr(ContentAPI::class.java, "Invalid object type passed to openDialogue() -> ${dialogue.javaClass.simpleName}")
}
}
@@ -975,7 +975,7 @@ fun adjustCharge(node: Node, amount: Int) {
when (node) {
is Item -> node.charge += amount
is Scenery -> node.charge += amount
else -> SystemLogger.logErr("Attempt to adjust the charge of invalid type: ${node.javaClass.simpleName}")
else -> SystemLogger.logErr(ContentAPI::class.java, "Attempt to adjust the charge of invalid type: ${node.javaClass.simpleName}")
}
}
@@ -988,7 +988,7 @@ fun getCharge(node: Node): Int {
when (node) {
is Item -> return node.charge
is Scenery -> return node.charge
else -> SystemLogger.logErr("Attempt to get charge of invalid type: ${node.javaClass.simpleName}")
else -> SystemLogger.logErr(ContentAPI::class.java, "Attempt to get charge of invalid type: ${node.javaClass.simpleName}")
.also { return -1 }
}
}
@@ -1002,7 +1002,7 @@ fun setCharge(node: Node, charge: Int) {
when (node) {
is Item -> node.charge = charge
is Scenery -> node.charge = charge
else -> SystemLogger.logErr("Attempt to set the charge of invalid type: ${node.javaClass.simpleName}")
else -> SystemLogger.logErr(ContentAPI::class.java, "Attempt to set the charge of invalid type: ${node.javaClass.simpleName}")
}
}
@@ -2128,4 +2128,6 @@ fun updateCredits(player: Player, amount: Int) : Boolean {
*/
fun getCredits(player: Player) : Int {
return player.details.accountInfo.credits
}
}
private class ContentAPI
-132
View File
@@ -1,132 +0,0 @@
package gui
import java.awt.*
import javax.swing.JPanel
/**
* @author Rodrigo, Maritaria
* @author Ceikry (rewrote into Kotlin, adapted for specific use case)
*/
class GraphView() : JPanel() {
private val values: MutableList<Int> = ArrayList(10)
fun setValues(newValues: Collection<Int>) {
values.clear()
addValues(newValues)
}
fun addValues(newValues: Collection<Int>) {
if(values.size > 200) values.removeFirst()
values.addAll(newValues)
updateUI()
}
override fun paintComponent(graphics: Graphics) {
super.paintComponent(graphics)
if (graphics !is Graphics2D) {
graphics.drawString("Graphics is not Graphics2D, unable to render", 0, 0)
return
}
val g: Graphics2D = graphics
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON)
val length: Int = values.size
val width: Int = width
val height: Int = height
val maxScore: Double = maxScore
val minScore: Double = minScore
val scoreRange: Double = maxScore - minScore
// draw white background
g.color = Color.WHITE
g.fillRect(
padding + labelPadding,
padding,
width - (2 * padding) - labelPadding,
height - (2 * padding) - labelPadding
)
g.color = Color.BLACK
val fontMetrics: FontMetrics = g.fontMetrics
val fontHeight: Int = fontMetrics.height
// create hatch marks and grid lines for y axis.
for (i in 0 until numberYDivisions + 1) {
val x1: Int = padding + labelPadding
val x2: Int = pointWidth + padding + labelPadding
val y: Int =
height - (((i * (height - (padding * 2) - labelPadding)) / numberYDivisions) + padding + labelPadding)
if (length > 0) {
g.color = gridColor
g.drawLine(padding + labelPadding + 1 + pointWidth, y, width - padding, y)
g.color = Color.BLACK
val tickValue: Int = (minScore + ((scoreRange * i) / numberYDivisions)).toInt()
val yLabel: String = tickValue.toString() + ""
val labelWidth: Int = fontMetrics.stringWidth(yLabel)
g.drawString(yLabel, x1 - labelWidth - 5, y + (fontHeight / 2) - 3)
}
g.drawLine(x1, y, x2, y)
}
// create x and y axes
g.drawLine(padding + labelPadding, height - padding - labelPadding, padding + labelPadding, padding)
g.drawLine(
padding + labelPadding,
height - padding - labelPadding,
width - padding,
height - padding - labelPadding
)
val oldStroke: Stroke = g.stroke
g.color = lineColor
g.stroke = graphStroke
val xScale: Double = (width.toDouble() - (2 * padding) - labelPadding) / (length - 1)
val yScale: Double = (height.toDouble() - (2 * padding) - labelPadding) / scoreRange
val graphPoints: MutableList<Point> = ArrayList(length)
for (i in 0 until length) {
val x1: Int = ((i * xScale) + padding + labelPadding).toInt()
val y1: Int = ((maxScore - values.get(i)) * yScale + padding).toInt()
graphPoints.add(Point(x1, y1))
}
for (i in 0 until graphPoints.size - 1) {
val x1: Int = graphPoints[i].x
val y1: Int = graphPoints[i].y
val x2: Int = graphPoints[i + 1].x
val y2: Int = graphPoints[i + 1].y
if(y2 != 0) {
g.drawLine(x1, y1, x2, y2)
}
}
val drawDots: Boolean = width > (length * pointWidth)
if (drawDots) {
g.stroke = oldStroke
g.color = pointColor
for (graphPoint: Point in graphPoints) {
val x: Int = graphPoint.x - pointWidth / 2
val y: Int = graphPoint.y - pointWidth / 2
g.fillOval(x, y, pointWidth, pointWidth)
}
}
}
private val minScore: Double
get() = values.stream().min { obj: Int, integer: Int? -> obj.compareTo((integer)!!) }.orElse(0)
.toDouble()
private val maxScore: Double
get() {
return values.stream().max { obj: Int, integer: Int? -> obj.compareTo((integer)!!) }.orElse(0)
.toDouble()
}
companion object {
private const val padding: Int = 25
private const val labelPadding: Int = 25
private const val pointWidth: Int = 4
private const val numberYDivisions: Int = 10
private val lineColor: Color = Color(44, 102, 230, 180)
private val pointColor: Color = Color(100, 100, 100, 180)
private val gridColor: Color = Color(200, 200, 200, 200)
private val graphStroke: Stroke = BasicStroke(2f)
}
init {
preferredSize = Dimension(padding * 2 + 300, padding * 2 + 200)
}
}
-10
View File
@@ -1,10 +0,0 @@
package gui
sealed class GuiEvent {
class UpdatePulseCount(val amount: Int) : GuiEvent()
class UpdateTickTime(val time: Long) : GuiEvent()
class UpdateQueuedPackets(val amount: Int) : GuiEvent()
class AddDebugMessage(val message: String) : GuiEvent()
class AddDefaultMessage(val message: String) : GuiEvent()
class AddAIPMessage(val message: String): GuiEvent()
}
-173
View File
@@ -1,173 +0,0 @@
package gui
import rs09.game.world.GameWorld
import java.awt.BorderLayout
import java.awt.Component
import java.awt.Dimension
import javax.swing.*
object ServerMonitor : JFrame("Server Monitor"){
val eventQueue = ArrayList<GuiEvent>()
val pulseCount = JLabel("0")
val tickTime = JLabel("0")
val queuedPackets = JLabel("0")
val pulseList = JTextArea("")
val debugLog = JTextArea("")
val defaultLog = JTextArea("")
val AIPlog = JTextArea("")
val tickTimeGraph = GraphView()
val pulseCountGraph = GraphView()
val packetQueueGraph = GraphView()
init {
isVisible = false
layout = BorderLayout()
size = Dimension(800,640)
preferredSize = Dimension(800,640)
minimumSize = Dimension(800,640)
isResizable = false
val tabs = JTabbedPane()
tabs.addTab("Overview", constructOverviewTab())
tabs.addTab("Graphs", constructGraphsTab())
add(tabs)
pack()
}
private fun constructGraphsTab(): JPanel {
val graphPanel = JPanel()
graphPanel.placeAt(0,10,800,590)
val tickTimeBorder = BorderFactory.createTitledBorder("Tick Time")
val pulseCountBorder = BorderFactory.createTitledBorder("Pulse Count")
val packetQueueBorder = BorderFactory.createTitledBorder("Queued Packets")
tickTimeGraph.placeAt(0, 20, 300, 200)
tickTimeGraph.border = tickTimeBorder
pulseCountGraph.placeAt(300,20,300,200)
pulseCountGraph.border = pulseCountBorder
packetQueueGraph.placeAt(0,220,300,200)
packetQueueGraph.border = packetQueueBorder
graphPanel.add(tickTimeGraph)
graphPanel.add(pulseCountGraph)
graphPanel.add(packetQueueGraph)
return graphPanel
}
private fun constructOverviewTab(): JPanel {
val overviewPanel = JPanel(null)
overviewPanel.placeAt(0,10,800,590)
val pulseLabel = JLabel("Pulse Count: ")
pulseLabel.placeAt(0,20,100,10)
pulseCount.placeAt(150,20,100,10)
val tickLabel = JLabel("Tick Time: ")
tickLabel.placeAt(0,35,100,10)
tickTime.placeAt(150,35,100,10)
val packetLabel = JLabel("Queued Packets: ")
packetLabel.placeAt(0,50,200,10)
queuedPackets.placeAt(150, 50, 100, 10)
val scrollPane = JScrollPane(pulseList)
scrollPane.placeAt(400,10,390,275)
val border = BorderFactory.createTitledBorder("Pulses")
scrollPane.border = border
overviewPanel.add(pulseLabel)
overviewPanel.add(pulseCount)
overviewPanel.add(tickLabel)
overviewPanel.add(tickTime)
overviewPanel.add(packetLabel)
overviewPanel.add(queuedPackets)
overviewPanel.add(scrollPane)
val logPane = constructLogPane()
logPane.placeAt(0,280,800,300)
overviewPanel.add(logPane)
return overviewPanel
}
private fun constructLogPane() : JTabbedPane {
val logPane = JTabbedPane()
debugLog.isEditable = false
val debugPanel = JPanel(BorderLayout())
val debugScrollpane = JScrollPane(debugLog)
debugScrollpane.placeAt(0,300,800,300)
debugPanel.add(debugScrollpane, BorderLayout.CENTER)
defaultLog.isEditable = false
val defaultPanel = JPanel(BorderLayout())
val defaultScrollpane = JScrollPane(defaultLog)
defaultScrollpane.placeAt(0,300,800,300)
defaultPanel.add(defaultScrollpane, BorderLayout.CENTER)
AIPlog.isEditable = false
val AIPPanel = JPanel(BorderLayout())
val AIPscrollpane = JScrollPane(AIPlog)
AIPscrollpane.placeAt(0,300,800,300)
AIPPanel.add(AIPscrollpane, BorderLayout.CENTER)
logPane.addTab("Default",defaultPanel)
logPane.addTab("Debug",debugPanel)
logPane.addTab("AIP",AIPPanel)
return logPane
}
private fun Component.placeAt(x: Int, y: Int, width: Int, height: Int){
this.setBounds(x,y,width,height)
}
fun open() {
isVisible = true
Thread {
while (true) {
SwingUtilities.invokeLater {
val removeList = ArrayList<GuiEvent>()
eventQueue.toTypedArray().forEach { event ->
when (event) {
is GuiEvent.UpdatePulseCount -> {
pulseCount.text = event.amount.toString()
pulseCountGraph.addValues(intArrayOf(event.amount).toList())
}
is GuiEvent.UpdateTickTime -> {
tickTime.text = event.time.toString() + "ms"
tickTimeGraph.addValues(intArrayOf(event.time.toInt()).toList())
}
is GuiEvent.AddDefaultMessage -> defaultLog.text = defaultLog.text + event.message + "\n"
is GuiEvent.AddAIPMessage -> AIPlog.text = AIPlog.text + event.message + "\n"
is GuiEvent.AddDebugMessage -> debugLog.text = debugLog.text + event.message + "\n"
is GuiEvent.UpdateQueuedPackets -> {
queuedPackets.text = event.amount.toString()
packetQueueGraph.addValues(intArrayOf(event.amount).toList())
}
}
removeList.add(event)
}
pulseList.text = GameWorld.Pulser.currentPulses
.map { it.javaClass.simpleName + "\n" }
.filter { it.replace("\n", "").isNotEmpty() }
.sorted()
.joinToString("")
eventQueue.removeAll(removeList)
repaint()
}
Thread.sleep(600L)
}
}.start()
}
}
+8 -10
View File
@@ -2,7 +2,6 @@ package rs09
import core.game.system.SystemManager
import core.game.system.SystemState
import core.game.system.mysql.SQLManager
import core.net.NioReactor
import core.tools.TimeStamp
import kotlinx.coroutines.*
@@ -52,28 +51,27 @@ object Server {
@JvmStatic
fun main(args: Array<String>) {
if (args.isNotEmpty()) {
SystemLogger.logInfo("Using config file: ${args[0]}")
SystemLogger.logInfo(this::class.java, "Using config file: ${args[0]}")
ServerConfigParser.parse(args[0])
} else {
SystemLogger.logInfo("Using config file: ${"worldprops" + File.separator + "default.conf"}")
SystemLogger.logInfo(this::class.java, "Using config file: ${"worldprops" + File.separator + "default.conf"}")
ServerConfigParser.parse("worldprops" + File.separator + "default.conf")
}
startTime = System.currentTimeMillis()
val t = TimeStamp()
GameWorld.prompt(true)
SQLManager.init()
Runtime.getRuntime().addShutdownHook(ServerConstants.SHUTDOWN_HOOK)
SystemLogger.logInfo("Starting networking...")
SystemLogger.logInfo(this::class.java, "Starting networking...")
try {
reactor = NioReactor.configure(43594 + GameWorld.settings?.worldId!!)
reactor!!.start()
} catch (e: BindException) {
SystemLogger.logErr("Port " + (43594 + GameWorld.settings?.worldId!!) + " is already in use!")
SystemLogger.logErr(this::class.java, "Port " + (43594 + GameWorld.settings?.worldId!!) + " is already in use!")
throw e
}
//WorldCommunicator.connect()
SystemLogger.logInfo(GameWorld.settings?.name + " flags " + GameWorld.settings?.toString())
SystemLogger.logInfo(GameWorld.settings?.name + " started in " + t.duration(false, "") + " milliseconds.")
SystemLogger.logInfo(this::class.java, GameWorld.settings?.name + " flags " + GameWorld.settings?.toString())
SystemLogger.logInfo(this::class.java, GameWorld.settings?.name + " started in " + t.duration(false, "") + " milliseconds.")
val scanner = Scanner(System.`in`)
running = true
@@ -96,8 +94,8 @@ object Server {
delay(20000)
while (running) {
if (System.currentTimeMillis() - lastHeartbeat > 7200 && running) {
SystemLogger.logErr("Triggering reboot due to heartbeat timeout")
SystemLogger.logErr("Creating thread dump...")
SystemLogger.logErr(this::class.java, "Triggering reboot due to heartbeat timeout")
SystemLogger.logErr(this::class.java, "Creating thread dump...")
val dump = threadDump(true, true)
withContext(Dispatchers.IO) {
+1 -1
View File
@@ -41,7 +41,7 @@ class ServerStore : PersistWorld {
fileMap[key] = data
counter++
} catch (e: Exception){
SystemLogger.logErr("Failed parsing ${storeFile.name} - stack trace below.")
SystemLogger.logErr(this::class.java, "Failed parsing ${storeFile.name} - stack trace below.")
e.printStackTrace()
return@forEach
}
@@ -35,7 +35,7 @@ import rs09.ServerConstants.Companion.SERVER_GE_NAME
import rs09.game.ai.AIRepository
import rs09.game.ge.GrandExchange
import rs09.game.ge.GrandExchangeOffer
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
import rs09.game.interaction.InteractionListeners
import rs09.game.system.SystemLogger
import rs09.game.system.config.ItemConfigParser
@@ -68,15 +68,15 @@ class ScriptAPI(private val bot: Player) {
if(node == null) return
val type = when(node){
is Scenery -> InteractionListener.SCENERY
is NPC -> InteractionListener.NPC
is Item -> InteractionListener.ITEM
else -> -1
}
is Scenery -> IntType.SCENERY
is NPC -> IntType.NPC
is Item -> IntType.ITEM
else -> null
} ?: return
val opt: Option? = node.interaction.options.filter {it != null && it.name.equals(option, true) }.firstOrNull()
if(opt == null){
SystemLogger.logWarn("Invalid option name provided: $option")
SystemLogger.logWarn(this::class.java, "Invalid option name provided: $option")
return
}
@@ -464,7 +464,7 @@ class ScriptAPI(private val bot: Player) {
}
val canSell = GrandExchange.addBotOffer(actualId, itemAmt)
if (canSell && saleIsBigNews(actualId, itemAmt)) {
SystemLogger.logAI("Offered $itemAmt of $actualId on the GE.")
SystemLogger.logAI(this::class.java, "Offered $itemAmt of $actualId on the GE.")
Repository.sendNews(SERVER_GE_NAME + " just offered " + itemAmt + " " + ItemDefinition.forId(actualId).name.toLowerCase() + " on the GE.")
}
bot.bank.remove(Item(id, itemAmt))
@@ -24,6 +24,7 @@ import org.json.simple.JSONObject
import rs09.ServerConstants
import rs09.game.ai.AIRepository
import rs09.game.ai.pvmbots.CombatBotAssembler
import rs09.game.interaction.IntType
import rs09.game.interaction.InteractionListeners
import java.io.File
import java.io.FileReader
@@ -126,8 +127,9 @@ class Adventurer(val style: CombatStyle): Script() {
"Teak","Mahogany")
val resource = scriptAPI.getNearestNodeFromList(resources,true)
if(resource != null){
if(resource.name.contains("ocks")) InteractionListeners.run(resource.id,1,"mine",bot,resource)
else InteractionListeners.run(resource.id,1,"chop down",bot,resource)
if(resource.name.contains("ocks")) InteractionListeners.run(resource.id,
IntType.SCENERY,"mine",bot,resource)
else InteractionListeners.run(resource.id,IntType.SCENERY,"chop down",bot,resource)
}
}
}
@@ -11,6 +11,7 @@ import org.rs09.consts.Items
import rs09.game.ai.general.ScriptAPI
import rs09.game.ai.skillingbot.SkillingBotAssembler
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
import rs09.game.interaction.InteractionListeners
import api.*
@@ -56,7 +57,7 @@ class CoalMiner : Script() {
scriptAPI.walkTo(mine.randomLoc)
} else {
val rock = scriptAPI.getNearestNode("rocks",true)
rock?.let { InteractionListeners.run(rock.id, InteractionListener.SCENERY,"mine",bot,rock) }
rock?.let { InteractionListeners.run(rock.id, IntType.SCENERY,"mine",bot,rock) }
}
overlay!!.setAmount(amountInInventory(bot, Items.COAL_453) + coalAmount)
}
@@ -8,6 +8,7 @@ import core.game.node.item.Item
import core.game.world.map.zone.ZoneBorders
import org.rs09.consts.Items
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
import rs09.game.interaction.InteractionListeners
import rs09.tools.stringtools.colorize
@@ -43,7 +44,7 @@ class DraynorWillows : Script(){
val willowtree = scriptAPI.getNearestNode("willow", true)
bot.interfaceManager.close()
willowtree?.let { InteractionListeners.run(willowtree.id,
InteractionListener.SCENERY,"Chop down",bot,willowtree) }
IntType.SCENERY,"Chop down",bot,willowtree) }
if (bot.inventory.isFull)
state = State.BANKING
}
@@ -5,6 +5,7 @@ import core.game.world.map.zone.ZoneBorders
import rs09.game.ai.general.ScriptAPI
import rs09.game.ai.skillingbot.SkillingBotAssembler
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
import rs09.game.interaction.InteractionListeners
@@ -14,6 +14,7 @@ import org.rs09.consts.Items
import rs09.game.ai.AIPlayer
import rs09.game.ai.general.ScriptAPI
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
import rs09.game.interaction.InteractionListeners
import rs09.game.world.GameWorld
import kotlin.random.Random
@@ -74,7 +75,7 @@ class LobsterCatcher : Script() {
if(spot == null){
state = State.IDLE
} else {
InteractionListeners.run(spot.id,InteractionListener.NPC,"cage",bot,spot)
InteractionListeners.run(spot.id,IntType.NPC,"cage",bot,spot)
}
if(bot.inventory.isFull){
state = State.FIND_BANK
@@ -11,6 +11,7 @@ import org.rs09.consts.Items
import rs09.game.ai.general.ScriptAPI
import rs09.game.ai.skillingbot.SkillingBotAssembler
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
import rs09.game.interaction.InteractionListeners
@PlayerCompatible
@@ -40,7 +41,7 @@ class SeersMagicTrees : Script(){
State.CHOPPING -> {
val tree = scriptAPI.getNearestNode(1306,true)
bot.interfaceManager.close()
tree?.let { InteractionListeners.run(tree.id, InteractionListener.SCENERY,"Chop down",bot,tree) }
tree?.let { InteractionListeners.run(tree.id, IntType.SCENERY,"Chop down",bot,tree) }
if(bot.inventory.isFull){
state = State.FIND_BANK
}
@@ -10,6 +10,7 @@ import org.rs09.consts.Items
import rs09.game.ai.AIPlayer
import rs09.game.ai.general.ScriptAPI
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
import rs09.game.interaction.InteractionListeners
import kotlin.random.Random
@@ -117,7 +118,7 @@ class SharkCatcher : Script() {
if (Random.nextBoolean()) {
tick = 0
val spot = scriptAPI.getNearestNode(334, false)
spot?.let { InteractionListeners.run(spot.id, InteractionListener.NPC,"harpoon",bot,spot) }
spot?.let { InteractionListeners.run(spot.id, IntType.NPC,"harpoon",bot,spot) }
if(bot.inventory.isFull){
state = State.FIND_BANK
} else {
@@ -8,6 +8,7 @@ import org.rs09.consts.Items
import rs09.game.ai.general.GeneralBotCreator
import rs09.game.content.global.worldevents.shootingstar.ShootingStarPlugin
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
import rs09.game.interaction.InteractionListeners
class ShootingStarBot : Script() {
@@ -33,7 +34,7 @@ class ShootingStarBot : Script() {
}
State.MINING -> {
InteractionListeners.run(star.starObject.id, InteractionListener.SCENERY, "mine", bot, star.starObject)
InteractionListeners.run(star.starObject.id, IntType.SCENERY, "mine", bot, star.starObject)
}
State.TELEPORT_BACK -> {
@@ -7,6 +7,7 @@ import core.game.world.map.zone.ZoneBorders
import org.rs09.consts.Items
import rs09.game.ai.skillingbot.SkillingBotAssembler
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
import rs09.game.interaction.InteractionListeners
@PlayerCompatible
@@ -50,7 +51,7 @@ class VarrockEssenceMiner : Script(){
State.MINING -> {
val essence = scriptAPI.getNearestNode(2491,true)
essence?.let { InteractionListeners.run(essence.id, InteractionListener.SCENERY,"mine",bot,essence) }
essence?.let { InteractionListeners.run(essence.id, IntType.SCENERY,"mine",bot,essence) }
if(bot.inventory.isFull)
state = State.TO_BANK
}
@@ -1,28 +1,11 @@
package rs09.game.ai.pvmbots
import core.game.container.impl.EquipmentContainer
import core.game.node.entity.combat.CombatSpell
import core.game.node.entity.player.link.SpellBookManager
import core.game.node.entity.player.link.appearance.Gender
import core.game.node.item.Item
import rs09.game.world.GameWorld
import core.game.world.map.Location
import core.tools.RandomFunction
import rs09.game.ai.AIPlayer
import rs09.game.ai.minigamebots.pestcontrol.PestControlTestBot
import rs09.game.ai.minigamebots.pestcontrol.PestControlTestBot2
import core.game.node.entity.skill.Skills
import java.util.*
import java.util.concurrent.Executors
// import sun.util.resources.CalendarData;
class PvMBotsBuilder {
fun randomItem() {
var test: Item? = null
val tests = ArrayList<Item?>()
for (x in 0..9998) test = Item(x)
if (test!!.definition.equipId != 0) tests.add(test)
}
companion object {
var botsSpawned = 0
@@ -32,474 +15,6 @@ class PvMBotsBuilder {
return PvMBots(l)
}
fun createLowest(l: Location?): LowestBot {
botsSpawned++
return LowestBot(l)
}
fun createNoob(l: Location?): NoobBot {
botsSpawned++
return NoobBot(l)
}
fun createDragonKiller(l: Location?): DragonKiller {
botsSpawned++
return DragonKiller(l)
}
fun createGiantMoleBot(l: Location?): GiantMoleBot {
botsSpawned++
return GiantMoleBot(l)
}
fun generateGiantMoleBot(p: PvMBots) {
p.skills.setLevel(Skills.SLAYER, 99)
p.skills.setStaticLevel(Skills.SLAYER, 99)
p.skills.setLevel(Skills.STRENGTH, 99)
p.skills.setStaticLevel(Skills.STRENGTH, 99)
p.skills.setLevel(Skills.ATTACK, 99)
p.skills.setStaticLevel(Skills.ATTACK, 99)
p.skills.setStaticLevel(Skills.HITPOINTS, 99)
p.skills.setLevel(Skills.HITPOINTS, 99)
p.skills.setStaticLevel(Skills.DEFENCE, 99)
p.skills.setLevel(Skills.DEFENCE, 99)
p.skills.setStaticLevel(Skills.PRAYER, 99)
p.skills.setLevel(Skills.PRAYER, 99)
p.skills.updateCombatLevel()
p.appearance.sync()
p.equipment.replace(Item(4720), EquipmentContainer.SLOT_CHEST)
p.equipment.replace(Item(4722), EquipmentContainer.SLOT_LEGS)
p.equipment.replace(Item(4716), EquipmentContainer.SLOT_HAT)
p.equipment.replace(Item(4718), EquipmentContainer.SLOT_WEAPON)
p.equipment.replace(Item(-1), EquipmentContainer.SLOT_SHIELD)
p.inventory.add(Item(952))
p.inventory.add(Item(33))
}
fun generateMinLevels(p: PvMBots) {
//Slayer so they can attack all monsters
p.skills.setLevel(Skills.SLAYER, 99)
p.skills.setStaticLevel(Skills.SLAYER, 99)
val combatType = RandomFunction.getRandom(2)
p.skills.setLevel(Skills.HITPOINTS, 15)
p.skills.setStaticLevel(Skills.HITPOINTS, 15)
p.inventory.add(Item(329, 5))
when (combatType) {
0 -> {
buildArcherStats(p)
buildArcherEquipment(p)
}
1 -> {
buildMeleeStats(p)
buildMeleeEquipment(p)
}
2 -> {
buildMageStats(p)
buildMagicEquipment(p)
setupWizard(p)
}
else -> {
buildMeleeStats(p)
buildMeleeEquipment(p)
}
}
}
fun createDragonKiller(p: DragonKiller) {
p.skills.setLevel(Skills.SLAYER, 99)
p.skills.setStaticLevel(Skills.SLAYER, 99)
val combatType = RandomFunction.getRandom(2)
p.skills.setLevel(Skills.HITPOINTS, 55)
p.skills.setStaticLevel(Skills.HITPOINTS, 55)
when (combatType) {
0 -> {
buildDragonArcherStats(p)
buildDragonArcherEquipment(p)
}
1 -> {
buildDragonMeleeStats(p)
buildDragonMeleeEquipment(p)
}
else -> {
buildDragonMeleeStats(p)
buildDragonMeleeEquipment(p)
}
}
}
private fun buildMaxMeleeStats(p: AIPlayer) {
p.skills.setLevel(Skills.ATTACK, 99)
p.skills.setStaticLevel(Skills.ATTACK, 99)
p.skills.setLevel(Skills.STRENGTH, 99)
p.skills.setStaticLevel(Skills.STRENGTH, 99)
p.skills.setLevel(Skills.DEFENCE, 99)
p.skills.setStaticLevel(Skills.DEFENCE, 99)
p.skills.updateCombatLevel()
p.appearance.sync()
}
private fun buildMaxMeleeEquipment(p: AIPlayer) {
val helms = intArrayOf(
3751)
val shield = intArrayOf(
14767)
val platebody = intArrayOf(
11724)
val platelegs = intArrayOf(
11726)
val amulets = intArrayOf(
6585)
val boots = intArrayOf(
3105)
val cape = intArrayOf(
6570)
val gloves = intArrayOf(
7462)
val weapons2 = intArrayOf(
4151)
val arrows = intArrayOf(
892)
p.equipment.replace(Item(helms[RandomFunction.random(helms.size)]), EquipmentContainer.SLOT_HAT)
p.equipment.replace(Item(shield[RandomFunction.random(shield.size)]), EquipmentContainer.SLOT_SHIELD)
p.equipment.replace(Item(platebody[RandomFunction.random(platebody.size)]), EquipmentContainer.SLOT_CHEST)
p.equipment.replace(Item(platelegs[RandomFunction.random(platelegs.size)]), EquipmentContainer.SLOT_LEGS)
p.equipment.replace(Item(weapons2[RandomFunction.random(weapons2.size)]), EquipmentContainer.SLOT_WEAPON)
p.equipment.replace(Item(weapons2[RandomFunction.random(arrows.size)], 99999), EquipmentContainer.SLOT_ARROWS)
p.equipment.replace(Item(amulets[RandomFunction.random(amulets.size)]), EquipmentContainer.SLOT_AMULET)
p.equipment.replace(Item(boots[RandomFunction.random(boots.size)]), EquipmentContainer.SLOT_FEET)
p.equipment.replace(Item(cape[RandomFunction.random(cape.size)]), EquipmentContainer.SLOT_CAPE)
p.equipment.replace(Item(gloves[RandomFunction.random(gloves.size)]), EquipmentContainer.SLOT_HANDS)
}
fun createNoob(p: NoobBot) {
p.skills.setLevel(Skills.SLAYER, 99)
p.skills.setStaticLevel(Skills.SLAYER, 99)
val combatType = RandomFunction.getRandom(3)
p.skills.setLevel(Skills.HITPOINTS, 10 + RandomFunction.getRandom(10))
p.skills.setStaticLevel(Skills.HITPOINTS, 10 + RandomFunction.getRandom(10))
p.skills.setLevel(Skills.DEFENCE, 1 + RandomFunction.getRandom(9))
p.skills.setStaticLevel(Skills.DEFENCE, 1 + RandomFunction.getRandom(9))
p.inventory.add(Item(329, 5))
when (combatType) {
0 -> {
buildNoobArcherStats(p)
buildNoobArcherEquipment(p)
}
1 -> {
buildNoobMeleeStats(p)
buildNoobMeleeEquipment(p)
}
2 -> {
run {
buildNoobMageStats(p)
buildNoobMagicEquipment(p)
setupWizard(p)
}
run {
buildNoobMeleeStats(p)
buildNoobMeleeEquipment(p)
}
}
else -> {
buildNoobMeleeStats(p)
buildNoobMeleeEquipment(p)
}
}
}
private fun buildArcherStats(p: PvMBots) {
p.skills.setLevel(Skills.RANGE, 10)
p.skills.setStaticLevel(Skills.RANGE, 10)
p.skills.setLevel(Skills.DEFENCE, 10)
p.skills.setStaticLevel(Skills.DEFENCE, 10)
p.skills.updateCombatLevel()
p.appearance.sync()
}
private fun buildDragonArcherStats(p: DragonKiller) {
p.skills.setStaticLevel(Skills.RANGE, 55 + RandomFunction.getRandom(15))
p.skills.setLevel(Skills.RANGE, p.skills.getLevel(Skills.RANGE))
p.skills.updateCombatLevel()
p.appearance.sync()
}
private fun buildNoobArcherStats(p: NoobBot) {
p.skills.setLevel(Skills.RANGE, 1 + RandomFunction.getRandom(10))
p.skills.setStaticLevel(Skills.RANGE, 1 + RandomFunction.getRandom(10))
p.skills.updateCombatLevel()
p.appearance.sync()
}
fun buildMeleeStats(p: PvMBots) {
p.skills.setLevel(Skills.ATTACK, 10)
p.skills.setStaticLevel(Skills.ATTACK, 10)
p.skills.setLevel(Skills.STRENGTH, 10)
p.skills.setStaticLevel(Skills.STRENGTH, 10)
p.skills.setLevel(Skills.DEFENCE, 10)
p.skills.setStaticLevel(Skills.DEFENCE, 10)
p.skills.updateCombatLevel()
p.appearance.sync()
}
fun buildDragonMeleeStats(p: DragonKiller) {
p.skills.setStaticLevel(Skills.ATTACK, 55 + RandomFunction.getRandom(15))
p.skills.setLevel(Skills.ATTACK, p.skills.getLevel(Skills.ATTACK))
p.skills.setStaticLevel(Skills.STRENGTH, 55 + RandomFunction.getRandom(15))
p.skills.setLevel(Skills.STRENGTH, p.skills.getLevel(Skills.STRENGTH))
p.skills.setLevel(Skills.DEFENCE, 45 + RandomFunction.getRandom(15))
p.skills.setLevel(Skills.DEFENCE, p.skills.getLevel(Skills.DEFENCE))
p.skills.updateCombatLevel()
p.appearance.sync()
}
private fun buildNoobMeleeStats(p: NoobBot) {
p.skills.setLevel(Skills.ATTACK, 1 + RandomFunction.getRandom(10))
p.skills.setStaticLevel(Skills.ATTACK, 1 + RandomFunction.getRandom(10))
p.skills.setLevel(Skills.STRENGTH, 1 + RandomFunction.getRandom(10))
p.skills.setStaticLevel(Skills.STRENGTH, 1 + RandomFunction.getRandom(10))
p.skills.updateCombatLevel()
p.appearance.sync()
}
private fun buildMageStats(p: PvMBots) {
p.skills.setLevel(Skills.MAGIC, 10)
p.skills.setStaticLevel(Skills.MAGIC, 10)
p.skills.setLevel(Skills.DEFENCE, 10)
p.skills.setStaticLevel(Skills.DEFENCE, 10)
p.skills.updateCombatLevel()
p.appearance.sync()
}
private fun buildNoobMageStats(p: NoobBot) {
p.skills.setLevel(Skills.MAGIC, 1 + RandomFunction.getRandom(10))
p.skills.setStaticLevel(Skills.MAGIC, 1 + RandomFunction.getRandom(10))
p.skills.updateCombatLevel()
p.appearance.sync()
}
private fun setupWizard(p: PvMBots) {
//final int SPELL_IDS[] = new int[] {1, 4, 6, 8, 10, 14, 17, 20, 24, 27, 33, 38, 45, 48, 52, 55 };
p.properties.autocastSpell = SpellBookManager.SpellBook.MODERN.getSpell(1) as CombatSpell
p.inventory.add(Item(556, 1000)) //Air runes
p.inventory.add(Item(558, 1000)) //Mind runes
}
private fun buildArcherEquipment(p: PvMBots) {
p.equipment.replace(Item(1169), EquipmentContainer.SLOT_HAT)
p.equipment.replace(Item(1129), EquipmentContainer.SLOT_CHEST)
p.equipment.replace(Item(1095), EquipmentContainer.SLOT_LEGS)
p.equipment.replace(Item(841), EquipmentContainer.SLOT_WEAPON)
p.equipment.replace(Item(884, 5000), EquipmentContainer.SLOT_ARROWS)
p.equipment.replace(Item(1007), EquipmentContainer.SLOT_CAPE)
p.equipment.replace(Item(1478), EquipmentContainer.SLOT_AMULET)
}
private fun buildDragonArcherEquipment(p: DragonKiller) {
p.equipment.replace(Item(1169), EquipmentContainer.SLOT_HAT)
p.equipment.replace(Item(13483), EquipmentContainer.SLOT_CHEST)
p.equipment.replace(Item(1099), EquipmentContainer.SLOT_LEGS)
p.equipment.replace(Item(9185), EquipmentContainer.SLOT_WEAPON)
p.equipment.replace(Item(1540), EquipmentContainer.SLOT_SHIELD)
p.equipment.replace(Item(9140, 500), EquipmentContainer.SLOT_ARROWS)
p.equipment.replace(Item(10498), EquipmentContainer.SLOT_CAPE)
p.equipment.replace(Item(1478), EquipmentContainer.SLOT_AMULET)
}
private fun buildNoobArcherEquipment(p: PvMBots) {
val hats = intArrayOf(1169, 1169, 1139, 1137, 1153, 579)
val legs = intArrayOf(1095, 7366, 1075, 1087, 1095)
val chest = intArrayOf(1129, 1103, 1101, 1129, 1117, 577)
p.equipment.replace(Item(hats[RandomFunction.getRandom(hats.size - 1)]), EquipmentContainer.SLOT_HAT)
p.equipment.replace(Item(chest[RandomFunction.getRandom(chest.size - 1)]), EquipmentContainer.SLOT_CHEST)
p.equipment.replace(Item(legs[RandomFunction.getRandom(legs.size - 1)]), EquipmentContainer.SLOT_LEGS)
p.equipment.replace(Item(841), EquipmentContainer.SLOT_WEAPON)
p.equipment.replace(Item(884, 5000), EquipmentContainer.SLOT_ARROWS)
p.equipment.replace(Item(1007), EquipmentContainer.SLOT_CAPE)
p.equipment.replace(Item(1478), EquipmentContainer.SLOT_AMULET)
}
private fun buildMeleeEquipment(p: PvMBots) {
p.equipment.replace(Item(1153), EquipmentContainer.SLOT_HAT)
p.equipment.replace(Item(1115), EquipmentContainer.SLOT_CHEST)
p.equipment.replace(Item(1067), EquipmentContainer.SLOT_LEGS)
p.equipment.replace(Item(1309), EquipmentContainer.SLOT_WEAPON)
p.equipment.replace(Item(884), EquipmentContainer.SLOT_ARROWS)
p.equipment.replace(Item(1007), EquipmentContainer.SLOT_CAPE)
p.equipment.replace(Item(1725), EquipmentContainer.SLOT_AMULET)
}
private fun buildDragonMeleeEquipment(p: DragonKiller) {
p.equipment.replace(Item(1163), EquipmentContainer.SLOT_HAT)
p.equipment.replace(Item(1127), EquipmentContainer.SLOT_CHEST)
p.equipment.replace(Item(1079), EquipmentContainer.SLOT_LEGS)
p.equipment.replace(Item(1333), EquipmentContainer.SLOT_WEAPON)
p.equipment.replace(Item(1540), EquipmentContainer.SLOT_SHIELD)
p.equipment.replace(Item(1007), EquipmentContainer.SLOT_CAPE)
p.equipment.replace(Item(1725), EquipmentContainer.SLOT_AMULET)
}
private fun buildNoobMeleeEquipment(p: PvMBots) {
val hats = intArrayOf(1169, 1169, 1139, 1137, 1153, 579)
val legs = intArrayOf(1095, 7366, 1075, 1087, 1095)
val chest = intArrayOf(1129, 1103, 1101, 1129, 1117, 577)
val weapons = intArrayOf(1307, 1321, 1375, 1203, 1239, 1267, 1293, 1323, 1335)
p.equipment.replace(Item(hats[RandomFunction.getRandom(hats.size - 1)]), EquipmentContainer.SLOT_HAT)
p.equipment.replace(Item(chest[RandomFunction.getRandom(chest.size - 1)]), EquipmentContainer.SLOT_CHEST)
p.equipment.replace(Item(legs[RandomFunction.getRandom(legs.size - 1)]), EquipmentContainer.SLOT_LEGS)
p.equipment.replace(Item(weapons[RandomFunction.getRandom(weapons.size - 1)]), EquipmentContainer.SLOT_WEAPON)
p.equipment.replace(Item(884), EquipmentContainer.SLOT_ARROWS)
p.equipment.replace(Item(1007), EquipmentContainer.SLOT_CAPE)
p.equipment.replace(Item(1725), EquipmentContainer.SLOT_AMULET)
}
private fun buildMagicEquipment(p: PvMBots) {
p.equipment.replace(Item(579), EquipmentContainer.SLOT_HAT)
p.equipment.replace(Item(577), EquipmentContainer.SLOT_CHEST)
p.equipment.replace(Item(1011), EquipmentContainer.SLOT_LEGS)
p.equipment.replace(Item(1389), EquipmentContainer.SLOT_WEAPON)
p.equipment.replace(Item(884), EquipmentContainer.SLOT_ARROWS)
p.equipment.replace(Item(1007), EquipmentContainer.SLOT_CAPE)
p.equipment.replace(Item(1727), EquipmentContainer.SLOT_AMULET)
}
private fun buildNoobMagicEquipment(p: PvMBots) {
val hats = intArrayOf(1169, 1169, 1139, 1137, 1153, 579)
val legs = intArrayOf(1095, 7366, 1075, 1087, 1095)
val chest = intArrayOf(1129, 1103, 1101, 1129, 1117, 577)
val weapons = intArrayOf(1379, 1383, 1385, 1387, 1389)
p.equipment.replace(Item(hats[RandomFunction.getRandom(hats.size - 1)]), EquipmentContainer.SLOT_HAT)
p.equipment.replace(Item(chest[RandomFunction.getRandom(chest.size - 1)]), EquipmentContainer.SLOT_CHEST)
p.equipment.replace(Item(legs[RandomFunction.getRandom(legs.size - 1)]), EquipmentContainer.SLOT_LEGS)
p.equipment.replace(Item(weapons[RandomFunction.getRandom(weapons.size - 1)]), EquipmentContainer.SLOT_WEAPON)
p.equipment.replace(Item(884), EquipmentContainer.SLOT_ARROWS)
p.equipment.replace(Item(1007), EquipmentContainer.SLOT_CAPE)
p.equipment.replace(Item(1727), EquipmentContainer.SLOT_AMULET)
}
fun spawn(loc: Location?) {
val bot = create(loc)
bot.appearance.gender = if (RandomFunction.random(3) == 1) Gender.FEMALE else Gender.MALE
}
fun spawnLowest(loc: Location?) {
val bot = createLowest(loc)
generateMinLevels(bot)
}
fun spawnNoob(loc: Location?) {
val bot = createNoob(loc)
createNoob(bot)
}
fun spawnDragonKiller(loc: Location?) {
val bot = createDragonKiller(loc)
bot.appearance.gender = if (RandomFunction.random(3) == 1) Gender.FEMALE else Gender.MALE
createDragonKiller(bot)
}
fun spawnGiantMoleBot(loc: Location?) {
val bot = createGiantMoleBot(Location(0, 0))
bot.teleport(loc)
bot.appearance.gender = if (RandomFunction.random(3) == 1) Gender.FEMALE else Gender.MALE
generateGiantMoleBot(bot)
}
@JvmStatic
fun immersiveSpawns() {
Executors.newSingleThreadExecutor().execute {
/*//Lumbridge
//GOBLINS
spawnLowest(new Location(3259, 3224));
spawnLowest(new Location(3251, 3235));
spawnLowest(new Location(3244, 3247));
spawnNoob(new Location(3244, 3247));
//COWS
spawnLowest(new Location(3259, 3245));
spawnLowest(new Location(3258, 3261));
spawnLowest(new Location(3263, 3263));
spawnLowest(new Location(3263, 3271));
spawnLowest(new Location(3254, 3288));
//CHICKENS
spawnLowest(new Location(3234, 3294));
spawnLowest(new Location(3229, 3297));
//GOBLINS2
spawnLowest(new Location(3182, 3255));
spawnLowest(new Location(3169, 3254));
spawnLowest(new Location(3167, 3233));
spawnLowest(new Location(3152, 3228));*/
//Lumby castle
spawnLowest(Location(3221, 3219))
/* spawnNoob(new Location(3193, 3208));
//Lumby swamp
spawnNoob(new Location(3224, 3186));
spawnNoob(new Location(3217, 3177));
spawnNoob(new Location(3209, 3191));
//Edge
spawnLowest(new Location(3096, 3509));
//Edge dungeon
//Hill giants
spawnLowest(new Location(3118, 9848));
spawnLowest(new Location(3110, 9842));
spawnLowest(new Location(3115, 9836));
spawnLowest(new Location(3107, 9832));
spawnLowest(new Location(3099, 9834));
//brass key room
spawnLowest(new Location(3127, 9863));
//Dark wizzards
spawnLowest(new Location(3226, 3367));
spawnLowest(new Location(3226, 3368));
spawnLowest(new Location(3230, 3373));
spawnLowest(new Location(3209, 3378));
//Varrock palace
spawnLowest(new Location(3218, 3465));
spawnLowest(new Location(3209, 3462));
//Varrock Sewers
spawnLowest(new Location(3235, 9868));
spawnLowest(new Location(3242, 9915));
spawnLowest(new Location(3176, 9883));
//Dragons Wilderness
//WEST
spawnDragonKiller(new Location(2977, 3614));
spawnDragonKiller(new Location(2987, 3619));
//Burthrope Dungeon
//Blue dragons
spawnDragonKiller(new Location(2901, 9799));
spawnDragonKiller(new Location(2910, 9804));
//Al kharid
//palace
spawnLowest(new Location(3301, 3173));
spawnNoob(new Location(3293, 3170));
spawnNoob(new Location(3286, 3171));
spawnNoob(new Location(3289, 3169));
//Slayer Tower
spawnLowest(new Location(3412, 3173));
spawnNoob(new Location(3412, 3539));
spawnNoob(new Location(3420, 3545));
spawnNoob(new Location(3420, 3545));
spawnNoob(new Location(3420, 3558));
spawnNoob(new Location(3433, 3571));
//Replace with something like rune bots
spawnDragonKiller(new Location(3437, 3562, 1));
spawnDragonKiller(new Location(3437, 3562, 1));
spawnDragonKiller(new Location(3437, 3562, 1));
//Bloodvelds
spawnDragonKiller(new Location(3417, 3561, 1));
spawnDragonKiller(new Location(3417, 3561, 1));
spawnDragonKiller(new Location(3417, 3561, 1));
//Brimhaven dragons
spawnDragonKiller(new Location(2704, 9450));
spawnDragonKiller(new Location(2704, 9450));*/println("[" + GameWorld.settings?.name + "]: PvMBotsBuilder: Spawned " + botsSpawned + " bots.")
}
}
@JvmStatic
fun createPestControlTestBot2(l: Location?): PestControlTestBot2 {
botsSpawned++
@@ -29,7 +29,7 @@ enum class AFUBeacon(val title: String, val fmLevel: Int, val varpId: Int, val o
for (beacon in values()) {
if (beacon.location.equals(location)) return beacon
}
return RIVER_SALVE.also { SystemLogger.logWarn("Unhandled Beacon Location ${location.toString()}") }
return RIVER_SALVE.also { SystemLogger.logWarn(this::class.java, "Unhandled Beacon Location ${location.toString()}") }
}
fun resetAllBeacons(player: Player){
@@ -9,6 +9,7 @@ import core.game.system.task.Pulse
import core.game.world.update.flag.context.Animation
import org.rs09.consts.Items
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
import rs09.game.world.GameWorld
private val VALID_LOGS = intArrayOf(Items.LOGS_1511, Items.OAK_LOGS_1521,Items.WILLOW_LOGS_1519,Items.MAPLE_LOGS_1517,Items.YEW_LOGS_1515,Items.MAGIC_LOGS_1513)
@@ -22,7 +23,7 @@ private val LIGHT_ANIM = Animation(7307)
class AFUBeaconListeners : InteractionListener{
override fun defineListeners() {
on(SCENERY,"add-logs","light"){ player, node ->
on(IntType.SCENERY,"add-logs","light"){ player, node ->
val beacon = AFUBeacon.forLocation(node.location)
val questComplete = player.questRepository.isComplete("All Fired Up")
val questStage = player.questRepository.getStage("All Fired Up")
@@ -10,6 +10,7 @@ import core.game.world.map.Location
import core.game.world.update.flag.context.Animation
import org.rs09.consts.Items
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
import java.util.*
/**
@@ -19,18 +20,18 @@ import java.util.*
class AFURepairClimbHandler : InteractionListener {
val repairIDs = intArrayOf(38480,38470,38494)
val climbIDs = intArrayOf(38469,38471,38486,38481,38469)
val climbIDs = intArrayOf(38469,38471,38486,38481)
override fun defineListeners() {
on(repairIDs,SCENERY,"repair"){ player, _ ->
on(repairIDs, IntType.SCENERY, "repair"){ player, _ ->
var rco: RepairClimbObject = RepairClimbObject.GWD
for(ent in RepairClimbObject.values()) if(ent.destinationDown?.withinDistance(player.location,2) == true || ent.destinationUp?.withinDistance(player.location,2) == true) rco = ent
repair(player,rco)
return@on true
}
on(climbIDs,SCENERY,"climb"){ player, node ->
on(climbIDs, IntType.SCENERY, "climb"){ player, node ->
var rco: RepairClimbObject = RepairClimbObject.GWD
for(ent in RepairClimbObject.values()) if(ent.destinationDown?.withinDistance(player.location,2) == true || ent.destinationUp?.withinDistance(player.location,2) == true) rco = ent
climb(player,rco,node.location)
@@ -7,6 +7,7 @@ import core.game.node.item.Item
import core.game.node.entity.skill.smithing.smelting.Bar
import core.game.system.task.Pulse
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
import core.game.world.map.Location
import org.rs09.consts.Items
import rs09.game.node.entity.npc.BFOreVariant
@@ -59,7 +60,7 @@ class BlastFurnaceListeners : InteractionListener {
/**FINALLY AFK STRENGTH TRAINING*/
on(pump, SCENERY, "operate") { player, node ->
on(pump, IntType.SCENERY, "operate") { player, node ->
if(player.getSkills().getLevel(Skills.STRENGTH) >= 30) {
val pumpL = Location(1950, 4961, 0)
val pumpF = Location(1949, 4961, 0)
@@ -91,7 +92,7 @@ class BlastFurnaceListeners : InteractionListener {
/**Logic for the pedals that run the conveyor, rewards Agility XP every tick that they're being
* pedaled but will stop once the conveyor breaks.*/
on(pedals, SCENERY, "pedal") { player, node ->
on(pedals, IntType.SCENERY, "pedal") { player, node ->
if(player.getSkills().getLevel(Skills.AGILITY) >= 30) {
val pedalL = Location(1947, 4966, 0)
val pedalF = Location(1946, 4966, 0)
@@ -117,7 +118,7 @@ class BlastFurnaceListeners : InteractionListener {
/**Lets players use a spade to take coke from the pile of coke*/
on(coke, SCENERY, "collect") { player, node ->
on(coke, IntType.SCENERY, "collect") { player, node ->
if (inInventory(player, Items.SPADE_952, 1)) {
animate(player, 2441)
removeItem(player, Items.SPADE_952, Container.INVENTORY)
@@ -133,7 +134,7 @@ class BlastFurnaceListeners : InteractionListener {
* and rewards firemaking XP when shoving coke in there, it will not allow players to shovel more
* coke in if it is already full.*/
on(stove, SCENERY,"refuel") { player, node ->
on(stove, IntType.SCENERY, "refuel") { player, node ->
if (inInventory(player, Items.SPADEFUL_OF_COKE_6448, 1) && BlastFurnace.stoveCoke < 30 && player.getSkills().getLevel(Skills.FIREMAKING) >= 30) {
animate(player, 2442)
lockInteractions(player,2)
@@ -164,7 +165,7 @@ class BlastFurnaceListeners : InteractionListener {
* smelt your ores because it's waiting for a player attribute to be set by the ore NPCs that this spawns
* Is it fucky? Yes
* Does it work? Also yes*/
on(conveyorLoad, SCENERY, "put-ore-on") { player, node ->
on(conveyorLoad, IntType.SCENERY, "put-ore-on") { player, node ->
val rocksInInven = playerOre.filter {inInventory(player, it)}
var oreToActuallyAdd = 0
var coalToActuallyAdd = 0
@@ -230,7 +231,7 @@ class BlastFurnaceListeners : InteractionListener {
/**Added this because clicking on ore then the belt and getting "Nothing interesting happens" is annoying
* it's essentially the same thing as above except without the dialogue because if you're clicking on ore
* and trying to use it on the conveyor belt then you know what you're trying to do.*/
onUseWith(SCENERY,conveyorLoad,*playerOre){ player, _, oreType ->
onUseWith(IntType.SCENERY,conveyorLoad,*playerOre){ player, _, oreType ->
val amountInInventory = player.inventory.getAmount(oreType.id)
val spaceForCoal = player.blastCoal.freeSlots()
val spaceForOre = player.blastOre.freeSlots()
@@ -282,14 +283,14 @@ class BlastFurnaceListeners : InteractionListener {
/**This handles interacting with the temperature gauge on the furnace*/
on(tGauge, SCENERY, "read") { player, node ->
on(tGauge, IntType.SCENERY, "read") { player, node ->
player.interfaceManager.openComponent(30)
return@on true
}
/**This handles taking bars from the dispenser*/
on(dispenser,SCENERY,"search", "take"){ player, node ->
on(dispenser, IntType.SCENERY, "search", "take"){ player, node ->
if(player.varpManager.get(543).getVarbitValue(8) == 0 || player.varpManager.get(543).getVarbitValue(8) == 3) {
player.interfaceManager.openComponent(28)
}
@@ -298,7 +299,7 @@ class BlastFurnaceListeners : InteractionListener {
/**Handles using a bucket of water on the bar dispenser*/
onUseWith(SCENERY,dispenser,Items.BUCKET_OF_WATER_1929){ player, used, with ->
onUseWith(IntType.SCENERY,dispenser,Items.BUCKET_OF_WATER_1929){ player, used, with ->
when {
player.varpManager.get(543).getVarbitValue(8) == 2 -> {
removeItem(player,Items.BUCKET_OF_WATER_1929,Container.INVENTORY)
@@ -321,7 +322,7 @@ class BlastFurnaceListeners : InteractionListener {
/**The sequel to Limp Bizkits hit single, "Fix shit"*/
on(brokenPotPipe,SCENERY,"repair"){ player, _ ->
on(brokenPotPipe, IntType.SCENERY, "repair"){ player, _ ->
if(player.getSkills().getLevel(Skills.CRAFTING) >= 30){
if(inInventory(player,Items.HAMMER_2347,1)) {
rewardXP(player, Skills.CRAFTING, 50.0)
@@ -336,7 +337,7 @@ class BlastFurnaceListeners : InteractionListener {
return@on true
}
on(brokenPumpPipe,SCENERY, "repair"){ player, _ ->
on(brokenPumpPipe, IntType.SCENERY, "repair"){ player, _ ->
if(player.getSkills().getLevel(Skills.CRAFTING) >= 30){
if(inInventory(player,Items.HAMMER_2347,1)) {
rewardXP(player, Skills.CRAFTING, 50.0)
@@ -351,7 +352,7 @@ class BlastFurnaceListeners : InteractionListener {
return@on true
}
on(brokenBelt,SCENERY,"repair"){ player, _ ->
on(brokenBelt, IntType.SCENERY, "repair"){ player, _ ->
if(player.getSkills().getLevel(Skills.CRAFTING) >= 30){
if(inInventory(player,Items.HAMMER_2347,1)) {
rewardXP(player, Skills.CRAFTING, 50.0)
@@ -366,7 +367,7 @@ class BlastFurnaceListeners : InteractionListener {
return@on true
}
on(brokenCog,SCENERY,"repair"){ player, _ ->
on(brokenCog, IntType.SCENERY, "repair"){ player, _ ->
if(player.getSkills().getLevel(Skills.CRAFTING) >= 30){
if(inInventory(player,Items.HAMMER_2347,1)) {
rewardXP(player, Skills.CRAFTING, 50.0)
@@ -13,6 +13,7 @@ import core.game.world.update.flag.context.Animation
import core.plugin.Initializable
import org.rs09.consts.Items
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
import rs09.game.node.entity.player.info.stats.FISHING_TRAWLER_LEAKS_PATCHED
import rs09.game.node.entity.player.info.stats.STATS_BASE
import rs09.tools.stringtools.colorize
@@ -34,7 +35,7 @@ class FishingTrawlerInteractionHandler : InteractionListener {
override fun defineListeners() {
on(ENTRANCE_PLANK,SCENERY,"cross"){ player, _ ->
on(ENTRANCE_PLANK, IntType.SCENERY, "cross"){ player, _ ->
if(player.skills.getLevel(Skills.FISHING) < 15){
player.dialogueInterpreter.sendDialogue("You need to be at least level 15 fishing to play.")
return@on true
@@ -44,7 +45,7 @@ class FishingTrawlerInteractionHandler : InteractionListener {
return@on true
}
on(EXIT_PLANK,SCENERY,"cross"){ player, _ ->
on(EXIT_PLANK, IntType.SCENERY, "cross"){ player, _ ->
player.properties.teleportLocation = Location.create(2676, 3170, 0)
(ActivityManager.getActivity("fishing trawler") as FishingTrawlerActivity).removePlayer(player)
val session: FishingTrawlerSession? = player.getAttribute("ft-session",null)
@@ -52,7 +53,7 @@ class FishingTrawlerInteractionHandler : InteractionListener {
return@on true
}
on(HOLE,SCENERY,"fill"){ player, node ->
on(HOLE, IntType.SCENERY, "fill"){ player, node ->
val session: FishingTrawlerSession? = player.getAttribute("ft-session",null)
session ?: return@on false
player.lock()
@@ -70,12 +71,12 @@ class FishingTrawlerInteractionHandler : InteractionListener {
return@on true
}
on(NETIDs,SCENERY,"inspect"){ player, _ ->
on(NETIDs, IntType.SCENERY, "inspect"){ player, _ ->
player.dialogueInterpreter.open(18237583)
return@on true
}
on(REWARD_NET,SCENERY,"inspect"){ player, _ ->
on(REWARD_NET, IntType.SCENERY, "inspect"){ player, _ ->
val session: FishingTrawlerSession? = player.getAttribute("ft-session",null)
if(session == null || session.boatSank){
player.dialogueInterpreter.sendDialogues(player, FacialExpression.GUILTY,"I'd better not go stealing other people's fish.")
@@ -85,7 +86,7 @@ class FishingTrawlerInteractionHandler : InteractionListener {
return@on true
}
on(BARREL_IDS,SCENERY,"climb-on"){ player, _ ->
on(BARREL_IDS, IntType.SCENERY, "climb-on"){ player, _ ->
player.properties.teleportLocation = Location.create(2672, 3222, 0)
player.dialogueInterpreter.sendDialogue("You climb onto the floating barrel and begin to kick your way to the","shore.","You make it to the shore tired and weary.")
player.appearance.setDefaultAnimations()
@@ -93,7 +94,7 @@ class FishingTrawlerInteractionHandler : InteractionListener {
return@on true
}
on(FULL_BAIL_BUCKET,ITEM,"empty"){player,node ->
on(FULL_BAIL_BUCKET, IntType.ITEM, "empty"){player,node ->
player.lock()
player.pulseManager.run(
object : Pulse(){
@@ -115,7 +116,7 @@ class FishingTrawlerInteractionHandler : InteractionListener {
return@on true
}
on(BAILING_BUCKET,ITEM,"bail-with") { player, node ->
on(BAILING_BUCKET, IntType.ITEM, "bail-with") { player, node ->
val session: FishingTrawlerSession? = player.getAttribute("ft-session",null)
session ?: return@on false
if(!session.isActive){
@@ -295,11 +295,11 @@ class FishingTrawlerSession(val activity: FishingTrawlerActivity? = null) : Logo
override fun areaEnter(entity: Entity) {
super.areaEnter(entity)
SystemLogger.logInfo("ENTERED FTZ")
SystemLogger.logInfo(this::class.java, "ENTERED FTZ")
}
override fun areaLeave(entity: Entity, logout: Boolean) {
super.areaLeave(entity, logout)
SystemLogger.logInfo("EXITED FTZ")
SystemLogger.logInfo(this::class.java, "EXITED FTZ")
}
}
@@ -8,6 +8,7 @@ import org.rs09.consts.Items
import org.rs09.consts.Scenery
import rs09.game.content.dialogue.region.craftingguild.TheDoorDialogues
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
/**
* @author bushtail
@@ -19,7 +20,7 @@ class CraftingGuildListeners : InteractionListener {
private val CAPE = Items.CRAFTING_CAPE_9780
override fun defineListeners() {
on(GUILD_DOOR, SCENERY, "open") { player, door ->
on(GUILD_DOOR, IntType.SCENERY, "open") { player, door ->
if (player.location == Location.create(2933, 3289, 0)) {
if (hasLevelStat(player, Skills.CRAFTING, 40)) {
if (inEquipment(player, APRON)) {
@@ -8,16 +8,17 @@ import core.game.world.update.flag.context.Graphics
import org.rs09.consts.Items
import org.rs09.consts.NPCs
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
import rs09.game.node.entity.skill.magic.SpellListener
import rs09.game.node.entity.skill.magic.spellconsts.Modern
class MTAListeners : InteractionListener {
override fun defineListeners() {
on(NPCs.MAZE_GUARDIAN_3102,NPC,"talk-to"){player,node ->
on(NPCs.MAZE_GUARDIAN_3102, IntType.NPC, "talk-to"){player,node ->
player.dialogueInterpreter.open(node.id, node)
return@on true
}
setDest(NPC, intArrayOf(NPCs.MAZE_GUARDIAN_3102), "talk-to") { player, node ->
setDest(IntType.NPC, intArrayOf(NPCs.MAZE_GUARDIAN_3102), "talk-to") { player, node ->
return@setDest node.location.transform(Direction.getDirection(player.location, node.location), -1);
}
}
@@ -15,6 +15,7 @@ import core.game.world.update.flag.context.Graphics
import org.rs09.consts.Items
import rs09.game.content.dialogue.DialogueFile
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
import rs09.tools.END_DIALOGUE
/**
@@ -25,7 +26,7 @@ class PharaohSceptre : InteractionListener {
override fun defineListeners() {
val SCEPTRES = intArrayOf(Items.PHARAOHS_SCEPTRE_9044, Items.PHARAOHS_SCEPTRE_9046, Items.PHARAOHS_SCEPTRE_9048, Items.PHARAOHS_SCEPTRE_9050)
on(SCEPTRES, ITEM, "teleport", "operate"){player, node ->
on(SCEPTRES, IntType.ITEM, "teleport", "operate"){player, node ->
val sceptre = node.asItem()
if(sceptre.id == SCEPTRES.last())
@@ -16,6 +16,7 @@ import org.rs09.consts.NPCs
import org.rs09.consts.Scenery
import rs09.game.content.dialogue.DialogueFile
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
/**
@@ -58,7 +59,7 @@ class PyramidPlunderMinigame : InteractionListener, TickListener, LogoutListener
val ENTRANCES = intArrayOf(16484, 16487, 16490, 16493) //All Scenery.AN_ANONYMOUS_LOOKING_DOOR_16484/etc
val SARCOPHAGUS = Scenery.SARCOPHAGUS_16495
on(Scenery.SPEARTRAP_16517, SCENERY, "pass"){player, node ->
on(Scenery.SPEARTRAP_16517, IntType.SCENERY, "pass"){player, node ->
val anim = Animation(CHECK_ANIM)
val duration = animationDuration(anim)
@@ -108,7 +109,7 @@ class PyramidPlunderMinigame : InteractionListener, TickListener, LogoutListener
return@on true
}
on(intArrayOf(*SEALED_URNS, *SNAKE_URNS), SCENERY, "search") { player, node ->
on(intArrayOf(*SEALED_URNS, *SNAKE_URNS), IntType.SCENERY, "search") { player, node ->
animate(player, URN_CHECK)
player.faceLocation(node.location)
lock(player, 1)
@@ -131,7 +132,7 @@ class PyramidPlunderMinigame : InteractionListener, TickListener, LogoutListener
return@on true
}
on(SEALED_URNS, SCENERY, "check for snakes") { player, node ->
on(SEALED_URNS, IntType.SCENERY, "check for snakes") { player, node ->
val urn = node.asScenery()
animate(player, URN_CHECK)
player.faceLocation(node.location)
@@ -144,7 +145,7 @@ class PyramidPlunderMinigame : InteractionListener, TickListener, LogoutListener
return@on true
}
on(SNAKE_URNS, SCENERY, "charm snake") { player, node ->
on(SNAKE_URNS, IntType.SCENERY, "charm snake") { player, node ->
if(!inInventory(player, Items.SNAKE_CHARM_4605))
{
sendMessage(player, "You need a snake charm to charm a snake.")
@@ -160,7 +161,7 @@ class PyramidPlunderMinigame : InteractionListener, TickListener, LogoutListener
return@on true
}
on(CHARMED_SNAKES, SCENERY, "search") { player, node ->
on(CHARMED_SNAKES, IntType.SCENERY, "search") { player, node ->
animate(player, URN_CHECK)
player.faceLocation(node.location)
lock(player, 1)
@@ -183,12 +184,12 @@ class PyramidPlunderMinigame : InteractionListener, TickListener, LogoutListener
return@on true
}
on(OPEN_URNS, SCENERY, "search") { player, _ ->
on(OPEN_URNS, IntType.SCENERY, "search") { player, _ ->
sendMessage(player, "You've already looted this urn.")
return@on true
}
on(SARCOPHAGUS, SCENERY, "open") { player, node ->
on(SARCOPHAGUS, IntType.SCENERY, "open") { player, node ->
sendMessage(player, "You attempt to push open the massive lid.")
val strength = getDynLevel(player, Skills.STRENGTH)
animate(player, PUSH_LID_START)
@@ -220,7 +221,7 @@ class PyramidPlunderMinigame : InteractionListener, TickListener, LogoutListener
return@on true
}
on(Scenery.GRAND_GOLD_CHEST_16473, SCENERY, "search") { player, node ->
on(Scenery.GRAND_GOLD_CHEST_16473, IntType.SCENERY, "search") { player, node ->
animate(player, OPEN_CHEST_ANIM)
runTask(player){
if(RandomFunction.roll(25))
@@ -242,7 +243,7 @@ class PyramidPlunderMinigame : InteractionListener, TickListener, LogoutListener
return@on true
}
on(Scenery.TOMB_DOOR_16475, SCENERY, "pick-lock") { player, node ->
on(Scenery.TOMB_DOOR_16475, IntType.SCENERY, "pick-lock") { player, node ->
val anim = Animation(CHECK_ANIM)
val duration = animationDuration(anim)
@@ -286,7 +287,7 @@ class PyramidPlunderMinigame : InteractionListener, TickListener, LogoutListener
return@on true
}
on(Scenery.TOMB_DOOR_16458, SCENERY, "leave tomb") { player, _ ->
on(Scenery.TOMB_DOOR_16458, IntType.SCENERY, "leave tomb") { player, _ ->
openDialogue(player, object : DialogueFile()
{
override fun handle(componentID: Int, buttonID: Int) {
@@ -310,7 +311,7 @@ class PyramidPlunderMinigame : InteractionListener, TickListener, LogoutListener
return@on true
}
on(ENTRANCES, SCENERY, "search") { player, door ->
on(ENTRANCES, IntType.SCENERY, "search") { player, door ->
if(!getAttribute(player, "tarik-spoken-to", false))
{
sendDialogue(player, "I should probably try to find out more about this place before I try to break in.")
@@ -343,12 +344,12 @@ class PyramidPlunderMinigame : InteractionListener, TickListener, LogoutListener
return@on true
}
on(Scenery.TOMB_DOOR_16459, SCENERY, "leave tomb") { player, _ ->
on(Scenery.TOMB_DOOR_16459, IntType.SCENERY, "leave tomb") { player, _ ->
teleport(player, getAttribute(player, "pyramid-entrance", Location.create(3288, 2802, 0)))
return@on true
}
on(NPCs.GUARDIAN_MUMMY_4476, NPC, "start-minigame") { player, _ ->
on(NPCs.GUARDIAN_MUMMY_4476, IntType.NPC, "start-minigame") { player, _ ->
if(!getAttribute(player, "pp:mummy-spoken-to", false))
{
openDialogue(player, NPCs.GUARDIAN_MUMMY_4476)
@@ -44,6 +44,7 @@ import rs09.game.content.activity.vinesweeper.Vinesweeper.Companion.populateSeed
import rs09.game.content.activity.vinesweeper.Vinesweeper.Companion.scheduleNPCs
import rs09.game.content.activity.vinesweeper.Vinesweeper.Companion.sendPoints
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
import rs09.game.interaction.InterfaceListener
import rs09.game.world.GameWorld
import rs09.game.world.GameWorld.ticks
@@ -86,17 +87,17 @@ class Vinesweeper : InteractionListener, InterfaceListener, MapArea {
override fun defineListeners() {
populateSeeds()
on(Sceneries.PORTAL_29534, SCENERY, "enter") { player, _ ->
on(Sceneries.PORTAL_29534, IntType.SCENERY, "enter") { player, _ ->
val x = player.getAttribute("vinesweeper:return-tele:x", 3052)
val y = player.getAttribute("vinesweeper:return-tele:y", 3304)
teleport(player, Location(x, y))
return@on true
}
on(SIGNS, SCENERY, "read") { player, node ->
on(SIGNS, IntType.SCENERY, "read") { player, node ->
player.interfaceManager.open(Component(INSTRUCTION_SIGNS[node.id]!!))
return@on true
}
on(HOLES, SCENERY, "dig") { player, node ->
on(HOLES, IntType.SCENERY, "dig") { player, node ->
if(!player.inventory.contains(Items.SPADE_952, 1)) {
// TODO (crash): authenticity
player.sendMessage("You need a spade to dig here.")
@@ -106,12 +107,12 @@ class Vinesweeper : InteractionListener, InterfaceListener, MapArea {
}
return@on true
}
onUseWith(SCENERY,Items.SPADE_952,*HOLES) { player, _, with ->
onUseWith(IntType.SCENERY,Items.SPADE_952,*HOLES) { player, _, with ->
player.visualize(Animation(Animations.HUMAN_VINESWEEPER_DIG_8709), Graphics(Gfx.VINESWEEPER_DIRT_DIG_1543))
dig(player, with.location)
return@onUseWith true
}
on(HOLES, SCENERY, "flag") { player, node ->
on(HOLES, IntType.SCENERY, "flag") { player, node ->
val hole = node as Scenery
var count = 0
if(player.location != node.location) {
@@ -135,12 +136,12 @@ class Vinesweeper : InteractionListener, InterfaceListener, MapArea {
})
return@on true
}
onUseWith(SCENERY,Items.FLAG_12625,*HOLES) { player, _, with ->
onUseWith(IntType.SCENERY,Items.FLAG_12625,*HOLES) { player, _, with ->
val hole = with as Scenery
plantFlag(player,hole)
return@onUseWith true
}
on(HOLES, SCENERY, "inspect") { player, node ->
on(HOLES, IntType.SCENERY, "inspect") { player, node ->
player.animate(Animation(Animations.HUMAN_INSPECT_HOLE_8710))
player.lock(5)
GameWorld.Pulser.submit(object : Pulse(5) {
@@ -162,42 +163,42 @@ class Vinesweeper : InteractionListener, InterfaceListener, MapArea {
})
return@on true
}
on(NPCs.MRS_WINKIN_7132, NPC, "talk-to") { player, npc ->
on(NPCs.MRS_WINKIN_7132, IntType.NPC, "talk-to") { player, npc ->
openDialogue(player, WinkinDialogue(), npc)
return@on true
}
on(NPCs.MRS_WINKIN_7132, NPC, "trade") { player, _ ->
on(NPCs.MRS_WINKIN_7132, IntType.NPC, "trade") { player, _ ->
player.interfaceManager.open(Component(686))
return@on true
}
on(NPCs.MRS_WINKIN_7132, NPC, "buy flags") { player, npc ->
on(NPCs.MRS_WINKIN_7132, IntType.NPC, "buy flags") { player, npc ->
val dialogue = WinkinDialogue()
dialogue.stage = 20
openDialogue(player, dialogue, npc)
return@on true
}
on(RABBITS, NPC, "feed") { player, node ->
on(RABBITS, IntType.NPC, "feed") { player, node ->
val rabbit = node as NPC
feedRabbit(player,rabbit)
return@on true
}
onUseWith(NPC,Items.OGLEROOT_12624,*RABBITS) { player, _, with ->
onUseWith(IntType.NPC,Items.OGLEROOT_12624,*RABBITS) { player, _, with ->
val rabbit = with as NPC
feedRabbit(player,rabbit)
return@onUseWith true
}
on(NPCs.FARMER_BLINKIN_7131, NPC, "talk-to") { player, npc ->
on(NPCs.FARMER_BLINKIN_7131, IntType.NPC, "talk-to") { player, npc ->
//player.interfaceManager.open(Component(TUTORIAL))
openDialogue(player, BlinkinDialogue(), npc)
return@on true
}
on(NPCs.FARMER_BLINKIN_7131, NPC, "buy-flags") { player, npc ->
on(NPCs.FARMER_BLINKIN_7131, IntType.NPC, "buy-flags") { player, npc ->
val dialogue = BlinkinDialogue()
dialogue.stage = 21
openDialogue(player, dialogue, npc)
return@on true
}
on(NPCs.FARMER_BLINKIN_7131, NPC, "buy-roots") { player, npc ->
on(NPCs.FARMER_BLINKIN_7131, IntType.NPC, "buy-roots") { player, npc ->
val dialogue = BlinkinDialogue()
dialogue.stage = 40
openDialogue(player, dialogue, npc)
@@ -6,6 +6,7 @@ import core.game.content.activity.wguild.catapult.CatapultRoom
import core.game.node.item.Item
import org.rs09.consts.Items
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
class WGuildListeners : InteractionListener {
override fun defineListeners() {
@@ -59,7 +59,7 @@ class RandomEventManager(val player: Player? = null) : LoginListener, EventHook<
event = ame.npc.create(player,ame.loot,ame.type)
if (event!!.spawnLocation == null) {
nextSpawn = GameWorld.ticks + 3000
SystemLogger.logWarn("Tried to spawn random event for ${player.username} but spawn location was null!")
SystemLogger.logWarn(this::class.java, "Tried to spawn random event for ${player.username} but spawn location was null!")
return
}
event!!.init()
@@ -4,12 +4,13 @@ import core.game.node.entity.npc.NPC
import core.game.system.task.Pulse
import org.rs09.consts.NPCs
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
class DrillDemonListeners : InteractionListener {
val MATS = intArrayOf(10076,10077,10078,10079)
override fun defineListeners() {
on(MATS,SCENERY,"use"){ player, node ->
on(MATS, IntType.SCENERY, "use"){ player, node ->
val correctTask = player.getAttribute(DrillDemonUtils.DD_KEY_TASK,-1)
if(correctTask == -1){
player.sendMessage("You can't do that right now.")
@@ -7,6 +7,7 @@ import core.game.world.map.Location
import org.rs09.consts.Items
import org.rs09.consts.NPCs
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
import rs09.game.interaction.inter.ExperienceInterface
class SupriseExamListeners : InteractionListener {
@@ -14,14 +15,14 @@ class SupriseExamListeners : InteractionListener {
val BOOK_OF_KNOWLEDGE = Items.BOOK_OF_KNOWLEDGE_11640
override fun defineListeners() {
on(MORDAUT,NPC,"talk-to"){player, node ->
on(MORDAUT, IntType.NPC, "talk-to"){player, node ->
player.faceLocation(Location.create(1886, 5024, 0))
val examComplete = player.getAttribute(SurpriseExamUtils.SE_KEY_CORRECT,0) == 3
player.dialogueInterpreter.open(MordautDialogue(examComplete),node.asNpc())
return@on true
}
on(SurpriseExamUtils.SE_DOORS,SCENERY,"open"){ player, node ->
on(SurpriseExamUtils.SE_DOORS, IntType.SCENERY, "open"){ player, node ->
val correctDoor = player.getAttribute(SurpriseExamUtils.SE_DOOR_KEY,-1)
if(correctDoor == -1){
@@ -38,7 +39,7 @@ class SupriseExamListeners : InteractionListener {
return@on true
}
on(BOOK_OF_KNOWLEDGE,ITEM,"read"){player, _ ->
on(BOOK_OF_KNOWLEDGE, IntType.ITEM, "read"){player, _ ->
player.setAttribute("caller"){skill: Int,p: Player ->
if(p.inventory.remove(Item(BOOK_OF_KNOWLEDGE))) {
val level = p.skills.getStaticLevel(skill)
@@ -53,7 +54,7 @@ class SupriseExamListeners : InteractionListener {
}
override fun defineDestinationOverrides() {
setDest(NPC,MORDAUT){_,_ ->
setDest(IntType.NPC,MORDAUT){_,_ ->
return@setDest Location.create(1886, 5025, 0)
}
}
@@ -8,6 +8,7 @@ import org.rs09.consts.Animations
import org.rs09.consts.NPCs
import rs09.game.content.dialogue.DialogueFile
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
import rs09.tools.END_DIALOGUE
/**
@@ -16,7 +17,7 @@ import rs09.tools.END_DIALOGUE
class AlKharidHealListener : InteractionListener {
override fun defineListeners() {
on(getIds(), NPC, "heal") { player, node ->
on(getIds(), IntType.NPC, "heal") { player, node ->
openDialogue(player, AlKharidHealDialogue(false), node.asNpc())
return@on true
}
@@ -8,6 +8,7 @@ import org.rs09.consts.Items
import org.rs09.consts.NPCs
import rs09.game.content.dialogue.DialogueFile
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
import rs09.tools.END_DIALOGUE
/**
@@ -16,7 +17,7 @@ import rs09.tools.END_DIALOGUE
class AliTheLeafletDropperListener : InteractionListener {
override fun defineListeners() {
on(NPCs.ALI_THE_LEAFLET_DROPPER_3680, NPC, "Take-flyer") { player, node ->
on(NPCs.ALI_THE_LEAFLET_DROPPER_3680, IntType.NPC, "Take-flyer") { player, node ->
if(player.inventory.containItems(Items.AL_KHARID_FLYER_7922)) {
openDialogue(player, DropperDialogue(2), node as NPC)
} else {
@@ -8,6 +8,7 @@ import core.plugin.Initializable
import org.rs09.consts.NPCs
import rs09.game.content.dialogue.Topic
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
import rs09.tools.END_DIALOGUE
/**
@@ -61,7 +62,7 @@ class FadliDialogue(player: Player? = null) : DialoguePlugin(player) {
class FadliListener : InteractionListener {
override fun defineListeners() {
on(NPCs.FADLI_958, NPC, "buy") { player, node ->
on(NPCs.FADLI_958, IntType.NPC, "buy") { player, node ->
if(node.asNpc().openShop(player)) {
return@on true
}
@@ -7,6 +7,7 @@ import core.game.node.entity.player.Player
import core.plugin.Initializable
import org.rs09.consts.NPCs
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
import rs09.game.interaction.InteractionListeners
import rs09.tools.END_DIALOGUE
@@ -39,7 +40,7 @@ class TowerGuardDialogue(player: Player? = null) : DialoguePlugin(player) {
}
10 -> npcl(FacialExpression.NEUTRAL, "IF YOU LIKE!").also {
stage = END_DIALOGUE
InteractionListeners.run(NPCs.GUARD_5489, InteractionListener.NPC, "watch-shouting", player, npc)
InteractionListeners.run(NPCs.GUARD_5489, IntType.NPC, "watch-shouting", player, npc)
}
}
return true
@@ -7,6 +7,7 @@ import core.game.node.entity.player.link.IronmanMode
import org.rs09.consts.Components
import org.rs09.consts.NPCs
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
/**
* Handles special banking interactions for Eniola at ZMI altar area.
@@ -15,7 +16,7 @@ import rs09.game.interaction.InteractionListener
*/
class EniolaListener : InteractionListener {
override fun defineListeners() {
on(NPCs.ENIOLA_6362, NPC, "bank") { player, _ ->
on(NPCs.ENIOLA_6362, IntType.NPC, "bank") { player, _ ->
restrictForIronman(player, IronmanMode.ULTIMATE) {
setAttribute(player, "zmi:bankaction", "open")
openInterface(player, Components.BANK_CHARGE_ZMI_619)
@@ -24,7 +25,7 @@ class EniolaListener : InteractionListener {
return@on true
}
on(NPCs.ENIOLA_6362, NPC, "collect") { player, _ ->
on(NPCs.ENIOLA_6362, IntType.NPC, "collect") { player, _ ->
restrictForIronman(player, IronmanMode.ULTIMATE) {
setAttribute(player, "zmi:bankaction", "collect")
openInterface(player, Components.BANK_CHARGE_ZMI_619)
@@ -4,6 +4,7 @@ import api.openBankAccount
import api.openGrandExchangeCollectionBox
import org.rs09.consts.NPCs
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
/**
* Handles Emerald Benedict's only available interaction.
@@ -12,12 +13,12 @@ import rs09.game.interaction.InteractionListener
*/
class EmeraldBenedictListener : InteractionListener {
override fun defineListeners() {
on(NPCs.EMERALD_BENEDICT_2271, NPC, "bank") { player, _ ->
on(NPCs.EMERALD_BENEDICT_2271, IntType.NPC, "bank") { player, _ ->
openBankAccount(player)
return@on true
}
on(NPCs.EMERALD_BENEDICT_2271, NPC, "collect") { player, _ ->
on(NPCs.EMERALD_BENEDICT_2271, IntType.NPC, "collect") { player, _ ->
openGrandExchangeCollectionBox(player)
return@on true
}
@@ -32,7 +32,7 @@ class GlobalKillCounter : StartupListener, ShutdownListener {
val tmp_rare_drops = data.get("rare_drops")
populate(rare_drops, tmp_rare_drops)
} catch (e: Exception){
SystemLogger.logErr("Failed parsing ${file.name} - stack trace below.")
SystemLogger.logErr(this::class.java, "Failed parsing ${file.name} - stack trace below.")
e.printStackTrace()
}
}
@@ -11,6 +11,7 @@ import core.game.node.entity.player.link.audio.Audio
import rs09.game.node.entity.skill.slayer.SlayerEquipmentFlags
import core.plugin.Plugin
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
import rs09.game.interaction.InteractionListeners
import rs09.game.system.config.ItemConfigParser
@@ -22,7 +23,7 @@ import rs09.game.system.config.ItemConfigParser
class EquipHandler : InteractionListener {
override fun defineListeners() {
on(ITEM, "equip", "wield", "wear") { player, node ->
on(IntType.ITEM, "equip", "wield", "wear") { player, node ->
handleEquip(player, node)
return@on true
}
@@ -39,7 +39,7 @@ object PickupHandler {
return true
}
if (player.getAttribute("droppedItem:" + item.id, 0) > GameWorld.ticks) { //Splinter
SystemLogger.logAlert("$player tried to do the drop & quick pick-up Ground Item dupe.")
SystemLogger.logAlert(this::class.java, "$player tried to do the drop & quick pick-up Ground Item dupe.")
return true
}
if (item !is GroundSpawnLoader.GroundSpawn && item.isRemainPrivate && !item.droppedBy(player)) {
@@ -13,6 +13,7 @@ import org.rs09.consts.Items
import org.rs09.consts.NPCs
import rs09.ServerConstants
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
import rs09.game.interaction.InterfaceListener
import rs09.game.system.SystemLogger
import rs09.game.system.command.Privilege
@@ -41,7 +42,7 @@ class Shops : StartupListener, TickListener, InteractionListener, InterfaceListe
fun logShop(msg: String)
{
SystemLogger.logInfo("[SHOPS] $msg")
SystemLogger.logInfo(this::class.java, "[SHOPS] $msg")
}
fun parseStock(stock: String, id: Int): ArrayList<ShopItem>{
@@ -57,7 +58,7 @@ class Shops : StartupListener, TickListener, InteractionListener, InterfaceListe
amount = "-1"
val item = tokens[0].toInt()
if(idsInStock[item] != null) {
SystemLogger.logWarn("[SHOPS] MALFORMED STOCK IN SHOP ID $id FOR ITEM $item")
SystemLogger.logWarn(this::class.java, "[SHOPS] MALFORMED STOCK IN SHOP ID $id FOR ITEM $item")
items.forEach { if(it.itemId == item) {
it.amount += amount.toInt()
return@map
@@ -105,7 +106,7 @@ class Shops : StartupListener, TickListener, InteractionListener, InterfaceListe
}
override fun defineListeners() {
on(NPC, "trade", "shop"){player, node ->
on(IntType.NPC, "trade", "shop"){player, node ->
val npc = node as NPC
if (npc.id == 2824) {
TanningProduct.open(player, 2824)
@@ -119,7 +120,7 @@ class Shops : StartupListener, TickListener, InteractionListener, InterfaceListe
return@on true
}
on(NPCs.SIEGFRIED_ERKLE_933, NPC, "trade"){ player, node ->
on(NPCs.SIEGFRIED_ERKLE_933, IntType.NPC, "trade"){ player, node ->
val points = getQP(player)
if(points < 40){
sendNPCDialogue(player, NPCs.SIEGFRIED_ERKLE_933, "I'm sorry, adventurer, but you need 40 quest points to buy from me.")
@@ -129,7 +130,7 @@ class Shops : StartupListener, TickListener, InteractionListener, InterfaceListe
return@on true
}
on(NPCs.FUR_TRADER_1316, NPC,"trade") { player, node ->
on(NPCs.FUR_TRADER_1316, IntType.NPC, "trade") { player, node ->
if (!isQuestComplete(player, "Fremennik Trials")) {
sendNPCDialogue(player, NPCs.FUR_TRADER_1316, "I don't sell to outerlanders.", FacialExpression.ANNOYED).also { END_DIALOGUE }
} else {
@@ -137,15 +138,6 @@ class Shops : StartupListener, TickListener, InteractionListener, InterfaceListe
}
return@on true
}
on(NPCs.FISH_MONGER_1315, NPC,"trade") { player, node ->
if (!isQuestComplete(player, "Fremennik Trials")) {
sendNPCDialogue(player, NPCs.FISH_MONGER_1315, "I don't sell to outerlanders.", FacialExpression.ANNOYED).also { END_DIALOGUE }
} else {
shopsByNpc[node.id]?.openFor(player)
}
return@on true
}
}
override fun defineInterfaceListeners() {
@@ -245,7 +237,7 @@ class Shops : StartupListener, TickListener, InteractionListener, InterfaceListe
}
override fun defineDestinationOverrides() {
setDest(NPC,"trade","shop"){_,node ->
setDest(IntType.NPC,"trade","shop"){ _, node ->
val npc = node as NPC
if (npc.getAttribute("facing_booth", false)) {
val offsetX = npc.direction.stepX shl 1
@@ -40,7 +40,7 @@ open class WorldEvent(var name: String) {
* Used to log world event messages in a standard and organized way.
*/
fun log(message: String){
SystemLogger.logInfo("[World Events($name)] $message")
SystemLogger.logInfo(this::class.java, "[World Events($name)] $message")
}
/**
@@ -12,6 +12,7 @@ import rs09.ServerStore.Companion.getInt
import rs09.game.content.global.WeightBasedTable
import rs09.game.content.global.WeightedItem
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
import rs09.game.system.SystemLogger
import rs09.plugin.CorePluginTypes.XPGainPlugin
import rs09.tools.stringtools.colorize
@@ -55,11 +56,10 @@ class XMASMboxHandler : InteractionListener {
//disable if it's not december.
//Calendar.MONTH is 0-indexed, Month is 1-indexed. I know. It's dumb. Thanks oracle.
if(Calendar.getInstance().get(Calendar.MONTH) + 1 != Month.DECEMBER.value){
SystemLogger.logInfo("${Calendar.getInstance().get(Calendar.MONTH)} - ${Month.DECEMBER.value}")
return
}
on(MBOX, ITEM, "open"){player, used ->
on(MBOX, IntType.ITEM, "open"){player, used ->
val item = MBOX_LOOT.roll().first()
if(removeItem(player, used, Container.INVENTORY)) {
@@ -6,6 +6,7 @@ import core.game.node.item.GroundItemManager
import org.rs09.consts.Items
import org.rs09.consts.NPCs
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
class EasterEventListeners : InteractionListener {
@@ -14,7 +15,7 @@ class EasterEventListeners : InteractionListener {
override fun defineListeners() {
on(eggs,ITEM,"take"){player, node ->
on(eggs, IntType.ITEM, "take"){player, node ->
player.pulseManager.run(object : MovementPulse(player,node, DestinationFlag.ITEM){
override fun pulse(): Boolean {
if(player.inventory.contains(Items.BASKET_OF_EGGS_4565,1) || player.equipment.contains(Items.BASKET_OF_EGGS_4565,1)){
@@ -31,13 +32,13 @@ class EasterEventListeners : InteractionListener {
return@on true
}
on(Items.BASKET_OF_EGGS_4565,ITEM,"operate"){player, node ->
on(Items.BASKET_OF_EGGS_4565, IntType.ITEM, "operate"){player, node ->
val numEggs = player.getAttribute<Int>(EGG_ATTRIBUTE) ?: 0
player.dialogueInterpreter.sendDialogue("You have $numEggs eggs in the basket.")
return@on true
}
on(NPCs.EASTER_BUNNY_7197,NPC,"talk-to"){player, node ->
on(NPCs.EASTER_BUNNY_7197, IntType.NPC, "talk-to"){player, node ->
val npc = node.asNpc()
npc.faceLocation(player.location)
val NEED_BASKET = !(player!!.inventory.contains(Items.BASKET_OF_EGGS_4565,1) || player!!.equipment.contains(Items.BASKET_OF_EGGS_4565,1) || player!!.bank.contains(Items.BASKET_OF_EGGS_4565,1))
@@ -16,12 +16,13 @@ import rs09.ServerStore.Companion.getInt
import rs09.ServerStore.Companion.getString
import rs09.game.content.dialogue.DialogueFile
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
import rs09.game.world.GameWorld
import rs09.tools.END_DIALOGUE
class TrickOrTreatHandler : InteractionListener {
override fun defineListeners() {
on(NPC, "trick-or-treat"){player, node ->
on(IntType.NPC, "trick-or-treat"){player, node ->
val hasDone5 = getDailyTrickOrTreats(player) == 5
val hasDoneMe = getTrickOrTreatedNPCs(player).contains(node.name.toLowerCase())
@@ -31,7 +31,7 @@ class PenguinManager{
private fun updateStoreFile(){
val jsonTags = JSONArray()
tagMapping.filter { it.value.isNotEmpty() }.forEach { (ordinal,taggers) ->
SystemLogger.logInfo("$ordinal - ${taggers.first()}")
SystemLogger.logInfo(this::class.java, "$ordinal - ${taggers.first()}")
val tag = JSONObject()
tag["ordinal"] = ordinal
tag["taggers"] = taggers
@@ -64,6 +64,6 @@ class PenguinManager{
}
fun log(message: String){
SystemLogger.logInfo("[Penguins] $message")
SystemLogger.logInfo(this::class.java, "[Penguins] $message")
}
}
@@ -12,11 +12,12 @@ import core.plugin.Plugin
import core.game.content.quest.PluginInteraction
import core.game.content.quest.PluginInteractionManager
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
class PenguinSpyingHandler : InteractionListener{
override fun defineListeners() {
on(PENGUINS, NPC, "spy-on"){player, node ->
on(PENGUINS, IntType.NPC, "spy-on"){player, node ->
val npc = node.asNpc()
if(PenguinManager.hasTagged(player, npc.location)){
player.sendMessage("You've already tagged this penguin.")
@@ -11,6 +11,7 @@ import rs09.ServerStore
import rs09.ServerStore.Companion.getBoolean
import rs09.game.content.dialogue.DialogueFile
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
import rs09.game.system.SystemLogger
import rs09.game.system.command.Privilege
import rs09.game.world.GameWorld
@@ -36,7 +37,7 @@ class ShootingStarPlugin : LoginListener, InteractionListener, TickListener, Com
}
override fun defineListeners() {
on(Scenery.SHOOTING_STAR_NOTICEBOARD_38669, SCENERY, "read") { player, _ ->
on(Scenery.SHOOTING_STAR_NOTICEBOARD_38669, IntType.SCENERY, "read") { player, _ ->
var index = 0
scoreboardEntries.forEach { entry ->
val timeElapsed = secondsToTicks(GameWorld.ticks - entry.time) / 60
@@ -48,17 +49,17 @@ class ShootingStarPlugin : LoginListener, InteractionListener, TickListener, Com
return@on true
}
on(SHOOTING_STARS,SCENERY,"mine"){ player, _ ->
on(SHOOTING_STARS, IntType.SCENERY, "mine"){ player, _ ->
star.mine(player)
return@on true
}
on(SHOOTING_STARS,SCENERY,"prospect"){ player, _ ->
on(SHOOTING_STARS, IntType.SCENERY, "prospect"){ player, _ ->
star.prospect(player)
return@on true
}
on(RING, ITEM, "rub", "operate"){player, node ->
on(RING, IntType.ITEM, "rub", "operate"){player, node ->
if(getRingStoreFile().getBoolean(player.username.toLowerCase())){
sendDialogue(player, "The ring is still recharging.")
return@on true
@@ -111,7 +112,7 @@ class ShootingStarPlugin : LoginListener, InteractionListener, TickListener, Com
}
override fun startup() {
SystemLogger.logInfo("Shooting Stars initialized.")
SystemLogger.logInfo(this::class.java, "Shooting Stars initialized.")
}
private data class ScoreboardEntry(val player: String, val time: Int)
@@ -16,6 +16,7 @@ import org.rs09.consts.NPCs
import rs09.ServerStore.Companion.getInt
import rs09.game.Event
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
/**
* Handles the work-for actions for the NPCs
@@ -120,7 +121,7 @@ class WorkForInteractionListener : InteractionListener, LoginListener {
}
override fun defineListeners() {
on(EMPLOYER_IDS, NPC, "work-for") { player, node ->
on(EMPLOYER_IDS, IntType.NPC, "work-for") { player, node ->
if (JobManager.getStoreFile().getInt(player.username.lowercase()) == 3) {
sendNPCDialogue(player, node.id, "You've hit your limit for the day. Come back tomorrow!")
return@on true
@@ -3,6 +3,7 @@ package rs09.game.content.quest.free.dragonslayer
import api.*
import org.rs09.consts.Items
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
class DSEquipListeners : InteractionListener {
@@ -3,10 +3,11 @@ package rs09.game.content.quest.free.dragonslayer
import api.sendMessage
import org.rs09.consts.Scenery
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
class DSListeners : InteractionListener {
override fun defineListeners() {
on(Scenery.CELL_DOOR_40184, SCENERY, "open") {player, _ ->
on(Scenery.CELL_DOOR_40184, IntType.SCENERY, "open") {player, _ ->
sendMessage(player, "It's locked tight.")
return@on true
}
@@ -7,6 +7,7 @@ import org.rs09.consts.Items
import org.rs09.consts.Graphics
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
import rs09.game.system.command.Privilege
import core.plugin.Initializable
import core.game.node.entity.npc.AbstractNPC
@@ -120,7 +121,7 @@ class BloatedToadListeners : InteractionListener, StartupListener, Commands {
}
override fun defineListeners() {
on(Items.BLOATED_TOAD_2875, ITEM, "drop") {player, used ->
on(Items.BLOATED_TOAD_2875, IntType.ITEM, "drop") {player, used ->
val quest = player.questRepository.getQuest("Big Chompy Bird Hunting")
val inExtraBorder = extraBorders.filter { it.insideBorder(player) }.count() > 0
@@ -151,13 +152,13 @@ class BloatedToadListeners : InteractionListener, StartupListener, Commands {
return@on true
}
on(Items.BLOATED_TOAD_2875, ITEM, "release") { player, used ->
on(Items.BLOATED_TOAD_2875, IntType.ITEM, "release") { player, used ->
removeItem(player, used.asItem())
sendPlayerDialogue(player, "Free the fat toadsies!")
return@on true
}
on(Items.BLOATED_TOAD_2875, ITEM, "release all") { player, used ->
on(Items.BLOATED_TOAD_2875, IntType.ITEM, "release all") { player, used ->
removeAll(player, used.asItem())
sendPlayerDialogue(player, "Free the fat toadsies!")
return@on true
@@ -18,6 +18,7 @@ import core.game.node.entity.player.link.quest.Quest
import core.game.world.update.flag.context.Graphics as Gfx
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
import rs09.game.content.dialogue.SkillDialogueHandler
import rs09.game.content.dialogue.SkillDialogueHandler.SkillDialogue
import rs09.game.system.config.ItemConfigParser
@@ -137,19 +138,19 @@ class ChompyBird : Quest("Big Chompy Bird Hunting", 35, 34, 2, Vars.VARP_QUEST_C
override fun defineListeners() {
val filledBellows = intArrayOf(Items.OGRE_BELLOWS_3_2872, Items.OGRE_BELLOWS_2_2873, Items.OGRE_BELLOWS_1_2874)
on(3379, SCENERY, "enter") {player, _ ->
on(3379, IntType.SCENERY, "enter") {player, _ ->
teleport(player, CAVE_ENTRANCE)
sendMessage(player, "You walk through the cave entrance into a dimly lit cave.")
return@on true
}
on(intArrayOf(32068, 32069), SCENERY, "pass-through") {player, _ ->
on(intArrayOf(32068, 32069), IntType.SCENERY, "pass-through") {player, _ ->
teleport(player, CAVE_EXIT)
sendMessage(player, "You walk back out of the darkness of the cave into daylight.")
return@on true
}
on(3377, SCENERY, "unlock") {player, node ->
on(3377, IntType.SCENERY, "unlock") {player, node ->
if (freeSlots(player) == 0) {
sendMessage(player, "You don't have enough space to do that.")
return@on true
@@ -177,7 +178,7 @@ class ChompyBird : Quest("Big Chompy Bird Hunting", 35, 34, 2, Vars.VARP_QUEST_C
return@on true
}
onUseWith(SCENERY, Items.RAW_CHOMPY_2876, 3375) {player, used, _ ->
onUseWith(IntType.SCENERY, Items.RAW_CHOMPY_2876, 3375) {player, used, _ ->
val rantzIngredient = getAttribute(player, ATTR_ING_RANTZ, -1)
val bugsIngredient = getAttribute(player, ATTR_ING_BUGS, -1)
val fycieIngredient = getAttribute(player, ATTR_ING_FYCIE, -1)
@@ -221,7 +222,7 @@ class ChompyBird : Quest("Big Chompy Bird Hunting", 35, 34, 2, Vars.VARP_QUEST_C
return@onUseWith true
}
onUseWith(SCENERY, Items.OGRE_BELLOWS_2871, 684) {player, used, _ ->
onUseWith(IntType.SCENERY, Items.OGRE_BELLOWS_2871, 684) {player, used, _ ->
if (removeItem(player, used.asItem())) {
lock(player, 2)
visualize(player, Animations.HUMAN_USING_BELLOWS_1026, Gfx(Graphics.USING_BELLOWS, 80))
@@ -231,7 +232,7 @@ class ChompyBird : Quest("Big Chompy Bird Hunting", 35, 34, 2, Vars.VARP_QUEST_C
return@onUseWith true
}
onUseWith(NPC, filledBellows, NPCs.SWAMP_TOAD_1013) {player, used, with ->
onUseWith(IntType.NPC, filledBellows, NPCs.SWAMP_TOAD_1013) {player, used, with ->
val hasTooManyToads = amountInInventory(player, Items.BLOATED_TOAD_2875) >= 3
if (hasTooManyToads) {
@@ -257,7 +258,7 @@ class ChompyBird : Quest("Big Chompy Bird Hunting", 35, 34, 2, Vars.VARP_QUEST_C
return@onUseWith true
}
onUseWith(ITEM, Items.OGRE_ARROW_SHAFT_2864, Items.FEATHER_314) {player, used, with ->
onUseWith(IntType.ITEM, Items.OGRE_ARROW_SHAFT_2864, Items.FEATHER_314) {player, used, with ->
val shaftAmount = amountInInventory(player, used.id)
val featherAmount = amountInInventory(player, with.id)
var maxAmount = min(shaftAmount, featherAmount)
@@ -278,7 +279,7 @@ class ChompyBird : Quest("Big Chompy Bird Hunting", 35, 34, 2, Vars.VARP_QUEST_C
return@onUseWith true
}
onUseWith(ITEM, Items.WOLF_BONES_2859, Items.CHISEL_1755) {player, used, with ->
onUseWith(IntType.ITEM, Items.WOLF_BONES_2859, Items.CHISEL_1755) {player, used, with ->
val maxAmount = amountInInventory(player, used.id)
if (getStage(player) == 0) {
@@ -314,7 +315,7 @@ class ChompyBird : Quest("Big Chompy Bird Hunting", 35, 34, 2, Vars.VARP_QUEST_C
return@onUseWith true
}
onUseWith(ITEM, Items.WOLFBONE_ARROWTIPS_2861, Items.FLIGHTED_OGRE_ARROW_2865) {player, used, with ->
onUseWith(IntType.ITEM, Items.WOLFBONE_ARROWTIPS_2861, Items.FLIGHTED_OGRE_ARROW_2865) {player, used, with ->
fun getMaxAmount(_unused: Int = 0): Int {
val tips = amountInInventory(player, Items.WOLFBONE_ARROWTIPS_2861)
val shafts = amountInInventory(player, Items.FLIGHTED_OGRE_ARROW_2865)
@@ -22,6 +22,7 @@ import core.game.world.map.Location
import core.game.world.map.path.Pathfinder
import core.game.interaction.MovementPulse
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
import core.game.world.update.flag.context.Animation
@Initializable
@@ -148,7 +149,7 @@ class ChompyBirdNPC : AbstractNPC, InteractionListener {
}
override fun defineListeners() {
on(NPCs.CHOMPY_BIRD_1016, NPC, "pluck") { player, node ->
on(NPCs.CHOMPY_BIRD_1016, IntType.NPC, "pluck") { player, node ->
val bird = node.asNpc()
if (!bird.getAttribute("plucked", false)) {
@@ -163,7 +164,7 @@ class ChompyBirdNPC : AbstractNPC, InteractionListener {
return@on true
}
on(Items.OGRE_BOW_2883, ITEM, "check kills") { player, _ ->
on(Items.OGRE_BOW_2883, IntType.ITEM, "check kills") { player, _ ->
val amount = player.getAttribute("chompy-kills", 0)
sendDialogue(player, "You have killed $amount chompy birds.")
return@on true
@@ -6,6 +6,7 @@ import rs09.tools.stringtools.colorize
import org.rs09.consts.Items
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
import core.game.node.entity.player.Player
import java.util.*
@@ -17,6 +17,7 @@ import rs09.game.content.quest.members.elementalworkshop.EWUtils.RIGHT_WATER_CON
import rs09.game.content.quest.members.elementalworkshop.EWUtils.WATER_WHEEL_STATE
import rs09.game.content.quest.members.elementalworkshop.EWUtils.currentStage
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
import rs09.game.system.SystemLogger
/**
@@ -90,7 +91,7 @@ class EWListeners : InteractionListener {
* Seers Village House listeners *
* * * * * * * * * * * * * * * * * */
// Bookcase (quest start)
on(Scenery.BOOKCASE_26113, SCENERY, "search") { player, _ ->
on(Scenery.BOOKCASE_26113, IntType.SCENERY, "search") { player, _ ->
val stage = currentStage(player)
if (stage < 3) {
@@ -129,7 +130,7 @@ class EWListeners : InteractionListener {
}
// Knife on Battered book -> Slashed book + Battered key
onUseWith(ITEM, Items.KNIFE_946, Items.BATTERED_BOOK_2886) { player, _, with ->
onUseWith(IntType.ITEM, Items.KNIFE_946, Items.BATTERED_BOOK_2886) { player, _, with ->
val stage = currentStage(player)
if (stage >= 1) {
lock(player, 2)
@@ -162,7 +163,7 @@ class EWListeners : InteractionListener {
* Seers Village Smithy listeners *
* * * * * * * * * * * * * * * * * */
// Odd looking wall handler
on(intArrayOf(Scenery.ODD_LOOKING_WALL_26114, Scenery.ODD_LOOKING_WALL_26115), SCENERY, "open") { player, wall ->
on(intArrayOf(Scenery.ODD_LOOKING_WALL_26114, Scenery.ODD_LOOKING_WALL_26115), IntType.SCENERY, "open") { player, wall ->
// Nothing interesting happens if quest wasn't started.
if (currentStage(player) < 1) {
sendMessage(player, "Nothing interesting happens.")
@@ -188,7 +189,7 @@ class EWListeners : InteractionListener {
return@on true
}
on(Scenery.STAIRCASE_3415, SCENERY, "climb-down") { player, _ ->
on(Scenery.STAIRCASE_3415, IntType.SCENERY, "climb-down") { player, _ ->
val stage = currentStage(player)
// Prevent player from somehow skipping beginning quest stages
if (stage < 1) {
@@ -207,7 +208,7 @@ class EWListeners : InteractionListener {
return@on true
}
on(Scenery.STAIRCASE_3416, SCENERY, "climb-up") { player, _ ->
on(Scenery.STAIRCASE_3416, IntType.SCENERY, "climb-up") { player, _ ->
teleport(player, Location.create(2709, 3498, 0))
return@on true
}
@@ -218,13 +219,13 @@ class EWListeners : InteractionListener {
* * * * * * * * * * * * * * */
// Center hatch, inaccessible
// NOTE: REMOVE ME/ADD CORRECT CHECKS FOR ELEMENTAL WORKSHOP II
on(Scenery.HATCH_18595, SCENERY, "open") { player, _ ->
on(Scenery.HATCH_18595, IntType.SCENERY, "open") { player, _ ->
sendDialogue(player, "You're unable to open the locked hatch.")
return@on true
}
// Stone bowl box, player can get more at any time
on(Scenery.BOXES_3397, SCENERY, "search") { player, _ ->
on(Scenery.BOXES_3397, IntType.SCENERY, "search") { player, _ ->
// If the player doesn't have a stone bowl in their inventory
if (player.inventory.addIfDoesntHave(emptyStoneBowl)) {
sendMessage(player, "You find a stone bowl.")
@@ -235,7 +236,7 @@ class EWListeners : InteractionListener {
}
// Needle crate, player can only receive once
on(Scenery.CRATE_3400, SCENERY, "search") { player, _ ->
on(Scenery.CRATE_3400, IntType.SCENERY, "search") { player, _ ->
if (!getAttribute(player, "/save:ew1:got_needle", false)) {
setAttribute(player, "/save:ew1:got_needle", true)
addItem(player, Items.NEEDLE_1733)
@@ -247,7 +248,7 @@ class EWListeners : InteractionListener {
}
// Leather crate, player can only receive once
on(Scenery.CRATE_3394, SCENERY, "search") { player, _ ->
on(Scenery.CRATE_3394, IntType.SCENERY, "search") { player, _ ->
if (!getAttribute(player, "/save:ew1:got_leather", false)) {
setAttribute(player, "/save:ew1:got_leather", true)
addItem(player, Items.LEATHER_1741)
@@ -259,7 +260,7 @@ class EWListeners : InteractionListener {
}
// Workbenches/Anvil
onUseWith(SCENERY, Items.ELEMENTAL_METAL_2893, Scenery.WORKBENCH_3402) { player, used, workbench ->
onUseWith(IntType.SCENERY, Items.ELEMENTAL_METAL_2893, Scenery.WORKBENCH_3402) { player, used, workbench ->
// Warn player their smithing level is too low to make the shield
if (player.skills.getLevel(Skills.SMITHING) < 20) {
sendMessage(player, "You need a smithing level of 20 to create an elemental shield.")
@@ -277,7 +278,7 @@ class EWListeners : InteractionListener {
}
// Sanity error check (Should never get thrown)
if (!player.inventory.containsAll(*elementalShieldReqItems)) {
SystemLogger.logErr("${player.username} tried to forge an elemental shield without all the required items.")
SystemLogger.logErr(this::class.java, "${player.username} tried to forge an elemental shield without all the required items.")
return@onUseWith false
}
// Successfully smith the elemental shield
@@ -302,7 +303,7 @@ class EWListeners : InteractionListener {
* Fire room listeners *
* * * * * * * * * * * * */
// Lava trough stone bowl (empty)
onUseWith(SCENERY, Items.A_STONE_BOWL_2888, *lavaTrough) { player, used, trough ->
onUseWith(IntType.SCENERY, Items.A_STONE_BOWL_2888, *lavaTrough) { player, used, trough ->
lock(player, (animationDuration(fillStoneBowlAnimation) + 1))
runTask(player) {
face(player, trough)
@@ -315,13 +316,13 @@ class EWListeners : InteractionListener {
}
// Lava trough stone bowl (filled with lava)
onUseWith(SCENERY, fullStoneBowl.id, *lavaTrough) { player, _, _ ->
onUseWith(IntType.SCENERY, fullStoneBowl.id, *lavaTrough) { player, _, _ ->
sendMessage(player, "The bowl is already full of lava.")
return@onUseWith true
}
// Pour lava into unlit furnace
onUseWith(SCENERY, fullStoneBowl.id, Scenery.FURNACE_18525) { player, used, _ ->
onUseWith(IntType.SCENERY, fullStoneBowl.id, Scenery.FURNACE_18525) { player, used, _ ->
player.faceLocation(Location.create(2726, 9875, 0))
lock(player, 3)
submitIndividualPulse(player, object : Pulse() {
@@ -347,7 +348,7 @@ class EWListeners : InteractionListener {
}
// Pour lava into lit furnace
onUseWith(SCENERY, fullStoneBowl.id, Scenery.FURNACE_18526) { player, used, _ ->
onUseWith(IntType.SCENERY, fullStoneBowl.id, Scenery.FURNACE_18526) { player, used, _ ->
player.faceLocation(Location.create(2726, 9875, 0))
runTask(player) {
playAudio(player, fillFurnaceWithLavaSFX)
@@ -358,7 +359,7 @@ class EWListeners : InteractionListener {
}
// Use elemental ore on lit furnace
onUseWith(SCENERY, Items.ELEMENTAL_ORE_2892, Scenery.FURNACE_18526) { player, _, _ ->
onUseWith(IntType.SCENERY, Items.ELEMENTAL_ORE_2892, Scenery.FURNACE_18526) { player, _, _ ->
player.faceLocation(Location.create(2726, 9875, 0))
// Warn player their smithing level is too low to smelt the ore
if (player.skills.getLevel(Skills.SMITHING) < 20) {
@@ -409,11 +410,11 @@ class EWListeners : InteractionListener {
* onCast SUPERHEAT spell (ModernListeners.kt)
* SKIPPED DUE TO SPAGHETTI: on BLAST FURNACE BELT "put-ore-on" (BlastfurnaceListeners.kt)
*/
onUseWith(SCENERY, Items.ELEMENTAL_ORE_2892, *furnaceIDS) { player, _, _ ->
onUseWith(IntType.SCENERY, Items.ELEMENTAL_ORE_2892, *furnaceIDS) { player, _, _ ->
sendMessage(player, "This furnace is not hot enough to smelt elemental ore.")
return@onUseWith true
}
onUseWith(SCENERY, Items.ELEMENTAL_ORE_2892, Scenery.CONVEYOR_BELT_9100) { player, _, _ ->
onUseWith(IntType.SCENERY, Items.ELEMENTAL_ORE_2892, Scenery.CONVEYOR_BELT_9100) { player, _, _ ->
sendMessage(player, "There would be no point in smelting that.")
return@onUseWith true
}
@@ -422,7 +423,7 @@ class EWListeners : InteractionListener {
* Water room listeners *
* * * * * * * * * * * * */
// Water controls
on(waterControls, SCENERY, "turn") { player, _ ->
on(waterControls, IntType.SCENERY, "turn") { player, _ ->
// Notify player they can't change water control values while water wheel is running
if (EWUtils.waterWheelEnabled(player)) {
sendMessage(player, "Now that the water wheel is running, the valve seems locked off.")
@@ -452,7 +453,7 @@ class EWListeners : InteractionListener {
else -> {
offset = -1
enabled = 0
SystemLogger.logErr("Unhandled location when determining enabled water controls! ${player.location}")
SystemLogger.logErr(this::class.java, "Unhandled location when determining enabled water controls! ${player.location}")
return@on false
}
}
@@ -481,7 +482,7 @@ class EWListeners : InteractionListener {
}
// Water wheel lever handler
on(Scenery.LEVER_3406, SCENERY, "pull") { player, lever ->
on(Scenery.LEVER_3406, IntType.SCENERY, "pull") { player, lever ->
// Default will happen no matter what
lock(player, 2)
sendMessage(player, "You pull the lever")
@@ -516,7 +517,7 @@ class EWListeners : InteractionListener {
/* * * * * * * * * * * * * *
* Air room listeners *
* * * * * * * * * * * * */
on(Scenery.BELLOWS_18516, SCENERY, "fix") { player, bellows ->
on(Scenery.BELLOWS_18516, IntType.SCENERY, "fix") { player, bellows ->
player.faceLocation(Location.create(2736, 9883, 0))
// Warn player bellows are already fixed
if (getAttribute(player, "/save:ew1:bellows_fixed", false)) {
@@ -553,7 +554,7 @@ class EWListeners : InteractionListener {
return@on true
}
on(Scenery.LEVER_3409, SCENERY, "pull") { player, lever ->
on(Scenery.LEVER_3409, IntType.SCENERY, "pull") { player, lever ->
// Warn player they have to fix the bellows before pulling the lever
if (!getAttribute(player, "/save:ew1:bellows_fixed", false)) {
sendPlayerDialogue(player, "I shouldn't risk damaging the bellows any further.")
@@ -584,20 +585,20 @@ class EWListeners : InteractionListener {
}
}
override fun defineDestinationOverrides() {
setDest(SCENERY, intArrayOf(Scenery.FURNACE_18525, Scenery.FURNACE_18526), "use") { _, _ ->
setDest(IntType.SCENERY, intArrayOf(Scenery.FURNACE_18525, Scenery.FURNACE_18526), "use") { _, _ ->
return@setDest Location.create(2724,9875)
}
setDest(SCENERY, intArrayOf(Scenery.BELLOWS_18516), "fix") { _, _ ->
setDest(IntType.SCENERY, intArrayOf(Scenery.BELLOWS_18516), "fix") { _, _ ->
return@setDest Location.create(2733, 9884, 0)
}
setDest(SCENERY, intArrayOf(Scenery.ODD_LOOKING_WALL_26115), "open") { player, _ ->
setDest(IntType.SCENERY, intArrayOf(Scenery.ODD_LOOKING_WALL_26115), "open") { player, _ ->
if (inBorders(player, 2709, 3496, 2711, 3498)) {
return@setDest Location.create(2709, 3496, 0)
} else {
return@setDest Location.create(2709, 3495, 0)
}
}
setDest(SCENERY, intArrayOf(Scenery.ODD_LOOKING_WALL_26114), "open") { player, _ ->
setDest(IntType.SCENERY, intArrayOf(Scenery.ODD_LOOKING_WALL_26114), "open") { player, _ ->
if (inBorders(player, 2709, 3496, 2711, 3498)) {
return@setDest Location.create(2710, 3496, 0)
} else {
@@ -12,6 +12,7 @@ import core.game.world.update.flag.context.Animation
import core.plugin.Initializable
import org.rs09.consts.NPCs
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
/**
* Npc(s):
@@ -46,7 +47,7 @@ class ElementalRockNPC(id: Int = 0, location: Location? = null) : AbstractNPC(id
// The NPC stays in their upright form when the player
// stops attacking and can walk around
override fun defineListeners() {
on(ids, NPC, "Mine") { player, node ->
on(ids, IntType.NPC, "Mine") { player, node ->
val tool: SkillingTool? = getTool(player, true)
// Check to see if the player can proc the NPC
if (tool == null) {
@@ -120,7 +120,7 @@ class FamilyCrest: Quest("Family Crest", 59, 58, 1, 148, 0, 1, 11) {
drawReward(player,"for the gauntlets",ln++)
if (!addItem(player, Items.FAMILY_GAUNTLETS_778)) {
SystemLogger.logErr("Failed to give gauntlets to ${player.username} at end of quest, this should not occur due to crest item removal needed to finish quest.")
SystemLogger.logErr(this::class.java, "Failed to give gauntlets to ${player.username} at end of quest, this should not occur due to crest item removal needed to finish quest.")
}
setAttribute(player, "/save:family-crest:gauntlets", Items.FAMILY_GAUNTLETS_778)
}
@@ -5,12 +5,13 @@ import api.*
import org.rs09.consts.Items
import org.rs09.consts.NPCs
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
class JohnathonAntiPosionInteraction: InteractionListener {
override fun defineListeners() {
val poisons = intArrayOf(Items.ANTIPOISON4_2446, Items.ANTIPOISON3_175, Items.ANTIPOISON2_177, Items.ANTIPOISON1_179)
onUseWith(NPC, poisons, NPCs.JOHNATHON_668){player, used, with ->
onUseWith(IntType.NPC, poisons, NPCs.JOHNATHON_668){player, used, with ->
val npc = with.asNpc()
val antip = used.asItem()
val stage = questStage(player, "Family Crest")
@@ -13,6 +13,7 @@ import core.net.packet.out.ClearScenery
import core.net.packet.out.ConstructScenery
import core.net.packet.out.UpdateAreaPosition;
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
fun doDoor(player: Player, scenery: Scenery) {
val d = if(scenery.rotation == 0 || scenery.rotation == 3) { -1 } else { 0 }
@@ -50,7 +51,7 @@ class WitchavenLeverInteraction : InteractionListener {
val DOORS = intArrayOf(NORTH_DOOR, HELLHOUND_DOOR, SOUTHWEST_DOOR, SOUTHEAST_DOOR)
override fun defineListeners() {
on(LEVERS, SCENERY, "pull") { player, node ->
on(LEVERS, IntType.SCENERY, "pull") { player, node ->
val baseId = if(node.id % 2 == 0) { node.id - 1 } else { node.id }
if(player.questRepository.getQuest("Family Crest").getStage(player) == 0) {
player.sendMessage("Nothing interesting happens.")
@@ -78,7 +79,7 @@ class WitchavenLeverInteraction : InteractionListener {
player.session.write(buffer)
return@on true
}
on(DOORS, SCENERY, "open") { player, node ->
on(DOORS, IntType.SCENERY, "open") { player, node ->
val northA = player.getAttribute("family-crest:witchaven-lever:${NORTH_LEVER_A}", false)
val northB = player.getAttribute("family-crest:witchaven-lever:${NORTH_LEVER_B}", false)
val south = player.getAttribute("family-crest:witchaven-lever:${SOUTH_LEVER}", false)
@@ -10,13 +10,13 @@ import org.rs09.consts.Scenery as Sceneries
import rs09.game.interaction.InteractionListener
import api.questStage
import api.sendMessage
import rs09.game.interaction.IntType
@Initializable
class DramenTreeListener : InteractionListener {
override fun defineListeners() {
on(Sceneries.DRAMEN_TREE_1292,SCENERY,"chop down"){ player, node ->
on(Sceneries.DRAMEN_TREE_1292, IntType.SCENERY, "chop down"){ player, node ->
val questStage = questStage(player,"Lost City")
if (SkillingTool.getHatchet(player) == null) {
sendMessage(player,"You do not have an axe which you have the level to use.")
@@ -10,6 +10,7 @@ import core.game.system.task.Pulse
import core.game.world.map.Location
import core.plugin.Initializable
import org.rs09.consts.Items
import rs09.game.interaction.IntType
import org.rs09.consts.Scenery as Sceneries
import rs09.game.interaction.InteractionListener
import rs09.game.world.GameWorld
@@ -24,7 +25,7 @@ class LostCityListeners : InteractionListener {
override fun defineListeners() {
// the shed teleport, to allow players to access zanaris if they enter the shed while wielding the dramen staff
on(Sceneries.DOOR_2406,SCENERY,"open"){ player, node ->
on(Sceneries.DOOR_2406,IntType.SCENERY,"open"){ player, node ->
DoorActionHandler.handleAutowalkDoor(player,node as Scenery)
val quest = "Lost City"
val isOutsideShed = player.location.x < node.location.x
@@ -52,7 +53,7 @@ class LostCityListeners : InteractionListener {
return@on true
}
// creating the dramen staff via using knife on dramen branch
onUseWith(ITEM,Items.KNIFE_946,Items.DRAMEN_BRANCH_771){ player, _, _ ->
onUseWith(IntType.ITEM,Items.KNIFE_946,Items.DRAMEN_BRANCH_771){ player, _, _ ->
if(!player.skills.hasLevel(Skills.CRAFTING,31)) {
sendDialogue(player,"You need a crafting level of 31 to do this.")
return@onUseWith false
@@ -12,6 +12,7 @@ import core.plugin.Initializable
import org.rs09.consts.NPCs
import org.rs09.consts.Scenery
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
import rs09.game.world.GameWorld
@@ -64,7 +65,7 @@ class ShamusTreeListener : InteractionListener {
}
override fun defineListeners() {
on(Scenery.TREE_2409,SCENERY,"chop") { player, _ ->
on(Scenery.TREE_2409, IntType.SCENERY, "chop") { player, _ ->
handleShamusTree(player)
return@on true
}
@@ -10,6 +10,7 @@ import org.rs09.consts.Items
import org.rs09.consts.NPCs
import rs09.game.content.dialogue.DialogueFile
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
import rs09.tools.END_DIALOGUE
/**
@@ -114,7 +115,7 @@ class BrotherCedricDialogue : DialogueFile() {
*/
class BrotherCedricListener : InteractionListener {
override fun defineListeners() {
on(NPCs.BROTHER_CEDRIC_280, NPC, "talk-to"){ player, _ ->
on(NPCs.BROTHER_CEDRIC_280, IntType.NPC, "talk-to"){ player, _ ->
player.dialogueInterpreter.open(BrotherCedricDialogue(), NPC(NPCs.BROTHER_CEDRIC_280))
return@on true
}
@@ -12,6 +12,7 @@ import org.rs09.consts.Items
import org.rs09.consts.NPCs
import rs09.game.content.dialogue.DialogueFile
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
import rs09.game.world.GameWorld.Pulser
import rs09.tools.END_DIALOGUE
@@ -207,7 +208,7 @@ class BrotherOmadDialogue : DialogueFile() {
*/
class BrotherOmadListener : InteractionListener {
override fun defineListeners() {
on(NPCs.BROTHER_OMAD_279, NPC, "talk-to"){ player, _ ->
on(NPCs.BROTHER_OMAD_279, IntType.NPC, "talk-to"){ player, _ ->
player.dialogueInterpreter.open(BrotherOmadDialogue(), NPC(NPCs.BROTHER_OMAD_279))
return@on true
}
@@ -5,6 +5,7 @@ import core.game.node.entity.npc.NPC
import org.rs09.consts.NPCs
import rs09.game.content.dialogue.DialogueFile
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
import rs09.tools.END_DIALOGUE
/**
@@ -36,7 +37,7 @@ class MonasteryMonkDialogue : DialogueFile() {
*/
class MonasteryMonkListener : InteractionListener {
override fun defineListeners() {
on(NPCs.MONK_281, NPC, "talk-to"){ player, _ ->
on(NPCs.MONK_281, IntType.NPC, "talk-to"){ player, _ ->
player.dialogueInterpreter.open(MonasteryMonkDialogue(), NPC(NPCs.MONK_281))
return@on true
}
@@ -16,6 +16,7 @@ import rs09.game.content.dialogue.DialogueFile
import rs09.game.content.global.action.PickupHandler
import rs09.game.content.global.shops.Shops
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
import rs09.game.node.entity.npc.MortMyreGhastNPC
import rs09.game.system.SystemLogger
import rs09.tools.END_DIALOGUE
@@ -46,12 +47,12 @@ class NSListeners : InteractionListener {
val items = intArrayOf(USED_SPELLCARD, FUNGUS)
override fun defineListeners() {
on(GROTTO_TREE, SCENERY, "look-at"){player, _ ->
on(GROTTO_TREE, IntType.SCENERY, "look-at"){player, _ ->
sendMessage(player, "It looks like a tree on a large rock with roots trailing down to the ground.")
return@on true
}
on(GROTTO_TREE, SCENERY, "search"){player, _ ->
on(GROTTO_TREE, IntType.SCENERY, "search"){player, _ ->
if(!getAttribute(player, GROTTO_SEARCHED, false) || !(inInventory(player, JOURNAL) || inBank(player, JOURNAL))){
sendItemDialogue(player, JOURNAL, "You search the strange rock. You find a knot and inside of it you discover a small tome. The words on the front are a bit vague, but you can make out the words 'Tarlock' and 'journal'.")
addItemOrDrop(player, JOURNAL, 1)
@@ -61,7 +62,7 @@ class NSListeners : InteractionListener {
return@on false
}
on(GROTTO_ENTRANCE, SCENERY, "enter"){player, node ->
on(GROTTO_ENTRANCE, IntType.SCENERY, "enter"){player, node ->
val questStage = player.questRepository.getQuest("Nature Spirit").getStage(player)
if(questStage < 55) {
val npc = core.game.node.entity.npc.NPC.create(NPCs.FILLIMAN_TARLOCK_1050, Location.create(3440, 3336, 0))
@@ -74,7 +75,7 @@ class NSListeners : InteractionListener {
return@on true
}
on(GROTTO_ALTAR, SCENERY,"search"){player, node ->
on(GROTTO_ALTAR, IntType.SCENERY, "search"){player, node ->
val stage = player.questRepository.getStage("Nature Spirit")
if(stage == 55){
openDialogue(player, FillimanCompletionDialogue(), NPC(NPCs.FILLIMAN_TARLOCK_1050))
@@ -84,22 +85,22 @@ class NSListeners : InteractionListener {
return@on false
}
on(NATURE_STONE, SCENERY, "search"){player, _ ->
on(NATURE_STONE, IntType.SCENERY, "search"){player, _ ->
sendDialogue(player, "You search the stone and find that it has some sort of nature symbol scratched into it.")
return@on true
}
on(FAITH_STONE, SCENERY, "search"){player, _ ->
on(FAITH_STONE, IntType.SCENERY, "search"){player, _ ->
sendDialogue(player, "You search the stone and find that it has some sort of faith symbol scratched into it.")
return@on true
}
on(FREELY_GIVEN_STONE, SCENERY, "search"){player, _ ->
on(FREELY_GIVEN_STONE, IntType.SCENERY, "search"){player, _ ->
sendDialogue(player, "You search the stone and find it has some sort of spirit symbol scratched into it.")
return@on true
}
on(WISHING_WELL, SCENERY, "make-wish"){player, node ->
on(WISHING_WELL, IntType.SCENERY, "make-wish"){player, node ->
if(player.questRepository.isComplete("Nature Spirit") && player.questRepository.isComplete("Wolf Whistle"))
Shops.openId(player, 241)
else
@@ -108,19 +109,19 @@ class NSListeners : InteractionListener {
return@on true
}
on(JOURNAL, ITEM, "read"){player, _ ->
on(JOURNAL, IntType.ITEM, "read"){player, _ ->
player.dialogueInterpreter.open(NSJournalDialogue())
return@on true
}
on(WASHING_BOWL, GROUNDITEM, "take"){player, node ->
SystemLogger.logInfo("Running listener")
on(WASHING_BOWL, IntType.GROUNDITEM, "take"){player, node ->
SystemLogger.logInfo(this::class.java, "Running listener")
GroundItemManager.create(Item(MIRROR), node.location, player)
PickupHandler.take(player, node as GroundItem)
return@on true
}
on(MIRROR, GROUNDITEM, "take"){player, node ->
on(MIRROR, IntType.GROUNDITEM, "take"){player, node ->
if(getAttribute(player, MIRROR_TAKEN, false) && (inInventory(player, MIRROR) || inBank(player, MIRROR))){
sendDialogue(player, "I don't need another one of these.")
return@on true
@@ -130,7 +131,7 @@ class NSListeners : InteractionListener {
return@on true
}
on(SPELLCARD, ITEM, "cast"){player, node ->
on(SPELLCARD, IntType.ITEM, "cast"){player, node ->
if(NSUtils.castBloom(player)){
removeItem(player, node.asItem(), Container.INVENTORY)
addItem(player, Items.A_USED_SPELL_2969)
@@ -138,7 +139,7 @@ class NSListeners : InteractionListener {
return@on true
}
on(intArrayOf(DRUID_POUCH, DRUID_POUCH_EMPTY), ITEM, "fill"){player, node ->
on(intArrayOf(DRUID_POUCH, DRUID_POUCH_EMPTY), IntType.ITEM, "fill"){player, node ->
if(player.questRepository.getStage("Nature Spirit") >= 75) {
if (amountInInventory(player, PEAR) >= 3) {
@@ -169,7 +170,7 @@ class NSListeners : InteractionListener {
return@on true
}
onUseWith(SCENERY, Items.SILVER_SICKLE_2961, NATURE_ALTAR){player, used, with ->
onUseWith(IntType.SCENERY, Items.SILVER_SICKLE_2961, NATURE_ALTAR){player, used, with ->
sendItemDialogue(player, Items.SILVER_SICKLEB_2963, "You dump the sickle into the waters.")
if(removeItem(player, Items.SILVER_SICKLE_2961, Container.INVENTORY)){
addItem(player, Items.SILVER_SICKLEB_2963, 1)
@@ -177,11 +178,11 @@ class NSListeners : InteractionListener {
return@onUseWith true
}
onUseWith(NPC, DRUID_POUCH, NPCs.GHAST_1052){player, used, with ->
onUseWith(IntType.NPC, DRUID_POUCH, NPCs.GHAST_1052){player, used, with ->
NSUtils.activatePouch(player, with as MortMyreGhastNPC)
}
onUseWith(SCENERY, items, *stones) { player, used, with ->
onUseWith(IntType.SCENERY, items, *stones) { player, used, with ->
when (used.id) {
USED_SPELLCARD -> {
if (with.id == FREELY_GIVEN_STONE) {
@@ -7,6 +7,7 @@ import core.game.system.task.Pulse
import core.game.world.map.Location
import org.rs09.consts.Items
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
import rs09.game.world.GameWorld.Pulser
import kotlin.math.abs
import kotlin.math.atan2
@@ -17,7 +18,7 @@ class HunterTalismanListener : InteractionListener {
override fun defineListeners() {
on(TALISMAN,ITEM,"locate"){player,_ ->
on(TALISMAN, IntType.ITEM, "locate"){player,_ ->
var locationString = getAttribute(player,"fremtrials:draugen-loc","none")
if(locationString == "none"){
val newLoc = possibleLocations.random()
@@ -1,7 +1,6 @@
package rs09.game.content.quest.members.thefremenniktrials
import api.sendMessage
import core.game.container.access.BitregisterAssembler
import rs09.game.interaction.InterfaceListener
class SeerLockInterfaceListener : InterfaceListener {
@@ -25,7 +24,7 @@ class SeerLockInterfaceListener : InterfaceListener {
player.packetDispatch.sendVarcUpdate(619, 0)
player.packetDispatch.sendVarcUpdate(620, 0)
player.packetDispatch.sendVarcUpdate(621, 0)
BitregisterAssembler.send(player,298,2,0,1, BitregisterAssembler(0))
player.packetDispatch.sendIfaceSettings(0, 2, 298, 0, 1)
player.setAttribute("riddle-letter-one",0)
player.setAttribute("riddle-letter-two",0)
player.setAttribute("riddle-letter-three",0)
@@ -14,6 +14,7 @@ import core.game.world.update.flag.context.Animation
import org.rs09.consts.Items
import rs09.game.content.dialogue.DialogueFile
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
class SeersHouseListeners : InteractionListener {
@@ -96,7 +97,7 @@ class SeersHouseListeners : InteractionListener {
override fun defineListeners() {
on(WESTDOOR,SCENERY,"open"){player,node ->
on(WESTDOOR, IntType.SCENERY, "open"){player,node ->
if(!player.getAttribute("PeerStarted",false)){
sendDialogue(player,"You should probably talk to the owner of this home.")
}
@@ -120,12 +121,12 @@ class SeersHouseListeners : InteractionListener {
return@on true
}
on(WESTLADDER, SCENERY,"Climb-up") { player, node ->
on(WESTLADDER, IntType.SCENERY, "Climb-up") { player, node ->
ClimbActionHandler.climb(player, Animation(828), Location.create(2631, 3664, 2))
return@on true
}
on(WESTTRAPDOOR.id, SCENERY,"Climb-down") { player, node ->
on(WESTTRAPDOOR.id, IntType.SCENERY, "Climb-down") { player, node ->
if(player.location.x < 2634){
ClimbActionHandler.climb(player, Animation(828), Location.create(2631, 3664, 0))
}
@@ -135,39 +136,39 @@ class SeersHouseListeners : InteractionListener {
return@on true
}
on(WESTTRAPDOOR.id, SCENERY,"Close") { player, node ->
on(WESTTRAPDOOR.id, IntType.SCENERY, "Close") { player, node ->
SceneryBuilder.replace(node.asScenery(), node.asScenery().transform(4174))
return@on true
}
on(WESTTRAPDOOR.id, SCENERY,"Open") { player, node ->
on(WESTTRAPDOOR.id, IntType.SCENERY, "Open") { player, node ->
SceneryBuilder.replace(node.asScenery(), node.asScenery().transform(4173))
return@on true
}
on(EASTTRAPDOOR.id, SCENERY,"Open") { player, node ->
on(EASTTRAPDOOR.id, IntType.SCENERY, "Open") { player, node ->
SceneryBuilder.replace(node.asScenery(), node.asScenery().transform(4173))
return@on true
}
on(EASTTRAPDOOR.id, SCENERY,"Close") { player, node ->
on(EASTTRAPDOOR.id, IntType.SCENERY, "Close") { player, node ->
SceneryBuilder.replace(node.asScenery(), node.asScenery().transform(4174))
return@on true
}
on(EASTTRAPDOOR.id, SCENERY,"Climb-down") { player, node ->
on(EASTTRAPDOOR.id, IntType.SCENERY, "Climb-down") { player, node ->
if(player.location.x > 2634){
ClimbActionHandler.climb(player, Animation(828), Location.create(2636, 3664, 0))
}
return@on true
}
on(EASTLADDER, SCENERY,"Climb-Up") { player, node ->
on(EASTLADDER, IntType.SCENERY, "Climb-Up") { player, node ->
ClimbActionHandler.climb(player, Animation(828), Location.create(2636, 3664, 2))
return@on true
}
on(CUPBOARD,SCENERY,"Search") { player, node ->
on(CUPBOARD, IntType.SCENERY, "Search") { player, node ->
sendMessage(player,"You search the cupboard...")
if(player.inventory.contains(EMPTYBUCKET,1)){
sendMessage(player,"You find nothing of interest.")
@@ -179,12 +180,12 @@ class SeersHouseListeners : InteractionListener {
return@on true
}
on(BALANCECHEST, SCENERY,"Open") { player, node ->
on(BALANCECHEST, IntType.SCENERY, "Open") { player, node ->
sendDialogue(player,"This chest is securely locked shut. There is some kind of balance attached to the lock, and a number four is painted just above it.")
return@on true
}
on(BOOKCASE, SCENERY,"Search") { player, node ->
on(BOOKCASE, IntType.SCENERY, "Search") { player, node ->
sendMessage(player,"You search the bookcase...")
if(player.inventory.contains(REDHERRING,1)){
sendMessage(player,"You find nothing of interest.")
@@ -196,7 +197,7 @@ class SeersHouseListeners : InteractionListener {
return@on true
}
on(SOUTHBOXES, SCENERY,"Search"){ player, node ->
on(SOUTHBOXES, IntType.SCENERY, "Search"){ player, node ->
sendMessage(player,"You search the boxes...")
if(player.inventory.contains(BLUETHREAD,1)){
sendMessage(player,"You find nothing of interest.")
@@ -208,17 +209,17 @@ class SeersHouseListeners : InteractionListener {
return@on true
}
on(CHEST, SCENERY,"Open"){ player, node ->
on(CHEST, IntType.SCENERY, "Open"){ player, node ->
SceneryBuilder.replace(node.asScenery(), node.asScenery().transform(4168))
return@on true
}
on(CHEST, SCENERY,"Close"){ player, node ->
on(CHEST, IntType.SCENERY, "Close"){ player, node ->
SceneryBuilder.replace(node.asScenery(), node.asScenery().transform(4167))
return@on true
}
on(CHEST, SCENERY,"Search"){ player, node ->
on(CHEST, IntType.SCENERY, "Search"){ player, node ->
sendMessage(player,"You search the chest...")
if(player.inventory.contains(EMPTYJUG,1)){
sendMessage(player,"You find nothing of interest.")
@@ -230,7 +231,7 @@ class SeersHouseListeners : InteractionListener {
return@on true
}
on(EASTCRATES, SCENERY,"Search") { player, node ->
on(EASTCRATES, IntType.SCENERY, "Search") { player, node ->
sendMessage(player,"You search the crates...")
if(player.inventory.contains(PICK,1)){
sendMessage(player,"You find nothing of interest.")
@@ -242,7 +243,7 @@ class SeersHouseListeners : InteractionListener {
return@on true
}
on(SOUTHCRATES, SCENERY,"Search") { player, node ->
on(SOUTHCRATES, IntType.SCENERY, "Search") { player, node ->
sendMessage(player,"You search the crates...")
if(player.inventory.contains(SHIPTOY,1)){
sendMessage(player,"You find nothing of interest.")
@@ -254,41 +255,17 @@ class SeersHouseListeners : InteractionListener {
return@on true
}
on(SOUTHBOXES, SCENERY,"Search") { player, node ->
sendMessage(player,"You search the boxes...")
if(player.inventory.contains(MAGNET,1)){
sendMessage(player,"You find nothing of interest.")
}
else{
addItem(player,MAGNET)
sendMessage(player,"You find a magnet hidden inside.")
}
return@on true
}
on(SOUTHBOXES, SCENERY,"Search") { player, node ->
sendMessage(player,"You search the boxes...")
if(player.inventory.contains(MAGNET,1)){
sendMessage(player,"You find nothing of interest.")
}
else{
addItem(player,MAGNET)
sendMessage(player,"You find a magnet hidden inside.")
}
return@on true
}
on(BULLSHEAD, SCENERY,"Study") { player, node ->
on(BULLSHEAD, IntType.SCENERY, "Study") { player, node ->
player.dialogueInterpreter.open(BullHeadDialogue(player))
return@on true
}
on(UNICORNHEAD, SCENERY,"Study") { player, node ->
on(UNICORNHEAD, IntType.SCENERY, "Study") { player, node ->
player.dialogueInterpreter.open(UnicornHeadDialogue(player))
return@on true
}
onUseWith(SCENERY,REDHERRING,COOKINGRANGE) { player, used, with ->
onUseWith(IntType.SCENERY,REDHERRING,COOKINGRANGE) { player, used, with ->
player.animate(Animation(883,Animator.Priority.HIGH))
player.audioManager.send(Audio(2577, 1, 1))
removeItem(player,REDHERRING)
@@ -297,19 +274,20 @@ class SeersHouseListeners : InteractionListener {
return@onUseWith true
}
onUseWith(ITEM,REDGOOP,WOODENDISK) { player, used, with ->
removeItem(player,WOODENDISK)
onUseWith(IntType.ITEM,REDGOOP,WOODENDISK) { player, used, with ->
removeItem(player, WOODENDISK)
removeItem(player, REDGOOP)
addItem(player,REDDISK)
sendMessage(player,"You coat the wooden coin with the sticky red goop.")
return@onUseWith true
}
on(MURAL, SCENERY,"Study") { player, node ->
on(MURAL, IntType.SCENERY, "Study") { player, node ->
sendMessage(player,"The mural feels like something is missing.")
return@on true
}
onUseWith(SCENERY, BUCKETS, TAP) { player, bucket, _ ->
onUseWith(IntType.SCENERY, BUCKETS, TAP) { player, bucket, _ ->
when(bucket.id){
3727 ->{
removeItem(player,EMPTYBUCKET)
@@ -345,7 +323,7 @@ class SeersHouseListeners : InteractionListener {
return@onUseWith true
}
onUseWith(SCENERY, JUGS, TAP) { player, used, with ->
onUseWith(IntType.SCENERY, JUGS, TAP) { player, used, with ->
when(used.id){
EMPTYJUG ->{
removeItem(player,EMPTYJUG)
@@ -369,7 +347,7 @@ class SeersHouseListeners : InteractionListener {
return@onUseWith true
}
onUseWith(SCENERY, BUCKETS, DRAIN) { player, used, with ->
onUseWith(IntType.SCENERY, BUCKETS, DRAIN) { player, used, with ->
when(used.id){
EMPTYBUCKET ->{
sendMessage(player,"The bucket is already empty!")
@@ -403,7 +381,7 @@ class SeersHouseListeners : InteractionListener {
return@onUseWith true
}
onUseWith(SCENERY, JUGS, DRAIN) { player, used, with ->
onUseWith(IntType.SCENERY, JUGS, DRAIN) { player, used, with ->
when(used.id){
EMPTYJUG ->{
sendMessage(player,"The jug is already empty!")
@@ -427,14 +405,7 @@ class SeersHouseListeners : InteractionListener {
return@onUseWith true
}
onUseWith(ITEM,REDGOOP,WOODENDISK) { player, _, _ ->
removeItem(player,REDGOOP)
removeItem(player,WOODENDISK)
addItem(player,REDDISK)
return@onUseWith true
}
onUseWith(SCENERY, FOURFIFTHBUCKET, BALANCECHEST) { player, used, with ->
onUseWith(IntType.SCENERY, FOURFIFTHBUCKET, BALANCECHEST) { player, used, with ->
removeItem(player,FOURFIFTHBUCKET)
addItem(player,VASE)
sendMessage(player,"You place the bucket on the scale.")
@@ -443,7 +414,7 @@ class SeersHouseListeners : InteractionListener {
return@onUseWith true
}
onUseWith(SCENERY, DISKS, MURAL) { player, used, with ->
onUseWith(IntType.SCENERY, DISKS, MURAL) { player, used, with ->
when(used.id){
REDDISK ->{
if(player.getAttribute("olddiskplaced",false)){
@@ -481,7 +452,7 @@ class SeersHouseListeners : InteractionListener {
return@onUseWith true
}
onUseWith(SCENERY, BUCKETS, BALANCECHEST) { player, used, with ->
onUseWith(IntType.SCENERY, BUCKETS, BALANCECHEST) { player, used, with ->
when(used.id){
EMPTYBUCKET ->{
player.animate(Animation(883,Animator.Priority.HIGH))
@@ -519,7 +490,7 @@ class SeersHouseListeners : InteractionListener {
return@onUseWith true
}
onUseWith(SCENERY, JUGS, BALANCECHEST) { player, used, with ->
onUseWith(IntType.SCENERY, JUGS, BALANCECHEST) { player, used, with ->
when(used.id){
EMPTYJUG ->{
player.animate(Animation(883,Animator.Priority.HIGH))
@@ -545,7 +516,7 @@ class SeersHouseListeners : InteractionListener {
return@onUseWith true
}
onUseWith(SCENERY, BUCKETS, FROZENTABLE) { player, used, with ->
onUseWith(IntType.SCENERY, BUCKETS, FROZENTABLE) { player, used, with ->
when(used.id){
EMPTYBUCKET -> sendMessage(player,"Your empty bucket gets very cold on the icy table.")
FULLBUCKET -> {
@@ -558,7 +529,7 @@ class SeersHouseListeners : InteractionListener {
return@onUseWith true
}
onUseWith(SCENERY, JUGS, FROZENTABLE) { player, used, with ->
onUseWith(IntType.SCENERY, JUGS, FROZENTABLE) { player, used, with ->
when(used.id){
EMPTYJUG -> sendMessage(player,"Your empty jug gets very cold on the icy table.")
FULLJUG -> {
@@ -571,7 +542,7 @@ class SeersHouseListeners : InteractionListener {
return@onUseWith true
}
onUseWith(ITEM,BUCKETS,*JUGS) { player, used, with ->
onUseWith(IntType.ITEM,BUCKETS,*JUGS) { player, used, with ->
when(used.id){
ONEFIFTHBUCKET -> {
when(with.id){
@@ -707,7 +678,7 @@ class SeersHouseListeners : InteractionListener {
return@onUseWith true
}
onUseWith(ITEM,JUGS,*BUCKETS) { player, used, with ->
onUseWith(IntType.ITEM,JUGS,*BUCKETS) { player, used, with ->
when(used.id){
ONETHIRDJUG->{
when(with.id){
@@ -833,30 +804,30 @@ class SeersHouseListeners : InteractionListener {
return@onUseWith true
}
on(VASE,ITEM,"Shake") { player, node ->
on(VASE, IntType.ITEM, "Shake") { player, node ->
sendDialogue(player,"You shake the strangely shaped Vase. From the sound of it there is something metallic inside, but the neck of th vase is too narrow for it to come out.")
return@on true
}
onUseWith(ITEM,PICK,VASE) { player, used, with ->
onUseWith(IntType.ITEM,PICK,VASE) { player, used, with ->
sendMessage(player,"The pick wouldn't be strong enough to break the vase open.")
return@onUseWith true
}
onUseWith(ITEM,MAGNET,VASE) { player, used, with ->
onUseWith(IntType.ITEM,MAGNET,VASE) { player, used, with ->
sendMessage(player,"You use the magnet on the vase. The metallic object inside moves.")
sendMessage(player,"The neck of the vase is too thin for thee object to come out of the vase.")
return@onUseWith true
}
onUseWith(SCENERY, VASE, TAP) { player, used, with ->
onUseWith(IntType.SCENERY, VASE, TAP) { player, used, with ->
removeItem(player,VASE)
addItem(player,FULLVASE)
sendMessage(player,"You fill the strange looking vase with water.")
return@onUseWith true
}
onUseWith(ITEM,FULLJUG,VASE) { player, used, with ->
onUseWith(IntType.ITEM,FULLJUG,VASE) { player, used, with ->
removeItem(player,FULLJUG)
removeItem(player,VASE)
addItem(player,EMPTYJUG)
@@ -865,12 +836,12 @@ class SeersHouseListeners : InteractionListener {
return@onUseWith true
}
on(FULLVASE,ITEM,"Shake") { player, node ->
on(FULLVASE, IntType.ITEM, "Shake") { player, node ->
sendDialogue(player,"You shake the strangely shaped vase. The water inside it sloshes a little. Some spills out of the neck of the vase.")
return@on true
}
onUseWith(ITEM,VASE,VASELID) { player, used, with ->
onUseWith(IntType.ITEM,VASE,VASELID) { player, used, with ->
removeItem(player,VASE)
removeItem(player,VASELID)
addItem(player,SEALEDEMPTYVASE)
@@ -878,7 +849,7 @@ class SeersHouseListeners : InteractionListener {
return@onUseWith true
}
onUseWith(ITEM,FULLVASE,VASELID) { player, used, with ->
onUseWith(IntType.ITEM,FULLVASE,VASELID) { player, used, with ->
removeItem(player,FULLVASE)
removeItem(player,VASELID)
addItem(player,SEALEDFULLVASE)
@@ -886,7 +857,7 @@ class SeersHouseListeners : InteractionListener {
return@onUseWith true
}
on(SEALEDEMPTYVASE,ITEM,"Remove-lid") { player, node ->
on(SEALEDEMPTYVASE, IntType.ITEM, "Remove-lid") { player, node ->
removeItem(player,SEALEDEMPTYVASE)
addItem(player,VASE)
addItem(player,VASELID)
@@ -894,7 +865,7 @@ class SeersHouseListeners : InteractionListener {
return@on true
}
on(SEALEDFULLVASE,ITEM,"Remove-lid") { player, node ->
on(SEALEDFULLVASE, IntType.ITEM, "Remove-lid") { player, node ->
removeItem(player,SEALEDFULLVASE)
addItem(player,VASE)
addItem(player,VASELID)
@@ -902,7 +873,7 @@ class SeersHouseListeners : InteractionListener {
return@on true
}
onUseWith(SCENERY, FULLVASE, FROZENTABLE) { player, used, with ->
onUseWith(IntType.SCENERY, FULLVASE, FROZENTABLE) { player, used, with ->
player.animate(Animation(883,Animator.Priority.HIGH))
removeItem(player,VASE)
addItem(player,FROZENVASE)
@@ -910,7 +881,7 @@ class SeersHouseListeners : InteractionListener {
return@onUseWith true
}
onUseWith(SCENERY, SEALEDFULLVASE, FROZENTABLE) { player, used, with ->
onUseWith(IntType.SCENERY, SEALEDFULLVASE, FROZENTABLE) { player, used, with ->
player.animate(Animation(883,Animator.Priority.HIGH))
removeItem(player,SEALEDFULLVASE)
addItem(player,FROZENKEY)
@@ -919,7 +890,7 @@ class SeersHouseListeners : InteractionListener {
return@onUseWith true
}
onUseWith(SCENERY, FROZENBUCKET, COOKINGRANGE) { player, used, with ->
onUseWith(IntType.SCENERY, FROZENBUCKET, COOKINGRANGE) { player, used, with ->
player.animate(Animation(883,Animator.Priority.HIGH))
player.audioManager.send(Audio(2577, 1, 1))
removeItem(player,FROZENBUCKET)
@@ -928,7 +899,7 @@ class SeersHouseListeners : InteractionListener {
return@onUseWith true
}
onUseWith(SCENERY, FROZENJUG, COOKINGRANGE) { player, used, with ->
onUseWith(IntType.SCENERY, FROZENJUG, COOKINGRANGE) { player, used, with ->
player.animate(Animation(883,Animator.Priority.HIGH))
player.audioManager.send(Audio(2577, 1, 1))
removeItem(player,FROZENJUG)
@@ -937,7 +908,7 @@ class SeersHouseListeners : InteractionListener {
return@onUseWith true
}
onUseWith(SCENERY, FROZENVASE, COOKINGRANGE) { player, used, with ->
onUseWith(IntType.SCENERY, FROZENVASE, COOKINGRANGE) { player, used, with ->
player.animate(Animation(883,Animator.Priority.HIGH))
player.audioManager.send(Audio(2577, 1, 1))
removeItem(player,FROZENVASE)
@@ -946,7 +917,7 @@ class SeersHouseListeners : InteractionListener {
return@onUseWith true
}
onUseWith(SCENERY, FROZENKEY, COOKINGRANGE) { player, used, with ->
onUseWith(IntType.SCENERY, FROZENKEY, COOKINGRANGE) { player, used, with ->
player.animate(Animation(883,Animator.Priority.HIGH))
player.audioManager.send(Audio(2577, 1, 1))
removeItem(player,FROZENKEY)
@@ -955,7 +926,7 @@ class SeersHouseListeners : InteractionListener {
return@onUseWith true
}
on(EASTDOOR, SCENERY,"Open") { player, node ->
on(EASTDOOR, IntType.SCENERY, "Open") { player, node ->
if(player.inventory.contains(SEERSKEY,1)){
player.setAttribute("/save:housepuzzlesolved",true)
player.inventory.clear()
@@ -21,6 +21,7 @@ import core.game.world.update.flag.context.Graphics
import org.rs09.consts.Items
import org.rs09.consts.NPCs
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
import rs09.game.system.config.ItemConfigParser
import rs09.game.world.GameWorld.Pulser
@@ -54,12 +55,12 @@ class TFTInteractionListeners : InteractionListener{
private val STEW_INGREDIENT_IDS = intArrayOf(Items.POTATO_1942,Items.ONION_1957,Items.CABBAGE_1965,Items.PET_ROCK_3695)
override fun defineListeners() {
onUseWith(NPC,BEER,WORKER){ player, beer, _ ->
onUseWith(IntType.NPC,BEER,WORKER){ player, beer, _ ->
player.dialogueInterpreter.open(CouncilWorkerFTDialogue(0,true,beer.id), NPC(WORKER))
return@onUseWith true
}
onUseWith(SCENERY, FISH, FISH_ALTAR){ player,fish,_ ->
onUseWith(IntType.SCENERY, FISH, FISH_ALTAR){ player,fish,_ ->
if(inInventory(player,Items.LYRE_3689) || inInventory(player,Items.ENCHANTED_LYRE_3690)) {
Pulser.submit(SpiritPulse(player, fish.id))
} else {
@@ -68,7 +69,7 @@ class TFTInteractionListeners : InteractionListener{
return@onUseWith true
}
onUseWith(ITEM,LOW_ALC_KEG,KEG){player,_,_ ->
onUseWith(IntType.ITEM,LOW_ALC_KEG,KEG){player,_,_ ->
if(!getAttribute(player,"fremtrials:keg-mixed",false)){
if(getAttribute(player,"fremtrials:cherrybomb",false)) {
removeItem(player,LOW_ALC_KEG)
@@ -83,7 +84,7 @@ class TFTInteractionListeners : InteractionListener{
return@onUseWith true
}
onUseWith(ITEM,TINDERBOX,CHERRY_BOMB){player,_,_ ->
onUseWith(IntType.ITEM,TINDERBOX,CHERRY_BOMB){player,_,_ ->
if(removeItem(player,CHERRY_BOMB)){
addItem(player,LIT_BOMB)
sendMessage(player,"You light the strange object.")
@@ -91,7 +92,7 @@ class TFTInteractionListeners : InteractionListener{
return@onUseWith true
}
onUseWith(ITEM,KNIFE,TREE_BRANCH){player,_,_ ->
onUseWith(IntType.ITEM,KNIFE,TREE_BRANCH){player,_,_ ->
if (!player.skills.hasLevel(Skills.CRAFTING,40)) {
sendDialogue(player, "You need 40 crafting to do this!")
return@onUseWith true
@@ -103,7 +104,7 @@ class TFTInteractionListeners : InteractionListener{
return@onUseWith true
}
onUseWith(SCENERY, STEW_INGREDIENT_IDS, LALLIS_STEW){player,stewIngredient,_ ->
onUseWith(IntType.SCENERY, STEW_INGREDIENT_IDS, LALLIS_STEW){player,stewIngredient,_ ->
when(stewIngredient.id){
Items.ONION_1957 -> {
sendDialogue(player,"You added an onion to the stew")
@@ -129,7 +130,7 @@ class TFTInteractionListeners : InteractionListener{
return@onUseWith true
}
onUseWith(SCENERY,GOLDEN_FLEECE,*SPINNING_WHEEL_IDS){ player, _, _ ->
onUseWith(IntType.SCENERY,GOLDEN_FLEECE,*SPINNING_WHEEL_IDS){ player, _, _ ->
if(removeItem(player,GOLDEN_FLEECE)){
addItem(player,GOLDEN_WOOL)
animate(player,896)
@@ -138,7 +139,7 @@ class TFTInteractionListeners : InteractionListener{
return@onUseWith true
}
onUseWith(ITEM,UNSTRUNG_LYRE,GOLDEN_WOOL){ player, _, _ ->
onUseWith(IntType.ITEM,UNSTRUNG_LYRE,GOLDEN_WOOL){ player, _, _ ->
if(player.getSkills().getLevel(Skills.FLETCHING) >= 25){
if(removeItem(player,GOLDEN_WOOL) &&
removeItem(player,Items.UNSTRUNG_LYRE_3688)){
@@ -150,7 +151,7 @@ class TFTInteractionListeners : InteractionListener{
return@onUseWith true
}
on(LONGHALL_BACKDOOR, SCENERY,"open"){player,door ->
on(LONGHALL_BACKDOOR, IntType.SCENERY, "open"){player,door ->
when {
getAttribute(player,"LyreEnchanted",false) -> {
sendNPCDialogue(player,1278,"Yeah you're good to go through. Olaf tells me you're some kind of outerlander bard here on tour. I doubt you're worse than Olaf is.")
@@ -166,7 +167,7 @@ class TFTInteractionListeners : InteractionListener{
return@on true
}
on(LYRE_IDs,ITEM,"play"){player,lyre ->
on(LYRE_IDs, IntType.ITEM, "play"){player,lyre ->
if(getAttribute(player,"onStage",false) && !getAttribute(player,"lyreConcertPlayed",false)){
Pulser.submit(LyreConcertPulse(player,lyre.id))
} else if(questStage(player, "Fremennik Trials") < 20 || !isQuestComplete(player, "Fremennik Trials")){
@@ -182,7 +183,7 @@ class TFTInteractionListeners : InteractionListener{
return@on true
}
on(PIPE,SCENERY,"put-inside"){ player, _ ->
on(PIPE, IntType.SCENERY, "put-inside"){ player, _ ->
if(inInventory(player,LIT_BOMB)){
sendMessage(player,"You stuff the lit object into the pipe.")
setAttribute(player,"/save:fremtrials:cherrybomb",true)
@@ -193,7 +194,7 @@ class TFTInteractionListeners : InteractionListener{
return@on true
}
on(PORTALIDs,SCENERY,"use"){ player, portal ->
on(PORTALIDs, IntType.SCENERY, "use"){ player, portal ->
player.properties?.teleportLocation = when(portal.id){
2273 -> DestRoom(2639, 10012, 2645, 10018).getCenter()
2274 -> DestRoom(2650, 10034, 2656, 10040).getCenter()
@@ -210,14 +211,14 @@ class TFTInteractionListeners : InteractionListener{
return@on true
}
on(SWENSEN_LADDER,SCENERY,"climb"){ player, _ ->
on(SWENSEN_LADDER, IntType.SCENERY, "climb"){ player, _ ->
if(!getAttribute(player,"fremtrials:swensen-accepted",false)){
sendNPCDialogue(player,1283,"Where do you think you're going?",FacialExpression.ANGRY)
}
return@on true
}
on(THORVALD_LADDER, SCENERY, "climb-down") { player, _ ->
on(THORVALD_LADDER, IntType.SCENERY, "climb-down") { player, _ ->
if (isQuestComplete(player, "Fremennik Trials") || getAttribute(player, "fremtrials:thorvald-vote", false)) {
sendMessage(player,"You have no reason to go back down there.")
return@on true
@@ -251,7 +252,7 @@ class TFTInteractionListeners : InteractionListener{
return@on true
}
on(THORVALD_LADDER_LOWER, SCENERY, "climb-up") { player, _ ->
on(THORVALD_LADDER_LOWER, IntType.SCENERY, "climb-up") { player, _ ->
if (player.getExtension<Any?>(KoscheiSession::class.java) != null) {
KoscheiSession.getSession(player).close()
}
@@ -259,12 +260,12 @@ class TFTInteractionListeners : InteractionListener{
return@on true
}
on(SWAYING_TREE,SCENERY,"cut-branch"){ player, node ->
on(SWAYING_TREE, IntType.SCENERY, "cut-branch"){ player, node ->
player.pulseManager.run(WoodcuttingSkillPulse(player, node as Scenery))
return@on true
}
on(SHOPNPCS,NPC,"Trade") { player, npc ->
on(SHOPNPCS, IntType.NPC, "Trade") { player, npc ->
if(isQuestComplete(player, "Fremennik Trials")){
npc.asNpc().openShop(player)
} else when(npc.id){
@@ -21,6 +21,7 @@ import org.rs09.consts.NPCs
import rs09.game.content.dialogue.DialogueBuilder
import rs09.game.content.dialogue.DialogueBuilderFile
import rs09.game.content.dialogue.DialogueFile
import rs09.game.interaction.IntType
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.InterfaceListener
import rs09.game.world.GameWorld
@@ -370,21 +371,21 @@ class TheGolemListeners : InteractionListener {
override fun defineDestinationOverrides() {
addClimbDest(Location.create(3492, 3089, 0), Location.create(2722, 4886, 0))
addClimbDest(Location.create(2721, 4884, 0), Location.create(3491, 3090, 0))
setDest(SCENERY, intArrayOf(34978), "climb-down") { _, _ -> return@setDest Location.create(3491, 3090, 0) }
setDest(SCENERY, intArrayOf(6372), "climb-up") { _, _ -> return@setDest Location.create(2722, 4886, 0) }
setDest(IntType.SCENERY, intArrayOf(34978), "climb-down") { _, _ -> return@setDest Location.create(3491, 3090, 0) }
setDest(IntType.SCENERY, intArrayOf(6372), "climb-up") { _, _ -> return@setDest Location.create(2722, 4886, 0) }
}
override fun defineListeners() {
onUseWith(NPC, Items.SOFT_CLAY_1761, 1907) { player, used, with -> return@onUseWith repairGolem(player) }
on(34978, SCENERY, "climb-down") { player, node -> ClimbActionHandler.climb(player, ClimbActionHandler.CLIMB_DOWN, SpecialLadders.getDestination(node.location)); return@on true }
on(6372, SCENERY, "climb-up") { player, node -> ClimbActionHandler.climb(player, ClimbActionHandler.CLIMB_UP, SpecialLadders.getDestination(node.location)); return@on true }
on(4615, ITEM, "read") { player, node ->
onUseWith(IntType.NPC, Items.SOFT_CLAY_1761, 1907) { player, used, with -> return@onUseWith repairGolem(player) }
on(34978, IntType.SCENERY, "climb-down") { player, node -> ClimbActionHandler.climb(player, ClimbActionHandler.CLIMB_DOWN, SpecialLadders.getDestination(node.location)); return@on true }
on(6372, IntType.SCENERY, "climb-up") { player, node -> ClimbActionHandler.climb(player, ClimbActionHandler.CLIMB_UP, SpecialLadders.getDestination(node.location)); return@on true }
on(4615, IntType.ITEM, "read") { player, node ->
player.setAttribute("ifaces:220:lines", LETTER_LINES)
player.setAttribute("/save:the-golem:read-elissa-letter", true)
openInterface(player, 220)
return@on true
}
on(35226, SCENERY, "search") { player, node ->
on(35226, IntType.SCENERY, "search") { player, node ->
player.packetDispatch.sendMessage("You search the bookcase.")
val readLetter = player.getAttribute("the-golem:read-elissa-letter", false)
if(!player.inventory.containsAtLeastOneItem(4616) && !player.bank.containsAtLeastOneItem(4616) && readLetter) {
@@ -395,8 +396,8 @@ class TheGolemListeners : InteractionListener {
}
return@on true
}
on(6363, SCENERY, "open") { player, node -> player.sendMessage("The door doesn't open."); return@on true }
on(6364, SCENERY, "enter") { player, node ->
on(6363, IntType.SCENERY, "open") { player, node -> player.sendMessage("The door doesn't open."); return@on true }
on(6364, IntType.SCENERY, "enter") { player, node ->
player.sendMessage("You step into the portal.")
if(!player.getAttribute("the-golem:seen-demon", false)) {
player.sendMessage("The room is dominated by a colossal horned skeleton!")
@@ -406,24 +407,24 @@ class TheGolemListeners : InteractionListener {
teleport(player, Location.create(3552, 4948, 0))
return@on true
}
on(6282, SCENERY, "enter") { player, node ->
on(6282, IntType.SCENERY, "enter") { player, node ->
player.sendMessage("You step into the portal.")
teleport(player, Location.create(2722, 4911, 0))
return@on true
}
onUseWith(SCENERY, Items.HAMMER_2347, 6301) { player, _, _ -> takeThroneGems(player); return@onUseWith true }
onUseWith(SCENERY, Items.CHISEL_1755, 6301) { player, _, _ -> takeThroneGems(player); return@onUseWith true }
on(646, NPC, "pickpocket") { player, node -> return@on pickpocketCurator(player, node) }
on(intArrayOf(24627, 24550), SCENERY, "study") { player, node -> return@on displayCase(player, node as Scenery) }
on(24627, SCENERY, "open") { player, node -> return@on openDisplayCase(player, node) }
onUseWith(SCENERY, 4618, 6309) { player, used, with -> return@onUseWith placeStatuette(player) }
on(intArrayOf(6307, 6308), SCENERY, "turn") { player, node -> turnStatuette(player, node as Scenery) }
onUseWith(ITEM, 233, 4620) { player, used, with -> return@onUseWith mortarOnMushroom(player) }
onUseWith(ITEM, 4621, 4622) { player, used, with -> return@onUseWith featherOnInk(player) }
onUseWith(ITEM, 970, 4623) { player, used, with -> return@onUseWith penOnPapyrus(player) }
onUseWith(NPC, 4619, 1907) { player, used, with -> return@onUseWith implementOnGolem(player) }
onUseWith(NPC, 4624, 1907) { player, used, with -> return@onUseWith programOnGolem(player, used, with) }
on(1911, NPC, "grab-feather") { player, node ->
onUseWith(IntType.SCENERY, Items.HAMMER_2347, 6301) { player, _, _ -> takeThroneGems(player); return@onUseWith true }
onUseWith(IntType.SCENERY, Items.CHISEL_1755, 6301) { player, _, _ -> takeThroneGems(player); return@onUseWith true }
on(646, IntType.NPC, "pickpocket") { player, node -> return@on pickpocketCurator(player, node) }
on(intArrayOf(24627, 24550), IntType.SCENERY, "study") { player, node -> return@on displayCase(player, node as Scenery) }
on(24627, IntType.SCENERY, "open") { player, node -> return@on openDisplayCase(player, node) }
onUseWith(IntType.SCENERY, 4618, 6309) { player, used, with -> return@onUseWith placeStatuette(player) }
on(intArrayOf(6307, 6308), IntType.SCENERY, "turn") { player, node -> turnStatuette(player, node as Scenery) }
onUseWith(IntType.ITEM, 233, 4620) { player, used, with -> return@onUseWith mortarOnMushroom(player) }
onUseWith(IntType.ITEM, 4621, 4622) { player, used, with -> return@onUseWith featherOnInk(player) }
onUseWith(IntType.ITEM, 970, 4623) { player, used, with -> return@onUseWith penOnPapyrus(player) }
onUseWith(IntType.NPC, 4619, 1907) { player, used, with -> return@onUseWith implementOnGolem(player) }
onUseWith(IntType.NPC, 4624, 1907) { player, used, with -> return@onUseWith programOnGolem(player, used, with) }
on(1911, IntType.NPC, "grab-feather") { player, node ->
if(player.getAttribute("the-golem:varmen-notes-read", false)) {
player.lock()
GameWorld.Pulser.submit(object : Pulse(){
@@ -7,6 +7,7 @@ import core.game.world.update.flag.context.Animation
import org.rs09.consts.Items
import org.rs09.consts.NPCs
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
import rs09.game.world.GameWorld
/**
@@ -17,7 +18,7 @@ class PickpocketSigmund : InteractionListener{
val SIGMUND = NPCs.SIGMUND_2082
override fun defineListeners() {
on(SIGMUND,NPC,"pickpocket"){player, node ->
on(SIGMUND, IntType.NPC, "pickpocket"){player, node ->
player.lock()
GameWorld.Pulser.submit(object : Pulse(){
var counter = 0
@@ -11,6 +11,7 @@ import core.plugin.Initializable
import org.rs09.consts.Items
import org.rs09.consts.NPCs
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
@Initializable
class KhazardWarlordNPC(id: Int = 0, location: Location? = null) : AbstractNPC(id,location), InteractionListener {
@@ -20,6 +20,7 @@ import rs09.game.content.dialogue.DialogueFile
import rs09.game.content.quest.members.tree.TreeGnomeVillage.Companion.mazeEntrance
import rs09.game.content.quest.members.tree.TreeGnomeVillage.Companion.mazeVillage
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
import rs09.game.world.GameWorld
class TreeGnomeVillageListeners : InteractionListener {
@@ -31,61 +32,61 @@ class TreeGnomeVillageListeners : InteractionListener {
private val strongholdDoor = 2184
override fun defineDestinationOverrides() {
setDest(NPC, intArrayOf(NPCs.TRACKER_GNOME_2_482),"talk-to"){ _, _ ->
setDest(IntType.NPC, intArrayOf(NPCs.TRACKER_GNOME_2_482),"talk-to"){ _, _ ->
return@setDest Location.create(2524, 3256, 0)
}
}
override fun defineListeners() {
on(NPCs.KING_BOLREN_469, NPC, "talk-to"){ player, npc ->
on(NPCs.KING_BOLREN_469, IntType.NPC, "talk-to"){ player, npc ->
openDialogue(player, KingBolrenDialogue(), npc)
return@on true
}
on(NPCs.ELKOY_5179, NPC, "talk-to"){ player, npc ->
on(NPCs.ELKOY_5179, IntType.NPC, "talk-to"){ player, npc ->
openDialogue(player, ElkoyDialogue(), npc)
return@on true
}
on(NPCs.ELKOY_5182, NPC, "talk-to"){ player, npc ->
on(NPCs.ELKOY_5182, IntType.NPC, "talk-to"){ player, npc ->
openDialogue(player, ElkoyDialogue(), npc)
return@on true
}
on(NPCs.ELKOY_5182, NPC, "follow"){ player, _ ->
on(NPCs.ELKOY_5182, IntType.NPC, "follow"){ player, _ ->
ElkoyDialogue().travelCutscene(player, if (player.location.y > 3161) mazeVillage else mazeEntrance)
return@on true
}
on(NPCs.COMMANDER_MONTAI_470, NPC, "talk-to"){ player, npc ->
on(NPCs.COMMANDER_MONTAI_470, IntType.NPC, "talk-to"){ player, npc ->
openDialogue(player, CommanderMontaiDialogue(), npc)
return@on true
}
on(NPCs.TRACKER_GNOME_1_481, NPC, "talk-to"){ player, npc ->
on(NPCs.TRACKER_GNOME_1_481, IntType.NPC, "talk-to"){ player, npc ->
openDialogue(player, TrackerGnomeOneDialogue(), npc)
return@on true
}
on(NPCs.TRACKER_GNOME_2_482, NPC, "talk-to"){ player, npc ->
on(NPCs.TRACKER_GNOME_2_482, IntType.NPC, "talk-to"){ player, npc ->
openDialogue(player, TrackerGnomeTwoDialogue(), npc)
return@on true
}
on(NPCs.TRACKER_GNOME_3_483, NPC, "talk-to"){ player, npc ->
on(NPCs.TRACKER_GNOME_3_483, IntType.NPC, "talk-to"){ player, npc ->
openDialogue(player, TrackerGnomeThreeDialogue(), npc)
return@on true
}
on(NPCs.KHAZARD_WARLORD_477, NPC, "talk-to"){ player, npc ->
on(NPCs.KHAZARD_WARLORD_477, IntType.NPC, "talk-to"){ player, npc ->
openDialogue(player, KhazardWarlordDialogue(), npc)
return@on true
}
on(NPCs.REMSAI_472, NPC, "talk-to"){ player, npc ->
on(NPCs.REMSAI_472, IntType.NPC, "talk-to"){ player, npc ->
openDialogue(player, RemsaiDialogue(), npc)
return@on true
}
on(NPCs.LOCAL_GNOME_484, NPC, "talk-to"){ player, npc ->
on(NPCs.LOCAL_GNOME_484, IntType.NPC, "talk-to"){ player, npc ->
openDialogue(player, LocalGnomeDialogue(), npc)
return@on true
}
on(ballista, SCENERY, "fire"){ player, _ ->
on(ballista, IntType.SCENERY, "fire"){ player, _ ->
openDialogue(player, BallistaDialogue())
return@on true
}
on(looseRailing, SCENERY, "squeeze-through"){ player, _ ->
on(looseRailing, IntType.SCENERY, "squeeze-through"){ player, _ ->
if(player.location != location(2516,3161,0)) {
squeezeThrough(player)
} else {
@@ -104,31 +105,31 @@ class TreeGnomeVillageListeners : InteractionListener {
}
return@on true
}
on(crumbledWall, SCENERY, "climb-over"){ player, _ ->
on(crumbledWall, IntType.SCENERY, "climb-over"){ player, _ ->
openDialogue(player, ClimbWall())
return@on true
}
on(closedChest, SCENERY, "open"){ player, node ->
on(closedChest, IntType.SCENERY, "open"){ player, node ->
SceneryBuilder.replace(node.asScenery(), Scenery(openedChest, node.location, node.asScenery().rotation),10)
val upperGuard: NPC = RegionManager.getNpc(player.location, NPCs.KHAZARD_COMMANDER_478, 6) ?: return@on true
upperGuard.sendChat("Oi. You! Get out of there.")
upperGuard.attack(player)
return@on true
}
on(openedChest, SCENERY, "search"){ player, _ ->
on(openedChest, IntType.SCENERY, "search"){ player, _ ->
if(!inInventory(player,Items.ORB_OF_PROTECTION_587)){
sendDialogue(player,"You search the chest. Inside you find the gnomes' stolen orb of protection.")
addItemOrDrop(player,Items.ORB_OF_PROTECTION_587)
}
return@on true
}
on(strongholdDoor, SCENERY, "open"){ player, node ->
on(strongholdDoor, IntType.SCENERY, "open"){ player, node ->
if(player.location.y >= 3251){
DoorActionHandler.handleAutowalkDoor(player, node as Scenery)
}
return@on true
}
on(NPCs.LIEUTENANT_SCHEPBUR_3817, NPC, "talk-to"){player, node ->
on(NPCs.LIEUTENANT_SCHEPBUR_3817, IntType.NPC, "talk-to"){player, node ->
openDialogue(player, LieutenantSchepburDialogue(),node)
return@on true
}
@@ -9,6 +9,7 @@ import core.game.world.map.Location
import core.game.world.update.flag.context.Animation
import org.rs09.consts.Items
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
class TribalTotemListeners : InteractionListener{
@@ -22,7 +23,7 @@ class TribalTotemListeners : InteractionListener{
val openChest = 2710
override fun defineListeners() {
on(frontDoor, SCENERY,"Open"){ player, door ->
on(frontDoor, IntType.SCENERY, "Open"){ player, door ->
if(player.questRepository.getStage("Tribal Totem") >= 35){
DoorActionHandler.handleAutowalkDoor(player,door.asScenery())
}
@@ -30,7 +31,7 @@ class TribalTotemListeners : InteractionListener{
return@on true
}
on(realCrate, SCENERY,"Investigate"){ player, node ->
on(realCrate, IntType.SCENERY, "Investigate"){ player, node ->
if(player.questRepository.getStage("Tribal Totem") in 1..19 && !player.inventory.containsAtLeastOneItem(Items.ADDRESS_LABEL_1858)){
sendDialogue(player,"There is a label on this crate. It says; To Lord Handelmort, Handelmort Mansion Ardogune.You carefully peel it off and take it.")
addItem(player,Items.ADDRESS_LABEL_1858,1)
@@ -41,19 +42,19 @@ class TribalTotemListeners : InteractionListener{
return@on true
}
on(wizCrate, SCENERY,"Investigate"){ player, node ->
on(wizCrate, IntType.SCENERY, "Investigate"){ player, node ->
sendDialogue(player,"There is a label on this crate: Senior Patents Clerk, Chamber of Invention, The Wizards' Tower, Misthalin. The crate is securely fastened shut and ready for delivery.")
return@on true
}
onUseWith(SCENERY,label,wizCrate){ player, used, with ->
onUseWith(IntType.SCENERY,label,wizCrate){ player, used, with ->
sendDialogue(player,"You carefully place the delivery address label over the existing label, covering it completely.")
removeItem(player,label)
player.questRepository.getQuest("Tribal Totem").setStage(player,20)
return@onUseWith true
}
on(lockedDoor, SCENERY,"Open"){ player, node ->
on(lockedDoor, IntType.SCENERY, "Open"){ player, node ->
if(player.getAttribute("TT:DoorUnlocked",false) == true){
DoorActionHandler.handleAutowalkDoor(player,node.asScenery())
}else{
@@ -62,7 +63,7 @@ class TribalTotemListeners : InteractionListener{
return@on true
}
on(stairs,SCENERY,"Climb-up"){ player, node ->
on(stairs, IntType.SCENERY, "Climb-up"){ player, node ->
if(player.getAttribute("TT:StairsChecked",false)){
ClimbActionHandler.climb(player, Animation(828), Location.create(2629, 3324, 1))
}
@@ -73,7 +74,7 @@ class TribalTotemListeners : InteractionListener{
return@on true
}
on(stairs, SCENERY,"Investigate"){ player, node ->
on(stairs, IntType.SCENERY, "Investigate"){ player, node ->
if(player.getSkills().getStaticLevel(Skills.THIEVING) >= 21){
sendDialogue(player,"Your trained senses as a thief enable you to see that there is a trap in these stairs. You make a note of its location for future reference when using these stairs")
player.setAttribute("/save:TT:StairsChecked",true)
@@ -83,17 +84,17 @@ class TribalTotemListeners : InteractionListener{
return@on true
}
on(closedChest, SCENERY,"Open"){ player, node ->
on(closedChest, IntType.SCENERY, "Open"){ player, node ->
SceneryBuilder.replace(node.asScenery(), node.asScenery().transform(2710))
return@on true
}
on(openChest,SCENERY,"Close"){ player, node ->
on(openChest, IntType.SCENERY, "Close"){ player, node ->
SceneryBuilder.replace(node.asScenery(), node.asScenery().transform(2709))
return@on true
}
on(openChest, SCENERY,"Search"){ player, node ->
on(openChest, IntType.SCENERY, "Search"){ player, node ->
if(!player.inventory.containsAtLeastOneItem(Items.TOTEM_1857)){
sendDialogue(player,"Inside the chest you find the tribal totem.")
addItem(player,Items.TOTEM_1857)
@@ -3,19 +3,20 @@ package rs09.game.content.quest.members.waterfall
import core.game.world.map.Location
import org.rs09.consts.NPCs
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
class WaterfallListeners : InteractionListener{
val HUDON = NPCs.HUDON_305
override fun defineListeners() {
on(HUDON,NPC,"talk-to"){player, node ->
on(HUDON, IntType.NPC, "talk-to"){player, node ->
player.dialogueInterpreter.open(HUDON,node.asNpc())
return@on true
}
}
override fun defineDestinationOverrides() {
setDest(NPC,HUDON){_,_ ->
setDest(IntType.NPC,HUDON){_,_ ->
return@setDest Location.create(2512, 3481, 0)
}
}
@@ -9,6 +9,7 @@ import core.game.system.task.Pulse
import core.game.world.map.Location
import org.rs09.consts.NPCs
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
import rs09.game.world.repository.Repository
/**
@@ -31,7 +32,7 @@ class TutorialListeners : InteractionListener {
val RAT_GATES = intArrayOf(3022, 3023)
override fun defineListeners() {
on(GUIDE_HOUSE_DOOR, SCENERY, "open"){player, door ->
on(GUIDE_HOUSE_DOOR, IntType.SCENERY, "open"){player, door ->
if(getAttribute(player, "tutorial:stage", 0) != 3)
return@on true
@@ -42,7 +43,7 @@ class TutorialListeners : InteractionListener {
return@on true
}
on(FIRST_GATE, SCENERY, "open"){player, gate ->
on(FIRST_GATE, IntType.SCENERY, "open"){player, gate ->
if(getAttribute(player, "tutorial:stage", 0) != 16)
return@on true
@@ -52,7 +53,7 @@ class TutorialListeners : InteractionListener {
return@on true
}
on(COOKS_DOOR, SCENERY, "open"){player, door ->
on(COOKS_DOOR, IntType.SCENERY, "open"){player, door ->
if(getAttribute(player, "tutorial:stage", 0) != 17)
return@on true
@@ -62,7 +63,7 @@ class TutorialListeners : InteractionListener {
return@on true
}
on(COOKS_EXIT, SCENERY, "open"){player, door ->
on(COOKS_EXIT, IntType.SCENERY, "open"){player, door ->
if(getAttribute(player, "tutorial:stage", 0) != 22)
return@on true
@@ -72,7 +73,7 @@ class TutorialListeners : InteractionListener {
return@on true
}
on(QUEST_ENTER, SCENERY, "open") {player, door ->
on(QUEST_ENTER, IntType.SCENERY, "open") {player, door ->
if(getAttribute(player, "tutorial:stage", 0) != 26)
return@on true
@@ -82,7 +83,7 @@ class TutorialListeners : InteractionListener {
return@on true
}
on(QUEST_LADDER, SCENERY, "climb-down") {player, ladder ->
on(QUEST_LADDER, IntType.SCENERY, "climb-down") {player, ladder ->
if(getAttribute(player, "tutorial:stage", 0) < 29)
return@on true
@@ -93,7 +94,7 @@ class TutorialListeners : InteractionListener {
ClimbActionHandler.climbLadder(player, ladder.asScenery(), "climb-down")
}
on(QUEST_EXIT_LADDER, SCENERY, "climb-up") { player, ladder ->
on(QUEST_EXIT_LADDER, IntType.SCENERY, "climb-up") { player, ladder ->
ClimbActionHandler.climbLadder(player, ladder.asScenery(), "climb-up")
submitWorldPulse(object : Pulse(2) {
@@ -107,7 +108,7 @@ class TutorialListeners : InteractionListener {
return@on true
}
on(COMBAT_GATES, SCENERY, "open"){player, gate ->
on(COMBAT_GATES, IntType.SCENERY, "open"){player, gate ->
if(getAttribute(player, "tutorial:stage", 0) != 43)
return@on true
@@ -116,7 +117,7 @@ class TutorialListeners : InteractionListener {
DoorActionHandler.handleAutowalkDoor(player, gate as Scenery)
}
on(RAT_GATES, SCENERY, "open") {player, gate ->
on(RAT_GATES, IntType.SCENERY, "open") {player, gate ->
val stage = getAttribute(player, "tutorial:stage", 0)
if(stage !in 50..53){
player.dialogueInterpreter.sendDialogues(NPCs.COMBAT_INSTRUCTOR_944, FacialExpression.ANGRY, "Oi, get away from there!","Don't enter my rat pen unless I say so!")
@@ -131,7 +132,7 @@ class TutorialListeners : InteractionListener {
return@on true
}
on(COMBAT_EXIT, SCENERY, "climb-up") {player, ladder ->
on(COMBAT_EXIT, IntType.SCENERY, "climb-up") {player, ladder ->
if(getAttribute(player, "tutorial:stage", 0) != 55)
return@on true
@@ -140,7 +141,7 @@ class TutorialListeners : InteractionListener {
ClimbActionHandler.climbLadder(player, ladder.asScenery(), "climb-up")
}
on(BANK_EXIT, SCENERY, "open") {player, door ->
on(BANK_EXIT, IntType.SCENERY, "open") {player, door ->
if(getAttribute(player, "tutorial:stage", 0) != 57)
return@on true
@@ -149,7 +150,7 @@ class TutorialListeners : InteractionListener {
DoorActionHandler.handleAutowalkDoor(player, door as Scenery)
}
on(FINANCE_EXIT, SCENERY, "open") {player,door ->
on(FINANCE_EXIT, IntType.SCENERY, "open") {player,door ->
if(getAttribute(player, "tutorial:stage", 0) != 59)
return@on true
@@ -158,7 +159,7 @@ class TutorialListeners : InteractionListener {
DoorActionHandler.handleAutowalkDoor(player, door as Scenery)
}
on(CHURCH_EXIT, SCENERY, "open") {player, door ->
on(CHURCH_EXIT, IntType.SCENERY, "open") {player, door ->
if(getAttribute(player, "tutorial:stage", 0) != 66)
return@on true
@@ -3,6 +3,7 @@ package rs09.game.content.zone
import api.*
import org.rs09.consts.Items
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
import core.game.content.global.action.ClimbActionHandler
import core.game.node.entity.skill.Skills
import core.game.node.entity.skill.agility.AgilityHandler
@@ -38,19 +39,19 @@ public class YanilleAgilityDungeonListeners : InteractionListener {
override fun defineListeners() {
ZoneBuilder.configure(YanilleAgilityDungeon());
on(1728, SCENERY, "climb-down") { player, _ ->
on(1728, IntType.SCENERY, "climb-down") { player, _ ->
player.teleport(Location(2620, 9565, 0))
return@on true
}
on(1729, SCENERY, "climb-up") { player, _ ->
on(1729, IntType.SCENERY, "climb-up") { player, _ ->
player.teleport(Location(2620, 9496, 0))
return@on true
}
on(2316, SCENERY, "climb-up") { player, _ ->
on(2316, IntType.SCENERY, "climb-up") { player, _ ->
player.teleport(Location.create(2569, 9525, 0))
return@on true
}
on(intArrayOf(2318, 2317), SCENERY, "climb-up", "climb-down") { player, target ->
on(intArrayOf(2318, 2317), IntType.SCENERY, "climb-up", "climb-down") { player, target ->
if (player.skills.getLevel(Skills.AGILITY) < 67) {
player.dialogueInterpreter.sendDialogue("You need an Agility level of at least 67 in order to do this.")
return@on true
@@ -61,11 +62,11 @@ public class YanilleAgilityDungeonListeners : InteractionListener {
player.skills.addExperience(Skills.AGILITY, 5.5, true)
return@on true
}
on(intArrayOf(35969, 2303), SCENERY, "walk-across") { player, target ->
on(intArrayOf(35969, 2303), IntType.SCENERY, "walk-across") { player, target ->
handleBalancingLedge(player, target.asScenery())
return@on true
}
on(377, SCENERY, "open") { player, target ->
on(377, IntType.SCENERY, "open") { player, target ->
if (!player.inventory.contains(Items.SINISTER_KEY_993, 1)) {
player.sendMessage("The chest is locked.")
} else {
@@ -85,11 +86,11 @@ public class YanilleAgilityDungeonListeners : InteractionListener {
}
return@on true
}
on(378, SCENERY, "search") { player, _ ->
on(378, IntType.SCENERY, "search") { player, _ ->
player.sendMessage("The chest is empty.")
return@on true
}
on(378, SCENERY, "shut") { player, _ ->
on(378, IntType.SCENERY, "shut") { player, _ ->
return@on true
}
@@ -9,6 +9,7 @@ import core.game.node.item.Item
import org.rs09.consts.Items
import org.rs09.consts.NPCs
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
import rs09.tools.END_DIALOGUE
/**It's just some simple Ordan dialogue
@@ -74,7 +75,7 @@ class OrdanDialogue(player: Player? = null) : DialoguePlugin(player) {
Items.RUNITE_ORE_452 to 1000
)
override fun defineListeners() {
onUseWith(NPC, NPCs.ORDAN_2564,*notedOre){ player, _, noteType ->
onUseWith(IntType.NPC, NPCs.ORDAN_2564,*notedOre){ player, _, noteType ->
val noteAmount = amountInInventory(player, noteType.id)
val noteName = noteType.name
var unNoteAmount = 0
@@ -11,6 +11,7 @@ import core.game.world.map.Location
import core.game.world.update.flag.context.Animation
import org.rs09.consts.Items
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
import rs09.game.world.GameWorld.Pulser
private const val LOADER = 11162
@@ -34,35 +35,35 @@ class BoneGrinderListener : InteractionListener {
/**
* Handle the bone loader/hopper fill option
*/
on(LOADER,SCENERY,"fill"){ player, _ ->
on(LOADER, IntType.SCENERY, "fill"){ player, _ ->
handleFill(player)
}
/**
* Handle the wheel's wind option
*/
on(BONE_GRINDER,SCENERY,"wind"){ player, _ ->
on(BONE_GRINDER, IntType.SCENERY, "wind"){ player, _ ->
handleWind(player)
}
/**
* Handle the wheel's status option
*/
on(BONE_GRINDER,SCENERY,"status"){ player, _ ->
on(BONE_GRINDER, IntType.SCENERY, "status"){ player, _ ->
handleStatus(player)
}
/**
* Handle the bin's empty option
*/
on(BIN,SCENERY,"empty"){ player, _ ->
on(BIN, IntType.SCENERY, "empty"){ player, _ ->
handleEmpty(player)
}
/**
* Handle Bone -> Hopper
*/
onUseWith(SCENERY,LOADER,*boneIDs){ player, _, _ ->
onUseWith(IntType.SCENERY,LOADER,*boneIDs){ player, _, _ ->
handleFill(player)
return@onUseWith true
}
@@ -99,10 +99,10 @@ class RevenantController : TickListener, Commands {
define("listrevs", Privilege.ADMIN) {player, strings ->
for (rev in trackedRevenants) {
SystemLogger.logInfo("REV ${rev.id}-${rev.name} @ ${rev.location.toString()}")
SystemLogger.logInfo(this::class.java, "REV ${rev.id}-${rev.name} @ ${rev.location.toString()}")
}
SystemLogger.logInfo("Total of ${trackedRevenants.size} revenants spawned.")
SystemLogger.logInfo(this::class.java, "Total of ${trackedRevenants.size} revenants spawned.")
}
define("clearrevs", Privilege.ADMIN) {_, _ ->
@@ -225,7 +225,7 @@ class GrandExchange : StartupListener, Commands {
if ( offer.offerState != OfferState.PENDING || offer.uid != 0L )
{
SystemLogger.logWarn("[GE] DISPATCH FAILURE: ${offer.offerState.name}, UID: ${offer.uid}")
SystemLogger.logWarn(this::class.java, "[GE] DISPATCH FAILURE: ${offer.offerState.name}, UID: ${offer.uid}")
return false
}
@@ -52,7 +52,7 @@ class FOGRewardsInterface : ComponentPlugin(){
176 -> choice = Air_Gloves
181 -> choice = Water_Gloves
186 -> choice = Earth_Gloves
else -> SystemLogger.logWarn("Unhandled button ID for FOG interface: $button").also { return true }
else -> SystemLogger.logWarn(this::class.java, "Unhandled button ID for FOG interface: $button").also { return true }
}
handleOpcode(choice,opcode,player!!)
return true
@@ -0,0 +1,9 @@
package rs09.game.interaction
enum class IntType {
ITEM,
SCENERY,
NPC,
GROUNDITEM,
PLAYER
}
@@ -8,45 +8,34 @@ import core.game.world.map.Location
import rs09.game.system.SystemLogger
interface InteractionListener : ContentInterface{
val ITEM: Int
get() = 0
val SCENERY: Int
get() = 1
val NPC: Int
get() = 2
val GROUNDITEM: Int
get() = 3
val PLAYER: Int
get() = 4
fun on(id: Int, type: Int, vararg option: String, handler: (player: Player, node: Node) -> Boolean){
InteractionListeners.add(id,type,option,handler)
fun on(id: Int, type: IntType, vararg option: String, handler: (player: Player, node: Node) -> Boolean){
InteractionListeners.add(id,type.ordinal,option,handler)
}
fun on(ids: IntArray, type: Int, vararg option: String, handler: (player: Player, node: Node) -> Boolean){
InteractionListeners.add(ids,type,option,handler)
fun on(ids: IntArray, type: IntType, vararg option: String, handler: (player: Player, node: Node) -> Boolean){
InteractionListeners.add(ids,type.ordinal,option,handler)
}
fun on(option: String, type: Int, handler: (player: Player, node: Node) -> Boolean){
InteractionListeners.add(option,type,handler)
fun on(option: String, type: IntType, handler: (player: Player, node: Node) -> Boolean){
InteractionListeners.add(option,type.ordinal,handler)
}
fun on(type: Int, vararg option: String, handler: (player: Player, node: Node) -> Boolean){
InteractionListeners.add(option,type,handler)
fun on(type: IntType, vararg option: String, handler: (player: Player, node: Node) -> Boolean){
InteractionListeners.add(option,type.ordinal,handler)
}
fun onUseWith(type: Int, used: Int, vararg with: Int, handler: (player: Player, used: Node, with: Node) -> Boolean){
InteractionListeners.add(type,used,with,handler)
fun onUseWith(type: IntType, used: Int, vararg with: Int, handler: (player: Player, used: Node, with: Node) -> Boolean){
InteractionListeners.add(type.ordinal,used,with,handler)
}
fun onUseWith(type: Int, used: IntArray, vararg with: Int, handler: (player: Player, used: Node, with: Node) -> Boolean){
InteractionListeners.add(type,used,with,handler)
fun onUseWith(type: IntType, used: IntArray, vararg with: Int, handler: (player: Player, used: Node, with: Node) -> Boolean){
InteractionListeners.add(type.ordinal,used,with,handler)
}
fun onUseAnyWith(type: Int, vararg with: Int, handler: (player: Player, used: Node, with: Node) -> Boolean) {
InteractionListeners.add(type, with, handler)
fun onUseAnyWith(type: IntType, vararg with: Int, handler: (player: Player, used: Node, with: Node) -> Boolean) {
InteractionListeners.add(type.ordinal, with, handler)
}
fun onUseWithPlayer(vararg used: Int, handler: (player: Player, used: Node, with: Node) -> Boolean) {
InteractionListeners.add(PLAYER, used, handler)
}
// Note: wildcard listeners incur overhead on every use-with interaction, only use them as a space-time tradeoff when something
// is actually supposed to have a response to every item used with it (e.g. imp boxes, certain quest npcs)
fun onUseWithWildcard(type: Int, predicate: (used: Int, with: Int) -> Boolean, handler: (player: Player, used: Node, with: Node) -> Boolean) {
InteractionListeners.addWildcard(type, predicate, handler)
fun onUseWithWildcard(type: IntType, predicate: (used: Int, with: Int) -> Boolean, handler: (player: Player, used: Node, with: Node) -> Boolean) {
InteractionListeners.addWildcard(type.ordinal, predicate, handler)
}
fun onEquip(id: Int, handler: (player: Player, node: Node) -> Boolean){
InteractionListeners.addEquip(id,handler)
@@ -64,15 +53,15 @@ interface InteractionListener : ContentInterface{
fun defineDestinationOverrides(){}
fun setDest(type: Int, id: Int,handler: (Entity, Node) -> Location){
InteractionListeners.addDestOverride(type,id,handler)
fun setDest(type: IntType, id: Int,handler: (Entity, Node) -> Location){
InteractionListeners.addDestOverride(type.ordinal,id,handler)
}
fun setDest(type:Int, vararg options: String, handler: (Entity, Node) -> Location){
InteractionListeners.addDestOverrides(type,options,handler)
fun setDest(type: IntType, vararg options: String, handler: (Entity, Node) -> Location){
InteractionListeners.addDestOverrides(type.ordinal,options,handler)
}
fun setDest(type: Int, ids: IntArray, vararg options: String, handler: (Entity, Node) -> Location){
InteractionListeners.addDestOverrides(type,ids,options,handler)
fun setDest(type: IntType, ids: IntArray, vararg options: String, handler: (Entity, Node) -> Location){
InteractionListeners.addDestOverrides(type.ordinal,ids,options,handler)
}
fun onDig(location: Location,method: (player: Player) -> Unit){
@@ -23,10 +23,17 @@ object InteractionListeners {
fun add(id: Int, type: Int, option: Array<out String>, method: (Player,Node) -> Boolean){
for(opt in option) {
val key = "$id:$type:${opt.toLowerCase()}"
if (!validate(key)) {
throw IllegalStateException("$opt for $id with type ${IntType.values()[type].name} already defined! Existing use: [${listeners[key]!!::class.toString()}]")
}
listeners[key] = method
}
}
private fun validate(key: String): Boolean {
return !listeners.containsKey(key) && !useWithListeners.containsKey(key)
}
@JvmStatic
fun add(ids: IntArray, type: Int, option: Array<out String>, method: (Player,Node) -> Boolean){
for(id in ids){
@@ -37,6 +44,9 @@ object InteractionListeners {
@JvmStatic
fun add(option: String,type: Int, method: (Player,Node) -> Boolean){
val key = "$type:${option.toLowerCase()}"
if (!validate(key)) {
throw IllegalStateException("Catchall listener for $option on type ${IntType.values()[type].name} already in use: ${listeners[key]!!::class}")
}
listeners[key] = method
}
@@ -49,13 +59,18 @@ object InteractionListeners {
@JvmStatic
fun add(used: Int, with: Int, type: Int, method: (Player,Node,Node) -> Boolean){
useWithListeners["$used:$with:$type"] = method
val key = "$used:$with:$type"
val altKey = "$with:$used:$type"
if (!validate(key) || !validate(altKey)) {
throw IllegalStateException("Usewith using $used with $with for type ${IntType.values()[type]} already in use: [${(useWithListeners[key] ?: useWithListeners[altKey])!!::class}")
}
useWithListeners[key] = method
}
@JvmStatic
fun add(type: Int, used: Int, with: IntArray, method: (Player, Node, Node) -> Boolean){
for(id in with){
useWithListeners["$used:$id:$type"] = method
add(used = used, with = id, type = type, method = method)
}
}
@@ -159,11 +174,10 @@ object InteractionListeners {
}
@JvmStatic
fun run(used: Node, with: Node, type: Int,player: Player): Boolean{
player.debug("InteractionListeners.run(${used.id}, ${with.id}, ${type}, _)")
fun run(used: Node, with: Node, type: IntType, player: Player): Boolean{
val flag = when(type){
2, 4 -> DestinationFlag.ENTITY
1 -> DestinationFlag.OBJECT
IntType.NPC, IntType.PLAYER -> DestinationFlag.ENTITY
IntType.SCENERY -> DestinationFlag.OBJECT
else -> DestinationFlag.OBJECT
}
@@ -172,19 +186,19 @@ object InteractionListeners {
var flipped = false
val method = if (with is Player) get(-1, used.id, 4) ?: return false
else get(used.id,with.id,type) ?:
if (type == InteractionListener.ITEM)
get(with.id,used.id,type).also { flipped = true } ?: return false
else get(used.id,with.id,type.ordinal) ?:
if (type == IntType.ITEM)
get(with.id,used.id,type.ordinal).also { flipped = true } ?: return false
else return false
val destOverride = if(flipped) {
getOverride(type, used.id, "use") ?: getOverride(type, with.id) ?: getOverride(type, "use")
getOverride(type.ordinal, used.id, "use") ?: getOverride(type.ordinal, with.id) ?: getOverride(type.ordinal, "use")
} else {
getOverride(type, with.id, "use") ?: getOverride(type, used.id) ?: getOverride(type, "use")
getOverride(type.ordinal, with.id, "use") ?: getOverride(type.ordinal, used.id) ?: getOverride(type.ordinal, "use")
}
if(type != 0 && !isUseWithInstant(method)) {
if(type != IntType.ITEM && !isUseWithInstant(method)) {
if(player.locks.isMovementLocked) return false
player.pulseManager.run(object : MovementPulse(player, with, flag, destOverride) {
override fun pulse(): Boolean {
@@ -209,19 +223,19 @@ object InteractionListeners {
}
@JvmStatic
fun run(id: Int, type: Int, option: String, player: Player, node: Node): Boolean{
fun run(id: Int, type: IntType, option: String, player: Player, node: Node): Boolean{
val flag = when(type){
4 -> DestinationFlag.ENTITY
3 -> DestinationFlag.ITEM
2 -> DestinationFlag.ENTITY
1 -> null
IntType.PLAYER -> DestinationFlag.ENTITY
IntType.GROUNDITEM -> DestinationFlag.ITEM
IntType.NPC -> DestinationFlag.ENTITY
IntType.ITEM -> null
else -> DestinationFlag.OBJECT
}
if(player.locks.isInteractionLocked) return false
val method = get(id,type,option) ?: get(option,type) ?: return false
val destOverride = getOverride(type, id, option) ?: getOverride(type,node.id) ?: getOverride(type,option.toLowerCase())
val method = get(id,type.ordinal,option) ?: get(option,type.ordinal) ?: return false
val destOverride = getOverride(type.ordinal, id, option) ?: getOverride(type.ordinal,node.id) ?: getOverride(type.ordinal,option.toLowerCase())
player.setAttribute("interact:option", option)
@@ -232,7 +246,7 @@ object InteractionListeners {
return true
}
if(type != 0 && !isInstant(method)) {
if(type != IntType.ITEM && !isInstant(method)) {
if(player.locks.isMovementLocked) return false
player.pulseManager.run(object : MovementPulse(player, node, flag, destOverride) {
override fun pulse(): Boolean {
@@ -70,7 +70,7 @@ class ExperienceInterface() : ComponentPlugin() {
46 -> Skills.WOODCUTTING
40 -> Skills.FLETCHING
51 -> Skills.CONSTRUCTION
else -> Skills.SLAYER.also { SystemLogger.logWarn("EXP_INTERFACE: Invalid SKILL CHOICE BUTTON: $button") }
else -> Skills.SLAYER.also { SystemLogger.logWarn(this::class.java, "EXP_INTERFACE: Invalid SKILL CHOICE BUTTON: $button") }
}
player.setAttribute("exp_interface:skill",skill)
}
@@ -2,7 +2,6 @@ package rs09.game.interaction.inter.ge
import api.*
import core.game.component.Component
import core.game.container.access.BitregisterAssembler
import core.game.ge.OfferState
import core.game.node.entity.player.Player
import core.game.node.entity.player.link.audio.Audio
@@ -125,7 +124,8 @@ class StockMarket : InterfaceListener {
149, "IviiiIsssss", "", "", "", "Examine", "Offer",
-1, 0, 7, 4, 93, 7012370
)
BitregisterAssembler.send(player, 107, 18, 0, 27, BitregisterAssembler(0, 1))
val settings = IfaceSettingsBuilder().enableOptions(0, 1).build()
player.packetDispatch.sendIfaceSettings(settings, 18, 107, 0, 27)
}
157 -> updateOfferAmount(player, tempOffer, tempOffer.amount - 1)
159 -> updateOfferAmount(player, tempOffer, tempOffer.amount + 1)
@@ -199,7 +199,7 @@ class StockMarket : InterfaceListener {
{
if(offer == null)
{
SystemLogger.logWarn("Opened offer was null and was attempted to be aborted!")
SystemLogger.logWarn(this::class.java, "Opened offer was null and was attempted to be aborted!")
return
}
sendMessage(player, "Abort request acknowledged. Please be aware that your offer may")
@@ -207,7 +207,7 @@ class StockMarket : InterfaceListener {
if(!offer.isActive)
{
SystemLogger.logWarn("Offer ${offer.uid}[${offer.index}]: ${if(offer.sell) "s" else "b"} ${offer.itemID}x ${offer.amount} was NO LONGER active when abort attempted")
SystemLogger.logWarn(this::class.java, "Offer ${offer.uid}[${offer.index}]: ${if(offer.sell) "s" else "b"} ${offer.itemID}x ${offer.amount} was NO LONGER active when abort attempted")
return
}
offer.offerState = OfferState.ABORTED
@@ -341,7 +341,7 @@ class StockMarket : InterfaceListener {
val item = offer.withdraw[index]
if(item == null)
{
SystemLogger.logWarn("Offer withdraw[$index] is null!")
SystemLogger.logWarn(this::class.java, "Offer withdraw[$index] is null!")
return
}
@@ -3,6 +3,7 @@ package rs09.game.interaction.item
import api.*
import org.rs09.consts.Items
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
/**
* Handles the bracelet of clay operate option.
@@ -12,7 +13,7 @@ class BraceletOfClayPlugin : InteractionListener {
override fun defineListeners() {
on(Items.BRACELET_OF_CLAY_11074, ITEM, "operate"){ player, node ->
on(Items.BRACELET_OF_CLAY_11074, IntType.ITEM, "operate"){ player, node ->
var charge = getCharge(node)
if (charge > 28) setCharge(node, 28).also { charge = 28 }
sendMessage(player, "You have $charge uses left.")
@@ -3,6 +3,7 @@ package rs09.game.interaction.`object`
import api.sendItemDialogue
import org.rs09.consts.Items
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
/**
* @author bushtail
@@ -13,11 +14,11 @@ class CadavaPotionListener : InteractionListener {
var POTION = Items.CADAVA_POTION_756
override fun defineListeners() {
on(POTION, ITEM, "drink") { player, node ->
on(POTION, IntType.ITEM, "drink") { player, node ->
sendItemDialogue(player, POTION, "You dare not drink.")
return@on true
}
on(POTION, ITEM, "look-at") { player, node ->
on(POTION, IntType.ITEM, "look-at") { player, node ->
sendItemDialogue(player, POTION, "This looks very colourful.")
return@on true
}
@@ -3,11 +3,12 @@ package rs09.game.interaction.item
import api.*
import org.rs09.consts.Items
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
class DrinkBlamishOilListener : InteractionListener {
override fun defineListeners() {
on(Items.BLAMISH_OIL_1582, ITEM, "drink"){player, _ ->
on(Items.BLAMISH_OIL_1582, IntType.ITEM, "drink"){player, _ ->
sendPlayerDialogue(player, "You know... I'd really rather not.")
return@on true
}
@@ -63,7 +63,7 @@ class EnchantJewelleryTabOption : OptionHandler(){
}
if(items == null){
SystemLogger.logWarn("UNHANDLED ENCHANT ITEM TABLET [ID: ${node?.id}")
SystemLogger.logWarn(this::class.java, "UNHANDLED ENCHANT ITEM TABLET [ID: ${node?.id}")
return true
}
@@ -8,11 +8,12 @@ import rs09.game.content.dialogue.DialogueFile
import rs09.game.content.dialogue.IfTopic
import rs09.game.content.dialogue.Topic
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
import rs09.tools.END_DIALOGUE
class EnchantedGemListener : InteractionListener {
override fun defineListeners() {
on(Items.ENCHANTED_GEM_4155, ITEM, "activate") { player, _ ->
on(Items.ENCHANTED_GEM_4155, IntType.ITEM, "activate") { player, _ ->
openDialogue(player, EnchantedGemDialogue())
return@on true
}
@@ -9,6 +9,7 @@ import core.game.node.item.Item
import rs09.game.content.dialogue.DialogueFile
import rs09.game.content.global.EnchantedJewellery
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
import rs09.tools.START_DIALOGUE
/**
@@ -20,11 +21,11 @@ class EnchantedJewelleryListener : InteractionListener {
val ids = EnchantedJewellery.idMap.keys.toIntArray()
override fun defineListeners() {
on(ids, ITEM, "operate") { player, node ->
on(ids, IntType.ITEM, "operate") { player, node ->
handle(player, node, true)
return@on true
}
on(ids, ITEM, "rub") { player, node ->
on(ids, IntType.ITEM, "rub") { player, node ->
handle(player, node, false)
return@on true
}
@@ -7,6 +7,7 @@ import core.game.world.update.flag.context.Animation
import org.rs09.consts.Items
import rs09.game.content.dialogue.DialogueFile
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
import rs09.tools.END_DIALOGUE
class GodBookListeners : InteractionListener {
@@ -16,17 +17,17 @@ class GodBookListeners : InteractionListener {
val GB_GUTHIX = Items.BOOK_OF_BALANCE_3844
override fun defineListeners() {
on(GB_SARADOMIN, ITEM, "preach"){player, _ ->
on(GB_SARADOMIN, IntType.ITEM, "preach"){player, _ ->
openDialogue(player, HOLY_DIALOGUE(BOOK.SARA))
return@on true
}
on(GB_ZAMORAK, ITEM, "preach"){ player, _ ->
on(GB_ZAMORAK, IntType.ITEM, "preach"){ player, _ ->
openDialogue(player, HOLY_DIALOGUE(BOOK.ZAM))
return@on true
}
on(GB_GUTHIX, ITEM, "preach"){ player, _ ->
on(GB_GUTHIX, IntType.ITEM, "preach"){ player, _ ->
openDialogue(player, HOLY_DIALOGUE(BOOK.GUTHIX))
return@on true
}
@@ -16,6 +16,7 @@ import core.plugin.Initializable
import core.plugin.Plugin
import org.rs09.consts.Items
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
import rs09.game.world.GameWorld
import api.*
@@ -33,7 +34,7 @@ private const val LAUNCH_ANIMATION = 4547
class GrandSeedPodHandler : InteractionListener {
override fun defineListeners() {
on(Items.GRAND_SEED_POD_9469, ITEM, "squash", "launch"){player, _ ->
on(Items.GRAND_SEED_POD_9469, IntType.ITEM, "squash", "launch"){player, _ ->
when(getUsedOption(player)){
"launch" -> submitWorldPulse(LaunchPulse(player))
"squash" -> submitWorldPulse(SquashPulse(player))
@@ -7,6 +7,7 @@ import org.rs09.consts.Items
import rs09.game.content.global.WeightBasedTable
import rs09.game.content.global.WeightedItem
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
import rs09.game.system.SystemLogger
class ImplingJarListener : InteractionListener {
@@ -14,7 +15,7 @@ class ImplingJarListener : InteractionListener {
val JARS = ImplingLoot.values().map { it.jarId }.toIntArray()
override fun defineListeners() {
on(JARS, ITEM, "loot"){player, node ->
on(JARS, IntType.ITEM, "loot"){player, node ->
val jar = node.asItem()
val loot = ImplingLoot.forId(jar.id)?.roll()?.first() ?: return@on false

Some files were not shown because too many files have changed in this diff Show More