1. import java.awt.Color;
  2. import java.awt.Font;
  3. import java.awt.Graphics;
  4. import java.awt.Point;
  5. import java.awt.Rectangle;
  6. import java.util.ArrayList;
  7. import java.util.Map;
  8.  
  9. import org.rsbot.bot.Bot;
  10. import org.rsbot.event.events.ServerMessageEvent;
  11. import org.rsbot.event.listeners.PaintListener;
  12. import org.rsbot.event.listeners.ServerMessageListener;
  13. import org.rsbot.script.Calculations;
  14. import org.rsbot.script.Constants;
  15. import org.rsbot.script.Script;
  16. import org.rsbot.script.ScriptManifest;
  17. import org.rsbot.script.wrappers.RSInterface;
  18. import org.rsbot.script.wrappers.RSInterfaceChild;
  19. import org.rsbot.script.wrappers.RSItemTile;
  20. import org.rsbot.script.wrappers.RSObject;
  21. import org.rsbot.script.wrappers.RSPlayer;
  22. import org.rsbot.script.wrappers.RSTile;
  23.  
  24. @ScriptManifest(authors = { "Weirded" }, category = "Hunter", name = "WeirdMultiHunter", description = "<html><head><style type='text/css'> body {font-family: 'Tahoma'; font-size: 10px; margin-left: 10px;}</style></head><body><h3>WeirdMultiHunter by Weirded</h3><br /><p><select name='thehunted'><option>Crimson Swift</option><option>Golden Warbler</option><option>Copper Longtail</option><option>Cerulean Twitch</option><option>Tropical Wagtail</option><option>Ferret</option><option>Grey Chinchompa</option><option>Red Chinchompa</option></select><br /><input type='checkbox' name='burybones' value='true'><b>Bury Bones?</b><br /><input type='checkbox' name='lagthing' value='true'><b>Check this if script lags</b><br /></p><p><b>Notice: </b>Make sure you turn off BreakHandler unless you want to lose alot of traps!</p><br /><p>Log in and stand where you want to hunt before starting.</p><br /></body></html>", version = 2.0)
  25. public class WeirdMultiHunter extends Script implements PaintListener, ServerMessageListener{
  26. public int TrapItem;
  27. public int TrapFailed;
  28. public int TrapCaught;
  29. public int TrapLaid;
  30.  
  31. public int whichTrap = 0;
  32. public int loopyThing = 0;
  33. public int checkThing = 0;
  34.  
  35. public int bones = 526;
  36. public int birdmeat = 9978;
  37. public int ferret = 10092;
  38.  
  39. public int TrapLayAnim = 5208;
  40. public int TrapRetrieveAnim;
  41.  
  42. public int numCaught = 0;
  43. public double expPer = 0;
  44. public int dropStuff = 0;
  45. public boolean buryBones = false;
  46. public boolean lagThing = false;
  47.  
  48. public boolean[] Trap = {false, false, false, false, false};
  49. public RSTile[] TrapPos = new RSTile[5];
  50. public int numTraps = 0;
  51.  
  52. public RSTile HuntingArea = new RSTile(-1, -1);
  53. public RSTile oldPosition = new RSTile(-1, -1);
  54. public int standingCount = 0;
  55. public boolean logoutCheck = false;
  56.  
  57. public long runTime = 0, seconds = 0 ,minutes = 0, hours = 0;
  58. public int gainedExp = 0;
  59. public int startLevel = 0;
  60. public int startExp = 0;
  61. public int expToLevel = 0;
  62. public long secToLevel = 0;
  63. public long minutesToLevel = 0;
  64. public long hoursToLevel = 0;
  65. public long startTime = 0;
  66. public float secExp = 0;
  67. public float minuteExp = 0;
  68. public float hourExp = 0;
  69.  
  70. public String getName(){
  71. return "WeirdMultiHunter";
  72. }
  73.  
  74. public String getAuthor(){
  75. return "Weirded";
  76. }
  77.  
  78. public String getScriptCategory(){
  79. return "Hunter";
  80. }
  81.  
  82. public double getVersion(){
  83. return 2.0;
  84. }
  85.  
  86. public String getScriptDescription() {
  87. String html = "<html>";
  88. html += "<head>";
  89. html += "<style type=\"text/css\"> body {font-family: \"Tahoma\"; font-size: 10px; margin-left: 10px;}</style>";
  90. html += "</head>";
  91. html += "<body>";
  92. html += "<h3>" + getName() + " v" + getVersion() + " by " + getAuthor() + "</h3><br />";
  93. html += "<p>";
  94. html += "<select name=\"thehunted\">";
  95. html += "<option>Crimson Swift</option>";
  96. html += "<option>Golden Warbler</option>";
  97. html += "<option>Copper Longtail</option>";
  98. html += "<option>Cerulean Twitch</option>";
  99. html += "<option>Tropical Wagtail</option>";
  100. html += "<option>Ferret</option>";
  101. html += "<option>Grey Chinchompa</option>";
  102. html += "<option>Red Chinchompa</option>";
  103. html += "</select><br />";
  104. html += "<input type=\"checkbox\" name=\"burybones\" value=\"true\"><b>Bury Bones?</b><br />";
  105. html += "<input type=\"checkbox\" name=\"lagthing\" value=\"true\"><b>Check this if script lags</b><br />";
  106. html += "</p>";
  107. html += "<p><b>Notice: </b>Make sure you turn off BreakHandler unless you want to lose alot of traps!</p><br />";
  108. html += "<p>Log in and stand where you want to hunt before starting.</p><br />";
  109. html += "</body>";
  110. html += "</html>";
  111.  
  112. return html;
  113. }
  114.  
  115. public boolean onStart(Map<String, String> args) {
  116. int i = 0;
  117. int j = 0;
  118. if(!isLoggedIn()){
  119. log("Log in and stand where you want to hunt before starting.");
  120. }
  121. if (args.get("thehunted").equals("Crimson Swift")){ i = 0; j = 0;}
  122. if (args.get("thehunted").equals("Golden Warbler")){ i = 1; j = 0;}
  123. if (args.get("thehunted").equals("Copper Longtail")){ i = 2; j = 0;}
  124. if (args.get("thehunted").equals("Cerulean Twitch")){ i = 3; j = 0;}
  125. if (args.get("thehunted").equals("Tropical Wagtail")){ i = 4; j = 0;}
  126. if (args.get("thehunted").equals("Ferret")){ i = 5; j = 1;}
  127. if (args.get("thehunted").equals("Grey Chinchompa")){ i = 6; j = 1;}
  128. if (args.get("thehunted").equals("Red Chinchompa")){ i = 7; j = 1;}
  129.  
  130. switch(i){
  131. case 0:
  132. TrapCaught = 19180;
  133. expPer = 34;
  134. dropStuff = 1;
  135. break;
  136. case 1:
  137. TrapCaught = 19184;
  138. expPer = 48;
  139. dropStuff = 1;
  140. break;
  141. case 2:
  142. TrapCaught = 19186;
  143. expPer = 61;
  144. dropStuff = 1;
  145. break;
  146. case 3:
  147. TrapCaught = 19182;
  148. expPer = 64.67;
  149. dropStuff = 1;
  150. break;
  151. case 4:
  152. TrapCaught = 19178;
  153. expPer = 95.2;
  154. dropStuff = 1;
  155. break;
  156. case 5:
  157. TrapCaught = 19191;
  158. expPer = 115;
  159. dropStuff = 2;
  160. break;
  161. case 6:
  162. TrapCaught = 19189;
  163. expPer = 198;
  164. break;
  165. case 7:
  166. TrapCaught = 19190;
  167. expPer = 265;
  168. break;
  169. default:
  170. break;
  171. }
  172. switch(j){
  173. case 0:
  174. TrapItem = 10006;
  175. TrapFailed = 19174;
  176. TrapLaid = 19175;
  177. TrapRetrieveAnim = 5207;
  178. break;
  179. case 1:
  180. TrapItem = 10008;
  181. TrapFailed = 19192;
  182. TrapLaid = 19187;
  183. TrapRetrieveAnim = 5212;
  184. break;
  185. default:
  186. break;
  187. }
  188. buryBones = args.get("burybones") != null ? true : false;
  189. lagThing = args.get("lagthing") != null ? true : false;
  190. HuntingArea = getMyPlayer().getLocation();
  191. return true;
  192. }
  193.  
  194. public void onFinish(){
  195. return;
  196. }
  197.  
  198. @Override
  199. protected int getMouseSpeed() {//Thanks to RcZhang
  200. return random(6,7);
  201. }
  202.  
  203. public boolean clickInventoryItem(int itemID) {//Thanks to RcZhang
  204. if (getCurrentTab() != TAB_INVENTORY
  205. && !RSInterface.getInterface(INTERFACE_BANK).isValid()
  206. && !RSInterface.getInterface(INTERFACE_STORE).isValid()
  207. && getMyPlayer().getAnimation() == -1) {
  208. openTab(TAB_INVENTORY);
  209. wait(random(100, 200));
  210. }
  211. int[] items = getInventoryArray();
  212. java.util.List<Integer> possible = new ArrayList<Integer>();
  213. for (int i = 0; i < items.length; i++) {
  214. if (items[i] == itemID) {
  215. possible.add(i);
  216. }
  217. }
  218. if (possible.size() == 0) return false;
  219. int idx = possible.get(0);
  220. Point t = getInventoryItemPoint(idx);
  221. moveMouse(t.x + 5, t.y + 5, 5, 5);
  222. wait(random(40, 50));
  223. clickMouse(true);
  224. wait(random(80, 100));
  225. return true;
  226. }
  227.  
  228. @Override
  229. public boolean atInventoryItem(final int itemID, final String option) {
  230. if (getCurrentTab() != Constants.TAB_INVENTORY
  231. && !RSInterface.getInterface(Constants.INTERFACE_BANK)
  232. .isValid()
  233. && !RSInterface.getInterface(Constants.INTERFACE_STORE)
  234. .isValid()) {
  235. openTab(Constants.TAB_INVENTORY);
  236. }
  237. final int[] items = getInventoryArray();
  238. final java.util.List<Integer> possible = new ArrayList<Integer>();
  239. for (int i = 0; i < items.length; i++) {
  240. if (items[i] == itemID) {
  241. possible.add(i);
  242. }
  243. }
  244. if (possible.size() == 0) {
  245. return false;
  246. }
  247. final int idx = possible.get(random(0, possible.size()));
  248. final Point t = getInventoryItemPoint(idx);
  249. moveMouse(t.x + 5, t.y + 5, 5, 5);
  250. wait(random(40, 50));
  251. return atMenu(option);
  252. }
  253.  
  254. /**
  255. * Loops through all menu items to find the longest
  256. * then returns the longest menu item. Since each character
  257. * is roughly 7 pixels it returns length*7.
  258. * Weirded :]
  259. * */
  260. public int getMenuLengthEstimate(){
  261. int i, longest = 0;
  262. for(i = 1; i < getMenuItems().size(); i++){
  263. if(getMenuItems().get(i).length() > getMenuItems().get(longest).length()){
  264. longest = i;
  265. }
  266. }
  267.  
  268. return getMenuItems().get(longest).length()*7;
  269. }
  270.  
  271. @Override
  272. public boolean atMenuItem(final int i) {
  273. if (!isMenuOpen()) {
  274. return false;
  275. }
  276. try {
  277. final RSTile menu = getMenuLocation();
  278. final int menuLength = getMenuLengthEstimate();
  279. final int xOff = random((menuLength/2 - 15), (menuLength/2 + 15)); //clicks near the middle of the menu
  280. final int yOff = random(23, 27) + 15 * i;
  281. moveMouse(menu.getX() + xOff, menu.getY() + yOff);
  282. if (!isMenuOpen()) {
  283. return false;
  284. }
  285. wait(random(20,25));
  286. clickMouse(true);
  287. wait(random(20,25));
  288. return true;
  289. } catch (final Exception e) {
  290. e.printStackTrace();
  291. return false;
  292. }
  293. }
  294.  
  295. public boolean HasTrapSet(RSTile tile){
  296. RSObject obj = getObjectAt(tile);
  297. if(obj == null){
  298. return false;
  299. }
  300. if(obj.getID() == TrapLaid){
  301. return true;
  302. }
  303. return false;
  304. }
  305.  
  306. public int HasTrap(RSTile tile){
  307. if(tile == null){
  308. return -1;
  309. }
  310. RSObject obj = getObjectAt(tile);
  311. if(obj == null){
  312. return -1;
  313. }
  314. return obj.getID();
  315. }
  316.  
  317. public boolean HasTrapLaid(RSTile tile){
  318. if(tile == null){
  319. return false;
  320. }
  321. int i = HasTrap(tile);
  322. if(i == -1){
  323. return false;
  324. }
  325. if(i >= 19170 && i <= 19210){
  326. return true;
  327. }
  328. return false;
  329. }
  330.  
  331. public boolean HasTrapItem(RSTile tile){
  332. if(tile == null){
  333. return false;
  334. }
  335. RSItemTile[] itemtile = getGroundItemsAt(tile);
  336. int i = 0;
  337. for(i = 0; i < itemtile.length; i++){
  338. if(itemtile[i].getItem().getID() == TrapItem){
  339. return true;
  340. }
  341. }
  342.  
  343. return false;
  344. }
  345.  
  346. public void SetTrapFalse(int TrapNum){
  347. Trap[TrapNum] = false;
  348. }
  349.  
  350. public int CheckTrap(int TrapNum){
  351. if(Trap[TrapNum] == true){
  352. if(HasTrap(TrapPos[TrapNum]) == TrapCaught || HasTrap(TrapPos[TrapNum]) == TrapFailed){
  353. return HasTrap(TrapPos[TrapNum]);
  354. }
  355. if(HasTrapItem(TrapPos[TrapNum])){
  356. return TrapItem;
  357. }
  358. }
  359. return -1;
  360. }
  361.  
  362. public int TrapsLaid(){
  363. int i, count = 0;
  364. for(i=0; i<numTraps; i++){
  365. if(Trap[i] == true){
  366. count++;
  367. }
  368. }
  369. return count;
  370. }
  371.  
  372. public int LaidTrapsLaid(){
  373. int i, count = 0;
  374. for(i=0; i<numTraps; i++){
  375. if(Trap[i] == true && HasTrapSet(TrapPos[i]) == true){
  376. count++;
  377. }
  378. }
  379. return count;
  380. }
  381.  
  382. public boolean TrapClick(RSTile tile, boolean lay){
  383. if(HasTrapItem(tile) == true && lay == true){
  384. weirdMouseMove(tile, "Lay");
  385. return true;
  386. }else if(HasTrapItem(tile) == true && lay == false){
  387. weirdMouseMove(tile, "Take");
  388. return true;
  389. }else if(HasTrap(tile) == TrapCaught){
  390. weirdMouseMove(tile, "Check");
  391. return true;
  392. }else if(HasTrap(tile) == TrapFailed){
  393. weirdMouseMove(tile, "Dismantle");
  394. return true;
  395. }
  396. return false;
  397. }
  398.  
  399. public boolean TrapRetrieve(int TrapNum){
  400. if(Trap[TrapNum] == false){
  401. return false;
  402. }
  403. if(CheckTrap(TrapNum) == -1){
  404. return false;
  405. }
  406. int i = 0;
  407. if(HasTrapLaid(TrapPos[TrapNum]) && HasTrapItem(TrapPos[TrapNum])){
  408. TrapClick(TrapPos[TrapNum], false);
  409. waitToMove(random(1000, 2000));
  410. for(; getMyPlayer().isMoving(); wait(random(20, 25)));
  411. whichTrap--;
  412. return true;
  413. }
  414. TrapClick(TrapPos[TrapNum], true);
  415. if(HasTrapItem(TrapPos[TrapNum])){
  416. for(i = 0;HasTrapSet(TrapPos[TrapNum]) == false;i++){
  417. wait(random(20,25));
  418. if(i > 200){
  419. return false;
  420. }
  421. }
  422. checkThing = 0;
  423. return true;
  424. }
  425. for(i = 0;CheckTrap(TrapNum) != -1;i++){
  426. wait(random(20,25));
  427. if(i > 200){
  428. return false;
  429. }
  430. }
  431. SetTrapFalse(TrapNum);
  432. checkThing = 0;
  433. whichTrap--;
  434. wait(random(200,250));
  435. if(!tileCompare(getMyPlayer().getLocation(), TrapPos[TrapNum])){
  436. weirdWalk(TrapPos[TrapNum]);
  437. if(waitToMove(random(1000, 2000)) == false){
  438. return false;
  439. }
  440. AntiBan(12, false);
  441. for(; getMyPlayer().isMoving(); wait(random(20, 25)));
  442. }
  443. return true;
  444. }
  445.  
  446. public boolean TrapLay(int TrapNum) {
  447. if(Trap[TrapNum] == true){
  448. return false;
  449. }
  450. int i = 0;
  451. RSTile Spot = TrapPos[TrapNum];
  452. Point TrapPoint = new Point(-1, -1);
  453. if(HasTrapLaid(Spot) || HasTrapItem(Spot)){
  454. for(;waitForAnim(20) != -1; wait(random(20,25)));
  455. for(;getMyPlayer().isMoving(); wait(random(20,25)));
  456. TrapClick(Spot, false);
  457. if(HasTrap(Spot) == TrapFailed || HasTrap(Spot) == TrapCaught){
  458. waitForAnim(random(1000, 2000));
  459. for(;waitForAnim(20) == TrapRetrieveAnim; wait(random(20,25)));
  460. }else if(HasTrapItem(Spot)){
  461. waitToMove(random(1000, 2000));
  462. for(;getMyPlayer().isMoving(); wait(random(20,25)));
  463. }
  464. return false;
  465. }
  466. if(!tileCompare(getMyPlayer().getLocation(), Spot)){
  467. weirdWalk(Spot);
  468. if(waitToMove(random(1000, 2000)) == false){
  469. return false;
  470. }
  471. AntiBan(12, false);
  472. for(; getMyPlayer().isMoving(); wait(random(20, 25)));
  473. }
  474. if(!tileCompare(getMyPlayer().getLocation(), Spot)){
  475. return false;
  476. }
  477. clickInventoryItem(TrapItem);
  478. AntiBan(13, false);
  479. for(i = 0;HasTrapSet(Spot) == false;i++){
  480. wait(random(20,25));
  481. if(i > 200){
  482. return false;
  483. }
  484. }
  485. checkThing = 0;
  486. if(Trap[TrapNum] == false){
  487. Trap[TrapNum] = true;
  488. return true;
  489. }else{
  490. return false;
  491. }
  492. }
  493.  
  494. public void ResetStuff(){
  495. int i;
  496. for(i=0; i<5; i++){
  497. if(Trap[i] == true && !HasTrapLaid(TrapPos[i]) && !HasTrapItem(TrapPos[i])){
  498. SetTrapFalse(i);
  499. }
  500. }
  501. }
  502.  
  503. public boolean weirdWalk(RSTile tile){
  504. Point p = new Point(-1, -1);
  505. do{
  506. p = Calculations.tileToScreen(tile);
  507. if(p.x == -1 || p.y == -1){
  508. return false;
  509. }
  510. moveMouse(p,random(-3,3),random(-3,3));
  511. wait(random(20, 25));
  512. }while(!atMenu("Walk Here"));
  513. wait(random(40,50));
  514. return true;
  515. }
  516.  
  517. public boolean weirdMouseMove(RSTile tile, String action){
  518. Point p = new Point(-1, -1);
  519. int i = 0;
  520. boolean check = false;
  521. do{
  522. if(i > 2){
  523. for(;waitForAnim(20) != -1; wait(random(20,25)));
  524. for(;getMyPlayer().isMoving(); wait(random(20,25)));
  525. }
  526. if(i > 30){
  527. return false;
  528. }
  529. p = Calculations.tileToScreen(tile);
  530. if(p.x == -1 || p.y == -1){
  531. return false;
  532. }
  533. moveMouse(p,random(-10,10),random(-10,10));
  534. wait(random(20, 25));
  535. if(getMenuIndex(action) != -1){
  536. //if (getMenuItems().get(0).toLowerCase().contains(action.toLowerCase())) {
  537. //clickMouse(true);
  538. //check = true;
  539. //} else {
  540. //clickMouse(false);
  541. wait(random(20,25));
  542. check = atMenu(action);
  543. //}
  544. }
  545. i++;
  546. if(i % 10 == 0){
  547. setCameraRotation(random(1, 359));
  548. setCameraAltitude(random(60.0, 80.0));
  549. }
  550. }while(!check);
  551. return true;
  552. }
  553.  
  554. public boolean tileCompare(RSTile tile1, RSTile tile2){
  555. if(tile1 == null || tile2 == null){
  556. return false;
  557. }
  558. if(tile1.getX() == tile2.getX() && tile1.getY() == tile2.getY()){
  559. return true;
  560. }
  561. return false;
  562. }
  563.  
  564. public RSTile nearestTile(RSTile[] tiles){
  565. int i, closest = 0;
  566. for(i=1;i<tiles.length;i++){
  567. if(distanceTo(tiles[i]) < distanceTo(tiles[closest])){
  568. closest = i;
  569. }
  570. }
  571. return tiles[closest];
  572. }
  573.  
  574. public void SetupSpots(){
  575. if(skills.getCurrentSkillLevel(Constants.STAT_HUNTER) < 20){
  576. numTraps = 1;
  577. }else if(skills.getCurrentSkillLevel(Constants.STAT_HUNTER) < 40){
  578. numTraps = 2;
  579. }else if(skills.getCurrentSkillLevel(Constants.STAT_HUNTER) < 60){
  580. numTraps = 3;
  581. }else if(skills.getCurrentSkillLevel(Constants.STAT_HUNTER) < 80){
  582. numTraps = 4;
  583. }else{
  584. numTraps = 5;
  585. }
  586.  
  587. switch(numTraps){
  588. case 5:
  589. TrapPos[4] = new RSTile(HuntingArea.getX(), HuntingArea.getY());
  590. case 4:
  591. TrapPos[3] = new RSTile(HuntingArea.getX() - 1, HuntingArea.getY() - 1);
  592. case 3:
  593. TrapPos[2] = new RSTile(HuntingArea.getX() + 1, HuntingArea.getY() - 1);
  594. case 2:
  595. TrapPos[1] = new RSTile(HuntingArea.getX() - 1, HuntingArea.getY() + 1);
  596. case 1:
  597. TrapPos[0] = new RSTile(HuntingArea.getX() + 1, HuntingArea.getY() + 1);
  598. break;
  599. default:
  600. break;
  601. }
  602. }
  603.  
  604. public void AntiBan(int r, final boolean Random) { // Made By Drizzt1112, edited a bit
  605. if (Random) {
  606. r = random(0, 20);
  607. }
  608. switch (r) {
  609. case 1:
  610. setCameraRotation(random(1, 359));
  611. break;
  612. case 2:
  613. setCameraAltitude(random(60.0, 80.0));
  614. break;
  615. case 3:
  616. case 4:
  617. case 5:
  618. case 6:
  619. moveMouse(random(1, 760), random(1, 499));
  620. break;
  621. case 7:
  622. //openTab(random(0, 12));
  623. //break;
  624. case 8:
  625. setCameraRotation(random(1, 359));
  626. setCameraAltitude(random(60.0, 80.0));
  627. break;
  628. case 9:
  629. int x = input.getX();
  630. int y = input.getY();
  631. moveMouse(x + random(-65, 75), y + random(-60, 70));
  632. x = input.getX();
  633. y = input.getY();
  634. moveMouse(x + random(-75, 70), y + random(-78, 69));
  635. x = input.getX();
  636. y = input.getY();
  637. moveMouse(x + random(-72, 74), y + random(-64, 72));
  638. x = input.getX();
  639. y = input.getY();
  640. moveMouse(x + random(-65, 64), y + random(-78, 66));
  641. break;
  642. case 10:
  643. case 11:
  644. if (getCurrentTab() != Constants.TAB_STATS) {
  645. openTab(Constants.TAB_STATS);
  646. }
  647. clickMouse(random(716, 721), random(415, 430), true);
  648. wait(random(100,200));
  649. moveMouse(random(613, 633), random(421, 441));
  650. wait(random(400,500));
  651. if (getCurrentTab() != Constants.TAB_INVENTORY) {
  652. openTab(Constants.TAB_INVENTORY);
  653. }
  654. break;
  655. case 12:
  656. moveMouse(650, 250, random(-80, 80), random(-60, 60));
  657. break;
  658. case 13:
  659. Point p = Calculations.tileToScreen(HuntingArea);
  660. if(p.x == -1 || p.y == -1){
  661. break;
  662. }
  663. moveMouse(p, random(-100, 100), random(-100, 100));
  664. break;
  665. case 14:
  666. case 15:
  667. final int x2 = input.getX();
  668. final int y2 = input.getY();
  669. moveMouse(x2 + random(-80, 80), y2 + random(-80, 80));
  670. break;
  671. case 16:
  672. case 17:
  673. case 18:
  674. case 19:
  675. final int x3 = random(0, 710);
  676. final int y3 = random(0, 420);
  677. moveMouse(40, 80, x3, y3);
  678. break;
  679. default:
  680. break;
  681. }
  682. }
  683.  
  684. public int loop() {
  685. if (!isLoggedIn() || RSInterface.getInterface(378).getChild(45).getAbsoluteX() > 20 || !RSInterface.getInterface(149).isValid()) {//Credits to Ruski
  686. return random(1200, 3100);
  687. }
  688.  
  689. if(logoutCheck == true){
  690. logout();
  691. stopAllScripts();
  692. }
  693.  
  694. if(isRunning() == false){
  695. setRun(true);
  696. wait(random(500,1000));
  697. }
  698.  
  699. /*if(loopyThing == 0){
  700. HuntingArea = nearestTile(HuntingAreas);
  701. }*/
  702.  
  703. if(loopyThing == 0){
  704. SetupSpots();
  705. }
  706.  
  707. if(dropStuff == 1){
  708. if(getInventoryCount(bones) > 0){
  709. if(buryBones){
  710. clickInventoryItem(bones);
  711. }else{
  712. atInventoryItem(bones, "Drop");
  713. }
  714. wait(random(1000,1500));
  715. }
  716. if(getInventoryCount(birdmeat) > 0){
  717. atInventoryItem(birdmeat, "Drop");
  718. return(random(1000,1500));
  719. }
  720. }else if(dropStuff == 2){
  721. if(getInventoryCount(ferret) > 0){
  722. atInventoryItem(ferret, "Release");
  723. return(random(1000,1500));
  724. }
  725. }
  726.  
  727. if(distanceTo(HuntingArea) >= 4) {
  728. if(!tileOnScreen(HuntingArea)){
  729. walkTileMM(HuntingArea);
  730. }else{
  731. weirdWalk(HuntingArea);
  732. }
  733. waitToMove(random(1000, 2000));
  734. for(; getMyPlayer().isMoving(); wait(random(200, 250)));
  735. return random(200, 250);
  736. }
  737.  
  738. if(inventoryContains(TrapItem)) {
  739. if(TrapsLaid() != numTraps){
  740. if(TrapLay(whichTrap)){
  741. }
  742. }
  743. }
  744.  
  745. if(TrapRetrieve(whichTrap)){
  746. }
  747.  
  748. if(whichTrap == -1){
  749. whichTrap = numTraps - 1;
  750. }
  751.  
  752. whichTrap++;
  753. checkThing++;
  754.  
  755. if(whichTrap == numTraps){
  756. whichTrap = 0;
  757. }
  758.  
  759. if(checkThing >= 4 || lagThing){
  760. for(;waitForAnim(20) != -1; wait(random(20,25)));
  761. for(;getMyPlayer().isMoving(); wait(random(20,25)));
  762. }
  763.  
  764. if(LaidTrapsLaid() == numTraps && checkThing >= random(100,200)){
  765. if(!tileCompare(getMyPlayer().getLocation(), HuntingArea)){
  766. weirdWalk(HuntingArea);
  767. waitToMove(random(1000, 2000));
  768. for(; getMyPlayer().isMoving(); wait(random(200, 250)));
  769. }
  770. }
  771.  
  772. if(RSInterface.getInterface(149).isValid()){
  773. if(TrapsLaid() < numTraps && !inventoryContains(TrapItem)){
  774. logoutCheck = true;
  775. log("Not enough Traps.");
  776. }
  777. }else{
  778. return random(1800,2000);
  779. }
  780.  
  781. loopyThing++;
  782. if(loopyThing == (5*numTraps+20)){
  783. AntiBan(0, true);
  784. loopyThing = 0;
  785. for(;waitForAnim(20) != -1; wait(random(20,25)));
  786. for(;getMyPlayer().isMoving(); wait(random(20,25)));
  787. ResetStuff();
  788. }
  789.  
  790. return random((140/numTraps), (160/numTraps));
  791. }
  792.  
  793. public void onRepaint(final Graphics g) {
  794. if (g == null){
  795. return;
  796. }
  797. if(!isLoggedIn()){
  798. return;
  799. }
  800.  
  801. final Color BG = new Color(0, 0, 0, 75);
  802. final Color RED = new Color(255, 0, 0, 255);
  803. final Color GREEN = new Color(0, 255, 0, 255);
  804. final Color BLACK = new Color(0, 0, 0, 255);
  805.  
  806. if (startTime == 0) {
  807. startTime = System.currentTimeMillis();
  808. }
  809.  
  810. if (startExp == 0) {
  811. startExp = skills.getCurrentSkillExp(Constants.STAT_HUNTER);
  812. }
  813.  
  814. if (startLevel == 0) {
  815. startLevel = skills.getCurrentSkillLevel(Constants.STAT_HUNTER);
  816. }
  817.  
  818. runTime = System.currentTimeMillis() - startTime;
  819. seconds = runTime / 1000;
  820. if (seconds >= 60) {
  821. minutes = seconds / 60;
  822. seconds -= minutes * 60;
  823. }
  824. if (minutes >= 60) {
  825. hours = minutes / 60;
  826. minutes -= hours * 60;
  827. }
  828.  
  829. gainedExp = skills.getCurrentSkillExp(Constants.STAT_HUNTER) - startExp;
  830. expToLevel = skills.getXPToNextLevel(Constants.STAT_HUNTER);
  831.  
  832. if ((minutes > 0 || hours > 0 || seconds > 0) && gainedExp > 0) {
  833. secExp = ((float) gainedExp)/(float)(seconds + (minutes*60) + (hours*60*60));
  834. }
  835. minuteExp = secExp * 60;
  836. hourExp = minuteExp * 60;
  837.  
  838. if(secExp > 0){
  839. secToLevel = (int)(expToLevel/(secExp));
  840. }
  841. if (secToLevel >= 60) {
  842. minutesToLevel = secToLevel / 60;
  843. secToLevel -= minutesToLevel * 60;
  844. }else{
  845. minutesToLevel = 0;
  846. }
  847. if (minutesToLevel >= 60) {
  848. hoursToLevel = minutesToLevel / 60;
  849. minutesToLevel -= hoursToLevel * 60;
  850. }else{
  851. hoursToLevel = 0;
  852. }
  853.  
  854. secToLevel = secToLevel;
  855. minutesToLevel = minutesToLevel;
  856. hoursToLevel = hoursToLevel;
  857.  
  858. g.setFont(new Font("Tahoma", Font.PLAIN, 10));
  859. g.setColor(BG);
  860. g.fill3DRect(345, 10, 160, 140, true);
  861. g.setColor(BLACK);
  862. g.drawString(getName() + " v" + getVersion(), 350+1, 25+1);
  863. g.setColor(Color.white);
  864. g.drawString(getName() + " v" + getVersion(), 350, 25);
  865. g.drawString("Running for: " + hours + ":" + minutes + ":" + seconds, 350, 40);
  866. g.drawString("Exp Gained: " + gainedExp + " (" + (skills.getCurrentSkillLevel(Constants.STAT_HUNTER) - startLevel) + ")", 350, 55);
  867. g.drawString("Stuff Caught: " + numCaught, 350, 70);
  868. g.drawString("Exp per hour: " + (int)hourExp, 350, 85);
  869. g.drawString("Exp to level: " + expToLevel + " (" + (int)((expToLevel/expPer)+0.5) + " catches)", 350, 100);
  870. g.drawString("Time to level: " + hoursToLevel + ":" + minutesToLevel + ":" + secToLevel, 350, 115);
  871. g.drawString("Progress to next level:", 350, 130);
  872. g.setColor(RED);
  873. g.fill3DRect(350, 135, 100, 10, true);
  874. g.setColor(GREEN);
  875. g.fill3DRect(350, 135, skills.getPercentToNextLevel(Constants.STAT_HUNTER), 10, true);
  876. g.setColor(BLACK);
  877. g.drawString(skills.getPercentToNextLevel(Constants.STAT_HUNTER) + "% to " + (skills.getCurrentSkillLevel(Constants.STAT_HUNTER) + 1), 380, 144);
  878. try{
  879. int i = 0;
  880. g.setColor(Color.white);
  881. g.drawString("Which Trap: " + whichTrap, 5, 120);
  882. g.drawString("Check Thing: " + checkThing, 5, 135);
  883. for(i=0; i<numTraps; i++){
  884. g.drawString("TrapPos" + i + ": " + TrapPos[i].toString(), 5, 150+(i*15));
  885. }
  886. for(i=0; i<numTraps; i++){
  887. g.drawString("Trap" + i + ": " + Boolean.toString(Trap[i]), 5, 150+(numTraps*15)+(i*15));
  888. }
  889. } catch (final Exception e) {
  890. }
  891. }
  892.  
  893. public void serverMessageRecieved(ServerMessageEvent e) {
  894. String message = e.getMessage().toLowerCase();
  895. if(message.contains("caught")){
  896. numCaught++;
  897. }
  898. }
  899.  
  900. }
  901.