Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.Color;
- import java.awt.Font;
- import java.awt.Graphics;
- import java.awt.Graphics2D;
- import java.awt.Image;
- import java.awt.Point;
- import java.io.IOException;
- import java.net.URL;
- import java.util.ArrayList;
- import javax.imageio.ImageIO;
- import com.rarebot.event.listeners.PaintListener;
- import com.rarebot.script.Script;
- import com.rarebot.script.ScriptManifest;
- import com.rarebot.script.methods.Skills;
- import com.rarebot.script.util.Timer;
- import com.rarebot.script.wrappers.RSArea;
- import com.rarebot.script.wrappers.RSGroundItem;
- import com.rarebot.script.wrappers.RSNPC;
- import com.rarebot.script.wrappers.RSTile;
- @ScriptManifest(authors = { "Swipe" }, name = "ExtremeHunter")
- public class ExtremeHunter extends Script implements PaintListener {
- // START: Code generated using Enfilade's Easel
- private Image getImage(String url) {
- try {
- return ImageIO.read(new URL(url));
- } catch (IOException e) {
- return null;
- }
- }
- private final int GREY_CHIN = 5079;
- private final int trapItem = 10008;
- private final int trapFailed = 19192;
- private final int trapCaught = 19190;
- private final int trapSetup = 19187;
- public final RSArea maBANK = new RSArea(new RSTile[] {
- new RSTile(2399, 2845), new RSTile(2399, 2838),
- new RSTile(2405, 2838), new RSTile(2405, 2844) });
- public final RSArea C_SWIFT = new RSArea(new RSTile[] {
- new RSTile(2606, 2933), new RSTile(2602, 2914),
- new RSTile(2606, 2910), new RSTile(2616, 2918),
- new RSTile(2622, 2927), new RSTile(2615, 2935) });
- public final RSArea T_WAGTAIL = new RSArea(new RSTile[] {
- new RSTile(2518, 2901), new RSTile(2520, 2917),
- new RSTile(2507, 2917), new RSTile(2507, 2904) });
- public final RSArea G_CHIN = new RSArea(new RSTile[] {
- new RSTile(2345, 3540), new RSTile(2345, 3540),
- new RSTile(2345, 3526), new RSTile(2357, 3526),
- new RSTile(2353, 3533), new RSTile(2358, 3540) });
- public final RSArea R_CHIN = new RSArea(new RSTile[] {
- new RSTile(2517, 2905), new RSTile(2516, 2886),
- new RSTile(2542, 2886), new RSTile(2539, 2902) });
- private final Image img1 = getImage("http://i.imgur.com/JlOte.png");
- // private final Image troll =
- // getImage("http://revolushii.ro/forum/Smileys/smileys/trollface.png");
- private String status = "Hunting";
- private int expGain = 0;
- private final int raw_meat = 9978;
- private final int BIRD_SNARE = 10006;
- private final int SET_SNARE = 19175;
- private final int[] DONE_SNARE = { 19180, 19178 };
- private final int C_SWIFT_ID = 5073;
- private final int T_WAG_ID = 5072;
- private final int trapID = 10008;
- int startLevel;
- private int fail = 300;
- private boolean banking;
- private ArrayList<RSTile> mySnares = new ArrayList<RSTile>();
- private long startTime;
- RSTile mainTrap;
- int startExp;
- public Job[] jobs = getJobs();
- final int butterflyJar = 10012;
- final int[] dropIDs = { 9978, 10115, 10125, 10127 }, buryIDs = { 526 },
- releaseIDs = { 10149, 10146, 10147, 10148, 10092 }, trapIDs = {
- 10006, 10008, 303, 954, 19965 }, layedTraps = { 19187,
- 19175, 19678, 19650, 19662 }, failedTraps = { 19192, 19174,
- 56813 }, layTrapHere = { 19679, 19652, 19663 },
- collapsedTraps = { 19190, 19180, 19178, 19182, 19189, 19675, 19186,
- 19654, 19659, 19184, 56819, 19191, 56821 },
- catchedButterflies = { 10014, 10016, 10018, 10020 },
- falconTargets = { 5098, 5099, 5100 }, falconSuccessful = { 5094,
- 5095, 5096 };
- RSTile startLoc, clickedFalcon;
- Image Background, Background2, Show, turnOffImage, startImg;
- boolean[] huntTrap = { false, false, false, false, true, false, false,
- false, false };
- RSTile[] traps = { null, null, null, null, null }, notMyFalcons = { null,
- null, null, null, null };
- int[] objAt = { 0, 0, 0, 0, 0 }, trapsX = { 0, 0, 0, 0, 0 }, trapsY = { 0,
- 0, 0, 0, 0 }, butterflyIDs = { 5082, 5084, 5085 },
- butterflyIDs2 = { 5082, 5083, 5084, 5085 };
- int[] jujuPot = { 20026, 20025, 20024, 20023 };
- /* Defining areas */
- final int[] bankArea = { 3507, 3475, 3513, 3483 }, swampLizardArea = {
- 3533, 3432, 3581, 3454 }, orangeSalamanderArea = { 3398, 3072,
- 3422, 3151 }, redSalamanderArea = { 2440, 3210, 2482, 3261 },
- falconryArea = { 2364, 3573, 2392, 3619 };
- final int[][] swampLizard = { { 3546, 3437, 3555, 3443 },
- { 3547, 3448, 3558, 3454 }, { 3535, 3450, 3539, 3452 } },
- orangeSalamander = { { 3410, 3072, 3417, 3079 },
- { 3408, 3080, 3413, 3083 }, { 3402, 3086, 3412, 3094 },
- { 3400, 3099, 3406, 3102 }, { 3401, 3131, 3410, 3136 } },
- redSalamander = { { 2466, 3234, 2480, 3246 },
- { 2445, 3220, 2452, 3228 }, { 2450, 3216, 2456, 3222 } },
- butterflyAreas = { { 2537, 2898, 2570, 2917 },
- { 2306, 3506, 2361, 3621 }, { 2690, 3758, 2747, 3802 },
- { 2702, 3803, 2740, 3838 } },
- butterflyStartingLocations = { { 2558, 2910 }, { 2322, 3600 },
- { 2714, 3792 }, { 2711, 3822 } };
- private void drawTile(Graphics render, RSTile tile, Color color) {
- Point southwest = calc.tileToScreen(tile, 0, 0, 0);
- Point southeast = calc.tileToScreen(
- new RSTile(tile.getX() + 1, tile.getY()), 0, 0, 0);
- Point northwest = calc.tileToScreen(new RSTile(tile.getX(),
- tile.getY() + 1), 0, 0, 0);
- Point northeast = calc.tileToScreen(
- new RSTile(tile.getX() + 1, tile.getY() + 1), 0, 0, 0);
- if (calc.pointOnScreen(southwest) && calc.pointOnScreen(southeast)
- && calc.pointOnScreen(northwest)
- && calc.pointOnScreen(northeast)) {
- render.setColor(Color.BLACK);
- render.drawPolygon(new int[] { (int) northwest.getX(),
- (int) northeast.getX(), (int) southeast.getX(),
- (int) southwest.getX() },
- new int[] { (int) northwest.getY(), (int) northeast.getY(),
- (int) southeast.getY(), (int) southwest.getY() }, 4);
- render.setColor(color);
- render.fillPolygon(new int[] { (int) northwest.getX(),
- (int) northeast.getX(), (int) southeast.getX(),
- (int) southwest.getX() },
- new int[] { (int) northwest.getY(), (int) northeast.getY(),
- (int) southeast.getY(), (int) southwest.getY() }, 4);
- }
- }
- public void onRepaint(Graphics g1) {
- Graphics2D g = (Graphics2D) g1;
- g.drawImage(img1, 0, 336, null);
- g.setColor(Color.black);
- g.setFont(new Font("Arial", 0, 12));
- g.drawString(status, 108, 395);
- expGain = skills.getCurrentExp(Skills.HUNTER) - startExp;
- g.drawString(expGain + " (+"
- + (skills.getRealLevel(Skills.HUNTER) - startLevel) + ") ",
- 148, 418);
- if (ChinTraps != null) {
- if (getCurrentJob().reqLevel() == 53) {
- g.drawString(
- (skills.getCurrentExp(Skills.HUNTER) - startExp)
- / 198
- + " Chins = "
- + ((skills.getCurrentExp(Skills.HUNTER) - startExp) / 198)
- * 655 + " gp", 250, 410);
- } else {
- g.drawString(
- (skills.getCurrentExp(Skills.HUNTER) - startExp)
- / 255
- + " Chins = "
- + ((skills.getCurrentExp(Skills.HUNTER) - startExp) / 255)
- * 905 + " gp", 250, 410);
- }
- }
- g.drawString(
- ""
- + (int) (((expGain)) * 3600000D / (System
- .currentTimeMillis() - startTime)) + " (+"
- + (skills.getRealLevel(Skills.HUNTER) - startLevel)
- * 3600000D / (System.currentTimeMillis() - startTime)
- + ") ", 112, 435);
- g.drawString(
- Timer.format(skills.getTimeTillNextLevel(Skills.HUNTER,
- (int) ((skills.getRealLevel(Skills.HUNTER) - startLevel) * 3600000D / (System
- .currentTimeMillis() - startTime)), System.currentTimeMillis() - startTime))
- + " || Total Time: "
- + Timer.format(System.currentTimeMillis() - startTime),
- 180, 454);
- g.setColor(new Color(250, 20, 20, 180));
- g.fillRoundRect(245, 385, 196, 12, 16, 16);
- g.setColor(new Color(20, 220, 20, 180));
- g.fillRoundRect(
- 245,
- 385,
- (int) ((int) skills.getPercentToNextLevel(Skills.HUNTER) * 1.96),
- 12, 16, 16);
- g.setColor(Color.BLACK);
- g.drawString(
- skills.getPercentToNextLevel(Skills.HUNTER) + "% to Level "
- + (skills.getCurrentLevel(Skills.HUNTER) + 1)
- + " Hunter - ("
- + skills.getExpToNextLevel(Skills.HUNTER) + ")", 250,
- 395);
- Point mLoc = mouse.getLocation();
- g.setColor(new Color(20, 230, 40, 180));
- g.drawLine(mLoc.x, 0, mLoc.x, 502);
- g.drawLine(0, mLoc.y, 764, mLoc.y);
- for (RSTile t : mySnares) {
- drawTile(g, t, new Color(200, 200, 200, 100));
- g.fillRect(calc.tileToMinimap(t).x, calc.tileToMinimap(t).y, 4, 4);
- g.setColor(new Color(30, 220, 80, 120));
- // objects.getTopAt(t).getModel().drawWireFrame(g);
- }
- RSNPC[] bird = npcs.getAll(C_SWIFT_ID, T_WAG_ID);
- for (int i = 0; i < mySnares.size(); i++) {
- for (RSNPC npc : bird) {
- g.drawLine(calc.tileToMinimap(npc.getLocation()).x,
- calc.tileToMinimap(npc.getLocation()).y,
- calc.tileToMinimap(mySnares.get(i)).x,
- calc.tileToMinimap(mySnares.get(i)).y);
- g.setColor(Color.WHITE);
- if (npc.isOnScreen()) {
- // g.drawImage(troll, npc.getModel().getPointOnScreen().x,
- // npc
- // .getModel().getPointOnScreen().y, null);
- g.drawString(
- "Distance (Trap "
- + (i + 1)
- + ")"
- + ": "
- + calc.distanceBetween(npc.getLocation(),
- mySnares.get(i)), npc.getModel()
- .getPointOnScreen().x, npc.getModel()
- .getPointOnScreen().y + (i * 8));
- }
- }
- }
- if (fail < 300) {
- g.drawString("FUCK! WE FAILED", 10, 10);
- fail++;
- }
- if (ChinTraps != null) {
- for (RSTile t : ChinTraps) {
- switch (objects.getTopAt(t).getID()) {
- case trapSetup:
- drawTile(g, t, Transparent(Color.YELLOW, 80));
- break;
- case trapFailed:
- drawTile(g, t, Transparent(Color.RED, 80));
- break;
- case 19189:
- drawTile(g, t, Transparent(Color.GREEN, 80));
- break;
- case 19190:
- drawTile(g, t, Transparent(Color.GREEN, 80));
- break;
- }
- }
- }
- }
- private Color Transparent(Color c, int trans) {
- return new Color(c.getRed(), c.getGreen(), c.getBlue(), trans);
- }
- private int getMaxTrapAmount() {
- int lvl = skills.getRealLevel(skills.HUNTER);
- if (lvl >= 80) {
- return 5;
- } else if (lvl >= 60) {
- return 4;
- } else if (lvl >= 40) {
- return 3;
- } else if (lvl >= 20) {
- return 2;
- }
- return 1;
- }
- private RSTile MainTrap;
- private RSTile[] getWagTraps() {
- switch (getMaxTrapAmount()) {
- case 2:
- return new RSTile[] {
- getMyPlayer().getLocation(),
- new RSTile(getMyPlayer().getLocation().getX() - 1,
- getMyPlayer().getLocation().getY() - 1) };
- case 3:
- return new RSTile[] {
- getMyPlayer().getLocation(),
- new RSTile(getMyPlayer().getLocation().getX() - 1,
- getMyPlayer().getLocation().getY() + 1),
- new RSTile(getMyPlayer().getLocation().getX() - 1,
- getMyPlayer().getLocation().getY() - 1) };
- }
- return null;
- }
- private RSTile[] getChinTraps() {
- switch (getMaxTrapAmount()) {
- case 3:
- return new RSTile[] {
- getMyPlayer().getLocation(),
- new RSTile(getMyPlayer().getLocation().getX() - 1,
- getMyPlayer().getLocation().getY() + 1),
- new RSTile(getMyPlayer().getLocation().getX() - 1,
- getMyPlayer().getLocation().getY() - 1) };
- case 4:
- return new RSTile[] {
- getMyPlayer().getLocation(),
- new RSTile(getMyPlayer().getLocation().getX() - 1,
- getMyPlayer().getLocation().getY() + 1),
- new RSTile(getMyPlayer().getLocation().getX() - 1,
- getMyPlayer().getLocation().getY() - 1),
- new RSTile(getMyPlayer().getLocation().getX() - 2,
- getMyPlayer().getLocation().getY()) };
- case 5:
- return new RSTile[] {
- getMyPlayer().getLocation(),
- new RSTile(getMyPlayer().getLocation().getX() - 1,
- getMyPlayer().getLocation().getY() - 1),
- new RSTile(getMyPlayer().getLocation().getX() - 1,
- getMyPlayer().getLocation().getY() + 1),
- new RSTile(getMyPlayer().getLocation().getX() + 1,
- getMyPlayer().getLocation().getY() + 1),
- new RSTile(getMyPlayer().getLocation().getX() + 1,
- getMyPlayer().getLocation().getY() - 1) };
- }
- return null;
- }
- private RSTile[] WagTraps;
- private RSTile[] ChinTraps;
- private Job[] getJobs() {
- Action snareWalkBank = new Action() {
- private int DUEL_RING;
- boolean activate() {
- return inventory.getCount(BIRD_SNARE) == 0;
- }
- void run() {
- banking = true;
- equipment.getItem(DUEL_RING).interact("rub");
- mouse.click(
- interfaces.getAllContaining("Mobil")[0].getLocation(),
- true);
- web.getWeb(maBANK.getCentralTile()).step();
- }
- };
- Action snareBank = new Action() {
- boolean activate() {
- return banking == true
- && maBANK.contains(getMyPlayer().getLocation());
- }
- void run() {
- if (!bank.isOpen()) {
- bank.open();
- } else if (bank.isOpen()) {
- // If the bone is not null, withdraw it
- if (bank.getItem(BIRD_SNARE) != null) {
- bank.withdraw(BIRD_SNARE, 24);
- bank.close();
- }
- // If the bird snare is null, stop the script
- else {
- log("You have no snares in the bank, stopping script!");
- env.saveScreenshot(true);
- stopScript();
- }
- }
- }
- };
- Action placeSnare = new Action() {
- boolean activate() {
- return mySnares.size() < getMaxTrapAmount();
- }
- void run() {
- if (MainTrap == null
- || !getCurrentJob().mainArea().contains(MainTrap)) {
- MainTrap = getMyPlayer().getLocation();
- }
- while (calc.distanceTo(MainTrap) > 0) {
- walking.walkTileOnScreen(MainTrap);
- }
- mySnares.add(MainTrap);
- inventory.getItem(BIRD_SNARE).doClick(true);
- sleep(5000);
- }
- };
- Action collectSnare = new Action() {
- boolean activate() {
- for (RSTile t : mySnares) {
- if (objects.getTopAt(t) != null
- && objects.getTopAt(t).getID() == DONE_SNARE[0]) {
- MainTrap = t;
- return true;
- }
- }
- return false;// TODO
- }
- void run() {
- objects.getTopAt(MainTrap).doClick();
- sleep(500);
- expGain += 34;
- mySnares.remove(MainTrap);
- }
- };
- Action fallenSnare = new Action() {
- boolean activate() {
- RSGroundItem g = groundItems.getNearest(BIRD_SNARE);
- if (g != null) {
- for (RSTile t : mySnares) {
- if (g.getLocation().equals(t))
- return true;
- }
- }
- return false;
- }
- void run() {
- RSGroundItem k = groundItems.getNearest(BIRD_SNARE);
- if (k != null)
- k.interact("Lay");
- sleep(2000);
- }
- };
- Job CRIMSON_SWIFTS = new Job() {
- int reqLevel() {
- return 1;
- }
- int endLevel() {
- return 20;
- }
- public RSArea mainArea() {
- return C_SWIFT;
- }
- };
- CRIMSON_SWIFTS.Steps.add(placeSnare);
- CRIMSON_SWIFTS.Steps.add(collectSnare);
- CRIMSON_SWIFTS.Steps.add(fallenSnare);
- // //////////////////////////////////////////////////////////////////
- Action fallenWagSnare = new Action() {
- RSTile Next;
- boolean activate() {
- RSGroundItem g = groundItems.getNearest(BIRD_SNARE);
- if (g != null) {
- for (RSTile t : mySnares) {
- if (g.getLocation().equals(t)) {
- if (objects.getTopAt(t) == null) {
- if (mySnares.size() == getMaxTrapAmount()) {
- Next = t;
- return true;
- }
- }
- }
- }
- }
- return false;
- }
- void run() {
- RSGroundItem k = groundItems.getNearest(BIRD_SNARE);
- if (k != null)
- k.interact("Lay");
- sleep(2000);
- }
- };
- Action placeWagSnare = new Action() {
- boolean activate() {
- return mySnares.size() < getMaxTrapAmount();
- }
- void run() {
- RSTile Next = null;
- if (WagTraps == null || WagTraps.length < getMaxTrapAmount()) {
- WagTraps = getWagTraps();
- }
- for (RSTile t : WagTraps) {
- if (objects.getTopAt(t) == null) {
- Next = t;
- break;
- }
- }
- if (Next != null) {
- while (calc.distanceTo(Next) > 0) {
- walking.walkTileOnScreen(Next);
- sleep(1000);
- }
- mySnares.add(Next);
- inventory.getItem(BIRD_SNARE).doClick(true);
- sleep(6000);
- }
- }
- };
- Action collectWagSnare = new Action() {
- RSTile Next;
- boolean activate() {
- for (RSTile t : WagTraps) {
- if (objects.getTopAt(t) != null
- && objects.getTopAt(t).getID() == DONE_SNARE[1]) {
- Next = t;
- return true;
- }
- }
- return false;// TODO
- }
- void run() {
- objects.getTopAt(Next).doClick();
- sleep(500);
- expGain += 96;
- sleep(500);
- mySnares.remove(Next);
- }
- };
- Action dropJunk = new Action() {
- boolean activate() {
- return inventory.containsOneOf(526, raw_meat);
- }
- void run() {
- inventory.dropItem(526);
- inventory.dropItem(raw_meat);
- sleep(500);
- }
- };
- Action failSafe = new Action() {
- boolean activate() {
- for (RSTile t : WagTraps) {
- for (RSGroundItem rg : groundItems.getAllAt(t)) {
- if (rg.getItem().getID() == BIRD_SNARE) {
- if (objects.getTopAt(t) != null) {
- rg.interact("take");
- }
- }
- }
- }
- return false;
- }
- void run() {
- log("We fucking failed. Probabaly going crazy with the traps...");
- fail = 0;
- }
- };
- Job TROPICAL_WAGTAIL = new Job() {
- int reqLevel() {
- return 20;
- }
- int endLevel() {
- return 53;
- }
- public RSArea mainArea() {
- return T_WAGTAIL;
- }
- };
- TROPICAL_WAGTAIL.Steps.add(placeWagSnare);
- TROPICAL_WAGTAIL.Steps.add(collectWagSnare);
- TROPICAL_WAGTAIL.Steps.add(fallenWagSnare);
- TROPICAL_WAGTAIL.Steps.add(dropJunk);
- TROPICAL_WAGTAIL.Steps.add(failSafe);
- CRIMSON_SWIFTS.Steps.add(dropJunk);
- Action setTrap = new Action() {
- RSTile Next = null;
- boolean activate() {
- if (ChinTraps == null) {
- ChinTraps = getChinTraps();
- }
- for (RSTile t : ChinTraps) {
- if (objects.getTopAt(t) == null) {
- Next = t;
- return true;
- }
- }
- return false;
- }
- void run() {
- if (Next != null) {
- while (calc.distanceTo(Next) > 0) {
- walking.walkTileOnScreen(Next);
- sleep(1000);
- }
- if (groundItems.getAllAt(Next).length == 0) {
- inventory.getItem(trapItem).doClick(true);
- } else {
- groundItems.getAllAt(Next)[0].interact("Lay");
- }
- sleep(6000);
- }
- }
- };
- Action takeTrap = new Action() {
- RSTile Next = null;
- boolean activate() {
- for (RSTile t : ChinTraps) {
- if (objects.getTopAt(t) != null) {
- if (objects.getTopAt(t).getID() == 19189) {
- Next = t;
- return true;
- }
- }
- }
- return false;
- }
- void run() {
- if (Next != null) {
- if (objects.getTopAt(Next).getID() == 19189) {
- objects.getTopAt(Next).doClick();
- sleep(2000);
- }
- }
- }
- };
- Action takefailTrap = new Action() {
- RSTile Next = null;
- boolean activate() {
- for (RSTile t : ChinTraps) {
- if (objects.getTopAt(t) != null) {
- if (objects.getTopAt(t).getID() == trapFailed) {
- Next = t;
- return true;
- }
- }
- }
- return false;
- }
- void run() {
- if (Next != null) {
- if (objects.getTopAt(Next).getID() == trapFailed) {
- objects.getTopAt(Next).doClick();
- sleep(2000);
- }
- }
- }
- };
- //
- Action takefail = new Action() {
- RSTile Next = null;
- boolean activate() {
- for (RSTile t : ChinTraps) {
- if (groundItems.getAllAt(t) != null) {
- if (groundItems.getAllAt(t).length > 0) {
- if (groundItems.getAllAt(t)[0].getItem().getID() == trapSetup) {
- Next = t;
- return true;
- }
- }
- }
- }
- return false;
- }
- void run() {
- if (Next != null) {
- if (groundItems.getAllAt(Next) != null
- && groundItems.getAllAt(Next)[0] != null) {
- groundItems.getAllAt(Next)[0].interact("take");
- }
- }
- }
- };
- Job GREY_CHIN = new Job() {
- int reqLevel() {
- return 53;
- }
- int endLevel() {
- return 63;// change once red is coded
- }
- public RSArea mainArea() {
- return G_CHIN;
- }
- };
- GREY_CHIN.Steps.add(setTrap);
- GREY_CHIN.Steps.add(takeTrap);
- GREY_CHIN.Steps.add(takefail);
- GREY_CHIN.Steps.add(takefailTrap);
- // ////////////////////////////////////////
- Action setRTrap = new Action() {
- RSTile Next = null;
- boolean activate() {
- if (ChinTraps == null) {
- ChinTraps = getChinTraps();
- }
- for (RSTile t : ChinTraps) {
- if (objects.getTopAt(t) == null) {
- Next = t;
- return true;
- }
- }
- return false;
- }
- void run() {
- if (Next != null) {
- while (calc.distanceTo(Next) > 0) {
- walking.walkTileOnScreen(Next);
- sleep(1000);
- }
- if (groundItems.getAllAt(Next).length == 0) {
- inventory.getItem(trapItem).doClick(true);
- } else {
- groundItems.getAllAt(Next)[0].interact("Lay");
- }
- sleep(6000);
- }
- }
- };
- Action takeRTrap = new Action() {
- RSTile Next = null;
- boolean activate() {
- for (RSTile t : ChinTraps) {
- if (objects.getTopAt(t) != null) {
- if (objects.getTopAt(t).getID() == 19190) {
- Next = t;
- return true;
- }
- }
- }
- return false;
- }
- void run() {
- if (Next != null) {
- if (objects.getTopAt(Next).getID() == 19190) {
- objects.getTopAt(Next).doClick();
- sleep(2000);
- }
- }
- }
- };
- Action takeRfailTrap = new Action() {
- RSTile Next = null;
- boolean activate() {
- for (RSTile t : ChinTraps) {
- if (objects.getTopAt(t) != null) {
- if (objects.getTopAt(t).getID() == trapFailed) {
- Next = t;
- return true;
- }
- }
- }
- return false;
- }
- void run() {
- if (Next != null) {
- if (objects.getTopAt(Next).getID() == trapFailed) {
- objects.getTopAt(Next).doClick();
- sleep(2000);
- }
- }
- }
- };
- //
- Action takeRfail = new Action() {
- RSTile Next = null;
- boolean activate() {
- for (RSTile t : ChinTraps) {
- if (groundItems.getAllAt(t) != null) {
- if (groundItems.getAllAt(t).length > 0) {
- if (groundItems.getAllAt(t)[0].getItem().getID() == trapSetup) {
- Next = t;
- return true;
- }
- }
- }
- }
- return false;
- }
- void run() {
- if (Next != null) {
- if (groundItems.getAllAt(Next) != null
- && groundItems.getAllAt(Next)[0] != null) {
- groundItems.getAllAt(Next)[0].interact("take");
- }
- }
- }
- };
- Job RED_CHIN = new Job() {
- int reqLevel() {
- return 63;
- }
- int endLevel() {
- return 99;// change once red is coded
- }
- public RSArea mainArea() {
- return R_CHIN;
- }
- };
- RED_CHIN.Steps.add(setRTrap);
- RED_CHIN.Steps.add(takeRTrap);
- RED_CHIN.Steps.add(takeRfail);
- RED_CHIN.Steps.add(takeRfailTrap);
- Job[] temp = { CRIMSON_SWIFTS, TROPICAL_WAGTAIL, GREY_CHIN, RED_CHIN };
- return temp;
- }
- // END: Code generated using Enfilade's Easel
- public boolean onStart() {
- startTime = System.currentTimeMillis();
- startLevel = skills.getRealLevel(Skills.HUNTER);
- startExp = skills.getCurrentExp(Skills.HUNTER);
- // new Scanner();
- return true;
- }
- @Override
- public int loop() {
- try {
- Job cur = getCurrentJob();
- if (cur.mainArea() != null
- && cur.mainArea().contains(getMyPlayer().getLocation())) {
- for (Action a : cur.Steps) {
- if (a.activate()) {
- a.run();
- break;
- }
- }
- } else {
- if (!banking)
- web.getWeb(cur.mainArea().getCentralTile()).step();
- }
- } catch (Exception e) {
- log(e.getMessage());
- }
- return 100;
- }
- private Job getCurrentJob() {
- for (Job job : getJobs()) {
- if (job.reqLevel() <= skills.getRealLevel(Skills.HUNTER)
- && job.endLevel() > skills.getRealLevel(Skills.HUNTER)) {
- return job;
- }
- }
- return null;
- }
- class Action {
- boolean activate() {
- return false;
- }
- void run() {
- }
- }
- class Job {
- private long startTime;
- public RSArea mainArea() {
- return null;
- }
- int reqLevel() {
- return -1;
- }
- int endLevel() {
- return -1;
- }
- ArrayList<Action> Steps = new ArrayList<Action>();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement