Advertisement
Guest User

Untitled

a guest
Nov 30th, 2015
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.77 KB | None | 0 0
  1. package Sirens.scripts.items;
  2.  
  3. import Sirens.model.Hits;
  4. import Sirens.model.player.Player;
  5. import Sirens.model.player.Skills;
  6. import Sirens.model.World;
  7. import Sirens.scripts.itemScript;
  8. import Sirens.util.Misc;
  9. import Sirens.rscache.ItemDefinitions;
  10.  
  11. public class i10944 extends itemScript {
  12.  
  13. /**
  14. * SpawnScape Vote Tokens
  15. * @Author Jonathan Sirens
  16. **/
  17.  
  18. public static int super_rare_chance = 1000;
  19.  
  20. public static String global_color = "2EA73D";
  21.  
  22. public static String global_shad = "0";
  23.  
  24. public static String website = "www.spawnscape.net/vote";
  25.  
  26. public static int[] SUPER_RARE_ITEMS = {17173, 17175, 17177, 17179, 17181, 17183, 17185, 17187, 8871, 16909, 16359, 12610, 12612, 5607, 1419, 4084, 12614, 12616, 17161, 17163, 17165, 17167, 17169, 17171, 1038, 1040, 1042, 1044, 1046, 1048, 1050, 1053, 1055, 1057};
  27.  
  28. public static int[] RARE_ITEMS = {9177, 1191, 5680, 15069, 15071, 18786, 6570, 19669, 11694, 14484, 11724, 11726, 13887, 13893, 13899, 13905, 15220, 15017, 11696, 6199, 11698, 11700, 18349, 18351, 18353, 18355, 18357, 13738, 13740, 13742, 13744, 15825, 17273};
  29.  
  30. public static int[] COMMON_ITEMS = {4151, 6585, 11732, 15018, 15019, 15020, 6920, 15486, 6889, 11235, 11718, 11720, 11722, 6733, 6735, 6737, 6731, 6914, 1052, 18335, 4716, 4718, 4720, 4722, 4708, 4710, 4712, 4714, 4724, 4726, 4728, 4730, 4745, 4747, 4749, 4751, 4732, 4734, 4736, 4738, 4753, 4755, 4757, 4759, 989};
  31.  
  32. public static int random_item(int collection) {
  33. if(collection == 0) {
  34. return COMMON_ITEMS[(int) (Math.random() * COMMON_ITEMS.length)];
  35. } else if(collection == 1) {
  36. return RARE_ITEMS[(int) (Math.random() * RARE_ITEMS.length)];
  37. } else if(collection == 2) {
  38. return SUPER_RARE_ITEMS[(int) (Math.random() * SUPER_RARE_ITEMS.length)];
  39. }
  40. return 0;
  41. }
  42.  
  43. public void option1(Player p, int itemId, int interfaceId, int slot) {
  44. if(p.getInventory().getContainer().get(slot) == null)
  45. return;
  46. if(p.getInventory().getContainer().get(slot).getId() != itemId)
  47. return;
  48. if(interfaceId != 149)
  49. return;
  50. int collection = 0;
  51. int random_chance = Misc.random(1, super_rare_chance);
  52. if(random_chance == super_rare_chance - 1) {
  53. collection = 2;
  54. } else if(random_chance >= 1 && random_chance <= 12) {
  55. collection = 1;
  56. } else {
  57. collection = 0;
  58. }
  59. int item_id = random_item(collection);
  60. String name = Misc.formatPlayerNameForDisplay(p.getUsername().replaceAll("_", " "));
  61. p.getInventory().deleteItem(10944, 1);
  62. p.getInventory().addItem(item_id, 1);
  63. int yell_chance = Misc.random(1, 6);
  64. String item_name = ItemDefinitions.forID(item_id).name;
  65. int points = 1;
  66. if(p.donator_rank == 1) {
  67. points += 1;
  68. } else if(p.donator_rank == 2) {
  69. points += 1;
  70. } else if(p.donator_rank == 3) {
  71. points += 2;
  72. }
  73. p.VOTE_POINTS += points;
  74. p.UNLIMITED_PRAYER += 3600;
  75. if(collection != 0) {
  76. yell_chance = 1;
  77. }
  78. if(yell_chance == 1) {
  79. for (Player global_players: World.getPlayers()) {
  80. if(global_players == null)
  81. continue;
  82. global_players.getFrames().sendMessage("<img="+p.rank_crown+"><col="+p.rank_color+"><shad="+p.rank_shad+">"+name+"</col></shad><col="+global_color+"><shad="+global_shad+"> has voted at <col=ffff00><shad=ffffff>"+website+" <col="+global_color+"><shad="+global_shad+">and recieved (<col=ff0000><shad=0>"+item_name+"<col="+global_color+"><shad="+global_shad+">)!");
  83. }
  84. }
  85. p.getFrames().sendMessage("<img="+p.rank_crown+"><col="+p.rank_color+"><shad="+p.rank_shad+">You have recieved (<col=ff0000><shad=0>"+item_name+"<col="+p.rank_color+"><shad="+p.rank_shad+">), 30 minutes of unlimited prayer,");
  86. p.getFrames().sendMessage("<col="+p.rank_color+"><shad="+p.rank_shad+">and <col=ffff00><shad=ffffff>"+points+"<col="+p.rank_color+"><shad="+p.rank_shad+"> vote points.");
  87. }
  88. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement