/
HighPriestNPC.java
109 lines (92 loc) · 3.48 KB
/
HighPriestNPC.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/* $Id$ */
/***************************************************************************
* (C) Copyright 2003-2010 - 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.semos.mines;
import java.util.Map;
import games.stendhal.common.Direction;
import games.stendhal.common.parser.Sentence;
import games.stendhal.server.core.config.ZoneConfigurator;
import games.stendhal.server.core.engine.StendhalRPZone;
import games.stendhal.server.entity.RPEntity;
import games.stendhal.server.entity.npc.ChatAction;
import games.stendhal.server.entity.npc.EventRaiser;
import games.stendhal.server.entity.npc.SpeakerNPC;
import games.stendhal.server.entity.player.Player;
public class HighPriestNPC 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) {
buildMineArea(zone);
}
private void buildMineArea(final StendhalRPZone zone) {
final SpeakerNPC npc = new SpeakerNPC("Aenihata") {
@Override
protected void createPath() {
setPath(null);
}
@Override
protected void createDialog() {
addGreeting(null, new ChatAction() {
@Override
public void fire(final Player player, final Sentence sentence, final EventRaiser raiser) {
String reply = "I am summoning a barrier to keep the #balrog away.";
if (player.getLevel() < 150) {
reply += " The balrog will kill you instantly. Run away!.";
} else {
reply += " I will keep the barrier to protect Faiumoni. Kill it.";
}
raiser.say(reply);
}
});
addReply("balrog",
"The fearest creature that Bolrogh army has.");
addGoodbye();
}
@Override
protected void onGoodbye(RPEntity player) {
setDirection(Direction.LEFT);
}
};
npc.addInitChatMessage(null, new ChatAction() {
@Override
public void fire(final Player player, final Sentence sentence, final EventRaiser raiser) {
if (!player.hasQuest("AenihataReward")
&& (player.getLevel() >= 150)) {
player.setQuest("AenihataReward", "done");
player.setAtkXP(1000000 + player.getAtkXP());
player.setDefXP(10000000 + player.getDefXP());
player.addXP(100000);
player.incAtkXP();
player.incDefXP();
}
if (!player.hasQuest("AenihataFirstChat")) {
player.setQuest("AenihataFirstChat", "done");
((SpeakerNPC) raiser.getEntity()).listenTo(player, "hi");
}
}
});
npc.setEntityClass("highpriestnpc");
npc.setDescription("You see Aenihata. He is a high priest and tries to protect Faiumoni with his magical skills.");
npc.setPosition(23, 44);
npc.setDirection(Direction.LEFT);
npc.initHP(85);
zone.add(npc);
}
}