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.nalwor.tower;
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 Princess NPC who lives in a tower.
28  *
29  * @author kymara
30  */
31 public class PrincessNPC implements ZoneConfigurator {
32 	/**
33 	 * Configure a zone.
34 	 *
35 	 * @param	zone		The zone to be configured.
36 	 * @param	attributes	Configuration attributes.
37 	 */
38 	@Override
configureZone(final StendhalRPZone zone, final Map<String, String> attributes)39 	public void configureZone(final StendhalRPZone zone, final Map<String, String> attributes) {
40 		buildNPC(zone);
41 	}
42 
buildNPC(final StendhalRPZone zone)43 	private void buildNPC(final StendhalRPZone zone) {
44 		final SpeakerNPC npc = new SpeakerNPC("Tywysoga") {
45 
46 			@Override
47 			protected void createPath() {
48 				final List<Node> nodes = new LinkedList<Node>();
49 				nodes.add(new Node(17, 13));
50 				nodes.add(new Node(10, 13));
51 				nodes.add(new Node(10, 4));
52 				nodes.add(new Node(3, 4));
53 				nodes.add(new Node(3, 3));
54 				nodes.add(new Node(7, 3));
55 				nodes.add(new Node(7, 9));
56 				nodes.add(new Node(12, 9));
57 				nodes.add(new Node(12, 13));
58 				setPath(new FixedPath(nodes, true));
59 			}
60 
61 			@Override
62 			protected void createDialog() {
63 				addGreeting("Hail to thee, human.");
64 				addJob("I'm a princess. What can I do?");
65 				addHelp("A persistent person could do a #task for me.");
66 				addOffer("I don't trade. My parents would have considered it beneath me.");
67  				addGoodbye("Goodbye, strange one.");
68 			}
69 		};
70 
71 		npc.setDescription("You see a beautiful but forlorn High Elf.");
72 		npc.setEntityClass("elfprincessnpc");
73 		npc.setPosition(17, 13);
74 		npc.setCollisionAction(CollisionAction.STOP);
75 		npc.initHP(100);
76 		zone.add(npc);
77 	}
78 }
79