Update ExaminePlugin.java

This commit is contained in:
Kyleeld
2019-05-08 09:50:08 +01:00
committed by GitHub
parent ba68695513
commit 55edaebf6b

View File

@@ -54,6 +54,8 @@ import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.util.StackFormatter; import net.runelite.client.util.StackFormatter;
import net.runelite.http.api.examine.ExamineClient; import net.runelite.http.api.examine.ExamineClient;
import net.runelite.http.api.osbuddy.OSBGrandExchangeClient;
import net.runelite.http.api.osbuddy.OSBGrandExchangeResult;
/** /**
* Submits examine info to the api * Submits examine info to the api
@@ -72,6 +74,7 @@ public class ExaminePlugin extends Plugin
private static final Pattern X_PATTERN = Pattern.compile("^\\d+ x "); private static final Pattern X_PATTERN = Pattern.compile("^\\d+ x ");
private final Deque<PendingExamine> pending = new ArrayDeque<>(); private final Deque<PendingExamine> pending = new ArrayDeque<>();
private final OSBGrandExchangeClient CLIENT = new OSBGrandExchangeClient();
private final Cache<CacheKey, Boolean> cache = CacheBuilder.newBuilder() private final Cache<CacheKey, Boolean> cache = CacheBuilder.newBuilder()
.maximumSize(128L) .maximumSize(128L)
.build(); .build();
@@ -342,11 +345,25 @@ public class ExaminePlugin extends Plugin
if (gePrice > 0) if (gePrice > 0)
{ {
OSBGrandExchangeResult osbresult = new OSBGrandExchangeResult();
try
{
osbresult = CLIENT.lookupItem(itemComposition.getId());
}
catch (IOException e)
{
e.printStackTrace();
}
message message
.append(ChatColorType.NORMAL) .append(ChatColorType.NORMAL)
.append(" GE average ") .append(" GE ")
.append(ChatColorType.HIGHLIGHT) .append(ChatColorType.HIGHLIGHT)
.append(StackFormatter.formatNumber(gePrice * quantity)); .append(StackFormatter.formatNumber(gePrice * quantity));
.append(ChatColorType.NORMAL)
.append(" OSB ")
.append(ChatColorType.HIGHLIGHT)
.append(StackFormatter.formatNumber(gePrice * quantity));
.append(StackFormatter.formatNumber(osbresult.getOverall_average() * quantity));
if (quantity > 1) if (quantity > 1)
{ {