Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.Color;
- import java.awt.Graphics;
- import java.util.Map;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.methods.Calculations;
- import org.rsbot.script.methods.MethodContext;
- import org.rsbot.script.wrappers.RSComponent;
- import org.rsbot.script.wrappers.RSGroundItem;
- import org.rsbot.script.wrappers.RSItem;
- import org.rsbot.script.wrappers.RSNPC;
- import org.rsbot.script.wrappers.RSPlayer;
- import org.rsbot.script.wrappers.RSTile;
- @ScriptManifest(authors = "Sweet Dylz", category = "Combat", name = "Get Me Hides!", version = 1.1, description =
- "<br> 1. Start in Beefy Bill's field. </br>" +
- "<br> 2. Have at least twenty open inventory spots </br>" +
- "<br> 3. ??? </br> " +
- "<br> 4. PROFIT!!! </br> <br> </br> " +
- "Do you want to bury bones? " +
- "<select name='buryBones'>" +
- "<option>No</option>"
- + "<option>Yes</option>")
- public class GetMeHides extends Script implements PaintListener
- {
- private int cowhide = 1739;
- private int[] cow = {81, 397, 1767, 1766, 1768};
- private int beefyBill = 246;
- private boolean walkingToCow = false;
- private boolean buryBones = false;
- private int totalHides = 0;
- private long startTime = System.currentTimeMillis();
- private String activity = "";
- public boolean onStart(Map<String, String> args)
- {
- if(args.get("buryBones").equals("Yes"))
- buryBones = true;
- log("Let's kill some cows...");
- return true;
- }
- public void onFinish()
- {
- log("Banked " + totalHides + " hides - go buy something shiny");
- }
- public void bank()
- {
- activity = "banking";
- RSNPC bill = npcs.getNearest(beefyBill);
- RSItem hide = inventory.getItem(cowhide);
- if(bill == null)
- {
- walking.walkTo(new RSTile(3179, 3322));
- }
- if(bill != null && hide != null)
- {
- while(!bill.isOnScreen())
- {
- walking.walkPathMM(walking.findPath(bill.getLocation()));
- activity = "walking to bill";
- sleep(random(2400, 2600));
- }
- while(!bill.isOnScreen() || getMyPlayer().isMoving())
- sleep(random(100, 200));
- hide.doClick(true);
- bill.doAction("-> Bee");
- sleep(random(800, 1000));
- if(interfaces.get(236).isValid())
- interfaces.get(236).getComponent(1).doClick();
- if(interfaces.get(451).isValid())
- interfaces.get(451).getComponent(1).doClick();
- sleep(random(1000, 1200));
- if(interfaces.get(241).isValid())
- interfaces.get(241).getComponent(5).doClick();
- if(!inventory.contains(cowhide))
- totalHides += 18;
- }
- }
- public void attackCow()
- {
- camera.setAltitude(true);
- RSNPC target = npcs.getNearestFreeToAttack(cow);
- activity = "killing cows";
- if(target == null)
- walking.walkTo(new RSTile(3179, 3322));
- if(target != null && !getMyPlayer().isInteractingWithLocalPlayer() && !getMyPlayer().isInCombat())
- {
- if(!target.isOnScreen() && !getMyPlayer().isMoving() && getMyPlayer().getInteracting() == null && !getMyPlayer().isInCombat())
- {
- mouse.click(calc.tileToMinimap(walking.findPath(target.getLocation())[1]), true);
- walkingToCow = true;
- }
- if(target.isOnScreen() && getMyPlayer().getInteracting() == null && !getMyPlayer().isInCombat())
- {
- target.doAction("tack");
- walkingToCow = false;
- }
- }
- }
- public void takeHides()
- {
- RSGroundItem hide = groundItems.getNearest(cowhide);
- activity = "picking up a hide";
- if(hide != null)
- {
- if(!hide.isOnScreen())
- {
- walking.walkPathMM(walking.findPath(hide.getLocation()));
- sleep(random(500, 600));
- }
- if(hide.isOnScreen())
- {
- if(walkingToCow)
- {
- walking.walkPathOnScreen(walking.findPath(hide.getLocation()));
- walkingToCow = false;
- sleep(random(300, 400));
- }
- hide.doAction("Take C");
- if(buryBones)
- {
- RSGroundItem bone = groundItems.getNearest(526);
- if(bone != null)
- {
- sleep(random(700, 900));
- bone.doAction("Take B");
- }
- }
- sleep(random(600, 800));
- if(inventory.contains(526) && buryBones)
- inventory.getItem(526).doClick(true);
- }
- }
- return;
- }
- public int loop()
- {
- //String runEnergy = interfaces.get(750).getComponent(5).getText();
- if(!game.isLoggedIn())
- return(random(500, 600));
- /*getMyPlayer().
- if(runEnergy != null)
- if((Character.isDigit(runEnergy.charAt(0))))
- if(Integer.parseInt(runEnergy.trim()) >= random(70, 90))
- interfaces.get(750).getComponent(1).doClick();*/
- antiban();
- if(getMyPlayer().getLocation().getY() >= 3350)
- walking.walkTo(new RSTile(3179, 3322));
- if(hasTwentyHides() && !getMyPlayer().isInCombat())
- bank();
- else if(groundItems.getNearest(cowhide)!= null)
- {
- takeHides();
- }
- else if(!getMyPlayer().isInCombat() && getMyPlayer().getInteracting() == null)
- attackCow();
- return random(200,300);
- }
- public boolean hasTwentyHides()
- {
- return inventory.getCount(cowhide) >= 20;
- }
- public void onRepaint(Graphics g)
- {
- if(game.isLoggedIn())
- {
- g.setColor(Color.CYAN);
- long millis = System.currentTimeMillis() - startTime;
- long hours = millis / (1000 * 60 * 60);
- millis -= hours * (1000 * 60 * 60);
- long minutes = millis / (1000 * 60);
- millis -= minutes * (1000 * 60);
- long seconds = millis / 1000;
- g.drawString("Get me Hides! by Sweet Dylz" , 9, 207);
- g.drawString("Currently: " + activity, 9, 227);
- g.drawString("Hides banked: " + totalHides , 9, 239);
- g.drawString("Time run: " + hours + " hours, " + minutes + " minutes, " + seconds + " seconds", 9, 251);
- g.setColor(Color.ORANGE);
- g.drawLine((int)mouse.getClientLocation().getX(), 0, (int)mouse.getClientLocation().getX(), 500);
- g.drawLine(0, (int)mouse.getClientLocation().getY(), 764, (int)mouse.getClientLocation().getY());
- }
- }
- public void antiban()
- {
- int rand = random(1,1200);
- if(rand >= 1 && rand < 11)
- log("Antiban");
- switch(rand)
- {
- case 1:
- RSPlayer p = players.getNearestByLevel(2, 130);
- if(p.isOnScreen())
- {
- mouse.click(p.getScreenLocation(), false);
- p.doAction("Cancel");
- }
- break;
- case 2:
- case 3:
- case 4:
- RSItem i = inventory.getItemAt(random(1,27));
- i.doClick(false);
- i.doAction("Examine");
- break;
- case 5:
- camera.moveRandomly(random(3000, 7000));
- camera.setAltitude(true);
- break;
- case 6:
- mouse.click(566, 185, 10, 15, true);
- RSComponent hpMenu = interfaces.get(320).getComponent(184);
- sleep(random(800, 1200));
- hpMenu.doHover();
- sleep(random(800, 1200));
- break;
- case 7:
- mouse.click(566, 185, 10, 15, true);
- RSComponent attMenu = interfaces.get(320).getComponent(194);
- sleep(random(800, 1200));
- attMenu.doHover();
- sleep(random(800, 1200));
- break;
- case 8:
- mouse.click(566, 185, 10, 15, true);
- RSComponent strMenu = interfaces.get(320).getComponent(5);
- sleep(random(800, 1200));
- strMenu.doHover();
- sleep(random(800, 1200));
- break;
- case 9:
- mouse.click(566, 185, 10, 15, true);
- RSComponent defMenu = interfaces.get(320).getComponent(22);
- sleep(800, 1200);
- defMenu.doHover();
- sleep(random(800, 1200));
- break;
- case 10:
- camera.setAngle(random(1,179));
- break;
- default:
- break;
- }
- }
- }
Add Comment
Please, Sign In to add comment