Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public boolean rareDrops(Player c, int i, boolean command, boolean reroll) {
- int rarity = 0;
- double percentage = 0;
- if (!command)
- percentage = getDropRate(c, npcs[i].npcType);
- else
- percentage = getDropRate(c, NpcDefinition.get(i).getId());
- int npcDropRate = 0;
- if (!command)
- npcDropRate = NPCDrops.DROP_RARITY.get(Integer.valueOf(npcs[i].npcType)).intValue() + 1;
- else
- npcDropRate = NPCDrops.DROP_RARITY.get(Integer.valueOf(NpcDefinition.get(i).getId())).intValue() + 1;
- if (!command && npcs[i].npcType == HANK_THE_TANK_ID) {
- double amountOfPlayers = 0;
- for (Player player : World.getPlayers()) {
- if (player == null)
- continue;
- if (player.distanceToPoint(npcs[i].getX(), npcs[i].getY()) < 16) {
- if (player.killingNpcIndex == npcs[i].getIndex()) {
- amountOfPlayers++;
- }
- }
- }
- if (c.getDisplayName().equalsIgnoreCase("karan")) {
- c.sendMessage("amountofPlayers: " + amountOfPlayers);
- }
- npcDropRate -= 200 * (1 - amountOfPlayers / 3);
- }
- if (c.instantdrop)
- return true;
- int chance = (int) (npcDropRate / (percentage / 100 + 1)) + 1;
- if (npcs[i].npcType == World.getBossTaskId()) {
- chance = (int) (chance * 0.95);
- }
- rarity = Misc.random(chance);
- int random = Misc.random(chance);
- int dpChance = 10000;
- if (!command && !reroll)
- c.getDP().killNPC(npcs[i].npcType);
- if (percentage != 0 && !reroll && !command && c.getDP().getPotential(npcs[i].npcType) <= 0) {
- Notices.send(NoticeType.DROP_RATE_MESSAGE,
- "<shad=155653>Your drop rate bonuses helped you by : " + (int) percentage + "%.", c);
- if (c.getDP().getKills(npcs[i].npcType) % 10 == 0) {
- c.sendMessage("<shad=155653>You're currently at kill " + c.getDP().getKills(npcs[i].npcType) + " of "
- + c.getDP().getRequired(npcs[i].npcType) + " needed for Drop Potential.");
- }
- }
- if (!command && !reroll && c.getDP().getPotential(npcs[i].npcType) > 0) {
- Notices.send(NoticeType.DROP_RATE_MESSAGE, "<col=255> Your Drop Potential is currently: "
- + c.getDP().getPotential(npcs[i].npcType) + "% with " + (int) percentage + "% drop rate bonus.", c);
- dpChance = (int) ((chance < 100 ? chance : 100) * (1 / c.getDP().getPotential(npcs[i].npcType)));
- if (dpChance < chance) {
- rarity = Misc.random(dpChance - 1);
- random = Misc.random(dpChance - 1);
- }
- }
- if ((c.getDisplayName().equalsIgnoreCase("Ash") || c.getDisplayName().equalsIgnoreCase("Karan")
- || c.getDisplayName().equalsIgnoreCase("Math")) && !command)
- c.sendMessage("<col=255> Chance: 1/" + chance + ", DP Chance: 1/" + dpChance + ", Randoms: (" + rarity
- + ", " + random + ")");
- return rarity == random ? true
- : !reroll && c.followerId == 22519 && Misc.random(74) == 0 ? rareDrops(c, i, false, true) : false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement