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.orril.dwarfmine;
14 
15 import java.util.Arrays;
16 import java.util.LinkedList;
17 import java.util.List;
18 import java.util.Map;
19 
20 import games.stendhal.server.core.config.ZoneConfigurator;
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.ConversationStates;
26 import games.stendhal.server.entity.npc.SpeakerNPC;
27 
28 /**
29  * Configure Orril Dwarf Blacksmith (Underground/Level -3).
30  *
31  * @author kymara
32  */
33 public class BlacksmithNPC implements ZoneConfigurator {
34 	/**
35 	 * Configure a zone.
36 	 *
37 	 * @param	zone		The zone to be configured.
38 	 * @param	attributes	Configuration attributes.
39 	 */
40 	@Override
configureZone(final StendhalRPZone zone, final Map<String, String> attributes)41 	public void configureZone(final StendhalRPZone zone, final Map<String, String> attributes) {
42 		buildBlacksmith(zone);
43 	}
44 
buildBlacksmith(final StendhalRPZone zone)45 	private void buildBlacksmith(final StendhalRPZone zone) {
46 		final SpeakerNPC hogart = new SpeakerNPC("Hogart") {
47 
48 			@Override
49 			protected void createPath() {
50 				final List<Node> nodes = new LinkedList<Node>();
51 				nodes.add(new Node(20, 11));
52 				nodes.add(new Node(12, 11));
53 				nodes.add(new Node(12, 7));
54 				nodes.add(new Node(12, 10));
55 				nodes.add(new Node(20, 10));
56 				nodes.add(new Node(20, 8));
57 				nodes.add(new Node(20, 11));
58 				setPath(new FixedPath(nodes, true));
59 			}
60 
61 			@Override
62 			protected void createDialog() {
63 				addGreeting();
64 				addJob("I am a master blacksmith. I used to forge weapons in secret for the dwarves in the mine, but they have forgotten me and my #stories.");
65 				addHelp("I could tell you a #story...");
66 				add(
67 				        ConversationStates.ATTENDING,
68 				        Arrays.asList("story", "stories"),
69 				        ConversationStates.ATTENDING,
70 				        "I expect a scruff like you has never heard of Lady Tembells, huh? She was so beautiful. She died young and her distraught husband asked a powerful Lord to bring her back to life. The fool didn't get what he bargained for, she became a #vampire.",
71 				        null);
72 				add(
73 				        ConversationStates.ATTENDING,
74 				        Arrays.asList("vampire"),
75 				        ConversationStates.ATTENDING,
76 				        "The husband had hired the help of a Vampire Lord! The Lady became his Vampire Bride and her maids became vampiresses. The Catacombs of North Semos are a deadly place now.",
77 				        null);
78 				addGoodbye("So long. I bet you won't sleep so well tonight.");
79 				addReply("bobbin", "Bobbins? BOBBINS?! Do you think I am a female?! Pfff go find some other blacksmith I'm no bobbin maker.");
80 
81 			} //remaining behaviour defined in maps.quests.VampireSword and  maps.quests.MithrilCloak
82 		};
83 
84 		hogart.setDescription("You see Hogart, a retired master dwarf smith.");
85 		hogart.setEntityClass("olddwarfnpc");
86 		hogart.setPosition(20, 11);
87 		hogart.setCollisionAction(CollisionAction.STOP);
88 		hogart.initHP(100);
89 		zone.add(hogart);
90 	}
91 }
92