Advertisement
Guest User

Untitled

a guest
Mar 24th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.20 KB | None | 0 0
  1. private final static int WALKING_PACKET = 11;
  2. private final static int MINI_WALKING_PACKET = 44;
  3. public final static int ACTION_BUTTON1_PACKET = 50;
  4. public final static int ACTION_BUTTON2_PACKET = 72;
  5. public final static int ACTION_BUTTON3_PACKET = 14;
  6. public final static int ACTION_BUTTON4_PACKET = 18;
  7. public final static int ACTION_BUTTON5_PACKET = 31;
  8. public final static int ACTION_BUTTON6_PACKET = 62;
  9. public final static int ACTION_BUTTON7_PACKET = 21;
  10. public final static int ACTION_BUTTON8_PACKET = 4;
  11. public final static int ACTION_BUTTON9_PACKET = 45;
  12. public final static int ACTION_BUTTON10_PACKET = -11;
  13. public final static int WORLD_MAP_CLICK = 37;
  14. public final static int RECEIVE_PACKET_COUNT_PACKET = 15;
  15. private final static int PLAYER_OPTION_3_PACKET = -1;
  16. private final static int PLAYER_OPTION_4_PACKET = 17;
  17. private final static int PLAYER_OPTION_6_PACKET = 67;
  18. private final static int MOVE_CAMERA_PACKET = 79;
  19. private final static int INTERFACE_ON_OBJECT = 107;
  20. private final static int CLICK_PACKET = 73;
  21. private final static int CLICK_PACKET_2 = 27;
  22. private final static int MOUVE_MOUSE_PACKET = 53;
  23. private final static int MOUSE_MOVEMENT_DELAY = 116;
  24. private final static int KEY_TYPED_PACKET = 86;
  25. private final static int CLOSE_INTERFACE_PACKET = 56;
  26. private final static int COMMANDS_PACKET = 109;
  27. private final static int INTERFACE_ON_INTERFACE = 102;
  28. private final static int IN_OUT_SCREEN_PACKET = 25;
  29. private final static int DONE_LOADING_REGION_PACKET = 76;
  30. private final static int PING_PACKET = 119;
  31. private final static int SCREEN_PACKET = 20;
  32. private final static int CHAT_TYPE_PACKET = 2;
  33. private final static int CHAT_PACKET = 87;
  34. private final static int PUBLIC_QUICK_CHAT_PACKET = 71;
  35. private final static int ADD_FRIEND_PACKET = -1;
  36. private final static int ADD_IGNORE_PACKET = -1;
  37. private final static int REMOVE_IGNORE_PACKET = -1;
  38. private final static int JOIN_FRIEND_CHAT_PACKET = -1;
  39. private final static int CHANGE_FRIEND_CHAT_PACKET = -1;
  40. private final static int KICK_FRIEND_CHAT_PACKET = -1;
  41. private final static int KICK_CLAN_CHAT_PACKET = -1;
  42. private final static int REMOVE_FRIEND_PACKET = -1;
  43. private final static int SEND_FRIEND_MESSAGE_PACKET = -1;
  44. private final static int SEND_FRIEND_QUICK_CHAT_PACKET = -1;
  45. private final static int OBJECT_CLICK1_PACKET = 36;
  46. private final static int OBJECT_CLICK2_PACKET = 39;
  47. private final static int OBJECT_CLICK3_PACKET = 40;
  48. private final static int OBJECT_CLICK4_PACKET = 90;
  49. private final static int OBJECT_CLICK5_PACKET = 41;
  50. private final static int OBJECT_EXAMINE_PACKET = 29;
  51. private final static int NPC_CLICK1_PACKET = 59;
  52. private final static int ATTACK_NPC_PACKET = 65;
  53. private final static int NPC_CLICK2_PACKET = 52;
  54. private final static int NPC_CLICK3_PACKET = 61;
  55. private final static int NPC_CLICK4_PACKET = 88;
  56. private static final int NPC_EXAMINE_PACKET = 38;
  57. private final static int PLAYER_OPTION_1_PACKET = 100;
  58. private final static int PLAYER_OPTION_2_PACKET = 68;
  59. private final static int PLAYER_OPTION_9_PACKET = 49;
  60. private final static int ITEM_TAKE_PACKET = 26;
  61. private final static int GROUND_ITEM_OPTION_2 = 0;
  62. private final static int DIALOGUE_CONTINUE_PACKET = 113;
  63. private final static int ENTER_INTEGER_PACKET = 81;
  64. private final static int ENTER_NAME_PACKET = 9;
  65. private final static int ENTER_LONG_TEXT_PACKET = 111;
  66. private final static int SWITCH_INTERFACE_COMPONENTS_PACKET = 12;
  67. private final static int INTERFACE_ON_PLAYER = -1;
  68. private final static int INTERFACE_ON_NPC = 32;
  69. private final static int COLOR_ID_PACKET = 91;
  70. private static final int FORUM_THREAD_ID_PACKET = -1;
  71. private final static int OPEN_URL_PACKET = -1;
  72. private final static int REPORT_ABUSE_PACKET = -1;
  73. private final static int GRAND_EXCHANGE_ITEM_SELECT_PACKET = 34;
  74. private final static int WORLD_LIST_UPDATE = 108;
  75. private final static int UPDATE_GAMEBAR_PACKET = 84;
  76. private final static int NIS_VAR_PACKET = 46;
  77. private final static int MUSIC_PACKET = 93;
  78. private final static int REQUEST_PLAY_MUSIC_PACKET = 82;
  79. private final static int CUTSCENE_DONE_PACKET = -1;
  80. private final static int GARBAGE_CLEAR_PACKET = 8;
  81.  
  82.  
  83. //--------SWITCH_INTERFACE_COMPONENTS_PACKET -- start
  84. if (opcode == SWITCH_INTERFACE_COMPONENTS_PACKET) {
  85. @SuppressWarnings("unused")
  86. int toItemId = stream.readShortLE();
  87. int fromInterfaceHash = stream.readIntLE();
  88. int fromSlot = stream.readShort();
  89. int toInterfaceHash = stream.readIntV1();
  90. int fromItemId = stream.readShort();
  91. int toSlot = stream.readShortLE();
  92.  
  93. int fromInterfaceId = fromInterfaceHash >> 16;
  94. int fromComponentId = fromInterfaceHash - (fromInterfaceId << 16);
  95. int toInterfaceId = toInterfaceHash >> 16;
  96. int toComponentId = toInterfaceHash - (toInterfaceId << 16);
  97.  
  98. if (Settings.DEBUG)
  99. System.out.println("Switch item " + fromInterfaceId + ", " + toInterfaceId + ", " + fromSlot + ", "
  100. + toSlot + ", " + fromComponentId + ", " + toComponentId);
  101. if (Utils.getInterfaceDefinitionsSize() <= fromInterfaceId
  102. || Utils.getInterfaceDefinitionsSize() <= toInterfaceId)
  103. return;
  104. if (!player.getInterfaceManager().containsInterface(fromInterfaceId)
  105. || !player.getInterfaceManager().containsInterface(toInterfaceId))
  106. return;
  107. if (fromComponentId != -1
  108. && Utils.getInterfaceDefinitionsComponentsSize(fromInterfaceId) <= fromComponentId)
  109. return;
  110. if (toComponentId != -1 && Utils.getInterfaceDefinitionsComponentsSize(toInterfaceId) <= toComponentId)
  111. return;
  112. if ((fromInterfaceId == Inventory.INVENTORY_INTERFACE || fromInterfaceId == Inventory.INVENTORY_INTERFACE_2)
  113. && (toInterfaceId == Inventory.INVENTORY_INTERFACE
  114. || toInterfaceId == Inventory.INVENTORY_INTERFACE_2)) {
  115. if (toSlot < 0 || toSlot >= player.getInventory().getItemsContainerSize()
  116. || fromSlot >= player.getInventory().getItemsContainerSize())
  117. return;
  118. player.getInventory().switchItem(fromSlot, toSlot);
  119. } else if ((fromInterfaceId == Inventory.INVENTORY_INTERFACE
  120. || fromInterfaceId == Inventory.INVENTORY_INTERFACE_2)
  121. && ((toInterfaceId == 1462 && toComponentId == 14)
  122. || (toInterfaceId == 1464 && toComponentId == 15))) {
  123. System.out.println("VAG");
  124. if (fromSlot >= player.getInventory().getItemsContainerSize()
  125. || player.getInterfaceManager().containsInventoryInter())
  126. return;
  127. Item item = player.getInventory().getItem(fromSlot);
  128. if (item == null)
  129. return;
  130. ItemDefinitions defs = ItemDefinitions.getItemDefinitions(item.getId());
  131. if (!defs.isWearItem())
  132. return;
  133. InventoryOptionsHandler.handleItemOption2(player, fromSlot, item.getId(), item);
  134. } else if (((fromInterfaceId == 1462 && fromComponentId == 14)
  135. || (fromInterfaceId == 1464 && fromComponentId == 15))
  136. && (toInterfaceId == Inventory.INVENTORY_INTERFACE
  137. || toInterfaceId == Inventory.INVENTORY_INTERFACE_2)) {
  138. if (fromSlot >= player.getEquipment().getItems().getSize()
  139. || player.getInterfaceManager().containsInventoryInter())
  140. return;
  141.  
  142. Item item = player.getEquipment().getItem(fromSlot);
  143. if (item == null)
  144. return;
  145. ItemDefinitions defs = ItemDefinitions.getItemDefinitions(item.getId());
  146. if (!defs.isWearItem())
  147. return;
  148. player.getEquipment().handleEquipment(defs.getEquipSlot(), item.getId(),
  149. WorldPacketsDecoder.ACTION_BUTTON1_PACKET);
  150. } else if (toInterfaceId == 1430 && (toComponentId >= 55 && toComponentId <= 229)
  151. || (toInterfaceId == 1436 && (toComponentId >= 25 && toComponentId <= 194))) { // ability
  152. // bar
  153. // switch shortcut
  154. if (fromInterfaceId == 1430 && (fromComponentId >= 55 && fromComponentId <= 229)
  155. || (fromInterfaceId == 1436 && (fromComponentId >= 25 && fromComponentId <= 194)))
  156. player.getActionbar().switchShortcut((fromComponentId - (fromInterfaceId == 1430 ? 55 : 25)) / 13,
  157. (toComponentId - (toInterfaceId == 1430 ? 55 : 25)) / 13);
  158. // item shortcut inv
  159. else if (fromInterfaceId == Inventory.INVENTORY_INTERFACE
  160. || fromInterfaceId == Inventory.INVENTORY_INTERFACE_2) {
  161. if (fromSlot >= player.getInventory().getItemsContainerSize())
  162. return;
  163. Item item = player.getInventory().getItem(fromSlot);
  164. if (item == null || item.getId() != fromItemId)
  165. return;
  166. player.getActionbar().setShortcut((toComponentId - (toInterfaceId == 1430 ? 55 : 25)) / 13,
  167. new ItemShortcut(item.getId()));
  168. // item shortcut equip
  169. } else if ((fromInterfaceId == 1464 && fromComponentId == 15)
  170. || (fromInterfaceId == 1464 && fromComponentId == 14)) {
  171. if (fromSlot >= player.getEquipment().getItems().getSize())
  172. return;
  173. Item item = player.getEquipment().getItem(fromSlot);
  174. if (item == null || item.getId() != fromItemId)
  175. return;
  176. player.getActionbar().setShortcut((toComponentId - (toInterfaceId == 1430 ? 55 : 25)) / 13,
  177. new ItemShortcut(item.getId()));
  178. // spell shortcut
  179. // Switch item 1464, 1430, 3, 65535, 15, 142
  180. } else if (fromInterfaceId == 1461 && fromComponentId == 1) {
  181. if (Magic.getSpellData(fromSlot) == null) // fake spell
  182. return;
  183. player.getActionbar().setShortcut((toComponentId - (toInterfaceId == 1430 ? 55 : 25)) / 13,
  184. new MagicAbilityShortcut(fromSlot));
  185.  
  186. } else if (fromInterfaceId == 1449 && fromComponentId == 1) {
  187. boolean usingDefenceAbilities = player.getCombatDefinitions().onDefenceMenu();
  188. if (ActionBar.getAbilityData(usingDefenceAbilities ? ActionBar.DEFENCE_ABILITY_SHORTCUT
  189. : ActionBar.HEAL_ABILITY_SHORTCUT, fromSlot) == null) // fake
  190. // spell
  191. return;
  192. player.getActionbar().setShortcut((toComponentId - (toInterfaceId == 1430 ? 55 : 25)) / 13,
  193. usingDefenceAbilities ? new DefenceAbilityShortcut(fromSlot)
  194. : new HealAbilityShortcut(fromSlot));
  195. } else if (fromInterfaceId == 1452 && fromComponentId == 1) {
  196. if (ActionBar.getAbilityData(ActionBar.RANGED_ABILITY_SHORTCUT, fromSlot) == null) // fake
  197. // spell
  198. return;
  199. player.getActionbar().setShortcut((toComponentId - (toInterfaceId == 1430 ? 55 : 25)) / 13,
  200. new RangeAbilityShortcut(fromSlot));
  201. // prayer shortcut
  202. } else if (fromInterfaceId == 1460 && fromComponentId == 1) {
  203. boolean usingStrAbilities = player.getCombatDefinitions().onStrengthMenu();
  204. if (ActionBar.getAbilityData(
  205. usingStrAbilities ? ActionBar.STRENGTH_ABILITY_SHORTCUT : ActionBar.MELEE_ABILITY_SHORTCUT,
  206. fromSlot) == null) // fake
  207. // spell
  208. return;
  209. player.getActionbar().setShortcut((toComponentId - (toInterfaceId == 1430 ? 55 : 25)) / 13,
  210. usingStrAbilities ? new StrengthAbilityShortcut(fromSlot)
  211. : new MeleeAbilityShortcut(fromSlot));
  212. } else if (fromInterfaceId == 1458 && fromComponentId == 31) {
  213. if (!player.getPrayer().exists(fromSlot))
  214. return;
  215. player.getActionbar().setShortcut((toComponentId - (toInterfaceId == 1430 ? 55 : 25)) / 13,
  216. new PrayerShortcut(fromSlot, player.getPrayer().isAncientCurses()));
  217. }
  218. } else if (fromInterfaceId == 1430 && (fromComponentId >= 55 && fromComponentId <= 229)
  219. || (fromInterfaceId == 1436 && (fromComponentId >= 25 && fromComponentId <= 194))) { // ability
  220. // bar
  221. // drag
  222. // inventory droping drag
  223. if ((toInterfaceId == InterfaceManager.RESIZABLE_WINDOW_ID && toComponentId == 18))
  224. player.getActionbar().clearShortcut((fromComponentId - (fromInterfaceId == 1430 ? 55 : 25)) / 13);
  225. } else if ((fromInterfaceId == Inventory.INVENTORY_INTERFACE
  226. || fromInterfaceId == Inventory.INVENTORY_INTERFACE_2)
  227. && (toInterfaceId == InterfaceManager.RESIZABLE_WINDOW_ID && toComponentId == 18)) {
  228. if (fromSlot >= player.getInventory().getItemsContainerSize())
  229. return;
  230. Item item = player.getInventory().getItem(fromSlot);
  231. if (item == null || item.getId() != fromItemId)
  232. return;
  233. InventoryOptionsHandler.handleItemOption7(player, fromSlot, fromItemId, item);
  234. } else if (fromInterfaceId == 762 && toInterfaceId == 762) {
  235. if (fromComponentId == toComponentId) {
  236. if (toComponentId == 10) {
  237. if (toSlot >= player.getInventory().getItemsContainerSize()
  238. || fromSlot >= player.getInventory().getItemsContainerSize())
  239. return;
  240. player.getInventory().switchItem(fromSlot, toSlot);
  241. } else
  242. player.getBank().switchItem(fromSlot, toSlot);
  243. } else if (fromComponentId == 10) {
  244. if (fromSlot >= player.getInventory().getItemsContainerSize())
  245. return;
  246. player.getBank().switchToBank(fromSlot, toSlot, toComponentId);
  247. } else if (fromComponentId == 243) {
  248. if (toComponentId >= 280)
  249. player.getBank().insertItem(fromSlot, toComponentId == 300 ? toSlot : -1, fromComponentId,
  250. toComponentId);
  251. else if (toComponentId == 10) {
  252. if (toSlot >= player.getInventory().getItemsContainerSize())
  253. return;
  254. player.getBank().switchToInventory(fromSlot, toSlot);
  255. } else
  256. player.getBank().switchItem(fromSlot, toSlot, fromComponentId, toComponentId);
  257. }
  258. } else if (fromInterfaceId == 1265 && toInterfaceId == 1266
  259. && player.getTemporaryAttributtes().get("is_buying") != null) {
  260. if ((boolean) player.getTemporaryAttributtes().get("is_buying") == true) {
  261. Shop shop = (Shop) player.getTemporaryAttributtes().get("shop_instance");
  262. if (shop == null)
  263. return;
  264. // shop.buyItem(player, fromSlot, 1);
  265. }
  266. } else if ((fromInterfaceId == 34 || fromInterfaceId == 1417)
  267. && (toInterfaceId == 34 || toInterfaceId == 1417))
  268. player.getNotes().switchNotes(fromSlot, toSlot);
  269. }
  270.  
  271. //--------SWITCH_INTERFACE_COMPONENTS_PACKET -- end
  272.  
  273. if (opcode == ENTER_INTEGER_PACKET) {
  274. if (!player.isRunning() || player.isDead())
  275. return; //put this (if) instead of urs
  276.  
  277. if (player.getInterfaceManager().containsInterface(105)
  278. && player.getTemporaryAttributtes().remove("GEPRICESET") != null) {
  279. player.getGeManager().modifyPricePerItem((value - 1));
  280. } else if (player.getInterfaceManager().containsInterface(105)
  281. && player.getTemporaryAttributtes().remove("GEQUANTITYSET") != null) {
  282. player.getGeManager().modifyAmount((value - 1));
  283. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement