Guest User

Untitled

a guest
Feb 18th, 2012
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.05 KB | None | 0 0
  1. package server.model.entity.combat;
  2.  
  3. import server.Config;
  4. import server.model.entity.player.Client;
  5. import server.model.entity.player.Player;
  6.  
  7. public class Curse {
  8.  
  9. private Client c;
  10. public Curse(Client c) {
  11. this.c = c;
  12. }
  13.  
  14. public void deactivateLeeches() {
  15. if(c.curseActive[13]) {
  16. c.curseDefence -= 5;
  17. }
  18. if(c.curseActive[10]) {
  19. c.curseAttack -= 5;
  20. }
  21. if(c.curseActive[12]) {
  22. c.curseMagic -= 5;
  23. }
  24. if(c.curseActive[11]) {
  25. c.curseRange -= 5;
  26. }
  27. if(c.curseActive[14]) {
  28. c.curseStrength -= 5;
  29. }
  30. }
  31. public void prayDrop() {
  32. if (c.playerLevel[5] == 0) {
  33. c.curseDefence = 0;
  34. c.curseStrength = 0;
  35. c.curseAttack = 0;
  36. c.curseMagic = 0;
  37. c.curseRange = 0;
  38. c.updateRequired = true;
  39. c.setAppearanceUpdateRequired(true);
  40. }
  41. }
  42. boolean deactive = false;
  43. public void curseStat(int curseId) {
  44. switch(curseId) {
  45.  
  46. case 19:
  47. if(!c.curseActive[19]) {
  48. turmBonus();
  49. }else {
  50. deactivateTurmoil();
  51. }
  52. // deactivateLeeches();
  53. c.updateRequired = true;
  54. c.setAppearanceUpdateRequired(true);
  55. prayDrop();
  56. break;
  57.  
  58. case 10:
  59. deactivateTurmoil();
  60. if(!c.curseActive[10]) {
  61. c.curseAttack += 5;
  62. }else if (c.curseActive[10] == false) {
  63. c.curseAttack -= 5;
  64. }
  65. prayDrop();
  66. c.updateRequired = true;
  67. c.setAppearanceUpdateRequired(true);
  68. break;
  69.  
  70. case 11:
  71. deactivateTurmoil();
  72. if(!c.curseActive[11]) {
  73. c.curseRange += 5;
  74. }else if (c.curseActive[11] == false) {
  75. c.curseRange -= 5;
  76. }
  77. prayDrop();
  78. c.updateRequired = true;
  79. c.setAppearanceUpdateRequired(true);
  80.  
  81. break;
  82. case 12:
  83. deactivateTurmoil();
  84. if(!c.curseActive[12]) {
  85. c.curseMagic += 5;
  86. }else if (c.curseActive[12]) {
  87. c.curseMagic -= 5;
  88. }
  89. prayDrop();
  90. c.updateRequired = true;
  91. c.setAppearanceUpdateRequired(true);
  92. break;
  93.  
  94. case 14:
  95. deactivateTurmoil();
  96. if(!c.curseActive[14]) {
  97. c.curseStrength += 5;
  98. }else if (c.curseActive[14]) {
  99. c.curseStrength -= 5;
  100. }
  101. prayDrop();
  102. c.updateRequired = true;
  103. c.setAppearanceUpdateRequired(true);
  104. break;
  105.  
  106. case 13:
  107. deactivateTurmoil();
  108. if(!c.curseActive[13]) {
  109. c.curseDefence += 5;
  110. }else if (c.curseActive[13]) {
  111. c.curseDefence -= 5;
  112. }
  113. prayDrop();
  114. c.updateRequired = true;
  115. c.setAppearanceUpdateRequired(true);
  116. break;
  117. case 15:
  118. case 16:
  119. case 17:
  120. case 18:
  121. deactivateLeeches();
  122. deactivateTurmoil();
  123. prayDrop();
  124. c.updateRequired = true;
  125. c.setAppearanceUpdateRequired(true);
  126. break;
  127.  
  128. }
  129. }
  130. public void turmBonus() {
  131. if (c.curseActive[19] == false) {
  132. c.curseDefence = 0;
  133. c.curseStrength = 0;
  134. c.curseAttack = 0;
  135. deactive = false;
  136. }else if (c.inCombat == true && deactive == false) {
  137. c.curseDefence = 30;
  138. c.curseStrength = 33;
  139. c.curseAttack = 30;
  140. } else if (c.inCombat == false && deactive == false) {
  141. c.curseDefence = 15;
  142. c.curseStrength = 23;
  143. c.curseAttack = 15;
  144. }
  145. c.updateRequired = true;
  146. c.setAppearanceUpdateRequired(true);
  147. }
  148. public void deactivateTurmoil() {
  149. if(c.curseActive[19]) {
  150. deactive = true;
  151. turmBonus();
  152. }
  153. }
  154.  
  155. public void resetCurse() {
  156. for(int p = 0; p < c.curseActive.length; p++) {
  157. c.curseActive[p] = false;
  158. c.getPA().sendFrame36(Player.CURSE_GLOW[p], 0);
  159. }
  160. c.headIcon = -1;
  161. c.getPA().requestUpdates();
  162. }
  163.  
  164. public void strCurse(int i) {
  165. for (int j = 0; j < str.length; j++) {
  166. if (str[j] != i) {
  167. c.curseActive[str[j]] = false;
  168. c.getPA().sendFrame36(Player.CURSE_GLOW[str[j]], 0);
  169. }
  170. }
  171. }
  172. public void atkCurse(int i) {
  173. for (int j = 0; j < atk.length; j++) {
  174. if (atk[j] != i) {
  175. c.curseActive[atk[j]] = false;
  176. c.getPA().sendFrame36(Player.CURSE_GLOW[atk[j]], 0);
  177. }
  178. }
  179. }
  180. public void defCurse(int i) {
  181. for (int j = 0; j < def.length; j++) {
  182. if (def[j] != i) {
  183. c.curseActive[def[j]] = false;
  184. c.getPA().sendFrame36(Player.CURSE_GLOW[def[j]], 0);
  185. }
  186. }
  187. }
  188. public void rngCurse(int i) {
  189. for (int j = 0; j < rng.length; j++) {
  190. if (rng[j] != i) {
  191. c.curseActive[rng[j]] = false;
  192. c.getPA().sendFrame36(Player.CURSE_GLOW[rng[j]], 0);
  193. }
  194. }
  195. }
  196. public void mgeCurse(int i) {
  197. for (int j = 0; j < mge.length; j++) {
  198. if (mge[j] != i) {
  199. c.curseActive[mge[j]] = false;
  200. c.getPA().sendFrame36(Player.CURSE_GLOW[mge[j]], 0);
  201. }
  202. }
  203. }
  204. public void sprtCurse(int i) {
  205. for (int j = 0; j < sprt.length; j++) {
  206. if (sprt[j] != i) {
  207. c.curseActive[sprt[j]] = false;
  208. c.getPA().sendFrame36(Player.CURSE_GLOW[sprt[j]], 0);
  209. }
  210. }
  211. }
  212.  
  213. public int[] def = {13, 19};
  214. public int[] str = {14, 19};
  215. public int[] atk = {1, 10, 19};
  216. public int[] rng = {2, 11, 19};
  217. public int[] mge = {3, 12, 19};
  218. public int[] sprt = {4, 16};//spirit
  219.  
  220. public void activateCurse(int i) {
  221. if(c.duelRule[7]) {
  222. resetCurse();
  223. c.sendMessage("Prayer has been disabled in this duel!");
  224. return;
  225. }
  226. if (c.playerLevel[1] < 30) {
  227. c.getPA().sendFrame36(Player.CURSE_GLOW[i], 0);
  228. c.sendMessage("You need a defence level of 30 to use this prayer!");
  229. return;
  230. }
  231. //0 = pItem//1 = sapWar//2 = sapRng//3 = sapMge//4 = sapSprt
  232. //5 = berserk//6 = defSum//7 = defMge//8 = defRng//9 = defMel
  233. //10 = leechAtk//11 = leechRng//12 = leechMge//13 = leechDef//14 = leechStr
  234. //15 = leechEnrgy//16 = leechSpec//17 = wrath//18 = soul//19 = turmoil
  235.  
  236. if(c.playerLevel[5] > 0 || !Config.PRAYER_POINTS_REQUIRED) {
  237. if(c.getPA().getLevelForXP(c.playerXP[5]) >= Player.CURSE_LEVEL_REQUIRED[i] || !Config.PRAYER_LEVEL_REQUIRED) {
  238. boolean headIcon = false;
  239. switch(i) {
  240. case 0://pItem
  241. if(c.prayerActive[10] == false) {
  242. c.startAnimation(12567);
  243. c.gfx0(2213);
  244. c.prayerActive[10] = true;
  245. c.lastProtItem = System.currentTimeMillis();
  246. } else {
  247. c.prayerActive[10] = false;
  248. }
  249. break;
  250.  
  251. //case 1:
  252. case 10:
  253. if (c.curseActive[i] == false) {
  254. atkCurse(i); //
  255. }
  256. break;
  257.  
  258. case 2:
  259. case 11:
  260. if (c.curseActive[i] == false) {
  261. rngCurse(i); //
  262. }
  263. break;
  264.  
  265. case 3:
  266. case 12:
  267. if (c.curseActive[i] == false) {
  268. mgeCurse(i); //
  269. }
  270. break;
  271.  
  272. case 4:
  273. case 16:
  274. if (c.curseActive[i] == false) {
  275. sprtCurse(i); //
  276. }
  277. break;
  278.  
  279. case 13:
  280. if (c.curseActive[i] == false) {
  281. defCurse(i); //
  282. }
  283. break;
  284. case 14:
  285. if (c.curseActive[i] == false) {
  286. strCurse(i); //
  287. }
  288. break;
  289.  
  290. case 6:
  291. case 7:
  292. case 8:
  293. case 9:
  294. if(System.currentTimeMillis() - c.stopPrayerDelay < 5000) {
  295. c.sendMessage("You have been injured and cannot use this prayer!");
  296. c.getPA().sendFrame36(Player.CURSE_GLOW[7], 0);
  297. c.getPA().sendFrame36(Player.CURSE_GLOW[8], 0);
  298. c.getPA().sendFrame36(Player.CURSE_GLOW[9], 0);
  299. return;
  300. }
  301. if (i == 7)
  302. c.protMageDelay = System.currentTimeMillis();
  303. else if (i == 8)
  304. c.protRangeDelay = System.currentTimeMillis();
  305. else if (i == 9)
  306. c.protMeleeDelay = System.currentTimeMillis();
  307. case 17:
  308. case 18:
  309. headIcon = true;
  310. for(int p = 6; p < 19; p++) {
  311. if(i != p && p != 10 && p != 11 && p != 12 && p != 13 && p != 14 && p != 15 && p != 16) {
  312. c.prayerActive[p] = false;
  313. c.getPA().sendFrame36(Player.CURSE_GLOW[p], 0);
  314. }
  315. }
  316. break;
  317.  
  318. case 19://Turmoil - DONE
  319. if (c.curseActive[i] == false) {
  320. c.startAnimation(12565);
  321. c.gfx0(2226);
  322. strCurse(i);
  323. atkCurse(i);
  324. defCurse(i);
  325. mgeCurse(i);
  326. rngCurse(i);
  327. }
  328. break;
  329. }
  330. if(!headIcon) {
  331. if(c.curseActive[i] == false) {
  332. c.curseActive[i] = true;
  333. c.getPA().sendFrame36(Player.CURSE_GLOW[i], 1);
  334. } else {
  335. c.curseActive[i] = false;
  336. c.getPA().sendFrame36(Player.CURSE_GLOW[i], 0);
  337. }
  338. } else {
  339. if(c.curseActive[i] == false) {
  340. c.curseActive[i] = true;
  341. c.getPA().sendFrame36(Player.CURSE_GLOW[i], 1);
  342. c.headIcon = Player.CURSE_HEAD_ICONS[i];
  343. c.getPA().requestUpdates();
  344. } else {
  345. c.curseActive[i] = false;
  346. c.getPA().sendFrame36(Player.CURSE_GLOW[i], 0);
  347. c.headIcon = -1;
  348. c.getPA().requestUpdates();
  349. }
  350. }
  351. } else {
  352. c.getPA().sendFrame36(Player.CURSE_GLOW[i],0);
  353. c.getPA().sendFrame126("You need a @blu@Prayer level of "+Player.CURSE_LEVEL_REQUIRED[i]+" to use "+Player.CURSE_NAME[i]+".", 357);
  354. c.getPA().sendFrame126("Click here to continue", 358);
  355. c.getPA().sendFrame164(356);
  356. }
  357. } else {
  358. c.getPA().sendFrame36(Player.CURSE_GLOW[i],0);
  359. c.sendMessage("You have run out of prayer points!");
  360. }
  361. }
  362.  
  363. }
Advertisement
Add Comment
Please, Sign In to add comment