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.kalavan.citygardens; 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.StendhalRPZone; 21 import games.stendhal.server.core.pathfinder.FixedPath; 22 import games.stendhal.server.core.pathfinder.Node; 23 import games.stendhal.server.entity.CollisionAction; 24 import games.stendhal.server.entity.npc.SpeakerNPC; 25 26 /** 27 * Builds a little girl called Annie Jones. 28 * 29 * @author kymara 30 */ 31 public class LittleGirlNPC implements ZoneConfigurator { 32 // 33 // ZoneConfigurator 34 // 35 36 /** 37 * Configure a zone. 38 * 39 * @param zone The zone to be configured. 40 * @param attributes Configuration attributes. 41 */ 42 @Override configureZone(final StendhalRPZone zone, final Map<String, String> attributes)43 public void configureZone(final StendhalRPZone zone, final Map<String, String> attributes) { 44 createNPC(zone); 45 } 46 47 createNPC(final StendhalRPZone zone)48 private void createNPC(final StendhalRPZone zone) { 49 final SpeakerNPC npc = new SpeakerNPC("Annie Jones") { 50 51 @Override 52 protected void createPath() { 53 final List<Node> nodes = new LinkedList<Node>(); 54 nodes.add(new Node(44, 90)); 55 nodes.add(new Node(44, 86)); 56 nodes.add(new Node(42, 86)); 57 nodes.add(new Node(42, 90)); 58 setPath(new FixedPath(nodes, true)); 59 } 60 61 @Override 62 protected void createDialog() { 63 // greeting and quest in maps/quests/IcecreamForAnnie.java 64 addOffer("I'm a little girl, I haven't anything to offer."); 65 addJob("I help my mummy."); 66 addHelp("Ask my mummy."); 67 addGoodbye("Ta ta."); 68 } 69 }; 70 71 npc.setDescription("You see a little girl, playing in the playground."); 72 npc.setEntityClass("pinkgirlnpc"); 73 npc.setPosition(44, 90); 74 npc.setCollisionAction(CollisionAction.STOP); 75 npc.initHP(100); 76 zone.add(npc); 77 } 78 } 79