RuneHive-Game
Loading...
Searching...
No Matches
FletchKindling.java
Go to the documentation of this file.
1package com.runehive.content.wintertodt.actions;
2
3import com.runehive.Config;
4import com.runehive.content.wintertodt.Wintertodt;
5import com.runehive.content.wintertodt.WintertodtAction;
6import com.runehive.game.world.entity.mob.player.Player;
7import com.runehive.game.world.entity.skill.Skill;
8import com.runehive.game.world.items.Item;
9
10public class FletchKindling extends WintertodtAction {
11
13
14 public FletchKindling(Player player, int amount) {
15 super(player);
16 this.amount = amount;
17 }
18
19 @Override
20 protected void execute() {
21
22 if(!getMob().inventory.contains(Wintertodt.BRUMA_ROOT)) {
23 getMob().animate(65535);
24 getMob().action.getCurrentAction().cancel();
25 return;
26 }
27
28 if(tick % 3 == 0) {
29 getMob().animate(1248);
30
31 getMob().inventory.remove(new Item(Wintertodt.BRUMA_ROOT));
32 getMob().inventory.add(new Item(Wintertodt.BRUMA_KINDLING));
33 getMob().inventory.refresh();
34 double xp = Skill.getLevelForExperience(getMob().skills.get(Skill.FLETCHING).getExperience()) * 0.6;
35 if(xp > 0) getMob().skills.addExperience(Skill.FLETCHING, xp * Config.FLETCHING_MODIFICATION);
36
37 amount--;
38 if(amount <= 0) {
39 getMob().animate(65535);
40 getMob().action.getCurrentAction().cancel();
41 return;
42 }
43 }
44 tick++;
45 }
46
47}
The class that contains setting-related constants for the server.
Definition Config.java:24
static final double FLETCHING_MODIFICATION
The experience modification for fletching.
Definition Config.java:259
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 FLETCHING
The fletching skill id.
Definition Skill.java:48
The container class that represents an item that can be interacted with.
Definition Item.java:21