Advertisement
Guest User

Untitled

a guest
Jun 12th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.35 KB | None | 0 0
  1. package com.rs.game.player.dialogues.impl;
  2.  
  3. import com.rs.game.Animation;
  4. import com.rs.game.ForceMovement;
  5. import com.rs.game.ForceTalk;
  6. import com.rs.game.Graphics;
  7. import com.rs.game.World;
  8. import com.rs.game.WorldTile;
  9. import com.rs.game.item.Item;
  10. import com.rs.game.npc.NPC;
  11. import com.rs.game.player.QuestManager.Quests;
  12. import com.rs.game.player.Skills;
  13. import com.rs.game.player.content.ItemConstants;
  14. import com.rs.game.player.dialogues.Dialogue;
  15. import com.rs.game.tasks.WorldTask;
  16. import com.rs.game.tasks.WorldTasksManager;
  17. import com.rs.utils.Utils;
  18.  
  19. public class CompletionistCape extends Dialogue {
  20.  
  21. static final int[] randomNPC = { 6935, 3283, 4344, 6966 };
  22. int capeId;
  23. NPC guard;
  24.  
  25. /**
  26. * This dialogue is sent upon the player clicking on object id: 2562.
  27. */
  28.  
  29. @Override
  30. public void start() {
  31. sendNPCDialogue(
  32. 4405,
  33. 9827,
  34. "Hey! Get your hands off that! Don't you know not to touch items that don't belong to you.");
  35. }
  36.  
  37. @Override
  38. public void run(int interfaceId, int componentId) {
  39. switch (stage) {
  40. case -1:
  41. sendPlayerDialogue(9827, "Sorry, I just wondered what it was.");
  42. stage = 1;
  43. break;
  44. case 1:
  45. sendNPCDialogue(4405, 9827,
  46. "A good question. It's perhaps one of more mysterious exibits in this land.");
  47. stage = 2;
  48. break;
  49. case 2:
  50. sendNPCDialogue(
  51. 4405,
  52. 9827,
  53. "It was only discovered recently, but I have"
  54. + " dated it back almost as far as I can track. It turns out"
  55. + " this cape might be the product, or at least involved with a"
  56. + " Second Age mage by the name of Anima.");
  57. stage = 3;
  58. break;
  59. case 3:
  60. sendPlayerDialogue(9827, "Anima?");
  61. stage = 4;
  62. break;
  63. case 4:
  64. sendNPCDialogue(
  65. 4405,
  66. 9827,
  67. "Indeed, you might have learned about him. He"
  68. + " was a powerful mage back in the First Age. Very skill-"
  69. + " focused too, so this cape was a particular find.");
  70. stage = 5;
  71. break;
  72. case 5:
  73. sendPlayerDialogue(9827, "What do you mean by that?");
  74. stage = 6;
  75. break;
  76. case 6:
  77. sendNPCDialogue(
  78. 4405,
  79. 9827,
  80. "Well, generally, his magical abilities were focused away"
  81. + " from combat - it seems this cape is under the mose"
  82. + " powerful enchantment we've ever seen.");
  83. stage = 7;
  84. break;
  85. case 7:
  86. sendPlayerDialogue(9827, "This cape is enchanted?");
  87. stage = 8;
  88. break;
  89. case 8:
  90. sendNPCDialogue(
  91. 4405,
  92. 9827,
  93. "Yes, and more than I can grasp. It physically repels anyone who tries to touch"
  94. + " it. I had quite a hassle getting it here with a ship.");
  95. stage = 9;
  96. break;
  97. case 9:
  98. sendPlayerDialogue(9827, "So no one has worn this cape?");
  99. stage = 10;
  100. break;
  101. case 10:
  102. sendNPCDialogue(
  103. 4405,
  104. 9827,
  105. "No one can! It's like it has a mind of it's own juding those who try as unworthy.");
  106. stage = 11;
  107. break;
  108. case 11:
  109. sendOptionsDialogue("Select Option", "Can I try?",
  110. "How interesting.");
  111. stage = 12;
  112. break;
  113. case 12:
  114. switch (componentId) {
  115. case OPTION_1:
  116. stage = 13;
  117. sendPlayerDialogue(9827, "Can I try?");
  118. break;
  119. case OPTION_2:
  120. default:
  121. stage = 30;
  122. sendPlayerDialogue(9827, "How interesting.");
  123. break;
  124. }
  125. break;
  126.  
  127. case 13:
  128. sendNPCDialogue(
  129. 4405,
  130. 9827,
  131. "I said no touching... but, if you get close enough, I'm sure you'll the enchantment affects"
  132. + " ... Good luck!");
  133. stage = 14;
  134. break;
  135. case 14:
  136. if (!ItemConstants.canWear(new Item(20769), player)) {
  137. player.getInterfaceManager().removeDialogueInterface();
  138. player.lock();
  139. player.setNextFaceWorldTile(new WorldTile(3263, 3455, 2));
  140. WorldTasksManager.schedule(new WorldTask() {
  141. int phase = 0;
  142.  
  143. @Override
  144. public void run() {
  145. switch (phase) {
  146. case 0:
  147. player.setNextAnimation(new Animation(857));
  148. break;
  149. case 1:
  150. player.setNextAnimation(new Animation(915));
  151. break;
  152. case 2:
  153. player.setNextAnimation(new Animation(857));
  154. break;
  155. case 3:
  156. player.setNextGraphics(new Graphics(86));
  157. player.getAppearence().transformIntoNPC(randomNPC[Utils.random(randomNPC.length - 1)]);
  158. break;
  159. case 4:
  160. player.setNextForceTalk(new ForceTalk("..What."));
  161. break;
  162. case 5:
  163. player.setNextGraphics(new Graphics(86));
  164. player.getAppearence().transformIntoNPC(-1);
  165. player.setNextAnimation(new Animation(10070));
  166. player.setNextForceMovement(new ForceMovement(
  167. new WorldTile(3263, 3453, 2), 1, 0));
  168. break;
  169. case 6:
  170. player.setNextWorldTile(new WorldTile(3263, 3453, 2));
  171. player.setNextFaceWorldTile(new WorldTile(3263, 3455, 2));
  172. sendNPCDialogue(4405, 9827,
  173. "Looks like Anima had a sense of humour!");
  174. player.unlock();
  175. break;
  176. }
  177. phase++;
  178. }
  179. }, 2, 2);
  180. stage = 15;
  181. } else {// TODO: Animation & graphics
  182. sendNPCDialogue(4405, 9827,
  183. "I've not seen a reaction like that! I think this cape is"
  184. + " identifying it's true owner.");
  185. stage = 16;
  186. }
  187. break;
  188. case 15:
  189. player.setNextFaceEntity(null);
  190. player.unlock();
  191. sendNPCDialogue(4405, 9827,
  192. "Sorry, it doesn't look like you are worthy of this cape. At"
  193. + " least not yet...");
  194. stage = -2;
  195. break;
  196. case 16:
  197. sendPlayerDialogue(9827, "You mean I can have it?");
  198. stage = 17;
  199. break;
  200. case 17:
  201. sendNPCDialogue(
  202. 4405,
  203. 9827,
  204. "Well, yes, but... I can't just let you take the cape. You"
  205. + " may be the true owner, but it is one of the most"
  206. + " treasured items I have.");
  207. stage = 18;
  208. break;
  209. case 18:
  210. sendNPCDialogue(
  211. 4405,
  212. 9827,
  213. "I suppose if I were compensated, perhaps I"
  214. + " could let you take it... How does 5,000,000 coins"
  215. + " sound?");
  216. stage = 19;
  217. break;
  218. case 19:
  219. sendOptionsDialogue("Select Option",
  220. "That sounds fair.", "That sounds like a joke!");
  221. stage = 20;
  222. break;
  223. case 20:
  224. switch (componentId) {
  225. case OPTION_1:
  226. sendPlayerDialogue(9827, "That sounds fair.");
  227. stage = 21;
  228. break;
  229. case OPTION_2:
  230. sendPlayerDialogue(9827, "That sounds like a joke!");
  231. stage = -2;
  232. break;
  233. }
  234. break;
  235. case 21:
  236. if (player.getInventory().getCoinsAmount() < 5000000) {
  237. sendNPCDialogue(
  238. 4405,
  239. 9827,
  240. "Alright, well come talk to me again when you have enough gold and I'll let you have it.");
  241. stage = -2;
  242. } else {
  243. if (player.getInventory().getFreeSlots() < 2) {
  244. sendNPCDialogue(4405, 9827,
  245. "Sorry, but your inventory seems to be full, please come back "
  246. + "with more space.");
  247. stage = -2;
  248. } else {
  249. int value = 5000000;
  250. player.getInventory().removeItemMoneyPouch(new Item(995,value));
  251. sendNPCDialogue(4405, 9827, "Thanks, enjoy!");
  252. player.getInventory().addItem(new Item(20769, 1));
  253. player.getInventory().addItem(new Item(20770, 1));
  254. stage = -2;
  255. }
  256. }
  257. break;
  258. case 30:
  259. sendNPCDialogue(4405, 9827, "Thanks for wasting my time.");
  260. stage = -2;
  261. break;
  262. case -2:
  263. end();
  264. break;
  265. }
  266. }
  267.  
  268.  
  269.  
  270. public void sendRequirementMessages() {
  271.  
  272. }
  273.  
  274. @Override
  275. public void finish() {
  276.  
  277. }
  278. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement