1 /* $Id$ */ 2 /*************************************************************************** 3 * (C) Copyright 2003-2010 - Stendhal * 4 *************************************************************************** 5 *************************************************************************** 6 * * 7 * This program is free software; you can redistribute it and/or modify * 8 * it under the terms of the GNU General Public License as published by * 9 * the Free Software Foundation; either version 2 of the License, or * 10 * (at your option) any later version. * 11 * * 12 ***************************************************************************/ 13 package games.stendhal.server.maps.ados.abandonedkeep; 14 15 import java.util.LinkedList; 16 import java.util.List; 17 import java.util.Map; 18 19 import games.stendhal.server.core.config.ZoneConfigurator; 20 import games.stendhal.server.core.engine.SingletonRepository; 21 import games.stendhal.server.core.engine.StendhalRPZone; 22 import games.stendhal.server.core.pathfinder.FixedPath; 23 import games.stendhal.server.core.pathfinder.Node; 24 import games.stendhal.server.entity.CollisionAction; 25 import games.stendhal.server.entity.npc.ShopList; 26 import games.stendhal.server.entity.npc.SpeakerNPC; 27 import games.stendhal.server.entity.npc.behaviour.adder.BuyerAdder; 28 import games.stendhal.server.entity.npc.behaviour.impl.BuyerBehaviour; 29 30 /** 31 * Inside Ados Abandoned Keep - level -3 . 32 */ 33 public class DwarfBuyerGuyNPC implements ZoneConfigurator { 34 35 private final ShopList shops = SingletonRepository.getShopList(); 36 37 @Override configureZone(StendhalRPZone zone, Map<String, String> attributes)38 public void configureZone(StendhalRPZone zone, 39 Map<String, String> attributes) { 40 buildNPC(zone); 41 } 42 buildNPC(StendhalRPZone zone)43 private void buildNPC(StendhalRPZone zone) { 44 final SpeakerNPC npc = new SpeakerNPC("Ritati Dragontracker") { 45 46 @Override 47 protected void createPath() { 48 final List<Node> nodes = new LinkedList<Node>(); 49 nodes.add(new Node(25,32)); 50 nodes.add(new Node(38,32)); 51 setPath(new FixedPath(nodes, true)); 52 } 53 54 @Override 55 public void createDialog() { 56 57 addGreeting("What do you want?"); 58 addJob("I buy odds and ends. Somebody has to do it."); 59 addHelp("Look at me! I am reduced to buying trinkets! How can I help YOU?"); 60 addOffer("Don't bother me unless you have something I want! Check the blackboard for prices."); 61 addQuest("Unless you want to #own this place, you cannot do anything for me."); 62 addGoodbye("Be off with you!"); 63 addReply("own", "What? Why you couldn't even begin to come up with enough money for that!"); 64 // see games.stendhal.server.maps.quests.mithrilcloak.GettingTools for further behaviour 65 addReply("buy", "I don't sell anything but you can look at my blackboard for what I buy. Or ask about #specials."); 66 addReply("YOU", "Yes, I am talking to YOU! Who else would I be talking to!"); 67 68 new BuyerAdder().addBuyer(this, new BuyerBehaviour(shops.get("buyoddsandends")), false); 69 }}; 70 71 npc.setPosition(25, 32); 72 npc.setCollisionAction(CollisionAction.STOP); 73 npc.setEntityClass("olddwarfnpc"); 74 npc.setDescription("You see Ritati Dragontracker who buys odds end ends."); 75 zone.add(npc); 76 } 77 } 78