diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-08-09 15:28:39 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-08-09 15:28:39 +0200 |
commit | 9cd32579cfec4fbfdd710442841c6e712a786c53 (patch) | |
tree | 3afedcefc59316259c3012cbdb1589bf9af36069 /src/main/java/at/hannibal2/skyhanni/features/bazaar | |
parent | 0efd1b797bbca2eb144b3ec795217ee2e9077c23 (diff) | |
download | skyhanni-9cd32579cfec4fbfdd710442841c6e712a786c53.tar.gz skyhanni-9cd32579cfec4fbfdd710442841c6e712a786c53.tar.bz2 skyhanni-9cd32579cfec4fbfdd710442841c6e712a786c53.zip |
Using NEUInternalName for all bazaar data cases
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/bazaar')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarApi.kt | 6 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarBestSellMethod.kt | 13 |
2 files changed, 8 insertions, 11 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarApi.kt b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarApi.kt index fa2f07038..d17a3dc6b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarApi.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarApi.kt @@ -6,7 +6,6 @@ import at.hannibal2.skyhanni.utils.* import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name -import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.RenderUtils.highlight import at.hannibal2.skyhanni.utils.StringUtils.removeColor import net.minecraft.client.gui.inventory.GuiChest @@ -22,10 +21,7 @@ class BazaarApi { var inBazaarInventory = false private var currentSearchedItem = "" - fun getBazaarDataByName(name: String): BazaarData? = - NEUItems.getRawInternalNameOrNull(name)?.let { getBazaarDataByInternalName(it) } - - fun getBazaarDataByInternalName(internalName: String) = internalName.asInternalName().getBazaarData() + fun getBazaarDataByName(name: String): BazaarData? = NEUItems.getInternalNameOrNull(name)?.getBazaarData() fun NEUInternalName.getBazaarData() = if (isBazaarItem()) { holder.getData(this) diff --git a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarBestSellMethod.kt b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarBestSellMethod.kt index e37d14df8..d6145fb63 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarBestSellMethod.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarBestSellMethod.kt @@ -2,8 +2,9 @@ package at.hannibal2.skyhanni.features.bazaar import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.InventoryCloseEvent -import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName_old -import at.hannibal2.skyhanni.utils.ItemUtils.nameWithEnchantment +import at.hannibal2.skyhanni.features.bazaar.BazaarApi.Companion.getBazaarData +import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName +import at.hannibal2.skyhanni.utils.ItemUtils.getNameWithEnchantment import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.NumberUtil @@ -39,25 +40,25 @@ class BazaarBestSellMethod { if (buyInstantly == null || buyInstantly.displayName != "§aBuy Instantly") return "" val bazaarItem = inv.getStackInSlot(13) ?: return "" - val internalName = NEUItems.getRawInternalNameOrNull(bazaarItem.displayName) ?: return "" + val internalName = NEUItems.getInternalNameOrNull(bazaarItem.displayName) ?: return "" var having = 0 for (slot in chest.inventorySlots) { if (slot == null) continue if (slot.slotNumber == slot.slotIndex) continue val stack = slot.stack ?: continue - if (internalName == stack.getInternalName_old()) { + if (internalName == stack.getInternalName()) { having += stack.stackSize } } if (having <= 0) return "" - val data = BazaarApi.getBazaarDataByInternalName(internalName) ?: return "" + val data = internalName.getBazaarData() ?: return "" val totalDiff = (data.buyPrice - data.sellPrice) * having val result = NumberUtil.format(totalDiff.toInt()) - val name = NEUItems.getItemStack(internalName).nameWithEnchantment + val name = internalName.getNameWithEnchantment() return "$name§7 sell difference: §6$result coins" } catch (e: Error) { e.printStackTrace() |