diff --git a/Server/src/plugin/interaction/city/nardah/AliTheCarter.java b/Server/src/plugin/interaction/city/nardah/AliTheCarter.java new file mode 100644 index 000000000..987bca6d1 --- /dev/null +++ b/Server/src/plugin/interaction/city/nardah/AliTheCarter.java @@ -0,0 +1,99 @@ +package plugin.interaction.city.nardah; + +import org.crandor.game.content.dialogue.DialoguePlugin; +import org.crandor.game.node.entity.npc.NPC; +import org.crandor.game.node.entity.player.Player; +import org.crandor.game.node.item.GroundItemManager; +import org.crandor.game.node.item.Item; +import org.crandor.plugin.InitializablePlugin; + +/** + * Handles Ali the Carter, TODO: Add more dialogue after Spirits of the Elid is added + * @author ceik + */ + +@InitializablePlugin +public class AliTheCarter extends DialoguePlugin { + public AliTheCarter(){ + /** + * Empty + */ + } + public AliTheCarter(Player player){super(player);} + @Override + public DialoguePlugin newInstance(Player player){return new AliTheCarter(player);} + public boolean open(Object... args){ + NPC npc = (NPC)args[0]; + player("Hello"); + return true; + } + + public boolean handle(int interfaceId, int buttonId){ + switch(stage){ + case 0: + npc("Hello, friend! Welcome to Nardah.","Do you happen to be in need of water?"); + stage++; + break; + case 1: + interpreter.sendOptions("Select one","Yes I am!","No thank you I'm good."); + stage++; + break; + case 2: + switch(buttonId){ + case 1: + player("Yes I am!"); + stage = 3; + break; + case 2: + player("No thank you."); + stage = 10; + break; + } + break; + case 3: + npc("It'll be 1000 coins for a full waterskin."); + stage++; + break; + case 4: + interpreter.sendOptions("Select one","Oh, wow. Um, sure.","Oh my! No thank you."); + stage++; + break; + case 5: + switch(buttonId){ + case 1: + player("Oh, wow. Um, sure."); + stage++; + break; + case 2: + player("Oh my! No thank you."); + stage = 10; + break; + } + break; + case 6: + if(player.getInventory().contains(995,1000)){ + player.getInventory().remove(new Item(995,1000)); + if(player.getInventory().freeSlots() > 0) { + player.getInventory().add(new Item(1823)); + } else { + GroundItemManager.create(new Item(1823),player.getLocation()); + } + end(); + } else { + player("Err, I seem to not have enough gold."); + stage++; + } + break; + case 7: + npc("Too bad, friend."); + stage = 10; + break; + case 10: + end(); + break; + } + return true; + } + @Override + public int[] getIds() {return new int[] {3030};} +} diff --git a/Server/src/plugin/interaction/city/nardah/Rokuh.java b/Server/src/plugin/interaction/city/nardah/Rokuh.java new file mode 100644 index 000000000..eb72d8e65 --- /dev/null +++ b/Server/src/plugin/interaction/city/nardah/Rokuh.java @@ -0,0 +1,100 @@ +package plugin.interaction.city.nardah; + +import org.crandor.cache.def.impl.NPCDefinition; +import org.crandor.game.content.dialogue.DialoguePlugin; +import org.crandor.game.content.global.shop.Shop; +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.game.system.script.context.ShopInstruction; +import org.crandor.plugin.InitializablePlugin; +import org.crandor.plugin.Plugin; + +@InitializablePlugin +public class Rokuh extends OptionHandler { + public final int NPC_ID = 3045; + + @Override + public Plugin newInstance(Object arg) throws Throwable { + new RokuhDialogue().init(); + NPCDefinition.forId(NPC_ID).getConfigurations().put("option:trade",this); + NPCDefinition.forId(NPC_ID).getConfigurations().put("option:talk-to",this); + return this; + } + + @Override + public final boolean handle(Player player, Node node, String string){ + NPC npc = node.asNpc(); + switch(string){ + case "trade": + npc.openShop(player); + break; + case "talk-to": + player.getDialogueInterpreter().open(NPC_ID); + break; + } + return true; + } + + final class RokuhDialogue extends DialoguePlugin { + public RokuhDialogue(){ + /** + * Empty + */ + } + public RokuhDialogue(Player player){ + super(player); + } + @Override + public DialoguePlugin newInstance(Player player){return new RokuhDialogue(player);} + + @Override + public boolean open(Object... args){ + npc("Come one, come all, buy my amazing choc ice invention here!","Chocolate on the outside. Iced cream on the inside.","Oh I also have some chocolate left over from making","choc ices which I'm selling too."); + return true; + } + + @Override + public boolean handle(int interfaceId, int buttonId){ + switch(stage) { + case 0: + //TODO: Add more options after Spirit of the Elid. + interpreter.sendOptions("Select one", "Cool I'd like to buy some", "No thanks, I'm not interested.", "How do you stop your icy snacks melting?"); + stage++; + break; + case 1: + switch(buttonId){ + case 1: + end(); + NPC Rokuh = new NPC(NPC_ID); + Rokuh.openShop(player); + break; + case 2: + player("No thanks, I'm not interested"); + stage = 10; + break; + case 3: + player("How do you stop your icy snacks melting?","The middle of the desert is the last place I'd expect to see ice."); + stage++; + break; + } + break; + case 2: + npc("It's quite a surprise, isn't it, my friend. I actually have this","special magic box of ice, which I bought for a princely sum","from a strange man while adventuring in lands far away","He said it is imbued with some sort of"); + stage++; + break; + case 3: + npc("powerful ice magic which keeps it cold all the time. I had","never seen any ice magic before, it's clearly very rare","and powerful, so I felt I had to buy it."); + stage = 10; + break; + case 10: + end(); + break; + } + return true; + } + @Override + public int[] getIds() {return new int[]{NPC_ID};} + } +}