1package com.runehive.content;
3import com.runehive.game.world.entity.mob.npc.definition.NpcDefinition;
4import com.runehive.game.world.entity.mob.npc.drop.NpcDrop;
5import com.runehive.game.world.entity.mob.npc.drop.NpcDropManager;
6import com.runehive.game.world.entity.mob.npc.drop.NpcDropTable;
7import com.runehive.game.world.entity.mob.player.Player;
8import com.runehive.game.world.items.Item;
9import com.runehive.game.world.items.ItemDefinition;
10import com.runehive.net.packet.out.SendItemOnInterfaceSlot;
11import com.runehive.net.packet.out.SendScrollbar;
12import com.runehive.net.packet.out.SendString;
13import com.runehive.net.packet.out.SendTooltip;
14import com.runehive.util.Utility;
16import java.util.ArrayList;
51 List<Integer> key = player.
attributes.
get(
"DROP_DISPLAY_KEY", List.class);
57 context = context.trim().toLowerCase();
58 List<String> npc =
new ArrayList<>();
59 List<Integer> integer =
new ArrayList<>();
66 if (name.toLowerCase().contains(context)) {
67 if (!npc.contains(name)) {
69 integer.add(definition.
npcIds[0]);
75 if (itemName.toLowerCase().contains(context)) {
76 if (!npc.contains(name)) {
78 integer.add(definition.
npcIds[0]);
85 if (integer.isEmpty()) {
90 int size = npc.size() < 10 ? 10 : npc.size();
91 for (
int index = 0,
string = 54516; index < size; index++,
string += 2) {
94 String name = index >= npc.size() ?
"" : npc.get(index);
95 player.
send(
new SendTooltip(name.isEmpty() ?
"" :
"View drop table of <col=ff9933>" + name,
string));
105 int size = definition ==
null ? 9 : definition.drops.length < 9 ? 9 : definition.
drops.length;
107 player.
send(
new SendString(definition ==
null ?
"" :
"Drops: " + definition.
drops.length, 54514));
109 for (
int index = 0,
string = 54552; index < size; index++) {
110 boolean valid = definition !=
null && (index < definition.drops.length && (
NpcDefinition.
get(definition.
npcIds[0]) !=
null));
Handles displaying the npc drops on an itemcontainer.
static void search(Player player, String context, DropType type)
static void display(Player player, NpcDropTable definition)
static final String[] DEFAULT
static void open(Player player)
final DialogueFactory execute()
Retrieves the next dialogue in the chain and executes it.
final DialogueFactory sendStatement(String... lines)
Appends a StatementDialogue to the current dialogue chain.
final GenericAttributes attributes
Contains the npc definitions.
static NpcDefinition get(int id)
Gets a npc definition from the definition array.
final int maximum
The maximum amount of this drop.
NpcDropChance type
The chance this item is dropped.
int id
The item id of this drop.
final int minimum
The minimum amount of this drop.
The manager class which holds the static entries of drop tables and has a method to execute a drop ta...
static final Map< Integer, NpcDropTable > NPC_DROPS
The collection of npc ids by their representative drop tables.
The class which represents a npc drop table.
final NpcDrop[] drops
The cached array of NpcDrops.
final int[] npcIds
The npc ids that share this drop table.
void open(int identification)
Opens an interface for the player.
This class represents a character controlled by a player.
DialogueFactory dialogueFactory
final InterfaceManager interfaceManager
void send(OutgoingPacket encoder)
Represents all of an in-game Item's attributes.
static ItemDefinition get(int id)
Gets an item definition.
String getName()
Gets the item name.
The container class that represents an item that can be interacted with.
The OutgoingPacket that sends a string to a Players itemcontainer in the client.
Handles miscellaneous methods.
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.
public< K, E > E get(K key)
Gets a generic attribute.
public< K, E > void set(K key, E attribute)
Sets a generic attribute.