All pastes #261439 Raw Edit

Unnamed

public java v1 · immutable
#261439 ·published 2006-11-29 06:51 UTC
rendered paste body
    /**     *      * @return the Rectangles on the minimap that are npc dots     */    public Rectangle[] getNpcsOnMinimap() {        XY[] npcs = findXYs(Areas.MINI_MAP, MiniMap.npc, 60);        Rectangle[] recs = new Rectangle[npcs.length];        for (int i = 0; i < recs.length; i++) {            recs[i] = bitmapToRectangle(npcs[i], MiniMap.npc);        }        return recs;    }    /**     *      * @return the Rectangles on the minimap that are player dots     */    public Rectangle[] getPlayersOnMinimap() {        XY[] players = findXYs(Areas.MINI_MAP, MiniMap.player, 60);        Rectangle[] recs = new Rectangle[players.length];        for (int i = 0; i < recs.length; i++) {            recs[i] = bitmapToRectangle(players[i], MiniMap.player);        }        return recs;    }    /**     *      * @return the Rectangles on the minimap that are item dots     */    public Rectangle[] getItemsOnMinimap() {        XY[] items = findXYs(Areas.MINI_MAP, MiniMap.item, 60);        Rectangle[] recs = new Rectangle[items.length];        for (int i = 0; i < recs.length; i++) {            recs[i] = bitmapToRectangle(items[i], MiniMap.item);        }        return recs;    }    /**     * Checks For A Colour On The MiniMap     *      * @param colourRGB     *            the color     * @return true if color is found     */    public boolean isColourOnMiniMap(RGB colourRGB) {        return findRGBXY(getColorArray2d(), Areas.MINI_MAP, colourRGB) != null;    }    public static final short[][][] bankSymbol = makeBackSymbol();    public static short[][][] makeBackSymbol() {        short[][][] colorMap = loadBitmap("bitmaps/bankicon.bmp");        for (int x = 0; x < colorMap.length; x++) {            for (int y = 0; y < colorMap[0].length; y++) {                if (colorMap[x][y][0] == 255 && colorMap[x][y][1] == 0                        && colorMap[x][y][2] == 0) {                    colorMap[x][y][0] = BitMapInfo.BITMAP_ANY;                }            }        }        return colorMap;    }    public Rectangle findBankSymbol() {        XY[] xys = new XY[0];        for (int attempts = 0; attempts < 3 && xys.length == 0; attempts++) {            // refresh color array, hopefully enough time for everything to be            // synched            getColorArray2d(0);            Rectangle[] rec1 = getNpcsOnMinimap();            Rectangle[] rec2 = getItemsOnMinimap();            Rectangle[] rec3 = getPlayersOnMinimap();            Rectangle[] recs = new Rectangle[rec1.length + rec2.length                    + rec3.length];            int index = 0;            for (int i = 0; i < rec1.length; i++) {                recs[index++] = rec1[i];            }            for (int i = 0; i < rec2.length; i++) {                recs[index++] = rec2[i];            }            for (int i = 0; i < rec3.length; i++) {                recs[index++] = rec3[i];            }            xys = findXYs(getColorArray2d(), Areas.MINI_MAP, recs, bankSymbol,                    null, 1, 10, 10, 10);        }        if (xys.length > 0) {            return bitmapToRectangle(xys[0], bankSymbol);        }        return null;    }