diff --git a/Modules/CombatAlerter.lua b/Modules/CombatAlerter.lua index 3ba1c9a..918dacd 100644 --- a/Modules/CombatAlerter.lua +++ b/Modules/CombatAlerter.lua @@ -69,44 +69,27 @@ function shared.CombatAlerter.Init() SetMapToCurrentZone() SetMapByID(GetCurrentMapAreaID()) - ---@type Message - local msg = { - channel = "C", - data = Heimdall_Data.config.combatAlerter.masterChannel, - message = string.format(shared.L.en.combatAlerterInCombat, + local areaId = GetCurrentMapAreaID() + + for _, channel in pairs(Heimdall_Data.config.combatAlerter.channels) do + local locale = shared.GetLocaleForChannel(channel) + local text = string.format(shared._L("combatAlerterInCombat", locale), source, - zone, subZone, - tostring(GetCurrentMapAreaID()), + shared._L("zone", locale), shared._L("subZone", locale), + tostring(areaId), x * 100, y * 100 - ), - } - - if Heimdall_Data.config.combatAlerter.debug then - print(string.format("[%s] Queuing alert message: '%s'", ModuleName, msg.message)) - end - table.insert(shared.messenger.queue, msg) - if not shared.L.ru.zones[zone] then - print(string.format("[%s] Zone %s not found in ru.zones", ModuleName, zone)) - end - zone = shared.L.ru.zones[zone] or zone - if not shared.L.ru.zones[subZone] then - print(string.format("[%s] Subzone %s not found in ru.zones", ModuleName, subZone)) - end - subZone = shared.L.ru.zones[subZone] or subZone - - if Heimdall_Data.config.echoToRussian then - -- Russian message - local ruMsg = { + ) + ---@type Message + local msg = { channel = "C", - data = Heimdall_Data.config.combatAlerter.masterChannel .. "ru", - message = string.format(shared.L.ru.combatAlerterInCombat, - source, - zone, subZone, - tostring(GetCurrentMapAreaID()), - x * 100, y * 100 - ), + data = channel, + message = text, } - table.insert(shared.messenger.queue, ruMsg) + if Heimdall_Data.config.combatAlerter.debug then + print(string.format("[%s] Queuing alert message", ModuleName)) + shared.dumpTable(msg) + end + table.insert(shared.messenger.queue, msg) end elseif Heimdall_Data.config.combatAlerter.debug then print(string.format("[%s] Source not in stinky list, ignoring: %s", ModuleName, source))