From 890f44737371973c2c339292c1279b1ee1858357 Mon Sep 17 00:00:00 2001 From: inglettronald Date: Tue, 28 Feb 2023 18:07:08 -0600 Subject: added persistent visitor alert --- src/main/kotlin/dulkirmod/config/Config.kt | 11 ++++++++++- .../kotlin/dulkirmod/features/GardenVisitorAlert.kt | 18 ++++++++++++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/dulkirmod/config/Config.kt b/src/main/kotlin/dulkirmod/config/Config.kt index 6fcf41e..4d490bd 100644 --- a/src/main/kotlin/dulkirmod/config/Config.kt +++ b/src/main/kotlin/dulkirmod/config/Config.kt @@ -546,11 +546,19 @@ object Config : Vigilant(File("./config/dulkirmod/config.toml"), "DulkirMod", so @Property( type = PropertyType.SWITCH, name = "Garden Visitor Alert", - description = "Notifies you if you have 5/5 garden visitors in queue", + description = "Notifies you if you have max garden visitors in queue", category = "Farming" ) var notifyMaxVisitors = false + @Property( + type = PropertyType.SWITCH, + name = "Persistent alert", + description = "If turned on, the alert will continue to flash until dealt with.", + category = "Farming" + ) + var persistentAlert = true + fun init() { initialize() addDependency("customMessage", "throttleNotifier") @@ -561,6 +569,7 @@ object Config : Vigilant(File("./config/dulkirmod/config.toml"), "DulkirMod", so addDependency("abiCallerID", "abiDND") addDependency("hurtCamIntensity", "hurtCamSlider") addDependency("tooltipSize", "scaledTooltips") + addDependency("persistentAlert", "notifyMaxVisitors") setCategoryDescription( "Custom Animations", diff --git a/src/main/kotlin/dulkirmod/features/GardenVisitorAlert.kt b/src/main/kotlin/dulkirmod/features/GardenVisitorAlert.kt index 1292b7e..b3113bd 100644 --- a/src/main/kotlin/dulkirmod/features/GardenVisitorAlert.kt +++ b/src/main/kotlin/dulkirmod/features/GardenVisitorAlert.kt @@ -6,7 +6,8 @@ import dulkirmod.utils.TabListUtils import dulkirmod.utils.Utils class GardenVisitorAlert { - var hasSentAlert = false + private var hasSentAlert = false + private var lastAlert = 0 fun alert() { if (!Config.notifyMaxVisitors) return @@ -19,10 +20,23 @@ class GardenVisitorAlert { if (TabListUtils.maxVisitors && !hasSentAlert) { val color = Utils.getColorString(Config.bestiaryNotifColor) DulkirMod.titleUtils.drawStringForTime("${color}Max Visitors", 5000) - DulkirMod.mc.thePlayer.playSound("mob.cat.meow", 1f * Config.bestiaryNotifVol, 1f) + DulkirMod.mc.thePlayer.playSound("note.pling", 1f * Config.bestiaryNotifVol, .3f) + DulkirMod.mc.thePlayer.playSound("note.pling", 1f * Config.bestiaryNotifVol, .6f) + DulkirMod.mc.thePlayer.playSound("note.pling", 1f * Config.bestiaryNotifVol, .9f) hasSentAlert = true + lastAlert = System.currentTimeMillis().toInt() } else if (!TabListUtils.maxVisitors) hasSentAlert = false + val timeSinceLastAlert = System.currentTimeMillis().toInt() - lastAlert + + if (TabListUtils.maxVisitors && hasSentAlert && timeSinceLastAlert > 5000 && Config.persistentAlert) { + lastAlert = System.currentTimeMillis().toInt() + val color = Utils.getColorString(Config.bestiaryNotifColor) + DulkirMod.titleUtils.drawStringForTime("${color}Max Visitors", 5000) + DulkirMod.mc.thePlayer.playSound("note.pling", 1f * Config.bestiaryNotifVol, .3f) + DulkirMod.mc.thePlayer.playSound("note.pling", 1f * Config.bestiaryNotifVol, .6f) + DulkirMod.mc.thePlayer.playSound("note.pling", 1f * Config.bestiaryNotifVol, .9f) + } } } \ No newline at end of file -- cgit