Guest User

agility.java

a guest
Apr 29th, 2014
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.79 KB | None | 0 0
  1. package com.exile.game.players.content.skills.agility;
  2.  
  3. import com.exile.event.CycleEvent;
  4. import com.exile.event.CycleEventContainer;
  5. import com.exile.event.CycleEventHandler;
  6. import com.exile.game.players.Player;
  7. import com.exile.handlers.SkillHandler;
  8.  
  9. public class Agility {
  10.  
  11. /**
  12. ** @author Ochroid | Scott
  13. **/
  14.  
  15. public void obsticle(final Player p, int Emote, int Req, int newX, int newY,
  16. final int agilityTimer, int amtEXP, String message) {
  17. if (p.getVariables().playerLevel[16] >= Req) {
  18. p.getVariables().agilityEmote = true;
  19. p.walk(newX, newY, Emote);
  20. p.getPA().addSkillXP(amtEXP, p.getVariables().playerAgility);
  21. System.out.println("Agy...");
  22. CycleEventHandler.getSingleton().addEvent(new CycleEvent() {
  23. public void execute(CycleEventContainer c) {
  24. p.stopEmote();
  25. stop();
  26. }
  27.  
  28. @Override
  29. public void stop() {
  30.  
  31. }
  32. }, agilityTimer);
  33. } else {
  34. p.sendMessage("You Need " + Req + " Agility To Do This Obstacle");
  35. }
  36. }
  37.  
  38. public static void agilityDelay(final Player p, int Emote, final int X, final int Y,
  39. final int H, int Req, int amtEXP, String message) {
  40. if (p.getVariables().playerLevel[16] >= Req) {
  41. p.startAnimation(Emote);
  42. p.getVariables().agilityEmote = true;
  43. p.getPA().addSkillXP(amtEXP, p.getVariables().playerAgility);
  44. CycleEventHandler.getSingleton().addEvent(new CycleEvent() {
  45. public void execute(CycleEventContainer c) {
  46. p.getPA().movePlayer(X, Y, H);
  47. p.getVariables().agilityEmote = false;
  48. stop();
  49. }
  50.  
  51. @Override
  52. public void stop() {
  53.  
  54. }
  55. }, 1);
  56. } else {
  57. p.sendMessage("You Need " + Req + " Agility To Do This Obstacle");
  58. }
  59. }
  60.  
  61. private static void agilityWalk(final Player c, final int walkAnimation,
  62. final int x, final int y) {
  63. c.getVariables().isRunning2 = false;
  64. c.getPA().sendFrame36(173, 0);
  65. c.getVariables().playerWalkIndex = walkAnimation;
  66. c.getPA().requestUpdates();
  67. c.getPA().walkTo(x, y);
  68. c.sendMessage("lewl agy");
  69. }
  70.  
  71. private static void resetAgilityWalk(final Player c) {
  72. c.getVariables().isRunning2 = true;
  73. c.getPA().sendFrame36(173, 1);
  74. c.getVariables().playerWalkIndex = 0x333;
  75. c.getPA().requestUpdates();
  76. c.getVariables().doingAgility = false;
  77. }
  78.  
  79. private static final int[] agilityObject = { 2295, 2285, 2286, 2313, 2312,
  80. 2314, 2315, 154, 4058, 2282, 2284, 2294, 2302, 3205, 1948 };
  81.  
  82. public static void swing(final Player c) {
  83. if (c.stopPlayerPacket) {
  84. return;
  85. }
  86. c.stopPlayerPacket = true;
  87.  
  88. if (c.absY != 3953) {
  89. c.getPA().walkTo(c.absX - 3953, 0);
  90. }
  91.  
  92. c.turnPlayerTo(3005, 3958);
  93. c.startAnimation(751);
  94.  
  95. CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() {
  96. @Override
  97. public void execute(CycleEventContainer container) {
  98. c.getPA().walkTo(0, 1);
  99. container.stop();
  100. }
  101.  
  102. @Override
  103. public void stop() {
  104. c.getVariables().barbObstacle = 1;
  105. c.getPA().addSkillXP(450, c.getVariables().playerAgility);
  106. }
  107. }, 2);
  108. CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() {
  109. @Override
  110. public void execute(CycleEventContainer container) {
  111. c.teleportToX = 2551;// end
  112. c.teleportToY = 3549;
  113. container.stop();
  114. }
  115.  
  116. @Override
  117. public void stop() {
  118. resetAgilityWalk(c);
  119. c.stopPlayerPacket = false;
  120. }
  121. }, 3);
  122. }
  123.  
  124. public static boolean agilityObstacle(final Player c, final int objectType) {
  125. for (int i = 0; i < agilityObject.length; i++) {
  126. if (objectType == agilityObject[i]) {
  127. return true;
  128. }
  129. }
  130. return false;
  131. }
  132.  
  133. public static void agilityCourse(final Player c, final int objectType) {
  134. if (c.getVariables().doingAgility) {
  135. return;
  136. }
  137. switch (objectType) {
  138. /**
  139. * Barbarian Course
  140. */
  141.  
  142. case 1948: //crumbling wall
  143. if (c.getVariables().objectX == 2536 && c.absX < 2537) {
  144. if (c.getVariables().barbObstacle == 5 && c.getVariables().playerLevel[16] >= 30) {
  145. c.getPA().movePlayer(2537, 3553, 0);
  146. c.getPA().addSkillXP(175, c.getVariables().playerAgility);
  147. c.getVariables().barbObstacle = 6;
  148. } else if (c.getVariables().playerLevel[16] >= 30) {
  149. c.getPA().movePlayer(2537, 3553, 0);
  150. c.getPA().addSkillXP(175, c.getVariables().playerAgility);
  151. } else {
  152. c.sendMessage("You need 30 Agility to attempt this obstacle");
  153. }
  154. } else if (c.getVariables().objectX == 2539 && c.absX < 2540) {
  155. if (c.getVariables().barbObstacle == 6 && c.getVariables().playerLevel[16] >= 30) {
  156. c.getPA().movePlayer(2540, 3553, 0);
  157. c.getPA().addSkillXP(175, c.getVariables().playerAgility);
  158. c.getVariables().barbObstacle = 7;
  159. } else if (c.getVariables().playerLevel[16] >= 30) {
  160. c.getPA().movePlayer(2540, 3553, 0);
  161. c.getPA().addSkillXP(175, c.getVariables().playerAgility);
  162. } else {
  163. c.sendMessage("You need 30 Agility to attempt this obstacle");
  164. }
  165. } else if (c.getVariables().objectX == 2542 && c.absX < 2543) {
  166. if (c.getVariables().barbObstacle == 7 && c.getVariables().playerLevel[16] >= 30) {
  167. c.getPA().movePlayer(2543, 3553, 0);
  168. c.getPA().addSkillXP(175, c.getVariables().playerAgility);
  169. c.getPA().addSkillXP(10000, c.getVariables().playerAgility);
  170. c.getVariables().barbObstacle = 0;
  171. return;
  172. } else if (c.getVariables().playerLevel[16] >= 30) {
  173. c.getPA().movePlayer(2543, 3553, 0);
  174. c.getPA().addSkillXP(175, c.getVariables().playerAgility);
  175. } else {
  176. c.sendMessage("You need 30 Agility to attempt this obstacle");
  177. }
  178. }
  179. break;
  180.  
  181. // Log Balance
  182. case 2294:
  183. if (c.absY != 3546 && c.absX != 2551) {
  184. c.getPA().movePlayer(2551, 3546, 0);
  185. c.absY = 3546;
  186. return;
  187. }
  188. c.getVariables().doingAgility = true;
  189. agilityWalk(c, 762, -10, 0);
  190. CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() {
  191. int cycle = 0;
  192. @Override
  193. public void execute(CycleEventContainer container) {
  194. if(c.absX == 2551 && cycle == 2) {
  195. container.stop();
  196. }
  197. if (c.absY != 3546) {
  198. c.getPA().movePlayer(2551, 3546, 0);
  199. }
  200. if (c.absX == 2541 && c.absY == 3546) {
  201. container.stop();
  202. }
  203. cycle++;
  204. }
  205.  
  206. @Override
  207. public void stop() {
  208. resetAgilityWalk(c);
  209. c.getPA().addSkillXP((int) 47 * SkillHandler.XPRates.AGILITY.getXPRate(),
  210. c.getVariables().playerAgility);
  211. if(c.getVariables().barbObstacle == 1) {
  212. c.getVariables().barbObstacle = 2;
  213. }
  214. c.getVariables().doingAgility = false;
  215. }
  216. }, 1);
  217. break;
  218.  
  219. // Net
  220. case 2284: // Barbarian Obstacle net
  221. agilityDelay(c, 828, 2537, 3546, 1, 40, 275,
  222. "You climbed the nets succesfully.");
  223. resetAgilityWalk(c);
  224. c.getVariables().doingAgility = false;
  225. if(c.getVariables().barbObstacle == 2) {
  226. c.getVariables().barbObstacle = 3;
  227. }
  228. break;
  229.  
  230. //Log Climb Thing XD
  231. case 2302:
  232. if (c.absY != 3547 && c.absX != 2536) {
  233. c.getPA().movePlayer(2536, 3547, 1);
  234. c.absY = 3547;
  235. return;
  236. }
  237. c.getVariables().doingAgility = true;
  238. agilityWalk(c, 756, -4, 0);
  239. CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() {
  240. int cycle = 0;
  241. @Override
  242. public void execute(CycleEventContainer container) {
  243. if(c.absX == 2536 && cycle == 2) {
  244. container.stop();
  245. return;
  246. }
  247. if (c.absY != 3547) {
  248. c.getPA().movePlayer(2536, 3547, 1);
  249. }
  250. if (c.absX == 2532 && c.absY == 3547) {
  251. container.stop();
  252. }
  253. cycle++;
  254. }
  255.  
  256. @Override
  257. public void stop() {
  258. resetAgilityWalk(c);
  259. c.getPA().addSkillXP((int) 48 * SkillHandler.XPRates.AGILITY.getXPRate(),
  260. c.getVariables().playerAgility);
  261. c.getVariables().doingAgility = false;
  262. if(c.getVariables().barbObstacle == 3) {
  263. c.getVariables().barbObstacle = 4;
  264. }
  265. }
  266. }, 1);
  267. break;
  268.  
  269. case 3205: // Ladder
  270. agilityDelay(c, 827, 2532, 3546, 0, 40, 180, "You climb down.");
  271. if(c.getVariables().barbObstacle == 4) {
  272. c.getVariables().barbObstacle = 5;
  273. }
  274. break;
  275.  
  276. /**
  277. * Gnome Course
  278. */
  279. case 2282:
  280. c.getVariables().objectDistance = 5;
  281. if (c.absY < 3554) {
  282. return;
  283. }
  284. if (c.absX != 2551) {
  285. c.getPA().movePlayer(2551, 3554, 0);
  286. return;
  287. }
  288. swing(c);
  289. break;
  290. case 2295:
  291. if (c.absX != 2474) {
  292. c.getPA().movePlayer(2474, 3436, 0);
  293. return;
  294. }
  295. c.getVariables().doingAgility = true;
  296. agilityWalk(c, 762, 0, -7);
  297. CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() {
  298. int cycle = 0;
  299. @Override
  300. public void execute(CycleEventContainer container) {
  301. if(c.absY == 3436 && cycle == 2) {
  302. container.stop();
  303. return;
  304. }
  305. if (c.absX != 2474) {
  306. c.getPA().movePlayer(2474, 3436, 0);
  307. }
  308. if (c.absX == 2474 && c.absY == 3429) {
  309. container.stop();
  310. }
  311. cycle++;
  312. }
  313.  
  314. @Override
  315. public void stop() {
  316. resetAgilityWalk(c);
  317. c.getPA().addSkillXP((int) 11 * SkillHandler.XPRates.AGILITY.getXPRate(),
  318. c.getVariables().playerAgility);
  319. c.getVariables().logBalance = true;
  320. c.getVariables().doingAgility = false;
  321. }
  322. }, 1);
  323. break;
  324. case 2285:
  325. c.startAnimation(828);
  326. c.getPA().movePlayer(c.absX, 3424, 1);
  327. c.getPA().addSkillXP((int) 13 * SkillHandler.XPRates.AGILITY.getXPRate(),
  328. c.getVariables().playerAgility);
  329. c.getVariables().obstacleNetUp = true;
  330. break;
  331. case 2313:
  332. c.startAnimation(828);
  333. c.getPA().movePlayer(2473, 3420, 2);
  334. c.getPA().addSkillXP((int) 12 * SkillHandler.XPRates.AGILITY.getXPRate(),
  335. c.getVariables().playerAgility);
  336. c.getVariables().treeBranchUp = true;
  337. break;
  338. case 2312:
  339. c.getVariables().doingAgility = true;
  340. if (c.absX != 2477 || c.absY != 3420) {
  341. c.getPA().movePlayer(2477, 3420, 2);
  342. return;
  343. }
  344. agilityWalk(c, 762, 6, 0);
  345. CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() {
  346. int cycle = 0;
  347. @Override
  348. public void execute(CycleEventContainer container) {
  349. if(c.absX == 2477 && cycle == 2) {
  350. container.stop();
  351. return;
  352. }
  353. if (c.absY != 3420) {
  354. c.getPA().movePlayer(2477, 3420, 2);
  355. }
  356. if (c.absX == 2483 && c.absY == 3420) {
  357. container.stop();
  358. return;
  359. }
  360. cycle++;
  361. }
  362.  
  363. @Override
  364. public void stop() {
  365. resetAgilityWalk(c);
  366. c.getPA().addSkillXP((int) 12 * SkillHandler.XPRates.AGILITY.getXPRate(),
  367. c.getVariables().playerAgility);
  368. c.getVariables().balanceRope = true;
  369. c.getVariables().doingAgility = false;
  370. }
  371. }, 1);
  372. break;
  373. case 2314:
  374. case 2315:
  375. c.startAnimation(828);
  376. c.getPA().movePlayer(c.absX, c.absY, 0);
  377. c.getPA().addSkillXP((int) 11 * SkillHandler.XPRates.AGILITY.getXPRate(),
  378. c.getVariables().playerAgility);
  379. c.getVariables().treeBranchDown = true;
  380. break;
  381. case 2286:
  382. if (c.absY > 3426) {
  383. return;
  384. }
  385. c.getVariables().doingAgility = true;
  386. c.startAnimation(828);
  387. CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() {
  388. @Override
  389. public void execute(CycleEventContainer container) {
  390. c.getPA().movePlayer(c.absX, 3427, 0);
  391. container.stop();
  392. }
  393.  
  394. @Override
  395. public void stop() {
  396. c.turnPlayerTo(c.absX, 3426);
  397. c.getPA().addSkillXP((int) 13 * SkillHandler.XPRates.AGILITY.getXPRate(),
  398. c.getVariables().playerAgility);
  399. c.getVariables().obstacleNetOver = true;
  400. c.getVariables().doingAgility = false;
  401. }
  402. }, 1);
  403. break;
  404. case 154:
  405. if (c.absY > 3432) {
  406. return;
  407. }
  408. c.getVariables().doingAgility = true;
  409. if (c.absX != 2484 && c.absY != 3430) {
  410. c.getPA().movePlayer(2484, 3430, 0);
  411. return;
  412. }
  413. c.startAnimation(749);
  414. agilityWalk(c, 844, 0, 7);
  415. CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() {
  416. int cycle = 0;
  417. @Override
  418. public void execute(CycleEventContainer container) {
  419. if(c.absY == 3430 && cycle == 2) {
  420. container.stop();
  421. return;
  422. }
  423. if (c.absY == 3437) {
  424. container.stop();
  425. }
  426. cycle++;
  427. }
  428.  
  429. @Override
  430. public void stop() {
  431. c.startAnimation(748);
  432. resetAgilityWalk(c);
  433. if(c.absY != 3430) {
  434. c.getVariables().logBalance = false;
  435. c.getVariables().obstacleNetUp = false;
  436. c.getVariables().treeBranchUp = false;
  437. c.getVariables().balanceRope = false;
  438. c.getVariables().treeBranchDown = false;
  439. c.getVariables().obstacleNetOver = false;
  440. c.getVariables().doingAgility = false;
  441. if (c.getVariables().logBalance && c.getVariables().obstacleNetUp && c.getVariables().treeBranchUp
  442. && c.getVariables().balanceRope && c.getVariables().treeBranchDown
  443. && c.getVariables().obstacleNetOver) {
  444. c.getPA().addSkillXP(
  445. (int) 50 * SkillHandler.XPRates.AGILITY.getXPRate(),
  446. c.getVariables().playerAgility);
  447. c.sendMessage("You have completed the full gnome agility course.");
  448. return;
  449. } else {
  450. c.getPA().addSkillXP(
  451. (int) 22 * SkillHandler.XPRates.AGILITY.getXPRate(),
  452. c.getVariables().playerAgility);
  453. }
  454. }
  455. }
  456. }, 1);
  457. break;
  458. case 4058:
  459. if (c.absY > 3432) {
  460. return;
  461. }
  462. if (c.absX != 2487 && c.absY != 3430) {
  463. c.getPA().movePlayer(2487, 3430, 0);
  464. return;
  465. }
  466. c.startAnimation(749);
  467. agilityWalk(c, 844, 0, 7);
  468. CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() {
  469. int cycle = 0;
  470. @Override
  471. public void execute(CycleEventContainer container) {
  472. if(c.absY == 3430 && cycle == 2) {
  473. container.stop();
  474. return;
  475. }
  476. if (c.absY == 3437) {
  477. container.stop();
  478. }
  479. cycle++;
  480. }
  481.  
  482. @Override
  483. public void stop() {
  484. c.startAnimation(748);
  485. resetAgilityWalk(c);
  486. if(c.absY != 3430) {
  487. c.getVariables().logBalance = false;
  488. c.getVariables().obstacleNetUp = false;
  489. c.getVariables().treeBranchUp = false;
  490. c.getVariables().balanceRope = false;
  491. c.getVariables().treeBranchDown = false;
  492. c.getVariables().obstacleNetOver = false;
  493. if (c.getVariables().logBalance && c.getVariables().obstacleNetUp && c.getVariables().treeBranchUp
  494. && c.getVariables().balanceRope && c.getVariables().treeBranchDown
  495. && c.getVariables().obstacleNetOver) {
  496. c.getPA().addSkillXP(
  497. (int) 37 * SkillHandler.XPRates.AGILITY.getXPRate(),
  498. c.getVariables().playerAgility);
  499. c.sendMessage("You have completed the full gnome agility course.");
  500. return;
  501. } else {
  502. c.getPA().addSkillXP(
  503. (int) 22 * SkillHandler.XPRates.AGILITY.getXPRate(),
  504. c.getVariables().playerAgility);
  505. }
  506. }
  507. }
  508. }, 1);
  509. break;
  510. }
  511. }
  512. }
Advertisement
Add Comment
Please, Sign In to add comment