use of net.runelite.api.Item in project runelite by runelite.
the class RSItemContainerMixin method getItems.
@Inject
@Override
public Item[] getItems() {
int[] itemIds = getItemIds();
int[] stackSizes = getStackSizes();
Item[] items = new Item[itemIds.length];
for (int i = 0; i < itemIds.length; ++i) {
RSItem item = client.createItem();
item.setId(itemIds[i]);
item.setQuantity(stackSizes[i]);
items[i] = item;
}
return items;
}
use of net.runelite.api.Item in project runelite by runelite.
the class PuzzleSolverOverlay method getItemIds.
private int[] getItemIds(ItemContainer container) {
int[] itemIds = new int[DIMENSION * DIMENSION];
Item[] items = container.getItems();
for (int i = 0; i < items.length; i++) {
itemIds[i] = items[i].getId();
}
// If blank is in the last position, items doesn't contain it, so let's add it manually
if (itemIds.length > items.length) {
itemIds[items.length] = BLANK_TILE_VALUE;
}
return convertToSolverFormat(itemIds);
}
use of net.runelite.api.Item in project runelite by runelite.
the class BankTagsPlugin method onMenuOptionClicked.
@Subscribe
public void onMenuOptionClicked(MenuOptionClicked event) {
if (event.getWidgetId() == WidgetInfo.BANK_ITEM_CONTAINER.getId() && event.getMenuAction() == MenuAction.EXAMINE_ITEM_BANK_EQ && event.getId() == EDIT_TAGS_MENU_INDEX) {
int inventoryIndex = event.getActionParam();
ItemContainer bankContainer = client.getItemContainer(InventoryID.BANK);
if (bankContainer == null) {
return;
}
Item[] items = bankContainer.getItems();
if (inventoryIndex < 0 || inventoryIndex >= items.length) {
return;
}
Item item = bankContainer.getItems()[inventoryIndex];
if (item == null) {
return;
}
int itemId = item.getId();
String itemName = itemManager.getItemComposition(itemId).getName();
String initialValue = getTags(itemId);
chatboxInputManager.openInputWindow(itemName + " Tags", initialValue, (newTags) -> {
if (newTags == null) {
return;
}
setTags(itemId, newTags);
Widget bankContainerWidget = client.getWidget(WidgetInfo.BANK_ITEM_CONTAINER);
if (bankContainerWidget == null) {
return;
}
Widget[] bankItemWidgets = bankContainerWidget.getDynamicChildren();
if (bankItemWidgets == null || inventoryIndex >= bankItemWidgets.length) {
return;
}
Widget bankItemWidget = bankItemWidgets[inventoryIndex];
String[] actions = bankItemWidget.getActions();
if (actions == null || EDIT_TAGS_MENU_INDEX - 1 >= actions.length) {
return;
}
int tagCount = getTagCount(itemId);
actions[EDIT_TAGS_MENU_INDEX - 1] = EDIT_TAGS_MENU_OPTION;
if (tagCount > 0) {
actions[EDIT_TAGS_MENU_INDEX - 1] += " (" + tagCount + ")";
}
});
}
}
use of net.runelite.api.Item in project runelite by runelite.
the class ItemPricesOverlay method makeValueTooltip.
private String makeValueTooltip(MenuEntry menuEntry) {
// Disabling both disables all value tooltips
if (!config.showGEPrice() && !config.showHAValue()) {
return null;
}
final int widgetId = menuEntry.getParam1();
ItemContainer container = null;
// Inventory item
if (widgetId == INVENTORY_ITEM_WIDGETID || widgetId == BANK_INVENTORY_ITEM_WIDGETID) {
container = client.getItemContainer(InventoryID.INVENTORY);
} else // Bank item
if (widgetId == BANK_ITEM_WIDGETID) {
container = client.getItemContainer(InventoryID.BANK);
}
if (container == null) {
return null;
}
// Find the item in the container to get stack size
final Item[] items = container.getItems();
final int index = menuEntry.getParam0();
if (index < items.length) {
final Item item = items[index];
return getItemStackValueText(item);
}
return null;
}
use of net.runelite.api.Item in project runelite by runelite.
the class PrayerPotion method heals.
@Override
public int heals(Client client) {
boolean hasHolyWrench = false;
ItemContainer equipContainer = client.getItemContainer(InventoryID.EQUIPMENT);
if (equipContainer != null) {
Item[] equip = equipContainer.getItems();
hasHolyWrench |= equip.length > RING_SLOT && equip[RING_SLOT].getId() == ItemID.RING_OF_THE_GODS_I;
if (equip.length > CAPE_SLOT) {
int cape = equip[CAPE_SLOT].getId();
hasHolyWrench |= cape == ItemID.PRAYER_CAPE;
hasHolyWrench |= cape == ItemID.PRAYER_CAPET;
// No idea what this is
hasHolyWrench |= cape == ItemID.PRAYER_CAPE_10643;
hasHolyWrench |= cape == ItemID.MAX_CAPE;
// Or these
hasHolyWrench |= cape == ItemID.MAX_CAPE_13282;
hasHolyWrench |= cape == ItemID.MAX_CAPE_13342;
}
}
if (!hasHolyWrench) {
ItemContainer invContainer = client.getItemContainer(InventoryID.INVENTORY);
if (invContainer != null) {
for (Item itemStack : invContainer.getItems()) {
int item = itemStack.getId();
hasHolyWrench |= item == ItemID.HOLY_WRENCH;
hasHolyWrench |= item == ItemID.PRAYER_CAPE;
hasHolyWrench |= item == ItemID.PRAYER_CAPET;
hasHolyWrench |= item == ItemID.PRAYER_CAPE_10643;
hasHolyWrench |= item == ItemID.MAX_CAPE;
hasHolyWrench |= item == ItemID.MAX_CAPE_13282;
hasHolyWrench |= item == ItemID.MAX_CAPE_13342;
if (hasHolyWrench) {
break;
}
}
}
}
double perc = hasHolyWrench ? .27 : .25;
int max = getStat().getMaximum(client);
return (((int) (max * perc)) * (delta >= 0 ? 1 : -1)) + delta;
}
Aggregations