From 4e23db746f35965b84f8dd5be19b9883c67d8add Mon Sep 17 00:00:00 2001 From: MTOnline69 <97001154+MTOnline69@users.noreply.github.com> Date: Thu, 12 Sep 2024 09:21:53 +0100 Subject: Feature: Broodmother alerts/messages and damage indicator support (#2325) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../config/features/combat/CombatConfig.java | 6 + .../combat/broodmother/BroodmotherConfig.java | 68 ++++++++ .../broodmother/BroodmotherSpawnAlertConfig.java | 41 +++++ .../damageindicator/DamageIndicatorConfig.java | 3 + .../at/hannibal2/skyhanni/data/model/TabWidget.kt | 2 +- .../features/combat/BroodmotherFeatures.kt | 183 +++++++++++++++++++++ .../skyhanni/features/combat/SpidersDenAPI.kt | 12 ++ .../features/combat/damageindicator/BossType.kt | 3 +- .../features/combat/damageindicator/MobFinder.kt | 5 + .../gui/customscoreboard/ScoreboardEvent.kt | 5 +- 10 files changed, 322 insertions(+), 6 deletions(-) create mode 100644 src/main/java/at/hannibal2/skyhanni/config/features/combat/broodmother/BroodmotherConfig.java create mode 100644 src/main/java/at/hannibal2/skyhanni/config/features/combat/broodmother/BroodmotherSpawnAlertConfig.java create mode 100644 src/main/java/at/hannibal2/skyhanni/features/combat/BroodmotherFeatures.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/features/combat/SpidersDenAPI.kt (limited to 'src/main/java/at/hannibal2/skyhanni') diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/combat/CombatConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/combat/CombatConfig.java index 4beede62b..7042b2fdb 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/combat/CombatConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/combat/CombatConfig.java @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.config.features.combat; import at.hannibal2.skyhanni.config.FeatureToggle; +import at.hannibal2.skyhanni.config.features.combat.broodmother.BroodmotherConfig; import at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig; import at.hannibal2.skyhanni.config.features.combat.ghostcounter.GhostCounterConfig; import com.google.gson.annotations.Expose; @@ -60,6 +61,11 @@ public class CombatConfig { @Accordion public FlareConfig flare = new FlareConfig(); + @Expose + @ConfigOption(name = "Broodmother", desc = "") + @Accordion + public BroodmotherConfig broodmother = new BroodmotherConfig(); + @Expose @ConfigOption(name = "Hide Damage Splash", desc = "Hide all damage splashes anywhere in SkyBlock.") @ConfigEditorBoolean diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/combat/broodmother/BroodmotherConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/combat/broodmother/BroodmotherConfig.java new file mode 100644 index 000000000..8acd69c1f --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/config/features/combat/broodmother/BroodmotherConfig.java @@ -0,0 +1,68 @@ +package at.hannibal2.skyhanni.config.features.combat.broodmother; + +import at.hannibal2.skyhanni.config.FeatureToggle; +import at.hannibal2.skyhanni.config.core.config.Position; +import at.hannibal2.skyhanni.features.combat.BroodmotherFeatures.StageEntry; +import com.google.gson.annotations.Expose; +import io.github.notenoughupdates.moulconfig.annotations.Accordion; +import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean; +import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorDraggableList; +import io.github.notenoughupdates.moulconfig.annotations.ConfigLink; +import io.github.notenoughupdates.moulconfig.annotations.ConfigOption; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +public class BroodmotherConfig { + + @Expose + @ConfigOption(name = "Countdown", desc = "Display a countdown until the Broodmother will spawn.\n" + + "§cCountdown will not show unless the time until spawn has been established, and may be off by a few seconds.") + @ConfigEditorBoolean + @FeatureToggle + public boolean countdown = true; + + @Expose + @ConfigOption(name = "Spawn Alert", desc = "Send a chat message, title and sound when the Broodmother spawns.") + @ConfigEditorBoolean + @FeatureToggle + public boolean alertOnSpawn = false; + + @Expose + @ConfigOption(name = "Alert Settings", desc = "") + @Accordion + public BroodmotherSpawnAlertConfig spawnAlert = new BroodmotherSpawnAlertConfig(); + + @Expose + @ConfigOption(name = "Imminent Warning", desc = "Warns you when the Broodmother is 1 minute away from spawning.") + @ConfigEditorBoolean + @FeatureToggle + public boolean imminentWarning = false; + + @Expose + @ConfigOption(name = "Chat Messages", desc = "Send a chat message when the Broodmother enters these stages.\n" + + "§cThe 'Alive!' and 'Imminent' stages are overridden by the \"Spawn Alert\" and \"Imminent Warning\" features.") + @ConfigEditorDraggableList + public List stages = new ArrayList<>(Arrays.asList( + StageEntry.SLAIN, + StageEntry.ALIVE + )); + + @Expose + @ConfigOption(name = "Stage on Server Join", desc = "Send a chat message with the Broodmother's current stage upon joining the Spider's Den.") + @ConfigEditorBoolean + @FeatureToggle + public boolean stageOnJoin = false; + + @Expose + @ConfigOption(name = "Hide own kills", desc = "Disable the chat message for the §eSlain §rstage if at the Spider Mound.") + @ConfigEditorBoolean + @FeatureToggle + public boolean hideSlainWhenNearby = false; + + @Expose + @ConfigLink(owner = BroodmotherConfig.class, field = "countdown") + public Position countdownPosition = new Position(10, 10, false, true); + +} diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/combat/broodmother/BroodmotherSpawnAlertConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/combat/broodmother/BroodmotherSpawnAlertConfig.java new file mode 100644 index 000000000..d0c2ccfe9 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/config/features/combat/broodmother/BroodmotherSpawnAlertConfig.java @@ -0,0 +1,41 @@ +package at.hannibal2.skyhanni.config.features.combat.broodmother; + +import at.hannibal2.skyhanni.features.combat.BroodmotherFeatures; +import at.hannibal2.skyhanni.utils.OSUtils; +import com.google.gson.annotations.Expose; +import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorButton; +import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorSlider; +import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorText; +import io.github.notenoughupdates.moulconfig.annotations.ConfigOption; + +public class BroodmotherSpawnAlertConfig { + + @Expose + @ConfigOption(name = "Alert Sound", desc = "The sound that plays for the alert.") + @ConfigEditorText + public String alertSound = "note.pling"; + + @Expose + @ConfigOption(name = "Pitch", desc = "The pitch of the alert sound.") + @ConfigEditorSlider(minValue = 0.5f, maxValue = 2.0f, minStep = 0.1f) + public float pitch = 1.0f; + + @ConfigOption(name = "Test Sound", desc = "Test current sound settings.") + @ConfigEditorButton(buttonText = "Test") + public Runnable testSound = BroodmotherFeatures::playTestSound; + + @Expose + @ConfigOption(name = "Repeat Sound", desc = "How many times the sound should be repeated.") + @ConfigEditorSlider(minValue = 1, maxValue = 20, minStep = 1) + public int repeatSound = 20; + + @ConfigOption(name = "Sounds", desc = "Click to open the list of available sounds.") + @ConfigEditorButton(buttonText = "OPEN") + public Runnable sounds = () -> OSUtils.openBrowser("https://www.minecraftforum.net/forums/mapping-and-modding-java-edition/mapping-and-modding-tutorials/2213619-1-8-all-playsound-sound-arguments"); + + @Expose + @ConfigOption(name = "Text", desc = "The text with color to be displayed as the title notification.") + @ConfigEditorText + public String text = "&4Broodmother has spawned!"; + +} diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/combat/damageindicator/DamageIndicatorConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/combat/damageindicator/DamageIndicatorConfig.java index 7010c7d35..ed37c396c 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/combat/damageindicator/DamageIndicatorConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/combat/damageindicator/DamageIndicatorConfig.java @@ -14,6 +14,7 @@ import java.util.Arrays; import java.util.List; import static at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.BossCategory.ARACHNE; +import static at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.BossCategory.BROODMOTHER; import static at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.BossCategory.DIANA_MOBS; import static at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.BossCategory.GARDEN_PESTS; import static at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig.BossCategory.INFERNO_DEMONLORD; @@ -96,6 +97,7 @@ public class DamageIndicatorConfig { DIANA_MOBS, SEA_CREATURES, ARACHNE, + BROODMOTHER, THE_RIFT_BOSSES, RIFTSTALKER_BLOODFIEND, REINDRAKE, @@ -129,6 +131,7 @@ public class DamageIndicatorConfig { RIFTSTALKER_BLOODFIEND("§bRiftstalker Bloodfiend", 23), REINDRAKE("§6Reindrake", 24), GARDEN_PESTS("§aGarden Pests", 25), + BROODMOTHER("§bBroodmother") ; private final String str; diff --git a/src/main/java/at/hannibal2/skyhanni/data/model/TabWidget.kt b/src/main/java/at/hannibal2/skyhanni/data/model/TabWidget.kt index 523121b37..85c50528f 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/model/TabWidget.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/model/TabWidget.kt @@ -195,7 +195,7 @@ enum class TabWidget( ), BROODMOTHER( // language=RegExp - "Broodmother: (?:§.)*(?