All pastes #344545 Raw Edit

Something

public java v1 · immutable
·published 2007-02-07 20:53 UTC
rendered paste body
package impsoft.nexus.bots.color.methods;import java.awt.Rectangle;import java.awt.event.KeyEvent;import javax.swing.plaf.basic.BasicSplitPaneUI.KeyboardEndHandler;import impsoft.nexus.botbase.CoreBot;import impsoft.nexus.bots.color.ColorBot;import impsoft.nexus.bots.color.constants.Areas;import impsoft.nexus.bots.color.scriptobjects.DTM;import impsoft.nexus.bots.color.scriptobjects.RGB;import impsoft.nexus.bots.color.scriptobjects.XY;import impsoft.nexus.components.input.InputBot;public abstract class SCAR extends EasyScript {    /*     * SCAR     */		public int Random(int max){		return random(0, max);	}    public XY FindColor(int color, int xs, int ys, int xe, int ye) {        return findXY(getColorArray2d(), new RGB(color), rectangleFromScar(xs,                ys, xe, ye));    }    public RGB getColor(int x, int y) {        return getRGB(x, y);    }    public XY FindColorTolerance(int color, int xs, int ys, int xe, int ye,            int tolerance) {        return findXY(getColorArray2d(), new RGB(color), rectangleFromScar(xs,                ys, xe, ye), tolerance, tolerance, tolerance);    }    public XY FindColorSpiral(int color, int xs, int ys, int xe, int ye) {        return findXYspiral(getColorArray2d(), new RGB(color),                rectangleFromScar(xs, ys, xe, ye));    }    public XY FindColorSpiralTolerance(int color, int xs, int ys, int xe,            int ye, int tolerance) {        return findXYspiral(getColorArray2d(), new RGB(color),                rectangleFromScar(xs, ys, xe, ye), tolerance, tolerance, tolerance);    }    public XY FindBitmap(short[][][] colorMapTofind) {        XY[] places = findXYs(getColorArray2d(), 1, colorMapTofind,                Areas.ENTIRE);        if (places.length == 1)            return places[0];        return null;    }        public XY FindBitmapIn(short[][][] colorMapTofind,int xs, int ys, int xe, int ye) {        XY[] places = findXYs(getColorArray2d(), 1, colorMapTofind,                rectangleFromScar(xs, ys, xe, ye));        if (places.length == 1)            return places[0];        return null;    }        public XY FindBitmapToleranceIn(short[][][] colorMapTofind, int xs, int ys, int xe, int ye, int tolerance) {        XY[] places = findXYs(getColorArray2d(), 1, colorMapTofind,                rectangleFromScar(xs, ys, xe, ye), tolerance, tolerance, tolerance);        if (places.length == 1)            return places[0];        return null;    }    public XY FindDeformedBitmapToleranceIn(short[][][] colorMapTofind, Rectangle rec, int tolerance, double accuracy) {        XY[] places = findXYs(getColorArray2d(), 1, colorMapTofind,                rec, accuracy, tolerance, tolerance, tolerance);        if (places.length == 1)            return places[0];        return null;    }        public XY FindDeformedBitmapToleranceIn(short[][][] colorMapTofind, int xs, int ys, int xe, int ye, int tolerance, double accuracy) {        XY[] places = findXYs(getColorArray2d(), 1, colorMapTofind,                rectangleFromScar(xs, ys, xe, ye), accuracy, tolerance, tolerance, tolerance);        if (places.length == 1)            return places[0];        return null;    }        public XY FindDeformedBitmapToleranceRotationIn(short[][][] colorMapTofind, int xs, int ys, int xe, int ye, int tolerance, double accuracy, double startAngle, double endAngle, double angleIntervalSize) {        for(;startAngle<endAngle;startAngle+=angleIntervalSize){        	XY[] places = findXYs(getColorArray2d(), 1, RotateBitmap(colorMapTofind,startAngle),                    rectangleFromScar(xs, ys, xe, ye), accuracy, tolerance, tolerance, tolerance);            if (places.length == 1)                return places[0];        }        return null;    }        public short[][][] RotateBitmap(short[][][] ColorMapToRotate, double theta){    	return trimColorMap(rotateColorMap(ColorMapToRotate, theta));    }        public boolean SimilarColors(int color,int color2,int tolerance){    	return compareColor(color, RGB.COLOR_TYPE_SCAR, color2, RGB.COLOR_TYPE_SCAR, tolerance, tolerance, tolerance);    }        public XY FindDTM(DTM[] dtm, int xs, int ys, int xe,            int ye) {    	return findDTM(getColorArray2d(), dtm, rectangleFromScar(xs, ys, xe, ye));    }        public Rectangle rectangleFromScar(int x0, int y0, int x1, int y1) {        return new Rectangle(x0, y0, x1 - x0, y1 - y0);    }        public void SendArrowSilentWait(int key, int time) throws InterruptedException{    	switch(key){    	case 0 : SendKey(KeyEvent.VK_UP,time);break;    	case 1 : SendKey(KeyEvent.VK_RIGHT,time);break;    	case 2 : SendKey(KeyEvent.VK_DOWN,time);break;    	case 3 : SendKey(KeyEvent.VK_LEFT,time);break;    	}     }}