Fix whoer localization
This commit is contained in:
@@ -56,53 +56,6 @@ function shared.Whoer.Init()
|
||||
self.seenCount)
|
||||
return string.format("|cFF%s%s|r", shared.classColors[self.class], out)
|
||||
end,
|
||||
---@return string
|
||||
NotifyMessage = function(self)
|
||||
local text = string.format(shared.L.en.whoerNew,
|
||||
self.name,
|
||||
self.stinky and "(!!!!)" or "",
|
||||
self.class,
|
||||
self.race,
|
||||
tostring(shared.raceMap[self.race]),
|
||||
self.guild,
|
||||
self.zone)
|
||||
--self.firstSeen,
|
||||
--self.lastSeen,
|
||||
--self.seenCount)
|
||||
return text
|
||||
end,
|
||||
---@return string
|
||||
NotifyRu = function(self)
|
||||
local ruClass = shared.L.ru.classes[self.class]
|
||||
if not ruClass then
|
||||
print(string.format("[%s] Class %s not found in ru.classes", ModuleName, self.class))
|
||||
end
|
||||
|
||||
local ruRace = shared.L.ru.races[self.race]
|
||||
if not ruRace then
|
||||
print(string.format("[%s] Race %s not found in ru.races", ModuleName, self.race))
|
||||
end
|
||||
|
||||
local faction = shared.raceMap[self.race]
|
||||
local ruFaction = shared.L.ru.factions[faction]
|
||||
if not ruFaction then
|
||||
print(string.format("[%s] Faction %s not found in ru.factions", ModuleName, tostring(faction)))
|
||||
ruFaction = "неизвестно"
|
||||
end
|
||||
|
||||
local text = string.format(shared.L.ru.whoerNew,
|
||||
self.name,
|
||||
self.stinky and "(!!!!)" or "",
|
||||
ruClass or self.class,
|
||||
ruRace or self.race,
|
||||
ruFaction or faction,
|
||||
self.guild,
|
||||
self.zone)
|
||||
--self.firstSeen,
|
||||
--self.lastSeen,
|
||||
--self.seenCount)
|
||||
return text
|
||||
end
|
||||
}
|
||||
|
||||
---@class WHOQuery
|
||||
@@ -300,51 +253,49 @@ function shared.Whoer.Init()
|
||||
return string.format("Not notifying for zone %s", tostring(player.zone))
|
||||
end
|
||||
|
||||
local text = player:NotifyMessage()
|
||||
if Heimdall_Data.config.who.debug then
|
||||
print(string.format("[%s] Queuing channel notification: '%s'", ModuleName, text))
|
||||
end
|
||||
|
||||
---@type Message
|
||||
local msg = {
|
||||
channel = "C",
|
||||
data = Heimdall_Data.config.who.notifyChannel,
|
||||
message = text
|
||||
}
|
||||
--table.insert(shared.messenger.queue, msg)
|
||||
table.insert(shared.networkMessenger.queue, msg)
|
||||
|
||||
if Heimdall_Data.config.who.doWhisper then
|
||||
if Heimdall_Data.config.who.debug then
|
||||
print(string.format("[%s] Processing whisper notifications for %d recipients", ModuleName,
|
||||
#Heimdall_Data.config.whisperNotify))
|
||||
end
|
||||
for _, name in pairs(Heimdall_Data.config.whisperNotify) do
|
||||
---@type Message
|
||||
local msg = {
|
||||
channel = "W",
|
||||
data = name,
|
||||
message = text
|
||||
}
|
||||
if Heimdall_Data.config.who.debug then
|
||||
print(string.format("[%s] Queuing whisper to %s", ModuleName, name))
|
||||
end
|
||||
--table.insert(shared.messenger.queue, msg)
|
||||
table.insert(shared.networkMessenger.queue, msg)
|
||||
end
|
||||
end
|
||||
|
||||
if Heimdall_Data.config.echoToRussian then
|
||||
-- Russian message
|
||||
local ruMsg = {
|
||||
for _, channel in pairs(Heimdall_Data.config.who.channels) do
|
||||
local locale = shared.GetLocaleForChannel(channel)
|
||||
local text = string.format(shared._L("whoerNew", locale),
|
||||
player.name,
|
||||
player.stinky and "(!!!!)" or "",
|
||||
shared._L(player.class, locale),
|
||||
shared._L(player.race, locale),
|
||||
shared._L(shared.raceMap[player.race] or "unknown", locale),
|
||||
player.guild,
|
||||
shared._L(player.zone, locale))
|
||||
---@type Message
|
||||
local msg = {
|
||||
channel = "C",
|
||||
data = Heimdall_Data.config.who.notifyChannel .. "ru",
|
||||
message = player:NotifyRu()
|
||||
data = channel,
|
||||
message = text
|
||||
}
|
||||
--table.insert(shared.messenger.queue, ruMsg)
|
||||
table.insert(shared.networkMessenger.queue, ruMsg)
|
||||
if Heimdall_Data.config.who.debug then
|
||||
print(string.format("[%s] Queuing channel notification", ModuleName))
|
||||
shared.dumpTable(msg)
|
||||
end
|
||||
table.insert(shared.networkMessenger.queue, msg)
|
||||
end
|
||||
|
||||
--if Heimdall_Data.config.who.doWhisper then
|
||||
-- if Heimdall_Data.config.who.debug then
|
||||
-- print(string.format("[%s] Processing whisper notifications for %d recipients", ModuleName,
|
||||
-- #Heimdall_Data.config.whisperNotify))
|
||||
-- end
|
||||
-- for _, name in pairs(Heimdall_Data.config.whisperNotify) do
|
||||
-- ---@type Message
|
||||
-- local msg = {
|
||||
-- channel = "W",
|
||||
-- data = name,
|
||||
-- message = text
|
||||
-- }
|
||||
-- if Heimdall_Data.config.who.debug then
|
||||
-- print(string.format("[%s] Queuing whisper to %s", ModuleName, name))
|
||||
-- end
|
||||
-- --table.insert(shared.messenger.queue, msg)
|
||||
-- table.insert(shared.networkMessenger.queue, msg)
|
||||
-- end
|
||||
--end
|
||||
|
||||
return nil
|
||||
end
|
||||
---@param player Player
|
||||
@@ -358,53 +309,42 @@ function shared.Whoer.Init()
|
||||
if not ShouldNotifyForZone(zone) and not ShouldNotifyForZone(player.zone) then
|
||||
return string.format("Not notifying for zones %s and %s", tostring(zone), tostring(player.zone))
|
||||
end
|
||||
local text = string.format(shared.L.en.whoerMoved,
|
||||
player.name,
|
||||
player.class,
|
||||
player.race,
|
||||
shared.raceMap[player.race] or "Unknown",
|
||||
player.guild,
|
||||
zone)
|
||||
for _, channel in pairs(Heimdall_Data.config.who.channels) do
|
||||
local locale = shared.GetLocaleForChannel(channel)
|
||||
local text = string.format(shared._L("whoerMoved", locale),
|
||||
player.name,
|
||||
shared._L(player.class, locale),
|
||||
shared._L(player.race, locale),
|
||||
shared._L(shared.raceMap[player.race] or "unknown", locale),
|
||||
player.guild,
|
||||
shared._L(zone, locale))
|
||||
|
||||
---@type Message
|
||||
local msg = {
|
||||
channel = "C",
|
||||
data = Heimdall_Data.config.who.notifyChannel,
|
||||
message = text
|
||||
}
|
||||
--table.insert(shared.messenger.queue, msg)
|
||||
table.insert(shared.networkMessenger.queue, msg)
|
||||
|
||||
text = string.format(shared.L.ru.whoerMoved,
|
||||
player.name,
|
||||
player.class,
|
||||
player.race,
|
||||
shared.raceMap[player.race] or "Unknown",
|
||||
player.guild,
|
||||
zone)
|
||||
|
||||
---@type Message
|
||||
msg = {
|
||||
channel = "C",
|
||||
data = Heimdall_Data.config.who.notifyChannel .. "ru",
|
||||
message = text
|
||||
}
|
||||
--table.insert(shared.messenger.queue, msg)
|
||||
table.insert(shared.networkMessenger.queue, msg)
|
||||
|
||||
if Heimdall_Data.config.who.doWhisper then
|
||||
for _, name in pairs(Heimdall_Data.config.whisperNotify) do
|
||||
---@type Message
|
||||
local msg = {
|
||||
channel = "W",
|
||||
data = name,
|
||||
message = text
|
||||
}
|
||||
--table.insert(shared.messenger.queue, msg)
|
||||
table.insert(shared.networkMessenger.queue, msg)
|
||||
---@type Message
|
||||
local msg = {
|
||||
channel = "C",
|
||||
data = channel,
|
||||
message = text
|
||||
}
|
||||
if Heimdall_Data.config.who.debug then
|
||||
print(string.format("[%s] Queuing channel notification", ModuleName))
|
||||
shared.dumpTable(msg)
|
||||
end
|
||||
table.insert(shared.networkMessenger.queue, msg)
|
||||
end
|
||||
|
||||
--if Heimdall_Data.config.who.doWhisper then
|
||||
-- for _, name in pairs(Heimdall_Data.config.whisperNotify) do
|
||||
-- ---@type Message
|
||||
-- local msg = {
|
||||
-- channel = "W",
|
||||
-- data = name,
|
||||
-- message = text
|
||||
-- }
|
||||
-- --table.insert(shared.messenger.queue, msg)
|
||||
-- table.insert(shared.networkMessenger.queue, msg)
|
||||
-- end
|
||||
--end
|
||||
|
||||
return nil
|
||||
end
|
||||
---@param player Player
|
||||
@@ -417,49 +357,41 @@ function shared.Whoer.Init()
|
||||
return string.format("Not notifying for zone %s", tostring(player.zone))
|
||||
end
|
||||
|
||||
local text = string.format(shared.L.en.whoerGone,
|
||||
player.name,
|
||||
player.class,
|
||||
player.guild,
|
||||
player.zone)
|
||||
for _, channel in pairs(Heimdall_Data.config.who.channels) do
|
||||
local locale = shared.GetLocaleForChannel(channel)
|
||||
local text = string.format(shared._L("whoerGone", locale),
|
||||
player.name,
|
||||
shared._L(player.class, locale),
|
||||
player.guild,
|
||||
shared._L(player.zone, locale))
|
||||
|
||||
---@type Message
|
||||
local msg = {
|
||||
channel = "C",
|
||||
data = Heimdall_Data.config.who.notifyChannel,
|
||||
message = text
|
||||
}
|
||||
--table.insert(shared.messenger.queue, msg)
|
||||
table.insert(shared.networkMessenger.queue, msg)
|
||||
|
||||
text = string.format(shared.L.ru.whoerGone,
|
||||
player.name,
|
||||
player.class,
|
||||
player.guild,
|
||||
player.zone)
|
||||
|
||||
---@type Message
|
||||
msg = {
|
||||
channel = "C",
|
||||
data = Heimdall_Data.config.who.notifyChannel .. "ru",
|
||||
message = text
|
||||
}
|
||||
--table.insert(shared.messenger.queue, msg)
|
||||
table.insert(shared.networkMessenger.queue, msg)
|
||||
|
||||
if Heimdall_Data.config.who.doWhisper then
|
||||
for _, name in pairs(Heimdall_Data.config.whisperNotify) do
|
||||
---@type Message
|
||||
local msg = {
|
||||
channel = "W",
|
||||
data = name,
|
||||
message = text
|
||||
}
|
||||
--table.insert(shared.messenger.queue, msg)
|
||||
table.insert(shared.networkMessenger.queue, msg)
|
||||
---@type Message
|
||||
local msg = {
|
||||
channel = "C",
|
||||
data = channel,
|
||||
message = text
|
||||
}
|
||||
if Heimdall_Data.config.who.debug then
|
||||
print(string.format("[%s] Queuing channel notification", ModuleName))
|
||||
shared.dumpTable(msg)
|
||||
end
|
||||
--table.insert(shared.messenger.queue, msg)
|
||||
table.insert(shared.networkMessenger.queue, msg)
|
||||
end
|
||||
|
||||
--if Heimdall_Data.config.who.doWhisper then
|
||||
-- for _, name in pairs(Heimdall_Data.config.whisperNotify) do
|
||||
-- ---@type Message
|
||||
-- local msg = {
|
||||
-- channel = "W",
|
||||
-- data = name,
|
||||
-- message = text
|
||||
-- }
|
||||
-- --table.insert(shared.messenger.queue, msg)
|
||||
-- table.insert(shared.networkMessenger.queue, msg)
|
||||
-- end
|
||||
--end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
@@ -578,7 +510,8 @@ function shared.Whoer.Init()
|
||||
player.lastSeenInternal = GetTime()
|
||||
if player.zone ~= zone then
|
||||
if Heimdall_Data.config.who.debug then
|
||||
print(string.format("[%s] Player %s zone changed from %s to %s", ModuleName, name, player.zone, zone))
|
||||
print(string.format("[%s] Player %s zone changed from %s to %s", ModuleName, name, player.zone,
|
||||
zone))
|
||||
end
|
||||
local err = NotifyZoneChanged(player, zone)
|
||||
if err then
|
||||
|
Reference in New Issue
Block a user