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

Public Member Functions

 FeedBrazier (Player player, Brazier brazier)
Public Member Functions inherited from com.runehive.content.wintertodt.WintertodtAction
String getName ()
 Gets the name of this action.
WalkablePolicy getWalkablePolicy ()
 Gets the WalkablePolicy of this action.
 WintertodtAction (Player player)
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

Brazier brazier
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 FeedBrazier.java.

Constructor & Destructor Documentation

◆ FeedBrazier()

com.runehive.content.wintertodt.actions.FeedBrazier.FeedBrazier ( Player player,
Brazier brazier )

Definition at line 16 of file FeedBrazier.java.

16 {
17 super(player);
18 this.brazier = brazier;
19 }

References brazier.

Member Function Documentation

◆ execute()

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

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

Reimplemented from com.runehive.content.wintertodt.WintertodtAction.

Definition at line 22 of file FeedBrazier.java.

22 {
23 if (brazier.getObject().getId() != Wintertodt.BURNING_BRAZIER_ID) {
24 getMob().message("The brazier has gone out.");
25 getMob().animate(65535);
26 getMob().action.getCurrentAction().cancel();
27 return;
28 }
29
30 if(!getMob().inventory.contains(Wintertodt.BRUMA_ROOT) && !getMob().inventory.contains(Wintertodt.BRUMA_KINDLING)) {
31 getMob().animate(65535);
32 getMob().action.getCurrentAction().cancel();
33 return;
34 }
35
36 if(tick % 2 == 0) {
37 getMob().animate(832);
38 if (getMob().inventory.remove(new Item(Wintertodt.BRUMA_KINDLING))) {
39 double xp = Skill.getLevelForExperience(getMob().skills.get(Skill.FIREMAKING).getExperience()) * 3.8;
40 if(xp > 0) getMob().skills.addExperience(Skill.FIREMAKING, xp * Config.FIREMAKING_MODIFICATION);
41 Wintertodt.addPoints(getMob(), 25);
42 } else {
43 getMob().inventory.remove(new Item(Wintertodt.BRUMA_ROOT));
44 double xp = Skill.getLevelForExperience(getMob().skills.get(Skill.FIREMAKING).getExperience()) * 3;
45 if(xp > 0) getMob().skills.addExperience(Skill.FIREMAKING, xp * Config.FIREMAKING_MODIFICATION);
46 Wintertodt.addPoints(getMob(), 10);
47 }
48 getMob().inventory.refresh();
49 }
50
51 tick++;
52 }

References com.runehive.content.wintertodt.Wintertodt.addPoints(), brazier, com.runehive.content.wintertodt.Wintertodt.BRUMA_KINDLING, com.runehive.content.wintertodt.Wintertodt.BRUMA_ROOT, com.runehive.content.wintertodt.Wintertodt.BURNING_BRAZIER_ID, com.runehive.game.world.entity.skill.Skill.FIREMAKING, com.runehive.Config.FIREMAKING_MODIFICATION, com.runehive.game.world.entity.skill.Skill.getLevelForExperience(), com.runehive.game.action.Action< T extends Mob >.getMob(), and tick.

Here is the call graph for this function:

Member Data Documentation

◆ brazier

Brazier com.runehive.content.wintertodt.actions.FeedBrazier.brazier
package

Definition at line 13 of file FeedBrazier.java.

Referenced by execute(), and FeedBrazier().

◆ tick

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

Definition at line 14 of file FeedBrazier.java.

Referenced by execute().


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