Fix whoer localization
This commit is contained in:
@@ -56,53 +56,6 @@ function shared.Whoer.Init()
|
|||||||
self.seenCount)
|
self.seenCount)
|
||||||
return string.format("|cFF%s%s|r", shared.classColors[self.class], out)
|
return string.format("|cFF%s%s|r", shared.classColors[self.class], out)
|
||||||
end,
|
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
|
---@class WHOQuery
|
||||||
@@ -300,51 +253,49 @@ function shared.Whoer.Init()
|
|||||||
return string.format("Not notifying for zone %s", tostring(player.zone))
|
return string.format("Not notifying for zone %s", tostring(player.zone))
|
||||||
end
|
end
|
||||||
|
|
||||||
local text = player:NotifyMessage()
|
for _, channel in pairs(Heimdall_Data.config.who.channels) do
|
||||||
if Heimdall_Data.config.who.debug then
|
local locale = shared.GetLocaleForChannel(channel)
|
||||||
print(string.format("[%s] Queuing channel notification: '%s'", ModuleName, text))
|
local text = string.format(shared._L("whoerNew", locale),
|
||||||
end
|
player.name,
|
||||||
|
player.stinky and "(!!!!)" or "",
|
||||||
---@type Message
|
shared._L(player.class, locale),
|
||||||
local msg = {
|
shared._L(player.race, locale),
|
||||||
channel = "C",
|
shared._L(shared.raceMap[player.race] or "unknown", locale),
|
||||||
data = Heimdall_Data.config.who.notifyChannel,
|
player.guild,
|
||||||
message = text
|
shared._L(player.zone, locale))
|
||||||
}
|
---@type Message
|
||||||
--table.insert(shared.messenger.queue, msg)
|
local 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 = {
|
|
||||||
channel = "C",
|
channel = "C",
|
||||||
data = Heimdall_Data.config.who.notifyChannel .. "ru",
|
data = channel,
|
||||||
message = player:NotifyRu()
|
message = text
|
||||||
}
|
}
|
||||||
--table.insert(shared.messenger.queue, ruMsg)
|
if Heimdall_Data.config.who.debug then
|
||||||
table.insert(shared.networkMessenger.queue, ruMsg)
|
print(string.format("[%s] Queuing channel notification", ModuleName))
|
||||||
|
shared.dumpTable(msg)
|
||||||
|
end
|
||||||
|
table.insert(shared.networkMessenger.queue, msg)
|
||||||
end
|
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
|
return nil
|
||||||
end
|
end
|
||||||
---@param player Player
|
---@param player Player
|
||||||
@@ -358,53 +309,42 @@ function shared.Whoer.Init()
|
|||||||
if not ShouldNotifyForZone(zone) and not ShouldNotifyForZone(player.zone) then
|
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))
|
return string.format("Not notifying for zones %s and %s", tostring(zone), tostring(player.zone))
|
||||||
end
|
end
|
||||||
local text = string.format(shared.L.en.whoerMoved,
|
for _, channel in pairs(Heimdall_Data.config.who.channels) do
|
||||||
player.name,
|
local locale = shared.GetLocaleForChannel(channel)
|
||||||
player.class,
|
local text = string.format(shared._L("whoerMoved", locale),
|
||||||
player.race,
|
player.name,
|
||||||
shared.raceMap[player.race] or "Unknown",
|
shared._L(player.class, locale),
|
||||||
player.guild,
|
shared._L(player.race, locale),
|
||||||
zone)
|
shared._L(shared.raceMap[player.race] or "unknown", locale),
|
||||||
|
player.guild,
|
||||||
|
shared._L(zone, locale))
|
||||||
|
|
||||||
---@type Message
|
---@type Message
|
||||||
local msg = {
|
local msg = {
|
||||||
channel = "C",
|
channel = "C",
|
||||||
data = Heimdall_Data.config.who.notifyChannel,
|
data = channel,
|
||||||
message = text
|
message = text
|
||||||
}
|
}
|
||||||
--table.insert(shared.messenger.queue, msg)
|
if Heimdall_Data.config.who.debug then
|
||||||
table.insert(shared.networkMessenger.queue, msg)
|
print(string.format("[%s] Queuing channel notification", ModuleName))
|
||||||
|
shared.dumpTable(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)
|
|
||||||
end
|
end
|
||||||
|
table.insert(shared.networkMessenger.queue, msg)
|
||||||
end
|
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
|
return nil
|
||||||
end
|
end
|
||||||
---@param player Player
|
---@param player Player
|
||||||
@@ -417,49 +357,41 @@ function shared.Whoer.Init()
|
|||||||
return string.format("Not notifying for zone %s", tostring(player.zone))
|
return string.format("Not notifying for zone %s", tostring(player.zone))
|
||||||
end
|
end
|
||||||
|
|
||||||
local text = string.format(shared.L.en.whoerGone,
|
for _, channel in pairs(Heimdall_Data.config.who.channels) do
|
||||||
player.name,
|
local locale = shared.GetLocaleForChannel(channel)
|
||||||
player.class,
|
local text = string.format(shared._L("whoerGone", locale),
|
||||||
player.guild,
|
player.name,
|
||||||
player.zone)
|
shared._L(player.class, locale),
|
||||||
|
player.guild,
|
||||||
|
shared._L(player.zone, locale))
|
||||||
|
|
||||||
---@type Message
|
---@type Message
|
||||||
local msg = {
|
local msg = {
|
||||||
channel = "C",
|
channel = "C",
|
||||||
data = Heimdall_Data.config.who.notifyChannel,
|
data = channel,
|
||||||
message = text
|
message = text
|
||||||
}
|
}
|
||||||
--table.insert(shared.messenger.queue, msg)
|
if Heimdall_Data.config.who.debug then
|
||||||
table.insert(shared.networkMessenger.queue, msg)
|
print(string.format("[%s] Queuing channel notification", ModuleName))
|
||||||
|
shared.dumpTable(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)
|
|
||||||
end
|
end
|
||||||
|
--table.insert(shared.messenger.queue, msg)
|
||||||
|
table.insert(shared.networkMessenger.queue, msg)
|
||||||
end
|
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
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -578,7 +510,8 @@ function shared.Whoer.Init()
|
|||||||
player.lastSeenInternal = GetTime()
|
player.lastSeenInternal = GetTime()
|
||||||
if player.zone ~= zone then
|
if player.zone ~= zone then
|
||||||
if Heimdall_Data.config.who.debug 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
|
end
|
||||||
local err = NotifyZoneChanged(player, zone)
|
local err = NotifyZoneChanged(player, zone)
|
||||||
if err then
|
if err then
|
||||||
|
Reference in New Issue
Block a user