59 lines
1.5 KiB
Lua
59 lines
1.5 KiB
Lua
---@class Message
|
|
---@field message string
|
|
---@field channel string
|
|
---@field data string
|
|
|
|
---@type Message[]
|
|
aura_env.messageQueue = {}
|
|
|
|
---@type table<string, string>
|
|
aura_env.raceMap = {
|
|
["Orc"] = "Horde",
|
|
["Undead"] = "Horde",
|
|
["Tauren"] = "Horde",
|
|
["Troll"] = "Horde",
|
|
["Blood Elf"] = "Horde",
|
|
["Goblin"] = "Horde",
|
|
["Human"] = "Alliance",
|
|
["Dwarf"] = "Alliance",
|
|
["Night Elf"] = "Alliance",
|
|
["Gnome"] = "Alliance",
|
|
["Draenei"] = "Alliance",
|
|
["Worgen"] = "Alliance",
|
|
["Vulpera"] = "Horde",
|
|
["Nightborne"] = "Horde",
|
|
["Zandalari Troll"] = "Horde",
|
|
["Kul Tiran"] = "Alliance",
|
|
["Dark Iron Dwarf"] = "Alliance",
|
|
["Void Elf"] = "Alliance",
|
|
["Lightforged Draenei"] = "Alliance",
|
|
["Mechagnome"] = "Alliance",
|
|
["Mag'har Orc"] = "Horde"
|
|
}
|
|
|
|
local throttleTimer = aura_env.config.throttle or 10
|
|
local throttleMap = {}
|
|
|
|
---@param playerName string
|
|
---@param race string
|
|
---@return nil
|
|
aura_env.NotifySpotted = function(playerName, race)
|
|
local now = GetTime()
|
|
local throttleTime = throttleMap[playerName] or 0
|
|
if now - throttleTime < throttleTimer then
|
|
return
|
|
end
|
|
throttleMap[playerName] = now
|
|
|
|
local zone = aura_env.config.zone
|
|
if not zone or zone == "" then
|
|
zone = GetZoneText() .. " " .. GetSubZoneText()
|
|
end
|
|
|
|
local message = {
|
|
channel = "CHANNEL",
|
|
data = aura_env.config.channel,
|
|
message = string.format("I see %s at %s!", playerName, zone)
|
|
}
|
|
table.insert(WeakAurasSaved.Cyka.MessageQueue, message)
|
|
end |