Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Created by IntelliJ IDEA.
- * User: Biohazard
- * Date: Jan 12, 2010
- * Time: 7:06:53 PM
- * To change this template use File | Settings | File Templates.
- */
- import com.kbotpro.scriptsystem.events.PaintEventListener;
- import com.kbotpro.scriptsystem.interfaces.Looped;
- import com.kbotpro.scriptsystem.runnable.Script;
- import com.kbotpro.scriptsystem.wrappers.PhysicalObject;
- import com.kbotpro.scriptsystem.wrappers.Tile;
- import com.kbotpro.scriptsystem.fetch.Walking;
- import com.kbotpro.scriptsystem.fetch.Skills;
- import com.kbotpro.scriptsystem.events.PaintEventListener;
- import com.kbotpro.scriptsystem.events.ServerMessageListener;
- import java.awt.*;
- public class HoneyCombHazard extends Script implements PaintEventListener, ServerMessageListener {
- //ID's
- private int[] BankerId = {2213};
- private int[] Repellent = {28};
- private int[] GateClosed = {1553};
- private int[] GateOpen = {1556};
- private int[] BeeHive = {68};
- // Paint
- String status = "";
- long startTime;
- int origEXP = 0;
- int HCR = 0;
- //Antiban
- int loopCount = 0;
- int randNumber = 0;
- //Path's
- int i = random(1, 2);
- private final Tile[] bankToField = {new Tile(2799, 3433), new Tile(2789, 3440), new Tile(2779, 3447),
- new Tile(2767, 3444)};
- private final Tile[] bankToFieldTwo = {new Tile(2794, 3435), new Tile(2784, 3439), new Tile(2776, 3443),
- new Tile(2768, 3443)};
- int b = random(1, 3);
- private final Tile[] fieldToBank = new Tile[]{new Tile(2775, 3442), new Tile(2785, 3441), new Tile(2795, 3433),
- new Tile(2806, 3435), new Tile(2809, 3440)};
- private final Tile[] fieldToBankTwo = {new Tile(2774, 3437), new Tile(2783, 3433), new Tile(2794, 3434),
- new Tile(2808, 3433), new Tile(2809, 3441)};
- private final Tile[] fieldToBankThree = new Tile[]{new Tile(2775, 3442), new Tile(2784, 3437), new Tile(2797, 3432),
- new Tile(2808, 3441)};
- // In the Bank
- private final Tile bankNorthwest = new Tile(2808, 3441);
- private final Tile bankSoutheast = new Tile(2811, 3438);
- // Is by the guild doors inside....
- private final Tile inFieldwest = new Tile(2763, 3444);
- private final Tile inFieldeast = new Tile(2766, 3441);
- private final Tile byGatewest = new Tile(2767, 3445);
- private final Tile byGateeast = new Tile(2770, 3442);
- private boolean isInBank() {
- Tile loc = getMyPlayer().getLocation();
- if (bankNorthwest.getX() <= loc.getX()
- && bankNorthwest.getY() >= loc.getY()
- && bankSoutheast.getX() >= loc.getX()
- && bankSoutheast.getY() <= loc.getY()) {
- return true;
- } else {
- return false;
- }
- }
- private boolean isInField() {
- Tile loc = getMyPlayer().getLocation();
- if (inFieldwest.getX() <= loc.getX()
- && inFieldwest.getY() >= loc.getY()
- && inFieldeast.getX() >= loc.getX()
- && inFieldeast.getY() <= loc.getY()) {
- return true;
- } else {
- return false;
- }
- }
- private boolean isByGate() {
- Tile loc = getMyPlayer().getLocation();
- if (byGatewest.getX() <= loc.getX()
- && byGatewest.getY() >= loc.getY()
- && byGateeast.getX() >= loc.getX()
- && byGateeast.getY() <= loc.getY()) {
- return true;
- } else {
- return false;
- }
- }
- public boolean shouldKill = false;
- public boolean canStart() {
- return game.isLoggedIn();
- }
- public String getName() {
- return "ClimbingBootGetter";
- }
- public void onRepaint(Graphics g) {
- long runTime = System.currentTimeMillis() - startTime;
- int secs = ((int) ((runTime / 1000) % 60));
- int mins = ((int) (((runTime / 1000) / 60) % 60));
- int hours = ((int) ((((runTime / 1000) / 60) / 60) % 60));
- g.setColor(Color.white);
- g.drawString("Current Status: " + status, 34, 50);
- g.drawString("Run time: " + (hours < 10 ? "0" : "") + hours + ":"
- + (mins < 10 ? "0" : "") + mins + ":" + (secs < 10 ? "0" : "")
- + secs, 34, 36);
- g.drawString("Total HoneyCombs retrieved: " + HCR, 34, 68);
- }
- public void stop() {
- shouldKill = true;
- log.log("Please wait while all threads are killed =]");
- }
- public void onStart() {
- startTime = System.currentTimeMillis();
- origEXP = skills.getExperience(Skills.SKILL_MINING);
- }
- public void onServerMessage(String m) {
- if (m.contains("honeycomb"))
- HCR++;
- }
- public void pause() {
- }
- public void registerWorkers() {
- createWorker(new Looped() {
- public int loop() {
- if (shouldKill) {
- log.log("Killed working worker!");
- return -1;
- }
- if (game.getCurrentTab() != 4) {
- game.openTab(4);
- }
- if (inventory.isFull()) {
- if (bank.isOpen()) {
- status = ("Depositing everything");
- bank.depositAllExcept(Repellent);
- sleep(random(750, 1000));
- status = ("Walking To Field");
- if (i == 1) {
- walking.walkPath(bankToField);
- } else if (i == 2) {
- walking.walkPath(bankToFieldTwo);
- }
- return (random(500, 600));
- }
- if (isInBank() && !bank.isOpen()) {
- status = ("Opening Bank");
- PhysicalObject Banker = objects.getClosestObject(12, BankerId);
- Banker.doAction("Use-Quickly");
- return random(1100, 1350);
- }
- if (inventory.isFull() && isInField()) {
- status = ("Walking To Bank");
- if (GateClosed != null) {
- status = ("Opening Gate we need to go to the bank");
- PhysicalObject Gate = objects.getClosestObject(12, GateClosed);
- Gate.doAction("Open");
- return random(1100, 1350);
- }
- if (GateClosed == null && inventory.isFull() && isInField()) {
- status = ("Gate is open, we can walk to bank");
- if (b == 1) {
- walking.walkPath(fieldToBank);
- } else if (b == 2) {
- walking.walkPath(fieldToBankTwo);
- } else walking.walkPath(fieldToBankThree);
- }
- return random(500, 600);
- }
- } else { if (!inventory.isFull())
- if (isInBank()) {
- status = ("Walking To The Field");
- walking.walkPath(bankToField);
- }
- if (GateClosed != null ) {
- status = ("Opening Gate");
- PhysicalObject Gate = objects.getClosestObject(12, GateClosed);
- Gate.doAction("Open");
- sleep(random(1000,1500));
- } else { if (GateOpen !=null){
- status = ("Gate is open, we can walk to honeycombs");
- walking.walkToMM(new Tile(2763, 3443));
- return random(750, 1000);
- }
- }
- }
- /* if (isInField() && !inventory.isFull()) {
- // get honeycombs
- } */
- return random(300, 500);
- }
- });
- createWorker(new Looped() {
- public int loop() {
- if (shouldKill) {
- log.log("Killed AntiBan!");
- return -1;
- }
- loopCount++;
- if (randNumber == 0) {
- randNumber = random(20000, 30000);
- }
- if (loopCount >= randNumber) {
- camera.setAngle(random(0, 359)); //rotate camera randomly
- loopCount = 0; //and reset counts and random number
- randNumber = 0;
- }
- return 1;
- }
- });
- }
- }
Add Comment
Please, Sign In to add comment