diff options
author | Walker Selby <git@walkerselby.com> | 2023-11-29 23:43:02 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-30 00:43:02 +0100 |
commit | 247d4d324dc9ce5960d8c94719707d232a89e3ad (patch) | |
tree | cbf6942c5875ed8fd8c24c54435aba5a514ce1b1 /src/main/java/at/hannibal2/skyhanni/features | |
parent | ed02a14a6d688ec9546d9ed06dddf412620bb246 (diff) | |
download | skyhanni-247d4d324dc9ce5960d8c94719707d232a89e3ad.tar.gz skyhanni-247d4d324dc9ce5960d8c94719707d232a89e3ad.tar.bz2 skyhanni-247d4d324dc9ce5960d8c94719707d232a89e3ad.zip |
Migrate Integer to Enums in Config #727
Co-authored-by: hannibal2 <24389977+hannibal002@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
19 files changed, 297 insertions, 166 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/BossType.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/BossType.kt index c80ae6d3d..045eaaa78 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/BossType.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/BossType.kt @@ -1,105 +1,109 @@ package at.hannibal2.skyhanni.features.combat.damageindicator +import at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.DamageIndicatorBossEntry + +typealias Type = DamageIndicatorBossEntry + enum class BossType( val fullName: String, - val bossTypeToggle: Int, + val bossTypeToggle: Type, val shortName: String = fullName, val showDeathTime: Boolean = false ) { - GENERIC_DUNGEON_BOSS("Generic Dungeon boss", 0),//TODO split into different bosses + GENERIC_DUNGEON_BOSS("Generic Dungeon boss", Type.DUNGEON_ALL),//TODO split into different bosses //Nether Mini Bosses - NETHER_BLADESOUL("§8Bladesoul", 1), - NETHER_MAGMA_BOSS("§4Magma Boss", 1), - NETHER_ASHFANG("§cAshfang", 1), - NETHER_BARBARIAN_DUKE("§eBarbarian Duke", 1), - NETHER_MAGE_OUTLAW("§5Mage Outlaw", 1), - - NETHER_VANQUISHER("§5Vanquisher", 2), - - END_ENDSTONE_PROTECTOR("§cEndstone Protector", 3), - END_ENDER_DRAGON("Ender Dragon", 4),//TODO fix totally - - SLAYER_ZOMBIE_1("§aRevenant Horror 1", 5, "§aRev 1", showDeathTime = true), - SLAYER_ZOMBIE_2("§eRevenant Horror 2", 5, "§eRev 2", showDeathTime = true), - SLAYER_ZOMBIE_3("§cRevenant Horror 3", 5, "§cRev 3", showDeathTime = true), - SLAYER_ZOMBIE_4("§4Revenant Horror 4", 5, "§4Rev 4", showDeathTime = true), - SLAYER_ZOMBIE_5("§5Revenant Horror 5", 5, "§5Rev 5", showDeathTime = true), - - SLAYER_SPIDER_1("§aTarantula Broodfather 1", 6, "§aTara 1", showDeathTime = true), - SLAYER_SPIDER_2("§eTarantula Broodfather 2", 6, "§eTara 2", showDeathTime = true), - SLAYER_SPIDER_3("§cTarantula Broodfather 3", 6, "§cTara 3", showDeathTime = true), - SLAYER_SPIDER_4("§4Tarantula Broodfather 4", 6, "§4Tara 4", showDeathTime = true), - - SLAYER_WOLF_1("§aSven Packmaster 1", 7, "§aSven 1", showDeathTime = true), - SLAYER_WOLF_2("§eSven Packmaster 2", 7, "§eSven 2", showDeathTime = true), - SLAYER_WOLF_3("§cSven Packmaster 3", 7, "§cSven 3", showDeathTime = true), - SLAYER_WOLF_4("§4Sven Packmaster 4", 7, "§4Sven 4", showDeathTime = true), - - SLAYER_ENDERMAN_1("§aVoidgloom Seraph 1", 8, "§aVoid 1", showDeathTime = true), - SLAYER_ENDERMAN_2("§eVoidgloom Seraph 2", 8, "§eVoid 2", showDeathTime = true), - SLAYER_ENDERMAN_3("§cVoidgloom Seraph 3", 8, "§cVoid 3", showDeathTime = true), - SLAYER_ENDERMAN_4("§4Voidgloom Seraph 4", 8, "§4Void 4", showDeathTime = true), - - SLAYER_BLAZE_1("§aInferno Demonlord 1", 9, "§aInferno 1", showDeathTime = true), - SLAYER_BLAZE_2("§aInferno Demonlord 2", 9, "§aInferno 2", showDeathTime = true), - SLAYER_BLAZE_3("§aInferno Demonlord 3", 9, "§aInferno 3", showDeathTime = true), - SLAYER_BLAZE_4("§aInferno Demonlord 4", 9, "§aInferno 4", showDeathTime = true), - - SLAYER_BLAZE_TYPHOEUS_1("§aInferno Typhoeus 1", 9, "§aTyphoeus 1"), - SLAYER_BLAZE_TYPHOEUS_2("§eInferno Typhoeus 2", 9, "§eTyphoeus 2"), - SLAYER_BLAZE_TYPHOEUS_3("§cInferno Typhoeus 3", 9, "§cTyphoeus 3"), - SLAYER_BLAZE_TYPHOEUS_4("§cInferno Typhoeus 4", 9, "§cTyphoeus 4"), - - SLAYER_BLAZE_QUAZII_1("§aInferno Quazii 1", 9, "§aQuazii 1"), - SLAYER_BLAZE_QUAZII_2("§eInferno Quazii 2", 9, "§eQuazii 2"), - SLAYER_BLAZE_QUAZII_3("§cInferno Quazii 3", 9, "§cQuazii 3"), - SLAYER_BLAZE_QUAZII_4("§cInferno Quazii 4", 9, "§cQuazii 4"), - - SLAYER_BLOODFIEND_1("§aRiftstalker Bloodfiend 1", 23, "§aBlood 1", showDeathTime = true), - SLAYER_BLOODFIEND_2("§6Riftstalker Bloodfiend 2", 23, "§6Blood 2", showDeathTime = true), - SLAYER_BLOODFIEND_3("§cRiftstalker Bloodfiend 3", 23, "§cBlood 3", showDeathTime = true), - SLAYER_BLOODFIEND_4("§4Riftstalker Bloodfiend 4", 23, "§4Blood 4", showDeathTime = true), - SLAYER_BLOODFIEND_5("§5Riftstalker Bloodfiend 5", 23, "§5Blood 5", showDeathTime = true), - - HUB_HEADLESS_HORSEMAN("§6Headless Horseman", 10), - - DUNGEON_F1("", 11), - DUNGEON_F2("", 12), - DUNGEON_F3("", 13), - DUNGEON_F4_THORN("§cThorn", 14), - DUNGEON_F5("§dLivid", 15), - DUNGEON_F("", 16), - DUNGEON_75("", 17), - - MINOS_INQUISITOR("§5Minos Inquisitor", 18), - MINOS_CHAMPION("§2Minos Champion", 18), - GAIA_CONSTURUCT("§2Gaia Construct", 18), - MINOTAUR("§2Minotaur", 18), - - THUNDER("§cThunder", 19), - LORD_JAWBUS("§cLord Jawbus", 19), - - DUMMY("Dummy", 20), - ARACHNE_SMALL("§cSmall Arachne", 21), - ARACHNE_BIG("§4Big Arachne", 21), + NETHER_BLADESOUL("§8Bladesoul", Type.NETHER_MINI_BOSSES), + NETHER_MAGMA_BOSS("§4Magma Boss", Type.NETHER_MINI_BOSSES), + NETHER_ASHFANG("§cAshfang", Type.NETHER_MINI_BOSSES), + NETHER_BARBARIAN_DUKE("§eBarbarian Duke", Type.NETHER_MINI_BOSSES), + NETHER_MAGE_OUTLAW("§5Mage Outlaw", Type.NETHER_MINI_BOSSES), + + NETHER_VANQUISHER("§5Vanquisher", Type.VANQUISHER), + + END_ENDSTONE_PROTECTOR("§cEndstone Protector", Type.ENDERSTONE_PROTECTOR), + END_ENDER_DRAGON("Ender Dragon", Type.ENDER_DRAGON),//TODO fix totally + + SLAYER_ZOMBIE_1("§aRevenant Horror 1", Type.REVENANT_HORROR, "§aRev 1", showDeathTime = true), + SLAYER_ZOMBIE_2("§eRevenant Horror 2", Type.REVENANT_HORROR, "§eRev 2", showDeathTime = true), + SLAYER_ZOMBIE_3("§cRevenant Horror 3", Type.REVENANT_HORROR, "§cRev 3", showDeathTime = true), + SLAYER_ZOMBIE_4("§4Revenant Horror 4", Type.REVENANT_HORROR, "§4Rev 4", showDeathTime = true), + SLAYER_ZOMBIE_5("§5Revenant Horror 5", Type.REVENANT_HORROR, "§5Rev 5", showDeathTime = true), + + SLAYER_SPIDER_1("§aTarantula Broodfather 1", Type.TARANTULA_BROODFATHER, "§aTara 1", showDeathTime = true), + SLAYER_SPIDER_2("§eTarantula Broodfather 2", Type.TARANTULA_BROODFATHER, "§eTara 2", showDeathTime = true), + SLAYER_SPIDER_3("§cTarantula Broodfather 3", Type.TARANTULA_BROODFATHER, "§cTara 3", showDeathTime = true), + SLAYER_SPIDER_4("§4Tarantula Broodfather 4", Type.TARANTULA_BROODFATHER, "§4Tara 4", showDeathTime = true), + + SLAYER_WOLF_1("§aSven Packmaster 1", Type.SVEN_PACKMASTER, "§aSven 1", showDeathTime = true), + SLAYER_WOLF_2("§eSven Packmaster 2", Type.SVEN_PACKMASTER, "§eSven 2", showDeathTime = true), + SLAYER_WOLF_3("§cSven Packmaster 3", Type.SVEN_PACKMASTER, "§cSven 3", showDeathTime = true), + SLAYER_WOLF_4("§4Sven Packmaster 4", Type.SVEN_PACKMASTER, "§4Sven 4", showDeathTime = true), + + SLAYER_ENDERMAN_1("§aVoidgloom Seraph 1", Type.VOIDGLOOM_SERAPH, "§aVoid 1", showDeathTime = true), + SLAYER_ENDERMAN_2("§eVoidgloom Seraph 2", Type.VOIDGLOOM_SERAPH, "§eVoid 2", showDeathTime = true), + SLAYER_ENDERMAN_3("§cVoidgloom Seraph 3", Type.VOIDGLOOM_SERAPH, "§cVoid 3", showDeathTime = true), + SLAYER_ENDERMAN_4("§4Voidgloom Seraph 4", Type.VOIDGLOOM_SERAPH, "§4Void 4", showDeathTime = true), + + SLAYER_BLAZE_1("§aInferno Demonlord 1", Type.INFERNO_DEMONLORD, "§aInferno 1", showDeathTime = true), + SLAYER_BLAZE_2("§aInferno Demonlord 2", Type.INFERNO_DEMONLORD, "§aInferno 2", showDeathTime = true), + SLAYER_BLAZE_3("§aInferno Demonlord 3", Type.INFERNO_DEMONLORD, "§aInferno 3", showDeathTime = true), + SLAYER_BLAZE_4("§aInferno Demonlord 4", Type.INFERNO_DEMONLORD, "§aInferno 4", showDeathTime = true), + + SLAYER_BLAZE_TYPHOEUS_1("§aInferno Typhoeus 1", Type.INFERNO_DEMONLORD, "§aTyphoeus 1"), + SLAYER_BLAZE_TYPHOEUS_2("§eInferno Typhoeus 2", Type.INFERNO_DEMONLORD, "§eTyphoeus 2"), + SLAYER_BLAZE_TYPHOEUS_3("§cInferno Typhoeus 3", Type.INFERNO_DEMONLORD, "§cTyphoeus 3"), + SLAYER_BLAZE_TYPHOEUS_4("§cInferno Typhoeus 4", Type.INFERNO_DEMONLORD, "§cTyphoeus 4"), + + SLAYER_BLAZE_QUAZII_1("§aInferno Quazii 1", Type.INFERNO_DEMONLORD, "§aQuazii 1"), + SLAYER_BLAZE_QUAZII_2("§eInferno Quazii 2", Type.INFERNO_DEMONLORD, "§eQuazii 2"), + SLAYER_BLAZE_QUAZII_3("§cInferno Quazii 3", Type.INFERNO_DEMONLORD, "§cQuazii 3"), + SLAYER_BLAZE_QUAZII_4("§cInferno Quazii 4", Type.INFERNO_DEMONLORD, "§cQuazii 4"), + + SLAYER_BLOODFIEND_1("§aRiftstalker Bloodfiend 1", Type.RIFTSTALKER_BLOODFIEND, "§aBlood 1", showDeathTime = true), + SLAYER_BLOODFIEND_2("§6Riftstalker Bloodfiend 2", Type.RIFTSTALKER_BLOODFIEND, "§6Blood 2", showDeathTime = true), + SLAYER_BLOODFIEND_3("§cRiftstalker Bloodfiend 3", Type.RIFTSTALKER_BLOODFIEND, "§cBlood 3", showDeathTime = true), + SLAYER_BLOODFIEND_4("§4Riftstalker Bloodfiend 4", Type.RIFTSTALKER_BLOODFIEND, "§4Blood 4", showDeathTime = true), + SLAYER_BLOODFIEND_5("§5Riftstalker Bloodfiend 5", Type.RIFTSTALKER_BLOODFIEND, "§5Blood 5", showDeathTime = true), + + HUB_HEADLESS_HORSEMAN("§6Headless Horseman", Type.HEADLESS_HORSEMAN), + + DUNGEON_F1("", Type.DUNGEON_FLOOR_1), + DUNGEON_F2("", Type.DUNGEON_FLOOR_2), + DUNGEON_F3("", Type.DUNGEON_FLOOR_3), + DUNGEON_F4_THORN("§cThorn", Type.DUNGEON_FLOOR_4), + DUNGEON_F5("§dLivid", Type.DUNGEON_FLOOR_5), + DUNGEON_F("", Type.DUNGEON_FLOOR_6), + DUNGEON_75("", Type.DUNGEON_FLOOR_7), + + MINOS_INQUISITOR("§5Minos Inquisitor", Type.DIANA_MOBS), + MINOS_CHAMPION("§2Minos Champion", Type.DIANA_MOBS), + GAIA_CONSTURUCT("§2Gaia Construct", Type.DIANA_MOBS), + MINOTAUR("§2Minotaur", Type.DIANA_MOBS), + + THUNDER("§cThunder", Type.SEA_CREATURES), + LORD_JAWBUS("§cLord Jawbus", Type.SEA_CREATURES), + + DUMMY("Dummy", Type.DUMMY), + ARACHNE_SMALL("§cSmall Arachne", Type.ARACHNE), + ARACHNE_BIG("§4Big Arachne", Type.ARACHNE), // The Rift - LEECH_SUPREME("§cLeech Supreme", 22), - BACTE("§aBacte", 22), - - WINTER_REINDRAKE("Reindrake", 24),//TODO fix totally - - GARDEN_PEST_BEETLE("§cBeetle", 25), - GARDEN_PEST_CRICKET("§cCricket", 25), - GARDEN_PEST_FLY("§cFly", 25), - GARDEN_PEST_LOCUST("§cLocust", 25), - GARDEN_PEST_MITE("§cMite", 25), - GARDEN_PEST_MOSQUITO("§cMosquito", 25), - GARDEN_PEST_MOTH("§cMoth", 25), - GARDEN_PEST_RAT("§cRat", 25), - GARDEN_PEST_SLUG("§cSlug", 25), - GARDEN_PEST_EARTHWORM("§cEarthworm", 25), + LEECH_SUPREME("§cLeech Supreme", Type.THE_RIFT_BOSSES), + BACTE("§aBacte", Type.THE_RIFT_BOSSES), + + WINTER_REINDRAKE("Reindrake", Type.REINDRAKE),//TODO fix totally + + GARDEN_PEST_BEETLE("§cBeetle", Type.GARDEN_PESTS), + GARDEN_PEST_CRICKET("§cCricket", Type.GARDEN_PESTS), + GARDEN_PEST_FLY("§cFly", Type.GARDEN_PESTS), + GARDEN_PEST_LOCUST("§cLocust", Type.GARDEN_PESTS), + GARDEN_PEST_MITE("§cMite", Type.GARDEN_PESTS), + GARDEN_PEST_MOSQUITO("§cMosquito", Type.GARDEN_PESTS), + GARDEN_PEST_MOTH("§cMoth", Type.GARDEN_PESTS), + GARDEN_PEST_RAT("§cRat", Type.GARDEN_PESTS), + GARDEN_PEST_SLUG("§cSlug", Type.GARDEN_PESTS), + GARDEN_PEST_EARTHWORM("§cEarthworm", Type.GARDEN_PESTS), //TODO arachne diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt index da682d17a..6bc0ac05c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.combat.damageindicator import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.DamageIndicatorBossEntry import at.hannibal2.skyhanni.data.ScoreboardData import at.hannibal2.skyhanni.events.BossHealthChangeEvent import at.hannibal2.skyhanni.events.DamageIndicatorDeathEvent @@ -16,6 +17,7 @@ import at.hannibal2.skyhanni.features.dungeon.DungeonAPI import at.hannibal2.skyhanni.features.slayer.blaze.HellionShield import at.hannibal2.skyhanni.features.slayer.blaze.setHellionShield import at.hannibal2.skyhanni.test.command.ErrorManager +import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.EntityUtils.canBeSeen import at.hannibal2.skyhanni.utils.EntityUtils.getNameTagWith @@ -870,6 +872,9 @@ class DamageIndicatorManager { event.move(2, "damageIndicator", "combat.damageIndicator") event.move(3, "slayer.endermanPhaseDisplay", "slayer.endermen.phaseDisplay") event.move(3, "slayer.blazePhaseDisplay", "slayer.blazes.phaseDisplay") + event.move(11, "slayer.blazes.bossesToShow", "slayer.blazes.bossesToShow") { element -> + ConfigUtils.migrateIntArrayListToEnumArrayList(element, DamageIndicatorBossEntry::class.java) + } } fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/endernodetracker/EnderNodeTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/endernodetracker/EnderNodeTracker.kt index b65021067..ada0e4029 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/endernodetracker/EnderNodeTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/endernodetracker/EnderNodeTracker.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.combat.endernodetracker import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.config.features.combat.EnderNodeConfig.EnderNodeDisplayEntry import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.data.ProfileStorageData import at.hannibal2.skyhanni.events.ConfigLoadEvent @@ -10,6 +11,7 @@ import at.hannibal2.skyhanni.events.IslandChangeEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.OwnInventoryItemUpdateEvent import at.hannibal2.skyhanni.events.SackChangeEvent +import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalNameOrNull import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList @@ -161,6 +163,9 @@ object EnderNodeTracker { @SubscribeEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(2, "misc.enderNodeTracker", "combat.enderNodeTracker") + event.move(11, "combat.enderNodeTracker.textFormat", "combat.enderNodeTracker.textFormat") { element -> + ConfigUtils.migrateIntArrayListToEnumArrayList(element, EnderNodeDisplayEntry::class.java) + } } private fun calculateProfit(storage: Data): Map<EnderNode, Double> { @@ -245,7 +250,8 @@ object EnderNodeTracker { val newList = mutableListOf<List<Any>>() for (index in config.textFormat.get()) { - newList.add(map[index]) + // TODO, change functionality to use enum rather than ordinals + newList.add(map[index.ordinal]) } return newList } diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostCounter.kt index 56e70437c..eb9b68643 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostCounter.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.combat.ghostcounter import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.config.features.combat.ghostcounter.GhostCounterConfig.GhostDisplayEntry import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.data.ProfileStorageData import at.hannibal2.skyhanni.data.SkillExperience @@ -34,6 +35,7 @@ import at.hannibal2.skyhanni.utils.CombatUtils.lastKillUpdate import at.hannibal2.skyhanni.utils.CombatUtils.lastUpdate import at.hannibal2.skyhanni.utils.CombatUtils.xpGainHour import at.hannibal2.skyhanni.utils.CombatUtils.xpGainHourLast +import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList @@ -111,7 +113,8 @@ object GhostCounter { private fun formatDisplay(map: List<List<Any>>): List<List<Any>> { val newList = mutableListOf<List<Any>>() for (index in config.ghostDisplayText) { - newList.add(map[index]) + // TODO, change functionality to use enum rather than ordinals + newList.add(map[index.ordinal]) } return newList } @@ -488,6 +491,9 @@ object GhostCounter { @SubscribeEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(2, "ghostCounter", "combat.ghostCounter") + event.move(11, "combat.ghostCounter.ghostDisplayText", "combat.ghostCounter.ghostDisplayText") { element -> + ConfigUtils.migrateIntArrayListToEnumArrayList(element, GhostDisplayEntry::class.java) + } } fun isEnabled() = config.enabled && IslandType.DWARVEN_MINES.isInIsland() diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostFormatting.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostFormatting.kt index 70f64de29..183753e51 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostFormatting.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostFormatting.kt @@ -138,7 +138,7 @@ object GhostFormatting { fun reset() { with(GhostCounter.config.textFormatting) { titleFormat = "&6Ghost Counter" - ghostKilledFormat = " &6Ghost Killed: &b%value% &7(%session%)" + ghostKilledFormat = " &6Ghosts Killed: &b%value% &7(%session%)" sorrowsFormat = " &6Sorrow: &b%value% &7(%session%)" ghostSinceSorrowFormat = " &6Ghost since Sorrow: &b%value%" ghostKillPerSorrowFormat = " &6Ghosts/Sorrow: &b%value%" @@ -179,4 +179,4 @@ object GhostFormatting { moneyMadeFormat = " &6Money made: &b%value%" } } -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/jerry/frozentreasure/FrozenTreasureTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/event/jerry/frozentreasure/FrozenTreasureTracker.kt index bfae2a7d8..63ec4fbf2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/jerry/frozentreasure/FrozenTreasureTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/jerry/frozentreasure/FrozenTreasureTracker.kt @@ -2,12 +2,14 @@ package at.hannibal2.skyhanni.features.event.jerry.frozentreasure import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.config.features.event.winter.FrozenTreasureConfig.FrozenTreasureDisplayEntry import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.data.ProfileStorageData import at.hannibal2.skyhanni.data.ScoreboardData import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent +import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.LorenzUtils.addOrPut import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland @@ -96,7 +98,8 @@ object FrozenTreasureTracker { private fun formatDisplay(map: List<List<Any>>): List<List<Any>> { val newList = mutableListOf<List<Any>>() for (index in config.textFormat) { - newList.add(map[index]) + // TODO, change functionality to use enum rather than ordinals + newList.add(map[index.ordinal]) } return newList } @@ -168,6 +171,13 @@ object FrozenTreasureTracker { @SubscribeEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(2, "misc.frozenTreasureTracker", "event.winter.frozenTreasureTracker") + event.move( + 11, + "event.winter.frozenTreasureTracker.textFormat", + "event.winter.frozenTreasureTracker.textFormat" + ) { element -> + ConfigUtils.migrateIntArrayListToEnumArrayList(element, FrozenTreasureDisplayEntry::class.java) + } } private fun onJerryWorkshop() = IslandType.WINTER.isInIsland() diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt index 461b2d698..147882837 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.garden.farming import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.config.features.garden.MoneyPerHourConfig.CustomFormatEntry import at.hannibal2.skyhanni.events.GardenToolChangeEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzTickEvent @@ -235,6 +236,7 @@ object CropMoneyDisplay { return if (config.hideTitle) newDisplay.drop(1) else newDisplay } + // TODO : Rewrite to not be index-reliant private fun fullTitle(title: String): String { val titleText: String val nameList = mutableListOf<String>() @@ -246,7 +248,8 @@ object CropMoneyDisplay { ) val list = mutableListOf<String>() for (index in config.customFormat) { - map[index]?.let { + // TODO, change functionality to use enum rather than ordinals + map[index.ordinal]?.let { list.add(it) } } @@ -276,8 +279,7 @@ object CropMoneyDisplay { val onlyNpcPrice = (!config.useCustomFormat && LorenzUtils.noTradeMode) || - (config.useCustomFormat && config.customFormat.size == 1 && - config.customFormat[0] == 2) + (config.useCustomFormat && config.customFormat.singleOrNull() == CustomFormatEntry.NPC_PRICE) for ((internalName, amount) in multipliers.moveEntryToTop { isSeeds(it.key) }) { val crop = cropNames[internalName]!! @@ -364,6 +366,7 @@ object CropMoneyDisplay { private fun isSeeds(internalName: NEUInternalName) = internalName.equals("ENCHANTED_SEEDS") || internalName.equals("SEEDS") + // TODO : Rewrite to not be index-reliant private fun formatNumbers(sellOffer: Double, instantSell: Double, npcPrice: Double): Array<Double> { return if (config.useCustomFormat) { val map = mapOf( @@ -373,7 +376,8 @@ object CropMoneyDisplay { ) val newList = mutableListOf<Double>() for (index in config.customFormat) { - map[index]?.let { + // TODO, change functionality to use enum rather than ordinals + map[index.ordinal]?.let { newList.add(it) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenBestCropTime.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenBestCropTime.kt index 15dd12dc0..6190bc27b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenBestCropTime.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenBestCropTime.kt @@ -95,7 +95,8 @@ class GardenBestCropTime { for (crop in sorted.keys) { if (crop.isMaxed()) continue val millis = timeTillNextCrop[crop]!! - val biggestUnit = TimeUnit.entries[config.highestTimeFormat.get()] + // TODO, change functionality to use enum rather than ordinals + val biggestUnit = TimeUnit.entries[config.highestTimeFormat.get().ordinal] val duration = TimeUtils.formatDuration(millis, biggestUnit, maxUnits = 2) val isCurrent = crop == currentCrop number++ diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt index b290672af..6c3bedbf8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt @@ -1,6 +1,9 @@ package at.hannibal2.skyhanni.features.garden.farming import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.config.features.garden.cropmilestones.CropMilestonesConfig.MilestoneTextEntry +import at.hannibal2.skyhanni.config.features.garden.cropmilestones.CropMilestonesConfig.TimeFormatEntry +import at.hannibal2.skyhanni.config.features.garden.cropmilestones.MushroomPetPerkConfig.MushroomTextEntry import at.hannibal2.skyhanni.data.GardenCropMilestones import at.hannibal2.skyhanni.data.GardenCropMilestones.getCounter import at.hannibal2.skyhanni.data.GardenCropMilestones.isMaxed @@ -17,6 +20,7 @@ import at.hannibal2.skyhanni.features.garden.GardenAPI.addCropIcon import at.hannibal2.skyhanni.features.garden.GardenAPI.getCropType import at.hannibal2.skyhanni.features.garden.farming.GardenCropSpeed.setSpeed import at.hannibal2.skyhanni.test.command.ErrorManager +import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.LorenzUtils.round @@ -175,7 +179,8 @@ object GardenCropMilestoneDisplay { val missingTimeSeconds = missing / farmingFortuneSpeed val millis = missingTimeSeconds * 1000 GardenBestCropTime.timeTillNextCrop[crop] = millis - val biggestUnit = TimeUnit.entries[config.highestTimeFormat.get()] + // TODO, change functionality to use enum rather than ordinals + val biggestUnit = TimeUnit.entries[config.highestTimeFormat.get().ordinal] val duration = TimeUtils.formatDuration(millis, biggestUnit) tryWarn(millis, "§b${crop.cropName} $nextTier in $duration") val speedText = "§7In §b$duration" @@ -224,7 +229,8 @@ object GardenCropMilestoneDisplay { private fun formatDisplay(lineMap: HashMap<Int, List<Any>>): MutableList<List<Any>> { val newList = mutableListOf<List<Any>>() for (index in config.text) { - lineMap[index]?.let { + // TODO, change functionality to use enum rather than ordinals + lineMap[index.ordinal]?.let { newList.add(it) } } @@ -269,7 +275,8 @@ object GardenCropMilestoneDisplay { val missingTimeSeconds = missing / blocksPerSecond val millis = missingTimeSeconds * 1000 - val biggestUnit = TimeUnit.entries[config.highestTimeFormat.get()] + // TODO, change functionality to use enum rather than ordinals + val biggestUnit = TimeUnit.entries[config.highestTimeFormat.get().ordinal] val duration = TimeUtils.formatDuration(millis.toLong(), biggestUnit) lineMap[3] = Collections.singletonList("§7In §b$duration") } @@ -279,7 +286,8 @@ object GardenCropMilestoneDisplay { val newList = mutableListOf<List<Any>>() for (index in config.mushroomPetPerk.text) { - lineMap[index]?.let { + // TODO, change functionality to use enum rather than ordinals + lineMap[index.ordinal]?.let { newList.add(it) } } @@ -303,5 +311,26 @@ object GardenCropMilestoneDisplay { event.move(3, "garden.cropMilestoneMushroomPetPerkEnabled", "garden.cropMilestones.mushroomPetPerk.enabled") event.move(3, "garden.cropMilestoneMushroomPetPerkText", "garden.cropMilestones.mushroomPetPerk.text") event.move(3, "garden.cropMilestoneMushroomPetPerkPos", "garden.cropMilestones.mushroomPetPerk.pos") + event.move( + 11, + "garden.cropMilestones.highestTimeFormat", + "garden.cropMilestones.highestTimeFormat" + ) { element -> + ConfigUtils.migrateIntToEnum(element, TimeFormatEntry::class.java) + } + event.move( + 11, + "garden.cropMilestones.text", + "garden.cropMilestones.text" + ) { element -> + ConfigUtils.migrateIntArrayListToEnumArrayList(element, MilestoneTextEntry::class.java) + } + event.move( + 11, + "garden.cropMilestones.mushroomPetPerk.text", + "garden.cropMilestones.mushroomPetPerk.text" + ) { element -> + ConfigUtils.migrateIntArrayListToEnumArrayList(element, MushroomTextEntry::class.java) + } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt index 4625f3b47..00eb4aaab 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.garden.visitor import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.config.Storage +import at.hannibal2.skyhanni.config.features.garden.visitor.DropsStatisticsConfig.DropsStatisticsTextEntry import at.hannibal2.skyhanni.data.ProfileStorageData import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.GuiRenderEvent @@ -10,6 +11,7 @@ import at.hannibal2.skyhanni.events.PreProfileSwitchEvent import at.hannibal2.skyhanni.events.garden.visitor.VisitorAcceptEvent import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.test.command.ErrorManager +import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.LorenzUtils.addOrPut @@ -45,7 +47,8 @@ object GardenVisitorDropStatistics { private fun formatDisplay(map: List<List<Any>>): List<List<Any>> { val newList = mutableListOf<List<Any>>() for (index in config.textFormat) { - newList.add(map[index]) + // TODO, change functionality to use enum rather than ordinals + newList.add(map[index.ordinal]) } return newList } @@ -118,6 +121,7 @@ object GardenVisitorDropStatistics { val currentRarity = LorenzUtils.enumValueOf<VisitorRarity>(rarity) val visitorRarities = GardenAPI.storage?.visitorDrops?.visitorRarities ?: return fixRaritiesSize(visitorRarities) + // TODO, change functionality to use enum rather than ordinals val temp = visitorRarities[currentRarity.ordinal] + 1 visitorRarities[currentRarity.ordinal] = temp saveAndUpdate() @@ -253,6 +257,10 @@ object GardenVisitorDropStatistics { event.move(3, "${originalPrefix}displayIcons", "${newPrefix}displayIcons") event.move(3, "${originalPrefix}onlyOnBarn", "${newPrefix}onlyOnBarn") event.move(3, "${originalPrefix}visitorDropPos", "${newPrefix}pos") + + event.move(11, "${newPrefix}textFormat", "${newPrefix}textFormat") { element -> + ConfigUtils.migrateIntArrayListToEnumArrayList(element, DropsStatisticsTextEntry::class.java) + } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt index 60b1d041d..fcde7ca24 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.garden.visitor import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.config.features.garden.visitor.RewardWarningConfig.ItemWarnEntry import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzChatEvent @@ -20,6 +21,7 @@ import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.features.garden.farming.GardenCropSpeed.getSpeed import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper import at.hannibal2.skyhanni.test.command.ErrorManager +import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemBlink @@ -607,6 +609,9 @@ class GardenVisitorFeatures { event.move(3, "garden.visitorColoredName", "garden.visitors.coloredName") event.move(3, "garden.visitorHypixelArrivedMessage", "garden.visitors.hypixelArrivedMessage") event.move(3, "garden.visitorHideChat", "garden.visitors.hideChat") + event.move(11, "garden.visitors.rewardWarning.drops", "garden.visitors.rewardWarning.drops") { element -> + ConfigUtils.migrateIntArrayListToEnumArrayList(element, ItemWarnEntry::class.java) + } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorAPI.kt index c8a68da36..260a9cdb2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorAPI.kt @@ -121,8 +121,8 @@ object VisitorAPI { fun hasReward(): VisitorReward? { for (internalName in allRewards) { val reward = VisitorReward.getByInternalName(internalName) ?: continue - - if (config.rewardWarning.drops.contains(reward.ordinal)) { + // TODO, change functionality to use enum rather than ordinals + if (config.rewardWarning.drops.elementAtOrNull(reward.ordinal) != null) { return reward } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt index 00d32b9a6..544ad6094 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt @@ -2,8 +2,26 @@ package at.hannibal2.skyhanni.features.inventory import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.api.CollectionAPI +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.config.features.inventory.InventoryConfig.ItemNumberEntry +import at.hannibal2.skyhanni.config.features.inventory.InventoryConfig.ItemNumberEntry.BOTTLE_OF_JYRRE +import at.hannibal2.skyhanni.config.features.inventory.InventoryConfig.ItemNumberEntry.COLLECTION_LEVEL +import at.hannibal2.skyhanni.config.features.inventory.InventoryConfig.ItemNumberEntry.DUNGEON_HEAD_FLOOR_NUMBER +import at.hannibal2.skyhanni.config.features.inventory.InventoryConfig.ItemNumberEntry.DUNGEON_POTION_LEVEL +import at.hannibal2.skyhanni.config.features.inventory.InventoryConfig.ItemNumberEntry.EDITION_NUMBER +import at.hannibal2.skyhanni.config.features.inventory.InventoryConfig.ItemNumberEntry.KUUDRA_KEY +import at.hannibal2.skyhanni.config.features.inventory.InventoryConfig.ItemNumberEntry.LARVA_HOOK +import at.hannibal2.skyhanni.config.features.inventory.InventoryConfig.ItemNumberEntry.MASTER_SKULL_TIER +import at.hannibal2.skyhanni.config.features.inventory.InventoryConfig.ItemNumberEntry.MASTER_STAR_TIER +import at.hannibal2.skyhanni.config.features.inventory.InventoryConfig.ItemNumberEntry.MINION_TIER +import at.hannibal2.skyhanni.config.features.inventory.InventoryConfig.ItemNumberEntry.NEW_YEAR_CAKE +import at.hannibal2.skyhanni.config.features.inventory.InventoryConfig.ItemNumberEntry.PET_LEVEL +import at.hannibal2.skyhanni.config.features.inventory.InventoryConfig.ItemNumberEntry.RANCHERS_BOOTS_SPEED +import at.hannibal2.skyhanni.config.features.inventory.InventoryConfig.ItemNumberEntry.SKILL_LEVEL +import at.hannibal2.skyhanni.config.features.inventory.InventoryConfig.ItemNumberEntry.VACUUM_GARDEN import at.hannibal2.skyhanni.events.RenderItemTipEvent import at.hannibal2.skyhanni.features.garden.pests.PestAPI +import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils import at.hannibal2.skyhanni.utils.ItemUtils.cleanName @@ -23,7 +41,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.removeColor import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -class ItemDisplayOverlayFeatures { +object ItemDisplayOverlayFeatures { private val config get() = SkyHanniMod.feature.inventory private val rancherBootsSpeedCapPattern = "§7Current Speed Cap: §a(?<cap>.*)".toPattern() private val petLevelPattern = "\\[Lvl (?<level>.*)] .*".toPattern() @@ -39,8 +57,7 @@ class ItemDisplayOverlayFeatures { private fun getStackTip(item: ItemStack): String { val itemName = item.cleanName() - val itemNumberAsStackSize = config.itemNumberAsStackSize - if (itemNumberAsStackSize.contains(0)) { + if (MASTER_STAR_TIER.isSelected()) { when (itemName) { "First Master Star" -> return "1" "Second Master Star" -> return "2" @@ -50,14 +67,11 @@ class ItemDisplayOverlayFeatures { } } - if (itemNumberAsStackSize.contains(1) && itemName.matchRegex("(.*)Master Skull - Tier .")) { + if (MASTER_SKULL_TIER.isSelected() && itemName.matchRegex("(.*)Master Skull - Tier .")) { return itemName.substring(itemName.length - 1) } - if (itemNumberAsStackSize.contains(2) && (itemName.contains("Golden ") || itemName.contains( - "Diamond " - )) - ) { + if (DUNGEON_HEAD_FLOOR_NUMBER.isSelected() && (itemName.contains("Golden ") || itemName.contains("Diamond "))) { when { itemName.contains("Bonzo") -> return "1" itemName.contains("Scarf") -> return "2" @@ -69,11 +83,11 @@ class ItemDisplayOverlayFeatures { } } - if (itemNumberAsStackSize.contains(3) && itemName.startsWith("New Year Cake (")) { + if (NEW_YEAR_CAKE.isSelected() && itemName.startsWith("New Year Cake (")) { return "§b" + itemName.between("(Year ", ")") } - if (itemNumberAsStackSize.contains(4)) { + if (PET_LEVEL.isSelected()) { val chestName = InventoryUtils.openInventoryName() if (!chestName.endsWith("Sea Creature Guide") && ItemUtils.isPet(itemName)) { petLevelPattern.matchMatcher(itemName) { @@ -87,7 +101,7 @@ class ItemDisplayOverlayFeatures { } } - if (itemNumberAsStackSize.contains(5) && itemName.contains(" Minion ") && + if (MINION_TIER.isSelected() && itemName.contains(" Minion ") && !itemName.contains("Recipe") && item.getLore().any { it.contains("Place this minion") } ) { val array = itemName.split(" ") @@ -100,7 +114,7 @@ class ItemDisplayOverlayFeatures { return (if (itemName.contains("Enchanted")) "§5" else "") + sackName.substring(0, 2) } - if (itemNumberAsStackSize.contains(8) && itemName.contains("Kuudra Key")) { + if (KUUDRA_KEY.isSelected() && itemName.contains("Kuudra Key")) { return when (itemName) { "Kuudra Key" -> "§a1" "Hot Kuudra Key" -> "§22" @@ -111,7 +125,7 @@ class ItemDisplayOverlayFeatures { } } - if (itemNumberAsStackSize.contains(9) && + if (SKILL_LEVEL.isSelected() && InventoryUtils.openInventoryName() == "Your Skills" && item.getLore().any { it.contains("Click to view!") } ) { @@ -124,9 +138,7 @@ class ItemDisplayOverlayFeatures { } } - if (itemNumberAsStackSize.contains(10) && InventoryUtils.openInventoryName() - .endsWith(" Collections") - ) { + if (COLLECTION_LEVEL.isSelected() && InventoryUtils.openInventoryName().endsWith(" Collections")) { val lore = item.getLore() if (lore.any { it.contains("Click to view!") }) { if (CollectionAPI.isCollectionTier0(lore)) return "0" @@ -139,7 +151,7 @@ class ItemDisplayOverlayFeatures { } } - if (itemNumberAsStackSize.contains(11) && itemName.contains("Rancher's Boots")) { + if (RANCHERS_BOOTS_SPEED.isSelected() && itemName.contains("Rancher's Boots")) { for (line in item.getLore()) { rancherBootsSpeedCapPattern.matchMatcher(line) { return group("cap") @@ -147,7 +159,7 @@ class ItemDisplayOverlayFeatures { } } - if (itemNumberAsStackSize.contains(12) && itemName.contains("Larva Hook")) { + if (LARVA_HOOK.isSelected() && itemName.contains("Larva Hook")) { for (line in item.getLore()) { "§7§7You may harvest §6(?<amount>.).*".toPattern().matchMatcher(line) { val amount = group("amount").toInt() @@ -160,10 +172,7 @@ class ItemDisplayOverlayFeatures { } } - if (itemNumberAsStackSize.contains(13) && itemName.startsWith("Dungeon ") && itemName.contains( - " Potion" - ) - ) { + if (DUNGEON_POTION_LEVEL.isSelected() && itemName.startsWith("Dungeon ") && itemName.contains(" Potion")) { item.name?.let { "Dungeon (?<level>.*) Potion".toPattern().matchMatcher(it.removeColor()) { return when (val level = group("level").romanToDecimal()) { @@ -176,37 +185,30 @@ class ItemDisplayOverlayFeatures { } } - if (itemNumberAsStackSize.contains(14)) { - if (item.getInternalNameOrNull() in PestAPI.vacuumVariants) { - for (line in item.getLore()) { - gardenVacuumPatterm.matchMatcher(line) { - val pests = group("amount").formatNumber() - return if (config.vacuumBagCap) { - if (pests > 39) "§640" else "$pests" - } else { - if (pests < 40) { - "$pests" - } else if (pests < 1_000) { - "§6$pests" - } else if (pests < 100_000) { - "§c${pests / 1000}k" - } else { - "§c${pests / 100_000 / 10.0}m" - } + if (VACUUM_GARDEN.isSelected() && item.getInternalNameOrNull() in PestAPI.vacuumVariants) { + for (line in item.getLore()) { + gardenVacuumPatterm.matchMatcher(line) { + val pests = group("amount").formatNumber() + return if (config.vacuumBagCap) { + if (pests > 39) "§640" else "$pests" + } else { + when { + pests < 40 -> "$pests" + pests < 1_000 -> "§6$pests" + pests < 100_000 -> "§c${pests / 1000}k" + else -> "§c${pests / 100_000 / 10.0}m" } } } } } - if (itemNumberAsStackSize.contains(15)) { - if (item.getInternalNameOrNull() == bottleOfJyrre) { - val seconds = item.getBottleOfJyrreSeconds() ?: 0 - return "§a${(seconds / 3600)}" - } + if (BOTTLE_OF_JYRRE.isSelected() && item.getInternalNameOrNull() == bottleOfJyrre) { + val seconds = item.getBottleOfJyrreSeconds() ?: 0 + return "§a${(seconds / 3600)}" } - if (itemNumberAsStackSize.contains(16)) { + if (EDITION_NUMBER.isSelected()) { item.getEdition()?.let { edition -> if (edition < 1_000) { return "§6$edition" @@ -227,4 +229,13 @@ class ItemDisplayOverlayFeatures { } return text } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.move(11, "inventory.itemNumberAsStackSize", "inventory.itemNumberAsStackSize") { element -> + ConfigUtils.migrateIntArrayListToEnumArrayList(element, ItemNumberEntry::class.java) + } + } + + fun ItemNumberEntry.isSelected() = config.itemNumberAsStackSize.contains(this) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemStars.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemStars.kt index 9b6e4c8bf..bbd302009 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemStars.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemStars.kt @@ -1,12 +1,14 @@ package at.hannibal2.skyhanni.features.inventory import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.features.inventory.InventoryConfig.ItemNumberEntry.CRIMSON_ARMOR +import at.hannibal2.skyhanni.data.jsonobjects.repo.ItemsJson import at.hannibal2.skyhanni.events.RenderItemTipEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent +import at.hannibal2.skyhanni.features.inventory.ItemDisplayOverlayFeatures.isSelected import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.StringUtils.matches -import at.hannibal2.skyhanni.data.jsonobjects.repo.ItemsJson import net.minecraftforge.event.entity.player.ItemTooltipEvent import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -53,7 +55,7 @@ class ItemStars { @SubscribeEvent fun onRenderItemTip(event: RenderItemTipEvent) { - if (!config.itemNumberAsStackSize.contains(6)) return + if (!CRIMSON_ARMOR.isSelected()) return val stack = event.stack val number = getCrimsonStars(stack.name ?: return) if (number != -1) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt index fd4ad8962..63ae5763e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt @@ -2,12 +2,14 @@ package at.hannibal2.skyhanni.features.mining.powdertracker import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent +import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.LorenzUtils.afterChange import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland @@ -176,12 +178,16 @@ object PowderTracker { event.move(8, "#profile.powderTracker", "#profile.powderTracker") { old -> old.asJsonObject.get("0") } + event.move(11, "mining.powderTracker.textFormat", "mining.powderTracker.textFormat") { element -> + ConfigUtils.migrateIntArrayListToEnumArrayList(element, PowderDisplayEntry::class.java) + } } private fun formatDisplay(map: List<List<Any>>) = buildList { if (map.isEmpty()) return@buildList for (index in config.textFormat.get()) { - add(map[index]) + // TODO, change functionality to use enum rather than ordinals + add(map[index.ordinal]) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordRPCManager.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordRPCManager.kt index e358b3f28..96123826e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordRPCManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordRPCManager.kt @@ -5,11 +5,15 @@ package at.hannibal2.skyhanni.features.misc.discordrpc import at.hannibal2.skyhanni.SkyHanniMod.Companion.consoleLog import at.hannibal2.skyhanni.SkyHanniMod.Companion.coroutineScope import at.hannibal2.skyhanni.SkyHanniMod.Companion.feature +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.config.features.misc.DiscordRPCConfig.LineEntry +import at.hannibal2.skyhanni.config.features.misc.DiscordRPCConfig.PriorityEntry import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.LorenzKeyPressEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.test.command.ErrorManager +import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.onToggle import at.hannibal2.skyhanni.utils.SimpleTimeMark @@ -50,9 +54,9 @@ object DiscordRPCManager : IPCListener { return@launch } consoleLog("Starting Discord RPC...") - - firstLine = getStatusByConfigId(config.firstLine.get()) - secondLine = getStatusByConfigId(config.secondLine.get()) + // TODO, change functionality to use enum rather than ordinals + firstLine = getStatusByConfigId(config.firstLine.get().ordinal) + secondLine = getStatusByConfigId(config.secondLine.get().ordinal) startTimestamp = System.currentTimeMillis() client = IPCClient(applicationID) client?.setListener(this@DiscordRPCManager) @@ -106,9 +110,9 @@ object DiscordRPCManager : IPCListener { fun updatePresence() { val location = DiscordStatus.LOCATION.getDisplayString() val discordIconKey = DiscordLocationKey.getDiscordIconKey(location) - - secondLine = getStatusByConfigId(config.secondLine.get()) - firstLine = getStatusByConfigId(config.firstLine.get()) + // TODO, change functionality to use enum rather than ordinals + secondLine = getStatusByConfigId(config.secondLine.get().ordinal) + firstLine = getStatusByConfigId(config.firstLine.get().ordinal) val presence: RichPresence = RichPresence.Builder() .setDetails(firstLine.getDisplayString()) .setState(secondLine.getDisplayString()) @@ -207,7 +211,25 @@ object DiscordRPCManager : IPCListener { // Events that change things in DiscordStatus @SubscribeEvent fun onKeybind(event: LorenzKeyPressEvent) { - if (!isEnabled() || !feature.misc.discordRPC.autoPriority.contains(4)) return // autoPriority 4 is dynamic afk + if (!isEnabled() || !PriorityEntry.AFK.isSelected()) return // autoPriority 4 is dynamic afk beenAfkFor = SimpleTimeMark.now() } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.move(11, "misc.discordRPC.firstLine", "misc.discordRPC.firstLine") { element -> + ConfigUtils.migrateIntToEnum(element, LineEntry::class.java) + } + event.move(11, "misc.discordRPC.secondLine", "misc.discordRPC.secondLine") { element -> + ConfigUtils.migrateIntToEnum(element, LineEntry::class.java) + } + event.move(11, "misc.discordRPC.auto", "misc.discordRPC.auto") { element -> + ConfigUtils.migrateIntToEnum(element, LineEntry::class.java) + } + event.move(11, "misc.discordRPC.autoPriority", "misc.discordRPC.autoPriority") { element -> + ConfigUtils.migrateIntArrayListToEnumArrayList(element, PriorityEntry::class.java) + } + } + + private fun PriorityEntry.isSelected() = config.autoPriority.contains(this) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt index 141870585..cc2a09b9d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordStatus.kt @@ -258,7 +258,8 @@ enum class DiscordStatus(private val displayMessageSupplier: Supplier<String>?) AUTO({ var autoReturn = "" for (statusID in SkyHanniMod.feature.misc.discordRPC.autoPriority) { // for every dynamic that the user wants to see... - val autoStatus = AutoStatus.entries[statusID] + // TODO, change functionality to use enum rather than ordinals + val autoStatus = AutoStatus.entries[statusID.ordinal] val result = autoStatus.correspondingDiscordStatus.getDisplayString() // get what would happen if we were to display it if (result != autoStatus.placeholderText) { // if that value is useful, display it @@ -269,7 +270,7 @@ enum class DiscordStatus(private val displayMessageSupplier: Supplier<String>?) if (autoReturn == "") { // if we didn't find any useful information, display the fallback val statusNoAuto = DiscordStatus.entries.toMutableList() statusNoAuto.remove(AUTO) - autoReturn = statusNoAuto[SkyHanniMod.feature.misc.discordRPC.auto.get()].getDisplayString() + autoReturn = statusNoAuto[SkyHanniMod.feature.misc.discordRPC.auto.get().ordinal].getDisplayString() } autoReturn }), diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt index 318d4c1f0..39c4979da 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt @@ -1,6 +1,8 @@ package at.hannibal2.skyhanni.features.misc.trevor import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.config.features.misc.TrevorTheTrapperConfig.TrackerEntry import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.data.ScoreboardData import at.hannibal2.skyhanni.events.CheckRenderEntityEvent @@ -14,6 +16,7 @@ import at.hannibal2.skyhanni.features.garden.farming.GardenCropSpeed import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled import at.hannibal2.skyhanni.test.command.ErrorManager +import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer import at.hannibal2.skyhanni.utils.LorenzColor @@ -302,4 +305,11 @@ object TrevorFeatures { fun onFarmingIsland() = IslandType.THE_FARMING_ISLANDS.isInIsland() fun inTrapperDen() = ScoreboardData.sidebarLinesFormatted.contains(" §7⏣ §bTrapper's Den") + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.move(11, "misc.trevorTheTrapper.textFormat", "misc.trevorTheTrapper.textFormat") { element -> + ConfigUtils.migrateIntArrayListToEnumArrayList(element, TrackerEntry::class.java) + } + } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorTracker.kt index 59d44b1b7..8284c0605 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorTracker.kt @@ -65,7 +65,8 @@ object TrevorTracker { private fun formatDisplay(map: List<List<Any>>): List<List<Any>> { val newList = mutableListOf<List<Any>>() for (index in config.textFormat) { - newList.add(map[index]) + // TODO, change functionality to use enum rather than ordinals + newList.add(map[index.ordinal]) } return newList } |