use of org.powerbot.script.rt4.TileMatrix in project powerbot by powerbot.
the class DrawGroundItems method repaint.
public void repaint(final Graphics render) {
if (!ctx.game.loggedIn()) {
return;
}
final Player player = ctx.players.local();
if (player == null) {
return;
}
final Tile tile = player.tile();
if (tile == null) {
return;
}
final FontMetrics metrics = render.getFontMetrics();
final int tHeight = metrics.getHeight();
final int plane = ctx.game.floor();
final List<GroundItem> check = new ArrayList<GroundItem>();
ctx.groundItems.select(10).addTo(check);
for (int x = tile.x() - 10; x <= tile.x() + 10; x++) {
n: for (int y = tile.y() - 10; y <= tile.y() + 10; y++) {
int d = 0;
final Tile loc = new Tile(x, y, plane);
for (final GroundItem groundItem : ctx.groundItems.select(check).at(loc)) {
final Point screen = new TileMatrix(ctx, loc).centerPoint();
if (screen.x == -1 || screen.y == -1) {
continue n;
}
final String name = groundItem.name();
String s = "";
s += groundItem.id();
if (!name.isEmpty()) {
s += " " + name;
}
final int stack = groundItem.stackSize();
if (stack > 1) {
s += " (" + groundItem.stackSize() + ")";
}
final int ty = screen.y - tHeight * (++d) + tHeight / 2;
final int tx = screen.x - metrics.stringWidth(s) / 2;
render.setColor(Color.green);
render.drawString(s, tx, ty);
}
}
}
}
use of org.powerbot.script.rt4.TileMatrix in project powerbot by powerbot.
the class DrawProjectiles method repaint.
@Override
public void repaint(final Graphics render) {
if (!ctx.game.loggedIn()) {
return;
}
for (final Projectile projectile : ctx.projectiles.select()) {
final Tile t = projectile.tile();
final TileMatrix m = new TileMatrix(ctx, t);
if (!m.valid()) {
continue;
}
m.bounds(new int[] { -128, 128, -256, 0, -128, 128 });
m.draw(render, 255);
}
}
use of org.powerbot.script.rt4.TileMatrix in project powerbot by powerbot.
the class DrawGroundItems method repaint.
public void repaint(final Graphics render) {
if (ctx.game.clientState() != Constants.GAME_LOADED) {
return;
}
final Player player = ctx.players.local();
if (player == null) {
return;
}
final Tile tile = player.tile();
if (tile == null) {
return;
}
final FontMetrics metrics = render.getFontMetrics();
final int tHeight = metrics.getHeight();
final List<GroundItem> check = new ArrayList<GroundItem>();
ctx.groundItems.select(10).addTo(check);
for (int x = -10; x <= 10; x++) {
for (int y = -10; y <= 10; y++) {
int d = 0;
final Tile loc = tile.derive(x, y);
final Point screen = new TileMatrix(ctx, loc).centerPoint();
if (screen.x == -1) {
continue;
}
for (final GroundItem groundItem : ctx.groundItems.select(check).at(loc)) {
final String name = groundItem.name();
String s = "";
s += groundItem.id();
if (!name.isEmpty()) {
s += " " + name;
}
final int stack = groundItem.stackSize();
if (stack > 1) {
s += " (" + stack + ")";
}
final int ty = screen.y - tHeight * (++d) + tHeight / 2;
final int tx = screen.x - metrics.stringWidth(s) / 2;
render.setColor(Color.green);
render.drawString(s, tx, ty);
}
}
}
}
Aggregations