All pastes #261443 Raw Edit

Someone

public java v1 · immutable
#261443 ·published 2006-11-29 06:56 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;    }    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() throws InterruptedException {        XY[] xys = new XY[0];        for (int attempts = 0; attempts < 3 && xys.length == 0; attempts++) {            if (attempts > 0)                sleep(defaultmaxAgeInMillisecs * 3);            // refresh color array, hopefully enough time for everything to be            // synched            getColorArray2d(0);            Rectangle[] npsRecs = getNpcsOnMinimap();            Rectangle[] itemsRecs = getItemsOnMinimap();            Rectangle[] playerRecs = getPlayersOnMinimap();            Rectangle[] allRecs = new Rectangle[npsRecs.length                    + itemsRecs.length + playerRecs.length];            int index = 0;            for (int i = 0; i < npsRecs.length; i++) {                allRecs[index++] = npsRecs[i];            }            for (int i = 0; i < itemsRecs.length; i++) {                allRecs[index++] = itemsRecs[i];            }            for (int i = 0; i < playerRecs.length; i++) {                allRecs[index++] = playerRecs[i];            }            xys = findXYs(getColorArray2d(), Areas.MINI_MAP, allRecs,                    bankSymbol, null, 1, 10, 10, 10);        }        if (xys.length > 0) {            return bitmapToRectangle(xys[0], bankSymbol);        }        return null;    }