refactored variables

René Welbers [01-18-16 - 14:08]
refactored variables
finalized last notify timeout
fixed some translations
Filename
RaidNotifier.lua
RaidNotifier.txt
lang/de.lua
lang/en.lua
diff --git a/RaidNotifier.lua b/RaidNotifier.lua
index d7f2642..25cf7e9 100644
--- a/RaidNotifier.lua
+++ b/RaidNotifier.lua
@@ -11,13 +11,17 @@ RaidNotifier.loaded	    = false
 RaidNotifier.author     = 'silentgecko'
 RaidNotifier.savedVarsName  = 'RNVars'
 RaidNotifier.variables = {
-    sanctum_magicka_deto = true,
-    sanctum_poison       = true,
+    sanctum_ophidia = {
+        magicka_deto = true,
+        poison = true,
+    },
 }
 RaidNotifier.tempVars = {
     last_notify = {
-        so_magicka_deto = 0,
-        so_poison       = 0
+        sanctum_ophidia = {
+            magicka_deto = 0,
+            poison       = 0
+        },
     },
 }

@@ -38,21 +42,25 @@ local function CreateSettingsMenu()
             text = GetString(RAIDNOTIFIER_DESCRIPTION),
         },
         {
+            type = "header",
+            name = GetString(RAIDNOTIFIER_SETTINGS_SANCTUM_HEADER),
+        },
+        {
             type = "checkbox",
-            name = GetString(RAIDNOTIFIER_SANCTUM_MAGICKA_DETONATION),
-            tooltip = GetString(RAIDNOTIFIER_SANCTUM_MAGICKA_DETONATION_TT),
-            getFunc = function() return RaidNotifier.savedVariables.sanctum_magicka_deto end,
+            name = GetString(RAIDNOTIFIER_SETTINGS_SANCTUM_MAGICKA_DETONATION),
+            tooltip = GetString(RAIDNOTIFIER_SETTINGS_SANCTUM_MAGICKA_DETONATION_TT),
+            getFunc = function() return RaidNotifier.savedVariables.sanctum_ophidia.magicka_deto end,
             setFunc = function(value)
-                RaidNotifier.savedVariables.sanctum_magicka_deto = value
+                RaidNotifier.savedVariables.sanctum_ophidia.magicka_deto = value
             end,
         },
         {
             type = "checkbox",
-            name = GetString(RAIDNOTIFIER_SANCTUM_POISON),
-            tooltip = GetString(RAIDNOTIFIER_SANCTUM_POISON_TT),
-            getFunc = function() return RaidNotifier.savedVariables.sanctum_poison end,
+            name = GetString(RAIDNOTIFIER_SETTINGS_SANCTUM_POISON),
+            tooltip = GetString(RAIDNOTIFIER_SETTINGS_SANCTUM_POISON_TT),
+            getFunc = function() return RaidNotifier.savedVariables.sanctum_ophidia.poison end,
             setFunc = function(value)
-                RaidNotifier.savedVariables.sanctum_poison = value
+                RaidNotifier.savedVariables.sanctum_ophidia.poison = value
             end,
         },
     }
