1package com.osroyale.content.skill.impl.hunter.net;
3import com.osroyale.Config;
4import com.osroyale.content.activity.randomevent.RandomEventHandler;
5import com.osroyale.content.skill.impl.hunter.net.impl.Impling;
6import com.osroyale.game.action.impl.HunterRespawnTask;
7import com.osroyale.game.task.Task;
8import com.osroyale.game.world.World;
9import com.osroyale.game.world.entity.mob.npc.Npc;
10import com.osroyale.game.world.entity.mob.player.Player;
11import com.osroyale.game.world.entity.skill.Skill;
12import com.osroyale.game.world.items.ItemDefinition;
13import com.osroyale.game.world.position.Position;
14import com.osroyale.net.packet.out.SendMessage;
15import com.osroyale.util.Utility;
51public class Netting
extends Task {
52 private final Player player;
53 private final Npc npc;
55 private final int experience;
56 private final int levelRequired;
57 private final int jar;
58 private final int reward;
60 public Netting(
Player player,
Npc npc,
int experience,
int levelRequired,
int jar,
int reward) {
64 this.position = npc.getPosition();
65 this.experience = experience;
66 this.levelRequired = levelRequired;
73 if (player.skills.getMaxLevel(
Skill.
HUNTER) < levelRequired) {
74 player.message(
"You need a hunter level of " + levelRequired +
" to do this!");
78 var canBarehandImpling =
Impling.forId(npc.id).isPresent() && player.skills.getMaxLevel(
Skill.
HUNTER) > levelRequired + 9;
79 if (!player.equipment.contains(10010) && !canBarehandImpling) {
80 player.send(
new SendMessage(
"You need to be wielding a butterfly net to do this!"));
84 if (!player.inventory.contains(jar)) {
86 player.message(
"You need " +
Utility.
getAOrAn(name) +
" " + name +
" to do this!");
90 if (player.inventory.isFull()) {
91 player.message(
"You do not have any free inventory spaces to do this!");
95 return !player.locking.locked();
100 player.locking.lock();
101 player.face(position);
102 var anim = !player.equipment.contains(10010) ? 7171 : 6606;
103 player.animate(anim);
108 boolean success =
true;
110 if (!npc.getPosition().equals(position) ||
Utility.random(3) == 1) {
115 player.inventory.remove(jar);
116 player.inventory.add(reward, 1);
118 player.message(
"You catch the " + npc.getName() +
" and place it in the jar.");
121 player.playerAssistant.activateSkilling(1);
123 player.message(
"You fail to catch the " + npc.getName() +
".");
131 player.locking.unlock();
static final double HUNTER_MODIFICATION
void onCancel(boolean logout)
synchronized final void cancel()
Task(boolean instant, int delay)
static void schedule(Task task)
static ItemDefinition get(int id)
static String getAOrAn(String nextWord)