diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt index 2d9f8ca50ca2..66688cf3289f 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt @@ -624,7 +624,7 @@ object Commands { event.register("shtestrabbitpaths") { description = "Tests pathfinding to rabbit eggs. Use a number 0-14." category = CommandCategory.DEVELOPER_TEST - callback { HoppityEggLocator.testPathfind(it) } + callback { HoppityEggLocator.testPathFind(it) } } event.register("shtestitem") { description = "test item internal name resolving" diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/event/hoppity/HoppityChatConfig.kt b/src/main/java/at/hannibal2/skyhanni/config/features/event/hoppity/HoppityChatConfig.kt new file mode 100644 index 000000000000..370f2d55e087 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/config/features/event/hoppity/HoppityChatConfig.kt @@ -0,0 +1,65 @@ +package at.hannibal2.skyhanni.config.features.event.hoppity + +import at.hannibal2.skyhanni.config.FeatureToggle +import com.google.gson.annotations.Expose +import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean +import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorDropdown +import io.github.notenoughupdates.moulconfig.annotations.ConfigOption + +class HoppityChatConfig { + @Expose + @ConfigOption(name = "Compact Chat", desc = "Compact chat events when finding a Hoppity Egg.") + @ConfigEditorBoolean + @FeatureToggle + var compact: Boolean = false + + @Expose + @ConfigOption(name = "Compacted Rarity", desc = "Show rarity of found rabbit in Compacted chat messages.") + @ConfigEditorDropdown + var rarityInCompact: CompactRarityTypes = CompactRarityTypes.NEW + + enum class CompactRarityTypes(private val displayName: String) { + NONE("Neither"), + NEW("New Rabbits"), + DUPE("Duplicate Rabbits"), + BOTH("New & Duplicate Rabbits"), + ; + + override fun toString() = displayName + } + + @Expose + @ConfigOption( + name = "Compact Hitman", + desc = "Show a summary message instead of individual messages for Hitman \"Claim All\" menu.\n" + + "§cRequires Compact Chat enabled to work." + ) + @ConfigEditorBoolean + @FeatureToggle + var compactHitman: Boolean = false + + @Expose + @ConfigOption( + name = "Show Duplicate Count", + desc = "Show the number of previous finds of a duplicate Hoppity rabbit in chat messages." + ) + @ConfigEditorBoolean + var showDuplicateNumber: Boolean = false + + @Expose + @ConfigOption( + name = "Recolor Time-Towered Chocolate", + desc = "Recolor raw chocolate gain from duplicate rabbits while Time Tower is active." + ) + @ConfigEditorBoolean + var recolorTTChocolate: Boolean = false + + @Expose + @ConfigOption( + name = "Time in Chat", + desc = "When the Egglocator can't find an egg, show the time until the next Hoppity event or egg spawn." + ) + @ConfigEditorBoolean + @FeatureToggle + var eggLocatorTimeInChat: Boolean = true +} diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/event/hoppity/HoppityEggsConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/event/hoppity/HoppityEggsConfig.java deleted file mode 100644 index 5c7af9a0b184..000000000000 --- a/src/main/java/at/hannibal2/skyhanni/config/features/event/hoppity/HoppityEggsConfig.java +++ /dev/null @@ -1,259 +0,0 @@ -package at.hannibal2.skyhanni.config.features.event.hoppity; - -import at.hannibal2.skyhanni.config.FeatureToggle; -import at.hannibal2.skyhanni.config.core.config.Position; -import com.google.gson.annotations.Expose; -import io.github.notenoughupdates.moulconfig.annotations.Accordion; -import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean; -import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorColour; -import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorDropdown; -import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorSlider; -import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorText; -import io.github.notenoughupdates.moulconfig.annotations.ConfigLink; -import io.github.notenoughupdates.moulconfig.annotations.ConfigOption; - -public class HoppityEggsConfig { - - @Expose - @ConfigOption(name = "Hoppity Abiphone Calls", desc = "") - @Accordion - public HoppityCallWarningConfig hoppityCallWarning = new HoppityCallWarningConfig(); - - @Expose - @ConfigOption(name = "Hoppity Hunt Stats Summary", desc = "") - @Accordion - public HoppityEventSummaryConfig eventSummary = new HoppityEventSummaryConfig(); - - @Expose - @ConfigOption(name = "Warp Menu", desc = "") - @Accordion - public HoppityWarpMenuConfig warpMenu = new HoppityWarpMenuConfig(); - - @Expose - @ConfigOption(name = "Stray Timer", desc = "") - @Accordion - public HoppityStrayTimerConfig strayTimer = new HoppityStrayTimerConfig(); - - @Expose - @ConfigOption(name = "Hoppity Waypoints", desc = "Toggle guess waypoints for Hoppity's Hunt.") - @ConfigEditorBoolean - @FeatureToggle - public boolean waypoints = true; - - @Expose - @ConfigOption( - name = "Show Waypoints Immediately", - desc = "Show an estimated waypoint immediately after clicking.\n" + - "§cThis might cause issues with other particle sources." - ) - @ConfigEditorBoolean - public boolean waypointsImmediately = false; - - @Expose - @ConfigOption(name = "Color", desc = "Color of the waypoint.") - @ConfigEditorColour - public String waypointColor = "0:53:46:224:73"; - - @Expose - @ConfigOption(name = "Show Line", desc = "Show a line to the waypoint.") - @ConfigEditorBoolean - @FeatureToggle - public boolean showLine = false; - - @Expose - @ConfigOption(name = "Show Path Finder", desc = "Show a pathfind to the next hoppity egg.") - @ConfigEditorBoolean - @FeatureToggle - public boolean showPathFinder = false; - - @Expose - @ConfigOption(name = "Show All Waypoints", desc = "Show all possible egg waypoints for the current lobby. §e" + - "Only works when you don't have an Egglocator in your inventory.") - @ConfigEditorBoolean - public boolean showAllWaypoints = false; - - @Expose - @ConfigOption(name = "Hide Duplicate Waypoints", desc = "Hide egg waypoints you have already found.\n" + - "§eOnly works when you don't have an Egglocator in your inventory.") - @ConfigEditorBoolean - @FeatureToggle - public boolean hideDuplicateWaypoints = false; - - @Expose - @ConfigOption(name = "Mark Duplicate Locations", desc = "Marks egg location waypoints which you have already found in red.") - @ConfigEditorBoolean - @FeatureToggle - public boolean highlightDuplicateEggLocations = false; - - @Expose - @ConfigOption(name = "Mark Nearby Duplicates", desc = "Always show duplicate egg locations when nearby.") - @ConfigEditorBoolean - @FeatureToggle - public boolean showNearbyDuplicateEggLocations = false; - - @Expose - @ConfigOption(name = "Load from NEU PV", desc = "Load Hoppity Egg Location data from API when opening the NEU Profile Viewer.") - @ConfigEditorBoolean - @FeatureToggle - public boolean loadFromNeuPv = true; - - @Expose - @ConfigOption(name = "Show Unclaimed Eggs", desc = "Display which eggs haven't been found in the last SkyBlock day.") - @ConfigEditorBoolean - @FeatureToggle - public boolean showClaimedEggs = false; - - @Expose - @ConfigOption(name = "Unclaimed Eggs Order", desc = "Order in which to display unclaimed eggs.") - @ConfigEditorDropdown - public UnclaimedEggsOrder unclaimedEggsOrder = UnclaimedEggsOrder.SOONEST_FIRST; - - public enum UnclaimedEggsOrder { - SOONEST_FIRST("Soonest First"), - MEAL_ORDER("Meal Order"), - ; - - private final String name; - - UnclaimedEggsOrder(String name) { - this.name = name; - } - - @Override - public String toString() { - return name; - } - } - - @Expose - @ConfigOption( - name = "Show Collected Locations", desc = "Show the number of found egg locations on this island.\n" + - "§eThis is not retroactive and may not be fully synced with Hypixel's count." - ) - @ConfigEditorBoolean - @FeatureToggle - public boolean showCollectedLocationCount = false; - - @Expose - @ConfigOption(name = "Warn When Unclaimed", desc = "Warn when all six eggs are ready to be found.") - @ConfigEditorBoolean - @FeatureToggle - public boolean warnUnclaimedEggs = false; - - @Expose - @ConfigOption(name = "Click to Warp", desc = "Make the eggs ready chat message & unclaimed timer display clickable to warp you to an island.") - @ConfigEditorBoolean - public boolean warpUnclaimedEggs = false; - - @Expose - @ConfigOption(name = "Warp Destination", desc = "A custom island to warp to in the above option.") - @ConfigEditorText - public String warpDestination = "nucleus"; - - @Expose - @ConfigOption(name = "Show While Busy", desc = "Show while \"busy\" (in a farming contest, doing Kuudra, in the rift, etc).") - @ConfigEditorBoolean - @FeatureToggle - public boolean showWhileBusy = false; - - @Expose - @ConfigOption(name = "Warn While Busy", desc = "Warn while \"busy\" (in a farming contest, doing Kuudra, in the rift, etc).") - @ConfigEditorBoolean - @FeatureToggle - public boolean warnWhileBusy = false; - - @Expose - @ConfigOption(name = "Show Outside SkyBlock", desc = "Show on Hypixel even when not playing SkyBlock.") - @ConfigEditorBoolean - @FeatureToggle - public boolean showOutsideSkyblock = false; - - @Expose - @ConfigOption(name = "Shared Hoppity Waypoints", desc = "Enable being able to share and receive egg waypoints in your lobby.") - @ConfigEditorBoolean - @FeatureToggle - public boolean sharedWaypoints = true; - - @Expose - @ConfigOption(name = "Adjust player opacity", desc = "Adjust the opacity of players near shared & guessed egg waypoints. (in %)") - @ConfigEditorSlider(minValue = 0, maxValue = 100, minStep = 1) - public int playerOpacity = 40; - - @Expose - @ConfigLink(owner = HoppityEggsConfig.class, field = "showClaimedEggs") - public Position position = new Position(200, 120, false, true); - - @Expose - @ConfigOption(name = "Highlight Hoppity Shop", desc = "Highlight items that haven't been bought from the Hoppity shop yet.") - @ConfigEditorBoolean - @FeatureToggle - public boolean highlightHoppityShop = true; - - @Expose - @ConfigOption(name = "Hoppity Shop Reminder", desc = "Remind you to open the Hoppity Shop each year.") - @ConfigEditorBoolean - @FeatureToggle - public boolean hoppityShopReminder = true; - - @Expose - @ConfigOption(name = "Time in Chat", desc = "When the Egglocator can't find an egg, show the time until the next Hoppity event or egg spawn.") - @ConfigEditorBoolean - @FeatureToggle - public boolean timeInChat = true; - - @Expose - @ConfigOption(name = "Compact Chat", desc = "Compact chat events when finding a Hoppity Egg.") - @ConfigEditorBoolean - @FeatureToggle - public boolean compactChat = false; - - @Expose - @ConfigOption(name = "Compacted Rarity", desc = "Show rarity of found rabbit in Compacted chat messages.") - @ConfigEditorDropdown - public CompactRarityTypes rarityInCompact = CompactRarityTypes.NEW; - - public enum CompactRarityTypes { - NONE("Neither"), - NEW("New Rabbits"), - DUPE("Duplicate Rabbits"), - BOTH("New & Duplicate Rabbits"), - ; - - private final String name; - - CompactRarityTypes(String name) { - this.name = name; - } - - @Override - public String toString() { - return name; - } - } - - @Expose - @ConfigOption(name = "Show Duplicate Count", desc = "Show the number of previous finds of a duplicate Hoppity rabbit in chat messages.") - @ConfigEditorBoolean - public boolean showDuplicateNumber = false; - - @Expose - @ConfigOption(name = "Recolor Time-Towered Chocolate", desc = "Recolor raw chocolate gain from duplicate rabbits while Time Tower is active.") - @ConfigEditorBoolean - public boolean recolorTTChocolate = false; - - @Expose - @ConfigOption( - name = "Rabbit Pet Warning", - desc = "Warn when using the Egglocator without a §d§lMythic Rabbit Pet §7equipped. " + - "§eOnly enable this setting when you own a mythic Rabbit pet." - ) - @ConfigEditorBoolean - @FeatureToggle - public boolean petWarning = false; - - @Expose - @ConfigOption(name = "Prevent Missing Rabbit the Fish", desc = "Prevent closing a Meal Egg's inventory if Rabbit the Fish is present.") - @ConfigEditorBoolean - @FeatureToggle - public boolean preventMissingRabbitTheFish = true; -} diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/event/hoppity/HoppityEggsConfig.kt b/src/main/java/at/hannibal2/skyhanni/config/features/event/hoppity/HoppityEggsConfig.kt new file mode 100644 index 000000000000..ae0351cfbb34 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/config/features/event/hoppity/HoppityEggsConfig.kt @@ -0,0 +1,92 @@ +package at.hannibal2.skyhanni.config.features.event.hoppity + +import at.hannibal2.skyhanni.config.FeatureToggle +import com.google.gson.annotations.Expose +import io.github.notenoughupdates.moulconfig.annotations.Accordion +import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean +import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorSlider +import io.github.notenoughupdates.moulconfig.annotations.ConfigOption + +class HoppityEggsConfig { + @Expose + @ConfigOption(name = "Hoppity Abiphone Calls", desc = "") + @Accordion + var hoppityCallWarning: HoppityCallWarningConfig = HoppityCallWarningConfig() + + @Expose + @ConfigOption(name = "Hoppity Hunt Stats Summary", desc = "") + @Accordion + var eventSummary: HoppityEventSummaryConfig = HoppityEventSummaryConfig() + + @Expose + @ConfigOption(name = "Warp Menu", desc = "") + @Accordion + var warpMenu: HoppityWarpMenuConfig = HoppityWarpMenuConfig() + + @Expose + @ConfigOption(name = "Stray Timer", desc = "") + @Accordion + var strayTimer: HoppityStrayTimerConfig = HoppityStrayTimerConfig() + + @Expose + @ConfigOption(name = "Chat Messages", desc = "") + @Accordion + var chat: HoppityChatConfig = HoppityChatConfig() + + @Expose + @ConfigOption(name = "Egg Waypoints", desc = "") + @Accordion + var waypoints: HoppityWaypointsConfig = HoppityWaypointsConfig() + + @Expose + @ConfigOption(name = "Egg Locations", desc = "") + @Accordion + var locations: HoppityLocationConfig = HoppityLocationConfig() + + @Expose + @ConfigOption(name = "Unclaimed Eggs", desc = "") + @Accordion + var unclaimedEggs: HoppityUnclaimedEggsConfig = HoppityUnclaimedEggsConfig() + + @Expose + @ConfigOption( + name = "Adjust player opacity", + desc = "Adjust the opacity of players near shared & guessed egg waypoints. (in %)" + ) + @ConfigEditorSlider(minValue = 0f, maxValue = 100f, minStep = 1f) + var playerOpacity: Int = 40 + + @Expose + @ConfigOption( + name = "Highlight Hoppity Shop", + desc = "Highlight items that haven't been bought from the Hoppity shop yet." + ) + @ConfigEditorBoolean + @FeatureToggle + var highlightHoppityShop: Boolean = true + + @Expose + @ConfigOption(name = "Hoppity Shop Reminder", desc = "Remind you to open the Hoppity Shop each year.") + @ConfigEditorBoolean + @FeatureToggle + var hoppityShopReminder: Boolean = true + + @Expose + @ConfigOption( + name = "Rabbit Pet Warning", + desc = "Warn when using the Egglocator without a §d§lMythic Rabbit Pet §7equipped. " + + "§eOnly enable this setting when you own a mythic Rabbit pet." + ) + @ConfigEditorBoolean + @FeatureToggle + var petWarning: Boolean = false + + @Expose + @ConfigOption( + name = "Prevent Missing Rabbit the Fish", + desc = "Prevent closing a Meal Egg's inventory if Rabbit the Fish is present." + ) + @ConfigEditorBoolean + @FeatureToggle + var preventMissingRabbitTheFish: Boolean = true +} diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/event/hoppity/HoppityLocationConfig.kt b/src/main/java/at/hannibal2/skyhanni/config/features/event/hoppity/HoppityLocationConfig.kt new file mode 100644 index 000000000000..1a63b226b502 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/config/features/event/hoppity/HoppityLocationConfig.kt @@ -0,0 +1,32 @@ +package at.hannibal2.skyhanni.config.features.event.hoppity + +import at.hannibal2.skyhanni.config.FeatureToggle +import com.google.gson.annotations.Expose +import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean +import io.github.notenoughupdates.moulconfig.annotations.ConfigOption + +class HoppityLocationConfig { + @Expose + @ConfigOption( + name = "Mark Duplicate Locations", + desc = "Marks egg location waypoints which you have already found in red." + ) + @ConfigEditorBoolean + @FeatureToggle + var highlightDuplicates: Boolean = false + + @Expose + @ConfigOption(name = "Mark Nearby Duplicates", desc = "Always show duplicate egg locations when nearby.") + @ConfigEditorBoolean + @FeatureToggle + var showNearbyDuplicates: Boolean = false + + @Expose + @ConfigOption( + name = "Load from NEU PV", + desc = "Load Hoppity Egg Location data from API when opening the NEU Profile Viewer." + ) + @ConfigEditorBoolean + @FeatureToggle + var loadFromNeuPv: Boolean = true +} diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/event/hoppity/HoppityUnclaimedEggsConfig.kt b/src/main/java/at/hannibal2/skyhanni/config/features/event/hoppity/HoppityUnclaimedEggsConfig.kt new file mode 100644 index 000000000000..08f037a6da9b --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/config/features/event/hoppity/HoppityUnclaimedEggsConfig.kt @@ -0,0 +1,91 @@ +package at.hannibal2.skyhanni.config.features.event.hoppity + +import at.hannibal2.skyhanni.config.FeatureToggle +import at.hannibal2.skyhanni.config.core.config.Position +import com.google.gson.annotations.Expose +import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean +import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorDropdown +import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorText +import io.github.notenoughupdates.moulconfig.annotations.ConfigLink +import io.github.notenoughupdates.moulconfig.annotations.ConfigOption + +class HoppityUnclaimedEggsConfig { + @Expose + @ConfigOption( + name = "Show Unclaimed Eggs", + desc = "Display which eggs haven't been found in the last SkyBlock day." + ) + @ConfigEditorBoolean + @FeatureToggle + var enabled: Boolean = false + + @Expose + @ConfigLink(owner = HoppityUnclaimedEggsConfig::class, field = "enabled") + var position: Position = Position(200, 120, false, true) + + @Expose + @ConfigOption(name = "Unclaimed Eggs Order", desc = "Order in which to display unclaimed eggs.") + @ConfigEditorDropdown + var displayOrder: UnclaimedEggsOrder = UnclaimedEggsOrder.SOONEST_FIRST + + enum class UnclaimedEggsOrder(private val displayName: String) { + SOONEST_FIRST("Soonest First"), + MEAL_ORDER("Meal Order"), + ; + + override fun toString() = displayName + } + + @Expose + @ConfigOption( + name = "Show Collected Locations", + desc = "Show the number of found egg locations on this island.\n" + + "§eThis is not retroactive and may not be fully synced with Hypixel's count." + ) + @ConfigEditorBoolean + @FeatureToggle + var showCollectedLocationCount: Boolean = false + + @Expose + @ConfigOption( + name = "Show While Busy", + desc = "Show while \"busy\" (in a farming contest, doing Kuudra, in the rift, etc)." + ) + @ConfigEditorBoolean + @FeatureToggle + var showWhileBusy: Boolean = false + + @Expose + @ConfigOption(name = "Show Outside SkyBlock", desc = "Show on Hypixel even when not playing SkyBlock.") + @ConfigEditorBoolean + @FeatureToggle + var showOutsideSkyblock: Boolean = false + + @Expose + @ConfigOption(name = "Warn When Unclaimed", desc = "Warn when all six eggs are ready to be found.") + @ConfigEditorBoolean + @FeatureToggle + var warningsEnabled: Boolean = false + + @Expose + @ConfigOption( + name = "Warn While Busy", + desc = "Warn while \"busy\" (in a farming contest, doing Kuudra, in the rift, etc)." + ) + @ConfigEditorBoolean + @FeatureToggle + var warnWhileBusy: Boolean = false + + @Expose + @ConfigOption( + name = "Click to Warp", + desc = "Make the eggs ready chat message & unclaimed timer display clickable to warp you to an island." + ) + @ConfigEditorBoolean + var warpClickEnabled: Boolean = false + + @Expose + @ConfigOption(name = "Warp Destination", desc = "A custom island to warp to in the above option.") + @ConfigEditorText + var warpClickDestination: String = "nucleus" +} diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/event/hoppity/HoppityWaypointsConfig.kt b/src/main/java/at/hannibal2/skyhanni/config/features/event/hoppity/HoppityWaypointsConfig.kt new file mode 100644 index 000000000000..155b15089640 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/config/features/event/hoppity/HoppityWaypointsConfig.kt @@ -0,0 +1,69 @@ +package at.hannibal2.skyhanni.config.features.event.hoppity + +import at.hannibal2.skyhanni.config.FeatureToggle +import com.google.gson.annotations.Expose +import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean +import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorColour +import io.github.notenoughupdates.moulconfig.annotations.ConfigOption + +class HoppityWaypointsConfig { + @Expose + @ConfigOption(name = "Enabled", desc = "Toggle guess waypoints for Hoppity's Hunt.") + @ConfigEditorBoolean + @FeatureToggle + var enabled: Boolean = true + + @Expose + @ConfigOption( + name = "Shared Waypoints", + desc = "Enable being able to share and receive egg waypoints in your lobby." + ) + @ConfigEditorBoolean + @FeatureToggle + var shared: Boolean = true + + @Expose + @ConfigOption( + name = "Show Waypoints Immediately", + desc = "Show an estimated waypoint immediately after clicking.\n" + + "§cThis might cause issues with other particle sources." + ) + @ConfigEditorBoolean + var showImmediately: Boolean = false + + @Expose + @ConfigOption(name = "Color", desc = "Color of the waypoint.") + @ConfigEditorColour + var color: String = "0:53:46:224:73" + + @Expose + @ConfigOption(name = "Show Line", desc = "Show a line to the waypoint.") + @ConfigEditorBoolean + @FeatureToggle + var showLine: Boolean = false + + @Expose + @ConfigOption(name = "Show Path Finder", desc = "Show a pathfind to the next hoppity egg.") + @ConfigEditorBoolean + @FeatureToggle + var showPathFinder: Boolean = false + + @Expose + @ConfigOption( + name = "Show All Waypoints", + desc = "Show all possible egg waypoints for the current lobby. §e" + + "Only works when you don't have an Egglocator in your inventory." + ) + @ConfigEditorBoolean + var showAll: Boolean = false + + @Expose + @ConfigOption( + name = "Hide Duplicate Waypoints", + desc = "Hide egg waypoints you have already found.\n" + + "§eOnly works when you don't have an Egglocator in your inventory." + ) + @ConfigEditorBoolean + @FeatureToggle + var hideDuplicates: Boolean = false +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggDisplayManager.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggDisplayManager.kt index 35ed0692240e..b7b01a13584c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggDisplayManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggDisplayManager.kt @@ -1,7 +1,7 @@ package at.hannibal2.skyhanni.features.event.hoppity import at.hannibal2.skyhanni.api.event.HandleEvent -import at.hannibal2.skyhanni.config.features.event.hoppity.HoppityEggsConfig.UnclaimedEggsOrder.SOONEST_FIRST +import at.hannibal2.skyhanni.config.features.event.hoppity.HoppityUnclaimedEggsConfig.UnclaimedEggsOrder.SOONEST_FIRST import at.hannibal2.skyhanni.data.mob.MobFilter.isRealPlayer import at.hannibal2.skyhanni.events.SecondPassedEvent import at.hannibal2.skyhanni.events.SkyHanniRenderEntityEvent @@ -25,6 +25,7 @@ import org.lwjgl.opengl.GL11 object HoppityEggDisplayManager { private val config get() = HoppityEggsManager.config + private val unclaimedEggsConfig get() = config.unclaimedEggs private var shouldHidePlayer: Boolean = false var display = listOf() @@ -74,19 +75,19 @@ object HoppityEggDisplayManager { private fun updateDisplay(): List { if (!HoppityEggsManager.isActive()) return emptyList() - if (!config.showClaimedEggs) return emptyList() - if (ReminderUtils.isBusy() && !config.showWhileBusy) return emptyList() + if (!unclaimedEggsConfig.enabled) return emptyList() + if (ReminderUtils.isBusy() && !unclaimedEggsConfig.showWhileBusy) return emptyList() val displayList: List = buildList { add("§bUnclaimed Eggs:") HoppityEggType.resettingEntries.filter { it.hasRemainingSpawns() // Only show eggs that have future spawns }.let { entries -> - if (config.unclaimedEggsOrder == SOONEST_FIRST) entries.sortedBy { it.timeUntil() } + if (unclaimedEggsConfig.displayOrder == SOONEST_FIRST) entries.sortedBy { it.timeUntil() } else entries }.forEach { add("§7 - ${it.formattedName} ${it.timeUntil().format()}") } - if (!config.showCollectedLocationCount || !LorenzUtils.inSkyBlock) return@buildList + if (!unclaimedEggsConfig.showCollectedLocationCount || !LorenzUtils.inSkyBlock) return@buildList val totalEggs = HoppityEggLocations.islandLocations.size if (totalEggs > 0) { @@ -100,10 +101,10 @@ object HoppityEggDisplayManager { val container = Renderable.verticalContainer(displayList.map(Renderable::string)) return listOf( - if (config.warpUnclaimedEggs) Renderable.clickAndHover( + if (unclaimedEggsConfig.warpClickEnabled) Renderable.clickAndHover( container, - tips = listOf("§eClick to ${"/warp ${config.warpDestination}".trim()}!"), - onClick = { HypixelCommands.warp(config.warpDestination) }, + tips = listOf("§eClick to ${"/warp ${unclaimedEggsConfig.warpClickDestination}".trim()}!"), + onClick = { HypixelCommands.warp(unclaimedEggsConfig.warpClickDestination) }, ) else container, ) } @@ -114,7 +115,7 @@ object HoppityEggDisplayManager { inOwnInventory = true, condition = { HoppityEggsManager.isActive() }, onRender = { - config.position.renderRenderables(display, posLabel = "Hoppity Eggs") + unclaimedEggsConfig.position.renderRenderables(display, posLabel = "Hoppity Eggs") }, ) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocations.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocations.kt index 2a8a48215600..19423fc934d2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocations.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocations.kt @@ -23,12 +23,8 @@ import at.hannibal2.skyhanni.utils.StringUtils @SkyHanniModule object HoppityEggLocations { - // TODO add gui/command to show total data/missing islands - private var collectedEggStorage: MutableMap> - get() = ChocolateFactoryAPI.profileStorage?.collectedEggLocations ?: mutableMapOf() - set(value) { - ChocolateFactoryAPI.profileStorage?.collectedEggLocations = value - } + private val collectedEggStorage: MutableMap> get() = + ChocolateFactoryAPI.profileStorage?.collectedEggLocations ?: mutableMapOf() var apiEggLocations: Map> = mapOf() @@ -81,7 +77,7 @@ object HoppityEggLocations { @HandleEvent fun onNeuProfileDataLoaded(event: NeuProfileDataLoadedEvent) { - if (loadedNeuThisProfile || !HoppityEggsManager.config.loadFromNeuPv) return + if (loadedNeuThisProfile || !HoppityEggsManager.config.locations.loadFromNeuPv) return val rawLocations = event.getCurrentPlayerData()?.events?.easter?.rabbits?.collectedLocations ?: return loadedNeuThisProfile = true diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocator.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocator.kt index 57762b1535a0..49c91a754912 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocator.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggLocator.kt @@ -39,6 +39,8 @@ import kotlin.time.Duration.Companion.seconds @SkyHanniModule object HoppityEggLocator { private val config get() = HoppityEggsManager.config + private val waypointsConfig get() = config.waypoints + private val locationConfig get() = config.locations val locatorItem = "EGGLOCATOR".toInternalName() private var lastParticlePosition: LorenzVec? = null @@ -95,7 +97,7 @@ object HoppityEggLocator { } sharedEggLocation?.let { - if (config.sharedWaypoints) { + if (waypointsConfig.shared) { event.drawEggWaypoint(it, "§aShared Egg") return } @@ -104,7 +106,7 @@ object HoppityEggLocator { var islandEggsLocations = HoppityEggLocations.islandLocations if (shouldShowAllEggs()) { - if (config.hideDuplicateWaypoints) { + if (waypointsConfig.hideDuplicates) { islandEggsLocations = islandEggsLocations.filter { !HoppityEggLocations.hasCollectedEgg(it) }.toSet() @@ -121,14 +123,14 @@ object HoppityEggLocator { private fun RenderWorldEvent.drawGuessLocations() { for ((index, eggLocation) in possibleEggLocations.withIndex()) { drawEggWaypoint(eggLocation, "§aGuess #${index + 1}") - if (config.showLine) { + if (waypointsConfig.showLine) { drawLineToEye(eggLocation.blockCenter(), LorenzColor.GREEN.toColor(), 2, false) } } } private fun RenderWorldEvent.drawDuplicateEggs(islandEggsLocations: Set) { - if (!config.highlightDuplicateEggLocations || !config.showNearbyDuplicateEggLocations) return + if (!locationConfig.highlightDuplicates || !locationConfig.showNearbyDuplicates) return for (eggLocation in islandEggsLocations) { val dist = eggLocation.distanceToPlayer() if (dist < 10 && HoppityEggLocations.hasCollectedEgg(eggLocation)) { @@ -140,19 +142,19 @@ object HoppityEggLocator { } private fun RenderWorldEvent.drawGuessImmediately() { - if (config.waypointsImmediately && lastClick.passedSince() < 5.seconds) { + if (waypointsConfig.showImmediately && lastClick.passedSince() < 5.seconds) { lastParticlePositionForever?.let { if (lastChange.passedSince() < 300.milliseconds) { val eyeLocation = exactPlayerEyeLocation() if (eyeLocation.distance(it) > 2) { drawWaypointFilled( it, - config.waypointColor.toSpecialColor(), + waypointsConfig.color.toSpecialColor(), seeThroughBlocks = true, ) drawDynamicText(it.up(), "§aGuess", 1.5) } - if (!drawLocations && config.showLine) { + if (!drawLocations && waypointsConfig.showLine) { drawLineToEye(it.blockCenter(), LorenzColor.GREEN.toColor(), 2, false) } } @@ -161,17 +163,17 @@ object HoppityEggLocator { } private fun RenderWorldEvent.drawEggWaypoint(location: LorenzVec, label: String) { - val shouldMarkDuplicate = config.highlightDuplicateEggLocations && HoppityEggLocations.hasCollectedEgg(location) + val shouldMarkDuplicate = locationConfig.highlightDuplicates && HoppityEggLocations.hasCollectedEgg(location) val possibleDuplicateLabel = if (shouldMarkDuplicate) "$label §c(Duplicate Location)" else label if (!shouldMarkDuplicate) { - drawWaypointFilled(location, config.waypointColor.toSpecialColor(), seeThroughBlocks = true) + drawWaypointFilled(location, waypointsConfig.color.toSpecialColor(), seeThroughBlocks = true) } else { drawColor(location, LorenzColor.RED.toColor(), false, 0.5f) } drawDynamicText(location.up(), possibleDuplicateLabel, 1.5) } - private fun shouldShowAllEggs() = config.showAllWaypoints && !locatorInHotbar && HoppityEggType.eggsRemaining() + private fun shouldShowAllEggs() = waypointsConfig.showAll && !locatorInHotbar && HoppityEggType.eggsRemaining() @SubscribeEvent fun onReceiveParticle(event: ReceiveParticleEvent) { @@ -273,12 +275,12 @@ object HoppityEggLocator { } private fun trySendingGraph() { - if (!config.showPathFinder) return + if (!waypointsConfig.showPathFinder) return val location = possibleEggLocations.firstOrNull() ?: return - val color = config.waypointColor.toSpecialColor() + val color = waypointsConfig.color.toSpecialColor() - IslandGraphs.pathFind(location, "Hoppity Egg", color, condition = { config.showPathFinder }) + IslandGraphs.pathFind(location, "Hoppity Egg", color, condition = { waypointsConfig.showPathFinder }) } fun isValidEggLocation(location: LorenzVec): Boolean = HoppityEggLocations.islandLocations.any { @@ -290,7 +292,8 @@ object HoppityEggLocator { private fun ReceiveParticleEvent.isEnchantmentParticle() = type == EnumParticleTypes.ENCHANTMENT_TABLE && speed == -2.0f && count == 10 fun isEnabled() = - LorenzUtils.inSkyBlock && config.waypoints && !GardenAPI.inGarden() && !ReminderUtils.isBusy(true) && HoppityAPI.isHoppityEvent() + LorenzUtils.inSkyBlock && config.waypoints.enabled && !GardenAPI.inGarden() && !ReminderUtils.isBusy(true) && + HoppityAPI.isHoppityEvent() private val ItemStack.isLocatorItem get() = getInternalName() == locatorItem @@ -328,7 +331,7 @@ object HoppityEggLocator { } } - fun testPathfind(args: Array) { + fun testPathFind(args: Array) { val target = args[0].formatInt() HoppityEggLocations.apiEggLocations[LorenzUtils.skyBlockIsland]?.let { for ((i, location) in it.values.withIndex()) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsCompactChat.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsCompactChat.kt index 919f2aadf629..16d1ac27be3f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsCompactChat.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsCompactChat.kt @@ -1,86 +1,173 @@ package at.hannibal2.skyhanni.features.event.hoppity -import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.config.features.event.hoppity.HoppityEggsConfig +import at.hannibal2.skyhanni.config.features.event.hoppity.HoppityChatConfig import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.features.event.hoppity.HoppityAPI.HoppityStateDataSet import at.hannibal2.skyhanni.features.event.hoppity.HoppityEggType.Companion.resettingEntries +import at.hannibal2.skyhanni.features.event.hoppity.HoppityEventSummary.getRabbitsFormat import at.hannibal2.skyhanni.features.inventory.chocolatefactory.ChocolateFactoryAPI import at.hannibal2.skyhanni.features.inventory.chocolatefactory.ChocolateFactoryTimeTowerManager import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.CollectionUtils.takeIfNotEmpty import at.hannibal2.skyhanni.utils.DelayedRun +import at.hannibal2.skyhanni.utils.LorenzRarity +import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.NumberUtil.shortFormat import at.hannibal2.skyhanni.utils.SimpleTimeMark.Companion.fromNow import at.hannibal2.skyhanni.utils.TimeUtils.format import kotlin.time.Duration.Companion.milliseconds import kotlin.time.Duration.Companion.seconds -typealias RarityType = HoppityEggsConfig.CompactRarityTypes +typealias RarityType = HoppityChatConfig.CompactRarityTypes @SkyHanniModule object HoppityEggsCompactChat { private var hoppityDataSet = HoppityStateDataSet() private val config get() = ChocolateFactoryAPI.config - private val eventConfig get() = SkyHanniMod.feature.event.hoppityEggs - private val rarityConfig get() = HoppityEggsManager.config.rarityInCompact + private val chatConfig get() = HoppityEggsManager.config.chat + private val waypointsConfig get() = HoppityEggsManager.config.waypoints + val hitmanCompactDataSets: MutableList = mutableListOf() fun compactChat(event: LorenzChatEvent?, dataSet: HoppityStateDataSet) { - if (!HoppityEggsManager.config.compactChat) return + if (!chatConfig.compact) return hoppityDataSet = dataSet.copy() event?.let { it.blockedReason = "compact_hoppity" } if (hoppityDataSet.hoppityMessages.size == 3) sendCompact() } private fun sendCompact() { - if (hoppityDataSet.lastMeal.let { HoppityEggType.resettingEntries.contains(it) } && eventConfig.sharedWaypoints) { + if (hoppityDataSet.lastMeal?.let { it == HoppityEggType.HITMAN } == true) handleCompactHitman() + else sendNonHitman() + } + + private fun sendNonHitman() { + if (HoppityEggType.resettingEntries.contains(hoppityDataSet.lastMeal) && waypointsConfig.shared) { DelayedRun.runDelayed(5.milliseconds) { createWaypointShareCompactMessage(HoppityEggsManager.getAndDisposeWaypointOnclick()) hoppityDataSet.reset() + hitmanCompactDataSets.clear() } } else { ChatUtils.hoverableChat(createCompactMessage(), hover = hoppityDataSet.hoppityMessages, prefix = false) hoppityDataSet.reset() + hitmanCompactDataSets.clear() } } - private fun createCompactMessage(): String { - val mealNameFormat = when (hoppityDataSet.lastMeal) { - in resettingEntries -> "${hoppityDataSet.lastMeal?.coloredName.orEmpty()} Egg" - else -> "${hoppityDataSet.lastMeal?.coloredName.orEmpty()} Rabbit" + private fun handleCompactHitman() { + if (!chatConfig.compactHitman) { + sendNonHitman() + return } - val nameFormat = hoppityDataSet.lastName.takeIf { it.isNotEmpty() } ?: "§C§L???" - val rarityString = hoppityDataSet.lastRarity?.let { "${it.chatColorCode}§l${it.rawName}" } ?: "§C§L???" - val rarityFormat = when { - hoppityDataSet.duplicate && rarityConfig in listOf(RarityType.BOTH, RarityType.DUPE) -> "$rarityString " - !hoppityDataSet.duplicate && rarityConfig in listOf(RarityType.BOTH, RarityType.NEW) -> "$rarityString " - else -> "" + + hoppityDataSet.let { + hitmanCompactDataSets.add(it.copy()) + it.reset() } + val sizeNow = hitmanCompactDataSets.size + DelayedRun.runDelayed(750.milliseconds) { + if (hitmanCompactDataSets.size != sizeNow) return@runDelayed + + if (hitmanCompactDataSets.size == 1) { + hoppityDataSet = hitmanCompactDataSets.first() // Pop back out the stored data + sendNonHitman() + } else sendHitmanSummary() + } + + } + private fun sendHitmanSummary() { + if (hitmanCompactDataSets.isEmpty()) return + val summaryMessage = buildString { + appendLine("§c§lHitman Summary") + appendLine() - return if (hoppityDataSet.duplicate) { - val dupeChocAmount = hoppityDataSet.lastDuplicateAmount?.shortFormat() ?: "?" - val timeFormat = hoppityDataSet.lastDuplicateAmount?.let { - ChocolateFactoryAPI.timeUntilNeed(it).format(maxUnits = 2) - } ?: "?" - val dupeNumberFormat = if (eventConfig.showDuplicateNumber) { - (HoppityCollectionStats.getRabbitCount(hoppityDataSet.lastName)).takeIf { it > 0 }?.let { + // Create a Map of LorenzRarity -> Int so we can use the existing EventSummary logic + val rarityMap: Map = hitmanCompactDataSets.getGroupedRarityMap() + getRabbitsFormat(rarityMap, "Total Hitman").forEach { appendLine(it) } + + hitmanCompactDataSets.filter { !it.duplicate }.takeIfNotEmpty()?.let { sets -> + appendLine() + // Create a Map of LorenzRarity -> Int so we can use the existing EventSummary logic + val newRarityMap: Map = sets.getGroupedRarityMap() + getRabbitsFormat(newRarityMap, "New").forEach { appendLine(it) } + } + + hitmanCompactDataSets.filter { it.duplicate }.takeIfNotEmpty()?.let { sets -> + appendLine() + // Create a Map of LorenzRarity -> Int so we can use the existing EventSummary logic + val dupeRarityMap: Map = sets.getGroupedRarityMap() + getRabbitsFormat(dupeRarityMap, "Duplicate").forEach { appendLine(it) } + + // Add the total amount of chocolate from duplicates + val dupeChocolateAmount = sets.sumOf { it.lastDuplicateAmount ?: 0 } + val timeFormat = dupeChocolateAmount.getChocExtraTimeString() + appendLine(" §6+${dupeChocolateAmount.addSeparators()} §6Chocolate§7$timeFormat") + } + } + ChatUtils.hoverableChat( + summaryMessage, + hover = hitmanCompactDataSets.sortedBy { + if (it.duplicate) 1 else 0 + }.map { it.createCompactMessage(withMeal = false) }, + prefix = false, + ) + hitmanCompactDataSets.clear() + } + + private fun Collection.getGroupedRarityMap(): Map = + this.mapNotNull { it.lastRarity } + .groupingBy { it } + .eachCount() + + private fun Long?.getChocExtraTimeString(): String { + if (this == null) return "?" + val extraTime = ChocolateFactoryAPI.timeUntilNeed(this) + return if (config.showDuplicateTime) ", §a+§b${extraTime.format(maxUnits = 2)}§7" else "" + } + + private fun HoppityStateDataSet.getNameFormat(): String = + lastName.takeIf { it.isNotEmpty() } ?: "§C§L???" + private fun HoppityStateDataSet.getRarityString(): String = + lastRarity?.let { "${it.chatColorCode}§l${it.rawName}" } ?: "§C§L???" + private fun HoppityStateDataSet.getRarityFormat(): String = when { + hoppityDataSet.duplicate && chatConfig.rarityInCompact in listOf(RarityType.BOTH, RarityType.DUPE) -> "${getRarityString()} " + !hoppityDataSet.duplicate && chatConfig.rarityInCompact in listOf(RarityType.BOTH, RarityType.NEW) -> "${getRarityString()} " + else -> "" + } + + private fun HoppityStateDataSet.createCompactMessage(withMeal: Boolean = true): String { + val mealNameFormat = if (withMeal) when (lastMeal) { + in resettingEntries -> "${lastMeal?.coloredName.orEmpty()} Egg! " + else -> "${lastMeal?.coloredName.orEmpty()} Rabbit! " + } else "" + + val nameFormat = getNameFormat() + val rarityFormat = getRarityFormat() + + return if (duplicate) { + val dupeChocAmount = lastDuplicateAmount?.shortFormat() ?: "?" + val dupeNumberFormat = if (chatConfig.showDuplicateNumber) { + (HoppityCollectionStats.getRabbitCount(lastName)).takeIf { it > 0 }?.let { " §7(§b#$it§7)" }.orEmpty() } else "" - val timeStr = if (config.showDuplicateTime) ", §a+§b$timeFormat§7" else "" - val dupeChocColor = if (eventConfig.recolorTTChocolate && ChocolateFactoryTimeTowerManager.timeTowerActive()) "§d" else "§6" + val timeStr = lastDuplicateAmount.getChocExtraTimeString() + val dupeChocColor = if (chatConfig.recolorTTChocolate && ChocolateFactoryTimeTowerManager.timeTowerActive()) "§d" else "§6" val dupeChocFormat = " §7(§6+$dupeChocColor$dupeChocAmount §6Chocolate§7$timeStr)" - "$mealNameFormat! §7Duplicate $rarityFormat$nameFormat$dupeNumberFormat$dupeChocFormat" + "$mealNameFormat§7Duplicate $rarityFormat$nameFormat$dupeNumberFormat$dupeChocFormat" } else { - "$mealNameFormat! §d§lNEW $rarityFormat$nameFormat §7(${hoppityDataSet.lastProfit}§7)" + "$mealNameFormat§d§lNEW $rarityFormat$nameFormat §7($lastProfit§7)" } } + private fun createCompactMessage(withMeal: Boolean = true) = hoppityDataSet.createCompactMessage(withMeal) + private fun createWaypointShareCompactMessage(onClick: () -> Unit) { val hover = hoppityDataSet.hoppityMessages.joinToString("\n") + " \n§eClick here to share the location of this chocolate egg with the server!" diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt index 3184799d87b5..2f7312fb4bcc 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt @@ -32,7 +32,11 @@ import kotlin.time.Duration.Companion.seconds object HoppityEggsManager { val config get() = SkyHanniMod.feature.event.hoppityEggs + private val chatConfig get() = config.chat + private val unclaimedEggsConfig get() = config.unclaimedEggs + private val waypointsConfig get() = config.waypoints + // /** * REGEX-TEST: §d§lHOPPITY'S HUNT §r§dYou found a §r§9Chocolate Lunch Egg §r§don a ledge next to the stairs up§r§d! * REGEX-TEST: §d§lHOPPITY'S HUNT §r§dYou found a §r§aChocolate Dinner Egg §r§dbehind Emissary Sisko§r§d! @@ -117,6 +121,7 @@ object HoppityEggsManager { "egg.notevent", "§cThis only works during Hoppity's Hunt!", ) + // private var lastMeal: HoppityEggType? = null private var lastNote: String? = null @@ -142,6 +147,12 @@ object HoppityEggsManager { lastNote = event.note } + private fun LorenzChatEvent.sendNextEggAvailable() { + val nextEgg = HoppityEggType.resettingEntries.minByOrNull { it.timeUntil() } ?: return + ChatUtils.chat("§eNext egg available in §b${nextEgg.timeUntil().format()}§e.") + blockedReason = "hoppity_egg" + } + @SubscribeEvent fun onChat(event: LorenzChatEvent) { if (!LorenzUtils.inSkyBlock) return @@ -149,7 +160,7 @@ object HoppityEggsManager { hoppityEventNotOn.matchMatcher(event.message) { val currentYear = SkyBlockTime.now().year - if (config.timeInChat) { + if (chatConfig.eggLocatorTimeInChat) { val timeUntil = SkyBlockTime(currentYear + 1).asTimeMark().timeUntil() ChatUtils.chat("§eHoppity's Hunt is not active. The next Hoppity's Hunt is in §b${timeUntil.format()}§e.") event.blockedReason = "hoppity_egg" @@ -161,22 +172,13 @@ object HoppityEggsManager { noEggsLeftPattern.matchMatcher(event.message) { HoppityEggType.allFound() - - if (config.timeInChat) { - val nextEgg = HoppityEggType.resettingEntries.minByOrNull { it.timeUntil() } ?: return - ChatUtils.chat("§eNext egg available in §b${nextEgg.timeUntil().format()}§e.") - event.blockedReason = "hoppity_egg" - } + if (chatConfig.eggLocatorTimeInChat) event.sendNextEggAvailable() return } eggAlreadyCollectedPattern.matchMatcher(event.message) { getEggType(event).markClaimed() - if (config.timeInChat) { - val nextEgg = HoppityEggType.resettingEntries.minByOrNull { it.timeUntil() } ?: return - ChatUtils.chat("§eNext egg available in §b${nextEgg.timeUntil().format()}§e.") - event.blockedReason = "hoppity_egg" - } + if (chatConfig.eggLocatorTimeInChat) event.sendNextEggAvailable() return } @@ -193,7 +195,7 @@ object HoppityEggsManager { } fun shareWaypointPrompt() { - if (!config.sharedWaypoints) return + if (!waypointsConfig.shared) return val meal = lastMeal ?: return val note = lastNote ?: return lastMeal = null @@ -202,7 +204,7 @@ object HoppityEggsManager { val currentLocation = LocationUtils.playerLocation() DelayedRun.runNextTick { latestWaypointOnclick = { HoppityEggsShared.shareNearbyEggLocation(currentLocation, meal, note) } - if (config.compactChat) return@runNextTick + if (chatConfig.compact) return@runNextTick ChatUtils.clickableChat( "Click here to share the location of this chocolate egg with the server!", onClick = latestWaypointOnclick, @@ -232,23 +234,27 @@ object HoppityEggsManager { } } + private val warpClickAction: Pair<() -> Unit, String> get() = + if (LorenzUtils.inSkyBlock) { + { HypixelCommands.warp(unclaimedEggsConfig.warpClickDestination) } to + "warp to ${unclaimedEggsConfig.warpClickDestination}".trim() + } else { + { HypixelCommands.skyblock() } to "join /skyblock!" + } + private fun warn() { - if (!config.warnUnclaimedEggs) return - if (ReminderUtils.isBusy() && !config.warnWhileBusy) return + if (!unclaimedEggsConfig.warningsEnabled) return + if (ReminderUtils.isBusy() && !unclaimedEggsConfig.warnWhileBusy) return if (lastWarnTime.passedSince() < 1.minutes) return lastWarnTime = now() val amount = HoppityEggType.resettingEntries.size val message = "All $amount Hoppity Eggs are ready to be found!" - if (config.warpUnclaimedEggs) { - val (action, actionName) = if (LorenzUtils.inSkyBlock) { - { HypixelCommands.warp(config.warpDestination) } to "warp to ${config.warpDestination}".trim() - } else { - { HypixelCommands.skyblock() } to "join /skyblock!" - } + if (unclaimedEggsConfig.warpClickEnabled) { + val (action, actionName) = warpClickAction ChatUtils.clickToActionOrDisable( message, - config::warpUnclaimedEggs, + unclaimedEggsConfig::warpClickEnabled, actionName = actionName, action = action, ) @@ -257,6 +263,42 @@ object HoppityEggsManager { SoundUtils.repeatSound(100, 10, SoundUtils.plingSound) } + // + private val massMigrationMap by lazy { + mapOf( + "waypoints" to "waypoints.enabled", + "waypointsImmediately" to "waypoints.showImmediately", + "waypointColor" to "waypoints.color", + "showLine" to "waypoints.showLine", + "showPathFinder" to "waypoints.showPathFinder", + "showAllWaypoints" to "waypoints.showAll", + "hideDuplicateWaypoints" to "waypoints.hideDuplicates", + "sharedWaypoints" to "waypoints.shared", + + "highlightDuplicateEggLocations" to "locations.highlightDuplicates", + "showNearbyDuplicateEggLocations" to "locations.showNearbyDuplicates", + "loadFromNeuPv" to "locations.loadFromNeuPv", + + "showClaimedEggs" to "unclaimedEggs.enabled", + "position" to "unclaimedEggs.position", + "unclaimedEggsOrder" to "unclaimeddEggs.displayOrder", + "warnUnclaimedEggs" to "unclaimedEggs.warningsEnabled", + "showCollectedLocationCount" to "unclaimedEggs.showCollectedLocationCount", + "warpUnclaimedEggs" to "unclaimedEggs.warpClickEnabled", + "warpDestination" to "unclaimedEggs.warpClickDestination", + "showWhileBusy" to "unclaimedEggs.showWhileBusy", + "warnWhileBusy" to "unclaimedEggs.warnWhileBusy", + "showOutsideSkyblock" to "unclaimedEggs.showOutsideSkyblock", + + "timeInChat" to "chat.eggLocatorTimeInChat", + "compactChat" to "chat.compact", + "rarityInCompact" to "chat.rarityInCompact", + "showDuplicateNumber" to "chat.showDuplicateNumber", + "recolorTTChocolate" to "chat.recolorTTChocolate", + ) + } + // + @HandleEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move( @@ -268,8 +310,13 @@ object HoppityEggsManager { event.move(50, "event.hoppityEggs.showDuringContest", "event.hoppityEggs.showWhileBusy") event.move(62, "event.hoppityEggs.uniquesWarpMenu", "event.hoppityEggs.warpMenu.enabled") event.move(62, "event.hoppityEggs.uniquesWarpMenuHideMax", "event.hoppityEggs.warpMenu.hideWhenMaxed") + + val baseConfig = "event.hoppityEggs" + massMigrationMap.forEach { (oldKey, newKey) -> + event.move(70, "$baseConfig.$oldKey", "$baseConfig.$newKey") + } } - fun isActive() = (LorenzUtils.inSkyBlock || (LorenzUtils.onHypixel && config.showOutsideSkyblock)) && + fun isActive() = (LorenzUtils.inSkyBlock || (LorenzUtils.onHypixel && unclaimedEggsConfig.showOutsideSkyblock)) && HoppityAPI.isHoppityEvent() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsShared.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsShared.kt index 6d95cd9b0069..b5bac3d87d14 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsShared.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsShared.kt @@ -16,7 +16,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @SkyHanniModule object HoppityEggsShared { - private val config get() = HoppityEggsManager.config + private val waypointsConfig get() = HoppityEggsManager.config.waypoints /** * REGEX-TEST: CalMWolfs: [SkyHanni] Breakfast Chocolate Egg located at x: 142, y: 71, z: -453 @@ -59,5 +59,5 @@ object HoppityEggsShared { HypixelCommands.allChat("[SkyHanni] ${meal.mealName} Chocolate Egg located at x: $x, y: $y, z: $z ($note)") } - fun isEnabled() = LorenzUtils.inSkyBlock && config.waypoints && config.sharedWaypoints + fun isEnabled() = LorenzUtils.inSkyBlock && waypointsConfig.enabled && waypointsConfig.shared } diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEventSummary.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEventSummary.kt index 24e1f53566e2..d6a9223a564e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEventSummary.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEventSummary.kt @@ -748,7 +748,7 @@ object HoppityEventSummary { return previousEggs + currentEggs } - private fun getRabbitsFormat(rarityMap: Map, name: String): List { + fun getRabbitsFormat(rarityMap: Map, name: String): List { val rabbitsSum = rarityMap.values.sum() if (rabbitsSum == 0) return emptyList() diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryBarnManager.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryBarnManager.kt index d76a871a4c59..7553840fdbdd 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryBarnManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryBarnManager.kt @@ -23,7 +23,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object ChocolateFactoryBarnManager { private val config get() = ChocolateFactoryAPI.config - private val hoppityConfig get() = HoppityEggsManager.config + private val hoppityChatConfig get() = HoppityEggsManager.config.chat private val profileStorage get() = ChocolateFactoryAPI.profileStorage /** @@ -56,7 +56,7 @@ object ChocolateFactoryBarnManager { HoppityEggsManager.duplicateRabbitFound.matchMatcher(event.message) { HoppityEggsManager.shareWaypointPrompt() val amount = group("amount").formatLong() - if (config.showDuplicateTime && !hoppityConfig.compactChat) { + if (config.showDuplicateTime && !hoppityChatConfig.compact) { val format = ChocolateFactoryAPI.timeUntilNeed(amount).format(maxUnits = 2) DelayedRun.runNextTick { ChatUtils.chat("§7(§a+§b$format §aof production§7)") @@ -67,7 +67,7 @@ object ChocolateFactoryBarnManager { var changedMessage = event.message - if (hoppityConfig.showDuplicateNumber && !hoppityConfig.compactChat) { + if (hoppityChatConfig.showDuplicateNumber && !hoppityChatConfig.compact) { // Add duplicate number to the duplicate rabbit message (HoppityCollectionStats.getRabbitCount(lastRabbit)).takeIf { it > 0 }?.let { changedMessage = changedMessage.replace( @@ -77,7 +77,7 @@ object ChocolateFactoryBarnManager { } } - if (hoppityConfig.recolorTTChocolate && ChocolateFactoryTimeTowerManager.timeTowerActive()) { + if (hoppityChatConfig.recolorTTChocolate && ChocolateFactoryTimeTowerManager.timeTowerActive()) { // Replace §6\+(?[\d,]+) Chocolate with §6\+§d(?[\d,]+) §6Chocolate changedMessage = changedMessage.replace( "§6\\+(?[\\d,]+) Chocolate",