56 private Npc brotherNpc;
58 private Barrows(
Player player) {
59 super(10,
Mob.DEFAULT_INSTANCE);
63 public static Barrows create(
Player player) {
64 Barrows minigame =
new Barrows(player);
70 if (player.barrowKills[brother.ordinal()]) {
71 player.dialogueFactory.sendPlayerChat(
"I have already killed this brother.").execute();
74 if (brotherNpc !=
null) {
75 player.dialogueFactory.sendPlayerChat(
"Maybe I should finish killing the other one first.").execute();
78 if (player.hiddenBrother == brother && player.barrowsKillCount != 5) {
79 player.dialogueFactory.sendPlayerChat(
"I should return when I've killed the others.").execute();
81 }
else if (player.hiddenBrother == brother && player.barrowsKillCount == 5) {
82 player.dialogueFactory.sendOption(
"Enter the tunnel.", () -> {
83 player.move(
new Position(3551, 9691, 0));
84 },
"No, I'm not ready yet.", () -> {
85 player.dialogueFactory.clear();
89 brotherNpc =
new Npc(brother.
getNpcId(), player.getPosition());
91 brotherNpc.speak(
"How dare you disturb my rest!");
92 brotherNpc.getCombat().attack(player);
93 brotherNpc.owner = player;
97 private void move(
Position position) {
98 if (brotherNpc !=
null && !brotherNpc.isDead()) {
102 player.move(position);
107 if (mob.
isPlayer() && mob.equals(player)) {
115 player.barrowsKillCount += 1;
116 player.barrowKills[bro.ordinal()] =
true;
117 if (player.barrowsKillCount == 1) {
139 if (brotherNpc !=
null) {
151 if (!
Area.inBarrows(player)) {
156 private void reset() {
157 player.barrowsKillCount = 0;
158 player.barrowKills =
new boolean[
BrotherData.values().length];
159 player.hiddenBrother =
null;
165 int killed = player.barrowsKillCount;
168 String ahrim = player.barrowKills[
BrotherData.AHRIM.ordinal()] ?
"@red@Ahrim the Blighted" :
"@gre@Ahrim the Blighted";
169 String dharok = player.barrowKills[
BrotherData.DHAROK.ordinal()] ?
"@red@Dharok the Wretched" :
"@gre@Dharok the Wretched";
170 String guthan = player.barrowKills[
BrotherData.GUTHAN.ordinal()] ?
"@red@Guthan the Infested" :
"@gre@Guthan the Infested";
171 String karil = player.barrowKills[
BrotherData.KARIL.ordinal()] ?
"@red@Karil the Tainted" :
"@gre@Karil the Tainted";
172 String torag = player.barrowKills[
BrotherData.TORAG.ordinal()] ?
"@red@Torag the Corrupted" :
"@gre@Torag the Corrupted";
173 String verac = player.barrowKills[
BrotherData.VERAC.ordinal()] ?
"@red@Verac the Defiled" :
"@gre@Verac the Defiled";
174 ActivityPanel.
update(player, percentage,
"Barrows",
new Item(19629, 0),
"Killed: <col=FF5500>" + killed +
"</col> - Remaining: <col=FF5500>" + (total - killed) +
"</col>", ahrim, dharok, guthan, karil, torag, verac);
184 if (event.getOpcode() == 0 && event.getNpc().id == 1671) {
187 factory.
sendNpcChat(1671,
"Hello #name,",
"would you like me to reset your barrows?");
190 factory.
sendNpcChat(1671,
"I have reset your barrows!");
191 },
"No thanks", factory::execute);
199 protected boolean clickObject(
Player player, ObjectInteractionEvent event) {
200 int id =
event.getObject().getId();
203 if (player.barrowsKillCount == 6) {
209 BarrowsUtility.generateRewards(player);
210 player.send(
new SendMessage(
"You have completed the barrows minigame, well done!"));
212 }
else if (player.barrowsKillCount == 5) {
213 if (brotherNpc ==
null) {
216 brotherNpc.
speak(
"How dare you disturb my slumber!");
218 brotherNpc.owner = player;
219 player.send(
new SendEntityHintArrow(brotherNpc));
225 move(BrotherData.AHRIM.getHillPosition());
228 summon(BrotherData.AHRIM);
231 move(BrotherData.VERAC.getHillPosition());
234 summon(BrotherData.VERAC);
237 move(BrotherData.DHAROK.getHillPosition());
240 summon(BrotherData.DHAROK);
243 move(BrotherData.TORAG.getHillPosition());
246 summon(BrotherData.TORAG);
249 move(BrotherData.GUTHAN.getHillPosition());
252 summon(BrotherData.GUTHAN);
255 move(BrotherData.KARIL.getHillPosition());
258 summon(BrotherData.KARIL);
265 public ActivityDeathType deathType() {
266 return ActivityDeathType.NORMAL;
270 public ActivityType getType() {
271 return ActivityType.BARROWS;
Activity(int cooldown, int instance)
void onRegionChange(Player player)
void onLogout(Player player)
boolean canTeleport(Player player)
static void clear(Player player)
static void update(Player player, int amount, String title, String footer, String... strings)
final DialogueFactory sendOption(String option1, Runnable action1, String option2, Runnable action2)
final DialogueFactory sendPlayerChat(String... lines)
final DialogueFactory sendNpcChat(int id, String... lines)
final DialogueFactory execute()