From 051d2921545fc5da7e22be52228656beca73bbd2 Mon Sep 17 00:00:00 2001 From: Ceikry Date: Thu, 12 Mar 2020 23:15:02 -0500 Subject: [PATCH] Added a basic handler for the bandits --- .../city/pollnivneach/DesertBandit.java | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 Server/src/plugin/interaction/city/pollnivneach/DesertBandit.java diff --git a/Server/src/plugin/interaction/city/pollnivneach/DesertBandit.java b/Server/src/plugin/interaction/city/pollnivneach/DesertBandit.java new file mode 100644 index 000000000..4e6767ed1 --- /dev/null +++ b/Server/src/plugin/interaction/city/pollnivneach/DesertBandit.java @@ -0,0 +1,52 @@ +package plugin.interaction.city.pollnivneach; + +import org.crandor.cache.def.impl.NPCDefinition; +import org.crandor.game.content.dialogue.DialoguePlugin; +import org.crandor.game.interaction.OptionHandler; +import org.crandor.game.node.Node; +import org.crandor.game.node.entity.npc.NPC; +import org.crandor.game.node.entity.player.Player; +import org.crandor.plugin.Plugin; + +public class DesertBandit extends OptionHandler { + public Plugin newInstance(Object arg) throws Throwable { + new BanditDialogue().init(); + NPCDefinition.forId(6388).getConfigurations().put("option:talk-to",this); + return this; + } + public boolean handle(Player player, Node node, String options){ + NPC npc = (NPC) node; + if(npc.getId() == 6388){ + if (options.equals("talk-to")){ + player.getDialogueInterpreter().open(6388); + } + } + return true; + } + + public class BanditDialogue extends DialoguePlugin { + public BanditDialogue() { + /** + * Empty. + */ + } + public BanditDialogue(Player player){super(player);} + + @Override + public DialoguePlugin newInstance(Player player){return new BanditDialogue(player);} + + @Override + public boolean open(Object... args){ + npc("Go away."); + return true; + } + + @Override + public boolean handle(int interfaceId, int buttonId){ + end(); + return true; + } + @Override + public int[] getIds() {return new int[] {6388};} + } +}