diff --git a/BuffsDebuffs.lua b/BuffsDebuffs.lua new file mode 100644 index 0000000..7dd39a7 --- /dev/null +++ b/BuffsDebuffs.lua @@ -0,0 +1,87 @@ + +RaidNotifier = RaidNotifier or {} +RaidNotifier.BuffsDebuffs = {} +-- --------------------------------------------------- +-- Sanctum Ophidia ----------------------------------- +-- --------------------------------------------------- +-- i don't know which of these debuffs is the correct, so we add all ;-) +-- Poison +local sanctum = {} +sanctum.poison = {} +sanctum.poison[38965] = true +sanctum.poison[38968] = true +sanctum.poison[38969] = true +sanctum.poison[41822] = true +sanctum.poison[41823] = true +sanctum.poison[41824] = true +sanctum.poison[41826] = true +sanctum.poison[41827] = true +sanctum.poison[41829] = true +sanctum.poison[41830] = true +sanctum.poison[41832] = true +sanctum.poison[41833] = true +sanctum.poison[53782] = true +sanctum.poison[53786] = true +sanctum.poison[53792] = true +sanctum.poison[53799] = true +sanctum.poison[53815] = true +sanctum.poison[54476] = true +sanctum.poison[54692] = true +sanctum.poison[55085] = true +sanctum.poison[55086] = true +sanctum.poison[55089] = true +sanctum.poison[55148] = true +sanctum.poison[57989] = true +sanctum.poison[65779] = true +sanctum.poison[65780] = true +sanctum.poison[65781] = true + +-- Sanctum Magicka Detonation +sanctum.magicka_deto = 59036 + +-- add ids back to global +RaidNotifier.BuffsDebuffs.sanctum_ophidia = sanctum + +-- --------------------------------------------------- +-- BuffFood ------------------------------------------ +-- --------------------------------------------------- +local buffFood = {} +buffFood[17407] = true -- max life +buffFood[17565] = true -- max magicka +buffFood[17567] = true -- max stamina +buffFood[17569] = true -- max life and magicka +buffFood[17577] = true -- max life and stamina +buffFood[47049] = true -- max life +buffFood[47051] = true -- max stamina +buffFood[61257] = true -- max life and magicka +buffFood[61259] = true -- max life +buffFood[61261] = true -- max stamina +buffFood[61294] = true -- max life and stamina +buffFood[66551] = true -- max life +buffFood[66124] = true -- max life +buffFood[66125] = true -- max life +buffFood[66127] = true -- max magicka +buffFood[66128] = true -- max magicka +buffFood[66129] = true -- max stamina +buffFood[66130] = true -- max stamina +buffFood[66131] = true -- lifereg +buffFood[66132] = true -- lifereg +buffFood[66136] = true -- magickareg +buffFood[66137] = true -- magickareg +buffFood[66140] = true -- staminareg +buffFood[66141] = true -- staminareg +buffFood[66576] = true -- max stamina +buffFood[68411] = true -- max all +buffFood[68412] = true -- max stamina +buffFood[68413] = true -- max magicka +buffFood[72816] = true -- max life and magicka +buffFood[72824] = true -- max life and reg +buffFood[72956] = true -- max life and stamina +buffFood[72957] = true -- max life +buffFood[72959] = true -- max life and magicka +buffFood[72960] = true -- max life +buffFood[72961] = true -- max stamina and magicka +buffFood[72962] = true -- max life + +-- add ids back to global +RaidNotifier.BuffsDebuffs.buffFood = buffFood \ No newline at end of file diff --git a/RaidNotifier.lua b/RaidNotifier.lua index 25bf774..dbc5292 100644 --- a/RaidNotifier.lua +++ b/RaidNotifier.lua @@ -1,27 +1,33 @@ local LAM = LibStub:GetLibrary("LibAddonMenu-2.0") -RaidNotifier = {} +RaidNotifier = RaidNotifier or {} RaidNotifier.name = 'RaidNotifier' RaidNotifier.slash = '/rn' -RaidNotifier.version = '1.1.1' +RaidNotifier.version = '1.2.0' RaidNotifier.versionDB = 1 RaidNotifier.loaded = false RaidNotifier.author = 'silentgecko' RaidNotifier.savedVarsName = 'RNVars' RaidNotifier.variables = { sanctum_ophidia = { - magicka_deto = true, - poison = true, + magicka_deto = true, + poison = true, }, + general = { + buffFood_reminder = true, + } } RaidNotifier.tempVars = { last_notify = { sanctum_ophidia = { magicka_deto = 0, - poison = 0 + poison = 0, }, + general = { + buffFood_reminder = 0, + } }, } @@ -43,6 +49,19 @@ local function CreateSettingsMenu() }, { type = "header", + name = GetString(RAIDNOTIFIER_SETTINGS_GENERAL_HEADER), + }, + { + type = "checkbox", + name = GetString(RAIDNOTIFIER_SETTINGS_GENERAL_BUFFFOOD_REMINDER), + tooltip = GetString(RAIDNOTIFIER_SETTINGS_GENERAL_BUFFFOOD_REMINDER_TT), + getFunc = function() return RaidNotifier.savedVariables.general.buffFood_reminder end, + setFunc = function(value) + RaidNotifier.savedVariables.general.buffFood_reminder = value + end, + }, + { + type = "header", name = GetString(RAIDNOTIFIER_SETTINGS_SANCTUM_HEADER), }, { @@ -97,6 +116,10 @@ end function RaidNotifier.addEventListeners() local self = RaidNotifier local raidId = GetCurrentParticipatingRaidId() + + -- add general + EVENT_MANAGER:RegisterForEvent(self.name, EVENT_EFFECT_CHANGED, self.generalBuffFoodReminder) + -- add sanctum if raidId == 3 then EVENT_MANAGER:RegisterForEvent(self.name, EVENT_EFFECT_CHANGED, self.sanctumDebuffs) @@ -116,45 +139,16 @@ function RaidNotifier.sanctumDebuffs(_, change, buff, name, unit, start, finish, if (unit ~= 'player') then return end local self = RaidNotifier + local buffsDebuffs = self.BuffsDebuffs.sanctum_ophidia -- only notice on effect added if (change == EFFECT_RESULT_GAINED) 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 - poison[38968] = true - poison[38969] = true - poison[41822] = true - poison[41823] = true - poison[41824] = true - poison[41826] = true - poison[41827] = true - poison[41829] = true - poison[41830] = true - poison[41832] = true - poison[41833] = true - poison[53782] = true - poison[53786] = true - poison[53792] = true - poison[53799] = true - poison[53815] = true - poison[54476] = true - poison[54692] = true - poison[55085] = true - poison[55086] = true - poison[55089] = true - poison[55148] = true - poison[57989] = true - poison[65779] = true - poison[65780] = true - poison[65781] = true - -- only notify when the last one is at least 15 seconds ago and it is 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 + if (buffsDebuffs.poison[abilityId]) and timeDiff > 15 then 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 @@ -167,7 +161,7 @@ function RaidNotifier.sanctumDebuffs(_, change, buff, name, unit, start, finish, local currentTime = GetTimeStamp() local lastNotify = self.tempVars.last_notify.sanctum_ophidia.magicka_deto local timeDiff = GetDiffBetweenTimeStamps(currentTime, lastNotify) - if (abilityId == 59036) and timeDiff > 10 then + if (abilityId == buffsDebuffs.magicka_deto) and timeDiff > 10 then self.tempVars.last_notify.sanctum_ophidia.magicka_deto = currentTime -- get current magicka percentage @@ -183,5 +177,65 @@ function RaidNotifier.sanctumDebuffs(_, change, buff, name, unit, start, finish, end end +function RaidNotifier.generalBuffFoodReminder(_, change, buff, name, unit, start, finish, stack, icon, _, effectType, abilityType, statusEffectType, unitName, unitId, abilityId) + -- only take care of player + if (unit ~= 'player') then return end + + local self = RaidNotifier + + -- return if the player don't want the reminder + if self.savedVariables.general.buffFood_reminder == false then + return + end + + local buffsDebuffs = self.BuffsDebuffs.buffFood + local buffFoodFound = false + + local numAuras = GetNumBuffs('player') + if (numAuras > 0) then + local currentTime = GetTimeStamp() + + for x = 1, numAuras do + local name, start, finish, _, _, _, _, _, _, _, abilityId, _ = GetUnitBuffInfo('player', x) + if buffsDebuffs[abilityId] then + -- set bufffoodfound to true + buffFoodFound = true + + local bufffood_remaining = finish - (GetFrameTimeMilliseconds() / 1000.0) + local lastNotify = self.tempVars.last_notify.general.buffFood_reminder + 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)) + end + end + end + + -- no bufffood found, alert every minute + if buffFoodFound == false then + local lastNotify = self.tempVars.last_notify.general.buffFood_reminder + local lastNotifyDiff = GetDiffBetweenTimeStamps(currentTime, lastNotify) + if lastNotifyDiff > 60 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 + end + else + -- no buffs found, we can directly alert + CENTER_SCREEN_ANNOUNCE:AddMessage(3, CSA_EVENT_SMALL_TEXT, SOUNDS.CHAMPION_POINTS_COMMITTED, GetString(RAIDNOTIFIER_ALERTS_GENERAL_NO_BUFFFOOD)) + end +end + ---------Events------- EVENT_MANAGER:RegisterForEvent(RaidNotifier.name, EVENT_ADD_ON_LOADED, RaidNotifier.Initialize) diff --git a/RaidNotifier.txt b/RaidNotifier.txt index 2dd5b61..92ac9c2 100644 --- a/RaidNotifier.txt +++ b/RaidNotifier.txt @@ -1,6 +1,6 @@ ## Title: |cEFEBBERaidNotifier|r ## Author: |c009ad6silentgecko|r -## Version: 1.1.1 +## Version: 1.2.0 ## APIVersion: 100013 ## SavedVariables: RNVars ## OptionalDependsOn: LibAddonMenu-2.0 @@ -22,6 +22,7 @@ libs/LibAddonMenu-2.0/controls/slider.lua libs/LibAddonMenu-2.0/controls/texture.lua RaidNotifier.lua +BuffsDebuffs.lua lang/en.lua lang/$(language).lua \ No newline at end of file diff --git a/lang/de.lua b/lang/de.lua index f8c3412..2b19f24 100644 --- a/lang/de.lua +++ b/lang/de.lua @@ -3,6 +3,11 @@ local L = {} -- SETTINGS ------------------------------------------ -- --------------------------------------------------- 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_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.' @@ -15,6 +20,9 @@ L.Settings_Sanctum_Poison_TT = 'Zeigt dir eine Benachrichtigung auf L.Alerts_Sanctum_Poison = '|c39942eGift|r! Zusammen stehen!' L.Alerts_Sanctum_Magicka_Detonation = '|c234afaMagicka Detonation|r! Verbrenn dein gesamtes Magicka!' +L.Alerts_General_No_Bufffood = 'Du hast kein Bufffood genommen!' +L.Alerts_General_Bufffood_Minutes = 'Dein Bufffood "<<1>>" läuft in |cbd0000<<2>>|r Minuten aus!' + for k, v in pairs(L) do local string = "RAIDNOTIFIER_" .. string.upper(k) ZO_CreateStringId(string, v) diff --git a/lang/en.lua b/lang/en.lua index 75cc398..76b2452 100644 --- a/lang/en.lua +++ b/lang/en.lua @@ -3,6 +3,11 @@ local L = {} -- SETTINGS ------------------------------------------ -- --------------------------------------------------- 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_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.' @@ -15,6 +20,9 @@ L.Settings_Sanctum_Poison_TT = 'Alerts for the poison phase during t L.Alerts_Sanctum_Poison = '|c39942ePoison|r! Stack together!' L.Alerts_Sanctum_Magicka_Detonation = '|c234afaMagicka Detonation|r! Burn all your Magicka!' +L.Alerts_General_No_Bufffood = 'You have taken no bufffood!' +L.Alerts_General_Bufffood_Minutes = 'Your "<<1>>" bufffood runs out in |cbd0000<<2>>|r minutes!' + for k, v in pairs(L) do local string = "RAIDNOTIFIER_" .. string.upper(k) ZO_CreateStringId(string, v)