diff --git a/Server/src/main/java/core/game/node/entity/skill/gather/GatheringSkillOptionPlugin.java b/Server/src/main/java/core/game/node/entity/skill/gather/GatheringSkillOptionPlugin.java deleted file mode 100644 index d358cc77e..000000000 --- a/Server/src/main/java/core/game/node/entity/skill/gather/GatheringSkillOptionPlugin.java +++ /dev/null @@ -1,39 +0,0 @@ -package core.game.node.entity.skill.gather; - -import core.cache.def.impl.ObjectDefinition; -import core.game.interaction.OptionHandler; -import core.game.node.Node; -import core.game.node.entity.player.Player; -import core.game.node.entity.skill.gather.woodcutting.WoodcuttingSkillPulse; -import core.plugin.Initializable; -import core.plugin.Plugin; -import rs09.game.node.entity.skill.gather.mining.MiningSkillPulse; - -/** - * Handles the gathering skill option handler plugin. - * @author Emperor - * @version 1.0 - */ -@Initializable -public final class GatheringSkillOptionPlugin extends OptionHandler { - - @Override - public Plugin newInstance(Object arg) throws Throwable { - ObjectDefinition.setOptionHandler("chop-down", this); - ObjectDefinition.setOptionHandler("chop down", this); - ObjectDefinition.setOptionHandler("cut down", this); - ObjectDefinition.setOptionHandler("mine", this); - return this; - } - - @Override - public boolean handle(Player player, Node node, String option) { - if(option.equals("mine")){ - player.getPulseManager().run(new MiningSkillPulse(player, node.asObject())); - } else { - player.getPulseManager().run(new WoodcuttingSkillPulse(player, node.asObject())); - } - return true; - } - -} diff --git a/Server/src/main/kotlin/rs09/game/content/dialogue/KjallakOnChopDialogue.kt b/Server/src/main/kotlin/rs09/game/content/dialogue/KjallakOnChopDialogue.kt new file mode 100644 index 000000000..20a3cccbf --- /dev/null +++ b/Server/src/main/kotlin/rs09/game/content/dialogue/KjallakOnChopDialogue.kt @@ -0,0 +1,12 @@ +package rs09.game.content.dialogue + +import rs09.tools.END_DIALOGUE + +class KjallakOnChopDialogue : DialogueFile() { + override fun handle(componentID: Int, buttonID: Int) { + when(stage){ + 0 -> npc("Hey! You're not allowed to chop those!").also { stage++ } + 1 -> player("Oh, ok...").also { stage = END_DIALOGUE } + } + } +} \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/node/entity/skill/gather/GatheringSkillOptionPlugin.kt b/Server/src/main/kotlin/rs09/game/node/entity/skill/gather/GatheringSkillOptionPlugin.kt new file mode 100644 index 000000000..338fa05b0 --- /dev/null +++ b/Server/src/main/kotlin/rs09/game/node/entity/skill/gather/GatheringSkillOptionPlugin.kt @@ -0,0 +1,29 @@ +package rs09.game.node.entity.skill.gather + +import core.game.node.entity.npc.NPC +import core.game.node.entity.skill.gather.woodcutting.WoodcuttingSkillPulse +import org.rs09.consts.NPCs +import rs09.game.content.dialogue.KjallakOnChopDialogue +import rs09.game.interaction.InteractionListener +import rs09.game.node.entity.skill.gather.mining.MiningSkillPulse + +class GatheringSkillOptionPlugin : InteractionListener() { + + val ETCETERIA_REGION = 10300 + + override fun defineListeners() { + on(OBJECT,"chop-down","chop down","cut down"){player,node -> + if(player.location.regionId == ETCETERIA_REGION){ + player.dialogueInterpreter.open(KjallakOnChopDialogue(), NPC(NPCs.CARPENTER_KJALLAK_3916)) + return@on true + } + player.pulseManager.run(WoodcuttingSkillPulse(player, node.asObject())) + return@on true + } + + on(OBJECT,"mine"){player,node -> + player.pulseManager.run(MiningSkillPulse(player, node.asObject())) + return@on true + } + } +} \ No newline at end of file