RuneHive-Game
Loading...
Searching...
No Matches
com.runehive.content.skill.SkillAction Class Referenceabstract
Inheritance diagram for com.runehive.content.skill.SkillAction:
Collaboration diagram for com.runehive.content.skill.SkillAction:

Classes

class  SkillAnimation
 A simple wrapper class which wraps an animation to a delay. More...

Public Member Functions

abstract Optional< SkillAnimationanimation ()
 The skill animation to execute.
abstract boolean canInit ()
 Determines if this action can be initialized.
abstract double experience ()
 The experience given from this action.
boolean ignore ()
 Determines if future skill actions from the same type should be ignored.
abstract void init ()
 Any functionality that should be handled when this action is submitted.
abstract void onExecute ()
 The method which is called on intervals of the specified #delay;.
abstract int skill ()
 The skill we should hand to experience to.
 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.
abstract String getName ()
 Gets the name of this action.
abstract WalkablePolicy getWalkablePolicy ()
 Gets the WalkablePolicy of this action.
boolean prioritized ()
 Determines if this action is prioritized.
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.

Protected Member Functions

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.
void onCancel (boolean logout)
 A function executed on cancellation.

Private Attributes

int animationCounter
 The animation counter of this task.
final Optional< Positionposition
 The position we should face.

Additional Inherited Members

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

Author
Stand Up
Since
19-12-2016.

Definition at line 14 of file SkillAction.java.

Constructor & Destructor Documentation

◆ SkillAction() [1/2]

com.runehive.content.skill.SkillAction.SkillAction ( Mob mob,
Optional< Position > position,
int delay,
boolean instant )

Creates a new Action randomevent.

Parameters
mobmob.
positionposition.
delaythe delay to repeat this action on.
instantinstant.

Definition at line 29 of file SkillAction.java.

29 {
30 super(mob, delay, instant);
31 this.position = position;
32 }

References com.runehive.game.task.Task.delay, com.runehive.game.task.Task.instant, com.runehive.game.action.Action< T extends Mob >.mob, and position.

◆ SkillAction() [2/2]

com.runehive.content.skill.SkillAction.SkillAction ( Mob mob,
Optional< Position > position,
boolean instant )

Creates a new Action randomevent.

Parameters
mobmob.
positionposition.
instantinstant.

Definition at line 41 of file SkillAction.java.

41 {
42 this(mob, position, 1, instant);
43 }

References com.runehive.game.task.Task.instant, com.runehive.game.action.Action< T extends Mob >.mob, and position.

Member Function Documentation

◆ animation()

abstract Optional< SkillAnimation > com.runehive.content.skill.SkillAction.animation ( )
abstract

The skill animation to execute.

Returns
the skill animation to execute.

Reimplemented in com.runehive.content.skill.impl.firemaking.FiremakingAction, com.runehive.content.skill.impl.smithing.SmithingArmour, com.runehive.game.action.impl.BuryBoneAction, and com.runehive.game.action.impl.ScatterAshAction.

Referenced by execute(), and onSchedule().

Here is the caller graph for this function:

◆ canInit()

abstract boolean com.runehive.content.skill.SkillAction.canInit ( )
abstract

Determines if this action can be initialized.

Returns
true if it can, false otherwise.

Reimplemented in com.runehive.content.skill.impl.firemaking.FiremakingAction, com.runehive.content.skill.impl.smithing.SmithingArmour, com.runehive.game.action.impl.BuryBoneAction, and com.runehive.game.action.impl.ScatterAshAction.

Referenced by onSchedule(), and start().

Here is the caller graph for this function:

◆ execute()

final void com.runehive.content.skill.SkillAction.execute ( )
protected

A function representing the unit of work that will be carried out.

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

Definition at line 125 of file SkillAction.java.

