1package com.runehive.game.world.entity.mob.npc.drop;
3import com.runehive.game.world.entity.mob.player.Player;
4import com.runehive.game.world.entity.mob.player.PlayerRight;
5import com.runehive.game.world.items.ItemDefinition;
6import com.runehive.util.RandomUtils;
7import com.runehive.util.parser.impl.NpcDropParser;
9import java.util.LinkedList;
59 this.drops = npcDrops;
69 LinkedList<NpcDrop>
items =
new LinkedList<>();
71 if (
player.equipment.hasRow()) {
77 player.message(
"Very Rare drop table accessed by ring");
78 player.playerAssistant.useROW();
82 player.message(
"Rare drop table accessed by ring");
83 player.playerAssistant.useROW();
91 for (
int chance = 0, index = 0; index < rollData.length - 1; index++) {
94 if (
rollData[index] == 0 || roll >= chance) {
98 if (
table[index].length > 0) {
119 public static void main(String[] args) {
131 int[] customRolls = {
153 System.out.println();
154 System.out.println(
"Table lengths (vr, r, uc, c): ");
155 for (
int index = 0; index < table.table.length - 1; index++) {
156 System.out.print(
table.table[index].length +
" ");
158 System.out.println(
"\n");
159 System.out.println(
"--------------------------------------------------");
160 System.out.println(
"Current rolls: \t \t \t \t Custom rolls:");
162 System.out.println();
166 long maxRoll = 0, maxRoll2 = 0;
168 for (
int index = 0; index <
rollData.length; index++) {
170 maxRoll2 += rollData2[index];
173 System.out.println(
"--------------------------------------------------");
174 System.out.println(
"Very Rare ---- " + ((
long)
rollData[0] * 100_00 /
maxRoll) / 100.0 +
"% \t\t Very Rare ---- " + ((
long) rollData2[0] * 100_00 / maxRoll2) / 100.0 +
"%");
175 System.out.println(
"Rare --------- " + ((
long)
rollData[1] * 100_00 /
maxRoll) / 100.0 +
"% \t\t Rare --------- " + ((
long) rollData2[1] * 100_00 / maxRoll2) / 100.0 +
"%");
176 System.out.println(
"Uncommon ----- " + ((
long)
rollData[2] * 100_00 /
maxRoll) / 100.0 +
"% \t\t Uncommon ----- " + ((
long) rollData2[2] * 100_00 / maxRoll2) / 100.0 +
"%");
177 System.out.println(
"Common ------- " + ((
long)
rollData[3] * 100_00 /
maxRoll) / 100.0 +
"% \t\t Common ------- " + ((
long) rollData2[3] * 100_00 / maxRoll2) / 100.0 +
"%");
178 System.out.println(
"Empty Drop --- " + ((
long)
rollData[4] * 100_00 /
maxRoll) / 100.0 +
"% \t\t Empty Drop --- " + ((
long) rollData2[4] * 100_00 / maxRoll2) / 100.0 +
"%");
179 System.out.println(
"--------------------------------------------------");
180 System.out.println(
"Very Rare ---- " + ((
long)
rollData[0] * 100_00 /
maxRoll) / tables[0].length / 100.0 +
"% \t\t Very Rare ---- " + ((
long) rollData2[0] * 100_00 / maxRoll2) / tables[0].length / tables[0].length / 100.0 +
"%");
181 System.out.println(
"Rare --------- " + ((
long)
rollData[1] * 100_00 /
maxRoll) / tables[1].length / 100.0 +
"% \t\t Rare --------- " + ((
long) rollData2[1] * 100_00 / maxRoll2) / tables[0].length / tables[1].length / 100.0 +
"%");
182 System.out.println(
"Uncommon ----- " + ((
long)
rollData[2] * 100_00 /
maxRoll) / tables[2].length / 100.0 +
"% \t\t Uncommon ----- " + ((
long) rollData2[2] * 100_00 / maxRoll2) / tables[0].length / tables[2].length / 100.0 +
"%");
183 System.out.println(
"Common ------- " + ((
long)
rollData[3] * 100_00 /
maxRoll) / tables[3].length / 100.0 +
"% \t\t Common ------- " + ((
long) rollData2[3] * 100_00 / maxRoll2) / tables[0].length / tables[3].length / 100.0 +
"%");
184 System.out.println(
"--------------------------------------------------");
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.
final NpcDrop[] drops
The cached array of NpcDrops.
final boolean rareDropTable
Determines if this table has access to the rare drop table.
static void printRates(NpcDrop[][] tables, int[] rollData, int[] rollData2)
final int[] npcIds
The npc ids that share this drop table.
static final int[] ROLL_DATA
List< NpcDrop > generate(Player player, boolean simulated)
NpcDropTable(int[] npcIds, boolean rareDropTable, NpcDrop[] npcDrops, NpcDrop[] always, NpcDrop[] common, NpcDrop[] uncommon, NpcDrop[] rare, NpcDrop[] veryRare)
Constructs a new NpcDropTable.
static void main(String[] args)
void setRollData(int[] rollData)
This class represents a character controlled by a player.
Represents all of an in-game Item's attributes.
static GsonParser createParser()
A static-util class that provides additional functionality for generating pseudo-random numbers.
static int inclusive(int min, int max)
Returns a pseudo-random int value between inclusive min and inclusive max.
static< T > T random(T[] array)
Pseudo-randomly retrieves a element from array.
Loads npc drops on startup.
Holds all the player right data.
static int dropRateIncrease(Player player, int roll)