Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Mineshaft click to gfs ascension rope #1542

Merged
merged 7 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/main/java/at/hannibal2/skyhanni/api/GetFromSackAPI.kt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ object GetFromSackAPI {
) =
ChatUtils.clickableChat(text, "${commands.first()} ${item.internalName.asString()} ${item.amount}")

fun getFromChatMessageSackItem(
item: NEUInternalName,
amount: Int,
text: String = "§lCLICK HERE§r§e to grab §ax${amount} §9${item.asString()}§e from sacks!"
j10a1n15 marked this conversation as resolved.
Show resolved Hide resolved
) =
getFromChatMessageSackItems(item.makePrimitiveStack(amount), text)

fun getFromSlotClickedSackItems(items: List<PrimitiveItemStack>, slotIndex: Int) = addToInventory(items, slotIndex)

fun Slot.getFromSackWhenClicked(items: List<PrimitiveItemStack>) = getFromSlotClickedSackItems(items, slotIndex)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,10 @@ 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.")
j10a1n15 marked this conversation as resolved.
Show resolved Hide resolved
@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.getFromChatMessageSackItem
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,9 @@ 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.SoundUtils
import at.hannibal2.skyhanni.utils.StringUtils.matches
import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
Expand All @@ -19,6 +24,8 @@ import kotlin.time.Duration.Companion.seconds

object MiningNotifications {

val ASCENSION_ROPE = "ASCENSION_ROPE".asInternalName()

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 +53,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..."
j10a1n15 marked this conversation as resolved.
Show resolved Hide resolved
)

private val config get() = SkyHanniMod.feature.mining.notifications

Expand All @@ -61,6 +72,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) {
getFromChatMessageSackItem(ASCENSION_ROPE, 1)
}
}
}
}
}

Expand Down
Loading