All pastes #2056427 Raw Edit

Miscellany

public text v1 · immutable
#2056427 ·published 2011-05-10 20:17 UTC
rendered paste body
import impsoft.bots.ColorBot;
import impsoft.scripting.ibot.interfaces.AutoPaint;
import impsoft.scripting.ibot.structs.AryanTile;
import impsoft.scripting.ibot.structs.AryanTileZone;
import impsoft.scripting.types.ColorScript;
import impsoft.scripting.ibot.itemrec.ItemNameExact;
import impsoft.utils.general.Timer;
import java.awt.Color;
import java.awt.Graphics;
import impsoft.scripting.ibot.interfaces.AutoPaint;
import impsoft.bots.reflection.NPC;
import impsoft.bots.reflection.NPCIterator;

import java.awt.Graphics;

import bergCoder.BergUtils;


public class Decanter extends ColorScript implements AutoPaint {

	// Script Info
	public static String author = "TJ!";
	public static String description = "Decants Pots";
	public static double version = 0.1;
	
	// Declare "util" to be an object type of BergUtils for use later.
	BergUtils util = new BergUtils(this);
	int itemsBanked = 0;
	
	// Public Variables
	long startTime = System.currentTimeMillis();
	private Timer timeRan = new Timer(0);


	public Decanter(ColorBot c) {
		super(c);
	}

	public void script() throws InterruptedException {

		while(!isLoggedIn()){
            log("|| Waiting for Login ||");
            sleep(600,1600);
         }

		log(" || AutoDecanter is active ||");
		
		// Walk to the decantNPC in case not starting at GE.
		walk();
		while(isLoggedIn()) {
			bankItems();
			sleep(300,500);
			walk();
			sleep(100,200);
			decant();
		}

	}
	 
	
	public void walk() throws InterruptedException{
		AryanTileZone decantNPCLocation = new AryanTileZone (new AryanTile(3157, 3480), (new AryanTile(3155, 3481)));
		theWorldMap.walkTo(decantNPCLocation.random());
		log("Walking to the decant NPC.");
	}

	public void decant() throws InterruptedException {
		NPC decantNPC = util.getNPCByName("Bob Barter");
		util.doNPC(decantNPC, "Decant");
		sleep(1500,2000);
	}

	public void bankItems() throws InterruptedException {
		theWorldMap.walkToBank();
		log("Walking to bank.");
		itemsBanked += theTabs.Inventory.getCount();
		theBank.doDepositAll();
		log("Depositing all items.");
		theBank.doWithDrawAll(new ItemNameExact("Extreme attack (3)"), true);
		log("Withdrawing all Extreme Attack (3)'s");
		theBank.exit();
		log("Exiting bank.");
	}
	

	public void paint(Graphics g) {
		g.setColor(new Color(0, 0, 0, 200)); // Sets color for background (In RGBA)
		g.drawRect(10, 10, 250, 50); // Draws a 250x250 Rectangle at (10,10);
		g.fillRect(10, 10, 250, 50); // Fill the rectangle with the color.
		
		g.setColor(Color.WHITE);
		g.drawString("AutoDecanter - v0.1 - By: TJ!", 15, 25);
		g.drawString("Time Ran: " + timeRan.toStringTimeElapsed(), 15, 40);
		g.drawString("Items Banked: " + itemsBanked, 15, 55);
	
	}

}