use of org.powerbot.script.rt4.Player in project powerbot by powerbot.
the class DrawPlayers method repaint.
public void repaint(final Graphics render) {
if (!ctx.game.loggedIn()) {
return;
}
final FontMetrics metrics = render.getFontMetrics();
for (final Player player : ctx.players.select()) {
final Point location = player.centerPoint();
if (location.x == -1 || location.y == -1) {
continue;
}
render.setColor(Color.RED);
render.fillRect((int) location.getX() - 1, (int) location.getY() - 1, 2, 2);
String s = player.name() + " (" + player.combatLevel() + ")";
render.setColor(player.inCombat() ? Color.RED : player.inMotion() ? Color.GREEN : Color.WHITE);
render.drawString(s, location.x - metrics.stringWidth(s) / 2, location.y - metrics.getHeight() / 2);
final String msg = player.overheadMessage();
boolean raised = false;
if (player.animation() != -1 || player.stance() != -1 || player.npcId() != -1) {
s = "";
s += "(";
if (player.npcId() != -1) {
s += "NPC: " + player.npcId() + " | ";
}
if (player.prayerIcon() != -1) {
s += "P: " + player.prayerIcon() + " | ";
}
if (player.skullIcon() != -1) {
s += "SK: " + player.skullIcon() + " | ";
}
if (player.animation() != -1 || player.stance() > 0) {
s += "A: " + player.animation() + " | ST: " + player.stance() + " | ";
}
s = s.substring(0, s.lastIndexOf(" | "));
s += ")";
render.drawString(s, location.x - metrics.stringWidth(s) / 2, location.y - metrics.getHeight() * 3 / 2);
raised = true;
}
if (msg != null) {
render.setColor(Color.ORANGE);
render.drawString(msg, location.x - metrics.stringWidth(msg) / 2, location.y - metrics.getHeight() * (raised ? 5 : 3) / 2);
}
}
}
use of org.powerbot.script.rt4.Player in project powerbot by powerbot.
the class DrawObjects method repaint.
@Override
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 FontMetrics metrics = render.getFontMetrics();
final int textHeight = metrics.getHeight();
final Map<Tile, AtomicInteger> counts = new HashMap<Tile, AtomicInteger>();
for (final GameObject object : ctx.objects.select(8)) {
final Tile t = object.tile();
if (t == null) {
continue;
}
if (!counts.containsKey(t)) {
counts.put(t, new AtomicInteger(0));
}
final Point p = object.centerPoint();
if (p.x == -1) {
continue;
}
render.setColor(Color.black);
render.fillRect(p.x - 1, p.y - 1, 2, 2);
final String s = Integer.toString(object.id());
final int ty = p.y - textHeight / 2;
final int tx = p.x - metrics.stringWidth(s) / 2;
render.setColor(C[object.type().ordinal()]);
final StringBuilder b = new StringBuilder(s);
final String n = object.name();
if (!n.isEmpty() && !n.equals("null")) {
int[] arr = object.meshIds();
if (arr.length < 1) {
arr = new int[] { -1 };
}
b.append(" (").append(n).append('/').append(arr[0]).append(')');
}
render.drawString(b.toString(), tx, ty - textHeight * counts.get(t).getAndIncrement());
}
}
use of org.powerbot.script.rt4.Player in project powerbot by powerbot.
the class TLocation method draw.
public int draw(int idx, final Graphics render) {
final Player player = ctx.players.local();
if (player != null) {
final Tile tile = player.tile();
drawLine(render, idx++, "Position: " + (tile != null ? tile.toString() : ""));
}
return idx;
}
use of org.powerbot.script.rt4.Player in project powerbot by powerbot.
the class TLocation method draw.
public int draw(int idx, final Graphics render) {
final Player player = ctx.players.local();
if (player != null) {
final Tile tile = player.tile();
drawLine(render, idx++, "Position: " + (tile != null ? tile.toString() : ""));
}
return idx;
}
use of org.powerbot.script.rt4.Player in project powerbot by powerbot.
the class TPlayer method draw.
@SuppressWarnings("deprecation")
public int draw(int idx, final Graphics render) {
final Player player = ctx.players.local();
drawLine(render, idx++, String.format("[%s] A: %d, CBL: %d, HP: %d, T: %d, S: %d, INT: %s", player.name(), player.animation(), player.combatLevel(), player.health(), player.team(), player.speed(), player.interacting()));
drawLine(render, idx++, String.format("ORIENT: %d, COMBAT: %s, APP (VE): %s", player.orientation(), Boolean.toString(player.inCombat()), Arrays.toString(player.appearance())));
return idx;
}
Aggregations