diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-10-26 12:30:02 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-10-26 12:30:02 +0200 |
commit | b6f9dc6caa77ef50e086fd50c6c32ebc69288eb8 (patch) | |
tree | 1532b36ad847210aae4968433cacbbe9f036f664 /src/main/java/at/hannibal2 | |
parent | 2c061eb7fc7c6f8f4e5889504e6b390c71e6a269 (diff) | |
download | skyhanni-b6f9dc6caa77ef50e086fd50c6c32ebc69288eb8.tar.gz skyhanni-b6f9dc6caa77ef50e086fd50c6c32ebc69288eb8.tar.bz2 skyhanni-b6f9dc6caa77ef50e086fd50c6c32ebc69288eb8.zip |
code cleanup
Diffstat (limited to 'src/main/java/at/hannibal2')
3 files changed, 23 insertions, 19 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/InventoryConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/InventoryConfig.java index 1f6494fd7..8d3c4a56d 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/InventoryConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/InventoryConfig.java @@ -160,15 +160,20 @@ public class InventoryConfig { public boolean enabled = true; @Expose - @ConfigOption(name = "Highlight Full", desc = "Highlight items that are full in red.\n§eDo not need the option above to be enabled.") + @ConfigOption( + name = "Highlight Full", + desc = "Highlight items that are full in red.\n" + + "§eDoes not need the option above to be enabled." + ) @ConfigEditorBoolean + @FeatureToggle public boolean highlightFull = true; @Expose @ConfigOption(name = "Number Format", desc = "Either show Default, Formatted or Unformatted numbers.\n" + - "§eDefault: §72,240/2.2k\n" + - "§eFormatted: §72.2k/2.2k\n" + - "§eUnformatted: §72,240/2,200") + "§eDefault: §72,240/2.2k\n" + + "§eFormatted: §72.2k/2.2k\n" + + "§eUnformatted: §72,240/2,200") @ConfigEditorDropdown(values = {"Default", "Formatted", "Unformatted"}) public int numberFormat = 1; diff --git a/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt index 7db58cd62..c88a66bd2 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt @@ -17,7 +17,6 @@ import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.editCopy import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName -import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.NEUItems.getNpcPriceOrNull import at.hannibal2.skyhanni.utils.NEUItems.getPrice import at.hannibal2.skyhanni.utils.NumberUtil.formatNumber @@ -157,8 +156,7 @@ object SackAPI { item.total = group("total") if (savingSacks) setSackItem(item.internalName, item.stored.formatNumber()) - val price: Long - if (isTrophySack) { + item.price = if (isTrophySack) { val internal = stack.getInternalName_old() val trophyFishName = internal.substringBeforeLast("_") .replace("_", "").lowercase() @@ -166,12 +164,11 @@ object SackAPI { val info = TrophyFishManager.getInfo(trophyFishName) val rarity = TrophyRarity.getByName(trophyRarityName) ?: TrophyRarity.BRONZE val filletValue = (info?.getFilletValue(rarity) ?: 0) * stored.toLong() - price = "MAGMA_FISH".asInternalName().sackPrice(filletValue.toString()) item.magmaFish = filletValue.toString() + "MAGMA_FISH".asInternalName().sackPrice(filletValue.toString()) } else { - price = internalName.sackPrice(stored).coerceAtLeast(0) + internalName.sackPrice(stored).coerceAtLeast(0) } - item.price = price if (isRuneSack) { @@ -361,4 +358,4 @@ enum class SackStatus { CORRECT, ALRIGHT, OUTDATED; -}
\ No newline at end of file +} 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 11cddf73b..7e1c50f1b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/SackDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/SackDisplay.kt @@ -5,13 +5,17 @@ import at.hannibal2.skyhanni.data.SackAPI import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.features.bazaar.BazaarApi -import at.hannibal2.skyhanni.utils.* +import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getLore +import at.hannibal2.skyhanni.utils.LorenzColor +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.LorenzUtils.addSelector import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName +import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.NEUItems.getItemStack +import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.NumberUtil.formatNumber import at.hannibal2.skyhanni.utils.RenderUtils.highlight @@ -23,7 +27,6 @@ object SackDisplay { private var display = emptyList<List<Any>>() private val config get() = SkyHanniMod.feature.inventory.sackDisplay - @SubscribeEvent fun onBackgroundDraw(event: GuiRenderEvent.ChestGuiOverlayRenderEvent) { if (SackAPI.inSackInventory) { @@ -39,9 +42,8 @@ object SackDisplay { if (!SackAPI.inSackInventory) return if (!config.highlightFull) return for (slot in InventoryUtils.getItemsInOpenChest()) { - val stack = slot.stack - val lore = stack.getLore() - if (lore.any { it.startsWith("§7Stored: §a")}) { + val lore = slot.stack.getLore() + if (lore.any { it.startsWith("§7Stored: §a") }) { slot highlight LorenzColor.RED } } @@ -122,6 +124,8 @@ object SackDisplay { rendered++ } + if (SackAPI.isTrophySack) newDisplay.addAsSingletonList("§cTotal Magmafish: §6${totalMagmaFish.addSeparators()}") + val name = SortType.entries[config.sortingType].longName newDisplay.addAsSingletonList("§7Sorted By: §c$name") @@ -133,8 +137,6 @@ object SackDisplay { update(false) }) - if (SackAPI.isTrophySack) newDisplay.addAsSingletonList("§cTotal Magmafish: §6${totalMagmaFish.addSeparators()}") - newDisplay.addButton( prefix = "§7Number format: ", getName = NumberFormat.entries[config.numberFormat].DisplayName, @@ -227,4 +229,4 @@ object SackDisplay { FORMATTED("Formatted"), UNFORMATTED("Unformatted") } -}
\ No newline at end of file +} |