client: use item composition high alch price
The correct way to compute ha price is floor(storePrice * 0.6f). This was being computed incorrectly everywhere except for the bank plugin. THis is now being computed centrally via the api.
This commit is contained in:
@@ -40,8 +40,6 @@ import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Constants;
|
||||
import static net.runelite.api.Constants.HIGH_ALCHEMY_MULTIPLIER;
|
||||
import net.runelite.api.InventoryID;
|
||||
import net.runelite.api.Item;
|
||||
import net.runelite.api.ItemComposition;
|
||||
@@ -411,8 +409,9 @@ public class BankPlugin extends Plugin
|
||||
}
|
||||
|
||||
final ItemComposition itemComposition = itemManager.getItemComposition(itemId);
|
||||
long gePrice = (long) itemManager.getItemPrice(itemId) * (long) itemQuantities.count(itemId);
|
||||
long haPrice = (long) (itemComposition.getPrice() * HIGH_ALCHEMY_MULTIPLIER) * (long) itemQuantities.count(itemId);
|
||||
final int qty = itemQuantities.count(itemId);
|
||||
final long gePrice = (long) itemManager.getItemPrice(itemId) * qty;
|
||||
final long haPrice = (long) itemComposition.getHaPrice() * qty;
|
||||
|
||||
long value = Math.max(gePrice, haPrice);
|
||||
|
||||
@@ -522,9 +521,8 @@ public class BankPlugin extends Plugin
|
||||
alch += qty * 1000L;
|
||||
break;
|
||||
default:
|
||||
final long storePrice = itemManager.getItemComposition(id).getPrice();
|
||||
final long alchPrice = (long) (storePrice * Constants.HIGH_ALCHEMY_MULTIPLIER);
|
||||
alch += alchPrice * qty;
|
||||
final int alchPrice = itemManager.getItemComposition(id).getHaPrice();
|
||||
alch += (long) alchPrice * qty;
|
||||
ge += (long) itemManager.getItemPrice(id) * qty;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,6 @@ import lombok.Value;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Constants;
|
||||
import net.runelite.api.Experience;
|
||||
import net.runelite.api.IconID;
|
||||
import net.runelite.api.ItemComposition;
|
||||
@@ -1018,15 +1017,12 @@ public class ChatCommandsPlugin extends Plugin
|
||||
.append(QuantityFormatter.formatNumber(itemPrice));
|
||||
|
||||
ItemComposition itemComposition = itemManager.getItemComposition(itemId);
|
||||
if (itemComposition != null)
|
||||
{
|
||||
int alchPrice = Math.round(itemComposition.getPrice() * Constants.HIGH_ALCHEMY_MULTIPLIER);
|
||||
builder
|
||||
.append(ChatColorType.NORMAL)
|
||||
.append(" HA value ")
|
||||
.append(ChatColorType.HIGHLIGHT)
|
||||
.append(QuantityFormatter.formatNumber(alchPrice));
|
||||
}
|
||||
final int alchPrice = itemComposition.getHaPrice();
|
||||
builder
|
||||
.append(ChatColorType.NORMAL)
|
||||
.append(" HA value ")
|
||||
.append(ChatColorType.HIGHLIGHT)
|
||||
.append(QuantityFormatter.formatNumber(alchPrice));
|
||||
|
||||
String response = builder.build();
|
||||
|
||||
|
||||
@@ -34,7 +34,6 @@ import javax.inject.Inject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Constants;
|
||||
import net.runelite.api.ItemComposition;
|
||||
import net.runelite.api.ItemID;
|
||||
import net.runelite.api.events.ChatMessage;
|
||||
@@ -318,9 +317,8 @@ public class ExaminePlugin extends Plugin
|
||||
{
|
||||
// quantity is at least 1
|
||||
quantity = Math.max(1, quantity);
|
||||
int itemCompositionPrice = itemComposition.getPrice();
|
||||
final long gePrice = itemManager.getItemPrice(id);
|
||||
final long alchPrice = itemCompositionPrice <= 0 ? 0 : Math.round(itemCompositionPrice * Constants.HIGH_ALCHEMY_MULTIPLIER);
|
||||
final int alchPrice = itemComposition.getHaPrice();
|
||||
|
||||
if (gePrice > 0 || alchPrice > 0)
|
||||
{
|
||||
|
||||
@@ -51,7 +51,6 @@ import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.Value;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Constants;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.ItemComposition;
|
||||
import net.runelite.api.ItemID;
|
||||
@@ -380,7 +379,7 @@ public class GroundItemsPlugin extends Plugin
|
||||
final int itemId = item.getId();
|
||||
final ItemComposition itemComposition = itemManager.getItemComposition(itemId);
|
||||
final int realItemId = itemComposition.getNote() != -1 ? itemComposition.getLinkedNoteId() : itemId;
|
||||
final int alchPrice = Math.round(itemComposition.getPrice() * Constants.HIGH_ALCHEMY_MULTIPLIER);
|
||||
final int alchPrice = itemComposition.getHaPrice();
|
||||
final boolean dropped = tile.getWorldLocation().equals(client.getLocalPlayer().getWorldLocation()) && droppedItemQueue.remove(itemId);
|
||||
|
||||
final GroundItem groundItem = GroundItem.builder()
|
||||
|
||||
@@ -29,7 +29,6 @@ import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Constants;
|
||||
import net.runelite.api.InventoryID;
|
||||
import net.runelite.api.Item;
|
||||
import net.runelite.api.ItemComposition;
|
||||
@@ -213,7 +212,7 @@ class ItemPricesOverlay extends Overlay
|
||||
int gePrice = 0;
|
||||
int haPrice = 0;
|
||||
int haProfit = 0;
|
||||
final int itemHaPrice = Math.round(itemDef.getPrice() * Constants.HIGH_ALCHEMY_MULTIPLIER);
|
||||
final int itemHaPrice = itemDef.getHaPrice();
|
||||
|
||||
if (config.showGEPrice())
|
||||
{
|
||||
|
||||
@@ -61,7 +61,6 @@ import lombok.NonNull;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Constants;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.InventoryID;
|
||||
import net.runelite.api.ItemComposition;
|
||||
@@ -877,7 +876,7 @@ public class LootTrackerPlugin extends Plugin
|
||||
{
|
||||
final ItemComposition itemComposition = itemManager.getItemComposition(itemId);
|
||||
final int gePrice = itemManager.getItemPrice(itemId);
|
||||
final int haPrice = Math.round(itemComposition.getPrice() * Constants.HIGH_ALCHEMY_MULTIPLIER);
|
||||
final int haPrice = itemComposition.getHaPrice();
|
||||
final boolean ignored = ignoredItems.contains(itemComposition.getName());
|
||||
|
||||
return new LootTrackerItem(
|
||||
|
||||
Reference in New Issue
Block a user