1package com.runehive.content.simulator;
3import com.runehive.content.activity.impl.barrows.BarrowsUtility;
4import com.runehive.game.world.entity.mob.npc.definition.NpcDefinition;
5import com.runehive.game.world.entity.mob.npc.drop.NpcDrop;
6import com.runehive.game.world.entity.mob.npc.drop.NpcDropManager;
7import com.runehive.game.world.entity.mob.npc.drop.NpcDropTable;
8import com.runehive.game.world.entity.mob.player.Player;
9import com.runehive.game.world.items.Item;
10import com.runehive.game.world.items.containers.pricechecker.PriceType;
11import com.runehive.net.packet.out.SendItemOnInterface;
12import com.runehive.net.packet.out.SendScrollbar;
13import com.runehive.net.packet.out.SendString;
14import com.runehive.util.RandomGen;
15import com.runehive.util.Utility;
26 Map<Integer, Integer> items =
new HashMap<>();
30 for (
int index = 0; index < amount; index++) {
34 if (items.containsKey(money.
getId())) {
37 items.replace(money.
getId(), toAdd);
45 if (items.containsKey(piece.
getId())) {
47 items.replace(piece.
getId(), toAdd);
54 Iterator it = items.entrySet().iterator();
55 while (it.hasNext()) {
56 Map.Entry pair = (Map.Entry) it.next();
57 int mapValue = (int) pair.getValue();
61 Item item =
new Item((
int) pair.getKey(), (
int) pair.getValue());
65 System.out.println(pair.getKey() +
" = " + pair.getValue());
71 int scroll = (items.size() / 6 + (items.size() % 6 > 0 ? 1 : 0)) * 44;
73 player.
send(
new SendString(
"<col=C1A875>Blood Money Chest", 26806));
83 if (amount > 100_000) {
92 Map<Integer, Item> items =
new HashMap<>();
94 for (
int index = 0; index < amount; index++) {
95 List<NpcDrop> npc_drops = drop.
generate(player,
true);
97 for (
NpcDrop drops : npc_drops) {
98 Item item = drops.toItem(gen);
100 items.compute(item.
getId(), (key, val) -> val ==
null ? item : val.
getId() == item.
getId() ? val.createAndIncrement(item.
getAmount()) : val);
104 List<Item> sorted =
new ArrayList<>(items.values());
105 sorted.sort((first, second) -> second.getValue() - first.getValue());
107 player.
attributes.
set(
"DROP_SIMULATOR_SORTED_LIST", sorted.toArray(
new Item[0]));
108 int scroll = (items.size() / 6 + (items.size() % 6 > 0 ? 1 : 0)) * 44;
final GenericAttributes attributes
Contains the npc definitions.
static NpcDefinition get(int id)
Gets a npc definition from the definition array.
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.
List< NpcDrop > generate(Player player, boolean simulated)
This class represents a character controlled by a player.
void send(OutgoingPacket encoder)
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.
The OutgoingPacket that sends a string to a Players itemcontainer in the client.
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.
public< K, E > void set(K key, E attribute)
Sets a generic attribute.
Created by Daniel on 2018-02-03.
VALUE
The value price type.
void execute(Player player, int id, int amount)