armark1ng

Untitled

Sep 5th, 2016
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.66 KB | None | 0 0
  1. package com.rs.game.player.quests;
  2.  
  3. import java.io.Serializable;
  4.  
  5. import com.rs.game.WorldObject;
  6. import com.rs.game.item.FloorItem;
  7. import com.rs.game.item.Item;
  8. import com.rs.game.npc.NPC;
  9. import com.rs.game.player.Player;
  10. import com.rs.game.player.quests.QuestManager.Progress;
  11.  
  12. /**
  13. * @author ARMAR X K1NG
  14. */
  15. public abstract class Quest implements Serializable {
  16.  
  17. private static final long serialVersionUID = 2587188148765693378L;
  18.  
  19. protected Player player;
  20.  
  21. protected Object[] parameters;
  22.  
  23. protected int stage = -1;
  24.  
  25. protected String RED = "<col=8A0808>";
  26.  
  27. protected String BLUE = "<col=08088A>";
  28.  
  29. public Progress progress = Progress.NOT_STARTED;
  30.  
  31. public abstract void start(boolean accept);
  32.  
  33. public abstract void update();
  34.  
  35. public void sendRewards() {
  36. player.setQuestPoints(player.getQuestPoints() + getQuestPoints());
  37. player.getInterfaceManager().sendInterface(1244);
  38. player.getPackets().sendIComponentText(1244, 25, "You have completed " + getQuestInformation()[0] + ".");
  39. player.getPackets().sendIComponentText(1244, 27, "Quest Points: " + player.getQuestPoints());
  40. player.getPackets().sendGlobalString(359, getQuestInformation()[5]);
  41. player.getPackets().sendItemOnIComponent(1244, 24, getRewardItemId(), 1);
  42. player.getVarsManager().sendVar(101, player.getQuestPoints());
  43. player.getPackets()
  44. .sendGameMessage("Congratulations! You have completed the " + getQuestInformation()[0] + " quest!");
  45. player.setCloseInterfacesEvent(new Runnable() {
  46.  
  47. @Override
  48. public void run() {
  49. giveRewards();
  50. }
  51. });
  52. }
  53.  
  54. public abstract void sendQuestJournalInterface(boolean show);
  55.  
  56. public void sendQuestInformation(String... information) {
  57. player.getInterfaceManager().sendInterface(1245);
  58. player.getPackets().sendRunScript(4017, new Object[] { information.length + 2 });
  59. for (int i = 0; i < 331; i++)
  60. player.getPackets().sendIComponentText(1245, i, "");
  61. player.getPackets().sendIComponentText(1245, 330, getQuestInformation()[0]);
  62. for (int i = 0; i < information.length; i++)
  63. player.getPackets().sendIComponentText(1245, (i + 13), information[i]);
  64. }
  65.  
  66. public abstract void finish();
  67.  
  68. protected abstract void giveRewards();
  69.  
  70. protected abstract void sendConfigs();
  71.  
  72. public abstract boolean hasRequirments();
  73.  
  74. protected abstract String[] getQuestInformation();
  75.  
  76. protected abstract int getQuestPoints();
  77.  
  78. protected abstract int questId();
  79.  
  80. protected abstract int getRewardItemId();
  81.  
  82. public void setStage(int stage) {
  83. this.stage = stage;
  84. }
  85.  
  86. public int getStage() {
  87. return this.stage;
  88. }
  89.  
  90. public boolean processNPCClick1(NPC npc) {
  91. return true;
  92. }
  93.  
  94. public boolean processNPCClick2(NPC npc) {
  95. return true;
  96. }
  97.  
  98. public boolean processNPCClick3(NPC npc) {
  99. return true;
  100. }
  101.  
  102. public boolean processItemOnNPC(NPC npc, Item item) {
  103. return true;
  104. }
  105.  
  106. public boolean processObjectClick1(WorldObject object) {
  107. return true;
  108. }
  109.  
  110. public boolean processObjectClick2(WorldObject object) {
  111. return true;
  112. }
  113.  
  114. public boolean processObjectClick3(WorldObject object) {
  115. return true;
  116. }
  117.  
  118. public boolean processObjectClick4(WorldObject object) {
  119. return true;
  120. }
  121.  
  122. public boolean processObjectClick5(WorldObject object) {
  123. return true;
  124. }
  125.  
  126. public boolean handleItemOnObject(WorldObject object, Item item) {
  127. return true;
  128. }
  129.  
  130. public boolean canTakeItem(FloorItem item) {
  131. return true;
  132. }
  133.  
  134. public boolean processButtonClick(int interfaceId, int componentId, int slotId, int slotId2, int packetId) {
  135. return true;
  136. }
  137.  
  138. public boolean canDropItem(Item item) {
  139. return true;
  140. }
  141.  
  142. public boolean useDig() {
  143. return true;
  144. }
  145.  
  146. public boolean canUseItemOnItem(Item itemUsed, Item usedWith) {
  147. return true;
  148. }
  149.  
  150. public boolean handleObjectExamine(WorldObject object) {
  151. return true;
  152. }
  153. }
Advertisement
Add Comment
Please, Sign In to add comment