RuneHive-Game
Loading...
Searching...
No Matches
com.runehive.content.activity.impl.barrows.Barrows Class Reference
Inheritance diagram for com.runehive.content.activity.impl.barrows.Barrows:
Collaboration diagram for com.runehive.content.activity.impl.barrows.Barrows:

Public Member Functions

boolean canTeleport (Player player)
 Called when the player attempts to teleport.
void cleanup ()
 Cleans up the activity when finished.
ActivityDeathType deathType ()
void finish ()
 Finishes the activity.
ActivityType getType ()
void onDeath (Mob mob)
 Called when the player die.
void onLogout (Player player)
 Called when the player logs out.
void onRegionChange (Player player)
 Called when the player changes region.
void update ()
 The update method.
Public Member Functions inherited from com.runehive.content.activity.Activity
 Activity (int cooldown, int instance)
 Constructs a new SequencedMinigame object.
void add (Mob mob)
 Adds a mob to the activity.
boolean canDrinkPotions (Player player)
boolean canEat (Player player, FoodData foodType)
boolean canEquipItem (Player player, Item item, EquipmentType type)
boolean canLogout (Player player)
boolean canSpellCast (Player player)
boolean canUsePrayer (Player player)
boolean canUseSpecial (Player player)
void cooldown (int cooldown)
 Applies a cooldown.
int getInstance ()
 Gets this activity's instance level.
Optional< Activity_PanelgetPanel ()
 Gets an optional of the activity panel.
int getTicks ()
 Gets the current ticks.
boolean onEvent (Player player, InteractionEvent interactionEvent)
boolean onStep (Mob mob)
void remove (Mob mob)
 Removes a mob from the activity.
void removeAll (Mob... mobs)
 Removes all mobs from the activity.
void sequence ()
 Sequences the activity.
void setInstance (int instance)
void setPanel (Activity_Panel panel)
 Sets the activity panel.
void setPause (boolean pause)
 Sets the pause state of the activity.

Static Public Member Functions

static Barrows create (Player player)
Static Public Member Functions inherited from com.runehive.content.activity.Activity
static boolean evaluate (Mob mob, Predicate< Activity > predicate)
static void forActivity (Mob mob, Consumer< Activity > consumer)
static< T extends Activity > Optional< T > search (Player player, Class< T > clazz)

Protected Member Functions

boolean clickNpc (Player player, NpcInteractionEvent event)
boolean clickObject (Player player, ObjectInteractionEvent event)
void start ()
 Starts the next activity stage.
Protected Member Functions inherited from com.runehive.content.activity.Activity
boolean clickButton (Player player, ClickButtonInteractionEvent event)
boolean clickItem (Player player, ItemInteractionEvent event)
final void finishCooldown ()
 Sets the cooldown flag to FINISH.
Optional<? extends ActivityListener<? extends Activity > > getListener ()
 Gets an Optional of the ActivityListener for this activity.
final boolean isPaused ()
 Checks if the cooldown is paused.
boolean itemContainerAction (Player player, ItemContainerInteractionEvent event)
final void pause ()
 Sets the cooldown flag to PAUSE.
boolean pickupItem (Player player, PickupItemInteractionEvent event)
final void resetCooldown ()
 Resets the remaining ticks to the cached cooldown ticks.
void restart (int delay, Runnable runnable)
boolean useItem (Player player, ItemOnItemInteractionEvent event)
boolean useItem (Player player, ItemOnObjectInteractionEvent event)

Private Member Functions

 Barrows (Player player)
void move (Position position)
void reset ()
void summon (BrotherData brother)

Private Attributes

Npc brotherNpc
Player player

Additional Inherited Members

Static Protected Attributes inherited from com.runehive.content.activity.Activity
static final int FINISH = -1
 The 'finish' cooldown id.
static final int PAUSE = -2
 The 'pause' cooldown id.
static final int START = 0
 The 'start' cooldown id.

Detailed Description

Definition at line 22 of file Barrows.java.

Constructor & Destructor Documentation

◆ Barrows()

com.runehive.content.activity.impl.barrows.Barrows.Barrows ( Player player)
private

Definition at line 28 of file Barrows.java.

28 {
29 super(10, Mob.DEFAULT_INSTANCE);
30 this.player = player;
31 }

References com.runehive.game.world.entity.Entity.DEFAULT_INSTANCE, and player.

Referenced by create().

Here is the caller graph for this function:

Member Function Documentation

◆ canTeleport()

boolean com.runehive.content.activity.impl.barrows.Barrows.canTeleport ( Player player)

