Tumble files around a bit
This commit is contained in:
1283
WeakAuras/Projects/_Shared/CLEUParser.lua
Normal file
1283
WeakAuras/Projects/_Shared/CLEUParser.lua
Normal file
File diff suppressed because it is too large
Load Diff
64
WeakAuras/Projects/_Shared/Colorer.lua
Normal file
64
WeakAuras/Projects/_Shared/Colorer.lua
Normal file
@@ -0,0 +1,64 @@
|
||||
---@alias Color {r: number, g: number, b: number}
|
||||
---@class Colorer
|
||||
---@field colors table<number, Color>
|
||||
---@field breakpoints table<number>
|
||||
Colorer = {
|
||||
--- Make sure colors and breakpoints always have the same number of entries! VERY IMPORTANT!
|
||||
---@type table<number, Color>
|
||||
colors = {
|
||||
{ r = 0.62, g = 0.62, b = 0.62 }, -- Grey
|
||||
{ r = 1, g = 1, b = 1 }, -- White
|
||||
{ r = 0.12, g = 1, b = 0 }, -- Green
|
||||
{ r = 0, g = 0.44, b = 0.87 }, -- Blue
|
||||
{ r = 0.64, g = 0.21, b = 0.93 }, -- Purple
|
||||
{ r = 1, g = 0.5, b = 0 }, -- Orange
|
||||
{ r = 0.9, g = 0.8, b = 0.5 }, -- Light Gold
|
||||
{ r = 0, g = 0.8, b = 1.0 }, -- Blizzard Blue
|
||||
},
|
||||
breakpoints = { -999, -10, -5, -2, 2, 5, 10, 999 },
|
||||
|
||||
---@param value number
|
||||
---@return Color, nil|string
|
||||
Interpolate = function(value)
|
||||
local color = { r = 0, g = 0, b = 0 }
|
||||
|
||||
---@type table<number, table<number, number>>
|
||||
local bracket = { { 0, 0 }, { 1, 1 } }
|
||||
for i = 1, #Colorer.breakpoints do
|
||||
if value < Colorer.breakpoints[i] then
|
||||
bracket[2] = { i, Colorer.breakpoints[i] }
|
||||
break
|
||||
end
|
||||
bracket[1] = { i, Colorer.breakpoints[i] }
|
||||
end
|
||||
|
||||
---@type Color
|
||||
local startColor = Colorer.colors[bracket[1][1]]
|
||||
---@type Color
|
||||
local endColor = Colorer.colors[bracket[2][1]]
|
||||
|
||||
local fraction = (value - bracket[1][2]) / (bracket[2][2] - bracket[1][2])
|
||||
|
||||
for k, v in pairs(startColor) do
|
||||
color[k] = Colorer.lerp(v, endColor[k], fraction)
|
||||
end
|
||||
|
||||
return color, nil
|
||||
end,
|
||||
|
||||
---@param color Color
|
||||
---@return string
|
||||
RGBToHex = function(color)
|
||||
local r = math.floor(color.r * 255)
|
||||
local g = math.floor(color.g * 255)
|
||||
local b = math.floor(color.b * 255)
|
||||
return string.format("%02x%02x%02x", r, g, b)
|
||||
end,
|
||||
|
||||
---@param a number
|
||||
---@param b number
|
||||
---@param t number
|
||||
---@return number
|
||||
lerp = function(a, b, t) return a * (1 - t) + b * t end,
|
||||
}
|
||||
setmetatable(Colorer, { __index = Colorer })
|
||||
79
WeakAuras/Projects/_Shared/Messenger.lua
Normal file
79
WeakAuras/Projects/_Shared/Messenger.lua
Normal file
@@ -0,0 +1,79 @@
|
||||
-- TICKER_200
|
||||
function()
|
||||
if not WeakAurasSaved.Cyka then WeakAurasSaved.Cyka = {} end
|
||||
if not WeakAurasSaved.Cyka.MessageQueue then WeakAurasSaved.Cyka.MessageQueue = {} end
|
||||
|
||||
---@type Message
|
||||
local message = WeakAurasSaved.Cyka.MessageQueue[1]
|
||||
if not message then return end
|
||||
if not message.message or message.message == "" then return end
|
||||
if not message.channel or message.channel == "" then return end
|
||||
|
||||
-- Map channel names to ids
|
||||
if message.channel == "CHANNEL" and message.data and string.match(message.data, "%D") then
|
||||
print("Channel presented as string:", message.data)
|
||||
local channelId = aura_env.channelIdMap[message.data]
|
||||
if not channelId then
|
||||
print("Channel not found, scanning")
|
||||
aura_env.ScanChannels()
|
||||
channelId = aura_env.channelIdMap[message.data]
|
||||
end
|
||||
if not channelId then
|
||||
print("Channel not joined, joining")
|
||||
channelId = aura_env.FindOrJoinChannel(message.data)
|
||||
end
|
||||
print("Channel resolved to id", channelId)
|
||||
message.data = channelId
|
||||
end
|
||||
|
||||
table.remove(WeakAurasSaved.Cyka.MessageQueue, 1)
|
||||
SendChatMessage(message.message, message.channel, nil, message.data)
|
||||
end
|
||||
|
||||
--INIT
|
||||
---@type table<string, number>
|
||||
aura_env.channelIdMap = {}
|
||||
aura_env.FindOrJoinChannel = function(channelName, password)
|
||||
local function GetChannelId(channelName)
|
||||
local channels = {GetChannelList()}
|
||||
for i = 1, #channels, 2 do
|
||||
local id = channels[i]
|
||||
local name = channels[i + 1]
|
||||
if name == channelName then
|
||||
return id
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local channelId = GetChannelId(channelName)
|
||||
if not channelId then
|
||||
print("Channel", channelName, "not found, joining")
|
||||
if password then
|
||||
JoinPermanentChannel(channelName, password)
|
||||
else
|
||||
JoinPermanentChannel(channelName)
|
||||
end
|
||||
end
|
||||
channelId = GetChannelId(channelName)
|
||||
aura_env.channelIdMap[channelName] = channelId
|
||||
return channelId
|
||||
end
|
||||
aura_env.ScanChannels = function()
|
||||
local channels = {GetChannelList()}
|
||||
for i = 1, #channels, 2 do
|
||||
local id = channels[i]
|
||||
local name = channels[i + 1]
|
||||
aura_env.channelIdMap[name] = id
|
||||
end
|
||||
end
|
||||
local channelId = aura_env.FindOrJoinChannel(aura_env.config.channel, aura_env.config.channelPassword)
|
||||
print("Channel", aura_env.config.channel, "resolved to id", channelId)
|
||||
--aura_env.iterator = 0
|
||||
--WeakAurasSaved.Cyka.MessageQueue = {}
|
||||
--for i = 1, 100 do
|
||||
-- table.insert(WeakAurasSaved.Cyka.MessageQueue, {
|
||||
-- channel = "CHANNEL",
|
||||
-- data = aura_env.channelId,
|
||||
-- message = "TEST" .. i
|
||||
-- })
|
||||
--end
|
||||
1
WeakAuras/Projects/_Shared/Messenger_Export
Normal file
1
WeakAuras/Projects/_Shared/Messenger_Export
Normal file
@@ -0,0 +1 @@
|
||||
!TI1)VPnou8)x40KO6kikRBN0P7MUogDJE0aRo76pmTuCtCaVgSrXoS2n183(9E2jHKqOqNMkknX(9(8E(9f)E2EN456rw6rcWFWRYeDexW8it(K74rod9iHsHMW)oZZ5K(EeAIEHm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