Add new code snippets
This commit is contained in:
@@ -0,0 +1,234 @@
|
||||
--GROUP_ROSTER_UPDATE INSPECT_READY
|
||||
function(e)
|
||||
if e == "GROUP_ROSTER_UPDATE" then
|
||||
for i = 1, 40 do
|
||||
local u = "raid" .. i
|
||||
if UnitExists(u) and not UnitIsUnit(u, "player") then
|
||||
if not aura_env.data[u] then
|
||||
aura_env.data[u] = {
|
||||
["name"] = UnitName(u),
|
||||
["class"] = select(3, UnitClass(u)),
|
||||
["neckilvl"] = 0,
|
||||
["backilvl"] = 0,
|
||||
["corruption"] = 0,
|
||||
["inspectQueue"] = false,
|
||||
["inspected"] = false
|
||||
}
|
||||
end
|
||||
if aura_env.data[u] then
|
||||
if aura_env.data[u].name ~= UnitName(u) then
|
||||
aura_env.data[u] = {
|
||||
["name"] = UnitName(u),
|
||||
["class"] = select(3, UnitClass(u)),
|
||||
["neckilvl"] = 0,
|
||||
["backilvl"] = 0,
|
||||
["corruption"] = 0,
|
||||
["inspectQueue"] = false,
|
||||
["inspected"] = false
|
||||
}
|
||||
end
|
||||
end
|
||||
elseif not UnitExists(u) and aura_env.data[u] then
|
||||
if aura_env.data[u] then
|
||||
aura_env.data[u] = nil
|
||||
end
|
||||
for k,v in pairs(aura_env.inspectQueue) do
|
||||
if v == u then
|
||||
table.remove(aura_env.inspectQueue, k)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif e == "INSPECT_READY" then
|
||||
if aura_env.notifyInspect ~= false and aura_env.inspecting == false then
|
||||
InspectUnit(aura_env.notifyInspect)
|
||||
aura_env.inspecting = true
|
||||
elseif aura_env.notifyInspect ~= false and aura_env.inspecting == true then
|
||||
for i = 1, 17 do
|
||||
local link = GetInventoryItemLink(aura_env.notifyInspect, i) or 0
|
||||
if link ~= 0 then
|
||||
local stats = {}
|
||||
GetItemStats(link, stats)
|
||||
local rarity = select(3, GetItemInfo(link))
|
||||
local ilvl = select(4, GetItemInfo(link))
|
||||
if aura_env.config.debug == true then
|
||||
for k,v in pairs(stats) do
|
||||
end
|
||||
end
|
||||
if i == 2 then
|
||||
aura_env.data[aura_env.notifyInspect].neckilvl = ilvl
|
||||
elseif i == 15 and rarity == 5 then
|
||||
aura_env.data[aura_env.notifyInspect].backilvl = ilvl
|
||||
end
|
||||
if stats["ITEM_MOD_CORRUPTION"] then
|
||||
--print("Item", link, "adds", stats["ITEM_MOD_CORRUPTION"], "corruption")
|
||||
aura_env.data[aura_env.notifyInspect].corruption = aura_env.data[aura_env.notifyInspect].corruption + stats["ITEM_MOD_CORRUPTION"]
|
||||
end
|
||||
if stats["ITEM_MOD_CORRUPTION_RESISTANCE"] then
|
||||
--print("Item", link, "reduces corruption by", stats["ITEM_MOD_CORRUPTION_RESISTANCE"])
|
||||
aura_env.data[aura_env.notifyInspect].corruption = aura_env.data[aura_env.notifyInspect].corruption - stats["ITEM_MOD_CORRUPTION_RESISTANCE"]
|
||||
end
|
||||
end
|
||||
end
|
||||
aura_env.data[aura_env.notifyInspect].inspectQueue = false
|
||||
aura_env.data[aura_env.notifyInspect].inspected = true
|
||||
aura_env.notifyInspect = false
|
||||
if not aura_env.ticker then aura_env.ticker = C_Timer.NewTicker(0.5, aura_env.inspectPing) end
|
||||
ClearInspectPlayer()
|
||||
end
|
||||
end
|
||||
|
||||
for k,v in pairs(aura_env.data) do
|
||||
if v.inspected == false and v.inspectQueue == false then
|
||||
aura_env.inspectQueue[#aura_env.inspectQueue + 1] = k
|
||||
v.inspectQueue = true
|
||||
end
|
||||
if v.neckilvl == 0 and v.inspectQueue == false then
|
||||
aura_env.inspectQueue[#aura_env.inspectQueue + 1] = k
|
||||
v.inspectQueue = true
|
||||
end
|
||||
end
|
||||
|
||||
local text = {"", "", "", ""}
|
||||
for k,v in pairs(aura_env.data) do
|
||||
text[1] = text[1] .. aura_env.classColor(v.class) .. v.name .. "\n"
|
||||
text[2] = text[2] .. "|cff" .. aura_env.config.ncolor .. v.neckilvl .. "\n"
|
||||
text[3] = text[3] .. "|cff" .. aura_env.config.ccolor .. v.backilvl .. "\n"
|
||||
text[4] = text[4] .. "|cff" .. aura_env.config.cocolor .. v.corruption .. "\n"
|
||||
end
|
||||
|
||||
aura_env.text = text[1]
|
||||
aura_env.randomFrame.text2:SetText(text[2])
|
||||
aura_env.randomFrame.text3:SetText(text[3])
|
||||
aura_env.randomFrame.text4:SetText(text[4])
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
--DISPLAY
|
||||
function()
|
||||
return aura_env.text
|
||||
end
|
||||
|
||||
--INIT
|
||||
if WeakAuras.IsOptionsOpen() then
|
||||
if aura_env.ticker then
|
||||
aura_env.ticker:Cancel()
|
||||
aura_env.ticker = nil
|
||||
end
|
||||
end
|
||||
local aura_env = aura_env
|
||||
aura_env.data = {}
|
||||
aura_env.text = ""
|
||||
aura_env.inspectQueue = {}
|
||||
aura_env.insIndex = 1
|
||||
aura_env.notifyInspect = false
|
||||
aura_env.inspecting = false
|
||||
aura_env.output = ""
|
||||
if not WeakAurasSaved.CustomTrash then WeakAurasSaved.CustomTrash = {} end
|
||||
if not WeakAurasSaved.CustomTrash.Debug then WeakAurasSaved.CustomTrash.Debug = {} end
|
||||
|
||||
aura_env.printTable = function(table, n)
|
||||
if not n then n = 0 end
|
||||
for k,v in pairs(table) do
|
||||
local printText = ""
|
||||
for i = 1, n do
|
||||
printText = printText .. " "
|
||||
end
|
||||
printText = printText .. "[" .. k .. "] = " .. tostring(v)
|
||||
print(printText)
|
||||
if type(v) == "table" then
|
||||
n = n + 1
|
||||
aura_env.printTable(v, n)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function uninspect()
|
||||
aura_env.inspecting = false
|
||||
end
|
||||
hooksecurefunc("ClearInspectPlayer", uninspect)
|
||||
|
||||
aura_env.classColor = function(class)
|
||||
if class == 6 then return "|cFFC41F3B" elseif
|
||||
class == 12 then return "|cFFA330C9" elseif
|
||||
class == 11 then return "|cFFFF7D0A" elseif
|
||||
class == 3 then return "|cFFABD473" elseif
|
||||
class == 8 then return "|cFF40C7EB" elseif
|
||||
class == 10 then return "|cFF00FF96" elseif
|
||||
class == 2 then return "|cFFF58CBA" elseif
|
||||
class == 5 then return "|cFFFFFFFF" elseif
|
||||
class == 4 then return "|cFFFFF569" elseif
|
||||
class == 7 then return "|cFF0070DE" elseif
|
||||
class == 9 then return "|cFF8787ED" elseif
|
||||
class == 1 then return "|cFFC79C6E" else
|
||||
return "|cFF000000" end
|
||||
end
|
||||
|
||||
aura_env.inspectPing = function()
|
||||
if aura_env.inspecting == false and aura_env.notifyInspect == false then
|
||||
if #aura_env.inspectQueue > 0 then
|
||||
if aura_env.insIndex >= #aura_env.inspectQueue then
|
||||
aura_env.insIndex = 1
|
||||
end
|
||||
for i = aura_env.insIndex, #aura_env.inspectQueue do
|
||||
if CheckInteractDistance(aura_env.inspectQueue[i], 2) == true then
|
||||
ClearInspectPlayer()
|
||||
NotifyInspect(aura_env.inspectQueue[i])
|
||||
aura_env.notifyInspect = aura_env.inspectQueue[i]
|
||||
if aura_env.ticker then aura_env.ticker:Cancel(); aura_env.ticker = nil end
|
||||
table.remove(aura_env.inspectQueue, i)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
for k,v in pairs(aura_env.data) do
|
||||
if v.neckilvl == 0 and v.inspectQueue == false then
|
||||
aura_env.inspectQueue[#aura_env.inspectQueue + 1] = k
|
||||
v.inspectQueue = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if not aura_env.ticker then
|
||||
aura_env.ticker = C_Timer.NewTicker(0.5, aura_env.inspectPing)
|
||||
end
|
||||
|
||||
local font, fontSize, fontFlags = aura_env.region.text:GetFont()
|
||||
local charWidth = fontSize * 0.6
|
||||
fontSize = fontSize * 0.65
|
||||
|
||||
aura_env.randomFrame = CreateFrame("frame")
|
||||
aura_env.randomFrame:ClearAllPoints()
|
||||
aura_env.randomFrame:SetPoint("CENTER", aura_env.region, "CENTER")
|
||||
|
||||
if not aura_env.randomFrame.text2 then
|
||||
aura_env.randomFrame.text2 = aura_env.randomFrame:CreateFontString()
|
||||
end
|
||||
aura_env.randomFrame.text2:SetFont(font, fontSize, fontFlags)
|
||||
aura_env.randomFrame.text2:SetPoint("CENTER", aura_env.region, "CENTER", charWidth * 8, 0)
|
||||
aura_env.randomFrame.text2:SetText("")
|
||||
aura_env.randomFrame.text2:SetJustifyV("center")
|
||||
aura_env.randomFrame.text2:SetJustifyH("center")
|
||||
aura_env.randomFrame.text2:Show()
|
||||
|
||||
if not aura_env.randomFrame.text3 then
|
||||
aura_env.randomFrame.text3 = aura_env.randomFrame:CreateFontString()
|
||||
end
|
||||
aura_env.randomFrame.text3:SetFont(font, fontSize, fontFlags)
|
||||
aura_env.randomFrame.text3:SetPoint("CENTER", aura_env.region, "CENTER", (charWidth * 8) + (charWidth * 3), 0)
|
||||
aura_env.randomFrame.text3:SetText("")
|
||||
aura_env.randomFrame.text3:SetJustifyV("center")
|
||||
aura_env.randomFrame.text3:SetJustifyH("center")
|
||||
aura_env.randomFrame.text3:Show()
|
||||
|
||||
if not aura_env.randomFrame.text4 then
|
||||
aura_env.randomFrame.text4 = aura_env.randomFrame:CreateFontString()
|
||||
end
|
||||
aura_env.randomFrame.text4:SetFont(font, fontSize, fontFlags)
|
||||
aura_env.randomFrame.text4:SetPoint("CENTER", aura_env.region, "CENTER", (charWidth * 8) + (charWidth * 3) + (charWidth * 3), 0)
|
||||
aura_env.randomFrame.text4:SetText("")
|
||||
aura_env.randomFrame.text4:SetJustifyV("center")
|
||||
aura_env.randomFrame.text4:SetJustifyH("center")
|
||||
aura_env.randomFrame.text4:Show()
|
Reference in New Issue
Block a user