Called when the player attempts to teleport.

Reimplemented from com.runehive.content.activity.Activity.

Definition at line 148 of file Barrows.java.

148 {
149 return true;
150 }

References player.

◆ cleanup()

void com.runehive.content.activity.impl.barrows.Barrows.cleanup ( )

Cleans up the activity when finished.

Reimplemented from com.runehive.content.activity.Activity.

Definition at line 108 of file Barrows.java.

108 {
109 if (brotherNpc != null) {
110 remove(brotherNpc);
111 }
112 }

References brotherNpc.

Referenced by finish().

Here is the caller graph for this function:

◆ clickNpc()

boolean com.runehive.content.activity.impl.barrows.Barrows.clickNpc ( Player player,
NpcInteractionEvent event )
protected

Reimplemented from com.runehive.content.activity.Activity.

Definition at line 153 of file Barrows.java.

153 {
154 if (event.getOpcode() == 0 && event.getNpc().id == 1671) {
155 DialogueFactory factory = player.dialogueFactory;
156
157 factory.sendNpcChat(1671, "Hello #name,", "would you like me to reset your barrows?");
158 factory.sendOption("Yes please", () -> {
159 reset();
160 factory.sendNpcChat(1671, "I have reset your barrows!");
161 }, "No thanks", factory::execute);
162 factory.execute();
163 return true;
164 }
165 return false;
166 }

References com.runehive.content.dialogue.DialogueFactory.execute(), player, reset(), com.runehive.content.dialogue.DialogueFactory.sendNpcChat(), and com.runehive.content.dialogue.DialogueFactory.sendOption().

Here is the call graph for this function:

◆ clickObject()

boolean com.runehive.content.activity.impl.barrows.Barrows.clickObject ( Player player,
ObjectInteractionEvent event )
protected

Reimplemented from com.runehive.content.activity.Activity.

Definition at line 169 of file Barrows.java.

169 {
170 int id = event.getObject().getId();
171 switch (id) {
172 case 20973:
173 if (player.barrowsKillCount == 6) {
174 if (player.inventory.getFreeSlots() < 5) {
175 player.dialogueFactory.sendPlayerChat("I should free up some inventory slots first.").execute();
176 return true;
177 }
178 reset();
179 BarrowsUtility.generateRewards(player);
180 player.send(new SendMessage("You have completed the barrows minigame, well done!"));
181 finish();
182 } else if (player.barrowsKillCount == 5) {
183 if (brotherNpc == null) {
184 brotherNpc = new Npc(player.hiddenBrother.getNpcId(), player.getPosition());
185 add(brotherNpc);
186 brotherNpc.speak("How dare you disturb my slumber!");
187 brotherNpc.getCombat().attack(player);
188 brotherNpc.owner = player;
189 player.send(new SendEntityHintArrow(brotherNpc));
190 }
191 return true;
192 }
193 break;
194 case 20667:
195 move(BrotherData.AHRIM.getHillPosition());
196 return true;
197 case 20770:
198 summon(BrotherData.AHRIM);
199 return true;
200 case 20672:
201 move(BrotherData.VERAC.getHillPosition());
202 return true;
203 case 20772:
204 summon(BrotherData.VERAC);
205 return true;
206 case 20668:
207 move(BrotherData.DHAROK.getHillPosition());
208 return true;
209 case 20720:
210 summon(BrotherData.DHAROK);
211 return true;
212 case 20671:
213 move(BrotherData.TORAG.getHillPosition());
214 return true;
215 case 20721:
216 summon(BrotherData.TORAG);
217 return true;
218 case 20669:
219 move(BrotherData.GUTHAN.getHillPosition());
220 return true;
221 case 20722:
222 summon(BrotherData.GUTHAN);
223 return true;
224 case 20670:
225 move(BrotherData.KARIL.getHillPosition());
226 return true;
227 case 20771:
228 summon(BrotherData.KARIL);
229 return true;
230 }
231 return false;
232 }

References com.runehive.content.activity.Activity.add(), com.runehive.content.activity.impl.barrows.BrotherData.AHRIM, brotherNpc, com.runehive.content.activity.impl.barrows.BrotherData.DHAROK, finish(), com.runehive.content.activity.impl.barrows.BarrowsUtility.generateRewards(), com.runehive.content.activity.impl.barrows.BrotherData.GUTHAN, com.runehive.content.activity.impl.barrows.BrotherData.KARIL, move(), player, reset(), summon(), com.runehive.content.activity.impl.barrows.BrotherData.TORAG, and com.runehive.content.activity.impl.barrows.BrotherData.VERAC.

