TFW Posted April 14, 2016 Posted April 14, 2016 (edited) fights anything eats any food paint exp and time tracker if you want something added let me know downloads https://www.mediafire.com/?8p9byab9r1o3lap progry Source codes /** * Created by TFW on 04/14/2016. */ @ScriptManifest(author = "TFW", info = "Fights anything", name = "TFW Fighter", version = 0.196, logo = "http://i.imgur.com/mDZdCJM.png") public class Fighter extends Script { LinkedList<MousePathPoint> mousePath = new LinkedList<MousePathPoint>(); private FighterGUI gui; private int r = 255; private int g = 0; private int b = 0; public String toAttack; public boolean eatFood; private long startTime; private NPC getNpcWhere; private Position startTile; @Override public void onStart() throws InterruptedException { this.startTile = myPlayer().getPosition(); getExperienceTracker().startAll(); startTime = System.currentTimeMillis(); this.gui = new FighterGUI(); gui.setVisible(true); while (gui.isVisible()){ sleep(200); } this.toAttack = gui.getToAttack(); this.eatFood = gui.isDoFood(); log("NPC: " + toAttack); log("Eat Food: " + "[" + eatFood + "]"); log("Starting Point: [" + startTile + "]"); log("======================================================================"); log("Welcome to [" + getName() + "] " + "by " + getAuthor() + ". You are currently running Version " + getVersion() + "."); log("======================================================================"); } @Override public int onLoop() throws InterruptedException { getNpcWhere = getNpcs().closest(true, npc -> npc.getName().toLowerCase().equals(toAttack) && npc.isAttackable() && npc.getHealthPercent() > 0 && getMap().canReach(npc)); if (myPlayer().getInteracting() == null && getNpcWhere != null && startTile.isOnMiniMap(getBot())){ if (getNpcWhere.getPosition().distance(myPosition()) <= 7){ InteractionEvent attackNpc = new InteractionEvent(getNpcWhere, "Attack"); //call interaction event attackNpc.setWalkTo(false); //turn off walking attackNpc.setOperateCamera(true); //enable camera execute(attackNpc); new ConditionalSleep(6000, 600) { @Override public boolean condition() throws InterruptedException { return myPlayer().getInteracting() != null; } }.sleep(); getMouse().moveSlightly(random(500)); } else { WalkingEvent walkToNpc = new WalkingEvent(getNpcWhere.getPosition()); //call the walking event walkToNpc.setBreakCondition(new Condition() { @Override public boolean evaluate() { return getNpcWhere.getPosition().distance(myPosition()) <= 4; } }); execute(walkToNpc); log("Walking to " + getNpcWhere.getName() + " @ " + getNpcWhere.getPosition()); } } if (myPlayer().getInteracting() != null && getCombat().isFighting() && !lowHealth()){ new ConditionalSleep(20000, 600) { @Override public boolean condition() throws InterruptedException { return myPlayer().getInteracting() == null || lowHealth(); } }.sleep(); } if (eatFood && lowHealth()){ if (gotFood()){ for (Item i : getInventory().getItems()) { if (i != null && i.hasAction("Eat")) { if (!getTabs().getOpen().equals(Tab.INVENTORY)) getTabs().open(Tab.INVENTORY); i.interact("Eat"); new ConditionalSleep(3000, random(600, 1200)) { @Override public boolean condition() throws InterruptedException { return myPlayer().getAnimation() == 829; } }.sleep(); break; } } } else { //stop no food stop(false); } } return random(600, 900); } @Override public void onExit() { long runTime = System.currentTimeMillis() - startTime; log("======================================================================"); log("Thank you for using [" + getName() + "] " + "by" + " [" + getAuthor() + "]."); log("======================================================================"); log("Time Ran: " + formatTime(runTime)); } @Override public void onPaint(Graphics2D gfx) { long runTime = System.currentTimeMillis() - startTime; gfx.drawString("Runtime: "+formatTime(runTime), 15, 40); gfx.drawString("Attack: " + getExperienceTracker().getGainedXP(Skill.ATTACK), 15, 65); gfx.drawString("Strength: " + getExperienceTracker().getGainedXP(Skill.STRENGTH), 15, 80); gfx.drawString("Defence: " + getExperienceTracker().getGainedXP(Skill.DEFENCE), 15, 95); gfx.drawString("Range: " + getExperienceTracker().getGainedXP(Skill.RANGED), 15, 110); gfx.drawString("Magic: " + getExperienceTracker().getGainedXP(Skill.MAGIC), 15, 125); while (!mousePath.isEmpty() && mousePath.peek().isUp()) mousePath.remove(); Point clientCursor = mouse.getPosition(); MousePathPoint mpp = new MousePathPoint(clientCursor.x, clientCursor.y, 500); if (mousePath.isEmpty() || !mousePath.getLast().equals(mpp)) mousePath.add(mpp); MousePathPoint lastPoint = null; for (MousePathPoint a : mousePath) { if (lastPoint != null) { gfx.setColor(nextColor()); gfx.drawLine(a.x, a.y, lastPoint.x, lastPoint.y); } lastPoint = a; } gfx.drawLine(clientCursor.x - 4, clientCursor.y, clientCursor.x + 4, clientCursor.y); gfx.drawLine(clientCursor.x, clientCursor.y - 4, clientCursor.x, clientCursor.y + 4); } /** * Methods */ /** PAINT SHIT * */ public void nextRGB() { if ( r == 255 && g < 255 && b == 0 ) { g++; } if ( g == 255 && r > 0 && b == 0 ) { r--; } if ( g == 255 && b < 255 && r == 0 ) { b++; } if ( b == 255 && g > 0 && r == 0 ) { g--; } if ( b == 255 && r < 255 && g == 0 ) { r++; } if ( r == 255 && b > 0 && g == 0 ) { b--; } } public Color nextColor() { nextRGB(); return makeColor(); } public Color makeColor() { return new Color(r, g, b); } public String formatTime(long ms){ long s = ms / 1000, m = s / 60, h = m / 60; s %= 60; m %= 60; h %= 24; return String.format("%02d:%02d:%02d", h, m, s); } public boolean lowHealth(){ return getSkills().getDynamic(Skill.HITPOINTS) <= (getSkills().getStatic(Skill.HITPOINTS) * 0.50); } public boolean gotFood() { return getInventory().contains(getEdible().getName()); } public Item getEdible() { return getInventory().getItem(item -> item != null && item.hasAction("Eat")); } } Edited April 14, 2016 by TFW 2
TFW Posted April 14, 2016 Author Posted April 14, 2016 (edited) i litteraly have one like that for myself lol thought about releasing it as a jar, since i only really use it for slayer because my obby tank is sooooo slow with slayer (1 atk) Nice . I let it auto find food in the inventory & just make user type in a name Edited April 14, 2016 by TFW
Botre Posted April 14, 2016 Posted April 14, 2016 i litteraly have one like that for myself lol thought about releasing it as a jar, since i only really use it for slayer because my obby tank is sooooo slow with slayer (1 atk) Name in img 1
GaetanoH Posted April 14, 2016 Posted April 14, 2016 Can someone delete that for him, sucks that hes name is in the image
TFW Posted April 16, 2016 Author Posted April 16, 2016 Might try this 1. Let me know if you find any problems. I ran it for 2 hours just fine
The Hero of Time Posted April 18, 2016 Posted April 18, 2016 Name in img Can someone delete that for him, sucks that hes name is in the image Could've cared less. my main is my life