Guest User

Untitled

a guest
Jan 23rd, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.73 KB | None | 0 0
  1.  
  2. eat();
  3.  
  4. startRunning(runEnergy);
  5.  
  6. switch(getState()) {
  7. case rope:
  8. doRope();
  9. return 50;
  10. case log:
  11. doLog();
  12. return 50;
  13. case net:
  14. doNet();
  15. return 50;
  16. case ledge:
  17. doLedge();
  18. return 50;
  19. case ladder:
  20. doLadder();
  21. return 50;
  22. case wall:
  23. doWall();
  24. return 50;
  25. case error:
  26. return -1;
  27. }
  28.  
  29. return 50;
  30. }
  31.  
  32.  
  33. //*******************************************************//
  34. // OTHER METHODS
  35. //*******************************************************//
  36. public void antiban() {
  37. antibanca = random(0,5);
  38. if (antibanca == 1) {
  39. int angle = camera.getAngle() + random(-90, 90);
  40. if (angle < 0) {
  41. angle = random(0, 10);
  42. }
  43. if (angle > 359) {
  44. angle = random(0, 10);
  45. }
  46. camera.setAngle(angle);
  47. return;
  48. }
  49. if (antibanca == 2) {
  50. status = "AntiBan(2)";
  51. camera.setCompass('n');
  52. sleep(200,300);
  53. return;
  54. }
  55. if (antibanca == 3) {
  56. status = "AntiBan(3)";
  57. camera.setCompass('s');
  58. sleep(200,400);
  59. return;
  60. }
  61. if (antibanca == 4) {
  62. status = "AntiBan(4)";
  63. mouse.move(random(50, 700), random(50, 450), 2, 2);
  64. sleep(200,300);
  65. return;
  66. }
  67. if (antibanca == 5) {
  68. status = "AntiBan(5)";
  69. mouse.moveSlightly();
  70. sleep(50,100);
  71. return;
  72. }
  73. }
  74. private void doRope() {
  75. status = "Swinging on rope...";
  76. final RSTile rope = new RSTile(2551 + random(0, 2), 3553);
  77. final RSTile ladder = new RSTile(2547, 9951);
  78. final RSTile walkHere = new RSTile(2551, 3554);
  79. if (playerInArea(2555, 9955, 2546, 9948)) {
  80. if (camera.getAngle() < 75 || camera.getAngle() > 110) {
  81. camera.setAngle(random(75, 110));
  82. sleep(random(100, 200));
  83. return;
  84. }
  85. if (onTile(ladder, "Ladder", "Climb-up", 0.4, 0.5, 40))
  86. log.info("Fell off of the rope.");
  87. sleep(random(3000, 3500));
  88. return;
  89. }
  90. if (!playerInArea(2554, 3555, 2549, 3554)) {
  91. walkTile(walkHere);
  92. sleep(random(50, 1500));
  93. camera.setAngle(random(200, 500));
  94. sleep(random(100, 200));
  95. return;
  96. }
  97. antiban();
  98. if (onTile(rope, "Ropeswing", "Swing-on", 0.5, 0, 450))
  99. sleep(random(500, 1000));
  100. mouse.move(random(50, 700), random(50, 450), 2, 2);
  101. sleep(random(1600, 1800));
  102. while(players.getMyPlayer().getAnimation() == 751 || players.getMyPlayer().isMoving())
  103. sleep(100);
  104. return;
  105. }
  106.  
  107. private void doLog() {
  108. status = "Crossing log...";
  109. final RSTile log = new RSTile(2550, 3546);
  110. if (onTile(log, "Log balance", "Walk-across", 0.5, 0.4, 0))
  111. sleep(random(100, 200));
  112. camera.setAngle(random(1, 360));
  113. sleep(random(100, 300));
  114. mouse.move(random(50, 700), random(50, 450), 2, 2);
  115. sleep(random(200, 700));
  116. mouse.move(random(50, 700), random(50, 450), 2, 2);
  117. sleep(random(1300, 1600));
  118. while(players.getMyPlayer().isMoving() || playerInArea(2550, 3546, 2542, 3546))
  119. sleep(100);
  120. return;
  121. }
  122.  
  123. private void doNet() {
  124. status = "Climbing up net...";
  125. final RSTile net = new RSTile(2538, 3546);
  126. final RSTile walkHere = new RSTile(2539, 3545);
  127. if (game.getPlane() == 0 && calc.distanceTo(new RSTile(2535, 3546)) <= 3) {
  128. camera.setCompass('w');
  129. walkTile(walkHere);
  130. sleep(random(500, 750));
  131. while(players.getMyPlayer().isMoving())
  132. sleep(100);
  133. return;
  134. }
  135. if (onTile(net, "Obstacle net", "Climb-over", random(0.51, 0.61), 0, 200))
  136. sleep(random(2000, 2700));
  137. antiban();
  138. while(players.getMyPlayer().getAnimation() == 828 || players.getMyPlayer().isMoving())
  139. sleep(100);
  140. return;}
  141.  
  142. private void doLedge() {
  143. status = "Walking on ledge...";
  144. final RSTile ledge = new RSTile(2535, 3547);
  145. if (onTile(ledge, "Balancing ledge", "Walk-across", 0.5, 0.75, 0))
  146. sleep(random(200, 700));
  147. mouse.move(random(50, 700), random(50, 450), 2, 2);
  148. sleep(random(1400, 2000));
  149. while(players.getMyPlayer().isMoving() || (playerInArea(2535, 3547, 2532, 3547) && game.getPlane() == 1))
  150. sleep(100);
  151. return;
  152. }
  153.  
  154. private void doLadder() {
  155. status = "Climbing ladder...";
  156. final RSTile ladder = new RSTile(2532, 3545);
  157. if (onTile(ladder, "Ladder", "Climb-down", 0.5, 0.6, 0))
  158. sleep(random(50, 200));
  159. camera.setAngle(random(1, 50));
  160. mouse.move(random(50, 700), random(50, 450), 2, 2);
  161. sleep(random(1000, 1400));
  162. while(players.getMyPlayer().isMoving() || players.getMyPlayer().getAnimation() == 827)
  163. sleep(100);
  164. return;
  165. }
  166.  
  167. private void doWall() {
  168. status = "Climbing over wall...";
  169. if (players.getMyPlayer().isMoving())
  170. return;
  171. final RSTile wall1 = new RSTile(2537, 3553);
  172. final RSTile wall2 = new RSTile(2542, 3553);
  173. final RSTile walkHere = new RSTile(2536, 3553);
  174. if (!calc.tileOnScreen(wall1)) {
  175. camera.setCompass('e');
  176. //walkTile(walkHere);
  177. sleep(random(200, 300));
  178. return;
  179. }
  180. if (playerInArea(2542, 3554, 2538, 3553)) {
  181. if (onTile(wall2, "Crumbling wall", "Climb-over", 0.9, 0.5, 5))
  182. sleep(random(500, 1500));
  183. while(players.getMyPlayer().isMoving() || players.getMyPlayer().getAnimation() == 4853)
  184. sleep(100);
  185. return;
  186. }
  187. if (onTile(wall1, "Crumbling wall", "Climb-over", 0.9, 0.5, 5))
  188. sleep(random(200, 600));
  189. mouse.move(random(50, 700), random(50, 450), 2, 2);
  190. sleep(random(1000, 1100));
  191. while(players.getMyPlayer().isMoving() || players.getMyPlayer().getAnimation() == 4853)
  192. sleep(100);
  193. return;
  194. }
  195.  
  196. private void startRunning(final int energy) {
  197. if (walking.getEnergy() >= energy && !walking.isRunEnabled()) {
  198. runEnergy = random(40, 95);
  199. walking.setRun(true);
  200. sleep(random(500, 750));
  201. }
  202. }
  203.  
  204. private boolean playerInArea(int maxX, int maxY, int minX, int minY) {
  205. int x = players.getMyPlayer().getLocation().getX();
  206. int y = players.getMyPlayer().getLocation().getY();
  207. if (x >= minX && x <= maxX && y >= minY && y <= maxY)
  208. {
  209. return true;
  210. }
  211. return false;
  212. }
  213.  
  214. public boolean eat() {
  215. status = "Eating...";
  216. int getHP = combat.getLifePoints();
  217. int RealHP = skills.getRealLevel(3) * 10;
  218. if (inventory.containsOneOf(food)) {
  219. if (getHP <= random(RealHP / 2.0, RealHP / 2.5)) {
  220. inventory.getItem(food).doAction("Eat");
  221. sleep(500, 1000);
  222. }
  223. }
  224. return false;
  225. }
  226.  
  227. public boolean onTile(RSTile tile, String search, String action, double dx, double dy, int height) {
  228. if (!tile.isValid()) {
  229. return false;
  230. }
  231.  
  232. Point checkScreen = null;
  233. checkScreen = calc.tileToScreen(tile, dx, dy, height);
  234. if (!calc.pointOnScreen(checkScreen)) {
  235. walkTile(tile);
  236. sleep(random(340, 1310));
  237. }
  238.  
  239. try {
  240. Point screenLoc = null;
  241. for (int i = 0; i < 30; i++) {
  242. screenLoc = calc.tileToScreen(tile, dx, dy, height);
  243. if (!calc.pointOnScreen(screenLoc)) {
  244. return false;
  245. }
  246. if(menu.getItems().toString().toLowerCase().contains(search.toLowerCase())) {
  247. break;
  248. }
  249. if (mouse.getLocation().equals(screenLoc)) {
  250. break;
  251. }
  252. mouse.move(screenLoc);
  253. }
  254. screenLoc = calc.tileToScreen(tile, height);
  255. if (menu.getItems().length <= 1) {
  256. return false;
  257. }
  258. sleep(random(100, 200));
  259. if (menu.getItems().toString().toLowerCase().contains(action.toLowerCase())) {
  260. mouse.click(true);
  261. return true;
  262. } else {
  263. return menu.doAction(action);
  264. }
  265. } catch (Exception e) {
  266. e.printStackTrace();
  267. return false;
  268. }
  269. }
  270.  
  271. private void walkTile(final RSTile tile) {
  272. if (!(calc.distanceTo(walking.getDestination()) <= random(4, 7))) {
  273. if (players.getMyPlayer().isMoving())
  274. return;
  275. }
  276. Point screen = calc.tileToScreen(tile);
  277. if (calc.pointOnScreen(screen)) {
  278. if (players.getMyPlayer().isMoving())
  279. return;
  280. mouse.move(screen, random(-3, 4), random(-3, 4));
  281. walking.walkTileOnScreen(tile);
  282. sleep(random(500, 750));
  283. return;
  284. } else {
  285. walking.walkTileMM(tile);
  286. sleep(random(500, 750));
  287. return;
  288. }
  289. }
  290.  
  291.  
  292. //*******************************************************//
  293. // ON FINISH
  294. //*******************************************************//
  295. public void onFinish() {
  296. }
  297.  
  298. //*******************************************************//
  299. // PAINT SCREEN
  300. //*******************************************************//
  301. public void drawMouse(final Graphics g) {
  302. if (normal != null) {
  303. final double mouseX = mouse.getLocation().getX() - 8,
  304. mouseY = mouse.getLocation().getY() - 8;
  305. final double mousePressX = mouse.getPressLocation().getX() - 8,
  306. mousePressY = mouse.getPressLocation().getY() - 8;
  307. if (System.currentTimeMillis() - mouse.getPressTime() < 400) {
  308. g.drawImage(clicked, (int) mousePressX, (int) mousePressY, null);
  309. }
  310. g.drawImage(normal, (int) mouseX, (int) mouseY, null);
  311. }
  312. }
  313.  
  314. public void drawStringShadow(final String text, final int x, final int y, final Graphics g) {
  315. g.setColor(Color.BLACK);
  316. g.drawString(text, x + 1, y + 1);
  317. g.setColor(Color.WHITE);
  318. g.drawString(text, x, y);
  319. }
  320.  
  321. public void onRepaint(Graphics g) {
  322. long runTime = 0;
  323. long seconds = 0;
  324. long minutes = 0;
  325. long hours = 0;
  326. int laps = 0;
  327. int percent = 0;
  328. int currentXP = 0;
  329. int currentLVL = 0;
  330. int gainedXP = 0;
  331. int gainedLVL = 0;
  332. int lapsPerHour = 0;
  333. int expPerHour = 0;
  334. final double courseXP = 139.5;
  335.  
  336. runTime = System.currentTimeMillis() - scriptStartTime;
  337. seconds = runTime / 1000;
  338. if ( seconds >= 60 ) {
  339. minutes = seconds / 60;
  340. seconds -= (minutes * 60);
  341. }
  342. if ( minutes >= 60 ) {
  343. hours = minutes / 60;
  344. minutes -= (hours * 60);
  345. }
  346.  
  347. percent = skills.getPercentToNextLevel(Skills.AGILITY);
  348. currentXP = skills.getCurrentExp(Skills.AGILITY);
  349. currentLVL = skills.getCurrentLevel(Skills.AGILITY);
  350. gainedXP = currentXP - startXP;
  351. gainedLVL = currentLVL - startLvl;
  352. laps = (int) (gainedXP / courseXP);
  353. lapsPerHour = (int) ((3600000.0 / (double) runTime) * laps);
  354. expPerHour = (int) (3600000.0 / (double) runTime * gainedXP);
  355. drawMouse(g);
  356. drawStringShadow("Run Time: " + hours + ":" + minutes + ":" + seconds, 10, 40, g);
  357. drawStringShadow("Status: " + status, 10, 60, g);
  358. drawStringShadow("Total Laps: " + laps + " ( " + lapsPerHour + "/hr )", 10, 80, g);
  359. drawStringShadow("Current Lvl: " + currentLVL + " ( + " + gainedLVL + " )", 10, 100, g);
  360. drawStringShadow("Exp Gained: " + gainedXP + " ( " + expPerHour + "/hr )", 10, 120, g);
  361. drawStringShadow("Exp To Next Level: " + skills.getExpToNextLevel(Skills.AGILITY), 10, 140, g);
  362. try {
  363. if (expPerHour > 0) {
  364. long sTNL = (skills.getExpToNextLevel(Skills.AGILITY)) / (expPerHour / 3600);
  365. long hTNL = sTNL / (60 * 60);
  366. sTNL -= hTNL * (60 * 60);
  367. long mTNL = sTNL / 60;
  368. sTNL -= mTNL * 60;
  369. drawStringShadow("Level in: " + hTNL + ":" + mTNL + ":" + sTNL + " ( " + percent + "% )", 10, 160, g);
  370. } else {
  371. drawStringShadow("Level in: 0:0:0 ( " + percent + "% )", 10, 160, g);
  372. }
  373. } catch(Exception e) {
  374. drawStringShadow("Level in: -1:-1:-1 ( " + percent + "% )", 10, 160, g);
  375. }
  376. }
  377. }
Add Comment
Please, Sign In to add comment