aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal002@users.noreply.github.com>2024-08-02 10:57:02 +0200
committerGitHub <noreply@github.com>2024-08-02 10:57:02 +0200
commit2f53d615b8cf6054e96dba6a5ad45ab244b3fc33 (patch)
tree8a0ed9e1df9c303c38cdcfa5f0d5add33bd6c9a5 /src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt
parenta6b7559cec69bda9e8202de6440da784d3f8925a (diff)
downloadskyhanni-2f53d615b8cf6054e96dba6a5ad45ab244b3fc33.tar.gz
skyhanni-2f53d615b8cf6054e96dba6a5ad45ab244b3fc33.tar.bz2
skyhanni-2f53d615b8cf6054e96dba6a5ad45ab244b3fc33.zip
Backend: /shdebugprice (#2289)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt
index 35992a15e..f3657d10e 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt
@@ -193,8 +193,9 @@ object NEUItems {
return if (priceSource == ItemPriceSource.BAZAAR_INSTANT_BUY) it.sellOfferPrice else it.instantBuyPrice
}
- val result = manager.auctionManager.getLowestBin(asString())
- if (result != -1L) return result.toDouble()
+ getLowestBinOrNull()?.let {
+ return it
+ }
if (equals("JACK_O_LANTERN")) {
return "PUMPKIN".asInternalName().getPrice(priceSource) + 1
@@ -208,6 +209,12 @@ object NEUItems {
return getNpcPriceOrNull() ?: getRawCraftCostOrNull(pastRecipes)
}
+ fun NEUInternalName.getLowestBinOrNull(): Double? {
+ val result = manager.auctionManager.getLowestBin(asString())
+ if (result == -1L) return null
+ return result.toDouble()
+ }
+
// If NEU fails to calculate the craft costs, we calculate it ourself.
fun NEUInternalName.getRawCraftCostOrNull(pastRecipes: List<NeuRecipe> = emptyList()): Double? =
manager.auctionManager.getCraftCost(asString())?.craftCost ?: run {