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

Handles picking up a flax. More...

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

Public Member Functions

void execute ()
 A function representing the unit of work that will be carried out.
 FlaxPickingAction (Player player, GameObject object)
 Constructs a new FlaxPickingAction.
String getName ()
 Gets the name of this action.
WalkablePolicy getWalkablePolicy ()
 Gets the WalkablePolicy of this action.
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 GameObject object
 The flax game object.
boolean pickup
 The ticks.

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

Handles picking up a flax.

Author
Daniel

Definition at line 17 of file FlaxPickingAction.java.

Constructor & Destructor Documentation

◆ FlaxPickingAction()

com.runehive.game.action.impl.FlaxPickingAction.FlaxPickingAction ( Player player,
GameObject object )

Constructs a new FlaxPickingAction.

Parameters
playerThe player instance.
objectThe flax game object.

Definition at line 31 of file FlaxPickingAction.java.

31 {
32 super(player, 2, true);
33 this.object = object;
34 }

References object.

Member Function Documentation

◆ execute()

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

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

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

Definition at line 37 of file FlaxPickingAction.java.

37 {
38 Player player = getMob().getPlayer();
39
40 if (pickup) {
41 player.inventory.add(new Item(1779, 1));
42// if (Utility.random(6) == 1) {
43// World.submit(new ObjectReplacementEvent(object, 20));
44// }
45 cancel();
46 } else {
47 player.animate(new Animation(827));
48 pickup = true;
49 setDelay(1);
50 }
51 }

References com.runehive.game.world.items.containers.ItemContainer.add(), com.runehive.game.world.entity.mob.Mob.animate(), com.runehive.game.task.Task.cancel(), com.runehive.game.action.Action< T extends Mob >.getMob(), com.runehive.game.world.entity.mob.Mob.getPlayer(), com.runehive.game.world.entity.mob.player.Player.inventory, pickup, and com.runehive.game.task.Task.setDelay().

Here is the call graph for this function:

◆ getName()

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

54 {
55 return "Flax picking";
56 }

◆ getWalkablePolicy()

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

64 {
65 return WalkablePolicy.NON_WALKABLE;
66 }

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

◆ prioritized()

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

59 {
60 return false;
61 }

Member Data Documentation

◆ object

final GameObject com.runehive.game.action.impl.FlaxPickingAction.object
private

The flax game object.

Definition at line 20 of file FlaxPickingAction.java.

Referenced by FlaxPickingAction().

◆ pickup

boolean com.runehive.game.action.impl.FlaxPickingAction.pickup
private

The ticks.

Definition at line 23 of file FlaxPickingAction.java.

Referenced by execute().


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