mirror of
https://github.com/Bluewhale1337/ElvUIModernized.git
synced 2026-07-27 16:34:45 +00:00
update !Compatibily & !DebugTools
This commit is contained in:
+178
-54
@@ -1,53 +1,22 @@
|
|||||||
--Cache global variables
|
--Cache global variables
|
||||||
--local assert = assert
|
|
||||||
local error = error
|
local error = error
|
||||||
local geterrorhandler = geterrorhandler
|
local geterrorhandler = geterrorhandler
|
||||||
local loadstring = loadstring
|
local loadstring = loadstring
|
||||||
local pairs = pairs
|
local pairs = pairs
|
||||||
local pcall = pcall
|
local pcall = pcall
|
||||||
|
local tonumber = tonumber
|
||||||
local tostring = tostring
|
local tostring = tostring
|
||||||
local type = type
|
local type = type
|
||||||
local unpack = unpack
|
local unpack = unpack
|
||||||
local ceil, floor = math.ceil, math.floor
|
local abs, ceil, exp, floor = math.abs, math.ceil, math.exp, math.floor
|
||||||
local find, format, gfind, gsub, sub = string.find, string.format, string.gfind, string.gsub, string.sub
|
local find, format, gfind, gsub, len, sub = string.find, string.format, string.gfind, string.gsub, string.len, string.sub
|
||||||
local concat, getn, setn, tinsert = table.concat, table.getn, table.setn, table.insert
|
local concat, getn, setn = table.concat, table.getn, table.setn
|
||||||
|
|
||||||
local escapeSequences = {
|
|
||||||
["\a"] = "\\a", -- Bell
|
|
||||||
["\b"] = "\\b", -- Backspace
|
|
||||||
["\t"] = "\\t", -- Horizontal tab
|
|
||||||
["\n"] = "\\n", -- Newline
|
|
||||||
["\v"] = "\\v", -- Vertical tab
|
|
||||||
["\f"] = "\\f", -- Form feed
|
|
||||||
["\r"] = "\\r", -- Carriage return
|
|
||||||
["\\"] = "\\\\", -- Backslash
|
|
||||||
["\""] = "\\\"", -- Quotation mark
|
|
||||||
["|"] = "||",
|
|
||||||
[" "] = "%s",
|
|
||||||
|
|
||||||
[" "] = "%s",
|
|
||||||
["!"] = "\\!",
|
|
||||||
["#"] = "\\#",
|
|
||||||
["$"] = "\\$",
|
|
||||||
["%"] = "\\%",
|
|
||||||
["&"] = "\\&",
|
|
||||||
["'"] = "\\'",
|
|
||||||
["("] = "\\(",
|
|
||||||
[")"] = "\\)",
|
|
||||||
["*"] = "\\*",
|
|
||||||
["+"] = "\\+",
|
|
||||||
[","] = "\\,",
|
|
||||||
["-"] = "\\-",
|
|
||||||
["."] = "\\.",
|
|
||||||
["/"] = "\\/"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
math.fmod = math.mod
|
||||||
math.huge = 1/0
|
math.huge = 1/0
|
||||||
string.gmatch = gfind
|
string.gmatch = string.gfind
|
||||||
|
|
||||||
function difftime(time2, time1)
|
function difftime(time2, time1)
|
||||||
-- assert(type(time2) == "number", format("bad argument #1 to 'difftime' (number expected, got %s)", time2 and type(time2) or "no value"))
|
|
||||||
-- assert(not time1 or type(time1) == "number", format("bad argument #2 to 'difftime' (number expected, got %s)", time1 and type(time1) or "no value"))
|
|
||||||
if type(time2) ~= "number" then
|
if type(time2) ~= "number" then
|
||||||
error(format("bad argument #1 to 'difftime' (number expected, got %s)", time2 and type(time2) or "no value"), 2)
|
error(format("bad argument #1 to 'difftime' (number expected, got %s)", time2 and type(time2) or "no value"), 2)
|
||||||
elseif time1 and type(time1) ~= "number" then
|
elseif time1 and type(time1) ~= "number" then
|
||||||
@@ -58,16 +27,13 @@ function difftime(time2, time1)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function select(n, ...)
|
function select(n, ...)
|
||||||
-- assert(type(n) == "number" or (type(n) == "string" and n == "#"), format("bad argument #1 to 'select' (number expected, got %s)", n and type(n) or "no value"))
|
|
||||||
if not (type(n) == "number" or (type(n) == "string" and n == "#")) then
|
if not (type(n) == "number" or (type(n) == "string" and n == "#")) then
|
||||||
error(format("bad argument #1 to 'select' (number expected, got %s)", n and type(n) or "no value"), 2)
|
error(format("bad argument #1 to 'select' (number expected, got %s)", n and type(n) or "no value"), 2)
|
||||||
end
|
end
|
||||||
|
|
||||||
if type(n) == "string" then
|
if n == "#" then
|
||||||
return getn(arg)
|
return getn(arg)
|
||||||
end
|
elseif n == 1 then
|
||||||
|
|
||||||
if n == 1 then
|
|
||||||
return unpack(arg)
|
return unpack(arg)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -80,19 +46,138 @@ function select(n, ...)
|
|||||||
return unpack(args)
|
return unpack(args)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local huge = math.huge
|
||||||
function math.modf(i)
|
function math.modf(i)
|
||||||
-- assert(type(i) == "number", format("bad argument #1 to 'modf' (number expected, got %s)", i and type(i) or "no value"))
|
i = type(i) ~= "number" and tonumber(i) or i
|
||||||
|
|
||||||
if type(i) ~= "number" then
|
if type(i) ~= "number" then
|
||||||
error(format("bad argument #1 to 'modf' (number expected, got %s)", i and type(i) or "no value"), 2)
|
error(format("bad argument #1 to 'modf' (number expected, got %s)", i and type(i) or "no value"), 2)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if i == 0 then
|
||||||
|
return i, i
|
||||||
|
elseif abs(i) == huge then
|
||||||
|
return i, i > 0 and 0 or -0
|
||||||
|
end
|
||||||
|
|
||||||
local int = i >= 0 and floor(i) or ceil(i)
|
local int = i >= 0 and floor(i) or ceil(i)
|
||||||
|
|
||||||
return int, i - int
|
return int, i - int
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function math.modulo(x, y)
|
||||||
|
x = type(x) ~= "number" and tonumber(i) or x
|
||||||
|
y = type(y) ~= "number" and tonumber(i) or y
|
||||||
|
|
||||||
|
if type(x) ~= "number" then
|
||||||
|
error(format("bad argument #1 to 'modulo' (number expected, got %s)", x and type(x) or "no value"), 2)
|
||||||
|
elseif type(y) ~= "number" then
|
||||||
|
error(format("bad argument #2 to 'modulo' (number expected, got %s)", y and type(y) or "no value"), 2)
|
||||||
|
end
|
||||||
|
|
||||||
|
return x - floor(x / y) * y
|
||||||
|
end
|
||||||
|
|
||||||
|
function math.cosh(i)
|
||||||
|
i = type(i) ~= "number" and tonumber(i) or i
|
||||||
|
|
||||||
|
if type(i) ~= "number" then
|
||||||
|
error(format("bad argument #1 to 'cosh' (number expected, got %s)", i and type(i) or "no value"), 2)
|
||||||
|
end
|
||||||
|
|
||||||
|
if i < 0 then
|
||||||
|
i = -i
|
||||||
|
end
|
||||||
|
|
||||||
|
if i > 21 then
|
||||||
|
return exp(i) / 2
|
||||||
|
end
|
||||||
|
|
||||||
|
return (exp(i) + exp(-i)) / 2
|
||||||
|
end
|
||||||
|
|
||||||
|
local sinhC = {
|
||||||
|
["P0"] = -0.6307673640497716991184787251e+6,
|
||||||
|
["P1"] = -0.8991272022039509355398013511e+5,
|
||||||
|
["P2"] = -0.2894211355989563807284660366e+4,
|
||||||
|
["P3"] = -0.2630563213397497062819489e+2,
|
||||||
|
["Q0"] = -0.6307673640497716991212077277e+6,
|
||||||
|
["Q1"] = 0.1521517378790019070696485176e+5,
|
||||||
|
["Q2"] = -0.173678953558233699533450911e+3
|
||||||
|
}
|
||||||
|
function math.sinh(i)
|
||||||
|
i = type(i) ~= "number" and tonumber(i) or i
|
||||||
|
|
||||||
|
if type(i) ~= "number" then
|
||||||
|
error(format("bad argument #1 to 'sinh' (number expected, got %s)", i and type(i) or "no value"), 2)
|
||||||
|
end
|
||||||
|
|
||||||
|
local neg, x
|
||||||
|
|
||||||
|
if i < 0 then
|
||||||
|
i = -i
|
||||||
|
neg = true
|
||||||
|
end
|
||||||
|
|
||||||
|
if i > 21 then
|
||||||
|
x = exp(i) / 2
|
||||||
|
elseif i > 0.5 then
|
||||||
|
x = (exp(i) - exp(-i)) / 2
|
||||||
|
else
|
||||||
|
local sq = i * i
|
||||||
|
x = (((sinhC["P3"] * sq + sinhC["P2"]) * sq + sinhC["P1"]) * sq + sinhC["P0"]) * i
|
||||||
|
x = x / (((sq + sinhC["Q2"]) * sq + sinhC["Q1"]) * sq + sinhC["Q0"])
|
||||||
|
end
|
||||||
|
|
||||||
|
if neg then
|
||||||
|
x = -x
|
||||||
|
end
|
||||||
|
|
||||||
|
return x
|
||||||
|
end
|
||||||
|
|
||||||
|
local MAXLOG2 = 8.8029691931113054295988e+01 * 0.5
|
||||||
|
local tanhP = {
|
||||||
|
-9.64399179425052238628E-1,
|
||||||
|
-9.92877231001918586564E1,
|
||||||
|
-1.61468768441708447952E3,
|
||||||
|
}
|
||||||
|
local tanhQ = {
|
||||||
|
1.12811678491632931402E2,
|
||||||
|
2.23548839060100448583E3,
|
||||||
|
4.84406305325125486048E3,
|
||||||
|
}
|
||||||
|
function math.tanh(i)
|
||||||
|
i = type(i) ~= "number" and tonumber(i) or i
|
||||||
|
|
||||||
|
if type(i) ~= "number" then
|
||||||
|
error(format("bad argument #1 to 'tanh' (number expected, got %s)", i and type(i) or "no value"), 2)
|
||||||
|
end
|
||||||
|
|
||||||
|
if i == 0 then
|
||||||
|
return i
|
||||||
|
end
|
||||||
|
|
||||||
|
local x = abs(i)
|
||||||
|
|
||||||
|
if x > MAXLOG2 then
|
||||||
|
return i < 0 and -1 or 1
|
||||||
|
elseif x >= 0.625 then
|
||||||
|
local s = exp(2 * x)
|
||||||
|
x = 1 - 2 / (s + 1)
|
||||||
|
|
||||||
|
if i < 0 then
|
||||||
|
x = -x
|
||||||
|
end
|
||||||
|
else
|
||||||
|
local sq = i * i
|
||||||
|
x = i + i * sq * ((tanhP[1] * sq + tanhP[2]) * sq + tanhP[3]) / (((sq + tanhQ[1]) * sq + tanhQ[2]) * sq + tanhQ[3])
|
||||||
|
end
|
||||||
|
|
||||||
|
return x
|
||||||
|
end
|
||||||
|
|
||||||
function string.join(delimiter, ...)
|
function string.join(delimiter, ...)
|
||||||
-- assert(type(delimiter) == "string" or type(delimiter) == "number", format("bad argument #1 to 'join' (string expected, got %s)", delimiter and type(delimiter) or "no value"))
|
|
||||||
if type(delimiter) ~= "string" and type(delimiter) ~= "number" then
|
if type(delimiter) ~= "string" and type(delimiter) ~= "number" then
|
||||||
error(format("bad argument #1 to 'join' (string expected, got %s)", delimiter and type(delimiter) or "no value"), 2)
|
error(format("bad argument #1 to 'join' (string expected, got %s)", delimiter and type(delimiter) or "no value"), 2)
|
||||||
end
|
end
|
||||||
@@ -106,9 +191,6 @@ end
|
|||||||
strjoin = string.join
|
strjoin = string.join
|
||||||
|
|
||||||
function string.match(str, pattern, index)
|
function string.match(str, pattern, index)
|
||||||
-- assert(type(str) == "string" or type(str) == "number", format("bad argument #1 to 'match' (string expected, got %s)", str and type(str) or "no value"))
|
|
||||||
-- assert(type(pattern) == "string" or type(pattern) == "number", format("bad argument #2 to 'match' (string expected, got %s)", pattern and type(pattern) or "no value"))
|
|
||||||
-- assert(not index or type(index) == "number" or (type(index) == "string" and index ~= ""), format("bad argument #3 to 'match' (number expected, got %s)", index and type(index) or "no value"))
|
|
||||||
if type(str) ~= "string" and type(str) ~= "number" then
|
if type(str) ~= "string" and type(str) ~= "number" then
|
||||||
error(format("bad argument #1 to 'match' (string expected, got %s)", str and type(str) or "no value"), 2)
|
error(format("bad argument #1 to 'match' (string expected, got %s)", str and type(str) or "no value"), 2)
|
||||||
elseif type(pattern) ~= "string" and type(pattern) ~= "number" then
|
elseif type(pattern) ~= "string" and type(pattern) ~= "number" then
|
||||||
@@ -132,9 +214,25 @@ function string.match(str, pattern, index)
|
|||||||
end
|
end
|
||||||
strmatch = string.match
|
strmatch = string.match
|
||||||
|
|
||||||
|
function string.reverse(str)
|
||||||
|
if type(str) ~= "string" and type(str) ~= "number" then
|
||||||
|
error(format("bad argument #1 to 'reverse' (string expected, got %s)", str and type(str) or "no value"), 2)
|
||||||
|
end
|
||||||
|
|
||||||
|
local size = len(str)
|
||||||
|
if size > 1 then
|
||||||
|
local reversed = ""
|
||||||
|
for i = size, 1, -1 do
|
||||||
|
reversed = reversed .. sub(str, i, i)
|
||||||
|
end
|
||||||
|
|
||||||
|
return reversed
|
||||||
|
end
|
||||||
|
|
||||||
|
return str
|
||||||
|
end
|
||||||
|
|
||||||
function string.split(delimiter, str)
|
function string.split(delimiter, str)
|
||||||
-- assert(type(delimiter) == "string" or type(delimiter) == "number", format("bad argument #1 to 'split' (string expected, got %s)", delimiter and type(delimiter) or "no value"))
|
|
||||||
-- assert(type(str) == "string" or type(str) == "number", format("bad argument #2 to 'split' (string expected, got %s)", str and type(str) or "no value"))
|
|
||||||
if type(delimiter) ~= "string" and type(delimiter) ~= "number" then
|
if type(delimiter) ~= "string" and type(delimiter) ~= "number" then
|
||||||
error(format("bad argument #1 to 'split' (string expected, got %s)", delimiter and type(delimiter) or "no value"), 2)
|
error(format("bad argument #1 to 'split' (string expected, got %s)", delimiter and type(delimiter) or "no value"), 2)
|
||||||
elseif type(str) ~= "string" and type(str) ~= "number" then
|
elseif type(str) ~= "string" and type(str) ~= "number" then
|
||||||
@@ -148,9 +246,35 @@ function string.split(delimiter, str)
|
|||||||
end
|
end
|
||||||
strsplit = string.split
|
strsplit = string.split
|
||||||
|
|
||||||
|
local escapeSequences = {
|
||||||
|
["\a"] = "\\a", -- Bell
|
||||||
|
["\b"] = "\\b", -- Backspace
|
||||||
|
["\t"] = "\\t", -- Horizontal tab
|
||||||
|
["\n"] = "\\n", -- Newline
|
||||||
|
["\v"] = "\\v", -- Vertical tab
|
||||||
|
["\f"] = "\\f", -- Form feed
|
||||||
|
["\r"] = "\\r", -- Carriage return
|
||||||
|
["\\"] = "\\\\", -- Backslash
|
||||||
|
["\""] = "\\\"", -- Quotation mark
|
||||||
|
["|"] = "||",
|
||||||
|
[" "] = "%s",
|
||||||
|
|
||||||
|
["!"] = "\\!",
|
||||||
|
["#"] = "\\#",
|
||||||
|
["$"] = "\\$",
|
||||||
|
["%"] = "\\%",
|
||||||
|
["&"] = "\\&",
|
||||||
|
["'"] = "\\'",
|
||||||
|
["("] = "\\(",
|
||||||
|
[")"] = "\\)",
|
||||||
|
["*"] = "\\*",
|
||||||
|
["+"] = "\\+",
|
||||||
|
[","] = "\\,",
|
||||||
|
["-"] = "\\-",
|
||||||
|
["."] = "\\.",
|
||||||
|
["/"] = "\\/"
|
||||||
|
}
|
||||||
function string.trim(str, chars)
|
function string.trim(str, chars)
|
||||||
-- assert(type(str) == "string" or type(str) == "number", format("bad argument #1 to 'trim' (string expected, got %s)", str and type(str) or "no value"))
|
|
||||||
-- assert(not chars or type(chars) == "string" or type(chars) == "number", format("bad argument #2 to 'trim' (string expected, got %s)", chars and type(chars) or "no value"))
|
|
||||||
if type(str) ~= "string" and type(str) ~= "number" then
|
if type(str) ~= "string" and type(str) ~= "number" then
|
||||||
error(format("bad argument #1 to 'trim' (string expected, got %s)", str and type(str) or "no value"), 2)
|
error(format("bad argument #1 to 'trim' (string expected, got %s)", str and type(str) or "no value"), 2)
|
||||||
elseif chars and (type(chars) ~= "string" and type(chars) ~= "number") then
|
elseif chars and (type(chars) ~= "string" and type(chars) ~= "number") then
|
||||||
@@ -159,13 +283,14 @@ function string.trim(str, chars)
|
|||||||
|
|
||||||
if chars then
|
if chars then
|
||||||
local tokens = {}
|
local tokens = {}
|
||||||
|
local size = 0
|
||||||
|
|
||||||
for token in gfind(chars, "[%z\1-\255]") do
|
for token in gfind(chars, "[%z\1-\255]") do
|
||||||
tinsert(tokens, token)
|
size = size + 1
|
||||||
|
tokens[size] = token
|
||||||
end
|
end
|
||||||
|
|
||||||
local pattern = ""
|
local pattern = ""
|
||||||
local size = getn(tokens)
|
|
||||||
|
|
||||||
for i = 1, size do
|
for i = 1, size do
|
||||||
pattern = pattern..(escapeSequences[tokens[i]] or tokens[i]).."+"
|
pattern = pattern..(escapeSequences[tokens[i]] or tokens[i]).."+"
|
||||||
@@ -196,7 +321,6 @@ end
|
|||||||
strtrim = string.trim
|
strtrim = string.trim
|
||||||
|
|
||||||
function table.wipe(t)
|
function table.wipe(t)
|
||||||
-- assert(type(t) == "table", format("bad argument #1 to 'wipe' (table expected, got %s)", t and type(t) or "no value"))
|
|
||||||
if type(t) ~= "table" then
|
if type(t) ~= "table" then
|
||||||
error(format("bad argument #1 to 'wipe' (table expected, got %s)", t and type(t) or "no value"), 2)
|
error(format("bad argument #1 to 'wipe' (table expected, got %s)", t and type(t) or "no value"), 2)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
--Cache global variables
|
--Cache global variables
|
||||||
local _G = _G
|
local _G = _G
|
||||||
--local assert = assert
|
|
||||||
local date = date
|
local date = date
|
||||||
local error = error
|
local error = error
|
||||||
local pairs = pairs
|
local pairs = pairs
|
||||||
@@ -64,7 +63,6 @@ QuestDifficultyColors = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function HookScript(frame, scriptType, handler)
|
function HookScript(frame, scriptType, handler)
|
||||||
-- assert(type(frame) == "table" and frame.GetScript and type(scriptType) == "string" and type(handler) == "function", "Usage: HookScript(frame, \"type\", function)")
|
|
||||||
if not (type(frame) == "table" and frame.GetScript and type(scriptType) == "string" and type(handler) == "function") then
|
if not (type(frame) == "table" and frame.GetScript and type(scriptType) == "string" and type(handler) == "function") then
|
||||||
error("Usage: HookScript(frame, \"type\", function)", 2)
|
error("Usage: HookScript(frame, \"type\", function)", 2)
|
||||||
end
|
end
|
||||||
@@ -84,7 +82,6 @@ end
|
|||||||
|
|
||||||
function hooksecurefunc(arg1, arg2, arg3)
|
function hooksecurefunc(arg1, arg2, arg3)
|
||||||
local isMethod = type(arg1) == "table" and type(arg2) == "string" and type(arg1[arg2]) == "function" and type(arg3) == "function"
|
local isMethod = type(arg1) == "table" and type(arg2) == "string" and type(arg1[arg2]) == "function" and type(arg3) == "function"
|
||||||
-- assert(isMethod or (type(arg1) == "string" and type(_G[arg1]) == "function" and type(arg2) == "function"), "Usage: hooksecurefunc([table,] \"functionName\", hookfunc)")
|
|
||||||
if not (isMethod or (type(arg1) == "string" and type(_G[arg1]) == "function" and type(arg2) == "function")) then
|
if not (isMethod or (type(arg1) == "string" and type(_G[arg1]) == "function" and type(arg2) == "function")) then
|
||||||
error("Usage: hooksecurefunc([table,] \"functionName\", hookfunc)", 2)
|
error("Usage: hooksecurefunc([table,] \"functionName\", hookfunc)", 2)
|
||||||
end
|
end
|
||||||
@@ -111,7 +108,9 @@ end
|
|||||||
If a table is passed first, it checks table.variable (e.g. issecurevariable(PlayerFrame, "Show") checks PlayerFrame["Show"] or PlayerFrame.Show (they are the same thing)).
|
If a table is passed first, it checks table.variable (e.g. issecurevariable(PlayerFrame, "Show") checks PlayerFrame["Show"] or PlayerFrame.Show (they are the same thing)).
|
||||||
]]
|
]]
|
||||||
function issecurevariable(t, var)
|
function issecurevariable(t, var)
|
||||||
-- assert(type(t) == "table" and type(var) == "string", "Usage: issecurevariable([table,] \"variable\")")
|
-- if type(var) ~= "table" or type(var) ~= "string" then
|
||||||
|
-- error("Usage: issecurevariable([table,] \"variable\")", 2)
|
||||||
|
-- end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -129,7 +128,6 @@ function tContains(table, item)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function UnitAura(unit, i, filter)
|
function UnitAura(unit, i, filter)
|
||||||
-- assert((type(unit) == "string" or type(unit) == "number") and (type(i) == "string" or type(i) == "number"), "Usage: UnitAura(\"unit\", index [, filter])")
|
|
||||||
if not ((type(unit) == "string" or type(unit) == "number") and (type(i) == "string" or type(i) == "number")) then
|
if not ((type(unit) == "string" or type(unit) == "number") and (type(i) == "string" or type(i) == "number")) then
|
||||||
error("Usage: UnitAura(\"unit\", index [, filter])", 2)
|
error("Usage: UnitAura(\"unit\", index [, filter])", 2)
|
||||||
end
|
end
|
||||||
@@ -170,7 +168,6 @@ function GetQuestDifficultyColor(level)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function FillLocalizedClassList(tab, female)
|
function FillLocalizedClassList(tab, female)
|
||||||
-- assert(type(tab) == "table", "Usage: FillLocalizedClassList(classTable[, isFemale])")
|
|
||||||
if type(tab) ~= "table" then
|
if type(tab) ~= "table" then
|
||||||
error("Usage: FillLocalizedClassList(classTable[, isFemale])", 2)
|
error("Usage: FillLocalizedClassList(classTable[, isFemale])", 2)
|
||||||
end
|
end
|
||||||
@@ -235,10 +232,8 @@ function GetInstanceInfo()
|
|||||||
local name = GetRealZoneText()
|
local name = GetRealZoneText()
|
||||||
|
|
||||||
local difficulty = 1
|
local difficulty = 1
|
||||||
local difficultyName = DUNGEON_DIFFICULTY1
|
|
||||||
local maxPlayers = GetMaxPlayersByType(instanceType, name)
|
local maxPlayers = GetMaxPlayersByType(instanceType, name)
|
||||||
|
local difficultyName = format("%d %s", maxPlayers, DUNGEON_DIFFICULTY1)
|
||||||
difficultyName = format("%d %s", maxPlayers, difficultyName)
|
|
||||||
|
|
||||||
return name, instanceType, difficulty, difficultyName, maxPlayers
|
return name, instanceType, difficulty, difficultyName, maxPlayers
|
||||||
end
|
end
|
||||||
@@ -251,7 +246,6 @@ function GetCurrentMapAreaID()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function GetMapNameByID(id)
|
function GetMapNameByID(id)
|
||||||
-- assert(type(id) == "string" or type(id) == "number", format("Bad argument #1 to \"GetMapNameByID\" (number expected, got %s)", id and type(id) or "no value"))
|
|
||||||
if not (type(id) == "string" or type(id) == "number") then
|
if not (type(id) == "string" or type(id) == "number") then
|
||||||
error(format("Bad argument #1 to \"GetMapNameByID\" (number expected, got %s)", id and type(id) or "no value"), 2)
|
error(format("Bad argument #1 to \"GetMapNameByID\" (number expected, got %s)", id and type(id) or "no value"), 2)
|
||||||
end
|
end
|
||||||
@@ -295,6 +289,7 @@ end
|
|||||||
|
|
||||||
local function OnSizeChanged()
|
local function OnSizeChanged()
|
||||||
local width, height = this:GetWidth(), this:GetHeight()
|
local width, height = this:GetWidth(), this:GetHeight()
|
||||||
|
|
||||||
this.texturePointer.width = width
|
this.texturePointer.width = width
|
||||||
this.texturePointer.height = height
|
this.texturePointer.height = height
|
||||||
this.texturePointer:SetWidth(width)
|
this.texturePointer:SetWidth(width)
|
||||||
@@ -302,19 +297,16 @@ local function OnSizeChanged()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function OnValueChanged()
|
local function OnValueChanged()
|
||||||
local value = arg1
|
|
||||||
local _, max = this:GetMinMaxValues()
|
local _, max = this:GetMinMaxValues()
|
||||||
|
|
||||||
if this.texturePointer.verticalOrientation then
|
if this.texturePointer.verticalOrientation then
|
||||||
this.texturePointer:SetHeight(this.texturePointer.height * (value / max))
|
this.texturePointer:SetHeight(this.texturePointer.height * (arg1 / max))
|
||||||
else
|
else
|
||||||
this.texturePointer:SetWidth(this.texturePointer.width * (value / max))
|
this.texturePointer:SetWidth(this.texturePointer.width * (arg1 / max))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function CreateStatusBarTexturePointer(statusbar)
|
function CreateStatusBarTexturePointer(statusbar)
|
||||||
-- assert(type(statusbar) == "table", format("Bad argument #1 to \"CreateStatusBarTexturePointer\" (table expected, got %s)", statusbar and type(statusbar) or "no value"))
|
|
||||||
-- assert(statusbar.GetObjectType and statusbar:GetObjectType() == "StatusBar", "Bad argument #1 to \"CreateStatusBarTexturePointer\" (statusbar object expected)")
|
|
||||||
if type(statusbar) ~= "table" then
|
if type(statusbar) ~= "table" then
|
||||||
error(format("Bad argument #1 to \"CreateStatusBarTexturePointer\" (table expected, got %s)", statusbar and type(statusbar) or "no value"), 2)
|
error(format("Bad argument #1 to \"CreateStatusBarTexturePointer\" (table expected, got %s)", statusbar and type(statusbar) or "no value"), 2)
|
||||||
elseif not (statusbar.GetObjectType and statusbar:GetObjectType() == "StatusBar") then
|
elseif not (statusbar.GetObjectType and statusbar:GetObjectType() == "StatusBar") then
|
||||||
@@ -360,7 +352,6 @@ function GetThreatStatusColor(statusIndex)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function GetThreatStatus(currentThreat, maxThreat)
|
function GetThreatStatus(currentThreat, maxThreat)
|
||||||
-- assert(type(currentThreat) == "number" and type(maxThreat) == "number", "Usage: GetThreatStatus(currentThreat, maxThreat)")
|
|
||||||
if type(currentThreat) ~= "number" or type(maxThreat) ~= "number" then
|
if type(currentThreat) ~= "number" or type(maxThreat) ~= "number" then
|
||||||
error("Usage: GetThreatStatus(currentThreat, maxThreat)", 2)
|
error("Usage: GetThreatStatus(currentThreat, maxThreat)", 2)
|
||||||
end
|
end
|
||||||
@@ -382,21 +373,21 @@ function GetThreatStatus(currentThreat, maxThreat)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local MAX_ITEM_ID = 24283
|
local LAST_ITEM_ID = 24283
|
||||||
local ItemInfoDB = {}
|
local itemInfoDB = {}
|
||||||
|
|
||||||
function GetItemInfoByName(name)
|
function GetItemInfoByName(itemName)
|
||||||
-- assert(type(itemName) == "string", "Usage: GetItemInfoByName(itemName)")
|
if type(itemName) ~= "string" then
|
||||||
if type(name) ~= "string" then
|
|
||||||
error("Usage: GetItemInfoByName(itemName)", 2)
|
error("Usage: GetItemInfoByName(itemName)", 2)
|
||||||
end
|
end
|
||||||
|
|
||||||
if not ItemInfoDB[name] then
|
if not itemInfoDB[itemName] then
|
||||||
local itemName
|
local name
|
||||||
for itemID = 1, MAX_ITEM_ID do
|
for itemID = 1, LAST_ITEM_ID do
|
||||||
itemName = GetItemInfo(itemID)
|
name = GetItemInfo(itemID)
|
||||||
if itemName ~= "" then
|
|
||||||
ItemInfoDB[name] = itemID
|
if name ~= "" then
|
||||||
|
itemInfoDB[name] = itemID
|
||||||
|
|
||||||
if name == itemName then
|
if name == itemName then
|
||||||
break
|
break
|
||||||
@@ -405,7 +396,7 @@ function GetItemInfoByName(name)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if not ItemInfoDB[name] then return end
|
if not itemInfoDB[itemName] then return end
|
||||||
|
|
||||||
return GetItemInfo(ItemInfoDB[name])
|
return GetItemInfo(itemInfoDB[itemName])
|
||||||
end
|
end
|
||||||
@@ -8,6 +8,7 @@ License: MIT
|
|||||||
]]
|
]]
|
||||||
|
|
||||||
local MAJOR_VERSION = "LibBabble-Zone-3.0"
|
local MAJOR_VERSION = "LibBabble-Zone-3.0"
|
||||||
|
--local MINOR_VERSION = 90000 + tonumber(("$Revision: 107 $"):match("%d+"))
|
||||||
local MINOR_VERSION = 90000 + tonumber(string.match("$Revision: 107 $", "%d+"))
|
local MINOR_VERSION = 90000 + tonumber(string.match("$Revision: 107 $", "%d+"))
|
||||||
|
|
||||||
if not LibStub then error(MAJOR_VERSION .. " requires LibStub.") end
|
if not LibStub then error(MAJOR_VERSION .. " requires LibStub.") end
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
local mod = math.mod
|
local modulo = math.modulo
|
||||||
local getn = table.getn
|
local getn = table.getn
|
||||||
|
|
||||||
EVENT_TRACE_EVENT_HEIGHT = 16;
|
EVENT_TRACE_EVENT_HEIGHT = 16;
|
||||||
@@ -49,7 +49,7 @@ function EventTraceFrame_OnLoad(self)
|
|||||||
EventTraceFrame_OnSizeChanged(self, self:GetWidth(), self:GetHeight());
|
EventTraceFrame_OnSizeChanged(self, self:GetWidth(), self:GetHeight());
|
||||||
self:EnableMouse(true);
|
self:EnableMouse(true);
|
||||||
self:EnableMouseWheel(true);
|
self:EnableMouseWheel(true);
|
||||||
self:SetScript("OnMouseWheel", function() EventTraceFrame_OnMouseWheel(tris, arg1) end);
|
self:SetScript("OnMouseWheel", function() EventTraceFrame_OnMouseWheel(this, arg1) end);
|
||||||
end
|
end
|
||||||
|
|
||||||
local _workTable = {};
|
local _workTable = {};
|
||||||
@@ -100,14 +100,14 @@ function EventTraceFrame_OnEvent (self, event, ...)
|
|||||||
local hours = math.floor(minutes / 60);
|
local hours = math.floor(minutes / 60);
|
||||||
seconds = seconds - 60 * minutes;
|
seconds = seconds - 60 * minutes;
|
||||||
minutes = minutes - 60 * hours;
|
minutes = minutes - 60 * hours;
|
||||||
hours = mod(hours, 1000)
|
hours = modulo(hours, 1000)
|
||||||
self.times[nextIndex] = string.format("%.2d:%.2d:%06.3f", hours, minutes, seconds);
|
self.times[nextIndex] = string.format("%.2d:%.2d:%06.3f", hours, minutes, seconds);
|
||||||
self.timeSinceLast[nextIndex] = 0;
|
self.timeSinceLast[nextIndex] = 0;
|
||||||
self.framesSinceLast[nextIndex] = 0;
|
self.framesSinceLast[nextIndex] = 0;
|
||||||
self.eventids[nextIndex] = GetCurrentEventID();
|
self.eventids[nextIndex] = GetCurrentEventID();
|
||||||
|
|
||||||
local numArgs = select("#", unpack(arg));
|
local numArgs = getn(arg);
|
||||||
for i=1, numArgs do
|
for i = 1, numArgs do
|
||||||
if (not self.args[i]) then
|
if (not self.args[i]) then
|
||||||
self.args[i] = {};
|
self.args[i] = {};
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -543,7 +543,7 @@
|
|||||||
FrameStackTooltip_OnUpdate(this, arg1);
|
FrameStackTooltip_OnUpdate(this, arg1);
|
||||||
</OnUpdate>
|
</OnUpdate>
|
||||||
<OnEvent>
|
<OnEvent>
|
||||||
FrameStackTooltip_OnEvent(this, arg);
|
FrameStackTooltip_OnEvent(this, event, arg1);
|
||||||
</OnEvent>
|
</OnEvent>
|
||||||
</Scripts>
|
</Scripts>
|
||||||
</GameTooltip>
|
</GameTooltip>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
-- Cache global variables
|
-- Cache global variables
|
||||||
local mod = math.mod
|
|
||||||
local pairs = pairs
|
local pairs = pairs
|
||||||
local tostring = tostring
|
local tostring = tostring
|
||||||
|
local fmod = math.fmod
|
||||||
local format, match = string.format, string.match
|
local format, match = string.format, string.match
|
||||||
local getn, setn, tinsert, tsort, twipe = table.getn, table.setn, table.insert, table.sort, table.wipe
|
local getn, setn, tinsert, tsort, twipe = table.getn, table.setn, table.insert, table.sort, table.wipe
|
||||||
-- WoW API
|
-- WoW API
|
||||||
@@ -174,7 +174,7 @@ function UpdateFrameStack(tooltip, showHidden)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if l ~= ol then
|
if l ~= ol then
|
||||||
cs = mod(cs, cn) + 1
|
cs = fmod(cs, cn) + 1
|
||||||
ol = l
|
ol = l
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user