Skip to content

Commit

Permalink
Feature: Mineshaft click to gfs ascension rope (#1542)
Browse files Browse the repository at this point in the history
Co-authored-by: hannibal2 <24389977+hannibal002@users.noreply.github.com>
  • Loading branch information
j10a1n15 and hannibal002 authored Apr 25, 2024
1 parent ec1e6bf commit 1d70f88
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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"),
Expand Down Expand Up @@ -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

Expand All @@ -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)
}
}
}
}
}

Expand Down

0 comments on commit 1d70f88

Please sign in to comment.