1 /***************************************************************************
2  *                   (C) Copyright 2003-2016 - Stendhal                    *
3  ***************************************************************************
4  ***************************************************************************
5  *                                                                         *
6  *   This program is free software; you can redistribute it and/or modify  *
7  *   it under the terms of the GNU General Public License as published by  *
8  *   the Free Software Foundation; either version 2 of the License, or     *
9  *   (at your option) any later version.                                   *
10  *                                                                         *
11  ***************************************************************************/
12 package games.stendhal.server.maps.magic.shrine;
13 
14 import java.util.LinkedList;
15 import java.util.List;
16 import java.util.Map;
17 
18 import games.stendhal.server.core.config.ZoneConfigurator;
19 import games.stendhal.server.core.engine.SingletonRepository;
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.ShopList;
25 import games.stendhal.server.entity.npc.SpeakerNPC;
26 import games.stendhal.server.entity.npc.action.SayTextAction;
27 import games.stendhal.server.entity.npc.behaviour.adder.SellerAdder;
28 import games.stendhal.server.entity.npc.behaviour.impl.SellerBehaviour;
29 
30 /**
31  * Builds a priestess NPC.
32  * She is a
33  *
34  * @author kymara
35  */
36 public class PriestessNPC implements ZoneConfigurator {
37 	private final ShopList shops = SingletonRepository.getShopList();
38 
39 	/**
40 	 * Configure a zone.
41 	 *
42 	 * @param	zone		The zone to be configured.
43 	 * @param	attributes	Configuration attributes.
44 	 */
45 	@Override
configureZone(final StendhalRPZone zone, final Map<String, String> attributes)46 	public void configureZone(final StendhalRPZone zone, final Map<String, String> attributes) {
47 		buildNPC(zone);
48 	}
49 
buildNPC(final StendhalRPZone zone)50 	private void buildNPC(final StendhalRPZone zone) {
51 		final SpeakerNPC npc = new SpeakerNPC("Kendra Mattori") {
52 
53 			@Override
54 			protected void createPath() {
55 				final List<Node> nodes = new LinkedList<Node>();
56 				nodes.add(new Node(9, 10));
57 				nodes.add(new Node(14, 10));
58 				nodes.add(new Node(14, 13));
59 				nodes.add(new Node(9, 13));
60 				setPath(new FixedPath(nodes, true));
61 			}
62 
63 			@Override
64 			protected void createDialog() {
65 			    addGreeting(null, new SayTextAction("Hello, [name]."));
66 				addJob("As a priestess I can #offer you a number of potions and antidotes.");
67 				addHelp("My sister Salva has the gift of healing. She is out for a walk by the aqueduct, you should find her there if you need her.");
68 				new SellerAdder().addSeller(this, new SellerBehaviour(shops.get("superhealing")), true);
69  				addGoodbye("Bye, for now.");
70 			}
71 		};
72 
73 		npc.setDescription("You see a beautiful woman hidden under swathes of fabric.");
74 		npc.setEntityClass("cloakedwoman2npc");
75 		npc.setPosition(9, 10);
76 		npc.setCollisionAction(CollisionAction.STOP);
77 		npc.initHP(100);
78 		zone.add(npc);
79 	}
80 }
81