diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-08-09 12:54:18 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-08-09 12:54:18 +0200 |
commit | 9e3d64fe033ddce0f0ab168e3cb3b6a6bcf08bcb (patch) | |
tree | df1227fc031cb3dec6b3abbcbb8e4a21731d7e22 /src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt | |
parent | c14fda47fd955f26a3d4b9d913b4580a5c5b016b (diff) | |
download | skyhanni-9e3d64fe033ddce0f0ab168e3cb3b6a6bcf08bcb.tar.gz skyhanni-9e3d64fe033ddce0f0ab168e3cb3b6a6bcf08bcb.tar.bz2 skyhanni-9e3d64fe033ddce0f0ab168e3cb3b6a6bcf08bcb.zip |
Using NEUInternalName in EstimatedItemValue
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt index 75f9d1562..e3674efd0 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt @@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.config.ConfigManager import at.hannibal2.skyhanni.test.command.CopyErrorCommand import at.hannibal2.skyhanni.utils.ItemBlink.checkBlinkItem import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName +import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimal import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.removeColor @@ -138,14 +139,17 @@ object NEUItems { fun getInternalNameOrNull(nbt: NBTTagCompound) = ItemResolutionQuery(manager).withItemNBT(nbt).resolveInternalName() - fun getPriceOrNull(internalName: String, useSellingPrice: Boolean = false): Double? { - val price = getPrice(internalName, useSellingPrice) + fun NEUInternalName.getPriceOrNull(useSellingPrice: Boolean = false): Double? { + val price = getPrice(useSellingPrice) if (price == -1.0) { return null } return price } + fun getPriceOrNull(internalName: String, useSellingPrice: Boolean = false) = + internalName.asInternalName().getPriceOrNull(useSellingPrice) + fun transHypixelNameToInternalName(hypixelId: String): NEUInternalName { val name = manager.auctionManager.transformHypixelBazaarToNEUItemId(hypixelId) return NEUInternalName.from(name) @@ -318,15 +322,14 @@ object NEUItems { } // Taken and edited from NEU - private fun resolveEnchantmentByName(enchantmentName: String): String? { - return enchantmentNamePattern.matchMatcher(enchantmentName) { + private fun resolveEnchantmentByName(enchantmentName: String) = + enchantmentNamePattern.matchMatcher(enchantmentName) { val name = group("name").trim { it <= ' ' } val ultimate = group("format").lowercase().contains("§l") ((if (ultimate && name != "Ultimate Wise") "ULTIMATE_" else "") + turboCheck(name).replace(" ", "_").replace("-", "_").uppercase() + ";" + group("level").romanToDecimal()) } - } //Uses NEU fun saveNBTData(item: ItemStack, removeLore: Boolean = true): String { |