diff options
Diffstat (limited to 'src/main')
-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) + } + } + } } } |