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

An action that faces an npc, but resets their facing to their default facing direction after 15 seconds. More...

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

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.
 NpcFaceAction (Npc npc, Position face, int option)
 Constructs a new NpcFaceAction.
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.

Private Attributes

final int[] FIRST_OPTION = {}
 The array list of all the first option npcs that can not face.
final int[] FOURTH_OPTION = {}
int[] identification
 The npc identifications to check if face action is allowed.
final int[] SECOND_OPTION = {3080, 3010}
 The array list of all the second option npcs that can not face.
final int[] THIRD_OPTION = {}
 The array list of all the third option npcs that can not face.

Additional Inherited Members

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.
void onSchedule ()
 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

An action that faces an npc, but resets their facing to their default facing direction after 15 seconds.

Author
Daniel
Michael | Chex

Definition at line 19 of file NpcFaceAction.java.

Constructor & Destructor Documentation

◆ NpcFaceAction()

com.runehive.game.action.impl.NpcFaceAction.NpcFaceAction ( Npc npc,
Position face,
int option )

Constructs a new NpcFaceAction.

Parameters
npcThe npc.
faceThe face position.
optionThe option id.

Definition at line 49 of file NpcFaceAction.java.

49 {
50 super(npc, 25);
51 if (option == 0) identification = FIRST_OPTION;
52 else if (option == 1) identification = SECOND_OPTION;
53 else if (option == 2) identification = THIRD_OPTION;
54 else if (option == 3) identification = FOURTH_OPTION;
55
56 if (Arrays.stream(PetData.values()).anyMatch(p -> npc.id == p.getNpc())) {
57 cancel();
58 return;
59 }
60
61 if (identification != null && Arrays.stream(identification).anyMatch($it -> npc.id == $it)) {
62 cancel();
63 return;
64 }
65
66 getMob().face(face);
67 }

References com.runehive.game.task.Task.cancel(), FIRST_OPTION, FOURTH_OPTION, com.runehive.game.action.Action< T extends Mob >.getMob(), com.runehive.game.world.entity.mob.Mob.id, identification, SECOND_OPTION, and THIRD_OPTION.

Here is the call graph for this function:

Member Function Documentation

◆ execute()

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

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

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

Definition at line 70 of file NpcFaceAction.java.

70 {
71 Npc npc = getMob().getNpc();
72
73 if (npc.walk) {
74 getMob().face(getMob().faceDirection);
75 }
76
77 cancel();
78 }

References com.runehive.game.task.Task.cancel(), com.runehive.game.action.Action< T extends Mob >.getMob(), com.runehive.game.world.entity.mob.Mob.getNpc(), and com.runehive.game.world.entity.mob.npc.Npc.walk.

Here is the call graph for this function:

◆ getName()

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

81 {
82 return "Npc face";
83 }

◆ getWalkablePolicy()

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

91 {
92 return WalkablePolicy.NON_WALKABLE;
93 }

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

◆ prioritized()

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

86 {
87 return false;
88 }

Member Data Documentation

◆ FIRST_OPTION

final int [] com.runehive.game.action.impl.NpcFaceAction.FIRST_OPTION = {}
private

The array list of all the first option npcs that can not face.

Definition at line 28 of file NpcFaceAction.java.

28{};

Referenced by NpcFaceAction().

◆ FOURTH_OPTION

final int [] com.runehive.game.action.impl.NpcFaceAction.FOURTH_OPTION = {}
private

Definition at line 40 of file NpcFaceAction.java.

40{};

Referenced by NpcFaceAction().

◆ identification

int [] com.runehive.game.action.impl.NpcFaceAction.identification
private

The npc identifications to check if face action is allowed.

Definition at line 23 of file NpcFaceAction.java.

Referenced by NpcFaceAction().

◆ SECOND_OPTION

final int [] com.runehive.game.action.impl.NpcFaceAction.SECOND_OPTION = {3080, 3010}
private

The array list of all the second option npcs that can not face.

Definition at line 33 of file NpcFaceAction.java.

33{3080, 3010};

Referenced by NpcFaceAction().

◆ THIRD_OPTION

final int [] com.runehive.game.action.impl.NpcFaceAction.THIRD_OPTION = {}
private

The array list of all the third option npcs that can not face.

Definition at line 38 of file NpcFaceAction.java.

38{};

Referenced by NpcFaceAction().


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