diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-09-10 10:41:56 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-09-10 10:41:56 +0200 |
commit | 6dd90af204bbb5859529b362909130e6c9767929 (patch) | |
tree | ea5283faa142b881a3468175b8b78341e0519b08 /src | |
parent | 593c01992afe4e8d5d4cd8aa61abbfb1d82e2a30 (diff) | |
download | skyhanni-6dd90af204bbb5859529b362909130e6c9767929.tar.gz skyhanni-6dd90af204bbb5859529b362909130e6c9767929.tar.bz2 skyhanni-6dd90af204bbb5859529b362909130e6c9767929.zip |
code cleanup
Diffstat (limited to 'src')
-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 |