Jump to content

getPositionTileFlag() / getLocalPositionTileFlag [Snippet]


Botre

Recommended Posts


package mapdata.Botrepreneur;

import org.osbot.rs07.api.map.Position;

import org.osbot.rs07.script.Script;

public class FlagMethods {

/**

* @author Botrepreneur

* @Version: 00.20 *Deux*

*/

public static Flag getPositionTileFlag(Script script, Position position) {

int flagValue = script.getClient().accessor.getClippingPlanes()[script.getClient().accessor.getPlane()].getTileFlags()[position.getLocalX(script.getBot())][position.getLocalY(script.getBot())];

return FlagMethods.getFlag(flagValue);

}

public static Flag getLocalPositionTileFlag(Script script, Position localPosition) {

int flagValue = script.getClient().accessor.getClippingPlanes()[script.getClient().accessor.getPlane()].getTileFlags()[localPosition.getX()][localPosition.getY()];

return FlagMethods.getFlag(flagValue);

}

public static Flag getLocalPositionTileFlag(Script script, int localX, int localY) {

int flagValue = script.getClient().accessor.getClippingPlanes()[script.getClient().accessor.getPlane()].getTileFlags()[localX][localY];

return FlagMethods.getFlag(flagValue);

}

private static Flag getFlag(int flagValue) {

if (flagValue == 0) {

return Flag.NULL;

} else {

for (int i = 0; i < Flag.values().length; i++) {

if ((Flag.values().getFlag() & flagValue) != 0) {

return Flag.values();

}

}

}

return null;

}

}


package mapdata.Botrepreneur;

import java.awt.Color;

public enum Flag {

/**

* @author Botrepreneur

* @Version: 00.00 *Deux*

*/

WALL_NORTHWEST(0x1, Color.ORANGE),

WALL_NORTH(0x2, Color.ORANGE),

WALL_NORTHEAST(0x4, Color.ORANGE),

WALL_EAST(0x8, Color.ORANGE),

WALL_SOUTHEAST(0x10, Color.ORANGE),

WALL_SOUTH(0x20, Color.ORANGE),

WALL_SOUTHWEST(0x40, Color.ORANGE),

WALL_WEST(0x80, Color.ORANGE),

OBJECT_TILE(0x100, Color.RED.brighter()),

WALL_BLOCK_NORTHWEST(0x200, Color.ORANGE.darker()),

WALL_BLOCK_NORTH(0x400, Color.ORANGE.darker()),

WALL_BLOCK_NORTHEAST(0x800, Color.ORANGE.darker()),

WALL_BLOCK_EAST(0x1000, Color.ORANGE.darker()),

WALL_BLOCK_SOUTHEAST(0x2000, Color.ORANGE.darker()),

WALL_BLOCK_SOUTH(0x4000, Color.ORANGE.darker()),

WALL_BLOCK_SOUTHWEST(0x8000, Color.ORANGE.darker()),

WALL_BLOCK_WEST(0x10000, Color.ORANGE.darker()),

OBJECT_BLOCK(0x20000, Color.RED.darker()),

DECORATION_BLOCK(0x40000, Color.PINK),

WALL_ALLOW_RANGE_NORTHWEST(0x400000, Color.ORANGE.brighter()),

WALL_ALLOW_RANGE_NORTH(0x800000, Color.ORANGE.brighter()),

WALL_ALLOW_RANGE_NORTHEAST(0x1000000, Color.ORANGE.brighter()),

WALL_ALLOW_RANGE_EAST(0x2000000, Color.ORANGE.brighter()),

WALL_ALLOW_RANGE_SOUTHEAST(0x4000000, Color.ORANGE.brighter()),

WALL_ALLOW_RANGE_SOUTH(0x8000000, Color.ORANGE.brighter()),

WALL_ALLOW_RANGE_SOUTHWEST(0x10000000, Color.ORANGE.brighter()),

WALL_ALLOW_RANGE_WEST(0x20000000, Color.ORANGE.brighter()),

OBJECT_ALLOW_RANGE(0x40000000, Color.ORANGE.brighter()),

WATER(0x200000, Color.BLUE),

NULL(0x0, Color.GREEN);

private int flag;

private Color color;

Flag(final int flag, final Color color) {

this.flag = flag;

this.color = color;

}

public int getFlag() {

return this.flag;

}

public Color getColor() {

return this.color;

}

public String toString() {

return this.name();

}

}

Edited by Botrepreneur
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...