switched from fixed interval for bufffood reminder to settable

René Welbers [01-26-16 - 12:51]
switched from fixed interval for bufffood reminder to settable
Filename
RaidNotifier.lua
lang/de.lua
lang/en.lua
diff --git a/RaidNotifier.lua b/RaidNotifier.lua
index 09aa492..072e942 100644
--- a/RaidNotifier.lua
+++ b/RaidNotifier.lua
@@ -23,6 +23,7 @@ RaidNotifier.variables = {
     },
     general = {
         buffFood_reminder = true,
+        buffFood_reminder_interval = 60,
     },
     debug = false
 }
@@ -73,6 +74,20 @@ local function CreateSettingsMenu()
             end,
         },
         {
+            type = "slider",
+            name = GetString(RAIDNOTIFIER_SETTINGS_GENERAL_BUFFFOOD_REMINDER_INTERVAL),
+            tooltip = GetString(RAIDNOTIFIER_SETTINGS_GENERAL_BUFFFOOD_REMINDER_INTERVAL_TT),
+            min = 30,
+            max = 120,
+            step = 5,
+            getFunc = function() return RaidNotifier.savedVariables.general.buffFood_reminder_interval end,
+            setFunc = function(value)
+                RaidNotifier.savedVariables.general.buffFood_reminder_interval = value
+            end,
+            default = 60,
+            width = "full",
+        },
+        {
             type = "header",
             name = GetString(RAIDNOTIFIER_SETTINGS_SANCTUM_HEADER),
         },
@@ -125,6 +140,7 @@ local function CreateSettingsMenu()
                 RaidNotifier.savedVariables.maelstrom.stage9_synergy = value
             end,
         },