125 {
126 if (!canRun()) {
127 cancel();
128 return;
129 }
130
131 if (animation().isPresent() && animationCounter++ > animation().get().delay) {
132 getMob().animate(animation().get().animation);
133 animationCounter = 0;
134 }
135
136 onExecute();
137 }

References animation(), animationCounter, com.runehive.game.task.Task.cancel(), com.runehive.game.task.Task.canRun(), com.runehive.game.task.Task.delay, com.runehive.game.action.Action< T extends Mob >.getMob(), and onExecute().

Referenced by com.runehive.content.skill.impl.firemaking.FiremakingAction.onDestruct().

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

◆ experience()

abstract double com.runehive.content.skill.SkillAction.experience ( )
abstract

The experience given from this action.

Returns
the numerical value representing the amount of experience given.

Reimplemented in com.runehive.content.skill.impl.firemaking.FiremakingAction, com.runehive.content.skill.impl.smithing.SmithingArmour, com.runehive.game.action.impl.BuryBoneAction, and com.runehive.game.action.impl.ScatterAshAction.

Referenced by com.runehive.content.skill.impl.DestructionSkillAction.onExecute(), com.runehive.content.skill.impl.HarvestingSkillAction.onExecute(), and com.runehive.content.skill.impl.ProducingSkillAction.onExecute().

Here is the caller graph for this function:

◆ ignore()

boolean com.runehive.content.skill.SkillAction.ignore ( )

Determines if future skill actions from the same type should be ignored.

Returns

Definition at line 103 of file SkillAction.java.

103 {
104 return false;
105 }

◆ init()

abstract void com.runehive.content.skill.SkillAction.init ( )
abstract

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

Reimplemented in com.runehive.content.skill.impl.firemaking.FiremakingAction, com.runehive.content.skill.impl.smithing.SmithingArmour, com.runehive.game.action.impl.BuryBoneAction, and com.runehive.game.action.impl.ScatterAshAction.

Referenced by onSchedule().

Here is the caller graph for this function:

◆ onExecute()

abstract void com.runehive.content.skill.SkillAction.onExecute ( )
abstract

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

Reimplemented in com.runehive.content.skill.impl.DestructionSkillAction, com.runehive.content.skill.impl.HarvestingSkillAction, com.runehive.content.skill.impl.ProducingSkillAction, com.runehive.game.action.impl.BuryBoneAction, and com.runehive.game.action.impl.ScatterAshAction.

Referenced by execute().

Here is the caller graph for this function:

◆ onSchedule()

final void com.runehive.content.skill.SkillAction.onSchedule ( )
protected

A function executed on registration.

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

Definition at line 113 of file SkillAction.java.

113 {
114 if (!canRun() || !canInit()) {
115 this.cancel();
116 return;
117 }
118 if (animation().isPresent() && animation().get().instant) {
119 getMob().animate(animation().get().animation);
120 }
121 init();
122 }

References animation(), com.runehive.game.task.Task.cancel(), canInit(), com.runehive.game.task.Task.canRun(), com.runehive.game.action.Action< T extends Mob >.getMob(), init(), and com.runehive.game.task.Task.instant.

Here is the call graph for this function:

◆ skill()

abstract int com.runehive.content.skill.SkillAction.skill ( )
abstract

◆ start()

final void com.runehive.content.skill.SkillAction.start ( )

Attempts to start the skill.

Definition at line 48 of file SkillAction.java.

48 {
49 //determine if this task can be initialized.
50 if (!canInit()) {
51 return;
52 }
53
54 //reset any other action.
55 getMob().action.clearNonWalkableActions();
56
57 //submit this action.
58 getMob().action.execute(this, false);
59 position.ifPresent(getMob()::face);
60 }

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

Referenced by com.runehive.content.skill.impl.prayer.BoneSacrifice.clickItem().

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

Member Data Documentation

◆ animationCounter

int com.runehive.content.skill.SkillAction.animationCounter
private

The animation counter of this task.

Definition at line 110 of file SkillAction.java.

Referenced by execute().

◆ position


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