Skip to content

Commit

Permalink
Feature: Carrolyn (hannibal002#3096)
Browse files Browse the repository at this point in the history
Co-authored-by: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com>
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
  • Loading branch information
3 people authored Dec 20, 2024
1 parent a638e64 commit 82060fc
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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

}

0 comments on commit 82060fc

Please sign in to comment.