diff options
Diffstat (limited to 'src')
12 files changed, 243 insertions, 34 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index 7441a60e3..a4a447c3f 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -112,7 +112,7 @@ import at.hannibal2.skyhanni.features.event.diana.GriffinBurrowHelper import at.hannibal2.skyhanni.features.event.diana.GriffinBurrowParticleFinder import at.hannibal2.skyhanni.features.event.diana.GriffinPetWarning import at.hannibal2.skyhanni.features.event.diana.InquisitorWaypointShare -import at.hannibal2.skyhanni.features.event.diana.MythologicalMobTracker +import at.hannibal2.skyhanni.features.event.diana.MythologicalCreatureTracker import at.hannibal2.skyhanni.features.event.diana.SoopyGuessBurrow import at.hannibal2.skyhanni.features.event.jerry.HighlightInquisitors import at.hannibal2.skyhanni.features.event.jerry.HighlightJerries @@ -139,6 +139,7 @@ import at.hannibal2.skyhanni.features.fishing.ThunderSparksHighlight import at.hannibal2.skyhanni.features.fishing.tracker.FishingProfitPlayerMoving import at.hannibal2.skyhanni.features.fishing.tracker.FishingProfitTracker import at.hannibal2.skyhanni.features.fishing.tracker.FishingTrackerCategoryManager +import at.hannibal2.skyhanni.features.fishing.tracker.SeaCreatureTracker import at.hannibal2.skyhanni.features.fishing.trophy.OdgerWaypoint import at.hannibal2.skyhanni.features.fishing.trophy.TrophyFishFillet import at.hannibal2.skyhanni.features.fishing.trophy.TrophyFishManager @@ -511,7 +512,7 @@ class SkyHanniMod { loadModule(NonGodPotEffectDisplay()) loadModule(SoopyGuessBurrow()) loadModule(DianaProfitTracker) - loadModule(MythologicalMobTracker) + loadModule(MythologicalCreatureTracker) loadModule(HighlightJerries()) loadModule(TheGreatSpook()) loadModule(GriffinBurrowHelper) @@ -609,6 +610,7 @@ class SkyHanniMod { loadModule(SlayerProfitTracker) loadModule(FishingProfitTracker) loadModule(FishingTrackerCategoryManager) + loadModule(SeaCreatureTracker) loadModule(FishingProfitPlayerMoving) loadModule(SlayerItemsOnGround()) loadModule(RestorePieceOfWizardPortalLore()) diff --git a/src/main/java/at/hannibal2/skyhanni/config/Storage.java b/src/main/java/at/hannibal2/skyhanni/config/Storage.java index 07641b44c..2678f0259 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/Storage.java +++ b/src/main/java/at/hannibal2/skyhanni/config/Storage.java @@ -6,9 +6,10 @@ import at.hannibal2.skyhanni.features.combat.endernodetracker.EnderNodeTracker; import at.hannibal2.skyhanni.features.combat.ghostcounter.GhostData; import at.hannibal2.skyhanni.features.dungeon.DungeonAPI; import at.hannibal2.skyhanni.features.event.diana.DianaProfitTracker; -import at.hannibal2.skyhanni.features.event.diana.MythologicalMobTracker; +import at.hannibal2.skyhanni.features.event.diana.MythologicalCreatureTracker; import at.hannibal2.skyhanni.features.event.jerry.frozentreasure.FrozenTreasureTracker; import at.hannibal2.skyhanni.features.fishing.tracker.FishingProfitTracker; +import at.hannibal2.skyhanni.features.fishing.tracker.SeaCreatureTracker; import at.hannibal2.skyhanni.features.fishing.trophy.TrophyRarity; import at.hannibal2.skyhanni.features.garden.CropAccessory; import at.hannibal2.skyhanni.features.garden.CropType; @@ -443,6 +444,9 @@ public class Storage { @Expose public FishingProfitTracker.Data fishingProfitTracker = new FishingProfitTracker.Data(); + @Expose + public SeaCreatureTracker.Data seaCreatureTracker = new SeaCreatureTracker.Data(); + } @Expose @@ -455,7 +459,8 @@ public class Storage { public DianaProfitTracker.Data dianaProfitTracker = new DianaProfitTracker.Data(); @Expose - public MythologicalMobTracker.Data mythologicalMobTracker = new MythologicalMobTracker.Data(); + // TODO renmae + public MythologicalCreatureTracker.Data mythologicalMobTracker = new MythologicalCreatureTracker.Data(); } } diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt index a202aa1dd..11f6de89a 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt @@ -17,11 +17,12 @@ import at.hannibal2.skyhanni.features.commands.PartyCommands import at.hannibal2.skyhanni.features.event.diana.BurrowWarpHelper import at.hannibal2.skyhanni.features.event.diana.DianaProfitTracker import at.hannibal2.skyhanni.features.event.diana.InquisitorWaypointShare -import at.hannibal2.skyhanni.features.event.diana.MythologicalMobTracker +import at.hannibal2.skyhanni.features.event.diana.MythologicalCreatureTracker import at.hannibal2.skyhanni.features.event.jerry.frozentreasure.FrozenTreasureTracker import at.hannibal2.skyhanni.features.fame.AccountUpgradeReminder import at.hannibal2.skyhanni.features.fame.CityProjectFeatures import at.hannibal2.skyhanni.features.fishing.tracker.FishingProfitTracker +import at.hannibal2.skyhanni.features.fishing.tracker.SeaCreatureTracker import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.features.garden.GardenCropTimeCommand import at.hannibal2.skyhanni.features.garden.GardenNextJacobContest @@ -215,9 +216,13 @@ object Commands { "Resets the Diana Profit Tracker" ) { DianaProfitTracker.resetCommand(it) } registerCommand( - "shresetmythologicalmobtracker", - "Resets the Mythological Mob Tracker" - ) { MythologicalMobTracker.resetCommand(it) } + "shresetmythologicalcreatureracker", + "Resets the Mythological Creature Tracker" + ) { MythologicalCreatureTracker.resetCommand(it) } + registerCommand( + "shresetseacreaturetracker", + "Resets the Sea Creature Tracker" + ) { SeaCreatureTracker.resetCommand(it) } } private fun usersBugFix() { diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/event/diana/DianaConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/event/diana/DianaConfig.java index 2de341b4c..4867c0bcd 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/event/diana/DianaConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/event/diana/DianaConfig.java @@ -70,7 +70,8 @@ public class DianaConfig { public DianaProfitTrackerConfig dianaProfitTracker = new DianaProfitTrackerConfig(); @Expose - @ConfigOption(name = "Mythological Mob Tracker", desc = "") + @ConfigOption(name = "Mythological Creature Tracker", desc = "") @Accordion + // TODO renmae public MythologicalMobTrackerConfig mythologicalMobtracker = new MythologicalMobTrackerConfig(); } diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/fishing/FishingConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/fishing/FishingConfig.java index 349f4882e..d0bf5d1f3 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/fishing/FishingConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/fishing/FishingConfig.java @@ -56,6 +56,11 @@ public class FishingConfig { public FishingProfitTrackerConfig fishingProfitTracker = new FishingProfitTrackerConfig(); @Expose + @ConfigOption(name = "Sea Creature Tracker", desc = "") + @Accordion + public SeaCreatureTrackerConfig seaCreatureTracker = new SeaCreatureTrackerConfig(); + + @Expose @ConfigOption( name = "Shark Fish Counter", desc = "Counts how many Sharks have been caught." diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/fishing/SeaCreatureTrackerConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/fishing/SeaCreatureTrackerConfig.java new file mode 100644 index 000000000..91c26aa21 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/config/features/fishing/SeaCreatureTrackerConfig.java @@ -0,0 +1,30 @@ +package at.hannibal2.skyhanni.config.features.fishing; + +import at.hannibal2.skyhanni.config.FeatureToggle; +import at.hannibal2.skyhanni.config.core.config.Position; +import com.google.gson.annotations.Expose; +import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; +import io.github.moulberry.moulconfig.annotations.ConfigOption; +import io.github.moulberry.moulconfig.observer.Property; + +public class SeaCreatureTrackerConfig { + + @Expose + @ConfigOption(name = "Enabled", desc = "Count the different sea creatures you catch.") + @ConfigEditorBoolean + @FeatureToggle + public boolean enabled = false; + + @Expose + public Position position = new Position(20, 20, false, true); + + @Expose + @ConfigOption(name = "Show Percentage", desc = "Show percentage how often what sea creature got catched.") + @ConfigEditorBoolean + public Property<Boolean> showPercentage = Property.of(false); + + @Expose + @ConfigOption(name = "Hide Chat", desc = "Hide the chat messages when catching a sea creature.") + @ConfigEditorBoolean + public boolean hideChat = false; +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/MythologicalMobTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/MythologicalCreatureTracker.kt index dfb0de36a..f924cefb1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/MythologicalMobTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/MythologicalCreatureTracker.kt @@ -17,7 +17,7 @@ import com.google.gson.annotations.Expose import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.util.regex.Pattern -object MythologicalMobTracker { +object MythologicalCreatureTracker { private val group = RepoPattern.group("event.diana.mythological.tracker") @@ -33,7 +33,7 @@ object MythologicalMobTracker { private val config get() = SkyHanniMod.feature.event.diana.mythologicalMobtracker - private val tracker = SkyHanniTracker("Mythological Mob Tracker", { Data() }, { it.diana.mythologicalMobTracker }) + private val tracker = SkyHanniTracker("Mythological Creature Tracker", { Data() }, { it.diana.mythologicalMobTracker }) { drawDisplay(it) } class Data : TrackerData() { @@ -42,10 +42,10 @@ object MythologicalMobTracker { } @Expose - var count: MutableMap<MythologicalMobType, Int> = mutableMapOf() + var count: MutableMap<MythologicalCreatureType, Int> = mutableMapOf() } - enum class MythologicalMobType(val displayName: String, val pattern: Pattern) { + enum class MythologicalCreatureType(val displayName: String, val pattern: Pattern) { MINOTAUR("§2Minotaur", minotaurPattern), GAIA_CONSTRUCT("§2Gaia Construct", gaiaConstructPattern), MINOS_CHAMPION("§2Minos Champion", minosChampionPattern), @@ -56,30 +56,30 @@ object MythologicalMobTracker { @SubscribeEvent fun onChat(event: LorenzChatEvent) { - MythologicalMobType.entries.forEach { mobType -> - if (mobType.pattern.matches(event.message)) { - tracker.modify { it.count.addOrPut(mobType, 1) } + MythologicalCreatureType.entries.forEach { creatureType -> + if (creatureType.pattern.matches(event.message)) { + tracker.modify { it.count.addOrPut(creatureType, 1) } if (config.hideChat) { - event.blockedReason = "mythological_mob_dug" + event.blockedReason = "mythological_creature_dug" } } } } private fun drawDisplay(data: Data): List<List<Any>> = buildList { - addAsSingletonList("§7Mythological Mob Tracker:") + addAsSingletonList("§7Mythological Creature Tracker:") val total = data.count.sumAllValues() - data.count.entries.sortedByDescending { it.value }.forEach { (mobType, amount) -> + data.count.entries.sortedByDescending { it.value }.forEach { (creatureType, amount) -> val percentageSuffix = if (config.showPercentage.get()) { val percentage = LorenzUtils.formatPercentage(amount.toDouble() / total) " §7$percentage" } else "" - addAsSingletonList(" §7- §e${amount.addSeparators()} ${mobType.displayName}$percentageSuffix") + addAsSingletonList(" §7- §e${amount.addSeparators()} ${creatureType.displayName}$percentageSuffix") } - addAsSingletonList(" §7- §e${total.addSeparators()} §bTotal Mobs") + addAsSingletonList(" §7- §e${total.addSeparators()} §7Total Mythological Creatures") } @SubscribeEvent @@ -97,7 +97,7 @@ object MythologicalMobTracker { } fun resetCommand(args: Array<String>) { - tracker.resetCommand(args, "shresetmythologicalmobtracker") + tracker.resetCommand(args, "shresetmythologicalcreatureracker") } private fun isEnabled() = DianaAPI.isDoingDiana() && config.enabled diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureManager.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureManager.kt index b3e0670fe..022e9d302 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureManager.kt @@ -1,11 +1,11 @@ package at.hannibal2.skyhanni.features.fishing import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.data.jsonobjects.repo.SeaCreatureJson import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.events.SeaCreatureFishEvent import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.data.jsonobjects.repo.SeaCreatureJson import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class SeaCreatureManager { @@ -32,33 +32,39 @@ class SeaCreatureManager { @SubscribeEvent fun onRepoReload(event: RepositoryReloadEvent) { seaCreatureMap.clear() - allFishingMobs.clear() + allFishingMobs = emptyMap() var counter = 0 val data = event.getConstant<Map<String, SeaCreatureJson.Variant>>("SeaCreatures", SeaCreatureJson.TYPE) val allFishingMobs = mutableMapOf<String, SeaCreature>() - for (variant in data.values) { + val variants = mutableMapOf<String, List<String>>() + + for ((variantName, variant) in data) { val chatColor = variant.chat_color - for ((displayName, seaCreature) in variant.sea_creatures) { + val variantFishes = mutableListOf<String>() + variants[variantName] = variantFishes + for ((name, seaCreature) in variant.sea_creatures) { val chatMessage = seaCreature.chat_message val fishingExperience = seaCreature.fishing_experience val rarity = seaCreature.rarity val rare = seaCreature.rare ?: false - val creature = SeaCreature(displayName, fishingExperience, chatColor, rare, rarity) + val creature = SeaCreature(name, fishingExperience, chatColor, rare, rarity) seaCreatureMap[chatMessage] = creature - allFishingMobs[displayName] = creature + allFishingMobs[name] = creature + variantFishes.add(name) counter++ } } SeaCreatureManager.allFishingMobs = allFishingMobs - + allVariants = variants } companion object { private val seaCreatureMap = mutableMapOf<String, SeaCreature>() - var allFishingMobs = mutableMapOf<String, SeaCreature>() + var allFishingMobs = mapOf<String, SeaCreature>() + var allVariants = mapOf<String, List<String>>() private val doubleHookMessages = setOf( "§eIt's a §r§aDouble Hook§r§e! Woot woot!", diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt new file mode 100644 index 000000000..2e0181706 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt @@ -0,0 +1,153 @@ +package at.hannibal2.skyhanni.features.fishing.tracker + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.ConfigLoadEvent +import at.hannibal2.skyhanni.events.GuiRenderEvent +import at.hannibal2.skyhanni.events.SeaCreatureFishEvent +import at.hannibal2.skyhanni.features.fishing.FishingAPI +import at.hannibal2.skyhanni.features.fishing.SeaCreatureManager +import at.hannibal2.skyhanni.test.command.ErrorManager +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.addOrPut +import at.hannibal2.skyhanni.utils.LorenzUtils.sumAllValues +import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators +import at.hannibal2.skyhanni.utils.StringUtils.allLettersFirstUppercase +import at.hannibal2.skyhanni.utils.tracker.SkyHanniTracker +import at.hannibal2.skyhanni.utils.tracker.TrackerData +import com.google.gson.annotations.Expose +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import kotlin.time.Duration.Companion.minutes + +object SeaCreatureTracker { + + private val config get() = SkyHanniMod.feature.fishing.seaCreatureTracker + + private val tracker = SkyHanniTracker("Sea Creature Tracker", { Data() }, { it.fishing.seaCreatureTracker }) + { drawDisplay(it) } + + class Data : TrackerData() { + override fun reset() { + amount.clear() + } + + @Expose + var amount: MutableMap<String, Int> = mutableMapOf() + } + + @SubscribeEvent + fun onSeaCreatureFish(event: SeaCreatureFishEvent) { + if (!isEnabled()) return + + tracker.modify { + val amount = if (event.doubleHook) 2 else 1 + it.amount.addOrPut(event.seaCreature.name, amount) + } + + if (config.hideChat) { + event.chatEvent.blockedReason = "sea_creature_tracker" + } + } + + private val nameAll: CategoryName = "All" + private var currentCategory: CategoryName = nameAll + + private fun getCurrentCategories(data: Data): Map<CategoryName, Int> { + val map = mutableMapOf<CategoryName, Int>() + map[nameAll] = data.amount.size + for ((category, names) in SeaCreatureManager.allVariants) { + val amount = names.count { it in data.amount } + if (amount > 0) { + map[category] = amount + } + } + + return map + } + + private fun drawDisplay(data: Data): List<List<Any>> = buildList { + addAsSingletonList("§7Sea Creature Tracker:") + + val filter: (String) -> Boolean = addCategories(data) + val realAmount = data.amount.filter { filter(it.key) } + + val total = realAmount.sumAllValues() + realAmount.entries.sortedByDescending { it.value }.forEach { (name, amount) -> + val displayName = SeaCreatureManager.allFishingMobs[name]?.displayName ?: run { + ErrorManager.logErrorStateWithData( + "Sea Creature Tracker can not display a name correctly", + "Could not find sea creature by name", + "SeaCreatureManager.allFishingMobs.keys" to SeaCreatureManager.allFishingMobs.keys, + "name" to name + ) + name + } + + val percentageSuffix = if (config.showPercentage.get()) { + val percentage = LorenzUtils.formatPercentage(amount.toDouble() / total) + " §7$percentage" + } else "" + + addAsSingletonList(" §7- §e${amount.addSeparators()} $displayName$percentageSuffix") + } + addAsSingletonList(" §7- §e${total.addSeparators()} §7Total Sea Creatures") + } + + private fun MutableList<List<Any>>.addCategories(data: Data): (String) -> Boolean { + val amounts = getCurrentCategories(data) + val list = amounts.keys.toList() + if (currentCategory !in list) { + currentCategory = nameAll + } + + if (tracker.isInventoryOpen()) { + addButton( + prefix = "§7Category: ", + getName = currentCategory.allLettersFirstUppercase() + " §7(" + amounts[currentCategory] + ")", + onChange = { + val id = list.indexOf(currentCategory) + currentCategory = list[(id + 1) % list.size] + tracker.update() + } + ) + } + + val items = SeaCreatureManager.allVariants[currentCategory] ?: run { + ErrorManager.logErrorStateWithData( + "Sea Creature Tracker can not find all sea creature variants", + "Sea creature variant is not found", + "SeaCreatureManager.allVariants.keys" to SeaCreatureManager.allVariants.keys, + "currentCategory" to currentCategory, + ) + return { true } + } + val filter: (String) -> Boolean = if (currentCategory == nameAll) { + { true } + } else { + { it in items } + } + return filter + } + + @SubscribeEvent + fun onConfigLoad(event: ConfigLoadEvent) { + LorenzUtils.onToggle(config.showPercentage) { + tracker.update() + } + } + + @SubscribeEvent + fun onRenderOverlay(event: GuiRenderEvent) { + if (!isEnabled()) return + + tracker.renderDisplay(config.position) + } + + fun resetCommand(args: Array<String>) { + tracker.resetCommand(args, "shresetseacreaturetracker") + } + + private fun isEnabled() = LorenzUtils.inSkyBlock && + FishingAPI.lastActiveFishingTime.passedSince() < 10.minutes && config.enabled +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt index 5f726f544..c7a70f12c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt @@ -46,7 +46,7 @@ import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.hasEtherwarp import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.hasJalapenoBook import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.hasWoodSingularity import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.isRecombobulated -import at.hannibal2.skyhanni.utils.StringUtils.firstLetterUppercase +import at.hannibal2.skyhanni.utils.StringUtils.allLettersFirstUppercase import at.hannibal2.skyhanni.utils.StringUtils.removeColor import com.google.gson.JsonObject import io.github.moulberry.notenoughupdates.recipes.Ingredient @@ -122,7 +122,7 @@ object EstimatedItemValueCalculator { if (price != null) { list.add( "§7Attribute §9${ - attributes[0].first.fixMending().split("_").joinToString(" ") { it.firstLetterUppercase() } + attributes[0].first.fixMending().allLettersFirstUppercase() } ${attributes[0].second}§7: (§6${NumberUtil.format(price)}§7)" ) return price @@ -148,7 +148,7 @@ object EstimatedItemValueCalculator { val displayName = attr.first.fixMending() list.add( " §9${ - displayName.split("_").joinToString(" ") { it.firstLetterUppercase() } + displayName.allLettersFirstUppercase() } ${attr.second}§7: §6${if (price != null) NumberUtil.format(price) else "Unknown"}" ) } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt index 3c9432638..98b661478 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt @@ -548,7 +548,7 @@ object LorenzUtils { return newValue } - fun <K, N : Number> MutableMap<K, N>.sumAllValues(): Double { + fun <K, N : Number> Map<K, N>.sumAllValues(): Double { if (values.isEmpty()) return 0.0 return when (values.first()) { diff --git a/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt index 9ac80f7f3..4e85267ca 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt @@ -284,4 +284,6 @@ object StringUtils { fun Pattern.matches(string: String) = matcher(string).matches() fun Pattern.find(string: String) = matcher(string).find() + + fun String.allLettersFirstUppercase() = split("_").joinToString(" ") { it.firstLetterUppercase() } } |