RuneHive-Game
Loading...
Searching...
No Matches
com.runehive.content.wintertodt.actions.ChopRoots Class Reference
Inheritance diagram for com.runehive.content.wintertodt.actions.ChopRoots:
Collaboration diagram for com.runehive.content.wintertodt.actions.ChopRoots:

Public Member Functions

 ChopRoots (Player player)
String getName ()
 Gets the name of this action.
WalkablePolicy getWalkablePolicy ()
 Gets the WalkablePolicy of this action.
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.
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

void execute ()
 A function representing the unit of work that will be carried out.
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 Attributes

int tick

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 12 of file ChopRoots.java.

Constructor & Destructor Documentation

◆ ChopRoots()

com.runehive.content.wintertodt.actions.ChopRoots.ChopRoots ( Player player)

Definition at line 15 of file ChopRoots.java.

15 {
16 super(player, 1);
17 }

Member Function Documentation

◆ execute()

void com.runehive.content.wintertodt.actions.ChopRoots.execute ( )
protected

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

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

Definition at line 30 of file ChopRoots.java.

30 {
31 AxeData axeData = AxeData.getDefinition(getMob()).orElse(null);
32
33 if (axeData == null) {
34 getMob().message("You need an axe to chop this tree.");
35 getMob().animate(65535);
36 getMob().action.getCurrentAction().cancel();
37 return;
38 }
39
40 if(getMob().inventory.getFreeSlots() <= 0) {
41 getMob().message("You have no space for that.");
42 getMob().animate(65535);
43 getMob().action.getCurrentAction().cancel();
44 return;
45 }
46
47 getMob().animate(axeData.animation);
48
49 if(tick % 3 == 0) {
50 getMob().inventory.add(new Item(Wintertodt.BRUMA_ROOT));
51 getMob().inventory.refresh();
52 getMob().message("You get a bruma root.");
53 double xp = Skill.getLevelForExperience(getMob().skills.get(Skill.WOODCUTTING).getExperience()) * 0.3;
54 if(xp > 0) getMob().skills.addExperience(Skill.WOODCUTTING, xp * Config.WOODCUTTING_MODIFICATION);
55 }
56 tick++;
57 }

References com.runehive.content.skill.impl.woodcutting.AxeData.animation, com.runehive.content.wintertodt.Wintertodt.BRUMA_ROOT, com.runehive.content.skill.impl.woodcutting.AxeData.getDefinition(), com.runehive.game.world.entity.skill.Skill.getLevelForExperience(), com.runehive.game.action.Action< T extends Mob >.getMob(), tick, com.runehive.game.world.entity.skill.Skill.WOODCUTTING, and com.runehive.Config.WOODCUTTING_MODIFICATION.

Here is the call graph for this function:

◆ getName()

String com.runehive.content.wintertodt.actions.ChopRoots.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 25 of file ChopRoots.java.

25 {
26 return "Chop roots";
27 }

◆ getWalkablePolicy()

WalkablePolicy com.runehive.content.wintertodt.actions.ChopRoots.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 20 of file ChopRoots.java.

20 {
21 return WalkablePolicy.NON_WALKABLE;
22 }

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

Member Data Documentation

◆ tick

int com.runehive.content.wintertodt.actions.ChopRoots.tick
package

Definition at line 14 of file ChopRoots.java.

Referenced by execute().


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