1 /***************************************************************************
2  *                   (C) Copyright 2003-2013 - 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.nalwor.flowershop;
13 
14 import java.util.ArrayList;
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.StendhalRPZone;
20 import games.stendhal.server.core.pathfinder.FixedPath;
21 import games.stendhal.server.core.pathfinder.Node;
22 import games.stendhal.server.entity.CollisionAction;
23 import games.stendhal.server.entity.npc.SpeakerNPC;
24 
25 public class FlowerGrowerNPC implements ZoneConfigurator {
26 
27     /**
28      * Configure a zone.
29      *
30      * @param	zone		The zone to be configured.
31      * @param	attributes	Configuration attributes.
32      */
33     @Override
configureZone(final StendhalRPZone zone, final Map<String, String> attributes)34 	public void configureZone(final StendhalRPZone zone, final Map<String, String> attributes) {
35         buildNPC(zone);
36     }
37 
buildNPC(final StendhalRPZone zone)38     private void buildNPC(final StendhalRPZone zone) {
39     	final SpeakerNPC npc = new SpeakerNPC("Seremela") {
40 
41     		@Override
42     		protected void createPath() {
43     			List<Node> nodes = new ArrayList<Node>();
44     			nodes.add(new Node(4, 3));
45     			nodes.add(new Node(3, 3));
46     			nodes.add(new Node(3, 6));
47     			nodes.add(new Node(4, 6));
48     			nodes.add(new Node(4, 8));
49     			nodes.add(new Node(2, 8));
50     			nodes.add(new Node(2, 9));
51     			nodes.add(new Node(6, 9));
52     			nodes.add(new Node(6, 8));
53     			nodes.add(new Node(4, 8));
54     			nodes.add(new Node(4, 6));
55     			nodes.add(new Node(10, 6));
56     			nodes.add(new Node(10, 3));
57     			nodes.add(new Node(10, 4));
58     			nodes.add(new Node(11, 4));
59     			nodes.add(new Node(10, 4));
60     			nodes.add(new Node(10, 6));
61     			nodes.add(new Node(3, 6));
62     			nodes.add(new Node(3, 3));
63     			setPath(new FixedPath(nodes, true));
64     		}
65 
66 			@Override
67 			public void createDialog() {
68     			addGreeting("Hello.");
69     			addGoodbye("Goodbye!");
70     			//addHelp("Hmmm, I don't think there is anything I can help with.");
71     			addJob("I take care of our city's beautiful flowers.");
72     			addOffer("I don't have anything to offer.");
73     			//addReply(Arrays.asList("flower", "flowers"), "Aren't flowers beautiful?");
74     			//addEmotionReply(ConversationPhrases.GOODBYE_MESSAGES, "winks");
75     		}
76     	};
77 
78     	npc.setPosition(4, 3);
79     	npc.setCollisionAction(CollisionAction.REVERSE);
80     	npc.setDescription("You see a beautiful elf girl that loves flowers.");
81     	npc.setEntityClass("elfflowergrowernpc");
82     	zone.add(npc);
83     }
84 }
85