@@ -109,12 +117,9 @@ function RaidNotifier.sanctumDebuffs(_, change, buff, name, unit, start, finish,

     local self = RaidNotifier

-    local currentTime = GetTimeStamp()
-    local lastNotify  = self.tempVars.last_notify
-
     -- only notice on effect added
     if (change == EFFECT_RESULT_GAINED) then
-        if self.savedVariables.sanctum_poison then
+        if self.savedVariables.sanctum_ophidia.poison then
             -- i don't know which of these debuffs is the correct, so we add all ;-)
             local poison = {}
             poison[38965] = true
@@ -146,20 +151,24 @@ function RaidNotifier.sanctumDebuffs(_, change, buff, name, unit, start, finish,
             poison[65781] = true

             -- only notify when the last one is at least 15 seconds ago and it is poison
-            local timeDiff = GetDiffBetweenTimeStamps(currentTime, lastNotify.so_poison)
+            local currentTime = GetTimeStamp()
+            local lastNotify  = self.tempVars.last_notify.sanctum_ophidia.poison
+            local timeDiff = GetDiffBetweenTimeStamps(currentTime, lastNotify)
             if (poison[abilityId]) and timeDiff > 15 then
-                self.tempVars.last_notify.so_poison = currentTime
-                CENTER_SCREEN_ANNOUNCE:AddMessage(2, CSA_EVENT_COMBINED_TEXT, SOUNDS.CHAMPION_POINTS_COMMITTED, GetString(RAIDNOTIFIER_SANCTUM_POISON_ALERT), nil, nil, nil, nil, nil, 2000)
+                self.tempVars.last_notify.sanctum_ophidia.poison = currentTime
+                CENTER_SCREEN_ANNOUNCE:AddMessage(2, CSA_EVENT_COMBINED_TEXT, SOUNDS.CHAMPION_POINTS_COMMITTED, GetString(RAIDNOTIFIER_ALERTS_SANCTUM_POISON), nil, nil, nil, nil, nil, 2000)
             end
         end

-        if self.savedVariables.sanctum_magicka_deto then
+        if self.savedVariables.sanctum_ophidia.magicka_deto then
             -- only notify when the last one is at least 10 seconds ago and it is poison
             -- debug abilityId: 30255 / Boundless Storm
             -- Real abilityId: 59036 / "Serp Target"
-            local timeDiff = GetDiffBetweenTimeStamps(currentTime, lastNotify.so_magicka_deto)
+            local currentTime = GetTimeStamp()
+            local lastNotify  = self.tempVars.last_notify.sanctum_ophidia.magicka_deto
+            local timeDiff = GetDiffBetweenTimeStamps(currentTime, lastNotify)
             if (abilityId == 30255) and timeDiff > 10 then
-                self.tempVars.last_notify.so_magicka_deto = currentTime
+                self.tempVars.last_notify.sanctum_ophidia.magicka_deto = currentTime

                 -- get current magicka percentage
                 local current, maximum, _ = GetUnitPower("player", POWERTYPE_MAGICKA)
@@ -167,7 +176,7 @@ function RaidNotifier.sanctumDebuffs(_, change, buff, name, unit, start, finish,

                 -- only notify if the current magicka is over 15%
                 if magickaPercentage > 15 then
-                    CENTER_SCREEN_ANNOUNCE:AddMessage(1, CSA_EVENT_COMBINED_TEXT, SOUNDS.CHAMPION_POINTS_COMMITTED, GetString(RAIDNOTIFIER_SANCTUM_MAGICKA_DETONATION_ALERT), nil, nil, nil, nil, nil, 5000)
+                    CENTER_SCREEN_ANNOUNCE:AddMessage(1, CSA_EVENT_COMBINED_TEXT, SOUNDS.CHAMPION_POINTS_COMMITTED, GetString(RAIDNOTIFIER_ALERTS_SANCTUM_MAGICKA_DETONATION), nil, nil, nil, nil, nil, 5000)
                 end
             end
         end
diff --git a/RaidNotifier.txt b/RaidNotifier.txt
index 69093fe..96f717b 100644
--- a/RaidNotifier.txt
+++ b/RaidNotifier.txt
@@ -1,6 +1,6 @@
 ## Title: |cEFEBBERaidNotifier|r
 ## Author: |c009ad6silentgecko|r
-## Version: 1.0.0
+## Version: 1.1.0
 ## APIVersion: 100013
 ## SavedVariables: RNVars
 ## OptionalDependsOn: LibAddonMenu-2.0
diff --git a/lang/de.lua b/lang/de.lua
index 107257a..f8c3412 100644
--- a/lang/de.lua
+++ b/lang/de.lua
@@ -2,17 +2,18 @@ local L = {}
 -- ---------------------------------------------------
 -- SETTINGS ------------------------------------------
 -- ---------------------------------------------------
-L.Description                   = 'Zeigt verschiedene Benachrichtigungen während verschiedener Ereignisse auf dem Bildschirm an'
-L.Sanctum_Magicka_Detonation    = 'Magicka Detonation (Sanctum Ophidia)'
-L.Sanctum_Magicka_Detonation_TT = 'Zeigt dir eine Benachrichtigung auf dem Bildschirm, wenn du den Debuff der Magicka Detonation während des Endbosskampfs in Sancum Ophidia hast.'
-L.Sanctum_Poison                = 'Gift (Sanctum Ophidia)'
-L.Sanctum_Poison_TT             = 'Zeigt dir eine Benachrichtigung auf dem Bildschirm, wenn die Giftphase während des Endbosskampfs in Sancum Ophidia beginnt.'
+L.Description                            = 'Zeigt dir wichtige Benachrichtigungen während versch. Ereignisse in Trials an'
+L.Settings_Sanctum_Header                = 'Sanctum Ophidia'
+L.Settings_Sanctum_Magicka_Detonation    = 'Magicka Detonation'
+L.Settings_Sanctum_Magicka_Detonation_TT = 'Zeigt dir eine Benachrichtigung auf dem Bildschirm, wenn du den Debuff der Magicka Detonation während des Endbosskampfs hast.'
+L.Settings_Sanctum_Poison                = 'Gift'
+L.Settings_Sanctum_Poison_TT             = 'Zeigt dir eine Benachrichtigung auf dem Bildschirm, wenn die Giftphase während des Endbosskampfs beginnt.'

 -- ---------------------------------------------------
 -- Alerts --------------------------------------------
 -- ---------------------------------------------------
-L.Sanctum_Poison_Alert             = '|c39942eGift|r! Zusammen stehen!'
-L.Sanctum_Magicka_Detonation_Alert = '|c234afaMagicka Detonation|r! Verbrenn dein gesamtes Magicka!'
+L.Alerts_Sanctum_Poison             = '|c39942eGift|r! Zusammen stehen!'
+L.Alerts_Sanctum_Magicka_Detonation = '|c234afaMagicka Detonation|r! Verbrenn dein gesamtes Magicka!'

 for k, v in pairs(L) do
     local string = "RAIDNOTIFIER_" .. string.upper(k)
diff --git a/lang/en.lua b/lang/en.lua
index ec7a730..75cc398 100644
--- a/lang/en.lua
+++ b/lang/en.lua
@@ -2,17 +2,18 @@ local L = {}
 -- ---------------------------------------------------
 -- SETTINGS ------------------------------------------
 -- ---------------------------------------------------
-L.Description                   = 'Displays on-screen notifications on differend events'
-L.Sanctum_Magicka_Detonation    = 'Magicka Detonation (Sanctum Ophidia)'
-L.Sanctum_Magicka_Detonation_TT = 'Alerts when you got the debuff of the magicka detonation during the serpent fight.'
-L.Sanctum_Poison                = 'Poison (Sanctum Ophidia)'
-L.Sanctum_Poison_TT             = 'Alerts for the poison phase during the Serpent fight.'
+L.Description                            = 'Displays on-screen notifications on different events during trials'
+L.Settings_Sanctum_Header                = 'Sanctum Ophidia'
+L.Settings_Sanctum_Magicka_Detonation    = 'Magicka Detonation'
+L.Settings_Sanctum_Magicka_Detonation_TT = 'Alerts when you got the debuff of the magicka detonation during the serpent fight.'
+L.Settings_Sanctum_Poison                = 'Poison'
+L.Settings_Sanctum_Poison_TT             = 'Alerts for the poison phase during the Serpent fight.'

 -- ---------------------------------------------------
 -- Alerts --------------------------------------------
 -- ---------------------------------------------------
-L.Sanctum_Poison_Alert             = '|c39942ePoison|r! Stack together!'
-L.Sanctum_Magicka_Detonation_Alert = '|c234afaMagicka Detonation|r! Burn all your Magicka!'
+L.Alerts_Sanctum_Poison             = '|c39942ePoison|r! Stack together!'
+L.Alerts_Sanctum_Magicka_Detonation = '|c234afaMagicka Detonation|r! Burn all your Magicka!'

 for k, v in pairs(L) do
     local string = "RAIDNOTIFIER_" .. string.upper(k)