Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2018
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.80 KB | None | 0 0
  1. public boolean rareDrops(Player c, int i, boolean command, boolean reroll) {
  2. int rarity = 0;
  3. double percentage = 0;
  4.  
  5. if (!command)
  6. percentage = getDropRate(c, npcs[i].npcType);
  7. else
  8. percentage = getDropRate(c, NpcDefinition.get(i).getId());
  9.  
  10. int npcDropRate = 0;
  11. if (!command)
  12. npcDropRate = NPCDrops.DROP_RARITY.get(Integer.valueOf(npcs[i].npcType)).intValue() + 1;
  13. else
  14. npcDropRate = NPCDrops.DROP_RARITY.get(Integer.valueOf(NpcDefinition.get(i).getId())).intValue() + 1;
  15.  
  16. if (!command && npcs[i].npcType == HANK_THE_TANK_ID) {
  17. double amountOfPlayers = 0;
  18. for (Player player : World.getPlayers()) {
  19. if (player == null)
  20. continue;
  21. if (player.distanceToPoint(npcs[i].getX(), npcs[i].getY()) < 16) {
  22. if (player.killingNpcIndex == npcs[i].getIndex()) {
  23. amountOfPlayers++;
  24. }
  25. }
  26. }
  27. if (c.getDisplayName().equalsIgnoreCase("karan")) {
  28. c.sendMessage("amountofPlayers: " + amountOfPlayers);
  29. }
  30. npcDropRate -= 200 * (1 - amountOfPlayers / 3);
  31. }
  32.  
  33. if (c.instantdrop)
  34. return true;
  35.  
  36. int chance = (int) (npcDropRate / (percentage / 100 + 1)) + 1;
  37.  
  38. if (npcs[i].npcType == World.getBossTaskId()) {
  39. chance = (int) (chance * 0.95);
  40. }
  41.  
  42. rarity = Misc.random(chance);
  43. int random = Misc.random(chance);
  44. int dpChance = 10000;
  45.  
  46. if (!command && !reroll)
  47. c.getDP().killNPC(npcs[i].npcType);
  48.  
  49. if (percentage != 0 && !reroll && !command && c.getDP().getPotential(npcs[i].npcType) <= 0) {
  50. Notices.send(NoticeType.DROP_RATE_MESSAGE,
  51. "<shad=155653>Your drop rate bonuses helped you by : " + (int) percentage + "%.", c);
  52. if (c.getDP().getKills(npcs[i].npcType) % 10 == 0) {
  53. c.sendMessage("<shad=155653>You're currently at kill " + c.getDP().getKills(npcs[i].npcType) + " of "
  54. + c.getDP().getRequired(npcs[i].npcType) + " needed for Drop Potential.");
  55. }
  56. }
  57.  
  58. if (!command && !reroll && c.getDP().getPotential(npcs[i].npcType) > 0) {
  59. Notices.send(NoticeType.DROP_RATE_MESSAGE, "<col=255> Your Drop Potential is currently: "
  60. + c.getDP().getPotential(npcs[i].npcType) + "% with " + (int) percentage + "% drop rate bonus.", c);
  61. dpChance = (int) ((chance < 100 ? chance : 100) * (1 / c.getDP().getPotential(npcs[i].npcType)));
  62. if (dpChance < chance) {
  63. rarity = Misc.random(dpChance - 1);
  64. random = Misc.random(dpChance - 1);
  65. }
  66. }
  67.  
  68. if ((c.getDisplayName().equalsIgnoreCase("Ash") || c.getDisplayName().equalsIgnoreCase("Karan")
  69. || c.getDisplayName().equalsIgnoreCase("Math")) && !command)
  70. c.sendMessage("<col=255> Chance: 1/" + chance + ", DP Chance: 1/" + dpChance + ", Randoms: (" + rarity
  71. + ", " + random + ")");
  72. return rarity == random ? true
  73. : !reroll && c.followerId == 22519 && Misc.random(74) == 0 ? rareDrops(c, i, false, true) : false;
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement