1package com.runehive.util.parser.impl;
3import com.google.gson.JsonObject;
4import com.runehive.game.world.entity.mob.npc.drop.NpcDrop;
5import com.runehive.game.world.entity.mob.npc.drop.NpcDropChance;
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.items.ItemDefinition;
9import com.runehive.util.parser.GsonParser;
10import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
11import it.unimi.dsi.fastutil.ints.IntSet;
12import org.jire.runehiveps.OldToNew;
14import java.util.Arrays;
15import java.util.LinkedList;
26 super(
"def/npc/npc_drops",
false);
30 protected void parse(JsonObject data) {
31 int[] npcIds =
builder.fromJson(data.get(
"id"),
int[].class);
32 IntSet newNpcIds =
new IntOpenHashSet(npcIds.length);
33 for (
int id : npcIds) {
41 npcIds = newNpcIds.toIntArray();
43 boolean rareDropTable = data.get(
"rare_table").getAsBoolean();
46 List<NpcDrop> always =
new LinkedList<>();
47 List<NpcDrop> common =
new LinkedList<>();
48 List<NpcDrop> uncommon =
new LinkedList<>();
49 List<NpcDrop> rare =
new LinkedList<>();
50 List<NpcDrop> veryRare =
new LinkedList<>();
55 if (itemDefinition ==
null)
58 if (drop.id == 12073) {
64 if (drop.id == 2722) {
70 if (drop.id == 2801) {
76 if (drop.id == 2677) {
82 if (drop.id == 11942) {
88 if (drop.id == 1436) {
92 if (drop.id == 1437) {
119 Arrays.sort(npcDrops);
123 if (data.has(
"roll-data")) {
124 int[] rollData =
builder.fromJson(data.get(
"roll-data"),
int[].class);
128 for (
int id : npcIds) {
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.
void setRollData(int[] rollData)
Represents all of an in-game Item's attributes.
static ItemDefinition get(int id)
Gets an item definition.
GsonParser(String path)
Creates a new GsonParser.
transient Gson builder
The Gson object.
void parse(JsonObject data)
The method allows a user to modify the data as its being parsed.
The enumerated type whose elements represent a set of constants used to differ between NpcDrop rariti...