Here is the call graph for this function:

◆ create()

Barrows com.runehive.content.activity.impl.barrows.Barrows.create ( Player player)
static

Definition at line 33 of file Barrows.java.

33 {
34 Barrows minigame = new Barrows(player);
35 minigame.add(player);
36 return minigame;
37 }

References com.runehive.content.activity.Activity.add(), Barrows(), and player.

Referenced by com.runehive.game.world.entity.mob.player.PlayerAssistant.setActivity(), and com.runehive.content.teleport.TeleportHandler.special().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ deathType()

ActivityDeathType com.runehive.content.activity.impl.barrows.Barrows.deathType ( )

Reimplemented from com.runehive.content.activity.Activity.

Definition at line 235 of file Barrows.java.

235 {
236 return ActivityDeathType.NORMAL;
237 }

References com.runehive.content.activity.ActivityDeathType.NORMAL.

◆ finish()

void com.runehive.content.activity.impl.barrows.Barrows.finish ( )

Finishes the activity.

Reimplemented from com.runehive.content.activity.Activity.

Definition at line 101 of file Barrows.java.

101 {
102 cleanup();
103 remove(player);
104 ActivityPanel.clear(player);
105 }

References cleanup(), com.runehive.content.activity.panel.ActivityPanel.clear(), and player.

Referenced by clickObject(), onDeath(), onLogout(), and onRegionChange().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getType()

ActivityType com.runehive.content.activity.impl.barrows.Barrows.getType ( )

Reimplemented from com.runehive.content.activity.Activity.

Definition at line 240 of file Barrows.java.

240 {
241 return ActivityType.BARROWS;
242 }

References com.runehive.content.activity.ActivityType.BARROWS.

◆ move()

void com.runehive.content.activity.impl.barrows.Barrows.move ( Position position)
private

Definition at line 67 of file Barrows.java.

67 {
68 if (brotherNpc != null && !brotherNpc.isDead()) {
69 remove(brotherNpc);
70 brotherNpc = null;
71 }
72 player.move(position);
73 }

References brotherNpc, and player.

Referenced by clickObject().

Here is the caller graph for this function:

◆ onDeath()

void com.runehive.content.activity.impl.barrows.Barrows.onDeath ( Mob mob)

Called when the player die.

Reimplemented from com.runehive.content.activity.Activity.

Definition at line 76 of file Barrows.java.

76 {
77 if (mob.isPlayer() && mob.equals(player)) {
78 finish();
79 return;
80 }
81 if (mob.isNpc()) {
82 BrotherData bro = BrotherData.getBarrowsBrother(mob.getNpc());
83 if (bro != null) {
84 brotherNpc = null;
85 player.barrowsKillCount += 1;
86 player.barrowKills[bro.ordinal()] = true;
87 if (player.barrowsKillCount == 1) {
88 player.hiddenBrother = BarrowsUtility.getHiddenBrother(player);
89 }
90 World.schedule(new NpcDeath(mob.getNpc()));
91 }
92 }
93 }

References brotherNpc, com.runehive.game.world.entity.Entity.equals(), finish(), com.runehive.content.activity.impl.barrows.BrotherData.getBarrowsBrother(), com.runehive.content.activity.impl.barrows.BarrowsUtility.getHiddenBrother(), com.runehive.game.world.entity.mob.Mob.getNpc(), com.runehive.game.world.entity.mob.Mob.isNpc(), com.runehive.game.world.entity.mob.Mob.isPlayer(), player, and com.runehive.game.world.World.schedule().

Here is the call graph for this function:

◆ onLogout()

void com.runehive.content.activity.impl.barrows.Barrows.onLogout ( Player player)

Called when the player logs out.

Reimplemented from com.runehive.content.activity.Activity.

Definition at line 115 of file Barrows.java.

115 {
116 finish();
117 }

References finish(), and player.

Here is the call graph for this function:

◆ onRegionChange()

void com.runehive.content.activity.impl.barrows.Barrows.onRegionChange ( Player player)

Called when the player changes region.

Reimplemented from com.runehive.content.activity.Activity.

Definition at line 120 of file Barrows.java.

120 {
121 if (!Area.inBarrows(player)) {
122 finish();
123 }
124 }

References finish(), com.runehive.game.world.position.Area.inBarrows(), and player.

Here is the call graph for this function:

◆ reset()

void com.runehive.content.activity.impl.barrows.Barrows.reset ( )
private

