diff options
author | inglettronald <inglettronald@gmail.com> | 2023-02-28 18:07:08 -0600 |
---|---|---|
committer | inglettronald <inglettronald@gmail.com> | 2023-02-28 18:07:08 -0600 |
commit | 890f44737371973c2c339292c1279b1ee1858357 (patch) | |
tree | 10343d16a0e663e845061ab0f155815d36cdd33d | |
parent | f8e29c3a1b18aa0587f102167ab5f6b5a43a5607 (diff) | |
download | DulkirMod-890f44737371973c2c339292c1279b1ee1858357.tar.gz DulkirMod-890f44737371973c2c339292c1279b1ee1858357.tar.bz2 DulkirMod-890f44737371973c2c339292c1279b1ee1858357.zip |
added persistent visitor alert
-rw-r--r-- | src/main/kotlin/dulkirmod/config/Config.kt | 11 | ||||
-rw-r--r-- | src/main/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 |