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.ados.townhall;
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 an NPC to keep track of all the traders in Faiumoni
28  * This means players can come find prices of all items.
29  * The shop signs now have to be coded in XML not java because the implementation got moved over :(
30  * So if you want to read them see data/conf/zones/ados.xml
31  * @author kymara
32  */
33 public class TaxmanNPC implements ZoneConfigurator {
34 
35 	/**
36 	 * Configure a zone.
37 	 *
38 	 * @param	zone		The zone to be configured.
39 	 * @param	attributes	Configuration attributes.
40 	 */
41 	@Override
configureZone(final StendhalRPZone zone, final Map<String, String> attributes)42 	public void configureZone(final StendhalRPZone zone, final Map<String, String> attributes) {
43 		buildNPC(zone);
44 	}
45 
buildNPC(final StendhalRPZone zone)46 	private void buildNPC(final StendhalRPZone zone) {
47 		// Please change the NPCOwned Chest name if you change this NPC name.
48 		final SpeakerNPC npc = new SpeakerNPC("Mr Taxman") {
49 
50 			@Override
51 			protected void createPath() {
52 				final List<Node> nodes = new LinkedList<Node>();
53 				nodes.add(new Node(2, 14));
54 				nodes.add(new Node(9, 14));
55 				nodes.add(new Node(9, 16));
56 				nodes.add(new Node(16, 16));
57 				nodes.add(new Node(9, 16));
58 				nodes.add(new Node(9, 14));
59 				setPath(new FixedPath(nodes, true));
60 			}
61 
62 			@Override
63 			protected void createDialog() {
64 				addGreeting("Hello. What do you want?");
65 				addJob("I calculate the duty and taxes owed by each trader in the land. It's the ones who buy weapons that I have to be most careful of. I also take #payment of owed house taxes.");
66 				addHelp("I expect you are wondering what this chaos here is. Well, each book you see is for a different shop or trade. I can work out how much to tax the shop owner. But don't poke your nose into them, it's private business!");
67 				addOffer("Me? Trade? You have it all wrong! I'm the tax man. It's my job to keep an eye on all traders across the land. That's why I have so many books open, I have to know exactly what these shopkeepers are doing.");
68 				addQuest("Ask Mayor Chalmers upstairs what Ados needs.");
69  				addGoodbye("Bye - and don't you even think of looking into these records!");
70 			}
71 		};
72 		npc.setDescription("You see a terrifying half human, the Tax Man.");
73 		npc.setEntityClass("taxmannpc");
74 		npc.setPosition(2, 14);
75 		npc.setCollisionAction(CollisionAction.STOP);
76 		npc.initHP(100);
77 		zone.add(npc);
78 
79 
80 	}
81 }
82