Code format
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
|
||||
aura_env.addtostring = function(s, ...)
|
||||
local i = 1
|
||||
while select(i, ...) do
|
||||
s = s .. select(i, ...) .. " "
|
||||
i = i + 1
|
||||
end
|
||||
s = s .. "\n"
|
||||
return s
|
||||
local i = 1
|
||||
while select(i, ...) do
|
||||
s = s .. select(i, ...) .. " "
|
||||
i = i + 1
|
||||
end
|
||||
s = s .. "\n"
|
||||
return s
|
||||
end
|
||||
|
@@ -1,5 +1,5 @@
|
||||
local plate = C_NamePlate.GetNamePlateForUnit("target")
|
||||
if plate then
|
||||
aura_env.region:ClearAllPoints()
|
||||
aura_env.region:SetPoint("BOTTOM", plate, "BOTTOM", 0, 0)
|
||||
aura_env.region:ClearAllPoints()
|
||||
aura_env.region:SetPoint("BOTTOM", plate, "BOTTOM", 0, 0)
|
||||
end
|
||||
|
@@ -1,48 +1,90 @@
|
||||
aura_env.classColor = function(class)
|
||||
if class == 6 then return "\124cFFC41F3B" elseif
|
||||
class == 12 then return "\124cFFA330C9" elseif
|
||||
class == 11 then return "\124cFFFF7D0A" elseif
|
||||
class == 3 then return "\124cFFABD473" elseif
|
||||
class == 8 then return "\124cFF40C7EB" elseif
|
||||
class == 10 then return "\124cFF00FF96" elseif
|
||||
class == 2 then return "\124cFFF58CBA" elseif
|
||||
class == 5 then return "\124cFFFFFFFF" elseif
|
||||
class == 4 then return "\124cFFFFF569" elseif
|
||||
class == 7 then return "\124cFF0070DE" elseif
|
||||
class == 9 then return "\124cFF8787ED" elseif
|
||||
class == 1 then return "\124cFFC79C6E" else
|
||||
return "\124cFFFFFFFF" end
|
||||
if class == 6 then
|
||||
return "\124cFFC41F3B"
|
||||
elseif class == 12 then
|
||||
return "\124cFFA330C9"
|
||||
elseif class == 11 then
|
||||
return "\124cFFFF7D0A"
|
||||
elseif class == 3 then
|
||||
return "\124cFFABD473"
|
||||
elseif class == 8 then
|
||||
return "\124cFF40C7EB"
|
||||
elseif class == 10 then
|
||||
return "\124cFF00FF96"
|
||||
elseif class == 2 then
|
||||
return "\124cFFF58CBA"
|
||||
elseif class == 5 then
|
||||
return "\124cFFFFFFFF"
|
||||
elseif class == 4 then
|
||||
return "\124cFFFFF569"
|
||||
elseif class == 7 then
|
||||
return "\124cFF0070DE"
|
||||
elseif class == 9 then
|
||||
return "\124cFF8787ED"
|
||||
elseif class == 1 then
|
||||
return "\124cFFC79C6E"
|
||||
else
|
||||
return "\124cFFFFFFFF"
|
||||
end
|
||||
end
|
||||
|
||||
aura_env.classColor = function(name)
|
||||
local class = UnitClass(name) or ""
|
||||
if class == "Death Knight" then return 0.77, 0.12, 0.23, 1 elseif
|
||||
class == "Demon Hunter" then return 0.64, 0.19, 0.79, 1 elseif
|
||||
class == "Druid" then return 1, 0.49, 0.04, 1 elseif
|
||||
class == "Hunter" then return 0.67, 0.83, 0.45, 1 elseif
|
||||
class == "Mage" then return 0.25, 0.78, 0.92, 1 elseif
|
||||
class == "Monk" then return 0, 1, 0.59, 1 elseif
|
||||
class == "Paladin" then return 0.96, 0.55, 0.73, 1 elseif
|
||||
class == "Priest" then return 1, 1, 1, 1 elseif
|
||||
class == "Rogue" then return 1, 0.96, 0.41, 1 elseif
|
||||
class == "Shaman" then return 0, 0.44, 0.87, 1 elseif
|
||||
class == "Warlock" then return 0.53, 0.53, 0.93, 1 elseif
|
||||
class == "Warrior" then return 0.78, 0.61, 0.43, 1 else
|
||||
return 0, 0, 0, 0 end
|
||||
local class = UnitClass(name) or ""
|
||||
if class == "Death Knight" then
|
||||
return 0.77, 0.12, 0.23, 1
|
||||
elseif class == "Demon Hunter" then
|
||||
return 0.64, 0.19, 0.79, 1
|
||||
elseif class == "Druid" then
|
||||
return 1, 0.49, 0.04, 1
|
||||
elseif class == "Hunter" then
|
||||
return 0.67, 0.83, 0.45, 1
|
||||
elseif class == "Mage" then
|
||||
return 0.25, 0.78, 0.92, 1
|
||||
elseif class == "Monk" then
|
||||
return 0, 1, 0.59, 1
|
||||
elseif class == "Paladin" then
|
||||
return 0.96, 0.55, 0.73, 1
|
||||
elseif class == "Priest" then
|
||||
return 1, 1, 1, 1
|
||||
elseif class == "Rogue" then
|
||||
return 1, 0.96, 0.41, 1
|
||||
elseif class == "Shaman" then
|
||||
return 0, 0.44, 0.87, 1
|
||||
elseif class == "Warlock" then
|
||||
return 0.53, 0.53, 0.93, 1
|
||||
elseif class == "Warrior" then
|
||||
return 0.78, 0.61, 0.43, 1
|
||||
else
|
||||
return 0, 0, 0, 0
|
||||
end
|
||||
end
|
||||
|
||||
aura_env.classColor = function(class)
|
||||
if class == 1 then return 0.78, 0.61, 0.43, 1 elseif
|
||||
class == 2 then return 0.96, 0.55, 0.73, 1 elseif
|
||||
class == 3 then return 0.67, 0.83, 0.45, 1 elseif
|
||||
class == 4 then return 1, 0.96, 0.41, 1 elseif
|
||||
class == 5 then return 1, 1, 1, 1 elseif
|
||||
class == 6 then return 0.77, 0.12, 0.23, 1 elseif
|
||||
class == 7 then return 0, 0.44, 0.87, 1 elseif
|
||||
class == 8 then return 0.25, 0.78, 0.92, 1 elseif
|
||||
class == 9 then return 0.53, 0.53, 0.93, 1 elseif
|
||||
class == 10 then return 0, 1, 0.59, 1 elseif
|
||||
class == 11 then return 1, 0.49, 0.04, 1 elseif
|
||||
class == 12 then return 0.64, 0.19, 0.79, 1 else
|
||||
return 1, 1, 1, 1 end
|
||||
if class == 1 then
|
||||
return 0.78, 0.61, 0.43, 1
|
||||
elseif class == 2 then
|
||||
return 0.96, 0.55, 0.73, 1
|
||||
elseif class == 3 then
|
||||
return 0.67, 0.83, 0.45, 1
|
||||
elseif class == 4 then
|
||||
return 1, 0.96, 0.41, 1
|
||||
elseif class == 5 then
|
||||
return 1, 1, 1, 1
|
||||
elseif class == 6 then
|
||||
return 0.77, 0.12, 0.23, 1
|
||||
elseif class == 7 then
|
||||
return 0, 0.44, 0.87, 1
|
||||
elseif class == 8 then
|
||||
return 0.25, 0.78, 0.92, 1
|
||||
elseif class == 9 then
|
||||
return 0.53, 0.53, 0.93, 1
|
||||
elseif class == 10 then
|
||||
return 0, 1, 0.59, 1
|
||||
elseif class == 11 then
|
||||
return 1, 0.49, 0.04, 1
|
||||
elseif class == 12 then
|
||||
return 0.64, 0.19, 0.79, 1
|
||||
else
|
||||
return 1, 1, 1, 1
|
||||
end
|
||||
end
|
||||
|
@@ -1,60 +1,59 @@
|
||||
aura_env.grad = function(c)
|
||||
--c expected as [0, 1]
|
||||
if c > 0.5 then
|
||||
c = 1 - (2 * (c - 0.5))
|
||||
return c, 1, 0, 1
|
||||
else
|
||||
c = c * 2
|
||||
return 1, c, 0, 1
|
||||
end
|
||||
--c expected as [0, 1]
|
||||
if c > 0.5 then
|
||||
c = 1 - (2 * (c - 0.5))
|
||||
return c, 1, 0, 1
|
||||
else
|
||||
c = c * 2
|
||||
return 1, c, 0, 1
|
||||
end
|
||||
end
|
||||
|
||||
local function hexgrad(val, min, max)
|
||||
local function tohex(input)
|
||||
local output = string.format("%x", input * 255)
|
||||
return output
|
||||
end
|
||||
local function grad(c, min, max)
|
||||
c = (((max - c) / (max - min)) * 1)
|
||||
if c > 0.5 then
|
||||
c = 1 - (2 * (c - 0.5))
|
||||
return c, 1, 0, 1
|
||||
else
|
||||
c = c * 2
|
||||
return 1, c, 0, 1
|
||||
end
|
||||
end
|
||||
local color1, color2, color3, color4 = 0, 0, 0, 0
|
||||
color1, color2, color3, color4 = grad(val, min, max)
|
||||
color1, color2, color3, color4 = tohex(color1), tohex(color2), tohex(color3), tohex(color4)
|
||||
color1, color2, color3, color4 = tostring(color1), tostring(color2), tostring(color3), tostring(color4)
|
||||
if string.len(color1) == 1 then color1 = "0" .. color1 end
|
||||
if string.len(color2) == 1 then color2 = "0" .. color2 end
|
||||
if string.len(color3) == 1 then color3 = "0" .. color3 end
|
||||
if string.len(color4) == 1 then color4 = "0" .. color4 end
|
||||
local color = "\124c" .. color4 .. color1 .. color2 .. color3
|
||||
return color
|
||||
local function tohex(input)
|
||||
local output = string.format("%x", input * 255)
|
||||
return output
|
||||
end
|
||||
local function grad(c, min, max)
|
||||
c = (((max - c) / (max - min)) * 1)
|
||||
if c > 0.5 then
|
||||
c = 1 - (2 * (c - 0.5))
|
||||
return c, 1, 0, 1
|
||||
else
|
||||
c = c * 2
|
||||
return 1, c, 0, 1
|
||||
end
|
||||
end
|
||||
local color1, color2, color3, color4 = 0, 0, 0, 0
|
||||
color1, color2, color3, color4 = grad(val, min, max)
|
||||
color1, color2, color3, color4 = tohex(color1), tohex(color2), tohex(color3), tohex(color4)
|
||||
color1, color2, color3, color4 = tostring(color1), tostring(color2), tostring(color3), tostring(color4)
|
||||
if string.len(color1) == 1 then color1 = "0" .. color1 end
|
||||
if string.len(color2) == 1 then color2 = "0" .. color2 end
|
||||
if string.len(color3) == 1 then color3 = "0" .. color3 end
|
||||
if string.len(color4) == 1 then color4 = "0" .. color4 end
|
||||
local color = "\124c" .. color4 .. color1 .. color2 .. color3
|
||||
return color
|
||||
end
|
||||
|
||||
local function RGBtoHex(rgb)
|
||||
local hexadecimal = 'FF'
|
||||
for key, value in pairs(rgb) do
|
||||
local hex = ''
|
||||
|
||||
while(value > 0)do
|
||||
local index = math.fmod(value, 16) + 1
|
||||
value = math.floor(value / 16)
|
||||
hex = string.sub('0123456789ABCDEF', index, index) .. hex
|
||||
end
|
||||
|
||||
if(string.len(hex) == 0)then
|
||||
hex = '00'
|
||||
|
||||
elseif(string.len(hex) == 1)then
|
||||
hex = '0' .. hex
|
||||
end
|
||||
|
||||
hexadecimal = hexadecimal .. hex
|
||||
end
|
||||
return hexadecimal
|
||||
local hexadecimal = "FF"
|
||||
for key, value in pairs(rgb) do
|
||||
local hex = ""
|
||||
|
||||
while value > 0 do
|
||||
local index = math.fmod(value, 16) + 1
|
||||
value = math.floor(value / 16)
|
||||
hex = string.sub("0123456789ABCDEF", index, index) .. hex
|
||||
end
|
||||
|
||||
if string.len(hex) == 0 then
|
||||
hex = "00"
|
||||
elseif string.len(hex) == 1 then
|
||||
hex = "0" .. hex
|
||||
end
|
||||
|
||||
hexadecimal = hexadecimal .. hex
|
||||
end
|
||||
return hexadecimal
|
||||
end
|
||||
|
@@ -4,12 +4,8 @@ aura_env.getDate = function()
|
||||
local month = date:match("(%d%d)") --(01)/07/19 14:36:42
|
||||
local day = date:match("%d%d%/(%d%d)") --01/(07)/19 14:36:42
|
||||
--Remove first place zeros
|
||||
if day:find("0") == 1 then
|
||||
day = day:gsub("0", "")
|
||||
end
|
||||
if month:find("0") == 1 then
|
||||
month = month:gsub("0", "")
|
||||
end
|
||||
if day:find("0") == 1 then day = day:gsub("0", "") end
|
||||
if month:find("0") == 1 then month = month:gsub("0", "") end
|
||||
local localdate = day .. "." .. month .. "." .. year
|
||||
return localdate
|
||||
end
|
||||
@@ -26,12 +22,8 @@ local function getDate()
|
||||
local month = date:match("(%d%d)") --(01)/07/19 14:36:42
|
||||
local day = date:match("%d%d%/(%d%d)") --01/(07)/19 14:36:42
|
||||
--Remove first place zeros
|
||||
if day:find("0") == 1 then
|
||||
day = day:gsub("0", "")
|
||||
end
|
||||
if month:find("0") == 1 then
|
||||
month = month:gsub("0", "")
|
||||
end
|
||||
if day:find("0") == 1 then day = day:gsub("0", "") end
|
||||
if month:find("0") == 1 then month = month:gsub("0", "") end
|
||||
local localdate = day .. "." .. month .. "." .. year
|
||||
return localdate
|
||||
end
|
||||
@@ -40,4 +32,4 @@ local function getTime()
|
||||
local date = date()
|
||||
local localtime = date:match("%d%d%/%d%d%/%d%d%s(%d%d%p%d%d%p%d%d)")
|
||||
return localtime
|
||||
end
|
||||
end
|
||||
|
@@ -1,6 +1,6 @@
|
||||
aura_env.stackDef = function(def1, def2)
|
||||
local x = 1 - def1
|
||||
local y = 1 - def2
|
||||
local var = x * y
|
||||
return 1 - var
|
||||
local x = 1 - def1
|
||||
local y = 1 - def2
|
||||
local var = x * y
|
||||
return 1 - var
|
||||
end
|
||||
|
@@ -2,11 +2,9 @@ aura_env.auraID = function(spell)
|
||||
for i = 1, 40 do
|
||||
local name = UnitBuff("player", i)
|
||||
if name then
|
||||
if name == spell then
|
||||
return i
|
||||
end
|
||||
if name == spell then return i end
|
||||
else
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@@ -5,9 +5,7 @@ local function formatTime(time)
|
||||
res = res - 60
|
||||
end
|
||||
s = res
|
||||
if s < 10 then
|
||||
s = string.format("0%d", s)
|
||||
end
|
||||
if s < 10 then s = string.format("0%d", s) end
|
||||
if type(s) ~= "string" then tostring(s) end
|
||||
return string.format("%d:%s", m, s)
|
||||
end
|
||||
end
|
||||
|
@@ -1,5 +1,3 @@
|
||||
local function name(arguments)
|
||||
end
|
||||
local function name(arguments) end
|
||||
|
||||
aura_env.name = function(arguments)
|
||||
end
|
||||
aura_env.name = function(arguments) end
|
||||
|
@@ -1,5 +1,4 @@
|
||||
|
||||
for itemLink in msg:gmatch("|%x+|Hitem:.-|h.-|h|r") do
|
||||
itemID = itemLink:match("item:(%d+):")
|
||||
icon = select(10, GetItemInfo(itemLink))
|
||||
itemID = itemLink:match("item:(%d+):")
|
||||
icon = select(10, GetItemInfo(itemLink))
|
||||
end
|
||||
|
@@ -4,16 +4,14 @@ while true do
|
||||
local spellName, spellSubName = GetSpellBookItemName(i, BOOKTYPE_SPELL)
|
||||
local type, ID = GetSpellBookItemInfo(i, BOOKTYPE_SPELL)
|
||||
if not spellName then
|
||||
do break end
|
||||
do
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if spellName:match("Mastery:") then
|
||||
break
|
||||
end
|
||||
if spellName:match("Mastery:") then break end
|
||||
if spellName ~= "Revive Battle Pets" and spellName ~= "Mobile Banking" then
|
||||
if (GetSpellBaseCooldown(ID) or 0) > 20000 then
|
||||
print(spellName, ID, GetSpellBaseCooldown(ID) / 1000)
|
||||
end
|
||||
if (GetSpellBaseCooldown(ID) or 0) > 20000 then print(spellName, ID, GetSpellBaseCooldown(ID) / 1000) end
|
||||
end
|
||||
|
||||
i = i + 1
|
||||
@@ -23,19 +21,15 @@ for row = 1, 7 do
|
||||
for column = 1, 3 do
|
||||
local ID = select(6, GetTalentInfo(row, column, 1))
|
||||
local spellName = select(2, GetTalentInfo(row, column, 1))
|
||||
if GetSpellBaseCooldown(ID) > 20000 then
|
||||
print(spellName, ID, GetSpellBaseCooldown(ID) / 1000)
|
||||
end
|
||||
end
|
||||
if GetSpellBaseCooldown(ID) > 20000 then print(spellName, ID, GetSpellBaseCooldown(ID) / 1000) end
|
||||
end
|
||||
end
|
||||
for row = 1, 7 do
|
||||
for column = 1, 3 do
|
||||
local ID = select(6, GetPvpTalentInfo(row, column, 1))
|
||||
if ID then
|
||||
local spellName = select(2, GetPvpTalentInfo(row, column, 1))
|
||||
if GetSpellBaseCooldown(ID) > 20000 then
|
||||
print(spellName, ID, GetSpellBaseCooldown(ID) / 1000)
|
||||
end
|
||||
if GetSpellBaseCooldown(ID) > 20000 then print(spellName, ID, GetSpellBaseCooldown(ID) / 1000) end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@@ -71,7 +71,7 @@ local function tonum(cchar)
|
||||
end
|
||||
local function findcollision(hash_table, array)
|
||||
local collisions = 0
|
||||
for k,v in ipairs(hash_table) do
|
||||
for k, v in ipairs(hash_table) do
|
||||
for i = 1, table.getn(hash_table) do
|
||||
if i ~= k then
|
||||
if hash_table[i] == hash_table[k] then
|
||||
@@ -83,14 +83,14 @@ local function findcollision(hash_table, array)
|
||||
end
|
||||
return collisions
|
||||
end
|
||||
aura_env.tohash = function(tempvar)
|
||||
aura_env.tohash = function(tempvar)
|
||||
local charTable = {}
|
||||
local hash = 0
|
||||
for char in tempvar:gmatch("%a") do
|
||||
charTable[#charTable + 1] = char
|
||||
hash = hash + tonum(char)
|
||||
hash = hash / table.getn(charTable)
|
||||
end
|
||||
end
|
||||
hash = math.floor(hash * 10000)
|
||||
return hash
|
||||
--print(aura_env.spellarray[hash], hash)
|
||||
@@ -98,4 +98,4 @@ end
|
||||
aura_env.checkbase = function(spell)
|
||||
if aura_env.spellarray[aura_env.tohash(spell)] == nil then return 0 end
|
||||
if aura_env.spellarray[aura_env.tohash(spell)] == spell then return 1 end
|
||||
end
|
||||
end
|
||||
|
@@ -1,3 +1 @@
|
||||
hooksecurefunc( "JumpOrAscendStart", function()
|
||||
DEFAULT_CHAT_FRAME:AddMessage( "Jump" );
|
||||
end );
|
||||
hooksecurefunc("JumpOrAscendStart", function() DEFAULT_CHAT_FRAME:AddMessage("Jump") end)
|
||||
|
@@ -1,8 +1,8 @@
|
||||
aura_env.glow = function(unit, s)
|
||||
local nameplate = C_NamePlate.GetNamePlateForUnit(unit)
|
||||
if nameplate and s == 1 then
|
||||
ActionButton_ShowOverlayGlow(nameplate.UnitFrame.HealthBar)
|
||||
else
|
||||
ActionButton_HideOverlayGlow(nameplate.UnitFrame.HealthBar)
|
||||
end
|
||||
local nameplate = C_NamePlate.GetNamePlateForUnit(unit)
|
||||
if nameplate and s == 1 then
|
||||
ActionButton_ShowOverlayGlow(nameplate.UnitFrame.HealthBar)
|
||||
else
|
||||
ActionButton_HideOverlayGlow(nameplate.UnitFrame.HealthBar)
|
||||
end
|
||||
end
|
||||
|
@@ -1,7 +1,7 @@
|
||||
--INIT
|
||||
if not aura_env.region.texture then
|
||||
local texture = aura_env.region:CreateTexture(nil, "OVERLAY")
|
||||
aura_env.region.texture = texture
|
||||
local texture = aura_env.region:CreateTexture(nil, "OVERLAY")
|
||||
aura_env.region.texture = texture
|
||||
end
|
||||
aura_env.region:SetHeight(128)
|
||||
aura_env.region:SetWidth(128)
|
||||
@@ -12,6 +12,6 @@ aura_env.region.texture:SetAllPoints(aura_env.region)
|
||||
aura_env.region.texture:Show()
|
||||
local plate = C_NamePlate.GetNamePlateForUnit("target")
|
||||
if plate then
|
||||
aura_env.region.texture:ClearAllPoints()
|
||||
aura_env.region.texture:SetPoint("BOTTOM", plate, "BOTTOM", 0, 0)
|
||||
aura_env.region.texture:ClearAllPoints()
|
||||
aura_env.region.texture:SetPoint("BOTTOM", plate, "BOTTOM", 0, 0)
|
||||
end
|
||||
|
@@ -1,6 +1,6 @@
|
||||
local function printTable(table, n)
|
||||
if not n then n = 0 end
|
||||
for k,v in pairs(table) do
|
||||
for k, v in pairs(table) do
|
||||
local printText = ""
|
||||
for i = 1, n do
|
||||
printText = printText .. " "
|
||||
@@ -12,4 +12,4 @@ local function printTable(table, n)
|
||||
printTable(v, n)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@@ -58,7 +58,7 @@ for i = 1, 10 do
|
||||
print(registers.lifo.push(i))
|
||||
end
|
||||
print("")
|
||||
for k,v in ipairs(registers.lifostack) do
|
||||
for k, v in ipairs(registers.lifostack) do
|
||||
print(v)
|
||||
end
|
||||
print("")
|
||||
@@ -74,11 +74,11 @@ for i = 1, 4 do
|
||||
print(registers.lilo.push(i))
|
||||
end
|
||||
print("")
|
||||
for k,v in ipairs(registers.lilostack) do
|
||||
for k, v in ipairs(registers.lilostack) do
|
||||
print(v)
|
||||
end
|
||||
print("")
|
||||
for i = 1, #registers.lilostack do
|
||||
print("pop")
|
||||
print(registers.lilo.pop())
|
||||
end
|
||||
end
|
||||
|
@@ -1,8 +1,8 @@
|
||||
aura_env.round = function(var, n)
|
||||
if (n) then
|
||||
if n then
|
||||
var = math.floor((var * 10 ^ n) + 0.5) / (10 ^ n)
|
||||
else
|
||||
var = math.floor(var + 0.5)
|
||||
end
|
||||
return var
|
||||
end
|
||||
end
|
||||
|
@@ -1,20 +1,20 @@
|
||||
aura_env.shorten = function(val)
|
||||
local function round(var, n)
|
||||
if (n) then
|
||||
var = math.floor((var * 10 ^ n) + 0.5) / (10 ^ n)
|
||||
else
|
||||
var = math.floor(var + 0.5)
|
||||
end
|
||||
return var
|
||||
end
|
||||
local n = 2
|
||||
if val < 1e3 then
|
||||
return round(val, n)
|
||||
elseif val > 1e3 and val < 1e6 then
|
||||
return round(val / 1e3, n) .. "k"
|
||||
elseif val > 1e6 and val < 1e9 then
|
||||
return round(val / 1e6, n) .. "M"
|
||||
elseif val > 1e9 then
|
||||
return round(val / 1e9, n) .. "G"
|
||||
end
|
||||
local function round(var, n)
|
||||
if n then
|
||||
var = math.floor((var * 10 ^ n) + 0.5) / (10 ^ n)
|
||||
else
|
||||
var = math.floor(var + 0.5)
|
||||
end
|
||||
return var
|
||||
end
|
||||
local n = 2
|
||||
if val < 1e3 then
|
||||
return round(val, n)
|
||||
elseif val > 1e3 and val < 1e6 then
|
||||
return round(val / 1e3, n) .. "k"
|
||||
elseif val > 1e6 and val < 1e9 then
|
||||
return round(val / 1e6, n) .. "M"
|
||||
elseif val > 1e9 then
|
||||
return round(val / 1e9, n) .. "G"
|
||||
end
|
||||
end
|
||||
|
@@ -1,4 +1,4 @@
|
||||
aura_env.range = function(val, min, max, max2)
|
||||
val = 1 - (((max - val) / (max - min)) * max2)
|
||||
return val
|
||||
end
|
||||
end
|
||||
|
@@ -1,22 +1,22 @@
|
||||
local function sortArray(array)
|
||||
local lastMax = 1000
|
||||
local maxv, maxk = 0, 0
|
||||
local temparray = {}
|
||||
for k, v in ipairs(array) do
|
||||
temparray[k] = v
|
||||
end
|
||||
local sorted = {}
|
||||
for k, v in ipairs(array) do
|
||||
maxv, maxk = 0, 0
|
||||
for k2, v2 in ipairs(temparray) do
|
||||
if lastMax and v2 > maxv and v2 <= lastMax then
|
||||
maxv = v2
|
||||
maxk = k2
|
||||
end
|
||||
end
|
||||
sorted[k] = maxv
|
||||
table.remove(temparray, maxk)
|
||||
lastMax = maxv
|
||||
end
|
||||
return sorted
|
||||
local lastMax = 1000
|
||||
local maxv, maxk = 0, 0
|
||||
local temparray = {}
|
||||
for k, v in ipairs(array) do
|
||||
temparray[k] = v
|
||||
end
|
||||
local sorted = {}
|
||||
for k, v in ipairs(array) do
|
||||
maxv, maxk = 0, 0
|
||||
for k2, v2 in ipairs(temparray) do
|
||||
if lastMax and v2 > maxv and v2 <= lastMax then
|
||||
maxv = v2
|
||||
maxk = k2
|
||||
end
|
||||
end
|
||||
sorted[k] = maxv
|
||||
table.remove(temparray, maxk)
|
||||
lastMax = maxv
|
||||
end
|
||||
return sorted
|
||||
end
|
||||
|
@@ -1,12 +1,10 @@
|
||||
aura_env.CUnitBuff = function(spell)
|
||||
for i = 1, 40 do
|
||||
local name = UnitBuff("player", i)
|
||||
if name then
|
||||
if name == spell then
|
||||
return UnitBuff("player", i)
|
||||
end
|
||||
else
|
||||
break
|
||||
end
|
||||
end
|
||||
for i = 1, 40 do
|
||||
local name = UnitBuff("player", i)
|
||||
if name then
|
||||
if name == spell then return UnitBuff("player", i) end
|
||||
else
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@@ -1,25 +1,20 @@
|
||||
|
||||
aura_env.UnitDebuffC = function(unit, spell)
|
||||
for i = 1, 40 do
|
||||
local name = UnitDebuff(unit, i)
|
||||
if name then
|
||||
if name == spell then
|
||||
return UnitDebuff(unit, i)
|
||||
end
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
for i = 1, 40 do
|
||||
local name = UnitDebuff(unit, i)
|
||||
if name then
|
||||
if name == spell then return UnitDebuff(unit, i) end
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
end
|
||||
aura_env.UnitBuffC = function(unit, spell)
|
||||
for i = 1, 40 do
|
||||
local name = UnitBuff(unit, i)
|
||||
if name then
|
||||
if name == spell then
|
||||
return UnitBuff(unit, i)
|
||||
end
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
for i = 1, 40 do
|
||||
local name = UnitBuff(unit, i)
|
||||
if name then
|
||||
if name == spell then return UnitBuff(unit, i) end
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user