diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt | 2 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/inventory/SackDisplay.kt | 29 |
2 files changed, 17 insertions, 14 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt index 4534e49a5..e2102c6ec 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt @@ -195,7 +195,7 @@ object SackAPI { @SubscribeEvent fun onChat(event: LorenzChatEvent) { if (!event.message.removeColor().startsWith("[Sacks]")) return - + val sackAddText = event.chatComponent.siblings.firstNotNullOfOrNull { sibling -> sibling.chatStyle?.chatHoverEvent?.value?.formattedText?.removeColor()?.takeIf { it.startsWith("Added") diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/SackDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/SackDisplay.kt index 260d4bb9e..fcb258d21 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/SackDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/SackDisplay.kt @@ -41,18 +41,19 @@ object SackDisplay { var rendered = 0 SackAPI.getSacksData(savingSacks) - if (SackAPI.sackItem.isNotEmpty()) { + val saclItems = SackAPI.sackItem.toList() + if (saclItems.isNotEmpty()) { val sortedPairs: MutableMap<String, SackAPI.SackOtherItem> = when (config.sortingType) { - 0 -> SackAPI.sackItem.toList().sortedByDescending { it.second.stored.formatNumber() }.toMap().toMutableMap() - 1 -> SackAPI.sackItem.toList().sortedBy { it.second.stored.formatNumber() }.toMap().toMutableMap() - 2 -> SackAPI.sackItem.toList().sortedByDescending { it.second.price }.toMap().toMutableMap() - 3 -> SackAPI.sackItem.toList().sortedBy { it.second.price }.toMap().toMutableMap() - else -> SackAPI.sackItem.toList().sortedByDescending { it.second.stored.formatNumber() }.toMap().toMutableMap() - } - - sortedPairs.toList().forEach { - if (it.second.stored == "0" && !config.showEmpty) { - sortedPairs.remove(it.first) + 0 -> saclItems.sortedByDescending { it.second.stored.formatNumber() } + 1 -> saclItems.sortedBy { it.second.stored.formatNumber() } + 2 -> saclItems.sortedByDescending { it.second.price } + 3 -> saclItems.sortedBy { it.second.price } + else -> saclItems.sortedByDescending { it.second.stored.formatNumber() } + }.toMap().toMutableMap() + + sortedPairs.forEach { (k, v) -> + if (v.stored == "0" && !config.showEmpty) { + sortedPairs.remove(k) } } @@ -152,11 +153,13 @@ object SackDisplay { STORED_DESC("Stored D", "Stored Descending"), STORED_ASC("Stored A", "Stored Ascending"), PRICE_DESC("Price D", "Price Descending"), - PRICE_ASC("Price A", "Price Ascending"),; + PRICE_ASC("Price A", "Price Ascending"), + ; } enum class PriceFrom(val displayName: String) { BAZAAR("Bazaar Price"), - NPC("Npc Price"),; + NPC("Npc Price"), + ; } }
\ No newline at end of file |