diff options
Diffstat (limited to 'src')
4 files changed, 42 insertions, 14 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt index b5c287d5a..1c5c76d92 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt @@ -66,7 +66,7 @@ object SlayerAPI { } val amountFormat = if (amount != 1) "§7${amount}x §r" else "" - val displayName = NEUItems.getItemStack(internalName).nameWithEnchantment + val displayName = getNameWithEnchantmentFor(internalName) val price = NEUItems.getPrice(internalName) val npcPrice = BazaarApi.getBazaarDataByInternalName(internalName)?.npcPrice ?: 0.0 @@ -81,6 +81,13 @@ object SlayerAPI { return result } + fun getNameWithEnchantmentFor(internalName: String): String? { + if (internalName == "WISP_POTION") { + return "§fWisp's Ice-Flavored Water" + } + return NEUItems.getItemStack(internalName).nameWithEnchantment + } + @SubscribeEvent fun onChat(event: LorenzChatEvent) { if (!LorenzUtils.inSkyBlock) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemProfitTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemProfitTracker.kt index 2e733a398..cba190cf4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemProfitTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemProfitTracker.kt @@ -11,7 +11,6 @@ import at.hannibal2.skyhanni.test.PriceSource import at.hannibal2.skyhanni.utils.* import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.name -import at.hannibal2.skyhanni.utils.ItemUtils.nameWithEnchantment import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.LorenzUtils.addSelector import at.hannibal2.skyhanni.utils.LorenzUtils.sortedDesc @@ -147,13 +146,12 @@ class SlayerItemProfitTracker { for ((internalName, itemProfit) in itemLog.items) { val amount = itemProfit.totalAmount - val bazaarData = BazaarApi.getBazaarDataByInternalName(internalName) ?: continue - val price = (getPrice(bazaarData) * amount).toLong() - var name = NEUItems.getItemStack(internalName).nameWithEnchantment ?: internalName + val price = (getPrice(internalName) * amount).toLong() + + var name = SlayerAPI.getNameWithEnchantmentFor(internalName) ?: internalName val priceFormat = NumberUtil.format(price) val hidden = itemProfit.hidden if (hidden) { -// text += " §c(hidden)" name = StringUtils.addFormat(name, "§m") } val text = " §7${amount.addSeparators()}x $name§7: §6$priceFormat" @@ -185,16 +183,22 @@ class SlayerItemProfitTracker { val mobKillCoins = itemLog.mobKillCoins if (mobKillCoins != 0L) { val mobKillCoinsFormat = NumberUtil.format(mobKillCoins) - map[Renderable.hoverTips(" §7Mob kill coins: §6$mobKillCoinsFormat", - listOf("§7Killing mobs gives you coins (more with scavenger)", - "§7You got §e$mobKillCoinsFormat §7coins in total this way"))] = mobKillCoins + map[Renderable.hoverTips( + " §7Mob kill coins: §6$mobKillCoinsFormat", + listOf( + "§7Killing mobs gives you coins (more with scavenger)", + "§7You got §e$mobKillCoinsFormat §7coins in total this way" + ) + )] = mobKillCoins profit += mobKillCoins } val slayerSpawnCost = itemLog.slayerSpawnCost if (slayerSpawnCost != 0L) { val mobKillCoinsFormat = NumberUtil.format(slayerSpawnCost) - map[Renderable.hoverTips(" §7Slayer Spawn Costs: §c$mobKillCoinsFormat", - listOf("§7You paid §c$mobKillCoinsFormat §7in total", "§7for starting the slayer quests."))] = slayerSpawnCost + map[Renderable.hoverTips( + " §7Slayer Spawn Costs: §c$mobKillCoinsFormat", + listOf("§7You paid §c$mobKillCoinsFormat §7in total", "§7for starting the slayer quests.") + )] = slayerSpawnCost profit += slayerSpawnCost } @@ -203,8 +207,12 @@ class SlayerItemProfitTracker { } val slayerCompletedCount = itemLog.slayerCompletedCount - addAsSingletonList(Renderable.hoverTips("§7Bosses killed: §e$slayerCompletedCount", - listOf("§7You killed the $itemLogCategory boss", "§e$slayerCompletedCount §7times."))) + addAsSingletonList( + Renderable.hoverTips( + "§7Bosses killed: §e$slayerCompletedCount", + listOf("§7You killed the $itemLogCategory boss", "§e$slayerCompletedCount §7times.") + ) + ) profit += mobKillCoins val profitFormat = NumberUtil.format(profit) @@ -227,6 +235,11 @@ class SlayerItemProfitTracker { } } + private fun getPrice(internalName: String): Double { + val bazaarData = BazaarApi.getBazaarDataByInternalName(internalName) + return bazaarData?.let { getPrice(it) } ?: NEUItems.getPrice(internalName) + } + private fun getPrice(bazaarData: BazaarData): Double { return when (config.priceFrom) { 0 -> bazaarData.sellPrice diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt index 7ed8e24fa..f36f9a60c 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt @@ -115,7 +115,12 @@ object ItemUtils { return false } - fun ItemStack.getInternalName() = NEUItems.getInternalName(this) + fun ItemStack.getInternalName(): String { + if (name == "§fWisp's Ice-Flavored Water I Splash Potion") { + return "WISP_POTION" + } + return NEUItems.getInternalName(this) + } fun ItemStack.isVanilla() = NEUItems.isVanillaItem(this) diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt index 074be1ce6..07e1c9318 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt @@ -107,6 +107,9 @@ object NEUItems { } fun getPrice(internalName: String): Double { + if (internalName == "WISP_POTION") { + return 20_000.0 + } return getPrice(internalName, false) } |