Java Code Examples for net.runelite.api.ItemID#PLATINUM_TOKEN
The following examples show how to use
net.runelite.api.ItemID#PLATINUM_TOKEN .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ItemManager.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
/** * Look up an item's price * * @param itemID item id * @param ignoreUntradeableMap should the price returned ignore the {@link UntradeableItemMapping} * @return item price */ public int getItemPrice(int itemID, boolean ignoreUntradeableMap) { if (itemID == ItemID.COINS_995) { return 1; } if (itemID == ItemID.PLATINUM_TOKEN) { return 1000; } ItemComposition itemComposition = getItemComposition(itemID); if (itemComposition.getNote() != -1) { itemID = itemComposition.getLinkedNoteId(); } itemID = WORN_ITEMS.getOrDefault(itemID, itemID); if (!ignoreUntradeableMap) { UntradeableItemMapping p = UntradeableItemMapping.map(ItemVariationMapping.map(itemID)); if (p != null) { return getItemPrice(p.getPriceID()) * p.getQuantity(); } } int price = 0; for (int mappedID : ItemMapping.map(itemID)) { ItemPrice ip = itemPrices.get(mappedID); if (ip != null) { price += ip.getPrice(); } } return price; }
Example 2
Source File: BankPlugin.java From plugins with GNU General Public License v3.0 | 4 votes |
@Nullable public ContainerPrices calculate(@Nullable Item[] items) { if (items == null) { return null; } long ge = 0; long alch = 0; for (final Item item : items) { final int qty = item.getQuantity(); final int id = item.getId(); if (id <= 0 || qty == 0) { continue; } switch (id) { case ItemID.COINS_995: ge += qty; alch += qty; break; case ItemID.PLATINUM_TOKEN: ge += qty * 1000L; alch += qty * 1000L; break; default: final long storePrice = itemManager.getItemDefinition(id).getPrice(); final long alchPrice = (long) (storePrice * Constants.HIGH_ALCHEMY_MULTIPLIER); alch += alchPrice * qty; ge += (long) itemManager.getItemPrice(id) * qty; break; } } return new ContainerPrices(ge, alch); }
Example 3
Source File: ItemPricesOverlay.java From plugins with GNU General Public License v3.0 | 4 votes |
private String getItemStackValueText(Item item) { int id = itemManager.canonicalize(item.getId()); int qty = item.getQuantity(); // Special case for coins and platinum tokens if (id == ItemID.COINS_995) { return QuantityFormatter.formatNumber(qty) + " gp"; } else if (id == ItemID.PLATINUM_TOKEN) { return QuantityFormatter.formatNumber(qty * 1000) + " gp"; } ItemDefinition itemDef = itemManager.getItemDefinition(id); // Only check prices for things with store prices if (itemDef.getPrice() <= 0) { return null; } int gePrice = 0; int haPrice = 0; int haProfit = 0; final int itemHaPrice = Math.round(itemDef.getPrice() * Constants.HIGH_ALCHEMY_MULTIPLIER); if (config.showGEPrice()) { gePrice = itemManager.getItemPrice(id); } if (config.showHAValue()) { haPrice = itemManager.getAlchValue(id); } if (gePrice > 0 && itemHaPrice > 0 && config.showAlchProfit()) { haProfit = calculateHAProfit(itemHaPrice, gePrice); } if (gePrice > 0 || haPrice > 0) { return stackValueText(qty, gePrice, haPrice, haProfit); } return null; }
Example 4
Source File: BankPlugin.java From runelite with BSD 2-Clause "Simplified" License | 4 votes |
@Nullable ContainerPrices calculate(@Nullable Item[] items) { if (items == null) { return null; } long ge = 0; long alch = 0; for (final Item item : items) { final int qty = item.getQuantity(); final int id = item.getId(); if (id <= 0 || qty == 0) { continue; } switch (id) { case ItemID.COINS_995: ge += qty; alch += qty; break; case ItemID.PLATINUM_TOKEN: ge += qty * 1000L; alch += qty * 1000L; break; default: final int alchPrice = itemManager.getItemComposition(id).getHaPrice(); alch += (long) alchPrice * qty; ge += (long) itemManager.getItemPrice(id) * qty; break; } } return new ContainerPrices(ge, alch); }
Example 5
Source File: ItemPricesOverlay.java From runelite with BSD 2-Clause "Simplified" License | 4 votes |
private String getItemStackValueText(Item item) { int id = itemManager.canonicalize(item.getId()); int qty = item.getQuantity(); // Special case for coins and platinum tokens if (id == ItemID.COINS_995) { return QuantityFormatter.formatNumber(qty) + " gp"; } else if (id == ItemID.PLATINUM_TOKEN) { return QuantityFormatter.formatNumber(qty * 1000) + " gp"; } ItemComposition itemDef = itemManager.getItemComposition(id); // Only check prices for things with store prices if (itemDef.getPrice() <= 0) { return null; } int gePrice = 0; int haPrice = 0; int haProfit = 0; final int itemHaPrice = itemDef.getHaPrice(); if (config.showGEPrice()) { gePrice = itemManager.getItemPrice(id); } if (config.showHAValue()) { haPrice = itemHaPrice; } if (gePrice > 0 && itemHaPrice > 0 && config.showAlchProfit()) { haProfit = calculateHAProfit(itemHaPrice, gePrice); } if (gePrice > 0 || haPrice > 0) { return stackValueText(qty, gePrice, haPrice, haProfit); } return null; }