diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/garden/GardenConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/garden/GardenConfig.java index b2b3f19aeaa1..04ee9f610e2a 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/garden/GardenConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/garden/GardenConfig.java @@ -15,6 +15,7 @@ import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorSlider; import io.github.notenoughupdates.moulconfig.annotations.ConfigLink; import io.github.notenoughupdates.moulconfig.annotations.ConfigOption; +import io.github.notenoughupdates.moulconfig.annotations.SearchTag; public class GardenConfig { @Expose @@ -241,4 +242,11 @@ public class GardenConfig { @Expose @ConfigLink(owner = GardenConfig.class, field = "showLogBookStats") public Position logBookStatsPos = new Position(427, 92, false, true); + + @Expose + @ConfigOption(name = "Carrolyn Fetch Helper", desc = "Helps to fetch items to Carrolyn for permanent buffs.") + @SearchTag("Expired Pumpkin, Exportable Carrots, Supreme Chocolate Bar, Fine Flour") + @ConfigEditorBoolean + @FeatureToggle + public boolean helpCarrolyn = true; } diff --git a/src/main/java/at/hannibal2/skyhanni/events/ItemClickEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/ItemClickEvent.kt index e0a96d7e5db6..d5f0e1155958 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/ItemClickEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/ItemClickEvent.kt @@ -3,4 +3,5 @@ package at.hannibal2.skyhanni.events import at.hannibal2.skyhanni.data.ClickType import net.minecraft.item.ItemStack +// Left or right click into the world, with the item in hand class ItemClickEvent(itemInHand: ItemStack?, clickType: ClickType) : WorldClickEvent(itemInHand, clickType) diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/OdgerWaypoint.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/OdgerWaypoint.kt index 3d56036eea70..1fbe3995cae6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/OdgerWaypoint.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/OdgerWaypoint.kt @@ -22,7 +22,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object OdgerWaypoint { private val config get() = SkyHanniMod.feature.fishing.trophyFishing - private val location = LorenzVec(-373, 207, -808) + private val odgerLocation = LorenzVec(-373, 207, -808) private var trophyFishInInventory = false @@ -39,8 +39,8 @@ object OdgerWaypoint { if (FishingAPI.holdingLavaRod) return if (!trophyFishInInventory) return - event.drawWaypointFilled(location, LorenzColor.WHITE.toColor()) - event.drawDynamicText(location, "Odger", 1.5) + event.drawWaypointFilled(odgerLocation, LorenzColor.WHITE.toColor()) + event.drawDynamicText(odgerLocation, "Odger", 1.5) } @HandleEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/CarrolynHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/CarrolynHelper.kt new file mode 100644 index 000000000000..215659f475cb --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/CarrolynHelper.kt @@ -0,0 +1,76 @@ +package at.hannibal2.skyhanni.features.garden.inventory + +import at.hannibal2.skyhanni.api.event.HandleEvent +import at.hannibal2.skyhanni.data.EntityMovementData +import at.hannibal2.skyhanni.data.IslandGraphs +import at.hannibal2.skyhanni.data.IslandType +import at.hannibal2.skyhanni.events.ItemClickEvent +import at.hannibal2.skyhanni.events.item.ItemHoverEvent +import at.hannibal2.skyhanni.features.garden.GardenAPI +import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.HypixelCommands +import at.hannibal2.skyhanni.utils.ItemUtils.getLore +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.LorenzVec +import at.hannibal2.skyhanni.utils.RegexUtils.matches +import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern +import net.minecraft.item.ItemStack + +@SkyHanniModule +object CarrolynHelper { + private val config get() = GardenAPI.config + + private val carrolynLocation = LorenzVec(0.5, 103.1, -803.7) + + private val patternGroup = RepoPattern.group("garden.carrolyn") + + /** + * REGEX-TEST: §7Bring §63,000 §7of these to §5Carrolyn §7in + */ + private val lorePattern by patternGroup.pattern( + "lore", + "§7Bring §63,000 §7of these to §5Carrolyn §7in", + ) + + @HandleEvent(priority = HandleEvent.LOWEST) + fun onTooltip(event: ItemHoverEvent) { + if (!isEnabled()) return + + if (!event.itemStack.isCarrolynItem()) return + + event.toolTip.add("") + event.toolTip.add("§eClick to navigate to Carrolyn!") + } + + private fun ItemStack?.isCarrolynItem() = this?.getLore()?.any { lorePattern.matches(it) } ?: false + + @HandleEvent(onlyOnSkyblock = true) + fun onItemClick(event: ItemClickEvent) { + if (!isEnabled()) return + + if (!event.itemInHand.isCarrolynItem()) return + + if (LorenzUtils.skyBlockIsland == IslandType.CRIMSON_ISLE) { + startPathfind() + } else { + ChatUtils.clickableChat( + "Carrolyn is on the Crimson Isle. Click here to warp there!", + onClick = { + HypixelCommands.warp("crimson") + EntityMovementData.onNextTeleport(IslandType.CRIMSON_ISLE) { + startPathfind() + } + }, + replaceSameMessage = true, + ) + } + } + + private fun startPathfind() { + IslandGraphs.pathFind(carrolynLocation, "§5Carrolyn", condition = { isEnabled() }) + } + + fun isEnabled() = LorenzUtils.inSkyBlock && config.helpCarrolyn + +}