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

Public Member Functions

String getName ()
 Gets the name of this action.
WalkablePolicy getWalkablePolicy ()
 Gets the WalkablePolicy of this action.
 MixHerb (Player player, int amount)
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 amount
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 11 of file MixHerb.java.

Constructor & Destructor Documentation

◆ MixHerb()

com.runehive.content.wintertodt.actions.MixHerb.MixHerb ( Player player,
int amount )

Definition at line 15 of file MixHerb.java.

15 {
16 super(player, 1);
17 this.amount = amount;
18 }

References amount.

Member Function Documentation

◆ execute()

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

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

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

Definition at line 31 of file MixHerb.java.

31 {
32 if(!getMob().inventory.contains(Wintertodt.BRUMA_HERB) || !getMob().inventory.contains(Wintertodt.REJUV_POT_UNF)) {
33 getMob().animate(65535);
34 getMob().action.getCurrentAction().cancel();
35 return;
36 }
37
38 if(tick % 2 == 0) {
39
40 getMob().message("You combine the bruma herb into the unfinished potion.");
41 getMob().animate(363);
42 getMob().inventory.remove(new Item(Wintertodt.BRUMA_HERB));
43 getMob().inventory.remove(new Item(Wintertodt.REJUV_POT_UNF));
44 getMob().inventory.add(new Item(Wintertodt.REJUV_POT_4));
45 getMob().inventory.refresh();
46 double xp = Skill.getLevelForExperience(getMob().skills.get(Skill.HERBLORE).getExperience()) * 0.1;
47 if(xp > 0) getMob().skills.addExperience(Skill.HERBLORE, xp * Config.HERBLORE_MODIFICATION);
48
49 amount--;
50 if(amount <= 0) {
51 getMob().animate(65535);
52 getMob().action.getCurrentAction().cancel();
53 return;
54 }
55 }
56
57 tick++;
58 }

References amount, com.runehive.content.wintertodt.Wintertodt.BRUMA_HERB, com.runehive.game.world.entity.skill.Skill.getLevelForExperience(), com.runehive.game.action.Action< T extends Mob >.getMob(), com.runehive.game.world.entity.skill.Skill.HERBLORE, com.runehive.Config.HERBLORE_MODIFICATION, com.runehive.content.wintertodt.Wintertodt.REJUV_POT_4, com.runehive.content.wintertodt.Wintertodt.REJUV_POT_UNF, and tick.

Here is the call graph for this function:

◆ getName()

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

26 {
27 return "Mix herb";
28 }

◆ getWalkablePolicy()

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

21 {
22 return WalkablePolicy.NON_WALKABLE;
23 }

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

Member Data Documentation

◆ amount

int com.runehive.content.wintertodt.actions.MixHerb.amount
package

Definition at line 13 of file MixHerb.java.

Referenced by execute(), and MixHerb().

◆ tick

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

Definition at line 13 of file MixHerb.java.

Referenced by execute().


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