Guest User

Untitled

a guest
Jan 4th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 28.44 KB | None | 0 0
  1. import java.awt.*;
  2. import java.awt.event.*;
  3. import java.awt.geom.Rectangle2D;
  4. import java.io.File;
  5. import java.io.FileInputStream;
  6. import java.io.FileNotFoundException;
  7. import java.io.FileWriter;
  8. import java.io.IOException;
  9. import java.text.NumberFormat;
  10. import java.text.DecimalFormat;
  11. import java.text.SimpleDateFormat;
  12. import java.util.Calendar;
  13. import java.util.Properties;
  14. import java.awt.*;
  15. import javax.imageio.ImageIO;
  16. import java.io.IOException;
  17. import java.net.URL;
  18.  
  19. import org.rsbot.script.util.Timer;
  20. import org.rsbot.script.wrappers.RSCharacter;
  21. import org.rsbot.script.wrappers.RSGroundItem;
  22. import org.rsbot.script.wrappers.RSNPC;
  23. import org.rsbot.script.wrappers.RSTile;
  24. import org.rsbot.event.events.MessageEvent;
  25. import org.rsbot.event.listeners.MessageListener;
  26. import org.rsbot.event.listeners.PaintListener;
  27. import org.rsbot.script.Script;
  28. import org.rsbot.script.ScriptManifest;
  29. import org.rsbot.script.methods.Game;
  30. import org.rsbot.script.methods.Inventory;
  31. import org.rsbot.script.methods.Methods;
  32. import org.rsbot.script.methods.Players;
  33. import org.rsbot.script.methods.Skills;
  34. import org.rsbot.script.methods.GrandExchange.GEItem;
  35. import org.rsbot.script.util.Filter;
  36. import org.rsbot.script.wrappers.*;
  37. import org.rsbot.Configuration;
  38.  
  39. @ScriptManifest(authors = {"#God"}, keywords = "crab", name = "AA -- iCrab Pvt.", version = 0.01, description =
  40. "#God PRIVATE Rock Crab Killer")
  41.  
  42. public class iCrab extends Script implements PaintListener {
  43.  
  44. int state;
  45.  
  46. RSTile[] castle2bank = new RSTile[]{
  47. new RSTile(2758, 3478), new RSTile(2757, 3478), new RSTile(2756, 3478),
  48. new RSTile(2755, 3478), new RSTile(2754, 3478), new RSTile(2753, 3478),
  49. new RSTile(2752, 3478), new RSTile(2751, 3478), new RSTile(2749, 3478),
  50. new RSTile(2748, 3478), new RSTile(2747, 3478), new RSTile(2746, 3479),
  51. new RSTile(2745, 3479), new RSTile(2744, 3479), new RSTile(2743, 3479), new RSTile(2742, 3479),
  52. new RSTile(2741, 3479), new RSTile(2740, 3479), new RSTile(2739, 3480), new RSTile(2738, 3481),
  53. new RSTile(2737, 3482), new RSTile(2736, 3482), new RSTile(2735, 3483), new RSTile(2734, 3483),
  54. new RSTile(2733, 3484), new RSTile(2733, 3485), new RSTile(2732, 3485), new RSTile(2731, 3485),
  55. new RSTile(2730, 3485), new RSTile(2729, 3485), new RSTile(2728, 3485), new RSTile(2727, 3485),
  56. new RSTile(2726, 3486), new RSTile(2726, 3487), new RSTile(2726, 3488), new RSTile(2726, 3489),
  57. new RSTile(2726, 3490), new RSTile(2726, 3491), new RSTile(2725, 3492)
  58. };
  59.  
  60. RSTile[] Bank2Crabs = new RSTile[]{
  61. new RSTile(2724, 3493), new RSTile(2724, 3492), new RSTile(2725, 3489), new RSTile(2725, 3488),
  62. new RSTile(2726, 3485), new RSTile(2725, 3485), new RSTile(2722, 3487), new RSTile(2721, 3488),
  63. new RSTile(2720, 3491), new RSTile(2719, 3492), new RSTile(2718, 3493), new RSTile(2718, 3494),
  64. new RSTile(2716, 3495), new RSTile(2715, 3496), new RSTile(2713, 3498), new RSTile(2712, 3499),
  65. new RSTile(2709, 3499), new RSTile(2708, 3500), new RSTile(2708, 3503), new RSTile(2708, 3504),
  66. new RSTile(2708, 3507), new RSTile(2708, 3508), new RSTile(2705, 3510), new RSTile(2704, 3510),
  67. new RSTile(2703, 3510), new RSTile(2702, 3510), new RSTile(2699, 3510), new RSTile(2698, 3510),
  68. new RSTile(2697, 3510), new RSTile(2696, 3510), new RSTile(2695, 3510), new RSTile(2694, 3510),
  69. new RSTile(2691, 3513), new RSTile(2690, 3513), new RSTile(2689, 3513), new RSTile(2688, 3514),
  70. new RSTile(2685, 3517), new RSTile(2684, 3518), new RSTile(2682, 3521), new RSTile(2682, 3522),
  71. new RSTile(2682, 3523), new RSTile(2682, 3524), new RSTile(2682, 3525), new RSTile(2682, 3526),
  72. new RSTile(2680, 3529), new RSTile(2680, 3530), new RSTile(2680, 3531), new RSTile(2681, 3531),
  73. new RSTile(2682, 3531), new RSTile(2683, 3532), new RSTile(2684, 3533), new RSTile(2685, 3533),
  74. new RSTile(2685, 3534), new RSTile(2685, 3535), new RSTile(2685, 3536), new RSTile(2684, 3536),
  75. new RSTile(2683, 3536), new RSTile(2683, 3537), new RSTile(2683, 3538), new RSTile(2683, 3539),
  76. new RSTile(2682, 3540), new RSTile(2681, 3541), new RSTile(2680, 3543), new RSTile(2680, 3544),
  77. new RSTile(2680, 3545), new RSTile(2679, 3546), new RSTile(2676, 3548), new RSTile(2675, 3549),
  78. new RSTile(2675, 3550), new RSTile(2675, 3551), new RSTile(2675, 3554), new RSTile(2675, 3555),
  79. new RSTile(2674, 3556), new RSTile(2673, 3556), new RSTile(2672, 3556), new RSTile(2671, 3556),
  80. new RSTile(2670, 3556), new RSTile(2669, 3557), new RSTile(2666, 3557), new RSTile(2665, 3557),
  81. new RSTile(2664, 3558), new RSTile(2663, 3559), new RSTile(2662, 3560), new RSTile(2661, 3561),
  82. new RSTile(2661, 3562), new RSTile(2661, 3563), new RSTile(2661, 3564), new RSTile(2661, 3565),
  83. new RSTile(2661, 3566), new RSTile(2661, 3567), new RSTile(2661, 3568), new RSTile(2660, 3569),
  84. new RSTile(2657, 3572), new RSTile(2656, 3573), new RSTile(2655, 3574), new RSTile(2654, 3575),
  85. new RSTile(2654, 3582), new RSTile(2654, 3583), new RSTile(2654, 3584), new RSTile(2653, 3585),
  86. new RSTile(2653, 3590), new RSTile(2654, 3599), new RSTile(2654, 3600), new RSTile(2654, 3601),
  87. new RSTile(2654, 3602), new RSTile(2654, 3603), new RSTile(2654, 3604), new RSTile(2654, 3605),
  88. new RSTile(2659, 3608), new RSTile(2660, 3608), new RSTile(2661, 3609), new RSTile(2662, 3610),
  89. new RSTile(2663, 3611), new RSTile(2664, 3611), new RSTile(2665, 3612), new RSTile(2666, 3613),
  90. new RSTile(2667, 3614), new RSTile(2667, 3615), new RSTile(2667, 3616), new RSTile(2667, 3617),
  91. new RSTile(2668, 3618), new RSTile(2669, 3619), new RSTile(2670, 3620), new RSTile(2671, 3620),
  92. new RSTile(2671, 3625), new RSTile(2671, 3626), new RSTile(2672, 3627), new RSTile(2673, 3628),
  93. new RSTile(2674, 3629), new RSTile(2674, 3630), new RSTile(2675, 3631), new RSTile(2676, 3632),
  94. new RSTile(2677, 3632), new RSTile(2678, 3632), new RSTile(2679, 3632), new RSTile(2680, 3632),
  95. new RSTile(2681, 3632), new RSTile(2682, 3632), new RSTile(2683, 3632), new RSTile(2684, 3632),
  96. new RSTile(2689, 3636), new RSTile(2690, 3636), new RSTile(2691, 3636), new RSTile(2692, 3636),
  97. new RSTile(2693, 3637), new RSTile(2694, 3638), new RSTile(2695, 3638), new RSTile(2696, 3638),
  98. new RSTile(2697, 3638), new RSTile(2698, 3639), new RSTile(2699, 3639), new RSTile(2700, 3639),
  99. new RSTile(2701, 3639), new RSTile(2702, 3640), new RSTile(2703, 3641), new RSTile(2704, 3642),
  100. new RSTile(2705, 3643), new RSTile(2706, 3644), new RSTile(2707, 3645), new RSTile(2708, 3646),
  101. new RSTile(2708, 3651), new RSTile(2708, 3652), new RSTile(2708, 3653), new RSTile(2708, 3654),
  102. new RSTile(2708, 3655), new RSTile(2708, 3656), new RSTile(2708, 3657), new RSTile(2709, 3658),
  103. new RSTile(2710, 3659), new RSTile(2709, 3659), new RSTile(2709, 3660), new RSTile(2709, 3661),
  104. new RSTile(2709, 3662), new RSTile(2709, 3663), new RSTile(2709, 3664), new RSTile(2709, 3665),
  105. new RSTile(2709, 3666), new RSTile(2709, 3667), new RSTile(2709, 3668), new RSTile(2709, 3669),
  106. new RSTile(2709, 3670), new RSTile(2709, 3671), new RSTile(2712, 3675), new RSTile(2712, 3676),
  107. new RSTile(2712, 3677), new RSTile(2712, 3678), new RSTile(2712, 3679), new RSTile(2712, 3680),
  108. new RSTile(2712, 3681), new RSTile(2712, 3682), new RSTile(2712, 3683), new RSTile(2712, 3684),
  109. new RSTile(2711, 3685), new RSTile(2710, 3686), new RSTile(2710, 3687), new RSTile(2710, 3688),
  110. new RSTile(2710, 3689), new RSTile(2710, 3690), new RSTile(2710, 3691), new RSTile(2710, 3692),
  111. new RSTile(2710, 3697), new RSTile(2710, 3698), new RSTile(2710, 3699), new RSTile(2710, 3700),
  112. new RSTile(2710, 3701), new RSTile(2710, 3702), new RSTile(2710, 3703), new RSTile(2710, 3704),
  113. new RSTile(2710, 3705), new RSTile(2710, 3706), new RSTile(2710, 3711), new RSTile(2710, 3712),
  114. new RSTile(2710, 3713), new RSTile(2709, 3714), new RSTile(2708, 3715), new RSTile(2707, 3716),
  115. new RSTile(2706, 3717)};
  116.  
  117. RSNPC Rock, Crab;
  118.  
  119. // tiles
  120. RSTile bankTile = new RSTile(2724,3493);
  121. RSTile crabTile = new RSTile(2706,3717);
  122. RSTile cammyTile = new RSTile(2757,3477);
  123. RSTile inSet = new RSTile(2773,10162);
  124. RSTile outSet = new RSTile(2730,3713);
  125.  
  126. // IDs of obj + npc 's
  127. public int crabID[] = {1267,1265}, rockID[] = {1268,1266}, charms[] = {12158, 12159, 12160, 12162};
  128. public int TTabID = 8010, bankBoothID = 25808, foodID = 333, arrowID = 0, stuck = 0, foodInBank =0, tabsInBank =0; //food set to trout by default
  129. public int inReset = 5008, outReset = 5014, foodEat = 0;
  130.  
  131. // booleans
  132. boolean needBank = false, needReset = false;
  133.  
  134. // paint counters/timers
  135. public String status = "";
  136. public long startTime = System.currentTimeMillis();
  137. public long RxpGain, RxpHour, Rlvlgain, RstartExp, Rstartlvl, brakeIn, brakeFor, HxpGain, HxpHour, Hlvlgain, HstartExp, Hstartlvl;
  138.  
  139. @Override
  140. public int loop() {
  141. switch (state){
  142. case 0:
  143. ToCrabs();
  144. break;
  145. case 1:
  146. ToReset();
  147. break;
  148. case 2:
  149. FromReset();
  150. break;
  151. case 3:
  152. Fight();
  153. break;
  154. case 4:
  155. Tobank();
  156. break;
  157. case 5:
  158. OpenBank();
  159. break;
  160. case 6:
  161. Dobank();
  162. break;
  163. case 7:
  164. Logout();
  165. break;
  166. case 8:
  167. brake();
  168. break;
  169.  
  170. }
  171.  
  172. return (random(100,280));
  173. }
  174.  
  175. // START ###
  176. public boolean onStart() {
  177. status = "Loading..";
  178. env.enableRandom("Improved Login"); //enables random
  179. long varTime = random(3200000, 9990000); //gets ran time for break to vary by
  180. brakeIn = System.currentTimeMillis() + varTime;
  181. brakeFor = random(720000 , 4200000); //breaks between there 2 times
  182. log.severe("Started !");
  183.  
  184. while (bank.isOpen()) { //shuts bank if its open on start
  185. bank.close();
  186. sleep(random(200, 400));
  187. }
  188.  
  189. startTime = System.currentTimeMillis(); //sets time @ start
  190. Rstartlvl = skills.getCurrentLevel(skills.RANGE); //start range level
  191. RstartExp = skills.getCurrentExp(skills.RANGE); //start range xp
  192. Hstartlvl = skills.getCurrentLevel(skills.CONSTITUTION); //start range level
  193. HstartExp = skills.getCurrentExp(skills.CONSTITUTION); //start range xp
  194.  
  195. if (calc.distanceTo(bankTile) < 10) { //bank
  196. if (!inventory.contains(foodID)){ //no food & in bank
  197. state = 5; // open bank
  198. }
  199. if (inventory.contains(foodID) && (inventory.contains(TTabID))){ //food & in bank
  200. state = 0; // walk 2 crabs
  201. }
  202. }
  203.  
  204. if (calc.distanceTo(crabTile) < 40) {//crabs
  205. if (!inventory.contains(foodID)){ //no food & @ crabs
  206. state = 4; // go 2 bank
  207. }
  208. if (inventory.contains(foodID)){ //food & @ crabs
  209. state = 3; // start attak
  210. }
  211. sleep(random(80, 140));
  212. return true;
  213. }
  214.  
  215. return true;
  216. }
  217.  
  218. private boolean brakeCheck() {
  219.  
  220. if (brakeIn < 1){ //if break timer has reached 0
  221. sleep (random(40,90));
  222. status = "Need To Brake..";
  223. state = 8; //send to break mode
  224. }
  225. return true;
  226.  
  227. }
  228.  
  229. private boolean brake() {
  230. long endIn = System.currentTimeMillis() + brakeFor; //how long break is for
  231. env.disableRandom("Improved Login"); //disables auto login
  232. status = "Taking Brake..";
  233. log.severe("Braking For - " +brakeFor);
  234. while (bank.isOpen()) { //closes bank if its open
  235. bank.close();
  236. sleep(random(200, 400));
  237. }
  238. game.logout(true); //logs out
  239. sleep(random(1200, 3600));
  240.  
  241. while (System.currentTimeMillis() < endIn) { //will brake here
  242. status = "Braking..";
  243. sleep(5000);
  244. }
  245.  
  246. while (System.currentTimeMillis() > endIn) { //brake is over
  247. env.enableRandom("Improved Login"); //enables random
  248. status = "Brake Over..";
  249. sleep(random(3000,6800)); //time to login
  250.  
  251. if (calc.distanceTo(bankTile) < 10) { //bank
  252. if (!inventory.contains(foodID)){ //no food & in bank
  253. state = 5; // open bank
  254. }
  255. if (inventory.contains(foodID)){ //food & in bank
  256. state = 0; // walk 2 crabs
  257. }
  258. }
  259.  
  260. if (calc.distanceTo(crabTile) < 25) {//crabs
  261. if (!inventory.contains(foodID)){ //no food & @ crabs
  262. state = 4; // go 2 bank
  263. }
  264. if (inventory.contains(foodID)){ //food & @ crabs
  265. state = 3; // start attak
  266. }
  267. sleep(random(80, 140));
  268. return true;
  269. }
  270.  
  271. }
  272.  
  273. return true;
  274.  
  275. }
  276.  
  277. private void pickItem(RSGroundItem item, String action) { //pickup method from 'glow'
  278. if (item != null) {
  279. Point middle = calc.tileToScreen(item.getLocation());
  280. if (item.isOnScreen() && !getMyPlayer().isMoving()) {
  281. if (!menu.contains(action)) {
  282. if (!menu.isOpen()) {
  283. mouse.move(middle);
  284. } else {
  285. mouse.moveOffScreen();
  286. }
  287. } else {
  288. menu.doAction(action);
  289. sleep(1000,1100);
  290. }
  291. } else if (!item.isOnScreen()) {
  292. if (!getMyPlayer().isMoving()) {
  293. walking.walkTileMM(item.getLocation()); // end 'glow' pick-up method
  294. }
  295. }
  296. }
  297. }
  298.  
  299. public boolean ToCrabs(){
  300.  
  301. if (!walking.isRunEnabled() && walking.getEnergy() > (random(15,35))) { // will enable run
  302. status = "Setting Run..";
  303. walking.setRun(true);
  304. sleep(random(80, 140));
  305. }
  306.  
  307. if (calc.distanceTo(crabTile) < 6) {
  308. state = 3;
  309. status = "At Crabs..";
  310. sleep(random(80, 170));
  311. return true;
  312. }
  313.  
  314. RSTilePath path = walking.newTilePath(Bank2Crabs);
  315. status = "Walking To Crabs..";
  316. if (!path.traverse()) {
  317. stuck++;
  318. if (stuck > 2) {
  319. walking.walkTileMM(walking.getClosestTileOnMap(new RSTile(2675, 3551)));
  320. }
  321. } else {
  322. stuck = 0;
  323. int max = 0;
  324. while (!getMyPlayer().isMoving() && max < 12) {
  325. status = "Walking To Crabs..";
  326. sleep(random(650, 900));
  327. }
  328. }
  329. return true;
  330. }
  331.  
  332. public boolean ToReset(){
  333.  
  334. RSObject GoInCave = objects.getNearest(inReset);
  335.  
  336. walking.walkTileMM(walking.getClosestTileOnMap(outSet));
  337. status = "Walking To Cave..";
  338. sleep(500);
  339.  
  340. if (getMyPlayer().isMoving()) {
  341. sleep (random(500, 650));
  342. }
  343.  
  344. if (calc.distanceTo(outSet) < 5) {
  345. status = "Finding Cave..";
  346. if (GoInCave != null && needReset == true) {
  347. GoInCave.doAction("Enter");
  348. status = "Entering Cave..";
  349. sleep(random(1200, 1450));
  350. }
  351. }
  352.  
  353. if (calc.distanceTo(inSet) < 2) {
  354. status = "Inside Cave..";
  355. needReset = false;
  356. sleep(150);
  357. state = 2;
  358. }
  359.  
  360. return true;
  361. }
  362.  
  363. private void pickupCharm() {
  364. if (inventory.getCount() < 27) {
  365. RSGroundItem ChPickUp = groundItems.getNearest(charms);
  366. sleep(90);
  367. pickItem(ChPickUp, "Take "+ ChPickUp.getItem().getName());
  368. checkHP();
  369. status = "Looted Charm..";
  370. sleep(random(100,250));
  371. }
  372. }
  373.  
  374. public boolean checkHP(){
  375. if (combat.getLifePoints() < (((skills.getRealLevel(Skills.CONSTITUTION) * 10) - 100))){
  376. status = "Eating Food..";
  377. eatFood();
  378. sleep(110);
  379. }
  380. return true;
  381. }
  382.  
  383. public boolean FromReset() {
  384.  
  385. RSObject GoOutCave = objects.getNearest(outReset);
  386. status = "Preparing To Exit..";
  387.  
  388. if (getMyPlayer().isMoving()) {
  389. sleep (random(300, 550));
  390. }
  391.  
  392. if (calc.distanceTo(inSet) < 5) {
  393. if (GoOutCave != null) {
  394. status = "Exiting Cave..";
  395. GoOutCave.doAction("Enter");
  396. sleep(random(1200, 1450));
  397. }
  398. }
  399.  
  400. if (calc.distanceTo(outSet) < 2) {
  401. status = "Walking To Crabs..";
  402. sleep(300);
  403. walking.walkTileMM(walking.getClosestTileOnMap(crabTile));
  404. sleep(1500);
  405. }
  406.  
  407. if (calc.distanceTo(crabTile) < 20) {
  408. sleep(300);
  409. state = 3;
  410. sleep(50);
  411. }
  412.  
  413. return true;
  414. }
  415.  
  416. public boolean Fight() {
  417.  
  418. Crab = npcs.getNearest(crabID);
  419. Rock = npcs.getNearest(rockID);
  420. RSTile RockLocation = Rock.getLocation();
  421.  
  422. checkHP();
  423.  
  424. if (!getMyPlayer().isInCombat() && (getMyPlayer().getInteracting() == null)) {
  425. if(Crab != null && !Crab.isInCombat() && Crab.isOnScreen() && !getMyPlayer().getLocation().equals(RockLocation)) {
  426. status = "Finding Crab..";
  427. Crab.interact("Attack");
  428. sleep(110,140);
  429. } else if(Rock != null && Rock.isOnScreen() && !getMyPlayer().getLocation().equals(RockLocation)) {
  430. status = "Walking To Rocks..";
  431. walking.walkTileOnScreen(Rock.getLocation());
  432. sleep(400,600);
  433. } else if (Rock != null && !Rock.isOnScreen()) {
  434. walking.walkTileMM(Rock.getLocation());
  435. status = "Walking..";
  436. } else if (getMyPlayer().getLocation().equals(RockLocation) && (getMyPlayer().getInteracting() == null)) {
  437. for (int i = 0; i < 50 && getMyPlayer().getLocation().equals(RockLocation) && (getMyPlayer().getInteracting() == null); i++) {
  438. if (getMyPlayer().isIdle()) {
  439. sleep(240,330);
  440. } for (int t = 0; t < 50 && !getMyPlayer().isInCombat(); t++) {
  441. status = "Need Reset..";
  442. needReset = true;
  443. }
  444. }
  445. }
  446. }
  447.  
  448. if (getMyPlayer().isInCombat()){
  449. status = "Fighting..";
  450. sleep (random(10, 30));
  451. checkHP();
  452. }
  453.  
  454. if (getMyPlayer().isMoving()) {
  455. sleep (random(30, 60));
  456. checkHP();
  457. }
  458.  
  459. if (groundItems.getNearest(charms) != null) {
  460. status = "Looting Charms..";
  461. sleep(random(30, 60));
  462. pickupCharm();
  463. }
  464.  
  465. if (needBank == true){
  466. state = 4;
  467. }
  468.  
  469. if (!inventory.contains(foodID)){
  470. needBank = true;
  471. }
  472.  
  473. if (needReset == true){
  474. state = 1;
  475. }
  476.  
  477. return true;
  478. }
  479.  
  480. private boolean Tobank(){
  481. status = "Need To Bank..";
  482.  
  483. if (calc.distanceTo(cammyTile) > 10) {// not at cammy
  484. if (!inventory.contains(TTabID)) { // at crabs with no tabs
  485. state = 7;
  486. sleep(3500);
  487. }
  488. else if (inventory.contains(TTabID)) { // at crabs with tabs
  489. status = "Using tab..";
  490. inventory.getItem(TTabID).doAction("Break");
  491. sleep(3500);
  492. }
  493. }
  494.  
  495. if (calc.distanceTo(cammyTile) < 5){ //at cammy
  496.  
  497. if (!walking.isRunEnabled() && walking.getEnergy() > (random(15,35))) { // will enable run
  498. status = "Setting Run..";
  499. walking.setRun(true);
  500. sleep(random(80, 110));
  501. }
  502.  
  503. if (calc.distanceTo(bankTile) < 3) { //meaning at bank
  504. status = "At Bank..";
  505. state = 5; //to open bank
  506. sleep(random(240, 320));
  507. return true;
  508. }
  509.  
  510. RSTilePath path2 = walking.newTilePath(castle2bank);
  511. status = "Walking To Bank..";
  512. if (!path2.traverse()) {
  513. stuck++;
  514. if (stuck > 2) {
  515. walking.walkTileMM(walking.getClosestTileOnMap(new RSTile(2740, 3479)));
  516. }
  517. } else {
  518. int max = 0;
  519. while (!getMyPlayer().isMoving() && max < 12) {
  520. status = "Walking To Bank..";
  521. sleep(random(550, 800));
  522. }
  523. }
  524. }
  525. return true;
  526. }
  527.  
  528. public boolean OpenBank() {
  529.  
  530. brakeCheck();
  531.  
  532. status = "Finding Bank..";
  533. while (!bank.isOpen()){
  534. RSObject bankboot = objects.getNearest(bankBoothID);
  535. if (bankboot != null){
  536. status = "Opening Bank..";
  537. bank.open();
  538. sleep(random(250, 400));
  539. }
  540. }
  541. if (bank.isOpen()){
  542. status = "Bank Is Open..";
  543. sleep(random(80, 120));
  544. state = 6;
  545. }
  546. return true;
  547. }
  548.  
  549. public boolean Dobank() {
  550. status = "Banking..";
  551. while (bank.isOpen()){
  552. while (!inventory.contains(foodID) && (!inventory.contains(TTabID))) {
  553. status = "Depositing..";
  554. bank.depositAll();
  555. sleep(random(340, 450));
  556. status = "Withdrawing..";
  557. bank.withdraw(foodID, 27);
  558. sleep(250);
  559. bank.withdraw(TTabID, 1);
  560. sleep(350);
  561. foodInBank = bank.getCount(foodID);
  562. tabsInBank = bank.getCount(TTabID);
  563. sleep(random(700, 930));
  564. }
  565. if (inventory.contains(foodID) && (inventory.contains(TTabID))){
  566. status = "Done at bank..";
  567. needBank = false;
  568. bank.close();
  569. state = 0;
  570. sleep(random(50, 90));
  571. }
  572. if (foodInBank < 28){
  573. log.severe("Ran out of food.");
  574. state = 7;
  575. }
  576. }
  577. return true;
  578. }
  579.  
  580. public boolean Logout() {
  581. env.disableRandom("Improved Login");
  582. status = "Logging Out..";
  583. log.severe("Logging Out!");
  584. while (bank.isOpen()) {
  585. bank.close();
  586. sleep(random(200, 400));
  587. }
  588. game.logout(true);
  589. return true;
  590. }
  591.  
  592. public boolean antiban(){
  593.  
  594. return true;
  595. }
  596.  
  597. public boolean eatFood(){
  598. status = "Eating Food..";
  599. if (!inventory.contains(foodID)){
  600. needBank = true;
  601. } else{
  602. inventory.getItem(foodID).doAction("Eat");
  603. foodEat = foodEat + 1;
  604. }
  605. sleep(170);
  606. return true;
  607. }
  608.  
  609. // FINISH ###
  610. public void onFinish() {
  611. log.severe("Ended !");
  612. }
  613.  
  614. // PAINT ###
  615. public void onRepaint(Graphics g1) {
  616. Graphics2D g = (Graphics2D)g1;
  617. if(game.isLoggedIn()){
  618. Rlvlgain = skills.getCurrentLevel(skills.RANGE) - Rstartlvl;
  619. RxpGain = skills.getCurrentExp(skills.RANGE) - RstartExp;
  620. RxpHour = (int) ((RxpGain) * 3600000D / (System.currentTimeMillis() - startTime));
  621. Hlvlgain = skills.getCurrentLevel(skills.CONSTITUTION) - Hstartlvl;
  622. HxpGain = skills.getCurrentExp(skills.CONSTITUTION) - HstartExp;
  623. HxpHour = (int) ((HxpGain) * 3600000D / (System.currentTimeMillis() - startTime));
  624.  
  625. final Color color1 = new Color(153, 0, 0);
  626. final Color color2 = new Color(0, 0, 0);
  627. final Color color3 = new Color(0, 102, 0);
  628. final Color color4 = new Color(255, 255, 255);
  629. final Color color5 = new Color(204, 204, 204);
  630. final Color color6 = new Color(153, 153, 0);
  631. final Color color7 = new Color(0, 102, 51);
  632. final Color color8 = new Color(255, 0, 0);
  633. final Color color9 = new Color(0, 0, 204);
  634.  
  635. final BasicStroke stroke1 = new BasicStroke(1);
  636. final BasicStroke stroke2 = new BasicStroke(3);
  637. final BasicStroke stroke3 = new BasicStroke(2);
  638.  
  639. final Font font1 = new Font("OCR A Extended", 0, 13);
  640. final Font font2 = new Font("Bradley Hand ITC", 2, 30);
  641. final Font font3 = new Font("OCR A Extended", 1, 18);
  642. final Font font4 = new Font("MS PGothic", 1, 25);
  643.  
  644.  
  645. long millis = System.currentTimeMillis() - startTime;
  646. long hours = millis / (1000 * 60 * 60);
  647. millis -= hours * (1000 * 60 * 60);
  648. long minutes = millis / (1000 * 60);
  649. millis -= minutes * (1000 * 60);
  650. long seconds = millis / 1000;
  651.  
  652. long bra = brakeIn - System.currentTimeMillis();
  653. long h = bra / (1000 * 60 * 60);
  654. bra -= h * (1000 * 60 * 60);
  655. long m = bra / (1000 * 60);
  656. bra -= m * (1000 * 60);
  657. long s = bra / 1000;
  658. if(game.isLoggedIn()){
  659.  
  660. // Paints the Mouse Location
  661. g.setColor(Color.black);
  662. Point mousey = mouse.getLocation();
  663. int x = (int) mousey.getX();
  664. int y = (int) mousey.getY();
  665. g.drawLine(x, 0, x, game.getHeight());
  666. g.drawLine(0, y, game.getWidth(), y);
  667. g.setColor(Color.white);
  668. g.drawRect(x - 2, y - 2, 5, 5);
  669. g.fillRect(x - 2, y - 2, 5, 5);
  670.  
  671.  
  672. g.setColor(color1);
  673. g.fillRect(7, 373, 491, 25);
  674. g.setColor(color2);
  675. g.setStroke(stroke1);
  676. g.drawRect(7, 373, 491, 25);
  677. g.setColor(color3);
  678. g.fillRect(7, 346, 491, 25);
  679. g.setColor(color2);
  680. g.drawRect(7, 346, 491, 25);
  681. g.setFont(font1);
  682. g.setColor(color4);
  683. g.drawString("Level: "+ skills.getCurrentLevel(skills.RANGE) +"(+" + Rlvlgain + ") Xp: " + RxpGain + "(+" + RxpHour + "/Hr)",14, 363);
  684. g.drawString("Level: "+ skills.getCurrentLevel(skills.CONSTITUTION) + "(+"+ Hlvlgain +") Xp: " +HxpGain + "(+" + HxpHour + "/Hr)", 11, 392);
  685. g.fillRoundRect(6, 272, 311, 64, 16, 16);
  686. g.setColor(color2);
  687. g.setStroke(stroke2);
  688. g.drawRoundRect(6, 272, 311, 64, 16, 16);
  689. g.setColor(color5);
  690. g.fillOval(522, 121, 42, 43);
  691. g.setColor(color6);
  692. g.setStroke(stroke3);
  693. g.drawOval(522, 121, 42, 43);
  694. g.setColor(color7);
  695. g.drawString("Ran: "+ hours + ":" + minutes + ":"
  696. + seconds, 16, 309);
  697. g.setColor(color8);
  698. g.drawString("Time TB: "+ h + ":" + m + ":" + s, 138, 308);
  699. g.setFont(font2);
  700. g.setColor(color2);
  701. g.drawString("#GOD Pvt. Crab Slayer", 10, 292);
  702. g.setFont(font3);
  703. g.setColor(color9);
  704. g.drawString(""+status, 15, 332);
  705. g.setFont(font4);
  706. g.setColor(color2);
  707. g.drawString(""+foodEat, 526, 152);
  708.  
  709. }
  710. //END: Code generated using Enfilade's Easel
  711. }
  712. }
  713.  
  714. // SERVER MESSAGE LISTER
  715. public void messageReceived(MessageEvent e) {
  716. try {
  717. String serverString = e.getMessage();
  718.  
  719. if (serverString.contains("just advanced")) {
  720. log.info("Leveled!");
  721. }
  722. if (serverString.contains("Oh dear")) {
  723. log.severe("Char. Died ! - Logged out");
  724. state = 7;
  725. }
  726.  
  727. if (serverString.contains("System update in")) {
  728. log.warning("System Update ! - Logged Out");
  729. state = 7;
  730. }
  731. } catch (Throwable t) {
  732. }
  733. }
  734.  
  735.  
  736.  
  737.  
  738. }
Add Comment
Please, Sign In to add comment