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 jailed Barbarian in Prison Hut on amazon island.
28  *
29  * @author Teiv
30  */
31 public class JailedBarbNPC 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 JailedBarbNPC = new SpeakerNPC("Lorenz") {
49 
50 			@Override
51 			protected void createPath() {
52 				final List<Node> nodes = new LinkedList<Node>();
53 				nodes.add(new Node(11, 12));
54 				nodes.add(new Node(11, 10));
55 				nodes.add(new Node(9, 10));
56 				nodes.add(new Node(9, 6));
57 				nodes.add(new Node(11, 6));
58 				nodes.add(new Node(11, 4));
59 				nodes.add(new Node(4, 4));
60 				nodes.add(new Node(4, 6));
61 				nodes.add(new Node(6, 6));
62 				nodes.add(new Node(6, 10));
63 				nodes.add(new Node(4, 10));
64 				nodes.add(new Node(4, 12));
65 				setPath(new FixedPath(nodes, true));
66 			}
67 
68 			@Override
69 			protected void createDialog() {
70 			    addGreeting("Flowers, flowers. All over here these ugly flowers!");
71 				addJob("I belong to the #Guard of the hidden King! Oops, too much information for you!");
72 				addReply("guard", "Uhm as I said, I didn't say anything to you!");
73 				addHelp("Kill as much of these ugly Amazonesses as you can, they tried to make me go insane with these ugly flowers all over here.");
74 				addOffer("Nothing to offer you!");
75 				addGoodbye("Bye bye, and cut down some of these ugly flowers!");
76 			}
77 		};
78 
79 		JailedBarbNPC.setEntityClass("jailedbarbariannpc");
80 		JailedBarbNPC.setPosition(11, 12);
81 		JailedBarbNPC.setCollisionAction(CollisionAction.STOP);
82 		JailedBarbNPC.initHP(100);
83 		JailedBarbNPC.setDescription("You see the jailed Barbarian Lorenz. What did he do to the Amazonesses?");
84 		zone.add(JailedBarbNPC);
85 	}
86 }
87