+
         {
             type = "header",
             name = GetString(RAIDNOTIFIER_SETTINGS_DEBUG_HEADER),
@@ -198,6 +214,8 @@ function RaidNotifier.removeEventListeners()
     EVENT_MANAGER:UnregisterForEvent(self.name .. "_MAELSTROM", EVENT_EFFECT_CHANGED)
 end

+
+-- Sanctum Ophidia Events
 function RaidNotifier.sanctumDebuffs(_, change, _, name, unit, _, _, _, _, _, _, _, _, _, _, abilityId)
     -- only take care of player
     if (unit ~= 'player') then return end
@@ -260,6 +278,7 @@ function RaidNotifier.sanctumDebuffs(_, change, _, name, unit, _, _, _, _, _, _,
 end


+-- Maelstrom Arena Events
 function RaidNotifier.maelstromDebuffs(_, change, _, name, unit, _, _, _, _, _, _, _, _, _, _, abilityId)
     -- only take care of player
     if (unit ~= 'player') then return end
@@ -296,6 +315,7 @@ function RaidNotifier.maelstromDebuffs(_, change, _, name, unit, _, _, _, _, _,
     end
 end

+-- General Events
 function RaidNotifier.generalBuffFoodReminder(_, _, _, _, unit, _, _, _, _, _, _, _, _, _, _, abilityId)
     -- only take care of player
     if (unit ~= 'player') then return end
@@ -309,6 +329,7 @@ function RaidNotifier.generalBuffFoodReminder(_, _, _, _, unit, _, _, _, _, _, _

     local buffsDebuffs = self.BuffsDebuffs.buffFood
     local buffFoodFound = false
+    local reminderInterval = self.savedVariables.general.buffFood_reminder_interval

     local numAuras = GetNumBuffs('player')
     if (numAuras > 0) then
@@ -325,18 +346,26 @@ function RaidNotifier.generalBuffFoodReminder(_, _, _, _, unit, _, _, _, _, _, _
                 local lastNotifyDiff     = GetDiffBetweenTimeStamps(currentTime, lastNotify)
                 local formatedTime       = ZO_FormatTime(bufffood_remaining, TIME_FORMAT_STYLE_COLONS, TIME_FORMAT_PRECISION_SECONDS)

-                if bufffood_remaining <= 60 and (lastNotifyDiff > 49) then
-                   -- alert 1 min
-                   self.tempVars.last_notify.general.buffFood_reminder = currentTime
-                   CENTER_SCREEN_ANNOUNCE:AddMessage(3, CSA_EVENT_SMALL_TEXT, SOUNDS.CHAMPION_POINTS_COMMITTED, zo_strformat(GetString(RAIDNOTIFIER_ALERTS_GENERAL_BUFFFOOD_MINUTES), name, formatedTime))
-                elseif bufffood_remaining <= 120 and (lastNotifyDiff > 170) then
-                   -- alert 2 min
-                   self.tempVars.last_notify.general.buffFood_reminder = currentTime
-                   CENTER_SCREEN_ANNOUNCE:AddMessage(7, CSA_EVENT_SMALL_TEXT, SOUNDS.CHAMPION_POINTS_COMMITTED, zo_strformat(GetString(RAIDNOTIFIER_ALERTS_GENERAL_BUFFFOOD_MINUTES), name, formatedTime))
-                elseif bufffood_remaining <= 300 and (lastNotifyDiff > 3600) then
-                   -- alert 5 min
-                   self.tempVars.last_notify.general.buffFood_reminder = currentTime
-                   CENTER_SCREEN_ANNOUNCE:AddMessage(10, CSA_EVENT_SMALL_TEXT, SOUNDS.CHAMPION_POINTS_COMMITTED, zo_strformat(GetString(RAIDNOTIFIER_ALERTS_GENERAL_BUFFFOOD_MINUTES), name, formatedTime))
+                -- old fixed interval
+--                if bufffood_remaining <= 60 and (lastNotifyDiff > 49) then
+--                    -- alert 1 min
+--                    self.tempVars.last_notify.general.buffFood_reminder = currentTime
+--                    CENTER_SCREEN_ANNOUNCE:AddMessage(3, CSA_EVENT_SMALL_TEXT, SOUNDS.CHAMPION_POINTS_COMMITTED, zo_strformat(GetString(RAIDNOTIFIER_ALERTS_GENERAL_BUFFFOOD_MINUTES), name, formatedTime))
+--                elseif bufffood_remaining <= 120 and (lastNotifyDiff > 170) then
+--                    -- alert 2 min
+--                    self.tempVars.last_notify.general.buffFood_reminder = currentTime
+--                    CENTER_SCREEN_ANNOUNCE:AddMessage(7, CSA_EVENT_SMALL_TEXT, SOUNDS.CHAMPION_POINTS_COMMITTED, zo_strformat(GetString(RAIDNOTIFIER_ALERTS_GENERAL_BUFFFOOD_MINUTES), name, formatedTime))
+--                elseif bufffood_remaining <= 300 and (lastNotifyDiff > 3600) then
+--                    -- alert 5 min
+--                    self.tempVars.last_notify.general.buffFood_reminder = currentTime
+--                    CENTER_SCREEN_ANNOUNCE:AddMessage(10, CSA_EVENT_SMALL_TEXT, SOUNDS.CHAMPION_POINTS_COMMITTED, zo_strformat(GetString(RAIDNOTIFIER_ALERTS_GENERAL_BUFFFOOD_MINUTES), name, formatedTime))
+--                end
+
+                -- new set interval
+                if bufffood_remaining <= 600 and (lastNotifyDiff > reminderInterval) then
+                    -- every set interval
+                    self.tempVars.last_notify.general.buffFood_reminder = currentTime
+                    CENTER_SCREEN_ANNOUNCE:AddMessage(3, CSA_EVENT_SMALL_TEXT, SOUNDS.CHAMPION_POINTS_COMMITTED, zo_strformat(GetString(RAIDNOTIFIER_ALERTS_GENERAL_BUFFFOOD_MINUTES), name, formatedTime))
                 end
                 if self.savedVariables.debug and buffFoodFound == false then
                     RaidNotifier.debug('bufffood id forgot?', abilityId)
@@ -345,11 +374,11 @@ function RaidNotifier.generalBuffFoodReminder(_, _, _, _, unit, _, _, _, _, _, _
             end
         end

-        -- no bufffood found, alert every minute
+        -- no bufffood found, alert every interval
         if buffFoodFound == false then
             local lastNotify     = self.tempVars.last_notify.general.buffFood_reminder
             local lastNotifyDiff = GetDiffBetweenTimeStamps(currentTime, lastNotify)
-            if lastNotifyDiff > 60 then
+            if lastNotifyDiff > reminderInterval then
                 self.tempVars.last_notify.general.buffFood_reminder = currentTime
                 CENTER_SCREEN_ANNOUNCE:AddMessage(3, CSA_EVENT_SMALL_TEXT, SOUNDS.CHAMPION_POINTS_COMMITTED, GetString(RAIDNOTIFIER_ALERTS_GENERAL_NO_BUFFFOOD))
             end
diff --git a/lang/de.lua b/lang/de.lua
index f32fab6..3e66f7e 100644
--- a/lang/de.lua
+++ b/lang/de.lua
@@ -4,9 +4,11 @@ local L = {}
 -- ---------------------------------------------------
 L.Description                            = 'Zeigt dir wichtige Benachrichtigungen während versch. Ereignisse in Trials an'

-L.Settings_General_Header                = 'Allgemein'
-L.Settings_General_Bufffood_Reminder     = 'Bufffood Erinnerung'
-L.Settings_General_Bufffood_Reminder_TT  = 'Erinnert dich daran Bufffood zu nehmen, wenn du eine Prüfung ohne Bufffood startest \nODER\n wenn du in einer Prüfung bist und dein Bufffood bald ausläuft (5 min, ~2 min und 1 min)'
+L.Settings_General_Header                        = 'Allgemein'
+L.Settings_General_Bufffood_Reminder             = 'Bufffood Erinnerung'
+L.Settings_General_Bufffood_Reminder_TT          = 'Erinnert dich daran Bufffood zu nehmen, wenn du eine Prüfung ohne Bufffood startest \nODER\n wenn du in einer Prüfung bist und dein Bufffood bald ausläuft (Siehe Intervall)'
+L.Settings_General_Bufffood_Reminder_Interval    = 'Interval für Bufffood Erinnerung'
+L.Settings_General_Bufffood_Reminder_Interval_TT = 'Hier kannst du den Intervall festlegen, wie oft dich der RaidNotifier an das Bufffood erinnern soll.\n\nAlle X Sekunden. \n\nBeginnt, wenn das Bufffood weniger als 10 Minuten läuft.'

 L.Settings_Sanctum_Header                = 'Sanctum Ophidia'
 L.Settings_Sanctum_Magicka_Detonation    = 'Magicka Detonation'
diff --git a/lang/en.lua b/lang/en.lua
index 390eec2..7992247 100644
--- a/lang/en.lua
+++ b/lang/en.lua
@@ -4,9 +4,11 @@ local L = {}
 -- ---------------------------------------------------
 L.Description                            = 'Displays on-screen notifications on different events during trials'

-L.Settings_General_Header                = 'General'
-L.Settings_General_Bufffood_Reminder     = 'Bufffood Reminder'
-L.Settings_General_Bufffood_Reminder_TT  = 'Reminds you, when you start a Trial without Buffood \nOR\n you\'re running a Trail and your bufffood runs out (5 mins, ~2 mins and 1 min)'
+L.Settings_General_Header                        = 'General'
+L.Settings_General_Bufffood_Reminder             = 'Bufffood Reminder'
+L.Settings_General_Bufffood_Reminder_TT          = 'Reminds you, when you start a Trial without Buffood \nOR\n you\'re running a Trail and your bufffood runs out (see interval)'
+L.Settings_General_Bufffood_Reminder_Interval    = 'Interval for Bufffood Reminder'
+L.Settings_General_Bufffood_Reminder_Interval_TT = 'Here you can set up the interval of how often the RaidNotifier remembers you on your bufffood.\n\nEvery X seconds. \n\nBegins, when the bufffood maintains 10 minutes or less.'

 L.Settings_Sanctum_Header                = 'Sanctum Ophidia'
 L.Settings_Sanctum_Magicka_Detonation    = 'Magicka Detonation'