diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-08-09 11:49:50 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-08-09 11:49:50 +0200 |
commit | 3bcd5b3a8afa5b322d75af1b82681fd7b1e494e5 (patch) | |
tree | ba3fc5108a01423ed96ea576aa32cb9de091ba9b /src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt | |
parent | 8d12c5259ff12e25f74194db19731ecc10280e47 (diff) | |
download | skyhanni-3bcd5b3a8afa5b322d75af1b82681fd7b1e494e5.tar.gz skyhanni-3bcd5b3a8afa5b322d75af1b82681fd7b1e494e5.tar.bz2 skyhanni-3bcd5b3a8afa5b322d75af1b82681fd7b1e494e5.zip |
bringing the future of NEUInternalName a bit closer to reality
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt index 4509d512e..4c18c7f94 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt @@ -146,27 +146,22 @@ object NEUItems { return price } - fun getPrice(internalName: NEUInternalName): Double { - if (internalName.asString() == "WISP_POTION") { - return 20_000.0 - } - return getPrice(internalName, false) - } - - fun getPrice(internalName: String) = getPrice(NEUInternalName.from(internalName)) - fun transHypixelNameToInternalName(hypixelId: String): NEUInternalName { val name = manager.auctionManager.transformHypixelBazaarToNEUItemId(hypixelId) return NEUInternalName.from(name) } - fun getPrice(internalName: NEUInternalName, useSellingPrice: Boolean): Double { - val result = manager.auctionManager.getBazaarOrBin(internalName.asString(), useSellingPrice) + fun NEUInternalName.getPrice(useSellingPrice: Boolean = false): Double { + val string = asString() + if (string == "WISP_POTION") { + return 20_000.0 + } + val result = manager.auctionManager.getBazaarOrBin(string, useSellingPrice) if (result == -1.0) { - if (internalName.asString() == "JACK_O_LANTERN") { + if (string == "JACK_O_LANTERN") { return getPrice("PUMPKIN", useSellingPrice) + 1 } - if (internalName.asString() == "GOLDEN_CARROT") { + if (string == "GOLDEN_CARROT") { // 6.8 for some players return 7.0 // NPC price } @@ -174,9 +169,8 @@ object NEUItems { return result } - fun getPrice(internalName: String, useSellingPrice: Boolean): Double { - return getPrice(NEUInternalName.from(internalName), useSellingPrice) - } + fun getPrice(internalName: String, useSellingPrice: Boolean = false) = + NEUInternalName.from(internalName).getPrice(useSellingPrice) fun getItemStackOrNull(internalName: NEUInternalName) = ItemResolutionQuery(manager) .withKnownInternalName(internalName.asString()) @@ -189,8 +183,7 @@ object NEUItems { fun getItemStack(internalName: NEUInternalName, definite: Boolean = false): ItemStack = getItemStackOrNull(internalName) ?: run { - - if (getPrice(internalName) == -1.0) return@run fallbackItem + if (internalName.getPrice() == -1.0) return@run fallbackItem if (definite) { Utils.showOutdatedRepoNotification() |