All pastes #258823 Raw Edit

Someone

public java v1 · immutable
#258823 ·published 2006-11-26 21:31 UTC
rendered paste body
import impsoft.ibot.Areas;import impsoft.ibot.Info;import impsoft.ibot.methods.RGB;import impsoft.ibot.methods.Script;import impsoft.ibot.methods.XY;import java.awt.Rectangle;import java.awt.event.KeyEvent;public class UltimateChopper extends Script {	public static double version = 1.0;	public static String[] commands = new String[] { "Min Sleep, Max Sleep, Axehead R, Axehead G, Axehead B" };	public static String arugs[];		public static String author = "Evil_";		public static String description = "Power cutter, that checks level!";	public String treename = "Tree";		public String treename2;		public String treename3;	public int minsleep;	public int maxsleep;		public RGB axehead;	public RGB treecolor;	private Rectangle searchzone = new Rectangle(5, 5, 510, 330);	private XY tXY;		private XY barXY;	@Override	public boolean doStart(String cmd, String[] args) {		if (args.length > 5) {			return false;		}		UltimateChopper.arugs = args;		minsleep = Integer.parseInt(arugs[0]);		maxsleep = Integer.parseInt(arugs[1]);		treecolor = new RGB(84, 105, 0);		axehead = new RGB(Integer.parseInt(arugs[2]), Integer.parseInt(arugs[3]), Integer.parseInt(arugs[4]));		log("Set angle Up");		SendKey(KeyEvent.VK_UP,random(2500,3500));		return true;	}	@Override	public void script() throws InterruptedException {		setTab(Info.TAB_OPTIONS);		setRun(true);		mouseMove(Info.OPTION_VBRIGHT_RECTANGLE);		mouseClickLeft(Info.OPTION_VBRIGHT_RECTANGLE);		sleep(1000+random(200, 1000));	while (true) {		tXY = findXYspiral(searchzone, 260, 405, treecolor, 12, 12, 12);		log("Searching");		checkStats();		log("Found + Moving");			mouseMove(tXY);		if (getTopText().indexOf("Yew", 0) > 0)			mouseClickLeft(random(4, 510), random(4, 331));		else if ((getTopText().indexOf(treename, 0) > 0) || (getTopText().indexOf(treename2, 0) > 0) || (getTopText().indexOf(treename3, 0) > 0)) {;				sleep(400 + random(10, 300));				underAttack();				log("Trying to chop");				mouseClickLeft(tXY);				sleep(random(minsleep, maxsleep));				underAttack();				check();			}			sleep(500+random(minsleep, maxsleep));		}	}		public void check() throws InterruptedException	{		if(inventoryCount() >= 28)		{			dropInventoryExceptPick();		}	}		public void dropInventory(int invIndex) throws InterruptedException { // Xerozcheez: Credits to Rictoo		Rectangle inventorySpot = Info.getInventoryRectangle(invIndex);		int currentMouseX = currentMouseX();		int currentMouseY = currentMouseY();		if (inventorySpot.contains(currentMouseX, currentMouseY)) {			mouseClickRight(currentMouseX, currentMouseY);		} else {			mouseClickRight(inventorySpot);		}		sleep(500);		getColorArray2d(0);		XY wordDrop = findGameText("Drop", Areas.INVENTORY, new RGB(255, 255,				255), 1, 1, 255);		if (wordDrop != null) {			Rectangle dropButton = new Rectangle(wordDrop.x, wordDrop.y, 30, 8);			mouseClickLeft(dropButton);		} else {			XY wordCancel = findGameText("Cancel", Areas.INVENTORY, new RGB(					255, 255, 255), 1, 1, 255);			if (wordCancel != null) {				Rectangle cancelButton = new Rectangle(wordCancel.x,						wordCancel.y, 30, 8);				mouseClickLeft(cancelButton);			}		}		sleep(500);	}	public void dropInventoryExceptPick() throws InterruptedException { // Xerozcheez: Credits to Rictoo		if (getTab() != Info.TAB_INVENTORY) {			setTab(Info.TAB_INVENTORY);		}		for (int i = 1; i < 29; i++) {			if (!itemExist(i)) {				break;			}			log("Moving mouse to Inventory slot " + i + " ");			mouseMove(Info.getInventoryRectangle(i));			sleep(500);			getColorArray2d(0);			String topText = getTopText().trim();			if (topText.indexOf(" ") != -1 && topText.indexOf("/") != -1) {				//This determines the items name from the topText				String item = topText.substring(topText.indexOf(" "),						topText.indexOf("/")).trim();				if (item.length() > 0) {					//We dont want to drop our pickaxe					if (topText.indexOf("axe") == -1							&& topText.indexOf("options") != -1) {						log("Found a \"" + item + "\" in Inventory Slot " + i								+ " 'Dropping'");						dropInventory(i);					} else {						log("Found a \"" + item + "\" in Inventory Slot " + i);					}				}			}		}	}		public void underAttack() throws InterruptedException	{		RGB bar = new RGB(0, 255, 0);		barXY = findXYspiral(new Rectangle(230, 109, 288, 152), 267, 143, bar, 0, 0, 0);				if (barXY != null)		{			for(int x = 0; x < 4; x++)			{				mouseClickLeft(62+random(3, 5), 17+random(3, 5));				sleep(random(2000, 4000));			}		}	}		public void checkStats() throws InterruptedException	{		if (getTab() != Info.TAB_STATS)			setTab(Info.TAB_STATS);		if (getStatBottom(Info.STAT_WOODCUTTING) >= 20)		{			treename2 = "Oak";		}		else		{			treename2 = "";		}		if (getStatBottom(Info.STAT_WOODCUTTING) >= 40)		{			treename3 = "Willow";		}		else		{			treename3 = "";		}	}}