armark1ng

Untitled

Sep 22nd, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.69 KB | None | 0 0
  1. else if (componentId == 38) {
  2. if (!canCreateGatestone())
  3. return false;
  4. if (packetId == WorldPacketsDecoder.ACTION_BUTTON2_PACKET) {
  5. player.getInventory().deleteItem(DungeonConstants.GATESTONE, 1);
  6. player.getInventory().addItem(DungeonConstants.GATESTONE, 1);
  7. player.getInventory().deleteItem(Magic.DUNG_COSMIC_RUNE, 3);
  8. player.getSkills().addXp(Skills.MAGIC, 43.5);
  9. player.setNextAnimation(new Animation(713));
  10. player.setNextGraphics(new Graphics(113));
  11. if (gatestone != null) {
  12. FloorItem item = World.getRegion(gatestone.getRegionId())
  13. .getGroundItem(DungeonConstants.GATESTONE, gatestone, player);
  14. if (item == null)
  15. return false;
  16. World.removeGroundItem(player, item, false);
  17. setGatestone(null);
  18. }
  19. } else {
  20. if (player.getInventory().containsItem(DungeonConstants.GATESTONE, 1)) {
  21. player.getPackets().sendGameMessage(
  22. "You already have a gatestone in your pack. Making another would be pointless.");
  23. } else if (gatestone != null) {
  24. player.getDialogueManager().startDialogue(new Dialogue() {
  25. @Override
  26. public void start() {
  27. this.sendDialogue("You already have an active gatestone, ",
  28. "Do you want to destroy your current and make another?");
  29. }
  30.  
  31. @Override
  32. public void run(int interfaceId, int componentId) {
  33. if (stage == -1) {
  34. stage = 0;
  35. this.sendOptionsDialogue(DEFAULT_OPTIONS_TITLE, "Yes.", "No.");
  36. } else if (stage == 0) {
  37. if (componentId == OPTION_1) {
  38. player.getInventory().addItem(DungeonConstants.GATESTONE, 1);
  39. player.getInventory().deleteItem(Magic.DUNG_COSMIC_RUNE, 3);
  40. player.getSkills().addXp(Skills.MAGIC, 43.5);
  41. player.setNextAnimation(new Animation(713));
  42. player.setNextGraphics(new Graphics(113));
  43. if (gatestone != null) {
  44. FloorItem item = World.getRegion(gatestone.getRegionId())
  45. .getGroundItem(DungeonConstants.GATESTONE, gatestone, player);
  46. if (item == null)
  47. return;
  48. World.removeGroundItem(player, item, false);
  49. setGatestone(null);
  50. }
  51. }
  52. end();
  53. }
  54. }
  55.  
  56. @Override
  57. public void finish() {
  58. // TODO Auto-generated method stub
  59.  
  60. }
  61. });
  62. } else {
  63. player.getInventory().addItem(DungeonConstants.GATESTONE, 1);
  64. player.getInventory().deleteItem(Magic.DUNG_COSMIC_RUNE, 3);
  65. player.getSkills().addXp(Skills.MAGIC, 43.5);
  66. player.setNextAnimation(new Animation(713));
  67. player.setNextGraphics(new Graphics(113));
  68. }
  69. }
  70. }
Advertisement
Add Comment
Please, Sign In to add comment