ULTIMATE GUIDE

LoG iN

ULTIMATE GUIDE


    GraniteBreaker

    Share

    Turk4life321
    Admin

    Posts : 41
    Join date : 2009-08-09
    Location : In Saims Room *cough*

    GraniteBreaker

    Post  Turk4life321 on Fri Jan 01, 2010 4:45 am

    import java.awt.Color;
    import java.awt.Graphics;
    import java.util.Map;

    import org.rsbot.event.listeners.PaintListener;
    import org.rsbot.script.Constants;
    import org.rsbot.script.Script;
    import org.rsbot.script.ScriptManifest;
    import org.rsbot.script.wrappers.RSInterface;

    @ScriptManifest(authors = { "Marneus901" }, category = "Money", name = "Granite Breaker",
    description = "Just start script with chisle in inventory", version = 0.2)
    public class GraniteBreaker extends Script implements PaintListener{
    public String getName(){return "GraniteBreaker";}
    public String getAuthor(){return "Marneus901";}
    public String getScriptCategory(){return "Money";}
    public double getVersion(){return 0.2;}
    public long runTime=0;
    public long millis;
    public long hours;
    public long minutes;
    public long seconds;
    public int kg5 = 6983;
    public int kg2 = 6981;
    public int g500 = 6979;
    public int CHISLE = 1755;
    public float kg5Broke=0;
    public float kg2Broke=0;
    public int g500Gained=0;

    @Override
    public int getMouseSpeed(){
    return 1;
    }
    public boolean onStart(Map<String, String> args) {
    runTime=System.currentTimeMillis();
    return true;
    }
    public void break5KG(){
    if(bank.isOpen()){
    atInterface(Constants.INTERFACE_BANK,
    Constants.INTERFACE_BANK_BUTTON_CLOSE);
    for(int i=0;i<30;++i){
    if(!bank.isOpen())
    break;
    wait(random(100,200));
    }
    return;
    }
    if(RSInterface.getChildInterface(228, 2).isValid()){
    atInterface(RSInterface.getChildInterface(228, 2));
    if(waitForAnim(3000)==11146){
    kg5Broke++;
    g500Gained+=2;
    }
    return;
    }
    atInventoryItem(CHISLE, "Use");
    wait(random(500,1000));
    if(getMenuIndex("->")!=-1){
    atInventoryItem(kg5, "Use");
    wait(random(1000,1500));
    }
    return;
    }
    public void break2KG(){
    if(bank.isOpen()){
    atInterface(Constants.INTERFACE_BANK,
    Constants.INTERFACE_BANK_BUTTON_CLOSE);
    for(int i=0;i<30;++i){
    if(!bank.isOpen())
    break;
    wait(random(100,200));
    }
    return;
    }
    if(RSInterface.getChildInterface(228, 2).isValid()){
    atInterface(RSInterface.getChildInterface(228, 2));
    if(waitForAnim(3000)==11146){
    kg2Broke++;
    g500Gained+=4;
    }
    return;
    }
    atInventoryItem(CHISLE, "Use");
    wait(random(500,1000));
    if(getMenuIndex("->")!=-1){
    atInventoryItem(kg2, "Use");
    wait(random(1000,1500));
    }
    return;
    }
    public void bankMyShit(){
    if(bank.isOpen()){
    if(getInventoryCountExcept(CHISLE)>1){
    bank.depositAllExcept(CHISLE);
    for(int i=0;i<20;++i){
    if(getInventoryCountExcept(CHISLE)==0)
    break;
    wait(random(150,200));
    }
    return;
    }

    int itemWidthdrawl=0;
    if(bank.getItemByID(kg5)!=null)
    itemWidthdrawl=kg5;
    else if(bank.getItemByID(kg2)!=null)
    itemWidthdrawl=kg2;
    else{
    log("Out of granite!");
    stopScript();
    }

    int kg5Check=0, kg2Check=0;
    kg5Check=getInventoryCount(kg5);
    kg2Check=getInventoryCount(kg2);
    if(itemWidthdrawl==kg5){
    bank.withdraw(kg5, 6-kg5Check);
    for(int i=0;i<20;++i){
    if(getInventoryCount(kg5)>kg5Check){
    log("We successfully widthdrew 5kg granite");
    kg5Check=0;
    break;
    }
    wait(random(150,200));
    }
    }
    else if(itemWidthdrawl==kg2){
    bank.withdraw(kg2, 6-kg2Check);
    for(int i=0;i<20;++i){
    if(getInventoryCount(kg2)>kg2Check){
    log("We successfully widthdrew 2kg granite");
    kg2Check=0;
    break;
    }
    wait(random(150,200));
    }
    }
    else{
    log("Something went wrong!");
    return;
    }

    return;
    }
    bank.open();
    for(int i=0;i<20;++i){
    if(bank.isOpen())
    return;
    wait(100);
    }
    }
    @Override
    public int loop() {
    if(getMenuIndex("->")!=-1){
    clickMouse(false);
    wait(random(100,150));
    try{
    atMenu("Cancel");
    return 10;
    }
    catch(Exception e){
    return 10;
    }
    }
    if(getInventoryCount(kg5)>0 && (28-getInventoryCount())>3){
    break5KG();
    return 10;
    }
    if(getInventoryCount(kg2)>0 && (28-getInventoryCount())>3){
    break2KG();
    return 10;
    }
    bankMyShit();
    return 10;
    }
    @Override
    public void onRepaint(Graphics g) {
    int X = 305;
    int Y = 5;
    millis = System.currentTimeMillis() - runTime;
    hours = millis / (1000 * 60 * 60);
    millis -= hours * (1000 * 60 * 60);
    minutes = millis / (1000 * 60);
    millis -= minutes * (1000 * 60);
    seconds = millis / 1000;
    g.setColor(new Color(112,138,144, 255));//Draw
    g.drawRect(X, Y, 210, 95);
    g.setColor(new Color(112,138,144, 150));//Fill
    g.fillRect(X, Y, 210, 95);
    g.setColor(new Color(255, 250, 250, 255));
    Y+=15;
    X+=5;
    g.drawString(getName() + " v" + getVersion(), X, Y);
    Y+=15;
    g.drawString("Runtime : " + hours + ":" + minutes + ":" + seconds, X, Y);
    Y+=15;
    g.drawString("5kg Broke : " + (int)kg5Broke, X, Y);
    Y+=15;
    g.drawString("2kg Broke : " + (int)kg2Broke, X, Y);
    Y+=15;
    g.drawString("500g Acquired : " + g500Gained, X, Y);
    Y+=15;
    g.drawString("Blocks/Hour : " + (int)(((kg5Broke+kg2Broke)*3600)/(((hours*60)*60)+(minutes*60)+seconds)), X, Y);
    }
    }

      Current date/time is Sat Nov 18, 2017 3:11 pm