RuneHive-Game
Loading...
Searching...
No Matches
com.runehive.game.action.impl.BuryBoneAction Class Reference

Handles burying a bone. More...

Inheritance diagram for com.runehive.game.action.impl.BuryBoneAction:
Collaboration diagram for com.runehive.game.action.impl.BuryBoneAction:

Public Member Functions

Optional< SkillAnimationanimation ()
 The skill animation to execute.
 BuryBoneAction (Player player, BoneData bone, int slot)
boolean canInit ()
 Determines if this action can be initialized.
double experience ()
 The experience given from this action.
String getName ()
 Gets the name of this action.
WalkablePolicy getWalkablePolicy ()
 Gets the WalkablePolicy of this action.
void init ()
 Any functionality that should be handled when this action is submitted.
void onCancel (boolean logout)
 A function executed on cancellation.
void onExecute ()
 The method which is called on intervals of the specified #delay;.
boolean prioritized ()
 Determines if this action is prioritized.
int skill ()
 The skill we should hand to experience to.
Public Member Functions inherited from com.runehive.content.skill.SkillAction
boolean ignore ()
 Determines if future skill actions from the same type should be ignored.
 SkillAction (Mob mob, Optional< Position > position, boolean instant)
 Creates a new Action randomevent.
 SkillAction (Mob mob, Optional< Position > position, int delay, boolean instant)
 Creates a new Action randomevent.
final void start ()
 Attempts to start the skill.
Public Member Functions inherited from com.runehive.game.action.Action< T extends Mob >
 Action (T mob, int delay)
 Creates a new Action randomevent.
 Action (T mob, int delay, boolean instant)
 Creates a new Action randomevent.
boolean cancellableInProgress ()
getMob ()
 Gets the player.
Public Member Functions inherited from com.runehive.game.task.Task
Task attach (Object newKey)
 Attaches a new key.
synchronized final void cancel ()
 Cancels all subsequent executions.
synchronized final void cancel (boolean logout)
 Cancels all subsequent executions.
boolean canRun ()
 Determines if the task can be ran.
Optional< Object > getAttachment ()
String getCreationStackTraceStr ()
int getDelay ()
Long getElapsedTimeFromRunStartTime ()
Optional< Long > getRunStartTime ()
long getTaskCreationTime ()
String getTaskId ()
boolean isInstant ()
boolean isRunning ()
void setDelay (int delay)
 Sets the cyclic delay.
void setExecutionTime ()
 Task (boolean instant, int delay)
 Creates a new Task.
 Task (int delay)
 Creates a new Task that doesn't execute instantly.

Private Attributes

final BoneData bone
final Item item
final int slot

Additional Inherited Members

Protected Member Functions inherited from com.runehive.content.skill.SkillAction
final void execute ()
 A function representing the unit of work that will be carried out.
final void onSchedule ()
 A function executed on registration.
Protected Member Functions inherited from com.runehive.game.task.Task
void baseExecute ()
boolean canSchedule ()
 A function executed on registration.
Package Functions inherited from com.runehive.game.task.Task
void onException (Exception e)
 A function executed on thrown exceptions.
void onLoop ()
 A function executed when iterated over.
final synchronized void process ()
synchronized void setRunning (boolean running)

Detailed Description

Handles burying a bone.

Author
Michael | Chex

Definition at line 23 of file BuryBoneAction.java.

Constructor & Destructor Documentation

◆ BuryBoneAction()

com.runehive.game.action.impl.BuryBoneAction.BuryBoneAction ( Player player,
BoneData bone,
int slot )

Definition at line 28 of file BuryBoneAction.java.

28 {
29 super(player, Optional.empty(), true);
30 this.slot = slot;
31 this.bone = bone;
32 this.item = player.inventory.get(slot);
33 }

References bone, com.runehive.game.world.items.containers.ItemContainer.get(), and com.runehive.game.world.entity.mob.player.Player.inventory.

Here is the call graph for this function:

Member Function Documentation

◆ animation()

Optional< SkillAnimation > com.runehive.game.action.impl.BuryBoneAction.animation ( )

The skill animation to execute.

Returns
the skill animation to execute.

Reimplemented from com.runehive.content.skill.SkillAction.

Definition at line 80 of file BuryBoneAction.java.

80 {
81 return Optional.empty();
82 }

◆ canInit()

boolean com.runehive.game.action.impl.BuryBoneAction.canInit ( )

Determines if this action can be initialized.

Returns
true if it can, false otherwise.

Reimplemented from com.runehive.content.skill.SkillAction.

Definition at line 36 of file BuryBoneAction.java.

36 {
37 return getMob().skills.getSkills()[skill()].stopwatch.elapsed(1200);
38 }

References com.runehive.game.action.Action< T extends Mob >.getMob(), and skill().

Here is the call graph for this function:

◆ experience()

double com.runehive.game.action.impl.BuryBoneAction.experience ( )

The experience given from this action.

Returns
the numerical value representing the amount of experience given.

Reimplemented from com.runehive.content.skill.SkillAction.

Definition at line 85 of file BuryBoneAction.java.

85 {
86 double exp = (bone.getExperience() * Config.PRAYER_MODIFICATION);
87 if (SkillCape.isEquipped(getMob().getPlayer(), SkillCape.PRAYER)) {
88 exp *= 2.0;
89 }
90 return exp;
91 }

References bone, com.runehive.game.action.Action< T extends Mob >.getMob(), com.runehive.content.skillcape.SkillCape.isEquipped(), com.runehive.content.skillcape.SkillCape.PRAYER, and com.runehive.Config.PRAYER_MODIFICATION.

Referenced by onExecute().

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

◆ getName()

String com.runehive.game.action.impl.BuryBoneAction.getName ( )