Definition at line 126 of file Barrows.java.

126 {
127 player.barrowsKillCount = 0;
128 player.barrowKills = new boolean[BrotherData.values().length];
129 player.hiddenBrother = null;
130 update();
131 }

References update().

Referenced by clickNpc(), and clickObject().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ start()

void com.runehive.content.activity.impl.barrows.Barrows.start ( )
protected

Starts the next activity stage.

Reimplemented from com.runehive.content.activity.Activity.

Definition at line 96 of file Barrows.java.

96 {
97
98 }

◆ summon()

void com.runehive.content.activity.impl.barrows.Barrows.summon ( BrotherData brother)
private

Definition at line 39 of file Barrows.java.

39 {
40 if (player.barrowKills[brother.ordinal()]) {
41 player.dialogueFactory.sendPlayerChat("I have already killed this brother.").execute();
42 return;
43 }
44 if (brotherNpc != null) {
45 player.dialogueFactory.sendPlayerChat("Maybe I should finish killing the other one first.").execute();
46 return;
47 }
48 if (player.hiddenBrother == brother && player.barrowsKillCount != 5) {
49 player.dialogueFactory.sendPlayerChat("I should return when I've killed the others.").execute();
50 return;
51 } else if (player.hiddenBrother == brother && player.barrowsKillCount == 5) {
52 player.dialogueFactory.sendOption("Enter the tunnel.", () -> {
53 player.move(new Position(3551, 9691, 0));
54 }, "No, I'm not ready yet.", () -> {
55 player.dialogueFactory.clear();
56 }).execute();
57 return;
58 }
59 brotherNpc = new Npc(brother.getNpcId(), player.getPosition());
60 add(brotherNpc);
61 brotherNpc.speak("How dare you disturb my rest!");
62 brotherNpc.getCombat().attack(player);
63 brotherNpc.owner = player;
64 player.send(new SendEntityHintArrow(brotherNpc));
65 }

References com.runehive.content.activity.Activity.add(), brotherNpc, com.runehive.content.activity.impl.barrows.BrotherData.getNpcId(), and player.

Referenced by clickObject().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ update()

void com.runehive.content.activity.impl.barrows.Barrows.update ( )

The update method.

Reimplemented from com.runehive.content.activity.Activity.

Definition at line 134 of file Barrows.java.

134 {
135 int killed = player.barrowsKillCount;
136 int total = BrotherData.values().length;
137 int percentage = (int) Utility.getPercentageAmount(killed, total);
138 String ahrim = player.barrowKills[BrotherData.AHRIM.ordinal()] ? "@red@Ahrim the Blighted" : "@gre@Ahrim the Blighted";
139 String dharok = player.barrowKills[BrotherData.DHAROK.ordinal()] ? "@red@Dharok the Wretched" : "@gre@Dharok the Wretched";
140 String guthan = player.barrowKills[BrotherData.GUTHAN.ordinal()] ? "@red@Guthan the Infested" : "@gre@Guthan the Infested";
141 String karil = player.barrowKills[BrotherData.KARIL.ordinal()] ? "@red@Karil the Tainted" : "@gre@Karil the Tainted";
142 String torag = player.barrowKills[BrotherData.TORAG.ordinal()] ? "@red@Torag the Corrupted" : "@gre@Torag the Corrupted";
143 String verac = player.barrowKills[BrotherData.VERAC.ordinal()] ? "@red@Verac the Defiled" : "@gre@Verac the Defiled";
144 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);
145 }

References com.runehive.content.activity.impl.barrows.BrotherData.AHRIM, com.runehive.content.activity.impl.barrows.BrotherData.DHAROK, com.runehive.util.Utility.getPercentageAmount(), com.runehive.content.activity.impl.barrows.BrotherData.GUTHAN, com.runehive.content.activity.impl.barrows.BrotherData.KARIL, player, com.runehive.content.activity.impl.barrows.BrotherData.TORAG, com.runehive.content.activity.panel.ActivityPanel.update(), and com.runehive.content.activity.impl.barrows.BrotherData.VERAC.

Referenced by reset().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ brotherNpc

Npc com.runehive.content.activity.impl.barrows.Barrows.brotherNpc
private

Definition at line 26 of file Barrows.java.

Referenced by cleanup(), clickObject(), move(), onDeath(), and summon().

◆ player

Player com.runehive.content.activity.impl.barrows.Barrows.player
private

The documentation for this class was generated from the following file:
  • java/com/runehive/content/activity/impl/barrows/Barrows.java