RuneHive-Game
Loading...
Searching...
No Matches
com.runehive.game.action.impl.LeverAction Class Reference
Inheritance diagram for com.runehive.game.action.impl.LeverAction:
Collaboration diagram for com.runehive.game.action.impl.LeverAction:

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.
 LeverAction (Player mob, GameObject lever, Position position, Direction face)
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 Member Functions

 LeverAction (Player mob, GameObject lever, Position position, Direction face, Predicate< Player > condition, String message)

Private Attributes

final Predicate< Playercondition
int count
final Direction face
final GameObject lever
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

Definition at line 18 of file LeverAction.java.

Constructor & Destructor Documentation

◆ LeverAction() [1/2]

com.runehive.game.action.impl.LeverAction.LeverAction ( Player mob,
GameObject lever,
Position position,
Direction face )

Definition at line 26 of file LeverAction.java.

26 {
27 this(mob, lever, position, face, null, null);
28 }

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

◆ LeverAction() [2/2]

com.runehive.game.action.impl.LeverAction.LeverAction ( Player mob,
GameObject lever,
Position position,
Direction face,
Predicate< Player > condition,
String message )
private

Definition at line 30 of file LeverAction.java.

30 {
31 super(mob, 1, false);
32 this.lever = lever;
33 this.position = position;
34 this.face = face;
35 this.condition = condition;
36 this.message = message;
37 }

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

Member Function Documentation

◆ canSchedule()

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

A function executed on registration.

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

Definition at line 40 of file LeverAction.java.

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

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.LeverAction.execute ( )

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

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

Definition at line 57 of file LeverAction.java.

57 {
58 if (count == 0) {
59 getMob().send(new SendMessage("You pull the lever..."));
60 getMob().animate(new Animation(2140, UpdatePriority.VERY_HIGH));
61 } else if (count == 1) {
62 Teleportation.activateOverride(getMob(), position, TeleportationData.MODERN);
63 cancel();
64 }
65 count++;
66 }

References com.runehive.content.skill.impl.magic.teleport.Teleportation.activateOverride(), com.runehive.game.task.Task.cancel(), count, com.runehive.game.action.Action< T extends Mob >.getMob(), com.runehive.content.skill.impl.magic.teleport.TeleportationData.MODERN, position, and com.runehive.game.UpdatePriority.VERY_HIGH.

Here is the call graph for this function:

◆ getName()

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

79 {
80 return "Lever action";
81 }

◆ getWalkablePolicy()

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

74 {
75 return WalkablePolicy.NON_WALKABLE;
76 }

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

◆ onCancel()

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

A function executed on cancellation.

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

Definition at line 69 of file LeverAction.java.

69 {
70 getMob().locking.unlock();
71 }

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

Here is the call graph for this function:

◆ onSchedule()

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

A function executed on registration.

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

Definition at line 49 of file LeverAction.java.

49 {
50 getMob().locking.lock();
51 getMob().face(position);
52 getMob().getCombat().reset();
53 getMob().damageImmunity.reset(3_000);
54 }

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

Here is the call graph for this function:

◆ prioritized()

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

84 {
85 return false;
86 }

Member Data Documentation

◆ condition

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

Definition at line 23 of file LeverAction.java.

Referenced by canSchedule(), and LeverAction().

◆ count

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

Definition at line 19 of file LeverAction.java.

Referenced by execute().

◆ face

final Direction com.runehive.game.action.impl.LeverAction.face
private

Definition at line 22 of file LeverAction.java.

Referenced by LeverAction(), and LeverAction().

◆ lever

final GameObject com.runehive.game.action.impl.LeverAction.lever
private

Definition at line 20 of file LeverAction.java.

Referenced by LeverAction(), and LeverAction().

◆ message

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

Definition at line 24 of file LeverAction.java.

Referenced by canSchedule(), and LeverAction().

◆ position

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

Definition at line 21 of file LeverAction.java.

Referenced by execute(), LeverAction(), LeverAction(), and onSchedule().


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