From 7aa7e7abb165b267c8521a43cc975fd545542ae2 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sun, 24 Sep 2023 10:12:26 +0200 Subject: Added workaround for new fire sale cosmetics (pet skin, helmet skin, rune) in estimated item value. --- .../features/misc/items/EstimatedItemValue.kt | 31 +++++++++++++++++----- 1 file changed, 25 insertions(+), 6 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni') diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt index ced04d3be..87d2f087e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt @@ -12,9 +12,11 @@ import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getInternalNameOrNull import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName_old import at.hannibal2.skyhanni.utils.ItemUtils.getItemName +import at.hannibal2.skyhanni.utils.ItemUtils.getItemNameOrNull import at.hannibal2.skyhanni.utils.ItemUtils.getItemRarityOrNull import at.hannibal2.skyhanni.utils.ItemUtils.getLore 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.onToggle import at.hannibal2.skyhanni.utils.LorenzUtils.sortedDesc @@ -537,8 +539,12 @@ object EstimatedItemValue { val internalName = stack.getHelmetSkin() ?: return 0.0 val price = internalName.getPrice() - val name = internalName.getItemName() - list.add("§7Skin: $name §7(§6" + NumberUtil.format(price) + "§7)") + val name = internalName.getNameOrRepoError() + val displayname = name ?: "§c${internalName.asString()}" + list.add("§7Skin: $displayname §7(§6" + NumberUtil.format(price) + "§7)") + if (name == null) { + list.add(" §8(Not yet in NEU Repo)") + } return price } @@ -546,8 +552,12 @@ object EstimatedItemValue { val internalName = stack.getArmorDye() ?: return 0.0 val price = internalName.getPrice() - val name = internalName.getItemName() - list.add("§7Dye: $name §7(§6" + NumberUtil.format(price) + "§7)") + val name = internalName.getNameOrRepoError() + val displayname = name ?: "§c${internalName.asString()}" + list.add("§7Dye: $displayname §7(§6" + NumberUtil.format(price) + "§7)") + if (name == null) { + list.add(" §8(Not yet in NEU Repo)") + } return price } @@ -555,11 +565,20 @@ object EstimatedItemValue { val internalName = stack.getRune() ?: return 0.0 val price = internalName.getPrice() - val name = internalName.getItemName() - list.add("§7Rune: $name §7(§6" + NumberUtil.format(price) + "§7)") + val name = internalName.getItemNameOrNull() + val displayname = name ?: "§c${internalName.asString()}" + list.add("§7Rune: $displayname §7(§6" + NumberUtil.format(price) + "§7)") + if (name == null) { + list.add(" §8(Not yet in NEU Repo)") + } return price } + private fun NEUInternalName.getNameOrRepoError(): String? { + val stack = getItemStackOrNull() ?: return null + return stack.nameWithEnchantment ?: "§cItem Name Error" + } + private fun addAbilityScrolls(stack: ItemStack, list: MutableList): Double { val abilityScrolls = stack.getAbilityScrolls() ?: return 0.0 -- cgit