use of org.powerbot.script.rt4.Player in project powerbot by powerbot.
the class TPlayer method draw.
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.healthPercent(), 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;
}
use of org.powerbot.script.rt4.Player 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);
}
}
}
}
use of org.powerbot.script.rt4.Player in project powerbot by powerbot.
the class DrawPlayers method repaint.
@SuppressWarnings("deprecation")
public void repaint(final Graphics render) {
if (ctx.game.clientState() != Constants.GAME_LOADED) {
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() + " [" + player.health() + "])";
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) {
s = "";
s += "(";
if (player.animation() != -1) {
s += "A: " + player.animation() + " | ST: -1 | ";
}
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 ExoPlayer by google.
the class ImaAdsLoader method getCurrentAdTagLoader.
@Nullable
private AdTagLoader getCurrentAdTagLoader() {
@Nullable Player player = this.player;
if (player == null) {
return null;
}
Timeline timeline = player.getCurrentTimeline();
if (timeline.isEmpty()) {
return null;
}
int periodIndex = player.getCurrentPeriodIndex();
@Nullable Object adsId = timeline.getPeriod(periodIndex, period).getAdsId();
if (adsId == null) {
return null;
}
@Nullable AdTagLoader adTagLoader = adTagLoaderByAdsId.get(adsId);
if (adTagLoader == null || !adTagLoaderByAdsMediaSource.containsValue(adTagLoader)) {
return null;
}
return adTagLoader;
}
use of org.powerbot.script.rt4.Player in project ExoPlayer by google.
the class SessionPlayerConnectorTest method play_withForwardingPlayer_isSkipped.
@Test
@LargeTest
public void play_withForwardingPlayer_isSkipped() throws Exception {
if (Looper.myLooper() == null) {
Looper.prepare();
}
Player forwardingPlayer = null;
SessionPlayerConnector playerConnector = null;
try {
Player exoPlayer = new ExoPlayer.Builder(context).setLooper(Looper.myLooper()).build();
forwardingPlayer = new ForwardingPlayer(exoPlayer) {
@Override
public boolean isCommandAvailable(int command) {
if (command == COMMAND_PLAY_PAUSE) {
return false;
}
return super.isCommandAvailable(command);
}
@Override
public Commands getAvailableCommands() {
return super.getAvailableCommands().buildUpon().remove(COMMAND_PLAY_PAUSE).build();
}
};
playerConnector = new SessionPlayerConnector(forwardingPlayer);
assertPlayerResult(playerConnector.play(), RESULT_INFO_SKIPPED);
} finally {
if (playerConnector != null) {
playerConnector.close();
}
if (forwardingPlayer != null) {
forwardingPlayer.release();
}
}
}
Aggregations