1package com.runehive.game.world.entity.mob.npc.drop;
3import com.runehive.Config;
4import com.runehive.content.CrystalChest;
5import com.runehive.content.ItemCreation;
6import com.runehive.content.achievement.AchievementHandler;
7import com.runehive.content.achievement.AchievementKey;
8import com.runehive.content.collectionlog.CollectionLog;
9import com.runehive.content.pet.PetData;
10import com.runehive.content.pet.Pets;
11import com.runehive.content.skill.impl.prayer.AshData;
12import com.runehive.content.skill.impl.prayer.BoneData;
13import com.runehive.game.world.World;
14import com.runehive.game.world.entity.mob.npc.Npc;
15import com.runehive.game.world.entity.mob.player.Player;
16import com.runehive.game.world.entity.mob.player.PlayerRight;
17import com.runehive.game.world.entity.skill.Skill;
18import com.runehive.game.world.items.Item;
19import com.runehive.game.world.items.ground.GroundItem;
20import com.runehive.game.world.position.Position;
21import com.runehive.net.packet.out.SendMessage;
22import com.runehive.net.packet.out.SendScreenshot;
23import com.runehive.util.Items;
24import com.runehive.util.RandomGen;
25import com.runehive.util.Utility;
26import plugin.itemon.item.LootingBagPlugin;
28import java.util.Arrays;
29import java.util.HashMap;
45 public static final Map<Integer, NpcDropTable>
NPC_DROPS =
new HashMap<>();
80 List<NpcDrop> npc_drops = table.
generate(killer,
false);
136 if (
npc.id == 494 && item.
getId() == 11907) {
142 for (
int i = 0; i < item.
getAmount(); i++)
151 List<Item> fullChargeItems = Arrays.asList(
156 fullChargeItems.forEach(item ->
GroundItem.
create(killer, item, dropPosition));
160 if (bone ==
null) {
return; }
166 if (
player.equipment.hasAmulet() &&
player.equipment.getAmuletSlot().getId() == 22111) {
170 if (current < maximum) {
173 if (current + points > maximum) {
174 points = maximum - current;
179 player.message(
"You feel your " +
player.equipment.getAmuletSlot().getName() +
" vibrate as you bury the bone.");
185 if (ashes ==
null) {
return; }
195 dropPos =
player.getPosition().copy();
203 if (
drop.getWeight() == 0) {
226 int weightMultiplier = 1;
227 double dropChance = (
drop.getWeight() * weightMultiplier) / drOffset;
228 if (dropChance < 1) {
231 double weight = 1.0 / dropChance;
232 if (
drop.getWeight() != 0) {
239 if (Math.random() <= weightSum) {
246 if (
npc.id == 494 && item.
getId() == 11907) {
264 dropPosition =
player.getPosition().copy();
283 if (item.
getId() == 11941 && (
player.playerAssistant.contains(
new Item(LootingBagPlugin.OPENED_ID)) ||
player.playerAssistant.contains(item))) {
288 if (
player.settings.dropNotification && item.
getValue() > 1_000_000) {
291 World.
sendMessage(
"<col=BA383E>osroyale: <col=" +
player.right.getColor() +
">" +
player.getName() +
" </col>has just received " +
Utility.
getAOrAn(name) +
" <col=BA383E>" + name +
" </col>from <col=BA383E>" +
npc.getName() +
"</col>!");
294 if (
player.settings.screenshotKill) {
297 }
else if (
player.settings.dropNotification && item.
getValue() > 100_000) {
308 if (alternative ==
npc)
The class that contains setting-related constants for the server.
static final double PRAYER_MODIFICATION
The experience modification for prayer.
Handles opening the crystal chest.
static final Item[] KEY_HALVES
The two item key halves.
Handles the achievements.
static void activate(Player player, AchievementKey achievement)
Activates the achievement for the individual player.
static void checkItemDrop(Player player, int npcId, int itemId, int amount)
Handles spawning, rewarding and picking up of pets.
static void onReward(Player player, int item, int chance)
Handles calculating the chance of a player receiving a skilling pet.
Represents the game world.
static void sendMessage(String... messages)
Sends a global message.
Represents a non-player character in the in-game world.
Item toItem(RandomGen gen)
Converts this NpcDrop to an item.
The manager class which holds the static entries of drop tables and has a method to execute a drop ta...
static NpcDrop rollDrop(Player player, Npc npc)
static void drop(Player killer, Npc npc)
Attempts to drop the drop table which belongs to npc#id.
static void tridentRunes(Player killer, Position dropPosition)
static boolean checkAlternativePosition(int npc)
static final boolean USE_NEW_SYSTEM
static final int[] ALTERNATIVE_POSITION
Alternative drop positions for mobs (i.e kraken, zulrah)
static void handleMessages(Player player, Npc npc, Item item)
static void handleMiscDrops(Player player, Npc npc)
static void handleAshSanctifier(Player player, AshData ashes)
static final Map< Integer, NpcDropTable > NPC_DROPS
The collection of npc ids by their representative drop tables.
static void handleBoneCrusher(Player player, BoneData bone)
The class which represents a npc drop table.
final NpcDrop[] drops
The cached array of NpcDrops.
List< NpcDrop > generate(Player player, boolean simulated)
WeightedCollection< E > add(double weight, E result)
boolean contains(Item item)
This class represents a character controlled by a player.
void message(String message)
String getName()
Gets the name of this entity.
void send(OutgoingPacket encoder)
final PlayerAssistant playerAssistant
boolean untradeableNotification
The untradeable notification flag.
boolean dropNotification
The drop notification flag.
Represents a trainable and usable skill.
static final int PRAYER
The prayer skill id.
The container class that represents an item that can be interacted with.
final int getId()
Gets the identification of this item.
final int getAmount()
Gets the quantity of this item.
int getValue(PriceType type)
Gets the value for this item.
Item createWithAmount(int newAmount)
Creates a new item with newAmount and the same identifier as this instance.
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 single tile on the game world.
Position copy()
Creates a deep copy of this location.
The OutgoingPacket that sends a message to a Players chatbox in the client.
static final int BONECRUSHER
static final int CHAOS_RUNE
static final int DEATH_RUNE
static final int FIRE_RUNE
The ThreadLocalRandom wrapper that provides additional functionality for generating pseudo-random num...
Handles miscellaneous methods.
static int random(int bound)
static String formatDigits(final int amount)
Formats digits for integers.
static< T > T randomElement(Collection< T > collection)
Picks a random element out of any array type.
static String getAOrAn(String nextWord)
A or an.
static Optional< PetData > forItem(int id)
Gets the pet data based on the given item identification.
static Optional< AshData > forId(int id)
static Optional< BoneData > forId(int id)
Gets the bone data based on the item.
double getExperience()
Gets the experience of the bone.
Holds all the player right data.
static String getColor(PlayerRight right)
static double getDropRateBonus(Player player)