RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
BirdsNest.java
1package com.osroyale.content.skill.impl.woodcutting;
2
3import com.osroyale.content.prestige.PrestigePerk;
4import com.osroyale.game.world.entity.mob.player.Player;
5import com.osroyale.game.world.items.Item;
6import com.osroyale.game.world.items.ground.GroundItem;
7import com.osroyale.net.packet.out.SendMessage;
8import com.osroyale.util.MessageColor;
9import com.osroyale.util.RandomUtils;
10import com.osroyale.util.Utility;
11
48
49public class BirdsNest {
50
52 private static final int[] BIRD_NEST = {5070, 5071, 5072, 5073, 5074};
53
55 private static final int[] SEED_REWARD = {5312, 5313, 5314, 5315, 5316, 5283, 5284, 5285, 5286, 5287, 5288, 5289, 5290, 5317};
56
58 private static final int[] RING_REWARD = {1635, 1637, 1639, 1641, 1643};
59
61 public static void drop(Player player) {
62 int chance = player.prestige.hasPerk(PrestigePerk.LITTLE_BIRDY) ? 10 : 5;
63 if (Utility.random(1, 200) < chance) {
64 Item item = new Item(Utility.randomElement(BIRD_NEST), 1);
65 GroundItem.create(player, item);
66 player.send(new SendMessage("A bird's nest falls out of the tree.", MessageColor.RED));
67 }
68 }
69
71 public static void search(Player player, int item) {
72 if (player.inventory.remaining() == 0) {
73 player.send(new SendMessage("You do not have enough inventory space to do this."));
74 return;
75 }
76 int reward = 0;
77 if (item == 5074)
78 reward = Utility.randomElement(RING_REWARD);
79 else if (item == 5073)
80 reward = Utility.randomElement(SEED_REWARD);
81 else if (item == 5070)
82 reward = 5076;
83 else if (item == 5071)
84 reward = 5077;
85 else if (item == 5072)
86 reward = 5078;
87 Item rewardItem = new Item(reward, 1);
88 String name = rewardItem.getName();
89 player.send(new SendMessage("You search the nest... and find " + Utility.getAOrAn(name) + " " + name + "."));
90 player.inventory.replace(item, 5075, true);
91 player.inventory.add(rewardItem);
92 }
93}
static void search(Player player, int item)
final boolean replace(int oldId, int newId, int index, boolean refresh)
static GroundItem create(Player player, Item item)
static< T > T randomElement(Collection< T > collection)
Definition Utility.java:285
static String getAOrAn(String nextWord)
Definition Utility.java:153