use of org.powerbot.script.rt6.Item in project ORCID-Source by ORCID.
the class WorkManagerImpl method createItemList.
private List<Item> createItemList(WorkEntity workEntity) {
Item item = new Item();
item.setItemName(workEntity.getTitle());
item.setItemType(ItemType.WORK);
item.setPutCode(String.valueOf(workEntity.getId()));
return Arrays.asList(item);
}
use of org.powerbot.script.rt6.Item in project ORCID-Source by ORCID.
the class ExternalIDValidatorTest method testValidateNotificationItems.
@Test
public void testValidateNotificationItems() {
Item i = new Item();
Item i2 = new Item();
Items items = new Items();
ExternalID id1 = new ExternalID();
id1.setRelationship(Relationship.SELF);
id1.setType("doi");
id1.setValue("value1");
id1.setUrl(new Url("http://value1.com"));
ExternalID id2 = new ExternalID();
id2.setRelationship(Relationship.SELF);
id2.setType("source-work-id");
id2.setValue("value2");
id2.setUrl(new Url("http://value1.com"));
i.setExternalIdentifier(id1);
i2.setExternalIdentifier(id2);
items.getItems().add(i);
items.getItems().add(i2);
// both valid
validator.validateNotificationItems(items);
// IDS one valid, one invalid
id2.setType("blah");
try {
validator.validateNotificationItems(items);
fail("no exception thrown for invalid type");
} catch (Exception e) {
if (!(e instanceof ActivityIdentifierValidationException))
throw e;
}
// IDS one valid, one VALID due to null (at least we have to do this if we want other tests to pass!)
id2.setType(null);
validator.validateNotificationItems(items);
}
use of org.powerbot.script.rt6.Item in project ORCID-Source by ORCID.
the class EmailMessageSenderTest method createActivity.
private Item createActivity(ItemType actType, String actName, String doi) {
Item act = new Item();
act.setItemType(actType);
act.setItemName(actName);
ExternalID extId = new ExternalID();
extId.setType("doi");
extId.setValue(doi);
act.setExternalIdentifier(extId);
return act;
}
use of org.powerbot.script.rt6.Item in project powerbot by powerbot.
the class DrawItems method repaint.
public void repaint(final Graphics render) {
if (!ctx.game.loggedIn()) {
return;
}
render.setFont(new Font("Arial", 0, 10));
render.setColor(Color.green);
if (ctx.bank.opened()) {
final Component container = ctx.widgets.component(Constants.BANK_WIDGET, Constants.BANK_ITEMS);
final Rectangle r = container.viewportRect();
if (r != null) {
for (final Item item : ctx.bank.select()) {
final Component c = item.component();
if (c == null) {
continue;
}
final Rectangle r2 = c.boundingRect();
if (r2 == null) {
continue;
}
if (c.relativePoint().y == 0 || !r.contains(r2)) {
continue;
}
final Point p = c.screenPoint();
render.drawString(c.itemId() + "", p.x, p.y + c.height());
}
}
}
if (ctx.backpack.component().visible()) {
for (final Item item : ctx.backpack.select()) {
final Component c = item.component();
if (c == null) {
continue;
}
final Point p = c.screenPoint();
render.drawString(c.itemId() + "", p.x, p.y + c.height());
}
}
if (ctx.equipment.component().visible()) {
for (final Item item : ctx.equipment.select()) {
if (item == null) {
continue;
}
final Component c = item.component();
if (c == null) {
continue;
}
final Point p = c.screenPoint();
render.drawString(c.itemId() + "", p.x, p.y + c.height());
}
}
}
use of org.powerbot.script.rt6.Item in project powerbot by powerbot.
the class TicketDestroy method poll.
@Override
public void poll() {
if (ctx.properties.getProperty("key.token.disable", "").equals("true")) {
// TODO: review this random event
return;
}
final Item item = ctx.backpack.select().id(Constants.TICKETDESTROY_ITEMS).poll();
if (!item.valid() || !ctx.hud.opened(Hud.Window.BACKPACK) || !ctx.players.local().idle()) {
priority.set(0);
return;
}
priority.set(3);
if (!ctx.backpack.scroll(item)) {
return;
}
if (((ctx.varpbits.varpbit(1448) & 0xFF00) >>> 8) < (item.id() == Constants.TICKETDESTROY_ITEMS[0] ? 10 : 9)) {
item.interact("Claim");
return;
}
if (!item.interact("Destroy")) {
return;
}
final Widget widget = ctx.widgets.widget(1183);
if (!Condition.wait(new Condition.Check() {
@Override
public boolean poll() {
return widget.valid();
}
})) {
return;
}
Component component = null;
for (final Component c : widget.components()) {
if (c.visible() && c.tooltip().trim().equalsIgnoreCase("destroy")) {
component = c;
break;
}
}
if (component != null && component.interact("Destroy")) {
Condition.wait(new Condition.Check() {
@Override
public boolean poll() {
return item.component().itemId() == -1;
}
}, 175);
}
}
Aggregations