diff --git a/WeakAuras/AuraWarnings.lua b/WeakAuras/AuraWarnings.lua index f835acf6bd..b72ee944a3 100644 --- a/WeakAuras/AuraWarnings.lua +++ b/WeakAuras/AuraWarnings.lua @@ -5,6 +5,7 @@ local AddonName, Private = ... --- @alias AuraWarningSeverity --- | "info" --- | "sound" +--- | "tts" --- | "warning" --- | "error" @@ -63,14 +64,16 @@ end local severityLevel = { info = 0, sound = 1, - warning = 2, - error = 3 + tts = 2, + warning = 3, + error = 4 } --- @type table local icons = { info = [[Interface/friendsframe/informationicon.blp]], sound = [[chatframe-button-icon-voicechat]], + tts = [[chatframe-button-icon-tts]], warning = [[Interface/buttons/adventureguidemicrobuttonalert.blp]], error = [[Interface/DialogFrame/UI-Dialog-Icon-AlertNew]] } @@ -79,6 +82,7 @@ local icons = { local titles = { info = L["Information"], sound = L["Sound"], + tts = L["Text To Speech"], warning = L["Warning"], error = L["Error"], } @@ -142,6 +146,7 @@ function Private.AuraWarnings.FormatWarnings(uid) result = AddMessages(result, messagePerSeverity["error"], icons["error"], mixedSeverity) result = AddMessages(result, messagePerSeverity["warning"], icons["warning"], mixedSeverity) result = AddMessages(result, messagePerSeverity["sound"], icons["sound"], mixedSeverity) + result = AddMessages(result, messagePerSeverity["tts"], icons["tts"], mixedSeverity) result = AddMessages(result, messagePerSeverity["info"], icons["info"], mixedSeverity) return icons[maxSeverity], titles[maxSeverity], result end diff --git a/WeakAuras/WeakAuras.lua b/WeakAuras/WeakAuras.lua index 7b1a375fcb..bce1e06497 100644 --- a/WeakAuras/WeakAuras.lua +++ b/WeakAuras/WeakAuras.lua @@ -2818,30 +2818,53 @@ local oldDataStub2 = { } function Private.UpdateSoundIcon(data) - local function anySoundCondition() + local function testConditions() + local sound, tts if data.conditions then for _, condition in ipairs(data.conditions) do for changeIndex, change in ipairs(condition.changes) do if change.property == "sound" then - return true + sound = true end + if change.property == "chat" and change.value and change.value.message_type == "TTS" then + tts = true + end + if sound and tts then break end end end end + return sound, tts end + local soundCondition, ttsCondition = testConditions() + + -- sound if data.actions.start.do_sound or data.actions.finish.do_sound then Private.AuraWarnings.UpdateWarning(data.uid, "sound_action", "sound", L["This aura plays a sound via an action."]) else Private.AuraWarnings.UpdateWarning(data.uid, "sound_action") end - if anySoundCondition() then + if soundCondition then Private.AuraWarnings.UpdateWarning(data.uid, "sound_condition", "sound", L["This aura plays a sound via a condition."]) else Private.AuraWarnings.UpdateWarning(data.uid, "sound_condition") end + -- tts + if (data.actions.start.do_message and data.actions.start.message_type == "TTS") + or (data.actions.finish.do_message and data.actions.finish.message_type == "TTS") + then + Private.AuraWarnings.UpdateWarning(data.uid, "tts_action", "tts", L["This aura plays a Text To Speech via an action."]) + else + Private.AuraWarnings.UpdateWarning(data.uid, "tts_action") + end + + if ttsCondition then + Private.AuraWarnings.UpdateWarning(data.uid, "tts_condition", "tts", L["This aura plays a Text To Speech via a condition."]) + else + Private.AuraWarnings.UpdateWarning(data.uid, "tts_condition") + end end function WeakAuras.PreAdd(data)