RuneHive-Game
Loading...
Searching...
No Matches
FeedBrazier.java
Go to the documentation of this file.
1package com.runehive.content.wintertodt.actions;
2
3import com.runehive.Config;
4import com.runehive.content.wintertodt.Brazier;
5import com.runehive.content.wintertodt.Wintertodt;
6import com.runehive.content.wintertodt.WintertodtAction;
7import com.runehive.game.world.entity.mob.player.Player;
8import com.runehive.game.world.entity.skill.Skill;
9import com.runehive.game.world.items.Item;
10
11public class FeedBrazier extends WintertodtAction {
12
14 int tick;
15
17 super(player);
18 this.brazier = brazier;
19 }
20
21 @Override
22 protected void execute() {
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);
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);
47 }
48 getMob().inventory.refresh();
49 }
50
51 tick++;
52 }
53}
The class that contains setting-related constants for the server.
Definition Config.java:24
static final double FIREMAKING_MODIFICATION
The experience modification for firemaking.
Definition Config.java:256
static void addPoints(Player player, int amount)
Handles adding wintertodt points to a player.
void execute()
A function representing the unit of work that will be carried out.
T getMob()
Gets the player.
Definition Action.java:44
This class represents a character controlled by a player.
Definition Player.java:125
Represents a trainable and usable skill.
Definition Skill.java:18
static final byte getLevelForExperience(double experience)
Gets the level for a given experience amount.
Definition Skill.java:446
static final int FIREMAKING
The firemaking skill id.
Definition Skill.java:54
The container class that represents an item that can be interacted with.
Definition Item.java:21