/
BuyerNPC.java
78 lines (70 loc) · 3.16 KB
/
BuyerNPC.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/* $Id$ */
/***************************************************************************
* (C) Copyright 2003-2023 - Stendhal *
***************************************************************************
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
package games.stendhal.server.maps.ados.barracks;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import games.stendhal.server.core.config.ZoneConfigurator;
import games.stendhal.server.core.engine.StendhalRPZone;
import games.stendhal.server.core.pathfinder.FixedPath;
import games.stendhal.server.core.pathfinder.Node;
import games.stendhal.server.entity.npc.ConversationPhrases;
import games.stendhal.server.entity.npc.SpeakerNPC;
/**
* Builds an NPC to buy previously unbought armor.
*
* @author kymara
*/
public class BuyerNPC implements ZoneConfigurator {
/**
* Configure a zone.
*
* @param zone The zone to be configured.
* @param attributes Configuration attributes.
*/
@Override
public void configureZone(final StendhalRPZone zone, final Map<String, String> attributes) {
buildNPC(zone);
}
private void buildNPC(final StendhalRPZone zone) {
final SpeakerNPC npc = new SpeakerNPC("Mrotho") {
@Override
protected void createPath() {
final List<Node> nodes = new LinkedList<Node>();
nodes.add(new Node(45, 49));
nodes.add(new Node(29, 49));
nodes.add(new Node(29, 57));
nodes.add(new Node(45, 57));
nodes.add(new Node(19, 57));
nodes.add(new Node(19, 49));
setPath(new FixedPath(nodes, true));
}
@Override
protected void createDialog() {
addGreeting("Greetings. Have you come to enlist as a soldier?");
addReply(ConversationPhrases.YES_MESSAGES, "Huh! Well I don't let your type enlist! Perhaps you want to #offer some of that armor instead...");
addReply(ConversationPhrases.NO_MESSAGES, "Good! You wouldn't have fit in here anyway.");
addJob("I'm looking after the weaponry here. We have plenty of ammunition but running low on armor. I see you have some you might #offer though.");
addHelp("I buy armor for the barracks here, make me an #offer. If you'll keep it quiet, I'll even sell you ammunition.");
addOffer("Please look at the blackboard by the shields rack to see what we are short of, and what we pay. I also sell a variety of arrows.");
addQuest("Oh, thanks but no thanks. I don't need anything.");
addGoodbye("Goodbye, comrade.");
}
};
npc.setDescription("You see Mrotho, guarding over Ados Barracks.");
npc.setEntityClass("barracksbuyernpc");
npc.setPosition(45, 49);
npc.initHP(500);
zone.add(npc);
}
}