Add new code snippets
This commit is contained in:
32
Complete Projects/Legion/CachedNPCLevels.lua
Normal file
32
Complete Projects/Legion/CachedNPCLevels.lua
Normal file
@@ -0,0 +1,32 @@
|
||||
--GLOBAL_TICKER GET_LEVEL
|
||||
function(e, ...)
|
||||
if e == "GET_LEVEL" then
|
||||
local name = ...
|
||||
if not aura_env.scanList[name] then
|
||||
aura_env.scanList[name] = GetTime()
|
||||
end
|
||||
end
|
||||
|
||||
for k, v in pairs(aura_env.scanList) do
|
||||
if GetTime() - v > 30 then
|
||||
aura_env.scanList[k] = nil
|
||||
end
|
||||
end
|
||||
|
||||
for i = 1, 40 do
|
||||
local u = "nameplate" .. i
|
||||
if UnitExists(u) then
|
||||
local uname, level = UnitName(u), UnitLevel(u)
|
||||
if aura_env.scanList[uname] then
|
||||
WeakAurasSaved.CustomTrash.CachedLevels[uname] = level
|
||||
aura_env.scanList[uname] = nil
|
||||
end
|
||||
else
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--INIT
|
||||
if not WeakAurasSaved.CustomTrash.CachedLevels then WeakAurasSaved.CustomTrash.CachedLevels = {} end
|
||||
aura_env.scanList = {}
|
||||
Reference in New Issue
Block a user