diff options
| author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-06-09 20:46:52 +0200 |
|---|---|---|
| committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-06-09 20:46:52 +0200 |
| commit | f052dda969869365afcb2f1fc89c899a56545feb (patch) | |
| tree | f6344d8ef8691108cb3ae206bc761860d2c2c611 /src/main/java | |
| parent | 1181b4a7bdb7cd46144d5550abcd56e2ba284b4d (diff) | |
| download | skyhanni-f052dda969869365afcb2f1fc89c899a56545feb.tar.gz skyhanni-f052dda969869365afcb2f1fc89c899a56545feb.tar.bz2 skyhanni-f052dda969869365afcb2f1fc89c899a56545feb.zip | |
additional changes to editorconfig and random code cleanup
Diffstat (limited to 'src/main/java')
10 files changed, 361 insertions, 215 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestones.kt b/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestones.kt index 2195efb99..5e236c4c5 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestones.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestones.kt @@ -23,11 +23,11 @@ object GardenCropMilestones { private val patternGroup = RepoPattern.group("data.garden.milestone") private val cropPattern by patternGroup.pattern( "crop", - "§7Harvest §f(?<name>.*) §7on .*" + "§7Harvest §f(?<name>.*) §7on .*", ) val totalPattern by patternGroup.pattern( "total", - "§7Total: §a(?<name>.*)" + "§7Total: §a(?<name>.*)", ) private val config get() = GardenAPI.config.cropMilestones @@ -67,9 +67,10 @@ object GardenCropMilestones { add(" §r§7§8+§d2 SkyHanni User Luck") } + val cropName = crop.cropName val messages = listOf( "§r§3§l▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬§r", - " §r§b§lGARDEN MILESTONE §3${crop.cropName} §8$oldLevel➜§3$newLevel§r", + " §r§b§lGARDEN MILESTONE §3$cropName §8$oldLevel➜§3$newLevel§r", if (goalReached) listOf( "", @@ -80,13 +81,16 @@ object GardenCropMilestones { "", " §r§a§lREWARDS§r", rewards.joinToString("\n"), - "§r§3§l▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬§r" + "§r§3§l▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬§r", ) chat(messages.joinToString("\n"), false) - if (goalReached) - chat("§e§lYou have reached your milestone goal of §b§l${customGoalLevel} §e§lin the §b§l${crop.cropName} §e§lcrop!", false) + val message = "§e§lYou have reached your milestone goal of §b§l$customGoalLevel " + + "§e§lin the §b§l$cropName §e§lcrop!" + if (goalReached) { + chat(message, false) + } SoundUtils.createSound("random.levelup", 1f, 1f).playSound() } diff --git a/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestonesCommunityFix.kt b/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestonesCommunityFix.kt index cd6523f26..691a3c8e2 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestonesCommunityFix.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestonesCommunityFix.kt @@ -30,7 +30,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object GardenCropMilestonesCommunityFix { private val amountPattern by RepoPattern.pattern( "data.garden.milestonefix.amount", - ".*§e(?<having>.*)§6/§e(?<max>.*)" + ".*§e(?<having>.*)§6/§e(?<max>.*)", ) private var showWrongData = false @@ -67,7 +67,7 @@ object GardenCropMilestonesCommunityFix { ChatUtils.chat( "Found §c${data.size} §ewrong crop milestone steps in the menu! " + "Correct data got put into clipboard. " + - "Please share it on the §bSkyHanni Discord §ein the channel §b#share-data§e." + "Please share it on the §bSkyHanni Discord §ein the channel §b#share-data§e.", ) OSUtils.copyToClipboard("```${data.joinToString("\n")}```") } else { @@ -93,8 +93,8 @@ object GardenCropMilestonesCommunityFix { // debug("crop: $crop") // debug("realTier: $realTier") - val guessNextMax = GardenCropMilestones.getCropsForTier(realTier + 1, crop) - GardenCropMilestones.getCropsForTier(realTier, crop) -// debug("guessNextMax: ${guessNextMax.addSeparators()}") + val guessNextMax = nextMax(realTier, crop) + // debug("guessNextMax: ${guessNextMax.addSeparators()}") val nextMax = amountPattern.matchMatcher(next) { group("max").formatLong() } ?: return @@ -114,7 +114,7 @@ object GardenCropMilestonesCommunityFix { // debug("$crop total offf by: ${totalOffBy.addSeparators()}") } -// fun debug(message: String) { + // fun debug(message: String) { // if (SkyHanniMod.feature.dev.debug.enabled) { // println(message) // } @@ -162,7 +162,7 @@ object GardenCropMilestonesCommunityFix { } private fun tryFix(crop: CropType, tier: Int, amount: Int): Boolean { - val guessNextMax = GardenCropMilestones.getCropsForTier(tier + 1, crop) - GardenCropMilestones.getCropsForTier(tier, crop) + val guessNextMax = nextMax(tier, crop) if (guessNextMax.toInt() == amount) return false GardenCropMilestones.cropMilestoneData = GardenCropMilestones.cropMilestoneData.editCopy { fix(crop, this, tier, amount) @@ -170,6 +170,9 @@ object GardenCropMilestonesCommunityFix { return true } + private fun nextMax(tier: Int, crop: CropType): Long = + GardenCropMilestones.getCropsForTier(tier + 1, crop) - GardenCropMilestones.getCropsForTier(tier, crop) + private fun fix(crop: CropType, map: MutableMap<CropType, List<Int>>, tier: Int, amount: Int) { map[crop] = map[crop]!!.editCopy { this[tier] = amount diff --git a/src/main/java/at/hannibal2/skyhanni/data/HotmData.kt b/src/main/java/at/hannibal2/skyhanni/data/HotmData.kt index c1ae1390a..8c6db7df0 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/HotmData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/HotmData.kt @@ -43,188 +43,289 @@ enum class HotmData( val rewardFun: ((Int) -> (Map<HotmReward, Double>)), ) { - MINING_SPEED("Mining Speed", + MINING_SPEED( + "Mining Speed", 50, { currentLevel -> (currentLevel + 2.0).pow(3) }, - { level -> mapOf(HotmReward.MINING_SPEED to level * 20.0) }), - MINING_FORTUNE("Mining Fortune", + { level -> mapOf(HotmReward.MINING_SPEED to level * 20.0) }, + ), + MINING_FORTUNE( + "Mining Fortune", 50, { currentLevel -> (currentLevel + 2.0).pow(3.05) }, - { level -> mapOf(HotmReward.MINING_FORTUNE to level * 5.0) }), - QUICK_FORGE("Quick Forge", + { level -> mapOf(HotmReward.MINING_FORTUNE to level * 5.0) }, + ), + QUICK_FORGE( + "Quick Forge", 20, { currentLevel -> (currentLevel + 2.0).pow(4) }, - { level -> mapOf(HotmReward.FORGE_TIME_DECREASE to 10.0 + (level * 0.5)) }), - TITANIUM_INSANIUM("Titanium Insanium", + { level -> mapOf(HotmReward.FORGE_TIME_DECREASE to 10.0 + (level * 0.5)) }, + ), + TITANIUM_INSANIUM( + "Titanium Insanium", 50, { currentLevel -> (currentLevel + 2.0).pow(3.1) }, - { level -> mapOf(HotmReward.TITANIUM_CHANCE to 2.0 + (level * 0.1)) }), - DAILY_POWDER("Daily Powder", + { level -> mapOf(HotmReward.TITANIUM_CHANCE to 2.0 + (level * 0.1)) }, + ), + DAILY_POWDER( + "Daily Powder", 100, { currentLevel -> 200.0 + (currentLevel * 18.0) }, - { level -> mapOf(HotmReward.DAILY_POWDER to (200.0 + ((level - 1.0) * 18.0)) * 2.0) }), - LUCK_OF_THE_CAVE("Luck of the Cave", + { level -> mapOf(HotmReward.DAILY_POWDER to (200.0 + ((level - 1.0) * 18.0)) * 2.0) }, + ), + LUCK_OF_THE_CAVE( + "Luck of the Cave", 45, { currentLevel -> (currentLevel + 2.0).pow(3.07) }, - { level -> mapOf(HotmReward.EXTRA_CHANCE_TRIGGER_RARE_OCCURRENCES to 5.0 + level) }), - CRYSTALLIZED("Crystallized", 30, { currentLevel -> (currentLevel + 2.0).pow(3.4) }, { level -> - mapOf( - HotmReward.MINING_SPEED to 20.0 + ((level - 1.0) * 6.0), - HotmReward.MINING_FORTUNE to 20.0 + ((level - 1.0) * 5.0) - ) - }), - EFFICIENT_MINER("Efficient Miner", + { level -> mapOf(HotmReward.EXTRA_CHANCE_TRIGGER_RARE_OCCURRENCES to 5.0 + level) }, + ), + CRYSTALLIZED( + "Crystallized", + 30, + { currentLevel -> (currentLevel + 2.0).pow(3.4) }, + { level -> + mapOf( + HotmReward.MINING_SPEED to 20.0 + ((level - 1.0) * 6.0), + HotmReward.MINING_FORTUNE to 20.0 + ((level - 1.0) * 5.0), + ) + }, + ), + EFFICIENT_MINER( + "Efficient Miner", 100, { currentLevel -> (currentLevel + 2.0).pow(2.6) }, - { level -> mapOf(HotmReward.AVERAGE_BLOCK_BREAKS to (10.0 + (level * 0.4)) * (1.0 + (level * 0.05))) }), - ORBITER("Orbiter", + { level -> mapOf(HotmReward.AVERAGE_BLOCK_BREAKS to (10.0 + (level * 0.4)) * (1.0 + (level * 0.05))) }, + ), + ORBITER( + "Orbiter", 80, { currentLevel -> (currentLevel + 1.0) * 70.0 }, - { level -> mapOf(HotmReward.CHANCE_EXTRA_XP_ORBS to 0.2 + (level * 0.01)) }), - SEASONED_MINEMAN("Seasoned Mineman", + { level -> mapOf(HotmReward.CHANCE_EXTRA_XP_ORBS to 0.2 + (level * 0.01)) }, + ), + SEASONED_MINEMAN( + "Seasoned Mineman", 100, { currentLevel -> (currentLevel + 2.0).pow(2.3) }, - { level -> mapOf(HotmReward.MINING_WISDOM to 5.0 + (level * 0.1)) }), - MOLE("Mole", + { level -> mapOf(HotmReward.MINING_WISDOM to 5.0 + (level * 0.1)) }, + ), + MOLE( + "Mole", 190, { currentLevel -> (currentLevel + 2.0).pow(2.2) }, - { level -> mapOf(HotmReward.AVERAGE_BLOCK_BREAKS to 1.0 + ((level + 9.0) * 0.05 * ((level + 8) % 20))) }), - PROFESSIONAL("Professional", + { level -> mapOf(HotmReward.AVERAGE_BLOCK_BREAKS to 1.0 + ((level + 9.0) * 0.05 * ((level + 8) % 20))) }, + ), + PROFESSIONAL( + "Professional", 140, { currentLevel -> (currentLevel + 2.0).pow(2.3) }, - { level -> mapOf(HotmReward.MINING_SPEED to 50.0 + (level * 5.0)) }), - LONESOME_MINER("Lonesome Miner", + { level -> mapOf(HotmReward.MINING_SPEED to 50.0 + (level * 5.0)) }, + ), + LONESOME_MINER( + "Lonesome Miner", 45, { currentLevel -> (currentLevel + 2.0).pow(3.07) }, - { level -> mapOf(HotmReward.COMBAT_STAT_BOOST to 5.0 + ((level - 1.0) * 0.5)) }), - GREAT_EXPLORER("Great Explorer", 20, { currentLevel -> (currentLevel + 2.0).pow(4.0) }, { level -> - mapOf( - HotmReward.CHANCE_OF_TREASURE_CHEST to (0.2 * (0.2 + 0.04 * (level - 1.0))), - HotmReward.LOCKS_OF_TREASURE_CHEST to 1 + level * 0.2 - ) - }), - FORTUNATE("Fortunate", + { level -> mapOf(HotmReward.COMBAT_STAT_BOOST to 5.0 + ((level - 1.0) * 0.5)) }, + ), + GREAT_EXPLORER( + "Great Explorer", + 20, + { currentLevel -> (currentLevel + 2.0).pow(4.0) }, + { level -> + mapOf( + HotmReward.CHANCE_OF_TREASURE_CHEST to (0.2 * (0.2 + 0.04 * (level - 1.0))), + HotmReward.LOCKS_OF_TREASURE_CHEST to 1 + level * 0.2, + ) + }, + ), + FORTUNATE( + "Fortunate", 20, { currentLevel -> (currentLevel + 1.0).pow(3.05) }, - { level -> mapOf(HotmReward.MINING_FORTUNE to 20.0 + (level * 4.0)) }), - POWDER_BUFF("Powder Buff", 50, { currentLevel -> (currentLevel + 1.0).pow(3.2) }, { level -> - mapOf( - HotmReward.MORE_MITHRIL_POWER to level.toDouble(), HotmReward.MORE_GEMSTONE_POWER to level.toDouble() - ) - }), - MINING_SPEED_II("Mining Speed II", + { level -> mapOf(HotmReward.MINING_FORTUNE to 20.0 + (level * 4.0)) }, + ), + POWDER_BUFF( + "Powder Buff", + 50, + { currentLevel -> (currentLevel + 1.0).pow(3.2) }, + { level -> + mapOf( + HotmReward.MORE_MITHRIL_POWER to level.toDouble(), + HotmReward.MORE_GEMSTONE_POWER to level.toDouble(), + ) + }, + ), + MINING_SPEED_II( + "Mining Speed II", 50, { currentLevel -> (currentLevel + 2.0).pow(3.2) }, - { level -> mapOf(HotmReward.MINING_SPEED to level * 40.0) }), - MINING_FORTUNE_II("Mining Fortune II", + { level -> mapOf(HotmReward.MINING_SPEED to level * 40.0) }, + ), + MINING_FORTUNE_II( + "Mining Fortune II", 50, { currentLevel -> (currentLevel + 2.0).pow(3.2) }, - { level -> mapOf(HotmReward.MINING_FORTUNE to level * 5.0) }), + { level -> mapOf(HotmReward.MINING_FORTUNE to level * 5.0) }, + ), // Static - MINING_MADNESS("Mining Madness", 1, { null }, { - mapOf( - HotmReward.MINING_SPEED to 50.0, HotmReward.MINING_FORTUNE to 50.0 - ) - }), + MINING_MADNESS( + "Mining Madness", + 1, + { null }, + { + mapOf( + HotmReward.MINING_SPEED to 50.0, + HotmReward.MINING_FORTUNE to 50.0, + ) + }, + ), SKY_MALL("Sky Mall", 1, { null }, { emptyMap() }), PRECISION_MINING("Precision Mining", 1, { null }, { mapOf(HotmReward.MINING_SPEED_BOOST to 30.0) }), - FRONT_LOADED("Front Loaded", 1, { null }, { - mapOf( - HotmReward.MINING_SPEED to 100.0, - HotmReward.MINING_FORTUNE to 100.0, - HotmReward.MORE_BASE_MITHRIL_POWER to 2.0, - HotmReward.MORE_BASE_GEMSTONE_POWER to 2.0 - ) - }), + FRONT_LOADED( + "Front Loaded", + 1, + { null }, + { + mapOf( + HotmReward.MINING_SPEED to 100.0, + HotmReward.MINING_FORTUNE to 100.0, + HotmReward.MORE_BASE_MITHRIL_POWER to 2.0, + HotmReward.MORE_BASE_GEMSTONE_POWER to 2.0, + ) + }, + ), STAR_POWDER("Star Powder", 1, { null }, { mapOf(HotmReward.MORE_MITHRIL_POWER to 300.0) }), GOBLIN_KILLER("Goblin Killer", 1, { null }, { emptyMap() }), // Abilities - PICKOBULUS("Pickobulus", 3, { null }, { level -> - mapOf( - HotmReward.ABILITY_RADIUS to ceil(level * 0.5) + 1.0, - HotmReward.ABILITY_COOLDOWN to 130.0 - 10.0 * level - ) - }), - MINING_SPEED_BOOST("Mining Speed Boost", 3, { null }, { level -> - mapOf( - HotmReward.ABILITY_DURATION to level + 1.0, HotmReward.ABILITY_COOLDOWN to 10.0 + 5.0 * level - ) - }), - VEIN_SEEKER("Vein Seeker", 3, { null }, { level -> - mapOf( - HotmReward.ABILITY_RADIUS to level + 1.0, - HotmReward.ABILITY_DURATION to 10.0 + 2.0 * level, - HotmReward.ABILITY_COOLDOWN to 60.0 - ) - }), - MANIAC_MINER("Maniac Miner", 3, { null }, { level -> - mapOf( - HotmReward.ABILITY_DURATION to 5.0 + level * 5.0, HotmReward.ABILITY_COOLDOWN to 60.0 - level - ) - }), + PICKOBULUS( + "Pickobulus", + 3, + { null }, + { level -> + mapOf( + HotmReward.ABILITY_RADIUS to ceil(level * 0.5) + 1.0, + HotmReward.ABILITY_COOLDOWN to 130.0 - 10.0 * level, + ) + }, + ), + MINING_SPEED_BOOST( + "Mining Speed Boost", + 3, + { null }, + { level -> + mapOf( + HotmReward.ABILITY_DURATION to level + 1.0, + HotmReward.ABILITY_COOLDOWN to 10.0 + 5.0 * level, + ) + }, + ), + VEIN_SEEKER( + "Vein Seeker", + 3, + { null }, + { level -> + mapOf( + HotmReward.ABILITY_RADIUS to level + 1.0, + HotmReward.ABILITY_DURATION to 10.0 + 2.0 * level, + HotmReward.ABILITY_COOLDOWN to 60.0, + ) + }, + ), + MANIAC_MINER( + "Maniac Miner", + 3, + { null }, + { level -> + mapOf( + HotmReward.ABILITY_DURATION to 5.0 + level * 5.0, + HotmReward.ABILITY_COOLDOWN to 60.0 - level, + ) + }, + ), PEAK_OF_THE_MOUNTAIN("Peak of the Mountain", 10, { null }, { emptyMap() }), // Mining V3 - DAILY_GRIND("Daily Grind", + DAILY_GRIND( + "Daily Grind", 100, { currentLevel -> 218.0 + (18.0 * (currentLevel - 2.0)) }, - { level -> mapOf(HotmReward.DAILY_POWDER to 50.0 * level) }), + { level -> mapOf(HotmReward.DAILY_POWDER to 50.0 * level) }, + ), DUST_COLLECTOR( "Dust Collector", 20, { currentLevel -> (currentLevel + 1.0).pow(4) }, - { level -> mapOf(HotmReward.FOSSIL_DUST to 1.0 * level) }), - WARM_HEARTED("Warm Hearted", + { level -> mapOf(HotmReward.FOSSIL_DUST to 1.0 * level) }, + ), + WARM_HEARTED( + "Warm Hearted", 50, { currentLevel -> floor((currentLevel + 1.0).pow(3.1)) }, - { level -> mapOf(HotmReward.COLD_RESISTANCE to 0.2 * level) }), + { level -> mapOf(HotmReward.COLD_RESISTANCE to 0.2 * level) }, + ), - STRONG_ARM("Strong Arm", + STRONG_ARM( + "Strong Arm", 100, { currentLevel -> floor((currentLevel + 1.0).pow(2.3)) }, - { level -> mapOf(HotmReward.MINING_SPEED to 5.0 * level) }), - NO_STONE_UNTURNED("No Stone Unturned", + { level -> mapOf(HotmReward.MINING_SPEED to 5.0 * level) }, + ), + NO_STONE_UNTURNED( + "No Stone Unturned", 50, { currentLevel -> floor((currentLevel + 1.0).pow(3.05)) }, - { level -> mapOf(HotmReward.UNKNOWN to 0.5 * level) }), + { level -> mapOf(HotmReward.UNKNOWN to 0.5 * level) }, + ), - SUB_ZERO_MINING("SubZero Mining", + SUB_ZERO_MINING( + "SubZero Mining", 100, { currentLevel -> floor((currentLevel + 1.0).pow(2.3)) }, - { level -> mapOf(HotmReward.MINING_FORTUNE to 1.0 * level) }), - SURVEYOR("Surveyor", + { level -> mapOf(HotmReward.MINING_FORTUNE to 1.0 * level) }, + ), + SURVEYOR( + "Surveyor", 20, { currentLevel -> (currentLevel + 1.0).pow(4) }, - { level -> mapOf(HotmReward.UNKNOWN to 0.75 * level) }), - EAGER_ADVENTURER("Eager Adventurer", + { level -> mapOf(HotmReward.UNKNOWN to 0.75 * level) }, + ), + EAGER_ADVENTURER( + "Eager Adventurer", 100, { currentLevel -> floor((currentLevel + 1.0).pow(2.3)) }, - { level -> mapOf(HotmReward.MINING_SPEED to 2.0 * level) }), + { level -> mapOf(HotmReward.MINING_SPEED to 2.0 * level) }, + ), - DEAD_MANS_CHEST("Dead Man's Chest", + DEAD_MANS_CHEST( + "Dead Man's Chest", 50, { currentLevel -> floor((currentLevel + 1.0).pow(3.2)) }, - { level -> mapOf(HotmReward.UNKNOWN to 1.0 * level) }), + { level -> mapOf(HotmReward.UNKNOWN to 1.0 * level) }, + ), - GIFTS_FROM_THE_DEPARTED("Gifts from the Departed", + GIFTS_FROM_THE_DEPARTED( + "Gifts from the Departed", 100, { currentLevel -> floor((currentLevel + 1.0).pow(2.45)) }, - { level -> mapOf(HotmReward.UNKNOWN to 0.2 * level) }), + { level -> mapOf(HotmReward.UNKNOWN to 0.2 * level) }, + ), EXCAVATOR( "Excavator", 50, { currentLevel -> (currentLevel + 1.0).pow(3) }, - { level -> mapOf(HotmReward.UNKNOWN to 0.5 * level) }), - RAGS_TO_RICHES("Rags to Riches", + { level -> mapOf(HotmReward.UNKNOWN to 0.5 * level) }, + ), + RAGS_TO_RICHES( + "Rags to Riches", 50, { currentLevel -> floor((currentLevel + 1.0).pow(3.05)) }, - { level -> mapOf(HotmReward.MINING_FORTUNE to 2.0 * level) }), + { level -> mapOf(HotmReward.MINING_FORTUNE to 2.0 * level) }, + ), KEEN_EYE("Keen Eye", 1, { null }, { emptyMap() }), MINESHAFT_MAYHEM("Mineshaft Mayhem", 1, { null }, { emptyMap() }), @@ -271,6 +372,7 @@ enum class HotmData( fun getReward() = rewardFun(activeLevel) + // TODO move all object functions into hotm api? @SkyHanniModule companion object { @@ -280,49 +382,62 @@ enum class HotmData( listOf(PICKOBULUS, MINING_SPEED_BOOST, VEIN_SEEKER, MANIAC_MINER, HAZARDOUS_MINER, GEMSTONE_INFUSION) private val inventoryPattern by patternGroup.pattern( - "inventory", "Heart of the Mountain" + "inventory", + "Heart of the Mountain", ) private val levelPattern by patternGroup.pattern( - "perk.level", "§(?<color>.)Level (?<level>\\d+).*" + "perk.level", + "§(?<color>.)Level (?<level>\\d+).*", ) private val notUnlockedPattern by patternGroup.pattern( - "perk.notunlocked", "(§.)*Requires.*|.*Mountain!|(§.)*Click to unlock!|" + "perk.notunlocked", + "(§.)*Requires.*|.*Mountain!|(§.)*Click to unlock!|", ) private val enabledPattern by patternGroup.pattern( - "perk.enable", "§a§lENABLED|(§.)*SELECTED" + "perk.enable", + "§a§lENABLED|(§.)*SELECTED", ) private val disabledPattern by patternGroup.pattern( - "perk.disabled", "§c§lDISABLED|§7§eClick to select!" - ) // unused for now since the assumption is when enabled isn't found it is disabled, but the value might be useful in the future or for debugging + "perk.disabled", + "§c§lDISABLED|§7§eClick to select!", + ) // unused for now since the assumption is when enabled isn't found it is disabled, + // but the value might be useful in the future or for debugging private val resetChatPattern by patternGroup.pattern( - "reset.chat", "§aReset your §r§5Heart of the Mountain§r§a! Your Perks and Abilities have been reset." + "reset.chat", + "§aReset your §r§5Heart of the Mountain§r§a! Your Perks and Abilities have been reset.", ) private val heartItemPattern by patternGroup.pattern( - "inventory.heart", "§5Heart of the Mountain" + "inventory.heart", + "§5Heart of the Mountain", ) private val resetItemPattern by patternGroup.pattern( - "inventory.reset", "§cReset Heart of the Mountain" + "inventory.reset", + "§cReset Heart of the Mountain", ) private val heartTokensPattern by patternGroup.pattern( - "inventory.heart.token", "§7Token of the Mountain: §5(?<token>\\d+)" + "inventory.heart.token", + "§7Token of the Mountain: §5(?<token>\\d+)", ) private val resetTokensPattern by patternGroup.pattern( - "inventory.reset.token", "\\s+§8- §5(?<token>\\d+) Token of the Mountain" + "inventory.reset.token", + "\\s+§8- §5(?<token>\\d+) Token of the Mountain", ) private val skymallPattern by patternGroup.pattern( - "skymall", "(?:§eNew buff§r§r§r: §r§f|§8 ■ §7)(?<perk>.*)" + "skymall", + "(?:§eNew buff§r§r§r: §r§f|§8 ■ §7)(?<perk>.*)", ) private val mayhemChatPattern by patternGroup.pattern( - "mayhem", "§b§lMAYHEM! §r§7(?<perk>.*)" + "mayhem", + "§b§lMAYHEM! §r§7(?<perk>.*)", ) var inInventory = false @@ -452,20 +567,23 @@ enum class HotmData( } private val skyMallCurrentEffect by patternGroup.pattern( - "skymall.current", "§aYour Current Effect" + "skymall.current", + "§aYour Current Effect", ) private fun handelSkyMall(lore: List<String>) { if (!SKY_MALL.enabled || !SKY_MALL.isUnlocked) HotmAPI.skymall = null else { - val index = (lore.indexOfFirstMatch(skyMallCurrentEffect) ?: run { - ErrorManager.logErrorStateWithData( - "Could not read the skymall effect from the hotm tree", - "skyMallCurrentEffect didn't match", - "lore" to lore - ) - return - }) + 1 + val index = ( + lore.indexOfFirstMatch(skyMallCurrentEffect) ?: run { + ErrorManager.logErrorStateWithData( + "Could not read the skymall effect from the hotm tree", + "skyMallCurrentEffect didn't match", + "lore" to lore, + ) + return + } + ) + 1 skymallPattern.matchMatcher(lore[index]) { val perk = group("perk") HotmAPI.skymall = SkymallPerk.entries.firstOrNull { it.itemPattern.matches(perk) } ?: run { @@ -473,7 +591,7 @@ enum class HotmData( "Could not read the skymall effect from the hotm tree", "no itemPattern matched", "lore" to lore, - "perk" to perk + "perk" to perk, ) null } @@ -531,7 +649,7 @@ enum class HotmData( "Could not read the skymall effect from chat", "no chatPattern matched", "chat" to event.message, - "perk" to perk + "perk" to perk, ) null } @@ -546,7 +664,7 @@ enum class HotmData( "Could not read the mayhem effect from chat", "no chatPattern matched", "chat" to event.message, - "perk" to perk + "perk" to perk, ) null } @@ -567,7 +685,8 @@ enum class HotmData( HotmAPI.Powder.entries.forEach { if (it.getStorage() == null) { ProfileStorageData.profileSpecific?.mining?.powder?.put( - it, ProfileSpecificStorage.MiningConfig.PowderStorage() + it, + ProfileSpecificStorage.MiningConfig.PowderStorage(), ) } } @@ -587,9 +706,11 @@ enum class HotmData( add("Mineshaft Mayhem: ${HotmAPI.mineshaftMayhem}") } event.title("HotM - Tree") - event.addIrrelevant(entries.filter { it.isUnlocked }.map { - "${if (it.enabled) "✔" else "✖"} ${it.printName}: ${it.activeLevel}" - }) + event.addIrrelevant( + entries.filter { it.isUnlocked }.map { + "${if (it.enabled) "✔" else "✖"} ${it.printName}: ${it.activeLevel}" + }, + ) } } } diff --git a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt index 06ed7f44f..0e2f9af32 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt @@ -39,7 +39,8 @@ class HypixelData { private val patternGroup = RepoPattern.group("data.hypixeldata") private val islandNamePattern by patternGroup.pattern( - "islandname", "(?:§.)*(Area|Dungeon): (?:§.)*(?<island>.*)" + "islandname", + "(?:§.)*(Area|Dungeon): (?:§.)*(?<island>.*)", ) private var lastLocRaw = SimpleTimeMark.farPast() @@ -47,41 +48,52 @@ class HypixelData { companion object { private val patternGroup = RepoPattern.group("data.hypixeldata") private val serverIdScoreboardPattern by patternGroup.pattern( - "serverid.scoreboard", "§7\\d+/\\d+/\\d+ §8(?<servertype>[mM])(?<serverid>\\S+).*" + "serverid.scoreboard", + "§7\\d+/\\d+/\\d+ §8(?<servertype>[mM])(?<serverid>\\S+).*", ) private val serverIdTablistPattern by patternGroup.pattern( - "serverid.tablist", " Server: §r§8(?<serverid>\\S+)" + "serverid.tablist", + " Server: §r§8(?<serverid>\\S+)", ) private val lobbyTypePattern by patternGroup.pattern( - "lobbytype", "(?<lobbyType>.*lobby)\\d+" + "lobbytype", + "(?<lobbyType>.*lobby)\\d+", ) private val playerAmountPattern by patternGroup.pattern( - "playeramount", "^\\s*(?:§.)+Players (?:§.)+\\((?<amount>\\d+)\\)\\s*$" + "playeramount", + "^\\s*(?:§.)+Players (?:§.)+\\((?<amount>\\d+)\\)\\s*$", ) private val playerAmountCoopPattern by patternGroup.pattern( - "playeramount.coop", "^\\s*(?:§.)*Coop (?:§.)*\\((?<amount>\\d+)\\)\\s*$" + "playeramount.coop", + "^\\s*(?:§.)*Coop (?:§.)*\\((?<amount>\\d+)\\)\\s*$", ) private val playerAmountGuestingPattern by patternGroup.pattern( - "playeramount.guesting", "^\\s*(?:§.)*Guests (?:§.)*\\((?<amount>\\d+)\\)\\s*$" + "playeramount.guesting", + "^\\s*(?:§.)*Guests (?:§.)*\\((?<amount>\\d+)\\)\\s*$", ) /** * REGEX-TEST: §r§b§lParty §r§f(4) */ private val dungeonPartyAmountPattern by patternGroup.pattern( - "playeramount.dungeonparty", "^\\s*(?:§.)+Party (?:§.)+\\((?<amount>\\d+)\\)\\s*$" + "playeramount.dungeonparty", + "^\\s*(?:§.)+Party (?:§.)+\\((?<amount>\\d+)\\)\\s*$", ) private val soloProfileAmountPattern by patternGroup.pattern( - "solo.profile.amount", "^\\s*(?:§.)*Island\\s*$" + "solo.profile.amount", + "^\\s*(?:§.)*Island\\s*$", ) private val scoreboardVisitingAmoutPattern by patternGroup.pattern( - "scoreboard.visiting.amount", "\\s+§.✌ §.\\(§.(?<currentamount>\\d+)§./(?<maxamount>\\d+)\\)" + "scoreboard.visiting.amount", + "\\s+§.✌ §.\\(§.(?<currentamount>\\d+)§./(?<maxamount>\\d+)\\)", ) private val guestPattern by patternGroup.pattern( - "guesting.scoreboard", "SKYBLOCK GUEST" + "guesting.scoreboard", + "SKYBLOCK GUEST", ) private val scoreboardTitlePattern by patternGroup.pattern( - "scoreboard.title", "SK[YI]BLOCK(?: CO-OP| GUEST)?" + "scoreboard.title", + "SK[YI]BLOCK(?: CO-OP| GUEST)?", ) /** @@ -89,7 +101,8 @@ class HypixelData { * REGEX-TEST: §5ф §dWizard Tower */ private val skyblockAreaPattern by patternGroup.pattern( - "skyblock.area", "\\s*§(?<symbol>7⏣|5ф) §(?<color>.)(?<area>.*)" + "skyblock.area", + "\\s*§(?<symbol>7⏣|5ф) §(?<color>.)(?<area>.*)", ) var hypixelLive = false @@ -116,7 +129,12 @@ class HypixelData { // Data from locraw var locrawData: JsonObject? = null private var locraw: MutableMap<String, String> = listOf( - "server", "gametype", "lobbyname", "lobbytype", "mode", "map" + "server", + "gametype", + "lobbyname", + "lobbytype", + "mode", + "map", ).associateWith { "" }.toMutableMap() val server get() = locraw["server"] ?: "" @@ -148,7 +166,7 @@ class HypixelData { "Could not find server id", "islandType" to LorenzUtils.skyBlockIsland, "tablist" to TabListData.getTabList(), - "scoreboard" to ScoreboardData.sidebarLinesFormatted + "scoreboard" to ScoreboardData.sidebarLinesFormatted, ) } @@ -280,8 +298,8 @@ class HypixelData { } } - @SubscribeEvent // TODO rewrite everything in here + @SubscribeEvent fun onTick(event: LorenzTickEvent) { if (!LorenzUtils.inSkyBlock) { // Modified from NEU. diff --git a/src/main/java/at/hannibal2/skyhanni/data/ItemAddManager.kt b/src/main/java/at/hannibal2/skyhanni/data/ItemAddManager.kt index fbac6d716..26658eee7 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/ItemAddManager.kt +++ b/src/main/java/at/hannibal2/skyhanni |
