diff options
author | J10a1n15 <45315647+j10a1n15@users.noreply.github.com> | 2024-04-25 10:29:15 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-25 10:29:15 +0200 |
commit | 1d70f88cf8387ab214523568b34f0e532ee070b6 (patch) | |
tree | d69fcc4e579271d1710a7624a50859a722511ade /src | |
parent | ec1e6bfd635311d940ee9e0dc80832c64021aa3e (diff) | |
download | skyhanni-1d70f88cf8387ab214523568b34f0e532ee070b6.tar.gz skyhanni-1d70f88cf8387ab214523568b34f0e532ee070b6.tar.bz2 skyhanni-1d70f88cf8387ab214523568b34f0e532ee070b6.zip |
Feature: Mineshaft click to gfs ascension rope (#1542)
Co-authored-by: hannibal2 <24389977+hannibal002@users.noreply.github.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/features/mining/MiningNotificationsConfig.java | 9 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/mining/MiningNotifications.kt | 19 |
2 files changed, 28 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/mining/MiningNotificationsConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/mining/MiningNotificationsConfig.java index 0c1461183..30394ba34 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/mining/MiningNotificationsConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/mining/MiningNotificationsConfig.java @@ -43,4 +43,13 @@ public class MiningNotificationsConfig { @ConfigOption(name = "Cold Threshold", desc = "Change when the Cold notification gets triggered.") @ConfigEditorSlider(minValue = 1, maxValue = 100, minStep = 1) public Property<Integer> coldThreshold = Property.of(50); + + @Expose + @ConfigOption( + name = "Get Ascension Rope", + desc = "Click on a chat message to get an Ascension Rope when you're at 90 Cold and in the §bMineshaft§7. " + + "§cOnly works if you have an Ascension Rope in your sacks." + ) + @ConfigEditorBoolean + public boolean getAscensionRope = true; } diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/MiningNotifications.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/MiningNotifications.kt index d018deaa9..6643ac4f5 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/MiningNotifications.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/MiningNotifications.kt @@ -1,6 +1,8 @@ package at.hannibal2.skyhanni.features.mining import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.api.GetFromSackAPI.getFromChatMessageSackItems +import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.data.MiningAPI.getCold import at.hannibal2.skyhanni.data.MiningAPI.inColdIsland import at.hannibal2.skyhanni.data.MiningAPI.lastColdReset @@ -10,6 +12,10 @@ import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.utils.ConditionalUtils import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland +import at.hannibal2.skyhanni.utils.LorenzUtils.runDelayed +import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName +import at.hannibal2.skyhanni.utils.PrimitiveItemStack.Companion.makePrimitiveStack import at.hannibal2.skyhanni.utils.SoundUtils import at.hannibal2.skyhanni.utils.StringUtils.matches import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern @@ -19,6 +25,8 @@ import kotlin.time.Duration.Companion.seconds object MiningNotifications { + private val ASCENSION_ROPE = "ASCENSION_ROPE".asInternalName().makePrimitiveStack(1) + enum class MiningNotificationList(val str: String, val notification: String) { MINESHAFT_SPAWN("§bGlacite Mineshaft", "§bMineshaft"), SCRAP("§9Suspicious Scrap", "§9Suspicious Scrap"), @@ -46,6 +54,10 @@ object MiningNotifications { "goblin.diamondspawn", "§6A §r§bDiamond Goblin §r§6has spawned!" ) + private val frostbitePattern by patternGroup.pattern( + "cold.frostbite", + "§9§lBRRR! §r§bYou're freezing! All you can think about is getting out of here to a warm campfire\\.\\.\\." + ) private val config get() = SkyHanniMod.feature.mining.notifications @@ -61,6 +73,13 @@ object MiningNotifications { scrapDrop.matches(message) -> sendNotification(MiningNotificationList.SCRAP) goldenGoblinSpawn.matches(message) -> sendNotification(MiningNotificationList.GOLDEN_GOBLIN) diamondGoblinSpawn.matches(message) -> sendNotification(MiningNotificationList.DIAMOND_GOBLIN) + frostbitePattern.matches(message) -> { + if (IslandType.MINESHAFT.isInIsland() && config.getAscensionRope) { + runDelayed(0.5.seconds) { + getFromChatMessageSackItems(ASCENSION_ROPE) + } + } + } } } |