---@class Colorer ---@field colors table ---@field breakpoints table aura_env.Colorer = { --- Make sure colors and breakpoints always have the same number of entries! VERY IMPORTANT! ---@type table 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 = 1, g = 0.2, b = 0.23 }, { 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> local bracket = { { 0, 0 }, { 1, 1 } } for i = 1, #aura_env.Colorer.breakpoints do if value < aura_env.Colorer.breakpoints[i] then bracket[2] = { i, aura_env.Colorer.breakpoints[i] } break end bracket[1] = { i, aura_env.Colorer.breakpoints[i] } end ---@type Color local startColor = aura_env.Colorer.colors[bracket[1][1]] ---@type Color local endColor = aura_env.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] = aura_env.Colorer.lerp(v, endColor[k], fraction) end return color, nil 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(aura_env.Colorer, { __index = aura_env.Colorer }) aura_env.KeystoneIdMap = { [165] = "Shadowmoon Burial Grounds", [166] = "Grimrail Depot", [197] = "Eye of Azshara", [198] = "Darkheart Thicket", [199] = "Black Rook Hold", [200] = "Halls of Valor", [206] = "Neltharion's Lair", [207] = "Vault of the Wardens", [208] = "Maw of Souls", [209] = "The Arcway", [210] = "Court of Stars", [227] = "Return to Karazhan: Lower", [233] = "Cathedral of Eternal Night", [234] = "Return to Karazhan: Upper", [239] = "Seat of the Triumvirate", }