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.amazon.hut;
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 the princess in Princess Hut on amazon island.
28  *
29  * @author Teiv
30  */
31 public class PrincessNPC 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 		buildNPC(zone);
45 	}
46 
buildNPC(final StendhalRPZone zone)47 	private void buildNPC(final StendhalRPZone zone) {
48 		final SpeakerNPC princessNPC = new SpeakerNPC("Princess Esclara") {
49 
50 			@Override
51 			protected void createPath() {
52 				final List<Node> nodes = new LinkedList<Node>();
53 				nodes.add(new Node(6, 13));
54 				nodes.add(new Node(14, 13));
55 				nodes.add(new Node(14, 4));
56 				nodes.add(new Node(6, 4));
57 				nodes.add(new Node(6, 3));
58 				nodes.add(new Node(4, 3));
59 				nodes.add(new Node(4, 7));
60 				nodes.add(new Node(6, 7));
61 				setPath(new FixedPath(nodes, true));
62 			}
63 
64 			@Override
65 			protected void createDialog() {
66 			        addGreeting("Huh, what are you doing here?");
67 				addReply("sorry", "Well, so you should be, sneaking up on me like that!");
68 				addReply("look", "You had better not poke around, this is all mine!");
69 				addReply("nothing", "Go away and do this somewhere else but not in my hut!");
70 				addJob("Job? You expect that a princess like me would need to work? Ha!");
71 				addHelp("Beware of my sisters on the island, they do not like strangers.");
72 				addOffer("There is nothing to offer you.");
73 				addGoodbye("Goodbye, and beware of the barbarians.");
74 			}
75 		};
76 
77 		princessNPC.setEntityClass("amazoness_princessnpc");
78 		princessNPC.setPosition(6, 13);
79 		princessNPC.setCollisionAction(CollisionAction.STOP);
80 		princessNPC.initHP(100);
81 		princessNPC.setDescription("You see Princess Esclara. She smells of coconut and pineapples...");
82 		zone.add(princessNPC);
83 	}
84 }
85