bufxiezds

This commit is contained in:
Ceikry
2021-03-20 22:41:43 -05:00
parent 61b08b18be
commit 2189b907d9
8 changed files with 28 additions and 11 deletions
@@ -9,6 +9,8 @@ import core.game.world.map.zone.ZoneBorders
import org.rs09.consts.Items import org.rs09.consts.Items
import rs09.game.ai.general.ScriptAPI import rs09.game.ai.general.ScriptAPI
import rs09.game.ai.skillingbot.SkillingBotAssembler import rs09.game.ai.skillingbot.SkillingBotAssembler
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.InteractionListeners
@PlayerCompatible @PlayerCompatible
@ScriptName("Falador Coal Miner") @ScriptName("Falador Coal Miner")
@@ -52,7 +54,7 @@ class CoalMiner() : Script() {
scriptAPI.walkTo(mine.randomLoc) scriptAPI.walkTo(mine.randomLoc)
} else { } else {
val rock = scriptAPI.getNearestNode("rocks",true) val rock = scriptAPI.getNearestNode("rocks",true)
rock?.interaction?.handle(bot,rock.interaction[0]) rock?.let { InteractionListeners.run(rock.id, InteractionListener.OBJECT,"mine",bot,rock) }
} }
overlay!!.setAmount(bot.inventory.getAmount(Items.COAL_453) + coalAmount) overlay!!.setAmount(bot.inventory.getAmount(Items.COAL_453) + coalAmount)
} }
@@ -7,6 +7,8 @@ import core.game.node.entity.skill.Skills
import core.game.node.item.Item import core.game.node.item.Item
import core.game.world.map.zone.ZoneBorders import core.game.world.map.zone.ZoneBorders
import org.rs09.consts.Items import org.rs09.consts.Items
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.InteractionListeners
import rs09.tools.stringtools.colorize import rs09.tools.stringtools.colorize
@PlayerCompatible @PlayerCompatible
@@ -39,7 +41,8 @@ class DraynorWillows : Script(){
scriptAPI.walkTo(willowZone.randomLoc) scriptAPI.walkTo(willowZone.randomLoc)
else { else {
val willowtree = scriptAPI.getNearestNode("willow", true) val willowtree = scriptAPI.getNearestNode("willow", true)
willowtree?.interaction?.handle(bot, willowtree.interaction[0]) willowtree?.let { InteractionListeners.run(willowtree.id,
InteractionListener.OBJECT,"chop",bot,willowtree) }
if (bot.inventory.isFull) if (bot.inventory.isFull)
state = State.BANKING state = State.BANKING
} }
@@ -13,6 +13,8 @@ import core.tools.RandomFunction
import org.rs09.consts.Items import org.rs09.consts.Items
import rs09.game.ai.AIPlayer import rs09.game.ai.AIPlayer
import rs09.game.ai.general.ScriptAPI import rs09.game.ai.general.ScriptAPI
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.InteractionListeners
import rs09.game.world.GameWorld import rs09.game.world.GameWorld
import kotlin.random.Random import kotlin.random.Random
@@ -71,7 +73,7 @@ class LobsterCatcher : Script() {
if(spot == null){ if(spot == null){
state = State.IDLE state = State.IDLE
} else { } else {
spot!!.interaction.handle(bot, spot.interaction[0]) InteractionListeners.run(spot.id,InteractionListener.NPC,"cage",bot,spot)
} }
if(bot.inventory.isFull){ if(bot.inventory.isFull){
state = State.FIND_BANK state = State.FIND_BANK
@@ -10,6 +10,8 @@ import core.tools.RandomFunction
import org.rs09.consts.Items import org.rs09.consts.Items
import rs09.game.ai.general.ScriptAPI import rs09.game.ai.general.ScriptAPI
import rs09.game.ai.skillingbot.SkillingBotAssembler import rs09.game.ai.skillingbot.SkillingBotAssembler
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.InteractionListeners
@PlayerCompatible @PlayerCompatible
@ScriptName("Seers Magics") @ScriptName("Seers Magics")
@@ -37,7 +39,7 @@ class SeersMagicTrees : Script(){
State.CHOPPING -> { State.CHOPPING -> {
val tree = scriptAPI.getNearestNode(1306,true) val tree = scriptAPI.getNearestNode(1306,true)
tree?.interaction?.handle(bot,tree.interaction[0]) tree?.let { InteractionListeners.run(tree.id, InteractionListener.OBJECT,"chop",bot,tree) }
if(bot.inventory.isFull){ if(bot.inventory.isFull){
state = State.FIND_BANK state = State.FIND_BANK
} }
@@ -10,6 +10,8 @@ import org.rs09.consts.Items
import rs09.game.ai.AIPlayer import rs09.game.ai.AIPlayer
import rs09.game.ai.general.ScriptAPI import rs09.game.ai.general.ScriptAPI
import rs09.game.ge.OfferManager import rs09.game.ge.OfferManager
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.InteractionListeners
import kotlin.random.Random import kotlin.random.Random
/* /*
@@ -115,7 +117,7 @@ class SharkCatcher : Script() {
if (Random.nextBoolean()) { if (Random.nextBoolean()) {
tick = 0 tick = 0
val spot = scriptAPI.getNearestNode(334, false) val spot = scriptAPI.getNearestNode(334, false)
spot!!.interaction.handle(bot, spot.interaction[2]) spot?.let { InteractionListeners.run(spot.id, InteractionListener.NPC,"harpoon",bot,spot) }
if(bot.inventory.isFull){ if(bot.inventory.isFull){
state = State.FIND_BANK state = State.FIND_BANK
} else { } else {
@@ -6,6 +6,8 @@ import core.game.world.map.Location
import core.game.world.map.zone.ZoneBorders import core.game.world.map.zone.ZoneBorders
import org.rs09.consts.Items import org.rs09.consts.Items
import rs09.game.ai.skillingbot.SkillingBotAssembler import rs09.game.ai.skillingbot.SkillingBotAssembler
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.InteractionListeners
@PlayerCompatible @PlayerCompatible
@ScriptDescription("Start in varrock bank with rune mysteries complete and a pickaxe equipped/in inventory") @ScriptDescription("Start in varrock bank with rune mysteries complete and a pickaxe equipped/in inventory")
@@ -47,7 +49,7 @@ class VarrockEssenceMiner : Script(){
State.MINING -> { State.MINING -> {
val essence = scriptAPI.getNearestNode(2491,true) val essence = scriptAPI.getNearestNode(2491,true)
essence?.interaction?.handle(bot,essence.interaction[0]) essence?.let { InteractionListeners.run(essence.id, InteractionListener.OBJECT,"mine",bot,essence) }
if(bot.inventory.isFull) if(bot.inventory.isFull)
state = State.TO_BANK state = State.TO_BANK
} }
@@ -5,9 +5,11 @@ import core.game.node.entity.player.Player
import core.game.world.map.Location import core.game.world.map.Location
abstract class InteractionListener : Listener{ abstract class InteractionListener : Listener{
val ITEM = 0 companion object {
val OBJECT = 1 val ITEM = 0
val NPC = 2 val OBJECT = 1
val NPC = 2
}
fun on(id: Int, type: Int, vararg option: String,handler: (player: Player, node: Node) -> Boolean){ fun on(id: Int, type: Int, vararg option: String,handler: (player: Player, node: Node) -> Boolean){
InteractionListeners.add(id,type,option,handler) InteractionListeners.add(id,type,option,handler)
} }
@@ -41,7 +41,8 @@ enum class Pickpockets(val ids: IntArray, val requiredLevel: Int, val low: Doubl
WeightedItem(Items.RUSTY_SWORD_686,1,1,3.5), WeightedItem(Items.RUSTY_SWORD_686,1,1,3.5),
WeightedItem(Items.BROKEN_ARMOUR_698,1,1,3.5), WeightedItem(Items.BROKEN_ARMOUR_698,1,1,3.5),
WeightedItem(Items.BROKEN_STAFF_689,1,1,3.2), WeightedItem(Items.BROKEN_STAFF_689,1,1,3.2),
WeightedItem(Items.BROKEN_ARROW_687,1,1,3.1) WeightedItem(Items.BROKEN_ARROW_687,1,1,3.1),
WeightedItem(Items.BUTTONS_688,1,1,3.0)
).insertEasyClue(1.0)), ).insertEasyClue(1.0)),
FEMALE_HAM_MEMBER(intArrayOf(1715), 15, 135.0, 240.0, 18.5, 1,3,4, WeightBasedTable.create( FEMALE_HAM_MEMBER(intArrayOf(1715), 15, 135.0, 240.0, 18.5, 1,3,4, WeightBasedTable.create(
WeightedItem(Items.COINS_995,1,21,5.5), WeightedItem(Items.COINS_995,1,21,5.5),
@@ -67,7 +68,8 @@ enum class Pickpockets(val ids: IntArray, val requiredLevel: Int, val low: Doubl
WeightedItem(Items.RUSTY_SWORD_686,1,1,3.5), WeightedItem(Items.RUSTY_SWORD_686,1,1,3.5),
WeightedItem(Items.BROKEN_ARMOUR_698,1,1,3.5), WeightedItem(Items.BROKEN_ARMOUR_698,1,1,3.5),
WeightedItem(Items.BROKEN_STAFF_689,1,1,3.2), WeightedItem(Items.BROKEN_STAFF_689,1,1,3.2),
WeightedItem(Items.BROKEN_ARROW_687,1,1,3.1) WeightedItem(Items.BROKEN_ARROW_687,1,1,3.1),
WeightedItem(Items.BUTTONS_688,1,1,3.0)
).insertEasyClue(1.0)), ).insertEasyClue(1.0)),
WARRIOR(intArrayOf(15, 18), 25, 84.0, 240.0, 26.0, 2, 2, 5, WeightBasedTable.create( WARRIOR(intArrayOf(15, 18), 25, 84.0, 240.0, 26.0, 2, 2, 5, WeightBasedTable.create(
WeightedItem(Items.COINS_995,18,18,1.0,true) WeightedItem(Items.COINS_995,18,18,1.0,true)