From 2189b907d923115297220fbacefa991789a3c296 Mon Sep 17 00:00:00 2001 From: Ceikry Date: Sat, 20 Mar 2021 22:41:43 -0500 Subject: [PATCH] bufxiezds --- .../rs09/game/ai/general/scriptrepository/CoalMiner.kt | 4 +++- .../game/ai/general/scriptrepository/DraynorWillows.kt | 5 ++++- .../game/ai/general/scriptrepository/LobsterCatcher.kt | 4 +++- .../game/ai/general/scriptrepository/SeersMagicTrees.kt | 4 +++- .../rs09/game/ai/general/scriptrepository/SharkCatcher.kt | 4 +++- .../ai/general/scriptrepository/VarrockEssenceMiner.kt | 4 +++- .../kotlin/rs09/game/interaction/InteractionListener.kt | 8 +++++--- .../rs09/game/node/entity/skill/thieving/Pickpockets.kt | 6 ++++-- 8 files changed, 28 insertions(+), 11 deletions(-) diff --git a/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/CoalMiner.kt b/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/CoalMiner.kt index 5f9016aa3..9fc4b307b 100644 --- a/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/CoalMiner.kt +++ b/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/CoalMiner.kt @@ -9,6 +9,8 @@ import core.game.world.map.zone.ZoneBorders 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.InteractionListeners @PlayerCompatible @ScriptName("Falador Coal Miner") @@ -52,7 +54,7 @@ class CoalMiner() : Script() { scriptAPI.walkTo(mine.randomLoc) } else { 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) } diff --git a/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/DraynorWillows.kt b/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/DraynorWillows.kt index 311d56bf0..b9195bb2e 100644 --- a/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/DraynorWillows.kt +++ b/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/DraynorWillows.kt @@ -7,6 +7,8 @@ import core.game.node.entity.skill.Skills 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.InteractionListeners import rs09.tools.stringtools.colorize @PlayerCompatible @@ -39,7 +41,8 @@ class DraynorWillows : Script(){ scriptAPI.walkTo(willowZone.randomLoc) else { 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) state = State.BANKING } diff --git a/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/LobsterCatcher.kt b/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/LobsterCatcher.kt index 837e02c8b..6863f20dd 100644 --- a/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/LobsterCatcher.kt +++ b/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/LobsterCatcher.kt @@ -13,6 +13,8 @@ import core.tools.RandomFunction 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.InteractionListeners import rs09.game.world.GameWorld import kotlin.random.Random @@ -71,7 +73,7 @@ class LobsterCatcher : Script() { if(spot == null){ state = State.IDLE } else { - spot!!.interaction.handle(bot, spot.interaction[0]) + InteractionListeners.run(spot.id,InteractionListener.NPC,"cage",bot,spot) } if(bot.inventory.isFull){ state = State.FIND_BANK diff --git a/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/SeersMagicTrees.kt b/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/SeersMagicTrees.kt index 7af24a5a7..48b7b45c3 100644 --- a/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/SeersMagicTrees.kt +++ b/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/SeersMagicTrees.kt @@ -10,6 +10,8 @@ import core.tools.RandomFunction 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.InteractionListeners @PlayerCompatible @ScriptName("Seers Magics") @@ -37,7 +39,7 @@ class SeersMagicTrees : Script(){ State.CHOPPING -> { 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){ state = State.FIND_BANK } diff --git a/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/SharkCatcher.kt b/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/SharkCatcher.kt index 94afafabe..2d78e48a0 100644 --- a/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/SharkCatcher.kt +++ b/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/SharkCatcher.kt @@ -10,6 +10,8 @@ import org.rs09.consts.Items import rs09.game.ai.AIPlayer import rs09.game.ai.general.ScriptAPI import rs09.game.ge.OfferManager +import rs09.game.interaction.InteractionListener +import rs09.game.interaction.InteractionListeners import kotlin.random.Random /* @@ -115,7 +117,7 @@ class SharkCatcher : Script() { if (Random.nextBoolean()) { tick = 0 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){ state = State.FIND_BANK } else { diff --git a/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/VarrockEssenceMiner.kt b/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/VarrockEssenceMiner.kt index 5d139cbdc..d429713c4 100644 --- a/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/VarrockEssenceMiner.kt +++ b/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/VarrockEssenceMiner.kt @@ -6,6 +6,8 @@ import core.game.world.map.Location 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.InteractionListeners @PlayerCompatible @ScriptDescription("Start in varrock bank with rune mysteries complete and a pickaxe equipped/in inventory") @@ -47,7 +49,7 @@ class VarrockEssenceMiner : Script(){ State.MINING -> { 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) state = State.TO_BANK } diff --git a/Server/src/main/kotlin/rs09/game/interaction/InteractionListener.kt b/Server/src/main/kotlin/rs09/game/interaction/InteractionListener.kt index d7d1a59db..9494648c9 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/InteractionListener.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/InteractionListener.kt @@ -5,9 +5,11 @@ import core.game.node.entity.player.Player import core.game.world.map.Location abstract class InteractionListener : Listener{ - val ITEM = 0 - val OBJECT = 1 - val NPC = 2 + companion object { + val ITEM = 0 + val OBJECT = 1 + val NPC = 2 + } fun on(id: Int, type: Int, vararg option: String,handler: (player: Player, node: Node) -> Boolean){ InteractionListeners.add(id,type,option,handler) } diff --git a/Server/src/main/kotlin/rs09/game/node/entity/skill/thieving/Pickpockets.kt b/Server/src/main/kotlin/rs09/game/node/entity/skill/thieving/Pickpockets.kt index 885a4a36c..245996fd0 100644 --- a/Server/src/main/kotlin/rs09/game/node/entity/skill/thieving/Pickpockets.kt +++ b/Server/src/main/kotlin/rs09/game/node/entity/skill/thieving/Pickpockets.kt @@ -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.BROKEN_ARMOUR_698,1,1,3.5), 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)), 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), @@ -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.BROKEN_ARMOUR_698,1,1,3.5), 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)), 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)