aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2024-06-09 20:46:52 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2024-06-09 20:46:52 +0200
commitf052dda969869365afcb2f1fc89c899a56545feb (patch)
treef6344d8ef8691108cb3ae206bc761860d2c2c611 /src
parent1181b4a7bdb7cd46144d5550abcd56e2ba284b4d (diff)
downloadskyhanni-f052dda969869365afcb2f1fc89c899a56545feb.tar.gz
skyhanni-f052dda969869365afcb2f1fc89c899a56545feb.tar.bz2
skyhanni-f052dda969869365afcb2f1fc89c899a56545feb.zip
additional changes to editorconfig and random code cleanup
Diffstat (limited to 'src')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestones.kt16
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestonesCommunityFix.kt15
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/HotmData.kt389
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt50
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/ItemAddManager.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/MaxwellAPI.kt49
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/MayorAPI.kt39
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/bazaar/HypixelBazaarFetcher.kt9
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/jsonobjects/other/HypixelPlayerApiJson.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/SeaCreatureJson.kt3
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/data/ItemAddManager.kt
@@ -25,7 +25,6 @@ object ItemAddManager {
enum class Source {
ITEM_ADD,
SACKS,
- ;
}
private val ARCHFIEND_DICE = "ARCHFIEND_DICE".asInternalName()
@@ -33,7 +32,7 @@ object ItemAddManager {
private val diceRollChatPattern by RepoPattern.pattern(
"data.itemmanager.diceroll",
- "§eYour §r§(5|6High Class )Archfiend Dice §r§erolled a §r§.(?<number>.)§r§e! Bonus: §r§.(?<hearts>.*)❤"
+ "§eYour §r§(5|6High Class )Archfiend Dice §r§erolled a §r§.(?<number>.)§r§e! Bonus: §r§.(?<hearts>.*)❤",
)
private var inSackInventory = false
diff --git a/src/main/java/at/hannibal2/skyhanni/data/MaxwellAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/MaxwellAPI.kt
index 37d384528..56e3cdf42 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/MaxwellAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/MaxwellAPI.kt
@@ -62,67 +62,67 @@ object MaxwellAPI {
private val patternGroup = RepoPattern.group("data.maxwell")
private val chatPowerPattern by patternGroup.pattern(
"chat.power",
- "§eYou selected the §a(?<power>.*) §e(power )?for your §aAccessory Bag§e!"
+ "§eYou selected the §a(?<power>.*) §e(power )?for your §aAccessory Bag§e!",
)
private val chatPowerUnlockedPattern by patternGroup.pattern(
"chat.power.unlocked",
- "§eYour selected power was set to (?:§r)*§a(?<power>.*)(?:§r)*§e!"
+ "§eYour selected power was set to (?:§r)*§a(?<power>.*)(?:§r)*§e!",
)
private val inventoryPowerPattern by patternGroup.pattern(
"inventory.power",
- "§7Selected Power: §a(?<power>.*)"
+ "§7Selected Power: §a(?<power>.*)",
)
private val inventoryMPPattern by patternGroup.pattern(
"inventory.magicalpower",
- "§7Magical Power: §6(?<mp>[\\d,]+)"
+ "§7Magical Power: §6(?<mp>[\\d,]+)",
)
private val thaumaturgyGuiPattern by patternGroup.pattern(
"gui.thaumaturgy",
- "Accessory Bag Thaumaturgy"
+ "Accessory Bag Thaumaturgy",
)
private val thaumaturgyStartPattern by patternGroup.pattern(
"gui.thaumaturgy.start",
- "§7Your tuning:"
+ "§7Your tuning:",
)
private val thaumaturgyDataPattern by patternGroup.pattern(
"gui.thaumaturgy.data",
- "§(?<color>.)\\+(?<amount>[^ ]+)(?<icon>.) (?<name>.+)"
+ "§(?<color>.)\\+(?<amount>[^ ]+)(?<icon>.) (?<name>.+)",
)
private val thaumaturgyMagicalPowerPattern by patternGroup.pattern(
"gui.thaumaturgy.magicalpower",
- "§7Total: §6(?<mp>[\\d.,]+) Magical Power"
+ "§7Total: §6(?<mp>[\\d.,]+) Magical Power",
)
private val statsTuningGuiPattern by patternGroup.pattern(
"gui.thaumaturgy.statstuning",
- "Stats Tuning"
+ "Stats Tuning",
)
private val statsTuningDataPattern by patternGroup.pattern(
"thaumaturgy.statstuning",
- "§7You have: .+ §7\\+ §(?<color>.)(?<amount>[^ ]+) (?<icon>.)"
+ "§7You have: .+ §7\\+ §(?<color>.)(?<amount>[^ ]+) (?<icon>.)",
)
private val tuningAutoAssignedPattern by patternGroup.pattern(
"tuningpoints.chat.autoassigned",
- "§aYour §r§eTuning Points §r§awere auto-assigned as convenience!"
+ "§aYour §r§eTuning Points §r§awere auto-assigned as convenience!",
)
private val yourBagsGuiPattern by patternGroup.pattern(
"gui.yourbags",
- "Your Bags"
+ "Your Bags",
)
private val powerSelectedPattern by patternGroup.pattern(
"gui.selectedpower",
- "§aPower is selected!"
+ "§aPower is selected!",
)
private val noPowerSelectedPattern by patternGroup.pattern(
"gui.noselectedpower",
- "(?:§.)*Visit Maxwell in the Hub to learn"
+ "(?:§.)*Visit Maxwell in the Hub to learn",
)
private val accessoryBagStack by patternGroup.pattern(
"stack.accessorybag",
- "§.Accessory Bag"
+ "§.Accessory Bag",
)
private val redstoneCollectionRequirementPattern by patternGroup.pattern(
"collection.redstone.requirement",
- "(?:§.)*Requires (?:§.)*Redstone Collection I+(?:§.)*\\."
+ "(?:§.)*Requires (?:§.)*Redstone Collection I+(?:§.)*\\.",
)
fun isThaumaturgyInventory(inventoryName: String) = thaumaturgyGuiPattern.matches(inventoryName)
@@ -138,7 +138,9 @@ object MaxwellAPI {
if (tunings.isNullOrEmpty()) return
val tuningsInScoreboard = ScoreboardElement.TUNING in CustomScoreboard.config.scoreboardEntries
if (tuningsInScoreboard) {
- ChatUtils.chat("Talk to Maxwell and open the Tuning Page again to update the tuning data in scoreboard.")
+ ChatUtils.chat(
+ "Talk to Maxwell and open the Tuning Page again to update the tuning data in scoreboard.",
+ )
}
}
}
@@ -150,7 +152,7 @@ object MaxwellAPI {
UnknownMaxwellPower("Unknown power: $power"),
"Unknown power: $power",
"power" to power,
- "message" to message
+ "message" to message,
)
}
}
@@ -186,7 +188,7 @@ object MaxwellAPI {
} ?: ErrorManager.skyHanniError(
"found no name in thaumaturgy",
"stack name" to stack.name,
- "line" to line
+ "line" to line,
)
map.add(it)
}
@@ -218,7 +220,7 @@ object MaxwellAPI {
"Unknown power: $displayName",
"displayName" to displayName,
"lore" to selectedPowerStack.getLore(),
- noStackTrace = true
+ noStackTrace = true,
)
}
@@ -256,7 +258,10 @@ object MaxwellAPI {
var foundMagicalPower = false
for (line in stack.getLore()) {
redstoneCollectionRequirementPattern.matchMatcher(line) {
- ChatUtils.chat("Seems like you don't have the Requirement for the Accessory Bag yet, setting power to No Power and magical power to 0.")
+ ChatUtils.chat(
+ "Seems like you don't have the Requirement for the Accessory Bag yet, " +
+ "setting power to No Power and magical power to 0.",
+ )
currentPower = getPowerByNameOrNull("No Power")
magicalPower = 0
return
@@ -281,7 +286,7 @@ object MaxwellAPI {
"Unknown power: ${stack.displayName}",
"displayName" to stack.displayName,
"lore" to stack.getLore(),
- noStackTrace = true
+ noStackTrace = true,
)
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/data/MayorAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/MayorAPI.kt
index ebb23536d..0f9ab9157 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/MayorAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/MayorAPI.kt
@@ -49,7 +49,7 @@ object MayorAPI {
// TODO: Add Regex-test
val foxyExtraEventPattern by group.pattern(
"foxy.extraevent",
- "Schedules an extra §.(?<event>.*) §.event during the year\\."
+ "Schedules an extra §.(?<event>.*) §.event during the year\\.",
)
/**
@@ -57,7 +57,7 @@ object MayorAPI {
*/
private val electionOverPattern by group.pattern(
"election.over",
- "§eThe election room is now closed\\. Clerk Seraphine is doing a final count of the votes\\.\\.\\."
+ "§eThe election room is now closed\\. Clerk Seraphine is doing a final count of the votes\\.\\.\\.",
)
/**
@@ -65,7 +65,7 @@ object MayorAPI {
*/
private val calendarGuiPattern by group.pattern(
"calendar.gui",
- "Calendar and Events"
+ "Calendar and Events",
)
/**
@@ -73,7 +73,7 @@ object MayorAPI {
*/
private val jerryHeadPattern by group.pattern(
"jerry.head",
- "§dMayor Jerry"
+ "§dMayor Jerry",
)
/**
@@ -81,7 +81,7 @@ object MayorAPI {
*/
private val perkpocalypsePerksPattern by group.pattern(
"perkpocalypse",
- "§9Perkpocalypse Perks:"
+ "§9Perkpocalypse Perks:",
)
var currentMayor: Mayor? = null
@@ -128,16 +128,17 @@ object MayorAPI {
jerryExtraMayor = null to SimpleTimeMark.farPast()
ChatUtils.clickableChat(
"The Perkpocalypse Mayor has expired! Click here to update the new temporary Mayor.",
- onClick = { HypixelCommands.calendar() }
+ onClick = { HypixelCommands.calendar() },
)
}
- if (Mayor.JERRY.isActive() && jerryExtraMayor.first == null && SkyHanniMod.feature.misc.unknownPerkpocalypseMayorWarning) {
+ val misc = SkyHanniMod.feature.misc
+ if (Mayor.JERRY.isActive() && jerryExtraMayor.first == null && misc.unknownPerkpocalypseMayorWarning) {
if (lastJerryExtraMayorReminder.passedSince() < 5.minutes) return
if (ReminderUtils.isBusy()) return
lastJerryExtraMayorReminder = SimpleTimeMark.now()
ChatUtils.clickableChat(
"The Perkpocalypse Mayor is not known! Click here to update the temporary Mayor.",
- onClick = { HypixelCommands.calendar() }
+ onClick = { HypixelCommands.calendar() },
)
}
}
@@ -161,27 +162,25 @@ object MayorAPI {
val stack: ItemStack =
event.inventoryItems.values.firstOrNull { jerryHeadPattern.matches(it.displayName) } ?: return
- stack.getLore().nextAfter(
- { perkpocalypsePerksPattern.matches(it) }
- )?.let { perk ->
- // This is one Perk of the Perkpocalypse Mayor
- val jerryMayor = getMayorFromPerk(getPerkFromName(perk.removeColor()) ?: return)?.addAllPerks() ?: return
+ val perk = stack.getLore().nextAfter({ perkpocalypsePerksPattern.matches(it) }) ?: return
+ // This is one Perk of the Perkpocalypse Mayor
+ val jerryMayor = getMayorFromPerk(getPerkFromName(perk.removeColor()) ?: return)?.addAllPerks() ?: return
- val lastMayorTimestamp = nextMayorTimestamp - SKYBLOCK_YEAR_MILLIS.milliseconds
+ val lastMayorTimestamp = nextMayorTimestamp - SKYBLOCK_YEAR_MILLIS.milliseconds
- val expireTime = (1..21).map { lastMayorTimestamp + (6.hours * it) }.first { it.isInFuture() }
+ val expireTime = (1..21).map { lastMayorTimestamp + (6.hours * it) }.first { it.isInFuture() }
- ChatUtils.debug("Jerry Mayor found: ${jerryMayor.name} expiring at: ${expireTime.timeUntil()}")
+ ChatUtils.debug("Jerry Mayor found: ${jerryMayor.name} expiring at: ${expireTime.timeUntil()}")
- jerryExtraMayor = jerryMayor to expireTime
- }
+ jerryExtraMayor = jerryMayor to expireTime
}
private fun calculateNextMayorTime(): SimpleTimeMark {
- var mayorYear = SkyBlockTime.now().year
+ val now = SkyBlockTime.now()
+ var mayorYear = now.year
// Check if either the month is already over or the day after 27th in the third month
- if (SkyBlockTime.now().month > ELECTION_END_MONTH || (SkyBlockTime.now().day >= ELECTION_END_DAY && SkyBlockTime.now().month == ELECTION_END_MONTH)) {
+ if (now.month > ELECTION_END_MONTH || (now.day >= ELECTION_END_DAY && now.month == ELECTION_END_MONTH)) {
// If so, the next mayor will be in the next year
mayorYear++
}
diff --git a/src/main/java/at/hannibal2/skyhanni/data/bazaar/HypixelBazaarFetcher.kt b/src/main/java/at/hannibal2/skyhanni/data/bazaar/HypixelBazaarFetcher.kt
index 6573cdb75..dfbb08164 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/bazaar/HypixelBazaarFetcher.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/bazaar/HypixelBazaarFetcher.kt
@@ -63,7 +63,7 @@ object HypixelBazaarFetcher {
private fun process(products: Map<String, BazaarProduct>) = products.mapNotNull { (key, product) ->
val internalName = NEUItems.transHypixelNameToInternalName(key)
val sellOfferPrice = product.buySummary.minOfOrNull { it.pricePerUnit } ?: 0.0
- val insantBuyPrice = product.sellSummary.maxOfOrNull { it.pricePerUnit } ?: 0.0
+ val instantBuyPrice = product.sellSummary.maxOfOrNull { it.pricePerUnit } ?: 0.0
if (product.quickStatus.isEmpty()) {
return@mapNotNull null
@@ -72,11 +72,10 @@ object HypixelBazaarFetcher {
if (internalName.getItemStackOrNull() == null) {
// Items that exist in Hypixel's Bazaar API, but not in NEU repo (not visible in the ingame bazaar).
// Should only include Enchants
- if (LorenzUtils.debug)
- println("Unknown bazaar product: $key/$internalName")
+ if (LorenzUtils.debug) println("Unknown bazaar product: $key/$internalName")
return@mapNotNull null
}
- internalName to BazaarData(internalName.itemName, sellOfferPrice, insantBuyPrice, product)
+ internalName to BazaarData(internalName.itemName, sellOfferPrice, instantBuyPrice, product)
}.toMap()
private fun BazaarQuickStatus.isEmpty(): Boolean = with(this) {
@@ -104,7 +103,7 @@ object HypixelBazaarFetcher {
userMessage,
"fetchType" to fetchType,
"failedAttepmts" to failedAttempts,
- "rawResponse" to rawResponse
+ "rawResponse" to rawResponse,
)
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/other/HypixelPlayerApiJson.kt b/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/other/HypixelPlayerApiJson.kt
index ee1f11bfc..70a352910 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/other/HypixelPlayerApiJson.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/other/HypixelPlayerApiJson.kt
@@ -26,8 +26,7 @@ data class HypixelApiEasterEvent(
)
data class HypixelApiRabbits(
- @Expose @SerializedName("collected_locations")
- val collectedLocations: Map<String, List<String>>,
+ @Expose @SerializedName("collected_locations") val collectedLocations: Map<String, List<String>>,
)
data class HypixelApiTrophyFish(
diff --git a/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/SeaCreatureJson.kt b/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/SeaCreatureJson.kt
index e49ed4e44..c75efdac3 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/SeaCreatureJson.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/SeaCreatureJson.kt
@@ -11,8 +11,7 @@ data class SeaCreatureJson(
@Expose @SerializedName("sea_creatures") val seaCreatures: Map<String, SeaCreatureInfo>,
) {
companion object {
- val TYPE: Type = object : TypeToken<Map<String?, SeaCreatureJson>>() {
- }.type
+ val TYPE: Type = object : TypeToken<Map<String?, SeaCreatureJson>>() {}.type
}
}