RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
ChopRoots.java
1package com.osroyale.content.wintertodt.actions;
2
3import com.osroyale.Config;
4import com.osroyale.content.skill.impl.woodcutting.AxeData;
5import com.osroyale.content.wintertodt.Wintertodt;
6import com.osroyale.game.action.Action;
7import com.osroyale.game.action.policy.WalkablePolicy;
8import com.osroyale.game.world.entity.mob.player.Player;
9import com.osroyale.game.world.entity.skill.Skill;
10import com.osroyale.game.world.items.Item;
11
12public class ChopRoots extends Action<Player> {
13
14 int tick;
15 public ChopRoots(Player player) {
16 super(player, 1);
17 }
18
19 @Override
20 public WalkablePolicy getWalkablePolicy() {
21 return WalkablePolicy.NON_WALKABLE;
22 }
23
24 @Override
25 public String getName() {
26 return "Chop roots";
27 }
28
29 @Override
30 protected void execute() {
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 }
58}
abstract WalkablePolicy getWalkablePolicy()