|
|
@ -19,15 +19,15 @@ local CreateFrame, UIParent, GetCursorPosition = CreateFrame, UIParent, GetCurso |
|
|
|
local GetScreenWidth, GetScreenHeight = GetScreenWidth, GetScreenHeight |
|
|
|
local GetScreenWidth, GetScreenHeight = GetScreenWidth, GetScreenHeight |
|
|
|
-- ~~| Locals |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
|
|
-- ~~| Locals |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
|
|
local escapeSequences = { |
|
|
|
local escapeSequences = { |
|
|
|
["\a"] = "\\a", -- Bell |
|
|
|
["\a"] = "\\a", -- Bell |
|
|
|
["\b"] = "\\b", -- Backspace |
|
|
|
["\b"] = "\\b", -- Backspace |
|
|
|
["\t"] = "\\t", -- Horizontal tab |
|
|
|
["\t"] = "\\t", -- Horizontal tab |
|
|
|
["\n"] = "\\n", -- Newline |
|
|
|
["\n"] = "\\n", -- Newline |
|
|
|
["\v"] = "\\v", -- Vertical tab |
|
|
|
["\v"] = "\\v", -- Vertical tab |
|
|
|
["\f"] = "\\f", -- Form feed |
|
|
|
["\f"] = "\\f", -- Form feed |
|
|
|
["\r"] = "\\r", -- Carriage return |
|
|
|
["\r"] = "\\r", -- Carriage return |
|
|
|
["\\"] = "\\\\", -- Backslash |
|
|
|
["\\"] = "\\\\", -- Backslash |
|
|
|
['"'] = '\\"', -- Quotation mark |
|
|
|
['"'] = '\\"', -- Quotation mark |
|
|
|
["|"] = "||", |
|
|
|
["|"] = "||", |
|
|
|
} |
|
|
|
} |
|
|
|
local lua_keywords = { |
|
|
|
local lua_keywords = { |
|
|
@ -77,20 +77,17 @@ local function GetCaller(level) |
|
|
|
-- Blizzard Sandbox |
|
|
|
-- Blizzard Sandbox |
|
|
|
local match, _, file, line = trace:find("^.*\\(.-):(%d+)") |
|
|
|
local match, _, file, line = trace:find("^.*\\(.-):(%d+)") |
|
|
|
if match then |
|
|
|
if match then |
|
|
|
return format("%s[%s%s: %s%s%s]|r", colors.orange, colors.yellow, file, colors.lightyellow, line, |
|
|
|
return format("%s[%s%s: %s%s%s]|r", colors.orange, colors.yellow, file, colors.lightyellow, line, colors.orange) |
|
|
|
colors.orange) |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
-- PQI DataFile |
|
|
|
-- PQI DataFile |
|
|
|
local match, _, file, line = trace:find('^%[string "[%s%-]*(.-%.lua).-"%]:(%d+)') |
|
|
|
local match, _, file, line = trace:find('^%[string "[%s%-]*(.-%.lua).-"%]:(%d+)') |
|
|
|
if match then |
|
|
|
if match then |
|
|
|
return format("%s[%s%s: %s%s%s]|r", colors.orange, colors.yellow, file, colors.lightyellow, line, |
|
|
|
return format("%s[%s%s: %s%s%s]|r", colors.orange, colors.yellow, file, colors.lightyellow, line, colors.orange) |
|
|
|
colors.orange) |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
-- PQR Ability code |
|
|
|
-- PQR Ability code |
|
|
|
local match, _, file, line = trace:find('^%[string "(.-)"%]:(%d+)') |
|
|
|
local match, _, file, line = trace:find('^%[string "(.-)"%]:(%d+)') |
|
|
|
if match then |
|
|
|
if match then |
|
|
|
return format("%s[%s%s: %s%s%s]|r", colors.orange, colors.yellow, file, colors.lightyellow, line, |
|
|
|
return format("%s[%s%s: %s%s%s]|r", colors.orange, colors.yellow, file, colors.lightyellow, line, colors.orange) |
|
|
|
colors.orange) |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
return format("%s[%sUnknown Caller%s]|r", colors.orange, colors.red, colors.orange) |
|
|
|
return format("%s[%sUnknown Caller%s]|r", colors.orange, colors.red, colors.orange) |
|
|
@ -128,8 +125,7 @@ function DiesalTools.GetColor(value) |
|
|
|
if type(value) == "table" and #value >= 3 then |
|
|
|
if type(value) == "table" and #value >= 3 then |
|
|
|
return value[1] / 255, value[2] / 255, value[3] / 255 |
|
|
|
return value[1] / 255, value[2] / 255, value[3] / 255 |
|
|
|
elseif type(value) == "string" then |
|
|
|
elseif type(value) == "string" then |
|
|
|
return tonumber(sub(value, 1, 2), 16) / 255, tonumber(sub(value, 3, 4), 16) / 255, |
|
|
|
return tonumber(sub(value, 1, 2), 16) / 255, tonumber(sub(value, 3, 4), 16) / 255, tonumber(sub(value, 5, 6), 16) / 255 |
|
|
|
tonumber(sub(value, 5, 6), 16) / 255 |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
@ -141,8 +137,7 @@ function DiesalTools.Stack() |
|
|
|
for trace in stack:gmatch("(.-)\n") do |
|
|
|
for trace in stack:gmatch("(.-)\n") do |
|
|
|
local match, _, file, line, func = trace:find("^.*\\(.-):(%d+).-`(.*)'$") |
|
|
|
local match, _, file, line, func = trace:find("^.*\\(.-):(%d+).-`(.*)'$") |
|
|
|
if match then |
|
|
|
if match then |
|
|
|
print(format("%s[%s%s: %s%s%s] %sfunction|r %s|r", colors.orange, colors.yellow, file, colors.lightyellow, |
|
|
|
print(format("%s[%s%s: %s%s%s] %sfunction|r %s|r", colors.orange, colors.yellow, file, colors.lightyellow, line, colors.orange, colors.blue, func)) |
|
|
|
line, colors.orange, colors.blue, func)) |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
print("|r--------------------------------------------------------------------------------") |
|
|
|
print("|r--------------------------------------------------------------------------------") |
|
|
@ -264,11 +259,9 @@ function DiesalTools.TintColor(color, percent, to, from) |
|
|
|
if to == "rgb255" then |
|
|
|
if to == "rgb255" then |
|
|
|
return round((255 - r) * percent + r), round((255 - g) * percent + g), round((255 - b) * percent + b) |
|
|
|
return round((255 - r) * percent + r), round((255 - g) * percent + g), round((255 - b) * percent + b) |
|
|
|
elseif to == "rgb1" then |
|
|
|
elseif to == "rgb1" then |
|
|
|
return round(((255 - r) * percent + r) / 255), round(((255 - g) * percent + g) / 255), |
|
|
|
return round(((255 - r) * percent + r) / 255), round(((255 - g) * percent + g) / 255), round(((255 - b) * percent + b) / 255) |
|
|
|
round(((255 - b) * percent + b) / 255) |
|
|
|
|
|
|
|
elseif to == "hex" then |
|
|
|
elseif to == "hex" then |
|
|
|
return format("%02x%02x%02x", round((255 - r) * percent + r), round((255 - g) * percent + g), |
|
|
|
return format("%02x%02x%02x", round((255 - r) * percent + r), round((255 - g) * percent + g), round((255 - b) * percent + b)) |
|
|
|
round((255 - b) * percent + b)) |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
-- return format("%02x%02x%02x", round((255-r)*percent+r), round((255-g)*percent+g), round((255-b)*percent+b) ) |
|
|
|
-- return format("%02x%02x%02x", round((255-r)*percent+r), round((255-g)*percent+g), round((255-b)*percent+b) ) |
|
|
|
end |
|
|
|
end |
|
|
@ -303,11 +296,9 @@ function DiesalTools.MixColors(color1, color2, percent, to, from) |
|
|
|
if to == "rgb255" then |
|
|
|
if to == "rgb255" then |
|
|
|
return round((r2 - r1) * percent) + r1, round((g2 - g1) * percent) + g1, round((b2 - b1) * percent) + b1 |
|
|
|
return round((r2 - r1) * percent) + r1, round((g2 - g1) * percent) + g1, round((b2 - b1) * percent) + b1 |
|
|
|
elseif to == "rgb1" then |
|
|
|
elseif to == "rgb1" then |
|
|
|
return round(((r2 - r1) * percent + r1) / 255), round(((g2 - g1) * percent + g1) / 255), |
|
|
|
return round(((r2 - r1) * percent + r1) / 255), round(((g2 - g1) * percent + g1) / 255), round(((b2 - b1) * percent + b1) / 255) |
|
|
|
round(((b2 - b1) * percent + b1) / 255) |
|
|
|
|
|
|
|
elseif to == "hex" then |
|
|
|
elseif to == "hex" then |
|
|
|
return format("%02x%02x%02x", round((r2 - r1) * percent) + r1, round((g2 - g1) * percent) + g1, |
|
|
|
return format("%02x%02x%02x", round((r2 - r1) * percent) + r1, round((g2 - g1) * percent) + g1, round((b2 - b1) * percent) + b1) |
|
|
|
round((b2 - b1) * percent) + b1) |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
@ -382,8 +373,7 @@ function DiesalTools.GetIconCoords(column, row, size, textureWidth, textureHeigh |
|
|
|
size = size or 16 |
|
|
|
size = size or 16 |
|
|
|
textureWidth = textureWidth or 128 |
|
|
|
textureWidth = textureWidth or 128 |
|
|
|
textureHeight = textureHeight or 16 |
|
|
|
textureHeight = textureHeight or 16 |
|
|
|
return (column * size - size) / textureWidth, (column * size) / textureWidth, (row * size - size) / textureHeight, |
|
|
|
return (column * size - size) / textureWidth, (column * size) / textureWidth, (row * size - size) / textureHeight, (row * size) / textureHeight |
|
|
|
(row * size) / textureHeight |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
-- | String Tools |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
|
|
-- | String Tools |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
|
@ -489,8 +479,8 @@ local function impl(t, cat, visited) |
|
|
|
if |
|
|
|
if |
|
|
|
k_type ~= "number" -- non-string non-number |
|
|
|
k_type ~= "number" -- non-string non-number |
|
|
|
or k >= next_i |
|
|
|
or k >= next_i |
|
|
|
or k < 1 -- integer key in hash part of the table |
|
|
|
or k < 1 -- integer key in hash part of the table |
|
|
|
or k % 1 ~= 0 -- non-integer key |
|
|
|
or k % 1 ~= 0 -- non-integer key |
|
|
|
then |
|
|
|
then |
|
|
|
if need_comma then |
|
|
|
if need_comma then |
|
|
|
cat(",") |
|
|
|
cat(",") |
|
|
@ -619,3 +609,31 @@ function DiesalTools.Unpack(t) |
|
|
|
end |
|
|
|
end |
|
|
|
return unpack(table) |
|
|
|
return unpack(table) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
---@param zoomPercent number |
|
|
|
|
|
|
|
---@param width number |
|
|
|
|
|
|
|
---@param height number |
|
|
|
|
|
|
|
---@param xOffset? number |
|
|
|
|
|
|
|
---@param yOffset? number |
|
|
|
|
|
|
|
---@return number, number, number, number, number, number, number, number |
|
|
|
|
|
|
|
function DiesalTools.GetTexCoord(zoomPercent, width, height, xOffset, yOffset) |
|
|
|
|
|
|
|
xOffset = xOffset or 0 |
|
|
|
|
|
|
|
yOffset = yOffset or 0 |
|
|
|
|
|
|
|
local textureWidth = 1 - 0.5 * zoomPercent |
|
|
|
|
|
|
|
local aspectRatio = width == 0 or height == 0 and 1 or width / height |
|
|
|
|
|
|
|
---@type table<number, number> |
|
|
|
|
|
|
|
local currentCoord = {} |
|
|
|
|
|
|
|
currentCoord[1], currentCoord[2], currentCoord[3], currentCoord[4], currentCoord[5], currentCoord[6], currentCoord[7], currentCoord[8] = 0, 0, 0, 1, 1, 0, 1, 1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local xRatio = aspectRatio < 1 and aspectRatio or 1 |
|
|
|
|
|
|
|
local yRatio = aspectRatio > 1 and 1 / aspectRatio or 1 |
|
|
|
|
|
|
|
for i, coord in ipairs(currentCoord) do |
|
|
|
|
|
|
|
if i % 2 == 1 then |
|
|
|
|
|
|
|
currentCoord[i] = (coord - 0.5) * textureWidth * xRatio + 0.5 - xOffset |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
currentCoord[i] = (coord - 0.5) * textureWidth * yRatio + 0.5 - yOffset |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return unpack(currentCoord) |
|
|
|
|
|
|
|
end |
|
|
|