diff options
Diffstat (limited to 'src/main/java')
38 files changed, 1319 insertions, 472 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index 117bb2d28..4d18ecdf0 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -424,7 +424,7 @@ class SkyHanniMod { loadModule(PlayerChatModifier()) loadModule(DungeonChatFilter()) loadModule(HideNotClickableItems()) - loadModule(ItemDisplayOverlayFeatures()) + loadModule(ItemDisplayOverlayFeatures) loadModule(CurrentPetDisplay()) loadModule(ExpOrbsOnGroundHider()) loadModule(FandomWikiFromMenus()) diff --git a/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt b/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt index a8ec467d9..6f5fe68ed 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt @@ -9,7 +9,7 @@ import com.google.gson.JsonPrimitive object ConfigUpdaterMigrator { val logger = LorenzLogger("ConfigMigration") - const val CONFIG_VERSION = 10 + const val CONFIG_VERSION = 11 fun JsonElement.at(chain: List<String>, init: Boolean): JsonElement? { if (chain.isEmpty()) return this if (this !is JsonObject) return null @@ -34,7 +34,7 @@ object ConfigUpdaterMigrator { } } - fun move(since: Int, oldPath: String, newPath: String, transform: (JsonElement) -> JsonElement = { it }) { + fun move(since: Int, oldPath: String, newPath: String = oldPath, transform: (JsonElement) -> JsonElement = { it }) { if (since <= oldVersion) { logger.log("Skipping move from $oldPath to $newPath ($since <= $oldVersion)") return diff --git a/src/main/java/at/hannibal2/skyhanni/config/HasLegacyId.java b/src/main/java/at/hannibal2/skyhanni/config/HasLegacyId.java new file mode 100644 index 000000000..a867cb570 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/config/HasLegacyId.java @@ -0,0 +1,26 @@ +package at.hannibal2.skyhanni.config; + +/** + * The interface HasLegacyId. + * To be used for config elements that are being migrated from ArrayLists to Enums. + * A legacyId is not needed for new elements. + */ +public interface HasLegacyId { + + /** + * Gets display string. + * + * @return the display string + */ + String toString(); + + /** + * Gets legacy id. This is used for legacy configs that are being migrated to enums. + * New elements do not need a legacyId, and should return -1 + * + * @return the legacy id + */ + default int getLegacyId() { + return -1; + } +} diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/combat/EnderNodeConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/combat/EnderNodeConfig.java index 0fd962084..37f6cdfb8 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/combat/EnderNodeConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/combat/EnderNodeConfig.java @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.config.features.combat; import at.hannibal2.skyhanni.config.FeatureToggle; +import at.hannibal2.skyhanni.config.HasLegacyId; import at.hannibal2.skyhanni.config.core.config.Position; import com.google.gson.annotations.Expose; import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; @@ -12,6 +13,23 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import static at.hannibal2.skyhanni.config.features.combat.EnderNodeConfig.EnderNodeDisplayEntry.COINS_MADE; +import static at.hannibal2.skyhanni.config.features.combat.EnderNodeConfig.EnderNodeDisplayEntry.ENCHANTED_ENDER_PEARL; +import static at.hannibal2.skyhanni.config.features.combat.EnderNodeConfig.EnderNodeDisplayEntry.ENCHANTED_END_STONE; +import static at.hannibal2.skyhanni.config.features.combat.EnderNodeConfig.EnderNodeDisplayEntry.ENCHANTED_OBSIDIAN; +import static at.hannibal2.skyhanni.config.features.combat.EnderNodeConfig.EnderNodeDisplayEntry.ENDERMAN_PET; +import static at.hannibal2.skyhanni.config.features.combat.EnderNodeConfig.EnderNodeDisplayEntry.ENDERMITE_NEST; +import static at.hannibal2.skyhanni.config.features.combat.EnderNodeConfig.EnderNodeDisplayEntry.ENDER_ARMOR; +import static at.hannibal2.skyhanni.config.features.combat.EnderNodeConfig.EnderNodeDisplayEntry.GRAND_XP_BOTTLE; +import static at.hannibal2.skyhanni.config.features.combat.EnderNodeConfig.EnderNodeDisplayEntry.MAGICAL_RUNE_I; +import static at.hannibal2.skyhanni.config.features.combat.EnderNodeConfig.EnderNodeDisplayEntry.MITE_GEL; +import static at.hannibal2.skyhanni.config.features.combat.EnderNodeConfig.EnderNodeDisplayEntry.NODES_MINED; +import static at.hannibal2.skyhanni.config.features.combat.EnderNodeConfig.EnderNodeDisplayEntry.SHRIMP_THE_FISH; +import static at.hannibal2.skyhanni.config.features.combat.EnderNodeConfig.EnderNodeDisplayEntry.SPACER_1; +import static at.hannibal2.skyhanni.config.features.combat.EnderNodeConfig.EnderNodeDisplayEntry.SPACER_2; +import static at.hannibal2.skyhanni.config.features.combat.EnderNodeConfig.EnderNodeDisplayEntry.TITANIC_XP_BOTTLE; +import static at.hannibal2.skyhanni.config.features.combat.EnderNodeConfig.EnderNodeDisplayEntry.TITLE; + public class EnderNodeConfig { @Expose @ConfigOption( @@ -28,36 +46,76 @@ public class EnderNodeConfig { name = "Text Format", desc = "Drag text to change the appearance of the overlay." ) - @ConfigEditorDraggableList( - exampleText = { - "§5§lEnder Node Tracker", - "§d1,303 Ender Nodes Mined", - "§615.3M Coins Made", - " ", - "§b123 §cEndermite Nest", - "§b832 §aEnchanted End Stone", - "§b230 §aEnchanted Obsidian", - "§b1630 §aEnchanted Ender Pearl", - "§b85 §aGrand Experience Bottle", - "§b4 §9Titanic Experience Bottle", - "§b15 §9End Stone Shulker", - "§b53 §9End Stone Geode", - "§b10 §d◆ Magical Rune I", - "§b24 §5Ender Gauntlet", - "§b357 §5Mite Gel", - "§b2 §cShrimp The Fish", - " ", - "§b200 §5Ender Armor", - "§b24 §5Ender Helmet", - "§b24 §5Ender Chestplate", - "§b24 §5Ender Leggings", - "§b24 §5Ender Boots", - "§b24 §5Ender Necklace", - "§f10§7-§a8§7-§93§7-§52§7-§61 §fEnderman Pet", - " " + @ConfigEditorDraggableList() + public Property<List<EnderNodeDisplayEntry>> textFormat = Property.of(new ArrayList<>(Arrays.asList( + TITLE, + NODES_MINED, + COINS_MADE, + SPACER_1, + ENDERMITE_NEST, + ENCHANTED_END_STONE, + ENCHANTED_OBSIDIAN, + ENCHANTED_ENDER_PEARL, + GRAND_XP_BOTTLE, + TITANIC_XP_BOTTLE, + MAGICAL_RUNE_I, + MITE_GEL, + SHRIMP_THE_FISH, + SPACER_2, + ENDER_ARMOR, + ENDERMAN_PET) + )); + + public enum EnderNodeDisplayEntry implements HasLegacyId { + TITLE("§5§lEnder Node Tracker", 0), + NODES_MINED("§d1,303 Ender Nodes Mined", 1), + COINS_MADE("§615.3M Coins Made", 2), + SPACER_1(" ", 3), + ENDERMITE_NEST("§b123 §cEndermite Nest", 4), + ENCHANTED_END_STONE("§b832 §aEnchanted End Stone", 5), + ENCHANTED_OBSIDIAN("§b230 §aEnchanted Obsidian", 6), + ENCHANTED_ENDER_PEARL("§b1630 §aEnchanted Ender Pearl", 7), + GRAND_XP_BOTTLE("§b85 §aGrand Experience Bottle", 8), + TITANIC_XP_BOTTLE("§b4 §9Titanic Experience Bottle", 9), + END_STONE_SHULKER("§b15 §9End Stone Shulker", 10), + END_STONE_GEODE("§b53 §9End Stone Geode", 11), + MAGICAL_RUNE_I("§b10 §d◆ Magical Rune I", 12), + ENDER_GAUNTLET("§b24 §5Ender Gauntlet", 13), + MITE_GEL("§b357 §5Mite Gel", 14), + SHRIMP_THE_FISH("§b2 §cShrimp The Fish", 15), + SPACER_2(" ", 16), + ENDER_ARMOR("§b200 §5Ender Armor", 17), + ENDER_HELMET("§b24 §5Ender Helmet", 18), + ENDER_CHESTPLATE("§b24 §5Ender Chestplate", 19), + ENDER_LEGGINGS("§b24 §5Ender Leggings", 20), + ENDER_BOOTS("§b24 §5Ender Boots", 21), + ENDER_NECKLACE("§b24 §5Ender Necklace", 22), + ENDERMAN_PET("§f10§7-§a8§7-§93§7-§52§7-§61 §fEnderman Pet", 23), + ; + + private final String str; + private final int legacyId; + + EnderNodeDisplayEntry(String str, int legacyId) { + this.str = str; + this.legacyId = legacyId; } - ) - public Property<List<Integer>> textFormat = Property.of(new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 14, 15, 16, 17, 23))); + + // Constructor if new enum elements are added post-migration + EnderNodeDisplayEntry(String str) { + this(str, -1); + } + + @Override + public int getLegacyId() { + return legacyId; + } + + @Override + public String toString() { + return str; + } + } @Expose public Position position = new Position(10, 80, false, true); diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/combat/MobsConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/combat/MobsConfig.java index 77731d854..3514c6729 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/combat/MobsConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/combat/MobsConfig.java @@ -6,11 +6,6 @@ import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; import io.github.moulberry.moulconfig.annotations.ConfigOption; public class MobsConfig { - - @Expose - @ConfigOption(name = "Highlighters", desc = "") - public boolean highlighters = false; - @Expose @ConfigOption(name = "Area Boss", desc = "Highlight Golden Ghoul, Old Wolf, Voidling Extremist and Millenia-Aged Blaze.") @ConfigEditorBoolean @@ -57,10 +52,6 @@ public class MobsConfig { public boolean arachneBossHighlighter = true; @Expose - @ConfigOption(name = "Respawn Timers", desc = "") - public boolean timers = false; - - @Expose @ConfigOption( name = "Area Boss", desc = "Show a timer when Golden Ghoul, Old Wolf, Voidling Extremist or Millenia-Aged Blaze respawns. " + diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/combat/damageindicator/DamageIndicatorConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/combat/damageindicator/DamageIndicatorConfig.java index 36ba986e2..6986d706c 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/combat/damageindicator/DamageIndicatorConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/combat/damageindicator/DamageIndicatorConfig.java @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.config.features.combat.damageindicator; import at.hannibal2.skyhanni.config.FeatureToggle; +import at.hannibal2.skyhanni.config.HasLegacyId; import com.google.gson.annotations.Expose; import io.github.moulberry.moulconfig.annotations.Accordion; import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; @@ -12,6 +13,22 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import static at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.DamageIndicatorBossEntry.ARACHNE; +import static at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.DamageIndicatorBossEntry.DIANA_MOBS; +import static at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.DamageIndicatorBossEntry.DUNGEON_ALL; +import static at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.DamageIndicatorBossEntry.GARDEN_PESTS; +import static at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.DamageIndicatorBossEntry.INFERNO_DEMONLORD; +import static at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.DamageIndicatorBossEntry.NETHER_MINI_BOSSES; +import static at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.DamageIndicatorBossEntry.REINDRAKE; +import static at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.DamageIndicatorBossEntry.REVENANT_HORROR; +import static at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.DamageIndicatorBossEntry.RIFTSTALKER_BLOODFIEND; +import static at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.DamageIndicatorBossEntry.SEA_CREATURES; +import static at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.DamageIndicatorBossEntry.SVEN_PACKMASTER; +import static at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.DamageIndicatorBossEntry.TARANTULA_BROODFATHER; +import static at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.DamageIndicatorBossEntry.THE_RIFT_BOSSES; +import static at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.DamageIndicatorBossEntry.VANQUISHER; +import static at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.DamageIndicatorBossEntry.VOIDGLOOM_SERAPH; + public class DamageIndicatorConfig { @Expose @@ -37,39 +54,79 @@ public class DamageIndicatorConfig { name = "Select Boss", desc = "Change what type of boss you want the damage indicator be enabled for." ) - @ConfigEditorDraggableList( - exampleText = { - "§bDungeon All", - "§bNether Mini Bosses", - "§bVanquisher", - "§bEndstone Protector (not tested)", - "§bEnder Dragon (not finished)", - "§bRevenant Horror", - "§bTarantula Broodfather", - "§bSven Packmaster", - "§bVoidgloom Seraph", - "§bInferno Demonlord", - "§bHeadless Horseman (bugged)", - "§bDungeon Floor 1", - "§bDungeon Floor 2", - "§bDungeon Floor 3", - "§bDungeon Floor 4", - "§bDungeon Floor 5", - "§bDungeon Floor 6", - "§bDungeon Floor 7", - "§bDiana Mobs", - "§bSea Creatures", - "Dummy", - "§bArachne", - "§bThe Rift Bosses", - "§bRiftstalker Bloodfiend", - "§6Reindrake", - "§aGarden Pests" - } - ) + @ConfigEditorDraggableList() //TODO only show currently working and tested features - public List<Integer> bossesToShow = new ArrayList<>(Arrays.asList(0, 1, 2, 5, 6, 7, 8, 9, 18, 19, 21, 22, 23, 24, 25)); + public List<DamageIndicatorBossEntry> bossesToShow = new ArrayList<>(Arrays.asList( + DUNGEON_ALL, + NETHER_MINI_BOSSES, + VANQUISHER, + REVENANT_HORROR, + TARANTULA_BROODFATHER, + SVEN_PACKMASTER, + VOIDGLOOM_SERAPH, + INFERNO_DEMONLORD, + DIANA_MOBS, + SEA_CREATURES, + ARACHNE, + THE_RIFT_BOSSES, + RIFTSTALKER_BLOODFIEND, + REINDRAKE, + GARDEN_PESTS + + )); + public enum DamageIndicatorBossEntry implements HasLegacyId { + DUNGEON_ALL("§bDungeon All", 0), + NETHER_MINI_BOSSES("§bNether Mini Bosses", 1), + VANQUISHER("§bVanquisher", 2), + ENDERSTONE_PROTECTOR("§bEndstone Protector (not tested)", 3), + ENDER_DRAGON("§bEnder Dragon (not finished)", 4), + REVENANT_HORROR("§bRevenant Horror", 5), + TARANTULA_BROODFATHER("§bTarantula Broodfather", 6), + SVEN_PACKMASTER("§bSven Packmaster", 7), + VOIDGLOOM_SERAPH("§bVoidgloom Seraph", 8), + INFERNO_DEMONLORD("§bInferno Demonlord", 9), + HEADLESS_HORSEMAN("§bHeadless Horseman (bugged)", 10), + DUNGEON_FLOOR_1("§bDungeon Floor 1", 11), + DUNGEON_FLOOR_2("§bDungeon Floor 2", 12), + DUNGEON_FLOOR_3("§bDungeon Floor 3", 13), + DUNGEON_FLOOR_4("§bDungeon Floor 4", 14), + DUNGEON_FLOOR_5("§bDungeon Floor 5", 15), + DUNGEON_FLOOR_6("§bDungeon Floor 6", 16), + DUNGEON_FLOOR_7("§bDungeon Floor 7", 17), + DIANA_MOBS("§bDiana Mobs", 18), + SEA_CREATURES("§bSea Creatures", 19), + DUMMY("Dummy", 20), + ARACHNE("§bArachne", 21), + THE_RIFT_BOSSES("§bThe Rift Bosses", 22), + RIFTSTALKER_BLOODFIEND("§bRiftstalker Bloodfiend", 23), + REINDRAKE("§6Reindrake", 24), + GARDEN_PESTS("§aGarden Pests", 25), + ; + + private final String str; + private final int legacyId; + + DamageIndicatorBossEntry(String str, int legacyId) { + this.str = str; + this.legacyId = legacyId; + } + + // Constructor if new enum elements are added post-migration + DamageIndicatorBossEntry(String str) { + this(str, -1); + } + + @Override + public int getLegacyId() { + return legacyId; + } + + @Override + public String toString() { + return str; + } + } @Expose @ConfigOption(name = "Hide Damage Splash", desc = "Hiding damage splashes near the damage indicator.") @ConfigEditorBoolean diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/combat/ghostcounter/GhostCounterConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/combat/ghostcounter/GhostCounterConfig.java index 783c4cda5..6bc8ee48d 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/combat/ghostcounter/GhostCounterConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/combat/ghostcounter/GhostCounterConfig.java @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.config.features.combat.ghostcounter; import at.hannibal2.skyhanni.config.FeatureToggle; +import at.hannibal2.skyhanni.config.HasLegacyId; import at.hannibal2.skyhanni.config.core.config.Position; import at.hannibal2.skyhanni.config.features.combat.ghostcounter.textformatting.TextFormattingConfig; import at.hannibal2.skyhanni.features.combat.ghostcounter.GhostUtil; @@ -16,6 +17,16 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import static at.hannibal2.skyhanni.config.features.combat.ghostcounter.GhostCounterConfig.GhostDisplayEntry.AVG_MAGIC_FIND; +import static at.hannibal2.skyhanni.config.features.combat.ghostcounter.GhostCounterConfig.GhostDisplayEntry.GHOSTS_KILLED; +import static at.hannibal2.skyhanni.config.features.combat.ghostcounter.GhostCounterConfig.GhostDisplayEntry.GHOST_PER_SORROW; +import static at.hannibal2.skyhanni.config.features.combat.ghostcounter.GhostCounterConfig.GhostDisplayEntry.GHOST_SINCE_SORROW; +import static at.hannibal2.skyhanni.config.features.combat.ghostcounter.GhostCounterConfig.GhostDisplayEntry.HIGHEST_KILL_COMBO; +import static at.hannibal2.skyhanni.config.features.combat.ghostcounter.GhostCounterConfig.GhostDisplayEntry.KILL_COMBO; +import static at.hannibal2.skyhanni.config.features.combat.ghostcounter.GhostCounterConfig.GhostDisplayEntry.SCAVENGER_COINS; +import static at.hannibal2.skyhanni.config.features.combat.ghostcounter.GhostCounterConfig.GhostDisplayEntry.SORROW; +import static at.hannibal2.skyhanni.config.features.combat.ghostcounter.GhostCounterConfig.GhostDisplayEntry.TITLE; + public class GhostCounterConfig { @Expose @@ -29,31 +40,65 @@ public class GhostCounterConfig { name = "Display Text", desc = "Drag text to change the appearance of the overlay." ) - @ConfigEditorDraggableList( - exampleText = { - "§6Ghosts Counter", - " §bGhost Killed: 42", - " §bSorrow: 6", - " §bGhost since Sorrow: 1", - " §bGhosts/Sorrow: 5", - " §bVolta: 6", - " §bPlasma: 8", - " §bGhostly Boots: 1", - " §bBag Of Cash: 4", - " §bAvg Magic Find: 271", - " §bScavenger Coins: 15,000", - " §bKill Combo: 14", - " §bHighest Kill Combo: 96", - " §bSkill XP Gained: 145,648", - " §bBestiary 1: 0/10", - " §bXP/h: 810,410", - " §bKills/h: 420", - " §bETA: 14d", - " §bMoney/h: 13,420,069", - " §bMoney made: 14B" + @ConfigEditorDraggableList() + public List<GhostDisplayEntry> ghostDisplayText = new ArrayList<>(Arrays.asList( + TITLE, + GHOSTS_KILLED, + SORROW, + GHOST_SINCE_SORROW, + GHOST_PER_SORROW, + AVG_MAGIC_FIND, + SCAVENGER_COINS, + KILL_COMBO, + HIGHEST_KILL_COMBO + )); + + public enum GhostDisplayEntry implements HasLegacyId { + TITLE("§6Ghosts Counter", 0), + GHOSTS_KILLED(" §bGhost Killed: 42", 1), + SORROW(" §bSorrow: 6", 2), + GHOST_SINCE_SORROW(" §bGhost since Sorrow: 1", 3), + GHOST_PER_SORROW(" §bGhosts/Sorrow: 5", 4), + VOLTA(" §bVolta: 6", 5), + PLASMA(" §bPlasma: 8", 6), + GHOSTLY_BOOTS(" §bGhostly Boots: 1", 7), + BAG_OF_CASH(" §bBag Of Cash: 4", 8), + AVG_MAGIC_FIND(" §bAvg Magic Find: 271", 9), + SCAVENGER_COINS(" §bScavenger Coins: 15,000", 10), + KILL_COMBO(" §bKill Combo: 14", 11), + HIGHEST_KILL_COMBO(" §bHighest Kill Combo: 96", 12), + SKILL_XP_GAINED(" §bSkill XP Gained: 145,648", 13), + BESTIARY(" §bBestiary 1: 0/10", 14), + XP_PER_HOUR(" §bXP/h: 810,410", 15), + KILLS_PER_HOUR(" §bKills/h: 420", 16), + ETA(" §bETA: 14d", 17), + MONEY_PER_HOUR(" §bMoney/h: 13,420,069", 18), + MONEY_MADE(" §bMoney made: 14B", 19), + ; + + private final String str; + private final int legacyId; + + GhostDisplayEntry(String str, int legacyId) { + this.str = str; + this.legacyId = legacyId; } - ) - public List<Integer> ghostDisplayText = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 9, 10, 11, 12)); + + // Constructor if new enum elements are added post-migration + GhostDisplayEntry(String str) { + this(str, -1); + } + + @Override + public int getLegacyId() { + return legacyId; + } + + @Override + public String toString() { + return str; + } + } @ConfigOption(name = "Text Formatting", desc = "") @Accordion diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/commands/TabCompleteConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/commands/TabCompleteConfig.java index 6e3420a59..b7edd0e07 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/commands/TabCompleteConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/commands/TabCompleteConfig.java @@ -15,6 +15,7 @@ public class TabCompleteConfig { @Expose @ConfigOption(name = "Island Players", desc = "Tab complete other players on the same island.") + @ConfigEditorBoolean public boolean islandPlayers = true; @Expose diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/event/winter/FrozenTreasureConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/event/winter/FrozenTreasureConfig.java index 2b41265a6..a1f378d08 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/event/winter/FrozenTreasureConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/event/winter/FrozenTreasureConfig.java @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.config.features.event.winter; import at.hannibal2.skyhanni.config.FeatureToggle; +import at.hannibal2.skyhanni.config.HasLegacyId; import at.hannibal2.skyhanni.config.core.config.Position; import com.google.gson.annotations.Expose; import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; @@ -11,6 +12,20 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import static at.hannibal2.skyhanni.config.features.event.winter.FrozenTreasureConfig.FrozenTreasureDisplayEntry.COMPACT_PROCS; +import static at.hannibal2.skyhanni.config.features.event.winter.FrozenTreasureConfig.FrozenTreasureDisplayEntry.ENCHANTED_ICE; +import static at.hannibal2.skyhanni.config.features.event.winter.FrozenTreasureConfig.FrozenTreasureDisplayEntry.ENCHANTED_PACKED_ICE; +import static at.hannibal2.skyhanni.config.features.event.winter.FrozenTreasureConfig.FrozenTreasureDisplayEntry.GLACIAL_FRAGMENT; +import static at.hannibal2.skyhanni.config.features.event.winter.FrozenTreasureConfig.FrozenTreasureDisplayEntry.GLACIAL_TALISMAN; +import static at.hannibal2.skyhanni.config.features.event.winter.FrozenTreasureConfig.FrozenTreasureDisplayEntry.GREEN_GIFT; +import static at.hannibal2.skyhanni.config.features.event.winter.FrozenTreasureConfig.FrozenTreasureDisplayEntry.ICE_PER_HOUR; +import static at.hannibal2.skyhanni.config.features.event.winter.FrozenTreasureConfig.FrozenTreasureDisplayEntry.RED_GIFT; +import static at.hannibal2.skyhanni.config.features.event.winter.FrozenTreasureConfig.FrozenTreasureDisplayEntry.SPACER_1; +import static at.hannibal2.skyhanni.config.features.event.winter.FrozenTreasureConfig.FrozenTreasureDisplayEntry.TITLE; +import static at.hannibal2.skyhanni.config.features.event.winter.FrozenTreasureConfig.FrozenTreasureDisplayEntry.TOTAL_ICE; +import static at.hannibal2.skyhanni.config.features.event.winter.FrozenTreasureConfig.FrozenTreasureDisplayEntry.TREASURES_MINED; +import static at.hannibal2.skyhanni.config.features.event.winter.FrozenTreasureConfig.FrozenTreasureDisplayEntry.WHITE_GIFT; + public class FrozenTreasureConfig { @Expose @@ -28,28 +43,65 @@ public class FrozenTreasureConfig { name = "Text Format", desc = "Drag text to change the appearance of the overlay." ) - @ConfigEditorDraggableList( - exampleText = { - "§1§lFrozen Treasure Tracker", - "§61,636 Treasures Mined", - "§33.2m Total Ice", - "§3342,192 Ice/hr", - "§81,002 Compact Procs", - " ", - "§b182 §fWhite Gift", - "§b94 §aGreen Gift", - "§b17 §9§cRed Gift", - "§b328 §fPacked Ice", - "§b80 §aEnchanted Ice", - "§b4 §9Enchanted Packed Ice", - "§b182 §aIce Bait", - "§b3 §aGlowy Chum Bait", - "§b36 §5Glacial Fragment", - "§b6 §fGlacial Talisman", - " ", + @ConfigEditorDraggableList() + public List<FrozenTreasureDisplayEntry> textFormat = new ArrayList<>(Arrays.asList( + TITLE, + TREASURES_MINED, + TOTAL_ICE, + ICE_PER_HOUR, + COMPACT_PROCS, + SPACER_1, + WHITE_GIFT, + GREEN_GIFT, + RED_GIFT, + ENCHANTED_ICE, + ENCHANTED_PACKED_ICE, + GLACIAL_FRAGMENT, + GLACIAL_TALISMAN + )); + + public enum FrozenTreasureDisplayEntry implements HasLegacyId { + TITLE("§1§lFrozen Treasure Tracker", 0), + TREASURES_MINED("§61,636 Treasures Mined", 1), + TOTAL_ICE("§33.2m Total Ice", 2), + ICE_PER_HOUR("§3342,192 Ice/hr", 3), + COMPACT_PROCS("§81,002 Compact Procs", 4), + SPACER_1(" ", 5), + WHITE_GIFT("§b182 §fWhite Gift", 6), + GREEN_GIFT("§b94 §aGreen Gift", 7), + RED_GIFT("§b17 §9§cRed Gift", 8), + PACKED_ICE("§b328 §fPacked Ice", 9), + ENCHANTED_ICE("§b80 §aEnchanted Ice", 10), + ENCHANTED_PACKED_ICE("§b4 §9Enchanted Packed Ice", 11), + ICE_BAIT("§b182 §aIce Bait", 12), + GLOWY_CHUM_BAIT("§b3 §aGlowy Chum Bait", 13), + GLACIAL_FRAGMENT("§b36 §5Glacial Fragment", 14), + GLACIAL_TALISMAN("§b6 §fGlacial Talisman", 15), + SPACER_2(" ", 16); + + private final String str; + private final int legacyId; + + FrozenTreasureDisplayEntry(String str, int legacyId) { + this.str = str; + this.legacyId = legacyId; } - ) - public List<Integer> textFormat = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 14, 15)); + + // Constructor if new enum elements are added post-migration + FrozenTreasureDisplayEntry(String str) { + this(str, -1); + } + + @Override + public int getLegacyId() { + return legacyId; + } + + @Override + public String toString() { + return str; + } + } @Expose @ConfigOption(name = "Only in Glacial Cave", desc = "Only shows the overlay while in the Glacial Cave.") diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/garden/MoneyPerHourConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/garden/MoneyPerHourConfig.java index a568ebf0f..77c9eddc2 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/garden/MoneyPerHourConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/garden/MoneyPerHourConfig.java @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.config.features.garden; import at.hannibal2.skyhanni.config.FeatureToggle; +import at.hannibal2.skyhanni.config.HasLegacyId; import at.hannibal2.skyhanni.config.core.config.Position; import com.google.gson.annotations.Expose; import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; @@ -12,6 +13,10 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import static at.hannibal2.skyhanni.config.features.garden.MoneyPerHourConfig.CustomFormatEntry.INSTANT_SELL; +import static at.hannibal2.skyhanni.config.features.garden.MoneyPerHourConfig.CustomFormatEntry.NPC_PRICE; +import static at.hannibal2.skyhanni.config.features.garden.MoneyPerHourConfig.CustomFormatEntry.SELL_OFFER; + public class MoneyPerHourConfig { @Expose @ConfigOption(name = "Show Money per Hour", @@ -70,14 +75,43 @@ public class MoneyPerHourConfig { name = "Custom Format", desc = "Set what prices to show") @ConfigEditorDraggableList( - exampleText = { - "§eSell Offer", - "§eInstant Sell", - "§eNPC Price" - }, requireNonEmpty = true ) - public List<Integer> customFormat = new ArrayList<>(Arrays.asList(0, 1, 2)); + public List<CustomFormatEntry> customFormat = new ArrayList<>(Arrays.asList( + SELL_OFFER, + INSTANT_SELL, + NPC_PRICE + )); + + public enum CustomFormatEntry implements HasLegacyId { + SELL_OFFER("§eSell Offer", 0), + INSTANT_SELL("§eInstant Sell", 1), + NPC_PRICE("§eNPC Price", 2), + ; + + private final String str; + private final int legacyId; + + CustomFormatEntry(String str, int legacyId) { + this.str = str; + this.legacyId = legacyId; + } + + // Constructor if new enum elements are added post-migration + CustomFormatEntry(String str) { + this(str, -1); + } + + @Override + public int getLegacyId() { + return legacyId; + } + + @Override + public String toString() { + return str; + } + } @Expose @ConfigOption( diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/garden/cropmilestones/CropMilestonesConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/garden/cropmilestones/CropMilestonesConfig.java index 053ffe900..8f2d5a450 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/garden/cropmilestones/CropMilestonesConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/garden/cropmilestones/CropMilestonesConfig.java @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.config.features.garden.cropmilestones; import at.hannibal2.skyhanni.config.FeatureToggle; +import at.hannibal2.skyhanni.config.HasLegacyId; import at.hannibal2.skyhanni.config.core.config.Position; import com.google.gson.annotations.Expose; import io.github.moulberry.moulconfig.annotations.Accordion; @@ -15,6 +16,14 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import static at.hannibal2.skyhanni.config.features.garden.cropmilestones.CropMilestonesConfig.MilestoneTextEntry.BLOCKS_PER_SECOND; +import static at.hannibal2.skyhanni.config.features.garden.cropmilestones.CropMilestonesConfig.MilestoneTextEntry.CROPS_PER_MINUTE; +import static at.hannibal2.skyhanni.config.features.garden.cropmilestones.CropMilestonesConfig.MilestoneTextEntry.MILESTONE_TIER; +import static at.hannibal2.skyhanni.config.features.garden.cropmilestones.CropMilestonesConfig.MilestoneTextEntry.NUMBER_OUT_OF_TOTAL; +import static at.hannibal2.skyhanni.config.features.garden.cropmilestones.CropMilestonesConfig.MilestoneTextEntry.TIME; +import static at.hannibal2.skyhanni.config.features.garden.cropmilestones.CropMilestonesConfig.MilestoneTextEntry.TITLE; +import static at.hannibal2.skyhanni.config.features.garden.cropmilestones.CropMilestonesConfig.TimeFormatEntry.YEAR; + public class CropMilestonesConfig { @Expose @ConfigOption( @@ -38,8 +47,40 @@ public class CropMilestonesConfig { @ConfigOption( name = "Time Format", desc = "Change the highest time unit to show (1h30m vs 90min)") - @ConfigEditorDropdown(values = {"Year", "Day", "Hour", "Minute", "Second"}) - public Property<Integer> highestTimeFormat = Property.of(0); + @ConfigEditorDropdown() + public Property<TimeFormatEntry> highestTimeFormat = Property.of(YEAR); + + public enum TimeFormatEntry implements HasLegacyId { + YEAR("Year", 0), + DAY("Day", 1), + HOUR("Hour", 2), + MINUTE("Minute", 3), + SECOND("Second", 4), + ; + + private final String str; + private final int legacyId; + + TimeFormatEntry(String str, int legacyId) { + this.str = str; + this.legacyId = legacyId; + } + + // Constructor if new enum elements are added post-migration + TimeFormatEntry(String str) { + this(str, -1); + } + + @Override + public int getLegacyId() { + return legacyId; + } + + @Override + public String toString() { + return str; + } + } @Expose @ConfigOption( @@ -54,18 +95,49 @@ public class CropMilestonesConfig { desc = "Drag text to change the appearance of the overlay.\n" + "Hold a farming tool to show the overlay." ) - @ConfigEditorDraggableList( - exampleText = { - "§6Crop Milestones", - "§7Pumpkin Tier 22", - "§e12,300§8/§e100,000", - "§7In §b12m 34s", - "§7Crops/Minute§8: §e12,345", - "§7Blocks/Second§8: §e19.85", - "§7Percentage: §e12.34%", + @ConfigEditorDraggableList() + public List<MilestoneTextEntry> text = new ArrayList<>(Arrays.asList( + TITLE, + MILESTONE_TIER, + NUMBER_OUT_OF_TOTAL, + TIME, + CROPS_PER_MINUTE, + BLOCKS_PER_SECOND + )); + + public enum MilestoneTextEntry implements HasLegacyId { + TITLE("§6Crop Milestones", 0), + MILESTONE_TIER("§7Pumpkin Tier 22", 1), + NUMBER_OUT_OF_TOTAL("§e12,300§8/§e100,000", 2), + TIME("§7In §b12m 34s", 3), + CROPS_PER_MINUTE("§7Crops/Minute§8: §e12,345", 4), + BLOCKS_PER_SECOND("§7Blocks/Second§8: §e19.85", 5), + PERCENTAGE("§7Percentage: §e12.34%", 6), + ; + + private final String str; + private final int legacyId; + + MilestoneTextEntry(String str, int legacyId) { + this.str = str; + this.legacyId = legacyId; } - ) - public List<Integer> text = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 5)); + + // Constructor if new enum elements are added post-migration + MilestoneTextEntry(String str) { + this(str, -1); + } + + @Override + public int getLegacyId() { + return legacyId; + } + + @Override + public String toString() { + return str; + } + } @Expose @ConfigOption(name = "Block Broken Precision", desc = "The amount of decimals displayed in blocks/second.") diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/garden/cropmilestones/MushroomPetPerkConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/garden/cropmilestones/MushroomPetPerkConfig.java index 66ef83a4c..2cd4cd911 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/garden/cropmilestones/MushroomPetPerkConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/garden/cropmilestones/MushroomPetPerkConfig.java @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.config.features.garden.cropmilestones; import at.hannibal2.skyhanni.config.FeatureToggle; +import at.hannibal2.skyhanni.config.HasLegacyId; import at.hannibal2.skyhanni.config.core.config.Position; import com.google.gson.annotations.Expose; import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; @@ -11,6 +12,11 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import static at.hannibal2.skyhanni.config.features.garden.cropmilestones.MushroomPetPerkConfig.MushroomTextEntry.MUSHROOM_TIER; +import static at.hannibal2.skyhanni.config.features.garden.cropmilestones.MushroomPetPerkConfig.MushroomTextEntry.NUMBER_OUT_OF_TOTAL; +import static at.hannibal2.skyhanni.config.features.garden.cropmilestones.MushroomPetPerkConfig.MushroomTextEntry.TIME; +import static at.hannibal2.skyhanni.config.features.garden.cropmilestones.MushroomPetPerkConfig.MushroomTextEntry.TITLE; + // TODO moulconfig runnable support public class MushroomPetPerkConfig { @Expose @@ -27,16 +33,45 @@ public class MushroomPetPerkConfig { desc = "Drag text to change the appearance of the overlay.\n" + "Hold a farming tool to show the overlay." ) - @ConfigEditorDraggableList( - exampleText = { - "§6Mooshroom Cow Perk", - "§7Mushroom Tier 8", - "§e6,700§8/§e15,000", - "§7In §b12m 34s", - "§7Percentage: §e12.34%", + @ConfigEditorDraggableList() + public List<MushroomTextEntry> text = new ArrayList<>(Arrays.asList( + TITLE, + MUSHROOM_TIER, + NUMBER_OUT_OF_TOTAL, + TIME + )); + + public enum MushroomTextEntry implements HasLegacyId { + TITLE("§6Mooshroom Cow Perk", 0), + MUSHROOM_TIER("§7Mushroom Tier 8", 1), + NUMBER_OUT_OF_TOTAL("§e6,700§8/§e15,000", 2), + TIME("§7In §b12m 34s", 3), + PERCENTAGE("§7Percentage: §e12.34%", 4), + ; + + private final String str; + private final int legacyId; + + MushroomTextEntry(String str, int legacyId) { + this.str = str; + this.legacyId = legacyId; } - ) - public List<Integer> text = new ArrayList<>(Arrays.asList(0, 1, 2, 3)); + + // Constructor if new enum elements are added post-migration + MushroomTextEntry(String str) { + this(str, -1); + } + + @Override + public int getLegacyId() { + return legacyId; + } + + @Override + public String toString() { + return str; + } + } @Expose public Position pos = new Position(-112, -143, false, true); diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/garden/visitor/DropsStatisticsConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/garden/visitor/DropsStatisticsConfig.java index 7fd332d25..6c4b0856f 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/garden/visitor/DropsStatisticsConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/garden/visitor/DropsStatisticsConfig.java @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.config.features.garden.visitor; import at.hannibal2.skyhanni.config.FeatureToggle; +import at.hannibal2.skyhanni.config.HasLegacyId; import at.hannibal2.skyhanni.config.core.config.Position; import com.google.gson.annotations.Expose; import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; @@ -11,6 +12,19 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import static at.hannibal2.skyhanni.config.features.garden.visitor.DropsStatisticsConfig.DropsStatisticsTextEntry.ACCEPTED; +import static at.hannibal2.skyhanni.config.features.garden.visitor.DropsStatisticsConfig.DropsStatisticsTextEntry.COINS_SPENT; +import static at.hannibal2.skyhanni.config.features.garden.visitor.DropsStatisticsConfig.DropsStatisticsTextEntry.COPPER; +import static at.hannibal2.skyhanni.config.features.garden.visitor.DropsStatisticsConfig.DropsStatisticsTextEntry.DEDICATION_IV; +import static at.hannibal2.skyhanni.config.features.garden.visitor.DropsStatisticsConfig.DropsStatisticsTextEntry.DENIED; +import static at.hannibal2.skyhanni.config.features.garden.visitor.DropsStatisticsConfig.DropsStatisticsTextEntry.FARMING_EXP; +import static at.hannibal2.skyhanni.config.features.garden.visitor.DropsStatisticsConfig.DropsStatisticsTextEntry.GREEN_BANDANA; +import static at.hannibal2.skyhanni.config.features.garden.visitor.DropsStatisticsConfig.DropsStatisticsTextEntry.OVERGROWN_GRASS; +import static at.hannibal2.skyhanni.config.features.garden.visitor.DropsStatisticsConfig.DropsStatisticsTextEntry.SPACER_1; +import static at.hannibal2.skyhanni.config.features.garden.visitor.DropsStatisticsConfig.DropsStatisticsTextEntry.TITLE; +import static at.hannibal2.skyhanni.config.features.garden.visitor.DropsStatisticsConfig.DropsStatisticsTextEntry.TOTAL_VISITORS; +import static at.hannibal2.skyhanni.config.features.garden.visitor.DropsStatisticsConfig.DropsStatisticsTextEntry.VISITORS_BY_RARITY; + public class DropsStatisticsConfig { @Expose @@ -27,34 +41,70 @@ public class DropsStatisticsConfig { name = "Text Format", desc = "Drag text to change the appearance of the overlay." ) - @ConfigEditorDraggableList( - exampleText = { - "§e§lVisitor Statistics", - "§e1,636 Total", - "§a1,172§f-§9382§f-§681§f-§c1", - "§21,382 Accepted", - "§c254 Denied", - " ", - "§c62,072 Copper", - "§33.2m Farming EXP", - "§647.2m Coins Spent", - "§b23 §9Flowering Bouquet", - "§b4 §9Overgrown Grass", - "§b2 §5Green Bandana", - "§b1 §9Dedication IV", - "§b6 §b◆ Music Rune I", - "§b1 §cSpace Helmet", - "§b1 §9Cultivating I", - "§b1 §9Replenish I", - " ", // If they want another empty row - "§212,600 Garden EXP", - "§b4.2k Bits", - "§220k Mithril Powder", - "§d18k Gemstone Powder", + @ConfigEditorDraggableList() + public List<DropsStatisticsTextEntry> textFormat = new ArrayList<>(Arrays.asList( + TITLE, + TOTAL_VISITORS, + VISITORS_BY_RARITY, + ACCEPTED, + DENIED, + SPACER_1, + COPPER, + FARMING_EXP, + COINS_SPENT, + OVERGROWN_GRASS, + GREEN_BANDANA, + DEDICATION_IV + )); + + public enum DropsStatisticsTextEntry implements HasLegacyId { + TITLE("§e§lVisitor Statistics", 0), + TOTAL_VISITORS("§e1,636 Total", 1), + VISITORS_BY_RARITY("§a1,172§f-§9382§f-§681§f-§d2§f-§c1", 2), + ACCEPTED("§21,382 Accepted", 3), + DENIED("§c254 Denied", 4), + SPACER_1(" ", 5), + COPPER("§c62,072 Copper", 6), + FARMING_EXP("§33.2m Farming EXP", 7), + COINS_SPENT("§647.2m Coins Spent", 8), + FLOWERING_BOUQUET("§b23 §9Flowering Bouquet", 9), + OVERGROWN_GRASS("§b4 §9Overgrown Grass", 10), + GREEN_BANDANA("§b2 §5Green Bandana", 11), + DEDICATION_IV("§b1 §9Dedication IV", 12), + MUSIC_RUNE_I("§b6 §b◆ Music Rune I", 13), + SPACE_HELMET("§b1 §cSpace Helmet", 14), + CULTIVATING_I("§b1 §9Cultivating I", 15), + REPLENISH_I("§b1 §9Replenish I", 16), + SPACER_2(" ", 17), + GARDEN_EXP("§212,600 Garden EXP", 18), + BITS("§b4.2k Bits", 19), + MITHRIL_POWDER("§220k Mithril Powder", 20), + GEMSTONE_POWDER("§d18k Gemstone Powder", 21), + ; + + private final String str; + private final int legacyId; + + DropsStatisticsTextEntry(String str, int legacyId) { + this.str = str; + this.legacyId = legacyId; } - ) - public List<Integer> textFormat = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12)); + // Constructor if new enum elements are added post-migration + DropsStatisticsTextEntry(String str) { + this(str, -1); + } + + @Override + public int getLegacyId() { + return legacyId; + } + + @Override + public String toString() { + return str; + } + } @Expose @ConfigOption(name = "Display Numbers First", desc = "Determines whether the number or drop name displays first. " + diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/garden/visitor/RewardWarningConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/garden/visitor/RewardWarningConfig.java index f83fc5518..bd3f158ff 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/garden/visitor/RewardWarningConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/garden/visitor/RewardWarningConfig.java @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.config.features.garden.visitor; import at.hannibal2.skyhanni.config.FeatureToggle; +import at.hannibal2.skyhanni.config.HasLegacyId; import com.google.gson.annotations.Expose; import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; import io.github.moulberry.moulconfig.annotations.ConfigEditorDraggableList; @@ -12,6 +13,13 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import static at.hannibal2.skyhanni.config.features.garden.visitor.RewardWarningConfig.ItemWarnEntry.CULTIVATING_I; +import static at.hannibal2.skyhanni.config.features.garden.visitor.RewardWarningConfig.ItemWarnEntry.DEDICATION_IV; +import static at.hannibal2.skyhanni.config.features.garden.visitor.RewardWarningConfig.ItemWarnEntry.GREEN_BANDANA; +import static at.hannibal2.skyhanni.config.features.garden.visitor.RewardWarningConfig.ItemWarnEntry.MUSIC_RUNE; +import static at.hannibal2.skyhanni.config.features.garden.visitor.RewardWarningConfig.ItemWarnEntry.OVERGROWN_GRASS; +import static at.hannibal2.skyhanni.config.features.garden.visitor.RewardWarningConfig.ItemWarnEntry.SPACE_HELMET; + public class RewardWarningConfig { @Expose @@ -58,5 +66,47 @@ public class RewardWarningConfig { "§9Replenish I", } ) - public List<Integer> drops = new ArrayList<>(Arrays.asList(1, 2, 3, 4, 5, 6)); + public List<ItemWarnEntry> drops = new ArrayList<>(Arrays.asList( + OVERGROWN_GRASS, + GREEN_BANDANA, + DEDICATION_IV, + MUSIC_RUNE, + SPACE_HELMET, + CULTIVATING_I + )); + + public enum ItemWarnEntry implements HasLegacyId { + FLOWERING_BOUQUET("§9Flowering Bouquet", 0), + OVERGROWN_GRASS("§9Overgrown Grass", 1), + GREEN_BANDANA("§9Green Bandana", 2), + DEDICATION_IV("§9Dedication IV", 3), + MUSIC_RUNE("§9Music Rune", 4), + SPACE_HELMET("§cSpace Helmet", 5), + CULTIVATING_I("§9Cultivating I", 6), + REPLENISH_I("§9Replenish I", 7), + ; + + private final String str; + private final int legacyId; + + ItemWarnEntry(String str, int legacyId) { + this.str = str; + this.legacyId = legacyId; + } + + // Constructor if new enum elements are added post-migration + ItemWarnEntry(String str) { + this(str, -1); + } + + @Override + public int getLegacyId() { + return legacyId; + } + + @Override + public String toString() { + return str; + } + } } diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/InventoryConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/InventoryConfig.java index d124e6982..0586e9e33 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/InventoryConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/InventoryConfig.java @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.config.features.inventory; import at.hannibal2.skyhanni.config.FeatureToggle; +import at.hannibal2.skyhanni.config.HasLegacyId; import at.hannibal2.skyhanni.config.features.inventory.helper.HelperConfig; import com.google.gson.annotations.Expose; import io.github.moulberry.moulconfig.annotations.Accordion; @@ -13,6 +14,11 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import static at.hannibal2.skyhanni.config.features.inventory.InventoryConfig.ItemNumberEntry.LARVA_HOOK; +import static at.hannibal2.skyhanni.config.features.inventory.InventoryConfig.ItemNumberEntry.NEW_YEAR_CAKE; +import static at.hannibal2.skyhanni.config.features.inventory.InventoryConfig.ItemNumberEntry.RANCHERS_BOOTS_SPEED; +import static at.hannibal2.skyhanni.config.features.inventory.InventoryConfig.ItemNumberEntry.VACUUM_GARDEN; + public class InventoryConfig { @Expose @@ -55,28 +61,57 @@ public class InventoryConfig { name = "Item Number", desc = "Showing the item number as a stack size for these items." ) - @ConfigEditorDraggableList( - exampleText = { - "§bMaster Star Tier", - "§bMaster Skull Tier", - "§bDungeon Head Floor Number", - "§bNew Year Cake", - "§bPet Level", - "§bMinion Tier", - "§bCrimson Armor", - "§7(Removed)", - "§bKuudra Key", - "§bSkill Level", - "§bCollection Level", - "§bRancher's Boots speed", - "§bLarva Hook", - "§bDungeon Potion Level", - "§bVacuum (Garden)", - "§bBottle Of Jyrre", - "§bEdition Number" + @ConfigEditorDraggableList() + public List<ItemNumberEntry> itemNumberAsStackSize = new ArrayList<>(Arrays.asList( + NEW_YEAR_CAKE, + RANCHERS_BOOTS_SPEED, + LARVA_HOOK, + VACUUM_GARDEN + )); + + public enum ItemNumberEntry implements HasLegacyId { + MASTER_STAR_TIER("§bMaster Star Tier", 0), + MASTER_SKULL_TIER("§bMaster Skull Tier", 1), + DUNGEON_HEAD_FLOOR_NUMBER("§bDungeon Head Floor Number", 2), + NEW_YEAR_CAKE("§bNew Year Cake", 3), + PET_LEVEL("§bPet Level", 4), + MINION_TIER("§bMinion Tier", 5), + CRIMSON_ARMOR("§bCrimson Armor", 6), + REMOVED("§7(Removed)", 7), + KUUDRA_KEY("§bKuudra Key", 8), + SKILL_LEVEL("§bSkill Level", 9), + COLLECTION_LEVEL("§bCollection Level", 10), + RANCHERS_BOOTS_SPEED("§bRancher's Boots speed", 11), + LARVA_HOOK("§bLarva Hook", 12), + DUNGEON_POTION_LEVEL("§bDungeon Potion Level", 13), + VACUUM_GARDEN("§bVacuum (Garden)", 14), + BOTTLE_OF_JYRRE("§bBottle Of Jyrre", 15), + EDITION_NUMBER("§bEdition Number", 16), + ; + + private final String str; + private final int legacyId; + + ItemNumberEntry(String str, int legacyId) { + this.str = str; + this.legacyId = legacyId; } - ) - public List<Integer> itemNumberAsStackSize = new ArrayList<>(Arrays.asList(3, 11, 12, 14)); + + // Constructor if new enum elements are added post-migration + ItemNumberEntry(String str) { + this(str, -1); + } + + @Override + public int getLegacyId() { + return legacyId; + } + + @Override + public String toString() { + return str; + } + } @Expose @ConfigOption(name = " Vacuum Bag Cap", desc = "Capping the Garden Vacuum Bag item number display to 40.") diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/mining/PowderTrackerConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/mining/PowderTrackerConfig.java index 50bff2a9b..1e658c5a2 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/mining/PowderTrackerConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/mining/PowderTrackerConfig.java @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.config.features.mining; import at.hannibal2.skyhanni.config.FeatureToggle; +import at.hannibal2.skyhanni.config.HasLegacyId; import at.hannibal2.skyhanni.config.core.config.Position; import com.google.gson.annotations.Expose; import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; @@ -12,6 +13,26 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.AMBER; +import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.AMETHYST; +import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.DIAMOND_ESSENCE; +import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.DISPLAY_MODE; +import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.DOUBLE_POWDER; +import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.ELECTRON; +import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.FTX; +import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.GEMSTONE_POWDER; +import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.GOLD_ESSENCE; +import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.JADE; +import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.MITHRIL_POWDER; +import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.ROBOTRON; +import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.RUBY; +import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.SAPPHIRE; +import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.SPACER_1; +import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.SPACER_2; +import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.TITLE; +import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.TOPAZ; +import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.TOTAL_CHESTS; + public class PowderTrackerConfig { @Expose @@ -35,48 +56,88 @@ public class PowderTrackerConfig { name = "Text Format", desc = "Drag text to change the appearance of the overlay." ) - @ConfigEditorDraggableList( - exampleText = { - "§b§lPowder Tracker", - "§7Display Mode: §a[Total] §e[This Session]", - "§d852 Total chests Picked §7(950/h)", - "§bx2 Powder: §aActive!", - "§b250,420 §aMithril Powder §7(350,000/h)", - "§b250,420 §dGemstone Powder §7(350,000/h)", - "", - "§b129 §bDiamond Essence §7(600/h)", - "§b234 §6Gold Essence §7(700/h)", - "", - "§50§7-§90§7-§a0§f-0 §cRuby Gemstone", - "§50§7-§90§7-§a0§f-0 §bSapphire Gemstone", - "§50§7-§90§7-§a0§f-0 §6Amber Gemstone", - "§50§7-§90§7-§a0§f-0 §5Amethyst Gemstone", - "§50§7-§90§7-§a0§f-0 §aJade Gemstone", - "§50§7-§90§7-§a0§f-0 §eTopaz Gemstone", - - "§b14 §9FTX 3070", - "§b14 §9Electron Transmitter", - "§b14 §9Robotron Reflector", - "§b14 §9Superlite Motor", - "§b14 §9Control Switch", - "§b14 §9Synthetic Heart", - "§b14 §9Total Robot Parts", - - "§90§7-§a0§7-§c0§f-§e0§f-§30 §fGoblin Egg", - - "§b12 §aWishing Compass", - - "§b320 §aSludge Juice", - "§b2 §9Ascension Rope", - "§b6 §5Treasurite", - "§b4 §6Jungle Heart", - "§b1 §5Pickonimbus 2000", - "§b14 §aYoggie", - "§b9 §fPrehistoric Egg", - "§b25 §aOil Barrel" + @ConfigEditorDraggableList() + public Property<List<PowderDisplayEntry>> textFormat = Property.of(new ArrayList<>(Arrays.asList( + TITLE, + DISPLAY_MODE, + TOTAL_CHESTS, + DOUBLE_POWDER, + MITHRIL_POWDER, + GEMSTONE_POWDER, + SPACER_1, + DIAMOND_ESSENCE, + GOLD_ESSENCE, + SPACER_2, + RUBY, + SAPPHIRE, + AMBER, + AMETHYST, + JADE, + TOPAZ, + FTX, + ELECTRON, + ROBOTRON + ))); + + public enum PowderDisplayEntry implements HasLegacyId { + TITLE("§b§lPowder Tracker", 0), + DISPLAY_MODE("§7Display Mode: §a[Total] §e[This Session]", 1), + TOTAL_CHESTS("§d852 Total chests Picked §7(950/h)", 2), + DOUBLE_POWDER("§bx2 Powder: §aActive!", 3), + MITHRIL_POWDER("§b250,420 §aMithril Powder §7(350,000/h)", 4), + GEMSTONE_POWDER("§b250,420 §dGemstone Powder §7(350,000/h)", 5), + SPACER_1("", 6), + DIAMOND_ESSENCE("§b129 §bDiamond Essence §7(600/h)", 7), + GOLD_ESSENCE("§b234 §6Gold Essence §7(700/h)", 8), + SPACER_2("", 9), + RUBY("§50§7-§90§7-§a0§f-0 §cRuby Gemstone", 10), + SAPPHIRE("§50§7-§90§7-§a0§f-0 §bSapphire Gemstone", 11), + AMBER("§50§7-§90§7-§a0§f-0 §6Amber Gemstone", 12), + AMETHYST("§50§7-§90§7-§a0§f-0 §5Amethyst Gemstone", 13), + JADE("§50§7-§90§7-§a0§f-0 §aJade Gemstone", 14), + TOPAZ("§50§7-§90§7-§a0§f-0 §eTopaz Gemstone", 15), + FTX("§b14 §9FTX 3070", 16), + ELECTRON("§b14 §9Electron Transmitter", 17), + ROBOTRON("§b14 §9Robotron Reflector", 18), + SUPERLITE("§b14 §9Superlite Motor", 19), + CONTROL_SWITCH("§b14 §9Control Switch", 20), + SYNTHETIC_HEART("§b14 §9Synthetic Heart", 21), + TOTAL_ROBOT_PARTS("§b14 §9Total Robot Parts", 22), + GOBLIN_EGGS("§90§7-§a0§7-§c0§f-§e0§f-§30 §fGoblin Egg", 23), + WISHING_COMPASS("§b12 §aWishing Compass", 24), + SLUDGE_JUICE("§b320 §aSludge Juice", 25), + ASCENSION_ROPE("§b2 §9Ascension Rope", 26), + TREASURITE("§b6 §5Treasurite", 27), + JUNGLE_HEART("§b4 §6Jungle Heart", 28), + PICKONIMBUS("§b1 §5Pickonimbus 2000", 29), + YOGGIE("§b14 §aYoggie", 30), + PREHISTORIC_EGG("§b9 §fPrehistoric Egg", 31), + OIL_BARREL("§b25 §aOil Barrel", 32), + ; + + private final String str; + private final int legacyId; + + PowderDisplayEntry(String str, int legacyId) { + this.str = str; + this.legacyId = legacyId; } - ) - public Property<List<Integer>> textFormat = Property.of(new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18))); + + // Constructor if new enum elements are added post-migration + PowderDisplayEntry(String str) { + this(str, -1); + } + + @Override + public int getLegacyId() { + return legacyId; + } + + @Override + public String toString() { + return str; + } + } @Expose public Position position = new Position(-274, 0, false, true); diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/misc/DiscordRPCConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/misc/DiscordRPCConfig.java index ab4a18d47..aa7a1d4b7 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/misc/DiscordRPCConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/misc/DiscordRPCConfig.java @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.config.features.misc; import at.hannibal2.skyhanni.config.FeatureToggle; +import at.hannibal2.skyhanni.config.HasLegacyId; import com.google.gson.annotations.Expose; import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; import io.github.moulberry.moulconfig.annotations.ConfigEditorDraggableList; @@ -13,6 +14,13 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import static at.hannibal2.skyhanni.config.features.misc.DiscordRPCConfig.LineEntry.NOTHING; +import static at.hannibal2.skyhanni.config.features.misc.DiscordRPCConfig.PriorityEntry.AFK; +import static at.hannibal2.skyhanni.config.features.misc.DiscordRPCConfig.PriorityEntry.CROP_MILESTONES; +import static at.hannibal2.skyhanni.config.features.misc.DiscordRPCConfig.PriorityEntry.DUNGEONS; +import static at.hannibal2.skyhanni.config.features.misc.DiscordRPCConfig.PriorityEntry.SLAYER; +import static at.hannibal2.skyhanni.config.features.misc.DiscordRPCConfig.PriorityEntry.STACKING_ENCHANT; + public class DiscordRPCConfig { @Expose @@ -23,41 +31,13 @@ public class DiscordRPCConfig { @Expose @ConfigOption(name = "First Line", desc = "Decide what to show in the first line.") - @ConfigEditorDropdown(values = { - "Nothing", - "Location", - "Purse", - "Bits", - "Stats", - "Held Item", - "SkyBlock Date", - "Profile", - "Slayer", - "Custom", - "Dynamic", - "Crop Milestone", - "Current Pet" - }) - public Property<Integer> firstLine = Property.of(0); + @ConfigEditorDropdown() + public Property<LineEntry> firstLine = Property.of(NOTHING); @Expose @ConfigOption(name = "Second Line", desc = "Decide what to show in the second line.") - @ConfigEditorDropdown(values = { - "Nothing", - "Location", - "Purse", - "Bits", - "Stats", - "Held Item", - "SkyBlock Date", - "Profile", - "Slayer", - "Custom", - "Dynamic", - "Crop Milestone", - "Current Pet" - }) - public Property<Integer> secondLine = Property.of(0); + @ConfigEditorDropdown() + public Property<LineEntry> secondLine = Property.of(NOTHING); @Expose @ConfigOption(name = "Custom", desc = "What should be displayed if you select \"Custom\" above.") @@ -66,32 +46,89 @@ public class DiscordRPCConfig { @Expose @ConfigOption(name = "Dynamic Priority", desc = "Disable certain dynamic statuses, or change the priority in case two are triggered at the same time (higher up means higher priority).") - @ConfigEditorDraggableList( - exampleText = { - "Crop Milestones", - "Slayer", - "Stacking Enchantment", - "Dungeon", - "AFK Indicator" + @ConfigEditorDraggableList() + public List<PriorityEntry> autoPriority = new ArrayList<>(Arrays.asList( + CROP_MILESTONES, + SLAYER, + STACKING_ENCHANT, + DUNGEONS, + AFK + )); + + public enum PriorityEntry implements HasLegacyId { + CROP_MILESTONES("Crop Milestones", 0), + SLAYER("Slayer", 1), + STACKING_ENCHANT("Stacking Enchantment", 2), + DUNGEONS("Dungeon", 3), + AFK("AFK Indicator", 4), + ; + + private final String str; + private final int legacyId; + + PriorityEntry(String str, int legacyId) { + this.str = str; + this.legacyId = legacyId; + } + + // Constructor if new enum elements are added post-migration + PriorityEntry(String str) { + this(str, -1); + } + + @Override + public int getLegacyId() { + return legacyId; + } + + @Override + public String toString() { + return str; } - ) - public List<Integer> autoPriority = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4)); + } @Expose @ConfigOption(name = "Dynamic Fallback", desc = "What to show when none of your \"Dynamic Priority\" statuses are active.") - @ConfigEditorDropdown(values = { - "Nothing", - "Location", - "Purse", - "Bits", - "Stats", - "Held Item", - "SkyBlock Date", - "Profile", - "Slayer", - "Custom", - "Crop Milestone", - "Current Pet" - }) - public Property<Integer> auto = Property.of(0); + @ConfigEditorDropdown() + public Property<LineEntry> auto = Property.of(NOTHING); + + public enum LineEntry implements HasLegacyId { + NOTHING("Nothing", 0), + LOCATION("Location", 1), + PURSE("Purse", 2), + BITS("Bits", 3), + STATS("Stats", 4), + HELD_ITEM("Held Item", 5), + SKYBLOCK_DATE("SkyBlock Date", 6), + PROFILE("Profile", 7), + SLAYER("Slayer", 8), + CUSTOM("Custom", 9), + DYNAMIC("Dynamic", 10), + CROP_MILESTONE("Crop Milestone", 11), + CURRENT_PET("Current Pet", 12), + ; + + private final String str; + private final int legacyId; + + LineEntry(String str, int legacyId) { + this.str = str; + this.legacyId = legacyId; + } + + // Constructor if new enum elements are added post-migration + LineEntry(String str) { + this(str, -1); + } + + @Override + public int getLegacyId() { + return legacyId; + } + + @Override + public String toString() { + return str; + } + } } diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/misc/TrevorTheTrapperConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/misc/TrevorTheTrapperConfig.java index 0c4226034..025125c4f 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/misc/TrevorTheTrapperConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/misc/TrevorTheTrapperConfig.java @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.config.features.misc; import at.hannibal2.skyhanni.config.FeatureToggle; +import at.hannibal2.skyhanni.config.HasLegacyId; import at.hannibal2.skyhanni.config.core.config.Position; import com.google.gson.annotations.Expose; import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; @@ -13,6 +14,18 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import static at.hannibal2.skyhanni.config.features.misc.TrevorTheTrapperConfig.TrackerEntry.ELUSIVE; +import static at.hannibal2.skyhanni.config.features.misc.TrevorTheTrapperConfig.TrackerEntry.ENDANGERED; +import static at.hannibal2.skyhanni.config.features.misc.TrevorTheTrapperConfig.TrackerEntry.KILLED; +import static at.hannibal2.skyhanni.config.features.misc.TrevorTheTrapperConfig.TrackerEntry.PELTS_PER_HOUR; +import static at.hannibal2.skyhanni.config.features.misc.TrevorTheTrapperConfig.TrackerEntry.QUESTS_STARTED; +import static at.hannibal2.skyhanni.config.features.misc.TrevorTheTrapperConfig.TrackerEntry.SPACER_1; +import static at.hannibal2.skyhanni.config.features.misc.TrevorTheTrapperConfig.TrackerEntry.TITLE; +import static at.hannibal2.skyhanni.config.features.misc.TrevorTheTrapperConfig.TrackerEntry.TOTAL_PELTS; +import static at.hannibal2.skyhanni.config.features.misc.TrevorTheTrapperConfig.TrackerEntry.TRACKABLE; +import static at.hannibal2.skyhanni.config.features.misc.TrevorTheTrapperConfig.TrackerEntry.UNDETECTED; +import static at.hannibal2.skyhanni.config.features.misc.TrevorTheTrapperConfig.TrackerEntry.UNTRACKABLE; + public class TrevorTheTrapperConfig { @Expose @@ -39,23 +52,59 @@ public class TrevorTheTrapperConfig { name = "Text Format", desc = "Drag text to change the appearance of the overlay." ) - @ConfigEditorDraggableList( - exampleText = { - "§b§lTrevor Data Tracker", - "§b1,428 §9Quests Started", - "§b11,281 §5Total Pelts Gained", - "§b2,448 §5Pelts Per Hour", - "", - "§b850 §cKilled Animals", - "§b153 §cSelf Killing Animals", - "§b788 §fTrackable Animals", - "§b239 §aUntrackable Animals", - "§b115 §9Undetected Animals", - "§b73 §5Endangered Animals", - "§b12 §6Elusive Animals" + @ConfigEditorDraggableList() + public List<TrackerEntry> textFormat = new ArrayList<>(Arrays.asList( + TITLE, + QUESTS_STARTED, + TOTAL_PELTS, + PELTS_PER_HOUR, + SPACER_1, + KILLED, + TRACKABLE, + UNTRACKABLE, + UNDETECTED, + ENDANGERED, + ELUSIVE + )); + + public enum TrackerEntry implements HasLegacyId { + TITLE("§b§lTrevor Data Tracker", 0), + QUESTS_STARTED("§b1,428 §9Quests Started", 1), + TOTAL_PELTS("§b11,281 §5Total Pelts Gained", 2), + PELTS_PER_HOUR("§b2,448 §5Pelts Per Hour", 3), + SPACER_1("", 4), + KILLED("§b850 §cKilled Animals", 5), + SELF_KILLING("§b153 §cSelf Killing Animals", 6), + TRACKABLE("§b788 §fTrackable Animals", 7), + UNTRACKABLE("§b239 §aUntrackable Animals", 8), + UNDETECTED("§b115 §9Undetected Animals", 9), + ENDANGERED("§b73 §5Endangered Animals", 10), + ELUSIVE("§b12 §6Elusive Animals", 11), + ; + + private final String str; + private final int legacyId; + + TrackerEntry(String str, int legacyId) { + this.str = str; + this.legacyId = legacyId; } - ) - public List<Integer> textFormat = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 5, 7, 8, 9, 10, 11)); + + // Constructor if new enum elements are added post-migration + TrackerEntry(String str) { + this(str, -1); + } + + @Override + public int getLegacyId() { + return legacyId; + } + + @Override + public String toString() { + return str; + } + } @Expose public Position position = new Position(10, 80, false, true); 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 } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ConfigUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ConfigUtils.kt new file mode 100644 index 000000000..99ed4b231 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/utils/ConfigUtils.kt @@ -0,0 +1,63 @@ +package at.hannibal2.skyhanni.utils + +import at.hannibal2.skyhanni.config.HasLegacyId +import com.google.gson.JsonArray +import com.google.gson.JsonElement +import com.google.gson.JsonPrimitive + +object ConfigUtils { + + /** + * Migrates an Int ArrayList to an Enum ArrayList. + * The new enum class should implement HasLegacyId and have a getter for LegacyId + * + * @param element The JsonElement to migrate + * @param enumClass The enum class to migrate to + * @return The migrated JsonElement + */ + fun <T> migrateIntArrayListToEnumArrayList(element: JsonElement, enumClass: Class<T>): JsonElement + where T : Enum<T>, T : HasLegacyId { + require(element is JsonArray) { "Expected a JsonArray but got ${element.javaClass.simpleName}" } + + // An array of enum constants that are to be migrated + val migratedArray = element.mapNotNull { jsonElement -> + val index = jsonElement.asInt + getEnumConstantFromLegacyId(index, enumClass)?.name + }.map { JsonPrimitive(it) } + + // Return a JsonArray of the migrated enum constants + return JsonArray().apply { + migratedArray.forEach { add(it) } + } + } + + /** + * Gets an enum constant from a legacy id + * @param legacyId The legacy id to get the enum constant from + * @param enumClass The enum class to get the enum constant from + * @return The enum constant, or null if not found + */ + private fun <T> getEnumConstantFromLegacyId( + legacyId: Int, + enumClass: Class<T> + ): T? where T : Enum<T>, T : HasLegacyId { + for (enumConstant in enumClass.getEnumConstants()) { + if (enumConstant.legacyId == legacyId) return enumConstant + } + return null + } + + /** + * Migrates an Int to an Enum Constant. + * The new enum class should implement HasLegacyId and have a getter for LegacyId + * + * @param element The JsonElement to migrate + * @param enumClass The enum class to migrate to + * @return The migrated JsonElement + */ + fun <T> migrateIntToEnum(element: JsonElement, enumClass: Class<T>): JsonElement + where T : Enum<T>, T : HasLegacyId { + require(element is JsonPrimitive) { "Expected a JsonPrimitive but got ${element.javaClass.simpleName}" } + return JsonPrimitive(getEnumConstantFromLegacyId(element.asInt, enumClass)?.name) + } +} |