1package com.runehive.content.skill.impl.hunter.trap;
3import com.runehive.game.Animation;
4import com.runehive.game.task.impl.HunterTask;
5import com.runehive.game.world.entity.mob.npc.Npc;
6import com.runehive.game.world.entity.mob.player.Player;
7import com.runehive.game.world.entity.skill.Skill;
8import com.runehive.game.world.object.CustomGameObject;
9import com.runehive.game.world.object.GameObject;
10import com.runehive.game.world.position.Position;
11import com.runehive.util.Utility;
14import java.util.concurrent.CopyOnWriteArrayList;
18 public static List<Trap>
traps =
new CopyOnWriteArrayList<Trap>();
22 private static final int[]
exps = {3254, 3744, 6041, 8811, 10272};
25 trap.getGameObject().register();
27 if (
trap.getOwner() !=
null)
28 trap.getOwner().trapsLaid++;
32 trap.getGameObject().unregister();
34 if (
trap.getOwner() !=
null)
35 trap.getOwner().trapsLaid--;
41 client.
message(
"You need to be in a hunting area to lay a trap.");
50 client.
message(
"There is already a trap here, please place yours somewhere else.");
59 if (npc ==
null || !npc.isVisible())
61 if (x == npc.getPosition().getX() && y == npc.getPosition().getY() || x == npc.getX() && y == npc.getY()) {
62 client.
message(
"You cannot place your trap right here, try placing it somewhere else.");
79 if (
trap.getOwner() !=
null &&
trap.getOwner().getUsername().equals(client.
getUsername()) && !
trap.getGameObject().getPosition().isWithinDistance(client.
getPosition(), 50)) {
81 client.
message(
"You didn't watch over your trap well enough, it has collapsed.");
90 return x >= 2758 && x <= 2965 && y >= 2880 && y <= 2954 || x >= 2300 && x <= 2320 && y >= 9790 && y <= 9800;
119 if (
trap.getGameObject().getPosition().equals(
object.getPosition()))
129 if (theTrap !=
null && theTrap.
getOwner() == client) {
133 else if (theTrap instanceof
BoxTrap) {
137 client.
message(
"You dismantle the trap..");
139 client.
message(
"You cannot dismantle someone else's trap.");
147 client.
message(
"You need a Hunter level of at least 60 to lay this trap.");
160 client.
message(
"You set up a bird snare..");
164 client.
message(
"You need a Hunter level of at least 27 to do this.");
167 client.
message(
"You set up a box trap..");
175 int levelToReturn = 1;
178 else if (npcType == 5074)
180 else if (npcType == 5075)
182 else if (npcType == 5076)
184 else if (npcType == 5079)
186 else if (npcType == 5080)
188 return levelToReturn;
192 return npc >= 5072 && npc <= 5080;
199 if (theTrap !=
null) {
208 client.
message(
"You've succesfully caught a crimson swift.");
213 client.
message(
"You've succesfully caught a Golden Warbler.");
218 client.
message(
"You've succesfully caught a Copper Longtail.");
223 client.
message(
"You've succesfully caught a Cerulean Twitch.");
228 client.
message(
"You've succesfully caught a Tropical Wagtail.");
231 }
else if (theTrap instanceof
BoxTrap) {
236 client.
message(
"You've succesfully caught a chinchompa!");
240 client.
message(
"You've succesfully caught a red chinchompa!");
246 client.
message(
"This is not your trap.");
254 if (
trap.getOwner() !=
null) {
256 trap.getOwner().message(
"You failed to catch the animal because your Hunter level is too low.");
257 trap.getOwner().message(
"You need atleast " +
requiredLevel(npc.
id) +
" Hunter to catch this animal");
GameObject getGameObject()
Gets the GameObject.
static void dismantle(Player client, GameObject trap)
static boolean goodArea(Player client)
static void layTrap(Player client, Trap trap)
static List< Trap > traps
static List< Npc > HUNTER_NPC_LIST
static void handleLogout(Player p)
static boolean canLay(Player client)
static int requiredLevel(int npcType)
static int getMaximumTraps(Player client)
static void lootTrap(Player client, GameObject trap)
static boolean isHunterNPC(int npc)
static void register(final Trap trap)
static void handleRegionChange(Player client)
static int getObjectIDByNPCID(int npcId)
static Trap getTrapForGameObject(final GameObject object)
static void deregister(Trap trap)
static boolean hasLarupia(Player client)
static void catchNPC(Trap trap, Npc npc)
Class that models a single animation used by an entity.
void setVisible(boolean visible)
final SkillManager skills
void animate(int animation)
void face(GameObject object)
Sets the client update flag to face a certain direction.
Represents a non-player character in the in-game world.
void appendDeath()
Handles the mob death.
This class represents a character controlled by a player.
final Inventory inventory
void message(String message)
Represents a trainable and usable skill.
static final int HUNTER
The hunter skill id.
void addExperience(int id, double experience)
Adds experience to a given skill.
int getLevel(int id)
Gets the level of a skill.
boolean remove(Item item)
Attempts to withdraw item from this container.
boolean add(Item item)
Attempts to deposit item into this container.
boolean contains(int id)
Determines if this container contains id.
Represents a static game object loaded from the map fs.
Represents a single tile on the game world.
int getY()
Gets the absolute y coordinate.
int getX()
Gets the absolute x coordinate.
Handles miscellaneous methods.
static int random(int bound)
The possible states a trap can be in.
Represents a game object.
default int getId()
Gets the object id.