armark1ng

Untitled

Sep 10th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.21 KB | None | 0 0
  1. package com.rs.game.player.content;
  2.  
  3. import com.rs.cache.loaders.ItemDefinitions;
  4. import com.rs.game.item.Item;
  5. import com.rs.game.player.Equipment;
  6. import com.rs.game.player.Player;
  7. import com.rs.game.tasks.WorldTask;
  8. import com.rs.game.tasks.WorldTasksManager;
  9. import com.rs.net.decoders.handlers.ButtonHandler;
  10.  
  11. public class CosmeticsHandler {
  12.  
  13. /**
  14. * Every Item Id You Put will show in the dialogue when clicked at the slot
  15. * no matter how many it will calculate the number of pages needed
  16. * automaticly
  17. */
  18. public static int[] HATS = { 20824, 1038, 1040, 1037, 1046, 1025 };
  19. public static int[] CAPES = { 1052, 1019, 1021, 19368 };
  20. public static int[] AMULETS = { 6585, 19335 };
  21. public static int[] CHESTS = { 20822, 20139, 1113, 1115, 1117, 1119, 1121, 1123, 1125, 1127, 1129, 20139, 1113,
  22. 1115, 1117, 1119, 1121, 1123, 1125, 1127, 1129 };
  23. public static int[] WEAPONS = { 16955, 18349, 18351, 18353 };
  24. public static int[] SHIELDS = { 17361, 13740, 13742, 13744, 17357, 17353 };
  25. public static int[] LEGS = { 20823 };
  26. public static int[] BOOTS = { 20826 };
  27. public static int[] GLOVES = { 20825 };
  28.  
  29. public static void openCosmeticsHandler(final Player player) {
  30. player.stopAll();
  31. player.getTemporaryAttributtes().put("Cosmetics", Boolean.TRUE);
  32. player.getInterfaceManager().sendInventoryInterface(670);
  33. player.getInterfaceManager().sendInterface(667);
  34. player.getVarsManager().sendVarBit(8348, 1);
  35. player.getVarsManager().sendVarBit(4894, 0);
  36. player.getPackets().sendItems(93, player.getInventory().getItems());
  37. player.getPackets().sendInterSetItemsOptionsScript(670, 0, 93, 4, 7, "Equip", "Compare", "Stats", "Examine");
  38. player.getPackets().sendUnlockIComponentOptionSlots(670, 0, 0, 27, 0, 1, 2, 3);
  39. Item[] cosmetics = player.getEquipment().getItems().getItemsCopy();
  40. for (int i = 0; i < cosmetics.length; i++) {
  41. Item item = cosmetics[i];
  42. if (i == Equipment.SLOT_AURA || i == Equipment.SLOT_ARROWS || i == Equipment.SLOT_RING)
  43. continue;
  44. if (item == null)
  45. cosmetics[i] = new Item(0);
  46. }
  47. player.getPackets().sendItems(94, cosmetics);
  48. player.getPackets().sendUnlockIComponentOptionSlots(667, 9, 0, 13, true, 0, 1, 2, 3);
  49. ButtonHandler.refreshEquipBonuses(player);
  50. WorldTasksManager.schedule(new WorldTask() {
  51. @Override
  52. public void run() {
  53. player.getVarsManager().sendVarBit(8348, 1);
  54. player.getPackets().sendRunScriptBlank(2319);
  55. }
  56. });
  57. player.setCloseInterfacesEvent(new Runnable() {
  58. @Override
  59. public void run() {
  60. player.getDialogueManager().finishDialogue();
  61. player.getTemporaryAttributtes().remove("Cosmetics");
  62. for (int i = 0; i < 15; i++) {
  63. player.getEquipment().refresh(i);
  64. }
  65. }
  66. });
  67. }
  68.  
  69. /*
  70. * Change the names of certain items of the costumes
  71. */
  72.  
  73. public static String getNameOnDialogue(int itemId) {
  74. switch (itemId) {
  75. case 20139:
  76. return "The Plate Of Torva!";
  77. }
  78. return ItemDefinitions.getItemDefinitions(itemId).getName();
  79. }
  80.  
  81. /*
  82. * Restricts player from using certain items if they doesn't have the
  83. * requirment needed
  84. */
  85.  
  86. public static boolean isRestrictedItem(Player player, int itemId) {
  87. switch (itemId) {
  88. case 18351:// Chaotic Long Sword Available for extreme donators
  89. return !player.isExtremeDonator();
  90. }
  91. return false;
  92. }
  93.  
  94. }
Advertisement
Add Comment
Please, Sign In to add comment