Advertisement
Guest User

Untitled

a guest
May 3rd, 2015
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.26 KB | None | 0 0
  1. package server.model.players;
  2.  
  3. import server.Config;
  4. import server.Server;
  5. import server.util.Misc;
  6. import server.model.players.*;
  7.  
  8. public class Curse {
  9.  
  10. private Client c;
  11. public Curse(Client c) {
  12. this.c = c;
  13. }
  14.  
  15. public void resetCurse() {
  16. for(int p = 0; p < c.curseActive.length; p++) {
  17. c.curseActive[p] = false;
  18. c.getPA().sendFrame36(c.CURSE_GLOW[p], 0);
  19. }
  20. c.headIcon = -1;
  21. c.getPA().requestUpdates();
  22. }
  23.  
  24. public void strCurse(int i) {
  25. for (int j = 0; j < str.length; j++) {
  26. if (str[j] != i) {
  27. c.curseActive[str[j]] = false;
  28. c.getPA().sendFrame36(c.CURSE_GLOW[str[j]], 0);
  29. }
  30. }
  31. }
  32. public void atkCurse(int i) {
  33. for (int j = 0; j < atk.length; j++) {
  34. if (atk[j] != i) {
  35. c.curseActive[atk[j]] = false;
  36. c.getPA().sendFrame36(c.CURSE_GLOW[atk[j]], 0);
  37. }
  38. }
  39. }
  40. public void defCurse(int i) {
  41. for (int j = 0; j < def.length; j++) {
  42. if (def[j] != i) {
  43. c.curseActive[def[j]] = false;
  44. c.getPA().sendFrame36(c.CURSE_GLOW[def[j]], 0);
  45. }
  46. }
  47. }
  48. public void rngCurse(int i) {
  49. for (int j = 0; j < rng.length; j++) {
  50. if (rng[j] != i) {
  51. c.curseActive[rng[j]] = false;
  52. c.getPA().sendFrame36(c.CURSE_GLOW[rng[j]], 0);
  53. }
  54. }
  55. }
  56. public void mgeCurse(int i) {
  57. for (int j = 0; j < mge.length; j++) {
  58. if (mge[j] != i) {
  59. c.curseActive[mge[j]] = false;
  60. c.getPA().sendFrame36(c.CURSE_GLOW[mge[j]], 0);
  61. }
  62. }
  63. }
  64. public void sprtCurse(int i) {
  65. for (int j = 0; j < sprt.length; j++) {
  66. if (sprt[j] != i) {
  67. c.curseActive[sprt[j]] = false;
  68. c.getPA().sendFrame36(c.CURSE_GLOW[sprt[j]], 0);
  69. }
  70. }
  71. }
  72.  
  73. public int[] def = {13, 19};
  74. public int[] str = {14, 19};
  75. public int[] atk = {1, 10, 19};
  76. public int[] rng = {2, 11, 19};
  77. public int[] mge = {3, 12, 19};
  78. public int[] sprt = {4, 16};//spirit
  79.  
  80. public void activateCurse(int i) {
  81. if(c.duelRule[7]) {
  82. resetCurse();
  83. c.sendMessage("Prayer has been disabled in this duel!");
  84. return;
  85. }
  86. if (c.playerLevel[1] < 30) {
  87. c.getPA().sendFrame36(c.CURSE_GLOW[i], 0);
  88. c.sendMessage("You need 30 Defence to use this prayer.");
  89. return;
  90. }
  91. //0 = pItem//1 = sapWar//2 = sapRng//3 = sapMge//4 = sapSprt
  92. //5 = berserk//6 = defSum//7 = defMge//8 = defRng//9 = defMel
  93. //10 = leechAtk//11 = leechRng//12 = leechMge//13 = leechDef//14 = leechStr
  94. //15 = leechEnrgy//16 = leechSpec//17 = wrath//18 = soul//19 = turmoil
  95.  
  96. if(c.playerLevel[5] > 0 || !Config.PRAYER_POINTS_REQUIRED) {
  97. if(c.getPA().getLevelForXP(c.playerXP[5]) >= c.CURSE_LEVEL_REQUIRED[i] || !Config.PRAYER_LEVEL_REQUIRED) {
  98. boolean headIcon = false;
  99. switch(i) {
  100.  
  101. case 0://pItem
  102. if(c.prayerActive[10] == false) {
  103. c.prayerActive[10] = true;
  104. c.lastProtItem = System.currentTimeMillis();
  105. c.startAnimation(12567);
  106. c.gfx0(2213);
  107. } else {
  108. c.prayerActive[10] = false;
  109. }
  110. break;
  111.  
  112.  
  113. case 1:
  114. case 10:
  115. if (c.curseActive[i] == false) {
  116. atkCurse(i); //
  117. }
  118. break;
  119.  
  120. case 2:
  121. case 11:
  122. if (c.curseActive[i] == false) {
  123. rngCurse(i); //
  124. }
  125. break;
  126.  
  127. case 3:
  128. case 12:
  129. if (c.curseActive[i] == false) {
  130. mgeCurse(i); //
  131. }
  132. break;
  133.  
  134. case 4:
  135. case 16:
  136. if (c.curseActive[i] == false) {
  137. sprtCurse(i); //
  138. }
  139. break;
  140. case 5:
  141. //if(!c.zerkOn) {
  142. //c.zerkOn = true;
  143. c.startAnimation(12589);
  144. c.gfx0(2266);
  145. c.sendMessage("You somehow feel your boosted stats will last longer.");
  146. // } else {
  147. // c.zerkOn = false;
  148. // }
  149. break;
  150.  
  151. case 13:
  152. if (c.curseActive[i] == false) {
  153. defCurse(i); //
  154. }
  155. break;
  156. case 14:
  157. if (c.curseActive[i] == false) {
  158. strCurse(i); //
  159. }
  160. break;
  161.  
  162. case 6:
  163. case 7:
  164. case 8:
  165. case 9:
  166. if(System.currentTimeMillis() - c.stopPrayerDelay < 5000) {
  167. c.sendMessage("You have been injured and can't use this prayer!");
  168. c.getPA().sendFrame36(c.CURSE_GLOW[7], 0);
  169. c.getPA().sendFrame36(c.CURSE_GLOW[8], 0);
  170. c.getPA().sendFrame36(c.CURSE_GLOW[9], 0);
  171. return;
  172. }
  173. if (i == 7)
  174. c.protMageDelay = System.currentTimeMillis();
  175. else if (i == 8)
  176. c.protRangeDelay = System.currentTimeMillis();
  177. else if (i == 9)
  178. c.protMeleeDelay = System.currentTimeMillis();
  179. case 17:
  180. case 18:
  181. headIcon = true;
  182. for(int p = 6; p < 19; p++) {
  183. if(i != p && p != 10 && p != 11 && p != 10 && p != 12 && p != 13 && p != 14 && p != 15 && p != 16) {
  184. c.curseActive[p] = false;
  185. c.getPA().sendFrame36(c.CURSE_GLOW[p], 0);
  186. }
  187. }
  188. break;
  189.  
  190. case 19:
  191. if (c.curseActive[i] == false) {
  192. c.startAnimation(12565);
  193. c.gfx0(2226);
  194. strCurse(i);
  195. atkCurse(i);
  196. defCurse(i);
  197. mgeCurse(i);
  198. rngCurse(i);
  199. }
  200. break;
  201. }
  202. if(!headIcon) {
  203. if(c.curseActive[i] == false) {
  204. c.curseActive[i] = true;
  205. c.getPA().sendFrame36(c.CURSE_GLOW[i], 1);
  206. } else {
  207. c.curseActive[i] = false;
  208. c.getPA().sendFrame36(c.CURSE_GLOW[i], 0);
  209. }
  210. } else {
  211. if(c.curseActive[i] == false) {
  212. c.curseActive[i] = true;
  213. c.getPA().sendFrame36(c.CURSE_GLOW[i], 1);
  214. c.headIcon = c.CURSE_HEAD_ICONS[i];
  215. c.getPA().requestUpdates();
  216. } else {
  217. c.curseActive[i] = false;
  218. c.getPA().sendFrame36(c.CURSE_GLOW[i], 0);
  219. c.headIcon = -1;
  220. c.getPA().requestUpdates();
  221. }
  222. }
  223. } else {
  224. c.getPA().sendFrame36(c.CURSE_GLOW[i],0);
  225. c.getPA().sendFrame126("You need a @blu@Prayer level of "+c.CURSE_LEVEL_REQUIRED[i]+" to use "+c.CURSE_NAME[i]+".", 357);
  226. c.getPA().sendFrame126("Click here to continue", 358);
  227. c.getPA().sendFrame164(356);
  228. }
  229. } else {
  230. resetCurse();
  231. strCurse(i);
  232. atkCurse(i);
  233. defCurse(i);
  234. mgeCurse(i);
  235. rngCurse(i);
  236. c.sendMessage("You have run out of Prayer points!");
  237. }
  238. }
  239.  
  240. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement