1package com.runehive.content.skill.impl.hunter.birdhouse;
3import com.runehive.game.world.entity.mob.player.Player;
4import com.runehive.game.world.entity.mob.player.persist.PlayerSerializer;
5import com.runehive.game.world.entity.skill.SkillData;
6import com.runehive.game.world.items.Item;
7import com.runehive.game.world.items.ground.GroundItem;
8import com.runehive.game.world.object.CustomGameObject;
9import com.runehive.game.world.object.ObjectDirection;
10import com.runehive.game.world.object.ObjectType;
11import com.runehive.net.packet.out.SendAddObject;
12import com.runehive.net.packet.out.SendRemoveInterface;
13import com.runehive.util.Utility;
15import java.util.ArrayList;
16import java.util.Random;
25 long left = playerBirdHouseData.birdhouseTimer - System.currentTimeMillis();
26 long minutes = left /
MINUTE;
27 return minutes < 0 ?
"rougly 1 minute." : minutes +
" minute(s).";
34 player.
message(
"You must have two spaces in your inventory to dismantle the birdhouse.");
38 ArrayList<Item> receivedItems =
new ArrayList<>();
42 receivedItems.add(
new Item(8792));
43 for(
int index = 0; index < 10; index++) {
45 receivedItems.add(
new Item(9978));
47 int[] featerAmount = { 30, 40, 50, 60 };
48 int featherAmount = featerAmount[
Utility.
random(featerAmount.length - 1)];
51 receivedItems.add(
new Item(314, featherAmount));
53 int nestsReceived = 0;
56 receivedItems.add(
new Item(5073));
60 receivedItems.add(
new Item(5073));
64 for(
int index = 0; index < 10; index++) {
70 int nestRate = birdHouseData.birdhouseData.succesRates * (hunterLevel - 1) / 98;
73 if(randomRoll < nestRate) {
81 receivedItems.add(
new Item(5072));
84 else if(nestRoll < 2) {
86 receivedItems.add(
new Item(5070));
88 }
else if(nestRoll < 3) {
90 receivedItems.add(
new Item(5071));
92 }
else if(nestRoll < 35) {
94 receivedItems.add(
new Item(5074));
98 receivedItems.add(
new Item(5075));
106 player.
message(
"You dismantle and discard the trap, retrieving "+nestsReceived+
" nest"+(nestsReceived > 1 ?
"s" :
"")+
", 10 dead birds, "+featherAmount+
" feathers and "+birdHouseData.
birdhouseData.
hunterData[1]+
" Hunter XP.");
117 int odds = 1 + (low * (99 - level) / 98) + (high * (level - 1) / 98);
118 double percent = ((double)odds / 256D) * 100D;
119 int random =
new Random().nextInt(256);
121 return odds >= random;
static boolean wasSuccesful(Player player, int skill, int low, int high)
static String getTimeLeft(PlayerBirdHouseData playerBirdHouseData)
static void receiveLoot(Player player, PlayerBirdHouseData birdHouseData)
BirdhouseData birdhouseData
Position birdhousePosition
final SkillManager skills
void animate(int animation)
This class represents a character controlled by a player.
final Inventory inventory
void message(String message)
final Equipment equipment
List< PlayerBirdHouseData > birdHouseData
void send(OutgoingPacket encoder)
static void save(Player player)
void addExperience(int id, double experience)
Adds experience to a given skill.
int getLevel(int id)
Gets the level of a skill.
The container class that represents an item that can be interacted with.
boolean contains(int[] bowsWithNoArrowsRequired)
void refresh()
Refreshes the players inventory.
void addOrDrop(List< Item > items)
Attempts to deposit an item to the players inventory, if there is no space it'll bank the item instea...
Represents a single Ground item on the world map.
static GroundItem create(Player player, Item item)
Creates a new GroundItem object for a player and an item.
Represents a static game object loaded from the map fs.
Handles miscellaneous methods.
static int random(int bound)
The enumerated type whose elements represent data for the skills.
The enumerated type whose elements represent the directions for objects.
static Optional< ObjectDirection > valueOf(final int id)
Returns a ObjectDirection wrapped in an Optional for the specified id.
The enumerated type whose elements represent all of the object types.
static Optional< ObjectType > valueOf(final int id)
Returns a ObjectType wrapped in an Optional for the specified id.