Advertisement
Guest User

Untitled

a guest
Nov 20th, 2019
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.70 KB | None | 0 0
  1. public static boolean shouldDrop(Player p,NPC npc, double drops,NpcDropItem[] c, boolean[] b, DropChance chance,
  2. boolean ringOfWealth, boolean ringOfWealth1, boolean ringOfWealth2, boolean ringOfWealth3, boolean ringOfWealthLucky, boolean amuletOfInsanity, boolean ringOfGods, boolean extreme, PlayerRights rights) {
  3.  
  4. int x = 0;
  5. double random = chance.getRandom(); //pull the chance from the table
  6. double oldRandom = chance.getRandom();
  7. double drBoost = NPCDrops.getDroprate(p);
  8. double oldDrBoost = NPCDrops.getDroprate(p);
  9. System.out.printLn("Testing Rates: Random: " + random + " - Dr Boost: " + drBoost);
  10. System.out.printLn("Testing Rates: OldRandom: " + oldRandom+ " - Old Dr Boost: " + oldDrBoost);
  11. for (int i = 0; i < drops; i++) {
  12. if (random == c[i].getChance().getRandom()) {
  13. x++;
  14. }
  15. }
  16. System.out.printLn("Testing Rates: Random: " + random + " - Old Random: " + oldRandom);
  17. random *= x;
  18. System.out.printLn("Testing Rates: Random: " + random + " - Old Random: " + oldRandom);
  19. p.setDroprate(drBoost);
  20. //p.setDroprate(NPCDrops.getDroprate(p));
  21.  
  22. if (p.getTransform() == npc.getId()) {
  23. drBoost += 5;
  24. p.sendMessage("Your soul boosted your droprate by 5% on this npc!");
  25. }
  26.  
  27. if (p.getSlayer().getSlayerTask().getNpcId() == npc.getId()) {
  28. if(p.getEquipment().get(Equipment.HEAD_SLOT).getId() == 11550){
  29. drBoost += 1;
  30. p.sendMessage("Your slayer helm boosted your droprate by 1%");
  31. }if(p.getEquipment().get(Equipment.HEAD_SLOT).getId() == 11549){
  32. drBoost += 3;
  33. p.sendMessage("Your slayer helm boosted your droprate by 2%");
  34. }if(p.getEquipment().get(Equipment.HEAD_SLOT).getId() == 11546){
  35. drBoost += 5;
  36. p.sendMessage("Your slayer helm boosted your droprate by 3%");
  37. }if(p.getEquipment().get(Equipment.HEAD_SLOT).getId() == 11547){
  38. drBoost += 10;
  39. p.sendMessage("Your slayer helm boosted your droprate by 4%");
  40. }if(p.getEquipment().get(Equipment.HEAD_SLOT).getId() == 11548){
  41. drBoost += 15;
  42. p.sendMessage("Your slayer helm boosted your droprate by 5%");
  43. }
  44. }
  45. System.out.printLn("Testing Rates: Random: " + random + " - Dr Boost: " + drBoost);
  46. System.out.printLn("Testing Rates: OldRandom: " + oldRandom+ " - Old Dr Boost: " + oldDrBoost);
  47.  
  48. random = (int)random * ((100-drBoost)/100);
  49. System.out.printLn("Testing Rates: Random: " + random + " - Dr Boost: " + drBoost);
  50. System.out.printLn("Testing Rates: OldRandom: " + oldRandom+ " - Old Dr Boost: " + oldDrBoost);
  51. System.out.printLn("Testing Final Rates: " + !b[chance.ordinal()] && Misc.getRandom((int) random) == 0);
  52. return !b[chance.ordinal()] && Misc.getRandom((int) random) == 0; //return true if random between 0 & table value is 1.
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement