Rework localization in deathreporter
This commit is contained in:
@@ -79,9 +79,10 @@ function shared.DeathReporter.Init()
|
||||
ModuleName, source, destination, spellName))
|
||||
end
|
||||
|
||||
local location = Heimdall_Data.config.deathReporter.zoneOverride
|
||||
if not location or location == "" then
|
||||
location = string.format("%s (%s)", GetZoneText(), GetSubZoneText())
|
||||
local zone, subzone = GetZoneText() or "Unknown", GetSubZoneText() or "Unknown"
|
||||
if Heimdall_Data.config.spotter.zoneOverride then
|
||||
zone = Heimdall_Data.config.spotter.zoneOverride or ""
|
||||
subzone = ""
|
||||
end
|
||||
|
||||
local x, y = GetPlayerMapPosition("player")
|
||||
@@ -92,46 +93,26 @@ function shared.DeathReporter.Init()
|
||||
SetMapByID(GetCurrentMapAreaID())
|
||||
local zoneId = GetCurrentMapAreaID()
|
||||
|
||||
---@type Message
|
||||
local msg = {
|
||||
channel = "C",
|
||||
data = Heimdall_Data.config.deathReporter.masterChannel,
|
||||
message = string.format(shared.L.en.killed,
|
||||
for _, channel in pairs(Heimdall_Data.config.deathReporter.channels) do
|
||||
local locale = shared.GetLocaleForChannel(channel)
|
||||
local text = string.format(shared._L("killed", locale),
|
||||
source,
|
||||
destination,
|
||||
spellName,
|
||||
location,
|
||||
shared._L(spellName, locale),
|
||||
shared._L(zone, locale), shared._L(subzone, locale),
|
||||
zoneId,
|
||||
x * 100, y * 100)
|
||||
}
|
||||
if Heimdall_Data.config.deathReporter.debug then
|
||||
print(string.format("[%s] Adding message to queue: %s", ModuleName, msg.message))
|
||||
end
|
||||
table.insert(shared.messenger.queue, msg)
|
||||
local zone, subZone = GetZoneText(), GetSubZoneText()
|
||||
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.deathReporter.masterChannel .. "ru",
|
||||
message = string.format(shared.L.ru.killed,
|
||||
source,
|
||||
destination,
|
||||
spellName,
|
||||
string.format("%s (%s)", zone, subZone),
|
||||
zoneId,
|
||||
x * 100, y * 100)
|
||||
data = channel,
|
||||
message = text
|
||||
}
|
||||
table.insert(shared.messenger.queue, ruMsg)
|
||||
if Heimdall_Data.config.deathReporter.debug then
|
||||
print(string.format("[%s] Queuing death report message", ModuleName))
|
||||
shared.dumpTable(msg)
|
||||
end
|
||||
table.insert(shared.messenger.queue, msg)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user