1package com.osroyale.content.skill.impl.woodcutting;
3import com.osroyale.Config;
4import com.osroyale.content.achievement.AchievementHandler;
5import com.osroyale.content.achievement.AchievementKey;
6import com.osroyale.content.activity.randomevent.RandomEventHandler;
7import com.osroyale.content.clanchannel.content.ClanTaskKey;
8import com.osroyale.content.pet.PetData;
9import com.osroyale.content.pet.Pets;
10import com.osroyale.content.prestige.PrestigePerk;
11import com.osroyale.content.skill.impl.firemaking.FiremakingData;
12import com.osroyale.content.skillcape.SkillCape;
13import com.osroyale.game.action.Action;
14import com.osroyale.game.action.policy.WalkablePolicy;
15import com.osroyale.game.task.impl.ObjectReplacementEvent;
16import com.osroyale.game.world.World;
17import com.osroyale.game.world.entity.mob.player.Player;
18import com.osroyale.game.world.entity.skill.Skill;
19import com.osroyale.game.world.items.Item;
20import com.osroyale.game.world.items.ItemDefinition;
21import com.osroyale.game.world.object.GameObject;
22import com.osroyale.game.world.position.Area;
23import com.osroyale.net.packet.out.SendMessage;
24import com.osroyale.util.RandomUtils;
25import com.osroyale.util.Utility;
27import java.util.Optional;
34public class WoodcuttingAction
extends Action<Player> {
46 private boolean chop() {
47 if (
getMob().inventory.getFreeSlots() == 0) {
48 getMob().dialogueFactory.sendStatement(
"You can't carry anymore logs.").execute();
52 getMob().animate(axe.animation);
55 if (
object ==
null || !
object.active()) {
64 getMob().playerAssistant.activateSkilling(1);
68 getMob().inventory.addOrDrop(
new Item(tree.item, 1));
71 Optional<FiremakingData> firemakingData =
FiremakingData.forId(tree.item);
73 if (firemakingData.isPresent()) {
76 getMob().inventory.add(tree.item, 1);
80 getMob().inventory.add(tree.item, 1);
85 }
else if (tree ==
TreeData.YEW_TREE) {
87 }
else if (tree ==
TreeData.MAGIC_TREE) {
90 if (
object.active() && (tree.logs == 1 || tree.logs != 1 &&
Utility.random(8) <= 0) && !
Area.inSuperDonatorZone(
object) && !
Area.inRegularDonatorZone(
object)) {
93 object.getGenericAttributes().set(
"logs", -1);
95 object.getGenericAttributes().set(
"logs", tree.logs);
109 if (!
object.getGenericAttributes().has(
"logs")) {
110 object.getGenericAttributes().set(
"logs", tree.logs);
113 getMob().animate(axe.animation);
122 if (
object ==
null || !
object.active() ||
object.getGenericAttributes() ==
null) {
145 return "woodcutting-action";
static final double WOODCUTTING_MODIFICATION
static void activate(Player player, AchievementKey achievement)
static void onReward(Player player, int item, int chance)
static void drop(Player player)
WalkablePolicy getWalkablePolicy()
void onCancel(boolean logout)
Action(T mob, int delay, boolean instant)
synchronized final void cancel()
static void schedule(Task task)
static final int WOODCUTTING
static final int FIREMAKING
static ItemDefinition get(int id)