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/misc | |
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/misc')
3 files changed, 41 insertions, 39 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/EnderNode.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/EnderNode.kt index e9d374f91..301dc65e2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/EnderNode.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/EnderNode.kt @@ -1,30 +1,33 @@ package at.hannibal2.skyhanni.features.misc +import at.hannibal2.skyhanni.utils.NEUInternalName +import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName + enum class EnderNode( - val internalName: String, + val internalName: NEUInternalName, val displayName: String, - ) { +) { - ENCHANTED_ENDSTONE("ENCHANTED_ENDSTONE","§aEnchanted End Stone"), - ENCHANTED_OBSIDIAN("ENCHANTED_OBSIDIAN","§aEnchanted Obsidian"), - ENCHANTED_ENDER_PEARL("ENCHANTED_ENDER_PEARL","§aEnchanted Ender Pearl"), - GRAND_EXP_BOTTLE("GRAND_EXP_BOTTLE","§aGrand Experience Bottle"), - TITANIC_EXP_BOTTLE("TITANIC_EXP_BOTTLE", "§9Titanic Experience Bottle"), - END_STONE_SHULKER("END_STONE_SHULKER","§9End Stone Shulker"), - ENDSTONE_GEODE("ENDSTONE_GEODE","§9End Stone Geode"), - MAGIC_RUNE("MAGIC_RUNE;1", "§d◆ Magical Rune I"), - ENDER_GAUNTLET("ENDER_GAUNTLET","§5Ender Gauntlet"), - MITE_GEL("MITE_GEL", "§5Mite Gel"), - SHRIMP_THE_FISH("SHRIMP_THE_FISH", "§cShrimp the Fish"), + ENCHANTED_ENDSTONE("ENCHANTED_ENDSTONE".asInternalName(), "§aEnchanted End Stone"), + ENCHANTED_OBSIDIAN("ENCHANTED_OBSIDIAN".asInternalName(), "§aEnchanted Obsidian"), + ENCHANTED_ENDER_PEARL("ENCHANTED_ENDER_PEARL".asInternalName(), "§aEnchanted Ender Pearl"), + GRAND_EXP_BOTTLE("GRAND_EXP_BOTTLE".asInternalName(), "§aGrand Experience Bottle"), + TITANIC_EXP_BOTTLE("TITANIC_EXP_BOTTLE".asInternalName(), "§9Titanic Experience Bottle"), + END_STONE_SHULKER("END_STONE_SHULKER".asInternalName(), "§9End Stone Shulker"), + ENDSTONE_GEODE("ENDSTONE_GEODE".asInternalName(), "§9End Stone Geode"), + MAGIC_RUNE("MAGIC_RUNE;1".asInternalName(), "§d◆ Magical Rune I"), + ENDER_GAUNTLET("ENDER_GAUNTLET".asInternalName(), "§5Ender Gauntlet"), + MITE_GEL("MITE_GEL".asInternalName(), "§5Mite Gel"), + SHRIMP_THE_FISH("SHRIMP_THE_FISH".asInternalName(), "§cShrimp the Fish"), - END_HELMET("END_HELMET", "§5Ender Helmet"), - END_CHESTPLATE("END_CHESTPLATE", "§5Ender Chestplate"), - END_LEGGINGS("END_LEGGINGS", "§5Ender Leggings"), - END_BOOTS("END_BOOTS", "§5Ender Boots"), - ENDER_NECKLACE("ENDER_NECKLACE", "§5Ender Necklace"), - COMMON_ENDERMAN_PET("ENDERMAN;0", "§fEnderman"), - UNCOMMON_ENDERMAN_PET("ENDERMAN;1", "§aEnderman"), - RARE_ENDERMAN_PET("ENDERMAN;2", "§9Enderman"), - EPIC_ENDERMAN_PET("ENDERMAN;3", "§5Enderman"), - LEGENDARY_ENDERMAN_PET("ENDERMAN;4", "§6Enderman") + END_HELMET("END_HELMET".asInternalName(), "§5Ender Helmet"), + END_CHESTPLATE("END_CHESTPLATE".asInternalName(), "§5Ender Chestplate"), + END_LEGGINGS("END_LEGGINGS".asInternalName(), "§5Ender Leggings"), + END_BOOTS("END_BOOTS".asInternalName(), "§5Ender Boots"), + ENDER_NECKLACE("ENDER_NECKLACE".asInternalName(), "§5Ender Necklace"), + COMMON_ENDERMAN_PET("ENDERMAN;0".asInternalName(), "§fEnderman"), + UNCOMMON_ENDERMAN_PET("ENDERMAN;1".asInternalName(), "§aEnderman"), + RARE_ENDERMAN_PET("ENDERMAN;2".asInternalName(), "§9Enderman"), + EPIC_ENDERMAN_PET("ENDERMAN;3".asInternalName(), "§5Enderman"), + LEGENDARY_ENDERMAN_PET("ENDERMAN;4".asInternalName(), "§6Enderman") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/EnderNodeTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/EnderNodeTracker.kt index f0509161f..549776a40 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/EnderNodeTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/EnderNodeTracker.kt @@ -8,12 +8,12 @@ import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.PlaySoundEvent -import at.hannibal2.skyhanni.features.bazaar.BazaarApi +import at.hannibal2.skyhanni.features.bazaar.BazaarApi.Companion.getBazaarData import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.LorenzUtils.afterChange import at.hannibal2.skyhanni.utils.LorenzUtils.editCopy -import at.hannibal2.skyhanni.utils.NEUItems +import at.hannibal2.skyhanni.utils.NEUItems.getPrice import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.NumberUtil.format import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems @@ -114,24 +114,22 @@ class EnderNodeTracker { private fun calculateProfit(): Map<EnderNode, Double> { val newProfit = mutableMapOf<EnderNode, Double>() - lootCount.forEach { - val price = if (isEnderArmor(it.key.displayName)) { + lootCount.forEach { (key, _) -> + val price = if (isEnderArmor(key.displayName)) { 10_000.0 } else { - val bzData = BazaarApi.getBazaarDataByInternalName(it.key.internalName) + val internalName = key.internalName + val bzData = internalName.getBazaarData() if (LorenzUtils.noTradeMode) { - bzData?.npcPrice ?: georgePrice(it.key) ?: 0.0 + bzData?.npcPrice ?: georgePrice(key) ?: 0.0 } else { - bzData?.npcPrice ?.coerceAtLeast(bzData.sellPrice) - ?.coerceAtLeast(georgePrice(it.key) ?: 0.0) - ?: NEUItems.getPrice(it.key.internalName) - + ?.coerceAtLeast(georgePrice(key) ?: 0.0) + ?: internalName.getPrice() } - } - newProfit[it.key] = price * (lootCount[it.key] ?: 0) + newProfit[key] = price * (lootCount[key] ?: 0) } return newProfit } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ghostcounter/GhostCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ghostcounter/GhostCounter.kt index 2cbab2a26..580fc7691 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/ghostcounter/GhostCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ghostcounter/GhostCounter.kt @@ -5,7 +5,7 @@ import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.data.ProfileStorageData import at.hannibal2.skyhanni.data.SkillExperience import at.hannibal2.skyhanni.events.* -import at.hannibal2.skyhanni.features.bazaar.BazaarApi +import at.hannibal2.skyhanni.features.bazaar.BazaarApi.Companion.getBazaarData import at.hannibal2.skyhanni.features.misc.ghostcounter.GhostData.Option.* import at.hannibal2.skyhanni.features.misc.ghostcounter.GhostData.bestiaryData import at.hannibal2.skyhanni.features.misc.ghostcounter.GhostUtil.formatBestiary @@ -29,6 +29,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.LorenzUtils.chat import at.hannibal2.skyhanni.utils.LorenzUtils.clickableChat +import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.NumberUtil.formatNumber import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimal @@ -223,10 +224,10 @@ object GhostCounter { addAsSingletonList(etaFormatting.base.formatText(eta).formatText(killETA)) val rate = 0.12 * (1 + (avgMagicFind.toDouble() / 100)) - val sorrowValue = (BazaarApi.getBazaarDataByInternalName("SORROW")?.buyPrice ?: 0).toLong() + val sorrowValue = ("SORROW".asInternalName().getBazaarData()?.buyPrice ?: 0).toLong() val final: String = (killInterp * sorrowValue * (rate / 100)).toLong().addSeparators() - val plasmaValue = (BazaarApi.getBazaarDataByInternalName("PLASMA")?.buyPrice ?: 0).toLong() - val voltaValue = (BazaarApi.getBazaarDataByInternalName("VOLTA")?.buyPrice ?: 0).toLong() + val plasmaValue = ("PLASMA".asInternalName().getBazaarData()?.buyPrice ?: 0).toLong() + val voltaValue = ("VOLTA".asInternalName().getBazaarData()?.buyPrice ?: 0).toLong() var moneyMade: Long = 0 val priceMap = listOf( Triple("Sorrow", SORROWCOUNT.getInt(), sorrowValue), |