diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-10-30 15:40:23 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-10-30 15:40:23 +0100 |
commit | 33b5429348dc5f274bf1cfaf530a77343eaf3fb6 (patch) | |
tree | 31eeeefa1f4d0655524e7c55b8124ea28fba80a2 /src/main/java/at/hannibal2/skyhanni | |
parent | 83951beb85032ca11eede16a11adb27ccc6042a4 (diff) | |
download | skyhanni-33b5429348dc5f274bf1cfaf530a77343eaf3fb6.tar.gz skyhanni-33b5429348dc5f274bf1cfaf530a77343eaf3fb6.tar.bz2 skyhanni-33b5429348dc5f274bf1cfaf530a77343eaf3fb6.zip |
No longer merging same items with different prices in Chest Value together.
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/inventory/ChestValue.kt | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/ChestValue.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/ChestValue.kt index 449464952..b7b8ae7f6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ChestValue.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ChestValue.kt @@ -13,7 +13,6 @@ import at.hannibal2.skyhanni.utils.ItemUtils.getInternalNameOrNull import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.LorenzUtils.addButton -import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NEUItems.getItemStackOrNull import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators @@ -34,7 +33,7 @@ class ChestValue { private val config get() = SkyHanniMod.feature.inventory.chestValueConfig private var display = emptyList<List<Any>>() - private val chestItems = mutableMapOf<NEUInternalName, Item>() + private val chestItems = mutableMapOf<String, Item>() private val inInventory get() = isValidStorage() @SubscribeEvent @@ -115,6 +114,7 @@ class ChestValue { val sortedList = sortedList() var totalPrice = 0.0 var rendered = 0 + val amountShowing = if (config.itemToShow > sortedList.size) sortedList.size else config.itemToShow newDisplay.addAsSingletonList("§7Estimated Chest Value: §o(Showing $amountShowing of ${sortedList.size} items)") for ((index, amount, stack, total, tips) in sortedList) { @@ -145,13 +145,11 @@ class ChestValue { newDisplay.addAsSingletonList("§6Total value : §b${totalPrice.formatPrice()}") } - private fun sortedList(): MutableList<Item> { - return when (config.sortingType) { - 0 -> chestItems.values.sortedByDescending { it.total } - 1 -> chestItems.values.sortedBy { it.total } - else -> chestItems.values.sortedByDescending { it.total } - }.toMutableList() - } + private fun sortedList() = when (config.sortingType) { + 0 -> chestItems.values.sortedByDescending { it.total } + 1 -> chestItems.values.sortedBy { it.total } + else -> chestItems.values.sortedByDescending { it.total } + }.toMutableList() private fun addButton(newDisplay: MutableList<List<Any>>) { newDisplay.addButton("§7Sorted By: ", @@ -194,11 +192,12 @@ class ChestValue { val list = mutableListOf<String>() val pair = EstimatedItemValue.getEstimatedItemPrice(stack, list) var (total, _) = pair + val key = "$internalName+$total" if (stack.item == Items.enchanted_book) total /= 2 list.add("§aTotal: §6§l${total.formatPrice()}") if (total == 0.0) continue - val item = chestItems.getOrPut(internalName) { + val item = chestItems.getOrPut(key) { Item(mutableListOf(), 0, stack, 0.0, list) } item.index.add(i) |