GE: Add back OSB price in the GE screen
This commit is contained in:
@@ -55,6 +55,17 @@ public interface GrandExchangeConfig extends Config
|
|||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 3,
|
position = 3,
|
||||||
|
keyName = "enableOsbPrices",
|
||||||
|
name = "Enable OSB actively traded prices",
|
||||||
|
description = "Shows the OSBuddy actively traded price at the GE"
|
||||||
|
)
|
||||||
|
default boolean enableOsbPrices()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
position = 4,
|
||||||
keyName = "enableGeLimits",
|
keyName = "enableGeLimits",
|
||||||
name = "Enable GE Limits on GE",
|
name = "Enable GE Limits on GE",
|
||||||
description = "Shows the GE Limits on the GE"
|
description = "Shows the GE Limits on the GE"
|
||||||
@@ -65,7 +76,7 @@ public interface GrandExchangeConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 4,
|
position = 5,
|
||||||
keyName = "showTotal",
|
keyName = "showTotal",
|
||||||
name = "Show grand exchange total",
|
name = "Show grand exchange total",
|
||||||
description = "Show grand exchange total"
|
description = "Show grand exchange total"
|
||||||
@@ -76,7 +87,7 @@ public interface GrandExchangeConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 5,
|
position = 6,
|
||||||
keyName = "showExact",
|
keyName = "showExact",
|
||||||
name = "Show exact total value",
|
name = "Show exact total value",
|
||||||
description = "Show exact total value"
|
description = "Show exact total value"
|
||||||
@@ -87,7 +98,7 @@ public interface GrandExchangeConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 6,
|
position = 7,
|
||||||
keyName = "enableAfford",
|
keyName = "enableAfford",
|
||||||
name = "Enable Afford quantity on GE",
|
name = "Enable Afford quantity on GE",
|
||||||
description = "Shows the quantity you can buy on the GE"
|
description = "Shows the quantity you can buy on the GE"
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ package net.runelite.client.plugins.grandexchange;
|
|||||||
import com.google.common.reflect.TypeToken;
|
import com.google.common.reflect.TypeToken;
|
||||||
import com.google.gson.stream.JsonReader;
|
import com.google.gson.stream.JsonReader;
|
||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
|
import io.reactivex.schedulers.Schedulers;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
@@ -169,6 +170,7 @@ public class GrandExchangePlugin extends Plugin
|
|||||||
|
|
||||||
private boolean quickLookup;
|
private boolean quickLookup;
|
||||||
private boolean enableNotifications;
|
private boolean enableNotifications;
|
||||||
|
private boolean enableOsbPrices;
|
||||||
private boolean enableGELimits;
|
private boolean enableGELimits;
|
||||||
private boolean enableAfford;
|
private boolean enableAfford;
|
||||||
|
|
||||||
@@ -275,6 +277,7 @@ public class GrandExchangePlugin extends Plugin
|
|||||||
{
|
{
|
||||||
this.quickLookup = config.quickLookup();
|
this.quickLookup = config.quickLookup();
|
||||||
this.enableNotifications = config.enableNotifications();
|
this.enableNotifications = config.enableNotifications();
|
||||||
|
this.enableOsbPrices = config.enableOsbPrices();
|
||||||
this.enableGELimits = config.enableGELimits();
|
this.enableGELimits = config.enableGELimits();
|
||||||
this.enableAfford = config.enableAfford();
|
this.enableAfford = config.enableAfford();
|
||||||
}
|
}
|
||||||
@@ -577,5 +580,43 @@ public class GrandExchangePlugin extends Plugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
geText.setText(text);
|
geText.setText(text);
|
||||||
|
|
||||||
|
if (!this.enableOsbPrices)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we already have the result, use it
|
||||||
|
if (osbGrandExchangeResult != null && osbGrandExchangeResult.getItem_id() == itemId && osbGrandExchangeResult.getOverall_average() > 0)
|
||||||
|
{
|
||||||
|
geText.setText(text + OSB_GE_TEXT + QuantityFormatter.formatNumber(osbGrandExchangeResult.getOverall_average()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (osbItem == itemId)
|
||||||
|
{
|
||||||
|
// avoid starting duplicate lookups
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
osbItem = itemId;
|
||||||
|
|
||||||
|
log.debug("Looking up OSB item price {}", itemId);
|
||||||
|
|
||||||
|
final String start = text;
|
||||||
|
executorService.submit(() ->
|
||||||
|
{
|
||||||
|
CLIENT.lookupItem(itemId)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(Schedulers.single())
|
||||||
|
.subscribe(
|
||||||
|
(osbresult) ->
|
||||||
|
{
|
||||||
|
osbGrandExchangeResult = osbresult;
|
||||||
|
// Update the text on the widget too
|
||||||
|
geText.setText(start + OSB_GE_TEXT + QuantityFormatter.formatNumber(osbresult.getOverall_average()));
|
||||||
|
},
|
||||||
|
(e) -> log.debug("Error getting price of item {}", itemId, e)
|
||||||
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user