diff options
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/features/event/hoppity/HoppityEggsConfig.java | 11 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/event/hoppity/WarpMenuUniques.kt | 58 |
2 files changed, 69 insertions, 0 deletions
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 index 8bbaa962c..3fd83db69 100644 --- 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 @@ -211,4 +211,15 @@ public class HoppityEggsConfig { @ConfigEditorBoolean @FeatureToggle public boolean petWarning = false; + + @Expose + @ConfigOption(name = "Show uniques in Warp Menu", desc = "Shows your unique eggs in the Warp Menu during the hoppity event.") + @ConfigEditorBoolean + @FeatureToggle + public boolean uniquesWarpMenu = true; + + @Expose + @ConfigOption(name = "Hide when maxed", desc = "Stops the above feature from working when the island is complete.") + @ConfigEditorBoolean + public boolean uniquesWarpMenuHideMax = true; } diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/WarpMenuUniques.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/WarpMenuUniques.kt new file mode 100644 index 000000000..939dea1b7 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/WarpMenuUniques.kt @@ -0,0 +1,58 @@ +package at.hannibal2.skyhanni.features.event.hoppity + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.data.IslandType +import at.hannibal2.skyhanni.events.LorenzToolTipEvent +import at.hannibal2.skyhanni.features.inventory.chocolatefactory.ChocolateFactoryAPI +import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.LorenzVec +import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher +import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +@SkyHanniModule +object WarpMenuUniques { + + /** + * REGEX-TEST: §bSkyBlock Hub + * REGEX-TEST: §aThe Barn§7 - §bSpawn + * REGEX-TEST: §aCrystal Hollows§7 - §bEntrance + */ + private val islandNamePattern by RepoPattern.pattern( + "inventory.warpmenu.island.name", + "§[ab](?<name>[\\w ']+)(?:§7 - §b.*)?", + ) + + private val collectedEggStorage: MutableMap<IslandType, MutableSet<LorenzVec>>? + get() = ChocolateFactoryAPI.profileStorage?.collectedEggLocations + + private val config get() = SkyHanniMod.feature.event.hoppityEggs + + @SubscribeEvent + fun onTooltip(event: LorenzToolTipEvent) { + if (!LorenzUtils.inSkyBlock) return + if (!config.uniquesWarpMenu) return + if (!HoppityAPI.isHoppityEvent()) return + if (event.slot.inventory.name != "Fast Travel") return + + val name = islandNamePattern.matchMatcher(event.slot.stack.displayName) { + group("name") + } ?: return + + val island = when (name) { + "SkyBlock Hub" -> IslandType.HUB + "The Barn" -> IslandType.THE_FARMING_ISLANDS + else -> IslandType.getByNameOrNull(name) ?: return + } + if (island == IslandType.DUNGEON_HUB) return + + if (HoppityEggLocations.apiEggLocations[island]?.size == null) return + val maxEggs = 15 + val collectedEggs = collectedEggStorage?.get(island)?.size ?: 0 + + if (collectedEggs >= maxEggs && config.uniquesWarpMenuHideMax) return + + event.toolTip.add(2, "§7Collected Hoppity Eggs: ${if (collectedEggs == maxEggs) "§a" else ""}$collectedEggs/$maxEggs") + } +} |