Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.06 KB | None | 0 0
  1. import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Color; import java.awt.Font; import java.awt.Point; import org.rsbot.script.Script; import org.rsbot.script.ScriptManifest; import org.rsbot.script.methods.Game; import org.rsbot.script.wrappers.RSNPC; import org.rsbot.script.wrappers.RSGroundItem; import org.rsbot.script.wrappers.RSItem; import org.rsbot.script.wrappers.RSObject; import org.rsbot.script.wrappers.RSTile; import org.rsbot.script.wrappers.RSArea; import org.rsbot.event.listeners.PaintListener; @ScriptManifest (authors = { "Szenis" }, keywords = "...", name = "SZUnicorns", version = 0.9, description = "kills blackunicorn and loot al unicorns.") public class SZUnicorns extends Script implements PaintListener { public long startTime = System.currentTimeMillis(); private int unichornpicked = 0; private RSArea area; int[] Unicornnpc = { 133 }; int[] Unicorn = { 237 }; int[] bankBoothID = { 39830 }; int strstartExp; int strxpgained; int attstartExp; int attxpgained; int defstartExp; int defxpgained; int hpstartExp; int hpxpgained; int unichorn = 237; int Unichornprice = 0; int strxphour = 0; int attxphour = 0; int defxphour = 0; int hpxphour = 0; int moneyhour = 0; int pickunichorn = 0; long nextAntiban=0; Color black = new Color(0, 0, 0, 170); String status = "loading"; RSTile[] Frombankway1 = { new RSTile(3127, 3632), new RSTile(3119, 3637), new RSTile(3114, 3644), new RSTile(3105, 3645), new RSTile(3094, 3645), new RSTile(3087, 3640), new RSTile(3080, 3637)}; RSTile[] Frombankway2 = { new RSTile(3135, 3639), new RSTile(3134, 3647), new RSTile(3128, 3647), new RSTile(3119, 3647), new RSTile(3109, 3647), new RSTile(3099, 3646), new RSTile(3090, 3644), new RSTile(3083, 3640), new RSTile(3080, 3637)}; RSTile[] Tobank = { new RSTile(3080, 3637), new RSTile(3087, 3642), new RSTile(3094, 3646), new RSTile(3106, 3646), new RSTile(3118, 3641), new RSTile(3128, 3632), new RSTile(3137, 3628), new RSTile(3137, 3628)}; RSTile[] tospot1 = { new RSTile(3082, 3646), new RSTile(3077, 3638)}; RSTile[] tospot2 = { new RSTile(3077, 3633), new RSTile(3082, 3644)}; RSTile[] tospot3 = { new RSTile(3083, 3634), new RSTile(3075, 3624)}; public boolean onStart() { pickunichorn=inventory.getCount(unichorn); Unichornprice = grandExchange.getMarketPrice(unichorn); return true; } public void antiBan() { if(nextAntiban<System.currentTimeMillis()) { final int choseanti = random(0, 80); if (choseanti == 3) { game.openTab(Game.TAB_INVENTORY); nextAntiban= random(700, 1600); return; } else if (choseanti == 4 || choseanti == 25) { mouse.move(random(0, 700), random(0, 500)); sleep(random(500, 750)); nextAntiban=System.currentTimeMillis()+ random(700, 1700); return; } else if (choseanti == 5) { mouse.move(random(0, 450), random(0, 400)); nextAntiban=System.currentTimeMillis()+ random(600, 1200); return; } else if (choseanti == 9 || choseanti == 11) { mouse.moveSlightly(); nextAntiban= System.currentTimeMillis()+random(600, 900); return; } else if (choseanti == 22|| choseanti == 23||choseanti ==24) { int angle = camera.getAngle() + random(-20, 90); if (angle < 0) { angle = random(0, 10); } if (angle > 359) { angle = random(0, 10); } camera.setAngle(angle); } else if(choseanti ==23||choseanti == 46||choseanti == 43) { mouse.moveOffScreen(); nextAntiban= System.currentTimeMillis()+random(1000,4000); return; } nextAntiban=System.currentTimeMillis()+random(600, 950); } } private boolean walkingawayfrombank1() { log("Start walking to black unicorn."); RSTile[] randomizedPath = walking.randomizePath(Frombankway1, 2, 2); return walking.walkPathMM(randomizedPath, 15); } private boolean walkingawayfrombank2() { log("Start walking to black unicorn."); RSTile[] randomizedPath = walking.randomizePath(Frombankway2, 2, 2); return walking.walkPathMM(randomizedPath, 15); } private void GetBlackUnicorn() { try { status = "Searching for black unicorn"; pickup(); RSNPC eenhoorn = npcs.getNearest(Unicornnpc); if(eenhoorn.isOnScreen() && getMyPlayer().getAnimation() == -1) { sleep(250); if(!eenhoorn.isOnScreen()) { antiBan(); pickup(); } else { status = "Attacking unicorns"; eenhoorn.doAction("Attack"); pickup(); } } else if(!eenhoorn.isOnScreen() && getMyPlayer().getAnimation() == -1) { antiBan(); getotherspot(); if(!Atspot1() || !Atspot2() || !Atspot3()) { pickup(); Walktospot1(); } } } catch (final Exception e) { } } public int loop() { if(getMyPlayer().getAnimation() == -1) { if (!walking.isRunEnabled() && walking.getEnergy() > 50) { antiBan(); walking.setRun(true); return random(750, 1000); } if (!interfaces.get(bank.INTERFACE_BANK).isValid()) { if (inventory.isFull()) { inventory.dropAllExcept(false, Unicorn); if(!Atbank()) { walkingtobank(); log("Walking back to bank."); } if(Atbank()) { log("Banking."); Banking(); } } else if (!inventory.isFull()) { if (!Atunicorn()) { chosewalkingawayfrombank(); sleep(3000); } if (Atunicorn()) { GetBlackUnicorn(); } } } } return 1000; } public void onRepaint(Graphics g) { if(strstartExp==0) { strstartExp = skills.getCurrentExp(skills.getIndex("strength")); } strxpgained = skills.getCurrentExp(skills.getIndex("strength")) - strstartExp; if(attstartExp==0) { attstartExp = skills.getCurrentExp(skills.getIndex("attack")); } attxpgained = skills.getCurrentExp(skills.getIndex("attack")) - attstartExp; if(defstartExp==0) { defstartExp = skills.getCurrentExp(skills.getIndex("defence")); } defxpgained = skills.getCurrentExp(skills.getIndex("defence")) - defstartExp; if(hpstartExp==0) { hpstartExp = skills.getCurrentExp(skills.getIndex("constitution")); } hpxpgained = skills.getCurrentExp(skills.getIndex("constitution")) - hpstartExp; if (pickunichorn<inventory.getCount(unichorn)) { unichornpicked++; pickunichorn=inventory.getCount(unichorn); } else if(inventory.getCount(unichorn)==0) { pickunichorn=0; } Graphics2D venster = (Graphics2D)g; venster.setColor(black); venster.fillRect(6, 345, 491, 113); venster.setColor(Color.black); venster.drawRect(6, 345, 240, 113); venster.setColor(Color.black); venster.drawRect(246, 345, 251, 113); venster.setFont(new Font("Default",0,12)); 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; long minutes2 = minutes + (hours * 60); g.setColor(Color.red); Point m = mouse.getLocation(); g.drawOval(m.x-5,m.y-5, 10, 10); g.drawOval(m.x-10,m.y-10,20,20); g.drawLine(m.x, m.y, m.x, m.y); int gainedmoney = unichornpicked*Unichornprice; float hornssec = 0; if ((minutes > 0 || hours > 0 || seconds > 0) && unichornpicked > 0) { hornssec = ((float) unichornpicked)/ (float) (seconds + (minutes * 60) + (hours * 60 * 60)); } float hornsmin = hornssec * 60; float hornshour = hornsmin * 60; float moneysec = 0; if ((minutes > 0 || hours > 0 || seconds > 0) && gainedmoney > 0) { moneysec = ((float) gainedmoney)/ (float) (seconds + (minutes * 60) + (hours * 60 * 60)); } float moneymin = moneysec * 60; float moneyhour = moneymin * 60; float strxpsec = 0; if ((minutes > 0 || hours > 0 || seconds > 0) && strxpgained > 0) { strxpsec = ((float) strxpgained)/ (float) (seconds + (minutes * 60) + (hours * 60 * 60)); } float strxpmin = strxpsec * 60; float strxphour = strxpmin * 60; float attxpsec = 0; if ((minutes > 0 || hours > 0 || seconds > 0) && attxpgained > 0) { attxpsec = ((float) attxpgained)/ (float) (seconds + (minutes * 60) + (hours * 60 * 60)); } float attxpmin = attxpsec * 60; float attxphour = attxpmin * 60; float defxpsec = 0; if ((minutes > 0 || hours > 0 || seconds > 0) && defxpgained > 0) { defxpsec = ((float) defxpgained)/ (float) (seconds + (minutes * 60) + (hours * 60 * 60)); } float defxpmin = defxpsec * 60; float defxphour = defxpmin * 60; float hpxpsec = 0; if ((minutes > 0 || hours > 0 || seconds > 0) && hpxpgained > 0) { hpxpsec = ((float) hpxpgained)/ (float) (seconds + (minutes * 60) + (hours * 60 * 60)); } float hpxpmin = hpxpsec * 60; float hpxphour = hpxpmin * 60; g.setColor(Color.yellow); g.drawString("Experience And Levels", 10, 361); g.drawString("Stregth xp: " + strxpgained, 10, 381); g.drawString("Hour: " + (int)strxphour, 140, 381); g.drawString("Attack xp: " + attxpgained, 10, 397); g.drawString("Hour: " + (int)attxphour, 140, 397); g.drawString("Defence xp: " + defxpgained, 10, 413); g.drawString("Hour: " + (int)defxphour, 140, 413); g.drawString("Consitution xp: " + hpxpgained, 10, 429); g.drawString("Hour: " + (int)hpxphour, 140, 429); g.drawString("Money And Status", 252, 361); g.drawString("Time running: " + hours + ":" + minutes + ":" + seconds + ".", 252, 381); g.drawString("Status: " + status + ".", 252, 397); g.drawString("Horns picked: " + unichornpicked, 252, 418); g.drawString("Hour: " + (int)hornshour, 382, 418); g.drawString("Money gained: " + gainedmoney, 252, 434); g.drawString("Hour: " +(int)moneyhour, 382, 434); } public void pickup() { try { RSGroundItem items = groundItems.getNearest(Unicorn); status = "Getting unicorn horns"; items.doAction("take"); } catch (final Exception e) { } } private void chosewalkingawayfrombank() { final int ranNo = random(1, 4); if (ranNo == 1 || ranNo == 2) { walkingawayfrombank1(); antiBan(); } else if (ranNo == 3 || ranNo == 4) { walkingawayfrombank2(); antiBan(); } status = "Walking to unicorns"; } private void getotherspot() { pickup(); status = "Searching for black unicorn"; int angle = camera.getAngle() + random(-20, 90); if (angle < 0) { angle = random(40, 150); } if (angle > 359) { angle = random(40, 150); } camera.setAngle(angle); } private void Banking() { try { RSObject bankBooth = objects.getNearest(bankBoothID); bankBooth.doAction("deposit"); if (bankBooth.doAction("deposit")) { sleep(3900); mouse.move(347, 277, 3, 3); mouse.click(true); } status = "Banking"; } catch (final Exception e) { } } private boolean Atbank() { RSArea area = new RSArea(new RSTile(3133, 3625), new RSTile(3139, 3633)); return area.contains(getMyPlayer().getLocation()); } private boolean Atspot1() { RSArea area = new RSArea(new RSTile(3071, 3635), new RSTile(3084, 3641)); return area.contains(getMyPlayer().getLocation()); } private boolean Atspot2() { RSArea area = new RSArea(new RSTile(3081, 3641), new RSTile(3087, 3646)); return area.contains(getMyPlayer().getLocation()); } private boolean Atspot3() { RSArea area = new RSArea(new RSTile(3070, 3622), new RSTile(3078, 3625)); return area.contains(getMyPlayer().getLocation()); } private boolean Atunicorn() { RSArea area = new RSArea(new RSTile(3070, 3620), new RSTile(3095, 3645)); return area.contains(getMyPlayer().getLocation()); } public boolean walkingtobank() { status = "Walking to bank"; RSTile[] randomizedPath = walking.randomizePath(Tobank, 2, 2); return walking.walkPathMM(randomizedPath, 15); } public boolean Walktospot1() { RSTile[] randomizedPath = walking.randomizePath(tospot1, 2, 2); return walking.walkPathMM(randomizedPath, 15); } public boolean Walktospot2() { RSTile[] randomizedPath = walking.randomizePath(tospot2, 2, 2); return walking.walkPathMM(randomizedPath, 15); } public boolean walkingtospot3() { RSTile[] randomizedPath = walking.randomizePath(tospot3, 2, 2); return walking.walkPathMM(randomizedPath, 15); } public void onFinish() { log("Thank you for using Szenis Unicorn bot."); } }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement