From 87c208b29f0ba4342bf6ee4ab6fcc48d77cb21c1 Mon Sep 17 00:00:00 2001 From: Arrvis the Lion Date: Mon, 7 Feb 2022 17:31:32 +0300 Subject: [PATCH] [AS] Fixed early warning for Olms's Gusts of Steam mechanic (jumps) --- RaidNotifier.lua | 11 ++++++++++- TrialAsylumSanctorium.lua | 17 +++++++++++++++-- lang/de.lua | 2 +- lang/en.lua | 2 +- lang/es.lua | 2 +- lang/fr.lua | 2 +- lang/ru.lua | 1 + 7 files changed, 30 insertions(+), 7 deletions(-) diff --git a/RaidNotifier.lua b/RaidNotifier.lua index f7c0b9c..e3830e8 100644 --- a/RaidNotifier.lua +++ b/RaidNotifier.lua @@ -630,12 +630,14 @@ do ---------------------- dbg("Register for %s (%s)", GetRaidZoneName(self.raidId), GetString("SI_DUNGEONDIFFICULTY", self.raidDifficulty)) local trial = self.Trial[self.raidId] + local combatStateChangedCallback + if (trial) then trial.Initialize() local combatEventCallback = trial.OnCombatEvent local bossesChangedCallback = trial.OnBossesChanged local effectChangedCallback = trial.OnEffectChanged - local combatStateChangedCallback = trial.OnCombatStateChanged + combatStateChangedCallback = trial.OnCombatStateChanged local abilityList = {} local function RegisterForAbility(abId) @@ -745,6 +747,13 @@ do ---------------------- EVENT_MANAGER:UnregisterForEvent(self.Name, EVENT_BOSSES_CHANGED) EVENT_MANAGER:UnregisterForEvent(self.Name, EVENT_PLAYER_COMBAT_STATE) + local trial = self.Trial[self.raidId] + + -- Remove custom handlers which may have been assigned inside the trial "class" + if type(trial.Shutdown) == "function" then + trial.Shutdown() + end + --self:RemoveFragment() self:HideAllElements() listening = false diff --git a/TrialAsylumSanctorium.lua b/TrialAsylumSanctorium.lua index 0db3033..8c24a7c 100644 --- a/TrialAsylumSanctorium.lua +++ b/TrialAsylumSanctorium.lua @@ -11,10 +11,16 @@ local data = {} function RaidNotifier.AS.Initialize() p = RaidNotifier.p dbg = RaidNotifier.dbg - + data = {} end +function RaidNotifier.AS.Shutdown() + -- In case of zoning out during the battle "OnCombatStateChanged" handler may be unregistered before it'll be called + -- outside the combat; so we have to manually unregister handler for interval check here + EVENT_MANAGER:UnregisterForUpdate(RaidNotifier.Name .. "_IntervalCheck") +end + local function OnIntervalCheck() local self = RaidNotifier local raidId = RaidNotifier.raidId @@ -22,7 +28,12 @@ local function OnIntervalCheck() local settings = self.Vars.asylum if (settings.olms_gusts_of_steam and settings.olms_gusts_of_steam_slider > 0) then - health, maxHealth = GetUnitPower("boss1", POWERTYPE_HEALTH) -- Llothi + local health, maxHealth = GetUnitPower("boss1", POWERTYPE_HEALTH) -- It's always Olms in AS + -- Precautious check in case of situation when the fight is finished already but the combat state check didn't fire yet + -- (as we have 3 seconds delay for that currently) + if (health == 0 or maxHealth == 0) then + return + end local healthPercent = health * 100 / maxHealth if (data.olmsHealthChecked == nil) then data.olmsHealthChecked = healthPercent @@ -40,6 +51,8 @@ end function RaidNotifier.AS.OnCombatStateChanged(inCombat) local self = RaidNotifier if (inCombat) then + -- At the start of the fight we want to clear all previous fight data collected + data = {} EVENT_MANAGER:RegisterForUpdate(self.Name .. "_IntervalCheck", 1000, OnIntervalCheck); dbg("start interval check") else diff --git a/lang/de.lua b/lang/de.lua index 8cc99fd..a93f942 100644 --- a/lang/de.lua +++ b/lang/de.lua @@ -405,7 +405,7 @@ L.Alerts_Asylum_Teleport_Strike_Other = "|cFF3366Teleportationsschlag L.Alerts_Asylum_Exhaustive_Charges = "Eingehende |cFF0000Erschöpfende Ladungen|r" L.Alerts_Asylum_Storm_The_Heavens = "Eingehende |cFF0000Erstürmung des Himmels|r! Kite!" L.Alerts_Asylum_Gusts_Of_Steam = "Eingehende |cFF9900Dampfschwaden|r! Verstecken!" -L.Alerts_Asylum_Pre_Gusts_Of_Steam = "<<1>> vor |cFF0000Sprung|r! Bereit zu Laufen!" +L.Alerts_Asylum_Pre_Gusts_Of_Steam = "|cFF0000<<1>>%|r vor |cFF9900Sprung|r! Bereit zu Laufen!" L.Alerts_Asylum_Trial_By_Fire = "Eingehendes |cFF5500Feuer|r!" L.Alerts_Asylum_Protector_Spawn = "|c0000FFGeschütz|r erscheint!" L.Alerts_Asylum_Protector_Active = "|c0000FFGeschütz|r aktiv!" diff --git a/lang/en.lua b/lang/en.lua index 4740a05..290fbaf 100644 --- a/lang/en.lua +++ b/lang/en.lua @@ -414,7 +414,7 @@ L.Alerts_Asylum_Teleport_Strike_Other = "|cFF3366Teleport Strike|r on L.Alerts_Asylum_Exhaustive_Charges = "Incoming |cFF0000Exhaustive Charges|r" L.Alerts_Asylum_Storm_The_Heavens = "Incoming |cFF0000Storm The Heavens|r! Kite!" L.Alerts_Asylum_Gusts_Of_Steam = "Incoming |cFF9900Gusts Of Steam|r! Hide!" -L.Alerts_Asylum_Pre_Gusts_Of_Steam = "<<1>> to |cFF0000jump|r! Prepare to Hide!" +L.Alerts_Asylum_Pre_Gusts_Of_Steam = "|cFF0000<<1>>%|r to |cFF9900jump|r! Prepare to Hide!" L.Alerts_Asylum_Trial_By_Fire = "Incoming |cFF5500Fire|r!" L.Alerts_Asylum_Protector_Spawn = "|c0000FFProtector|r spawning!" L.Alerts_Asylum_Protector_Active = "|c0000FFProtector|r active!" diff --git a/lang/es.lua b/lang/es.lua index 87d8dd4..8efe610 100644 --- a/lang/es.lua +++ b/lang/es.lua @@ -416,7 +416,7 @@ L.Alerts_Asylum_Teleport_Strike_Other = "|cFF3366 Golpe de transporta L.Alerts_Asylum_Exhaustive_Charges = "|cFF0000Cargas agotadoras|r inminente." L.Alerts_Asylum_Storm_The_Heavens = "¡|cFF0000Asalto desde los Cielos|r inminente! ¡Aléjate lentamente!" L.Alerts_Asylum_Gusts_Of_Steam = "¡|cFF9900Ráfagas de vapor|r inminente! ¡Escóndete!" -L.Alerts_Asylum_Pre_Gusts_Of_Steam = "¡<<1>> va a |cFF0000saltar|r! ¡Preparate para esconderte!" +L.Alerts_Asylum_Pre_Gusts_Of_Steam = "¡|cFF0000<<1>>%|r va a |cFF9900saltar|r! ¡Preparate para esconderte!" L.Alerts_Asylum_Trial_By_Fire = "¡|cFF5500Fuego|r inminente!" L.Alerts_Asylum_Protector_Spawn = "¡|c0000FFProtector|r apareciendo!" L.Alerts_Asylum_Protector_Active = "¡|c0000FFProtector|r activo!" diff --git a/lang/fr.lua b/lang/fr.lua index 61b42cb..19e9bd9 100644 --- a/lang/fr.lua +++ b/lang/fr.lua @@ -398,7 +398,7 @@ L.Alerts_Asylum_Teleport_Strike_Other = "|cFF3366Téléportation|r su L.Alerts_Asylum_Exhaustive_Charges = "En Approche |cFF0000Charges Épuisantes|r" L.Alerts_Asylum_Storm_The_Heavens = "En Approche |cFF0000Assaillir les Cieux|r! Courez!" L.Alerts_Asylum_Gusts_Of_Steam = "En Approche |cFF9900Nuages de Vapeur|r! Cachez vous!" -L.Alerts_Asylum_Pre_Gusts_Of_Steam = "<<1>>% avant |cFF0000Saut|r! Préparez vous!" +L.Alerts_Asylum_Pre_Gusts_Of_Steam = "|cFF0000<<1>>%|r avant |cFF9900Saut|r! Préparez vous!" L.Alerts_Asylum_Trial_By_Fire = "En Approche |cFF5500Feu|r!" L.Alerts_Asylum_Protector_Spawn = "Apparition d'un |c0000FFProtecteur|r!" L.Alerts_Asylum_Protector_Active = "|c0000FFProtecteur|r actif!" diff --git a/lang/ru.lua b/lang/ru.lua index aed59f0..e180289 100644 --- a/lang/ru.lua +++ b/lang/ru.lua @@ -398,6 +398,7 @@ L.Alerts_Asylum_Storm_The_Heavens = "Приближается |cF L.Alerts_Asylum_Eruption = "|c595959Eruption|r нацелена на тебя!" L.Alerts_Asylum_Eruption_Other = "|c595959Eruption|r нацелена на игрока |cFC0000<>|r!" L.Alerts_Asylum_Gusts_Of_Steam = "Приближается |cFF9900Gusts Of Steam|r! СПРЯЧЬСЯ!" +L.Alerts_Asylum_Pre_Gusts_Of_Steam = "|cFF0000<<1>>%|r до |cFF9900прыжка|r! ГОТОВЬСЯ прятаться!" L.Alerts_Asylum_Trial_By_Fire = "Приближается |cFF5500Fire|r!" L.Alerts_Asylum_Protector_Spawn = "Появляется |c0000FFЗащитник|r!" L.Alerts_Asylum_Protector_Active = "|c0000FFЗащитник|r активирован!"