Gets the name of this action.

Returns
The name of this action.

Reimplemented from com.runehive.game.action.Action< T extends Mob >.

Definition at line 99 of file BuryBoneAction.java.

99 {
100 return "Bone bury";
101 }

◆ getWalkablePolicy()

WalkablePolicy com.runehive.game.action.impl.BuryBoneAction.getWalkablePolicy ( )

Gets the WalkablePolicy of this action.

Returns
The walkable policy of this action.

Reimplemented from com.runehive.game.action.Action< T extends Mob >.

Definition at line 109 of file BuryBoneAction.java.

109 {
110 return WalkablePolicy.NON_WALKABLE;
111 }

References com.runehive.game.action.policy.WalkablePolicy.NON_WALKABLE.

◆ init()

void com.runehive.game.action.impl.BuryBoneAction.init ( )

Any functionality that should be handled when this action is submitted.

Reimplemented from com.runehive.content.skill.SkillAction.

Definition at line 41 of file BuryBoneAction.java.

41 {
42
43 }

◆ onCancel()

void com.runehive.game.action.impl.BuryBoneAction.onCancel ( boolean logout)

A function executed on cancellation.

Reimplemented from com.runehive.game.task.Task.

Definition at line 75 of file BuryBoneAction.java.

75 {
76 getMob().skills.getSkills()[skill()].stopwatch.reset();
77 }

References com.runehive.game.action.Action< T extends Mob >.getMob(), and skill().

Here is the call graph for this function:

◆ onExecute()

void com.runehive.game.action.impl.BuryBoneAction.onExecute ( )

The method which is called on intervals of the specified #delay;.

Reimplemented from com.runehive.content.skill.SkillAction.

Definition at line 46 of file BuryBoneAction.java.

46 {
47 getMob().animate(new Animation(827));
48 Player player = getMob().getPlayer();
49 player.inventory.remove(item, slot, true);
50 player.skills.addExperience(skill(), experience());
51 player.send(new SendMessage("You bury the " + item.getName() + "."));
52 AchievementHandler.activate(player, AchievementKey.BURY_BONES, 1);
53
54 if (player.equipment.hasAmulet() && player.equipment.getAmuletSlot().getId() == 22111) {
55 int current = player.skills.getLevel(Skill.PRAYER);
56 int maximum = player.skills.getMaxLevel(Skill.PRAYER);
57
58 if (current < maximum) {
59 int points = bone.getBoneAmulet();
60
61 if (current + points > maximum) {
62 points = maximum - current;
63 }
64
65 player.skills.get(Skill.PRAYER).addLevel(points);
66 player.skills.refresh(Skill.PRAYER);
67 player.message("You feel your " + player.equipment.getAmuletSlot().getName() + " vibrate as you bury the bone.");
68 }
69 }
70
71 cancel();
72 }

References com.runehive.content.achievement.AchievementHandler.activate(), com.runehive.game.world.entity.skill.SkillManager.addExperience(), com.runehive.game.world.entity.skill.Skill.addLevel(), bone, com.runehive.content.achievement.AchievementKey.BURY_BONES, com.runehive.game.task.Task.cancel(), com.runehive.game.world.entity.mob.player.Player.equipment, experience(), com.runehive.game.world.entity.skill.SkillManager.get(), com.runehive.game.world.items.containers.equipment.Equipment.getAmuletSlot(), com.runehive.game.world.items.Item.getId(), com.runehive.game.world.entity.skill.SkillManager.getLevel(), com.runehive.game.world.entity.skill.SkillManager.getMaxLevel(), com.runehive.game.action.Action< T extends Mob >.getMob(), com.runehive.game.world.items.Item.getName(), com.runehive.game.world.entity.mob.Mob.getPlayer(), com.runehive.game.world.items.containers.equipment.Equipment.hasAmulet(), com.runehive.game.world.entity.mob.player.Player.inventory, item, com.runehive.game.world.entity.mob.player.Player.message(), com.runehive.game.world.entity.skill.Skill.PRAYER, com.runehive.game.world.entity.skill.SkillManager.refresh(), com.runehive.game.world.items.containers.ItemContainer.remove(), com.runehive.game.world.entity.mob.player.Player.send(), skill(), and com.runehive.game.world.entity.mob.Mob.skills.

Here is the call graph for this function:

◆ prioritized()

boolean com.runehive.game.action.impl.BuryBoneAction.prioritized ( )

Determines if this action is prioritized.

When making an action prioritized, the next action will be ignored if not queued.

Returns
true if this action is prioritized, false otherwise.

Reimplemented from com.runehive.game.action.Action< T extends Mob >.

Definition at line 104 of file BuryBoneAction.java.

104 {
105 return false;
106 }

◆ skill()

int com.runehive.game.action.impl.BuryBoneAction.skill ( )

The skill we should hand to experience to.

Reimplemented from com.runehive.content.skill.SkillAction.

Definition at line 94 of file BuryBoneAction.java.

94 {
95 return Skill.PRAYER;
96 }

References com.runehive.game.world.entity.skill.Skill.PRAYER.

Referenced by canInit(), onCancel(), and onExecute().

Here is the caller graph for this function:

Member Data Documentation

◆ bone

final BoneData com.runehive.game.action.impl.BuryBoneAction.bone
private

Definition at line 26 of file BuryBoneAction.java.

Referenced by BuryBoneAction(), experience(), and onExecute().

◆ item

final Item com.runehive.game.action.impl.BuryBoneAction.item
private

Definition at line 25 of file BuryBoneAction.java.

Referenced by onExecute().

◆ slot

final int com.runehive.game.action.impl.BuryBoneAction.slot
private

Definition at line 24 of file BuryBoneAction.java.


The documentation for this class was generated from the following file: