Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions src/main/kotlin/dev/oblongboot/sxp/Slayerxpoverlay.kt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ object Slayerxpoverlay : ModInitializer {
EVENT_BUS.subscribe(onMessage())
EVENT_BUS.subscribe(dev.oblongboot.sxp.features.BossHighlightFeat())
EVENT_BUS.subscribe(dev.oblongboot.sxp.features.AutoCallMaddoxFeat())
EVENT_BUS.subscribe(dev.oblongboot.sxp.features.MiniBossAlert())

APIUtils.getXP()
APIUtils.startAutoXPUpdates()
Expand Down
41 changes: 41 additions & 0 deletions src/main/kotlin/dev/oblongboot/sxp/features/MiniBossAlert.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package dev.oblongboot.sxp.features

import dev.oblongboot.sxp.events.OnPacket
import dev.oblongboot.sxp.settings.Config
import dev.oblongboot.sxp.utils.Scheduler
import meteordevelopment.orbit.EventHandler
import net.minecraft.client.MinecraftClient
import net.minecraft.sound.SoundCategory
import net.minecraft.sound.SoundEvents
import net.minecraft.text.Text
import net.minecraft.util.Formatting
import net.minecraft.network.packet.s2c.play.GameMessageS2CPacket

class MiniBossAlert {
@EventHandler
fun onChatMessage(event: OnPacket.Incoming) {
val packet = event.packet
if (packet !is GameMessageS2CPacket) return
if (!Config.isToggled("MiniBossAlert")) return
val msg = packet.content().string.trim()

val regex = Regex("SLAYER MINI-BOSS (.+) has spawned!")
val match = regex.find(msg) ?: return
val mini = match.groupValues[1]

val client = MinecraftClient.getInstance()
val player = client.player ?: return

client.execute {
client.inGameHud.setTitle(
Text.literal(mini).formatted(Formatting.DARK_RED, Formatting.BOLD)
)

client.inGameHud.setSubtitle(Text.empty())
client.inGameHud.setTitleTicks(0, 25, 0)

client.player?.playSound(SoundEvents.BLOCK_NOTE_BLOCK_PLING.value())
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ object FeatureManager {
}

// I dont think this was implemented because it wasnt working for me
val knownSwitches = listOf("BurningVengeanceDamage", "BurningVengeanceTimer", "ShortPrefix", "IsGradient")
val knownSwitches = listOf("ShortPrefix", "IsGradient", "AutoCallMaddox", "MiniBossAlert")
knownSwitches.forEach {switchName ->
states[switchName] = Config.isToggled(switchName)
}
Expand Down
55 changes: 33 additions & 22 deletions src/main/kotlin/dev/oblongboot/sxp/ui/SettingsScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,17 @@ class SettingsScreen : Screen(Text.of("SlayerXPOverlay Config")) {
y = yPos
}
elements.add(autoCallMaddox)
yPos += elementHeight + elementSpacing + 60

val miniBossAlert = SwitchConfig(
name = "MiniBossAlert",
default = false
).apply {
x = sidebarWidth + 20
y = yPos
}
elements.add(miniBossAlert)
yPos += elementHeight + elementSpacing + 60

// val HighlightsToggle = SwitchConfig(
// name = "BossHighlight",
Expand All @@ -171,28 +182,28 @@ class SettingsScreen : Screen(Text.of("SlayerXPOverlay Config")) {
}


"Blaze" -> {
val BVDamage = SwitchConfig(
name = "BurningVengeanceDamage",
default = false,
description = "Says the Damage of your first Burning Vengeance Activation in chat"
).apply {
x = sidebarWidth + 20
y = yPos
}
elements.add(BVDamage)
yPos += elementHeight + elementSpacing + 60

val BVTimer = SwitchConfig(
name = "BurningVengeanceTimer",
default = false,
description = "Counts down the time until Burning Vengeance Activates"
).apply {
x = sidebarWidth + 20
y = yPos
}
elements.add(BVTimer)
}
// "Blaze" -> {
// val BVDamage = SwitchConfig(
// name = "BurningVengeanceDamage",
// default = false,
// description = "Says the Damage of your first Burning Vengeance Activation in chat"
// ).apply {
// x = sidebarWidth + 20
// y = yPos
// }
// elements.add(BVDamage)
// yPos += elementHeight + elementSpacing + 60
//
// val BVTimer = SwitchConfig(
// name = "BurningVengeanceTimer",
// default = false,
// description = "Counts down the time until Burning Vengeance Activates"
// ).apply {
// x = sidebarWidth + 20
// y = yPos
// }
// elements.add(BVTimer)
// }

"Colors" -> {
val messageColorSelector1 = ColorboxSetting(
Expand Down
17 changes: 9 additions & 8 deletions src/main/kotlin/dev/oblongboot/sxp/utils/BossDetection.kt
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,19 @@ fun bossChecker(sw: StopwatchUtil, lastUUID: Array<String>) {
lastUUID[0] = stand.uuid.toString();

val cSlayer = Scoreboard.getSlayerType()
// Add config checks after they are made
if (cSlayer == "Blaze" && Config.isToggled("BurningVengeanceDamage")) {
burningDamage();
}
if (cSlayer == "Blaze" && Config.isToggled("BurningVengeanceTimer")) {
burningTimer(pName);
}
// Discontinued features. Keeping just in case its somehow used again
// if (cSlayer == "Blaze" && Config.isToggled("BurningVengeanceDamage")) {
// burningDamage();
// }
// if (cSlayer == "Blaze" && Config.isToggled("BurningVengeanceTimer")) {
// burningTimer(pName);
// }
break;
}
}
});
}

// Discontinued due to being useless
fun burningDamage() {
var running = true;

Expand All @@ -85,6 +85,7 @@ fun burningDamage() {
});
}

// Discontinued due to being useless
fun burningTimer(pName: String?) {
var running = true;

Expand Down
Loading