aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConutik <60240193+Conutik@users.noreply.github.com>2024-04-24 00:02:37 +0300
committerGitHub <noreply@github.com>2024-04-23 23:02:37 +0200
commit2b8b4d90bcda89e1b0c109d6531bf13208bc487b (patch)
treeb91e451ede2a7b10f6d7279903b7f3011d51b336
parent85f50e4d0c8e22e310cb7f066de3a6f14be624ba (diff)
downloadskyhanni-2b8b4d90bcda89e1b0c109d6531bf13208bc487b.tar.gz
skyhanni-2b8b4d90bcda89e1b0c109d6531bf13208bc487b.tar.bz2
skyhanni-2b8b4d90bcda89e1b0c109d6531bf13208bc487b.zip
Feature: Architect Notifications when puzzle fails (#1197)
Co-authored-by: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> Co-authored-by: Cal <cwolfson58@gmail.com> Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/dungeon/DungeonConfig.java8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonArchitectFeatures.kt58
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt19
4 files changed, 83 insertions, 4 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
index 07e1268aa..fa375862e 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
@@ -108,6 +108,7 @@ import at.hannibal2.skyhanni.features.cosmetics.ArrowTrail
import at.hannibal2.skyhanni.features.cosmetics.CosmeticFollowingLine
import at.hannibal2.skyhanni.features.dungeon.CroesusChestTracker
import at.hannibal2.skyhanni.features.dungeon.DungeonAPI
+import at.hannibal2.skyhanni.features.dungeon.DungeonArchitectFeatures
import at.hannibal2.skyhanni.features.dungeon.DungeonBossHideDamageSplash
import at.hannibal2.skyhanni.features.dungeon.DungeonBossMessages
import at.hannibal2.skyhanni.features.dungeon.DungeonChatFilter
@@ -633,6 +634,7 @@ class SkyHanniMod {
loadModule(HighlightDungeonDeathmite())
loadModule(DungeonHideItems())
loadModule(DungeonCopilot())
+ loadModule(DungeonArchitectFeatures())
loadModule(EndermanSlayerFeatures())
loadModule(FireVeilWandParticles())
loadModule(HideMobNames())
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/dungeon/DungeonConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/dungeon/DungeonConfig.java
index 7040c2a1e..1f3c688db 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/dungeon/DungeonConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/dungeon/DungeonConfig.java
@@ -60,6 +60,14 @@ public class DungeonConfig {
public boolean highlightTeammates = true;
@Expose
+ @ConfigOption(name = "Architect Notifier",
+ desc = "Notifies you to use the Architect in Dungeons when a puzzle is failed. " +
+ "§cOnly works when having enough §5Architect First Drafts §cin the sack.")
+ @ConfigEditorBoolean
+ @FeatureToggle
+ public boolean architectNotifier = true;
+
+ @Expose
@ConfigOption(name = "Object Hider", desc = "Hide various things in Dungeons.")
@Accordion
public ObjectHiderConfig objectHider = new ObjectHiderConfig();
diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonArchitectFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonArchitectFeatures.kt
new file mode 100644
index 000000000..8475f2749
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonArchitectFeatures.kt
@@ -0,0 +1,58 @@
+package at.hannibal2.skyhanni.features.dungeon
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.data.SackAPI.getAmountInSacks
+import at.hannibal2.skyhanni.events.LorenzChatEvent
+import at.hannibal2.skyhanni.utils.ChatUtils
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName
+import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
+import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import kotlin.time.Duration.Companion.seconds
+
+class DungeonArchitectFeatures {
+
+ private val config get() = SkyHanniMod.feature.dungeon
+ private val patternGroup = RepoPattern.group("dungeon.architectsdraft")
+
+ private val puzzleFailPattern by patternGroup.pattern(
+ "puzzle.fail.normal",
+ "(?:§c§lPUZZLE FAIL!|§4) §.§.(?<name>\\S*) .*"
+ )
+ private val quizPuzzleFailPattern by patternGroup.pattern(
+ "puzzle.fail.quiz",
+ "§4\\[STATUE] Oruo the Omniscient§r§f: (?:§.)*(?<name>\\S*) (?:§.)*chose the wrong .*"
+ )
+
+ private val architectsFirstDraftItem = "ARCHITECT_FIRST_DRAFT".asInternalName()
+
+ @SubscribeEvent
+ fun onChat(event: LorenzChatEvent) {
+ if (!isEnabled()) return
+
+ puzzleFailPattern.matchMatcher(event.message) {
+ generateMessage(group("name"), event)
+ }
+ quizPuzzleFailPattern.matchMatcher(event.message) {
+ generateMessage(group("name"), event)
+ }
+ }
+
+ private fun generateMessage(name: String, event: LorenzChatEvent) {
+ val architectItemAmount = architectsFirstDraftItem.getAmountInSacks()
+ if (architectItemAmount <= 0) return
+
+ // TODO use hypxel command class (once the pr is merged
+ ChatUtils.clickableChat(
+ "§c§lPUZZLE FAILED! §r§b$name §r§efailed a puzzle.\n" +
+ "§eClick here to get §5Architect's First Draft §7(§e${architectItemAmount}x left§7)",
+ "/gfs ARCHITECT_FIRST_DRAFT 1",
+ false
+ )
+ LorenzUtils.sendTitle("§c§lPUZZLE FAILED!", 3.seconds)
+ event.blockedReason = "puzzle_fail"
+ }
+
+ private fun isEnabled(): Boolean = DungeonAPI.inDungeon() && config.architectNotifier
+}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt
index 4fb461d9b..1528fe150 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCopilot.kt
@@ -12,6 +12,7 @@ import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.RenderUtils.renderString
import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
+import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import net.minecraft.entity.item.EntityArmorStand
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
@@ -19,14 +20,24 @@ class DungeonCopilot {
private val config get() = SkyHanniMod.feature.dungeon.dungeonCopilot
- private val countdownPattern =
- "(.*) has started the dungeon countdown. The dungeon will begin in 1 minute.".toPattern()
+ private val patternGroup = RepoPattern.group("dungeon.copilot")
+ private val countdownPattern by patternGroup.pattern(
+ "countdown",
+ "(.*) has started the dungeon countdown. The dungeon will begin in 1 minute."
+ )
+ private val witherDoorPattern by patternGroup.pattern(
+ "wither.door",
+ "(.*) opened a §r§8§lWITHER §r§adoor!"
+ )
+ private val bloodDoorPattern by patternGroup.pattern(
+ "blood.door",
+ "§cThe §r§c§lBLOOD DOOR§r§c has been opened!"
+ )
+
private val keyPatternsList = listOf(
"§eA §r§a§r§[6c]§r§[8c](?<key>Wither|Blood) Key§r§e was picked up!".toPattern(),
"(.*) §r§ehas obtained §r§a§r§[6c]§r§[8c](?<key>Wither|Blood) Key§r§e!".toPattern()
)
- private val witherDoorPattern = "(.*) opened a §r§8§lWITHER §r§adoor!".toPattern()
- private val bloodDoorPattern = "§cThe §r§c§lBLOOD DOOR§r§c has been opened!".toPattern()
private var nextStep = ""
private var searchForKey = false