diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-09-24 10:12:26 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-09-24 10:12:26 +0200 |
commit | 7aa7e7abb165b267c8521a43cc975fd545542ae2 (patch) | |
tree | 78a3d91a021efc67c3a4365c1aa1ad7219bfa98d /src/main | |
parent | 60a1fe8170c49abfc7d416d0f9f0e0a1f1c5e8f2 (diff) | |
download | skyhanni-7aa7e7abb165b267c8521a43cc975fd545542ae2.tar.gz skyhanni-7aa7e7abb165b267c8521a43cc975fd545542ae2.tar.bz2 skyhanni-7aa7e7abb165b267c8521a43cc975fd545542ae2.zip |
Added workaround for new fire sale cosmetics (pet skin, helmet skin, rune) in estimated item value.
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt | 31 |
1 files changed, 25 insertions, 6 deletions
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<String>): Double { val abilityScrolls = stack.getAbilityScrolls() ?: return 0.0 |