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

Created by Daniel on 2017-10-12. More...

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

Public Member Functions

void execute ()
 A function representing the unit of work that will be carried out.
String getName ()
 Gets the name of this action.
WalkablePolicy getWalkablePolicy ()
 Gets the WalkablePolicy of this action.
 LadderAction (Player mob, GameObject ladder, Position position)
 LadderAction (Player mob, GameObject ladder, Position position, Predicate< Player > condition, String message)
boolean prioritized ()
 Determines if this action is prioritized.
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.

Protected Member Functions

boolean canSchedule ()
 A function executed on registration.
void onCancel (boolean logout)
 A function executed on cancellation.
void onSchedule ()
 A function executed on registration.
Protected Member Functions inherited from com.runehive.game.task.Task
void baseExecute ()

Private Attributes

final Predicate< Playercondition
int count
final GameObject ladder
final String message
final Position position

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

Created by Daniel on 2017-10-12.

Definition at line 18 of file LadderAction.java.

Constructor & Destructor Documentation

◆ LadderAction() [1/2]

com.runehive.game.action.impl.LadderAction.LadderAction ( Player mob,
GameObject ladder,
Position position )

Definition at line 25 of file LadderAction.java.

25 {
26 this(mob, ladder, position, null, null);
27 }

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

◆ LadderAction() [2/2]

com.runehive.game.action.impl.LadderAction.LadderAction ( Player mob,
GameObject ladder,
Position position,
Predicate< Player > condition,
String message )

Definition at line 29 of file LadderAction.java.

29 {
30 super(mob, 1, false);
31 this.ladder = ladder;
32 this.position = position;
33 this.condition = condition;
34 this.message = message;
35 }

References condition, ladder, message, com.runehive.game.action.Action< T extends Mob >.mob, and position.

Member Function Documentation

◆ canSchedule()

boolean com.runehive.game.action.impl.LadderAction.canSchedule ( )
protected

A function executed on registration.

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

Definition at line 38 of file LadderAction.java.

38 {
39 if (condition != null && !condition.test(getMob())) {
40 getMob().send(new SendMessage(message, MessageColor.RED));
41 return false;
42 }
43 return true;
44 }

References condition, com.runehive.game.action.Action< T extends Mob >.getMob(), message, and com.runehive.util.MessageColor.RED.

Here is the call graph for this function:

◆ execute()

void com.runehive.game.action.impl.LadderAction.execute ( )

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

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

Definition at line 55 of file LadderAction.java.

55 {
56 if (count == 0) {
57 getMob().animate(new Animation(828, UpdatePriority.VERY_HIGH));
58 } else if (count == 1) {
59 getMob().move(position);
60 cancel();
61 }
62 count++;
63 }

References com.runehive.game.task.Task.cancel(), count, com.runehive.game.action.Action< T extends Mob >.getMob(), position, and com.runehive.game.UpdatePriority.VERY_HIGH.

Here is the call graph for this function:

◆ getName()

String com.runehive.game.action.impl.LadderAction.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 75 of file LadderAction.java.

75 {
76 return "Ladder action";
77 }

◆ getWalkablePolicy()

WalkablePolicy com.runehive.game.action.impl.LadderAction.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 70 of file LadderAction.java.

70 {
71 return WalkablePolicy.NON_WALKABLE;
72 }

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

◆ onCancel()

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

A function executed on cancellation.

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

Definition at line 66 of file LadderAction.java.

66 {
67 }

◆ onSchedule()

void com.runehive.game.action.impl.LadderAction.onSchedule ( )
protected

A function executed on registration.

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

Definition at line 47 of file LadderAction.java.

47 {
48 getMob().locking.lock();
49 getMob().face(ladder.getPosition());
50 getMob().getCombat().reset();
51 getMob().damageImmunity.reset(3_000);
52 }

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

Here is the call graph for this function:

◆ prioritized()

boolean com.runehive.game.action.impl.LadderAction.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 80 of file LadderAction.java.

80 {
81 return false;
82 }

Member Data Documentation

◆ condition

final Predicate<Player> com.runehive.game.action.impl.LadderAction.condition
private

Definition at line 22 of file LadderAction.java.

Referenced by canSchedule(), and LadderAction().

◆ count

int com.runehive.game.action.impl.LadderAction.count
private

Definition at line 19 of file LadderAction.java.

Referenced by execute().

◆ ladder

final GameObject com.runehive.game.action.impl.LadderAction.ladder
private

Definition at line 20 of file LadderAction.java.

Referenced by LadderAction(), LadderAction(), and onSchedule().

◆ message

final String com.runehive.game.action.impl.LadderAction.message
private

Definition at line 23 of file LadderAction.java.

Referenced by canSchedule(), and LadderAction().

◆ position

final Position com.runehive.game.action.impl.LadderAction.position
private

Definition at line 21 of file LadderAction.java.

Referenced by execute(), LadderAction(), and LadderAction().


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