Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.Color;
- import java.awt.Graphics;
- import java.awt.Point;
- import java.util.HashSet;
- import java.util.Iterator;
- import java.util.Set;
- import java.awt.*;
- import org.rsbot.event.events.MessageEvent;
- import org.rsbot.event.listeners.MessageListener;
- import org.rsbot.script.*;
- import org.rsbot.script.methods.Game;
- import org.rsbot.script.methods.Skills;
- import org.rsbot.script.wrappers.*;
- import org.rsbot.script.util.Timer;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.script.methods.GrandExchange;
- @ScriptManifest(authors = "Havefunpeeps", keywords = "Bones", name = "Al-Khared Item Awesomer", version = 1.04, description = "Picks and banks Bones and other items")
- public class ItemAwesomer extends Script implements PaintListener {
- int BonesID = 526;
- public long startTime = 0;
- public long millis = 0;
- public long hours = 0;
- public long minutes = 0;
- public long seconds = 0;
- public long last = 0;
- private int BonesPicked = 0;
- private int BonePrice;
- private int profit;
- private int profitHour;
- private int BonesHour;
- private int Banks;
- public final RSArea BankArea = new RSArea(new RSTile[] {
- new RSTile(3264, 3161), new RSTile(3264, 3173),
- new RSTile(3273, 3174), new RSTile(3272, 3160)
- });
- public final RSArea PalaceArea = new RSArea(new RSTile[] {
- new RSTile(3280, 3157), new RSTile(3305, 3157),
- new RSTile(3305, 3180), new RSTile(3280, 3180)
- });
- public final RSTile[] ToPalace = {
- new RSTile(3269, 3166), new RSTile(3274, 3167),
- new RSTile(3276, 3172), new RSTile(3278, 3177),
- new RSTile(3282, 3180), new RSTile(3287, 3181),
- new RSTile(3292, 3180), new RSTile(3292, 3175),
- new RSTile(3292, 3170), new RSTile(3293, 3167)
- };
- public final RSTile[] ToBank = {
- new RSTile(3293, 3168), new RSTile(3293, 3173),
- new RSTile(3294, 3178), new RSTile(3291, 3182),
- new RSTile(3286, 3181), new RSTile(3281, 3181),
- new RSTile(3279, 3176), new RSTile(3276, 3172),
- new RSTile(3272, 3169), new RSTile(3268, 3167)
- };
- public boolean onStart(){
- mouse.setSpeed(random(8, 14));
- BonePrice = grandExchange.lookup(BonesID).getGuidePrice();
- startTime = System.currentTimeMillis();
- return true;
- }
- public void antiBanMouse() {
- int randomNum1 = random(1, 50);
- if (randomNum1 == 1 || randomNum1 == 2 || randomNum1 == 3) {
- mouse.moveSlightly();
- mouse.moveSlightly();
- }
- if (randomNum1 == 4 || randomNum1 == 5 || randomNum1 == 6) {
- mouse.move(random(175, 325), random(75, 225));
- }
- if (randomNum1 == 7) {
- mouse.moveRandomly(10, 150);
- }
- if (randomNum1 == 10 || randomNum1 == 11 || randomNum1 == 12
- || randomNum1 == 13) {
- mouse.moveSlightly();
- mouse.moveRandomly(random(30, 39), random(40, 60));
- }
- if (randomNum1 == 14) {
- mouse.moveOffScreen();
- }
- if (randomNum1 == 15) {
- mouse.moveSlightly();
- mouse.move(random(350, 700), random(50, 300));
- }
- if (randomNum1 == 16) {
- mouse.moveSlightly();
- mouse.moveSlightly();
- mouse.moveSlightly();
- mouse.moveSlightly();
- }
- if (randomNum1 > 16) {
- int randomNum2 = random(1, 3);
- if (randomNum2 == 1) {
- mouse.moveSlightly();
- }
- if (randomNum2 == 2) {
- mouse.moveRandomly(30, 50);
- }
- if (randomNum2 == 3) {
- mouse.moveSlightly();
- mouse.moveRandomly(30, 50);
- }
- }
- sleep(random(100, 400));
- }
- public void antiBanCamera() {
- int randomNumber3 = random(1, 40);
- if (randomNumber3 == 1 || randomNumber3 == 2 || randomNumber3 == 3) {
- camera.setPitch(random(40, 68));
- }
- if (randomNumber3 == 4 || randomNumber3 == 5 || randomNumber3 == 6) {
- camera.moveRandomly(random(800, 1200));
- }
- if (randomNumber3 == 7 || randomNumber3 == 8 || randomNumber3 == 9) {
- camera.setAngle(random(10, 50));
- }
- if (randomNumber3 == 10 || randomNumber3 == 11) {
- camera.setPitch(true);
- }
- if (randomNumber3 == 12 || randomNumber3 == 13) {
- camera.setPitch(false);
- }
- if (randomNumber3 == 14) {
- camera.moveRandomly(random(400, 800));
- }
- if (randomNumber3 == 15) {
- camera.setAngle(random(5, 40));
- sleep(random(200, 300));
- }
- if (randomNumber3 > 15 && randomNumber3 < 30) {
- camera.setPitch(true);
- }
- if (randomNumber3 > 29) {
- camera.moveRandomly(random(200, 800));
- }
- }
- public void antiBan(){
- int randomNumber123 = random(1, 3);
- if(randomNumber123 == 1) {
- antiBanMouse();
- }
- if(randomNumber123 == 2) {
- antiBanCamera();
- }
- }
- public void PickUpBones() {
- RSGroundItem Bones = groundItems.getNearest(BonesID);
- if ((groundItems.getNearest(BonesID) != null) && getMyPlayer().isIdle() && (calc.tileOnScreen(Bones.getLocation()))) {
- Bones.doAction("Take");
- sleep(random(250, 500));
- } else if ((groundItems.getNearest(BonesID) != null)
- && (!calc.tileOnScreen(Bones.getLocation()))) {
- walking.walkTileMM(groundItems.getNearest(BonesID).getLocation());
- }
- if(Bones == null) {
- sleep(random(250,500));
- }
- if (!walking.isRunEnabled() && walking.getEnergy() >= 50) {
- walking.setRun(true);
- sleep(200, 400);
- }
- }
- private boolean walkPath(RSTile[] path) {
- if (calc.distanceTo(path[path.length - 1]) > 4) {
- RSTile n = getNext(path);
- if(n!=null){
- walking.walkTileMM(n.randomize(2, 2));
- if(random(1,6) != 2){
- mouse.moveRandomly(20);
- }
- }
- }
- return false;
- }
- private RSTile getNext(RSTile[] path) {
- boolean found = false;
- for (int a = 0; a < path.length&&!found; a++) {
- if(calc.tileOnMap(path[path.length-1-a])){
- found = true;
- return path[path.length-1-a];
- }
- }
- return null;
- }
- public int loop() {
- if(BankArea.contains(getMyPlayer().getLocation())){
- if(inventory.isFull()){
- bank.open();
- bank.depositAll();
- bank.close();
- Banks++;
- }
- }else{
- if(inventory.isFull()){
- walkPath(ToBank);
- sleep(500, 700);
- }
- }
- if(PalaceArea.contains(getMyPlayer().getLocation())){
- if(!inventory.isFull()){
- PickUpBones();
- }
- }else{
- if(!inventory.isFull()){
- walkPath(ToPalace);
- sleep(500, 700);
- }
- }
- return(random(100, 200));
- }
- //START: Code generated using Enfilade's Easel
- private final Color color1 = new Color(0, 0, 255, 75);
- private final Color color2 = new Color(0, 0, 0);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final Font font1 = new Font("Arial", 0, 9);
- public void onRepaint(Graphics g1) {
- Graphics2D g = (Graphics2D)g1;
- profit = BonePrice * BonesPicked;
- BonesPicked = Banks * 28;
- profitHour = (int) ((profit) * 3600000D / (System.currentTimeMillis() - startTime));
- BonesHour = (int) ((BonesPicked) * 3600000D / (System.currentTimeMillis() - startTime));
- millis = System.currentTimeMillis() - startTime;
- hours = millis / (1000 * 60 * 60);
- millis -= hours * (1000 * 60 * 60);
- minutes = millis / (1000 * 60);
- millis -= minutes * (1000 * 60);
- seconds = millis / 1000;
- g.setColor(color1);
- g.fillRect(371, 185, 147, 155);
- g.setColor(color2);
- g.setStroke(stroke1);
- g.drawRect(371, 185, 147, 155);
- g.setFont(font1);
- g.drawString("Time Running: " + hours +":"+ minutes + ":" + seconds, 382, 215);
- g.drawString("Items Picked Up: " +BonesPicked, 383, 230);
- g.drawString("Items per Hour: "+BonesHour , 383, 245);
- g.drawString("Banks: " +Banks, 383, 260);
- }
- //END: Code generated using Enfilade's Easel
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement