Guest User

DialogueType.java

a guest
Mar 17th, 2013
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.62 KB | None | 0 0
  1. /**
  2. * Copyright Arham 4 @2013
  3. *
  4. * File made for the project Allstar-Redone.
  5. */
  6. package dialogue;
  7.  
  8. import client;
  9.  
  10. /**
  11. * @author Arham 4/RelentlessPK
  12. *
  13. * The type of dialogue.
  14. */
  15. public class DialogueType {
  16.  
  17. /**
  18. * Sent for player talking.
  19. *
  20. * @param player
  21. * The player.
  22. * @param expression
  23. * The expression ID.
  24. * @param strings
  25. * The text to say in the dialogue.
  26. */
  27. public DialogueType sendPlayerDialogue(client player, int expression,
  28. String... dialogueText) {
  29. if (dialogueText.length == 1) {
  30. player.sendFrame200(969, expression);
  31. player.sendFrame126(player.playerName.replaceAll("_", " "), 970);
  32. player.sendFrame126(dialogueText[0], 971);
  33. player.sendFrame126("Click here to continue", 972);
  34. player.sendFrame185(969);
  35. player.sendFrame164(968);
  36. } else if (dialogueText.length == 2) {
  37. player.sendFrame200(974, expression);
  38. player.sendFrame126(player.playerName.replaceAll("_", " "), 975);
  39. player.sendFrame126(dialogueText[0], 976);
  40. player.sendFrame126(dialogueText[1], 977);
  41. player.sendFrame126("Click here to continue", 978);
  42. player.sendFrame185(974);
  43. player.sendFrame164(973);
  44. } else if (dialogueText.length == 3) {
  45. player.sendFrame200(980, expression);
  46. player.sendFrame126(player.playerName.replaceAll("_", " "), 981);
  47. player.sendFrame126(dialogueText[0], 982);
  48. player.sendFrame126(dialogueText[1], 983);
  49. player.sendFrame126(dialogueText[2], 984);
  50. player.sendFrame126("Click here to continue", 985);
  51. player.sendFrame185(980);
  52. player.sendFrame164(979);
  53. } else if (dialogueText.length == 4) {
  54. player.sendFrame200(987, expression);
  55. player.sendFrame126(player.playerName.replaceAll("_", " "), 988);
  56. player.sendFrame126(dialogueText[0], 989);
  57. player.sendFrame126(dialogueText[1], 990);
  58. player.sendFrame126(dialogueText[2], 991);
  59. player.sendFrame126(dialogueText[3], 992);
  60. player.sendFrame126("Click here to continue", 993);
  61. player.sendFrame185(987);
  62. player.sendFrame164(986);
  63. }
  64. return this;
  65. }
  66.  
  67. /**
  68. * Sent for NPC talking.
  69. *
  70. * @param player
  71. * The player.
  72. * @param npcId
  73. * The NPC's ID.
  74. * @param expression
  75. * The expression ID.
  76. * @param dialogueText
  77. * The text of the dialogue.
  78. */
  79. public DialogueType sendNpcDialogue(client player, int npcId,
  80. int expression, String... dialogueText) {
  81. if (dialogueText.length == 1) {
  82. player.sendFrame200(4883, expression);
  83. player.sendFrame126(player.GetNpcName(npcId), 4884);
  84. player.sendFrame126(dialogueText[0], 4885);
  85. player.sendFrame75(npcId, 4883);
  86. player.sendFrame164(4882);
  87. } else if (dialogueText.length == 2) {
  88. player.sendFrame200(4888, expression);
  89. player.sendFrame126(player.GetNpcName(npcId), 4889);
  90. player.sendFrame126(dialogueText[0], 4890);
  91. player.sendFrame126(dialogueText[1], 4891);
  92. player.sendFrame75(npcId, 4901);
  93. player.sendFrame164(4887);
  94. } else if (dialogueText.length == 3) {
  95. player.sendFrame200(4894, expression);
  96. player.sendFrame126(player.GetNpcName(npcId), 4895);
  97. player.sendFrame126(dialogueText[0], 4896);
  98. player.sendFrame126(dialogueText[1], 4897);
  99. player.sendFrame126(dialogueText[2], 4898);
  100. player.sendFrame75(npcId, 4894);
  101. player.sendFrame164(4893);
  102. } else if (dialogueText.length == 4) {
  103. player.sendFrame200(4901, expression);
  104. player.sendFrame126(player.GetNpcName(npcId), 4902);
  105. player.sendFrame126(dialogueText[0], 4903);
  106. player.sendFrame126(dialogueText[1], 4904);
  107. player.sendFrame126(dialogueText[2], 4905);
  108. player.sendFrame126(dialogueText[3], 4906);
  109. player.sendFrame126("Click here to continue", 4907);
  110. player.sendFrame75(npcId, 4901);
  111. player.sendFrame164(4900);
  112. }
  113. return this;
  114. }
  115.  
  116. /**
  117. * The option dialogue.
  118. *
  119. * @param player
  120. * The player.
  121. * @param choiceText
  122. * The choice option texts.
  123. */
  124. public DialogueType sendOptionDialogue(client player, String... choiceText) {
  125. if (choiceText.length == 1)
  126. return null;
  127. if (choiceText.length == 2) {
  128. player.sendFrame126("Select an Option", 2460);
  129. player.sendFrame126(choiceText[0], 2461);
  130. player.sendFrame126(choiceText[1], 2462);
  131. player.sendFrame164(2459);
  132. } else if (choiceText.length == 3) {
  133. player.sendFrame126("Select an Option", 2470);
  134. player.sendFrame126(choiceText[0], 2471);
  135. player.sendFrame126(choiceText[1], 2472);
  136. player.sendFrame126(choiceText[2], 2473);
  137. player.sendFrame164(2469);
  138. } else if (choiceText.length == 4) {
  139. player.sendFrame126("Select an Option", 8208);
  140. player.sendFrame126(choiceText[0], 8209);
  141. player.sendFrame126(choiceText[1], 8210);
  142. player.sendFrame126(choiceText[2], 8211);
  143. player.sendFrame126(choiceText[3], 8212);
  144. player.sendFrame164(8207);
  145. } else if (choiceText.length == 5) {
  146. player.sendFrame126("Select an Option", 8220);
  147. player.sendFrame126(choiceText[0], 8221);
  148. player.sendFrame126(choiceText[1], 8222);
  149. player.sendFrame126(choiceText[2], 81986);
  150. player.sendFrame126(choiceText[3], 8224);
  151. player.sendFrame126(choiceText[4], 8225);
  152. player.sendFrame164(8219);
  153. }
  154. return this;
  155. }
  156.  
  157. /**
  158. * Sends an item message. I could not find anything other than this 1 line,
  159. * don't know where a 2, 3, or 4 line is.
  160. *
  161. * @param player
  162. * The player.
  163. * @param title
  164. * The title of this text. This will be the top blue text.
  165. * @param message
  166. * The message to send.
  167. * @param itemid
  168. * The item ID to show in the message.
  169. * @param size
  170. * The size of the item in the message.
  171. */
  172. public DialogueType sendItemMessage(client player, String title,
  173. String message, int itemid, int size) {
  174. player.sendFrame200(4883, 591);
  175. player.sendFrame126(message, 4884);
  176. player.sendFrame126(title, 4885);
  177. player.sendFrame246(4883, size, itemid);
  178. player.sendFrame164(4882);
  179. player.NpcDialogueSend = true;
  180. return this;
  181. }
  182.  
  183. /**
  184. * An infodia text. There is no "Click here to continue" in this. I could
  185. * not find any other thins for this like only 3 lines and such.
  186. *
  187. * @param player
  188. * The player.
  189. * @param text
  190. * The first line of text to say.
  191. * @param text2
  192. * The second line of text to say.
  193. * @param text3
  194. * The third line of text to say.
  195. * @param text4
  196. * The fourth line of text to say.
  197. * @param title
  198. * The title of this text. This will be the blue text on the top.
  199. */
  200. public DialogueType sendInfodiaMessage(Client player, String text, String text2,
  201. String text3, String text4, String title) {
  202. player.sendFrame126(title, 6180);
  203. player.sendFrame126(text, 6181);
  204. player.sendFrame126(text2, 6182);
  205. player.sendFrame126(text3, 6183);
  206. player.sendFrame126(text4, 6184);
  207. player.sendFrame164(6179);
  208. return this;
  209. }
  210.  
  211. /**
  212. * A statement. This is different from infodia as this has
  213. * "Click here to continue"
  214. *
  215. * @param player
  216. * The player.
  217. * @param lines
  218. * The lines to be said.
  219. */
  220. public DialogueType sendStatement(client player, String... lines) {
  221. int[] statementIds = { 357, 360, 364, 369 };
  222. if (lines == null || lines.length > 4)
  223. return;
  224. int id = statementIds[lines.length - 1];
  225. for (int i = 0; i <= lines.length; i++) {
  226. if (i == lines.length) {
  227. player.sendFrame126("Click here to continue", id);
  228. break;
  229. }
  230. player.sendFrame126(lines[i], id++);
  231. }
  232. player.sendFrame164(statementIds[lines.length - 1] - 1);
  233. return this;
  234. }
  235.  
  236. }
Advertisement
Add Comment
Please, Sign In to add comment