Advertisement
Guest User

Curse.java

a guest
Mar 30th, 2011
1,140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.35 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, 19};//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. case 0://pItem
  101. if(c.prayerActive[10] == false) {
  102. c.prayerActive[10] = true;
  103. c.startAnimation(12567);
  104. c.gfx0(2213);
  105. c.lastProtItem = System.currentTimeMillis();
  106. } else {
  107. c.prayerActive[10] = false;
  108. }
  109. break;
  110.  
  111. case 1:
  112. case 10:
  113. if (c.curseActive[i] == false) {
  114. atkCurse(i); // FUNKAR LÅT VA!
  115. }
  116. break;
  117.  
  118. case 2:
  119. case 11:
  120. if (c.curseActive[i] == false) {
  121. rngCurse(i); // FUNKAR!! LÅT VA!!!
  122. }
  123. break;
  124.  
  125. case 3:
  126. case 12:
  127. if (c.curseActive[i] == false) {
  128. mgeCurse(i); // FUNKAR LÅT STÅ!
  129. }
  130. break;
  131.  
  132. case 4:
  133. case 16:
  134. if (c.curseActive[i] == false) {
  135. sprtCurse(i); // FUNKAR!!
  136. }
  137. break;
  138. case 5:
  139. if(!c.zerkOn) {
  140. c.zerkOn = true;
  141. c.startAnimation(12589);
  142. c.gfx0(2266);
  143. c.sendMessage("You somehow feel your boosted stats will last longer.");
  144. } else {
  145. c.zerkOn = false;
  146. }
  147. break;
  148.  
  149. case 13:
  150. if (c.curseActive[i] == false) {
  151. defCurse(i); // FUNKARRRR
  152. }
  153. break;
  154. case 14:
  155. if (c.curseActive[i] == false) {
  156. strCurse(i); // ALLL GOOOD
  157. }
  158. break;
  159. case 15:
  160. if (c.curseActive[i] == false) {
  161. c.curseActive[19] = false;
  162. c.getPA().sendFrame36(c.CURSE_GLOW[19], 0);
  163. }
  164. break;
  165.  
  166.  
  167. case 6:
  168. case 7:
  169. case 8:
  170. case 9:
  171. if(System.currentTimeMillis() - c.stopPrayerDelay < 5000) {
  172. c.sendMessage("You have been injured and can't use this prayer!");
  173. c.getPA().sendFrame36(c.CURSE_GLOW[7], 0);
  174. c.getPA().sendFrame36(c.CURSE_GLOW[8], 0);
  175. c.getPA().sendFrame36(c.CURSE_GLOW[9], 0);
  176. return;
  177. }
  178. if (i == 7)
  179. c.protMageDelay = System.currentTimeMillis();
  180. else if (i == 8)
  181. c.protRangeDelay = System.currentTimeMillis();
  182. else if (i == 9)
  183. c.protMeleeDelay = System.currentTimeMillis();
  184. case 17:
  185. case 18:
  186. headIcon = true;
  187. for(int p = 6; p < 19; p++) {
  188. if(i != p && p != 10 && p != 11 && p != 10 && p != 12 && p != 13 && p != 14 && p != 15 && p != 16) {
  189. c.curseActive[p] = false;
  190. c.getPA().sendFrame36(c.CURSE_GLOW[p], 0);
  191. }
  192. }
  193. break;
  194.  
  195. case 19://Turmoil - DONE
  196. if (c.curseActive[i] == false) {
  197. c.startAnimation(12565);
  198. c.gfx0(2226);
  199. strCurse(i);
  200. atkCurse(i);
  201. defCurse(i);
  202. mgeCurse(i);
  203. rngCurse(i);
  204. sprtCurse(i);
  205. c.curseActive[15] = false;
  206. c.usingPrayer = false;
  207. c.getPA().sendFrame36(c.CURSE_GLOW[15], 0);
  208. }
  209. break;
  210. }
  211. if(!headIcon) {
  212. if(c.curseActive[i] == false) {
  213. c.curseActive[i] = true;
  214. c.getPA().sendFrame36(c.CURSE_GLOW[i], 1);
  215. } else {
  216. c.curseActive[i] = false;
  217. c.getPA().sendFrame36(c.CURSE_GLOW[i], 0);
  218. }
  219. } else {
  220. if(c.curseActive[i] == false) {
  221. c.curseActive[i] = true;
  222. c.getPA().sendFrame36(c.CURSE_GLOW[i], 1);
  223. c.headIcon = c.CURSE_HEAD_ICONS[i];
  224. c.getPA().requestUpdates();
  225. } else {
  226. c.curseActive[i] = false;
  227. c.getPA().sendFrame36(c.CURSE_GLOW[i], 0);
  228. c.headIcon = -1;
  229. c.getPA().requestUpdates();
  230. }
  231. }
  232. } else {
  233. c.getPA().sendFrame36(c.CURSE_GLOW[i],0);
  234. c.getPA().sendFrame126("You need a @blu@Prayer level of "+c.CURSE_LEVEL_REQUIRED[i]+" to use "+c.CURSE_NAME[i]+".", 357);
  235. c.getPA().sendFrame126("Click here to continue", 358);
  236. c.getPA().sendFrame164(356);
  237. }
  238. } else {
  239. c.getPA().sendFrame36(c.CURSE_GLOW[i],0);
  240. c.sendMessage("You have run out of prayer points!");
  241. }
  242. }
  243.  
  244. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement