290 lines
14 KiB
Lua
290 lines
14 KiB
Lua
--CLEU PLAYER_TARGET_CHANGED PLAYER_FOCUS_CHANGED
|
|
function(e, ...)
|
|
if aura_env.config.tsuenable == false then
|
|
local se = select(2, ...)
|
|
if se == "SPELL_AURA_APPLIED_DOSE" or e == "PLAYER_TARGET_CHANGED" then
|
|
aura_env.owndebuff = {["stacks"] = 0, ["damage"] = 0,}
|
|
aura_env.totaldebuff = {["stacks"] = 0, ["damage"] = 0,}
|
|
aura_env.damagepercentage = 0
|
|
local unit = "target"
|
|
if aura_env.config.tar == 2 then unit = "focus" elseif aura_env.config.tar == 3 then unit = "Boss1" end
|
|
local bossmax = UnitHealthMax(unit)
|
|
if aura_env.config.pdmg == true then
|
|
for i = 1, 200 do
|
|
local name = UnitDebuff(unit, i)
|
|
if name == "Conductive Ink" then
|
|
local caster = select(7, UnitDebuff(unit, i))
|
|
local stacks = select(3, UnitDebuff(unit, i))
|
|
aura_env.totaldebuff.stacks = aura_env.totaldebuff.stacks + stacks
|
|
aura_env.myTooltip:SetUnitDebuff(unit, i)
|
|
local text = _G["MyAddOnTooltipTextLeft2"]:GetText()
|
|
if text:match("Falling below %d*%% health will cause") then
|
|
local damage = text:match("inflict (%d+%,?%d*)")
|
|
damage = damage:gsub("%,", "")
|
|
damage = damage:gsub(" ", "")
|
|
damage = tonumber(damage)
|
|
aura_env.totaldebuff.damage = aura_env.totaldebuff.damage + damage
|
|
if caster == "player" then aura_env.owndebuff.damage = damage; aura_env.owndebuff.stacks = stacks end
|
|
end
|
|
elseif not name then break end
|
|
end
|
|
else
|
|
for i = 1, 200 do
|
|
local name = UnitDebuff(unit, i)
|
|
if name == "Conductive Ink" then
|
|
aura_env.totaldebuff.stacks = aura_env.totaldebuff.stacks + select(3, UnitDebuff(unit, i))
|
|
aura_env.myTooltip:SetUnitDebuff(unit, i)
|
|
local text = _G["MyAddOnTooltipTextLeft2"]:GetText()
|
|
if text:match("Falling below %d*%% health will cause") then
|
|
aura_env.totaldebuff.damage = text:match("inflict (%d+%,?%d*)")
|
|
aura_env.totaldebuff.damage = aura_env.totaldebuff.damage:gsub("%,", "")
|
|
aura_env.totaldebuff.damage = aura_env.totaldebuff.damage:gsub(" ", "")
|
|
aura_env.totaldebuff.damage = tonumber(aura_env.totaldebuff.damage)
|
|
end
|
|
break
|
|
elseif not name then break end
|
|
end
|
|
end
|
|
aura_env.damagepercentage = aura_env.round(((aura_env.totaldebuff.damage / bossmax) * 100), 2)
|
|
return true
|
|
end
|
|
end
|
|
end
|
|
|
|
--TSU
|
|
--CLEU PLAYER_TARGET_CHANGED
|
|
function(allstates, e, ...)
|
|
if aura_env.config.tsuenable == true then
|
|
local unit = "target"
|
|
if aura_env.config.tar == 2 then unit = "focus" elseif aura_env.config.tar == 3 then unit = "Boss1" end
|
|
if UnitExists(unit) then
|
|
local hp, maxhp = UnitHealth(unit), UnitHealthMax(unit)
|
|
local pp = hp / maxhp
|
|
if pp > 0.3 then
|
|
local totaldamage, totalstacks = 0, 0
|
|
local maxdamage, maxstacks = {["d"] = 0, ["c"] = ""}, {["s"] = 0, ["c"] = ""}
|
|
local datatable = {}
|
|
aura_env.damagepercentage = 0
|
|
local se = select(2, ...)
|
|
if se == "SPELL_AURA_APPLIED_DOSE" or e == "PLAYER_TARGET_CHANGED" or e == "PLAYER_FOCUS_CHANGED" then
|
|
for i = 1, #allstates do
|
|
allstates[i].sub30 = false
|
|
if i > 1 then
|
|
allstates[i] = {["show"] = false, ["changed"] = true}
|
|
end
|
|
end
|
|
for i = 1, 200 do
|
|
local name = UnitDebuff(unit, i)
|
|
if name == "Conductive Ink" then
|
|
local caster = select(7, UnitDebuff(unit, i))
|
|
local stacks = select(3, UnitDebuff(unit, i))
|
|
aura_env.totaldebuff.stacks = aura_env.totaldebuff.stacks + stacks
|
|
aura_env.myTooltip:SetUnitDebuff(unit, i)
|
|
local text = _G["MyAddOnTooltipTextLeft2"]:GetText()
|
|
if text:match("Falling below %d*%% health will cause") then
|
|
local damage = text:match("inflict (%d+%,?%d*)")
|
|
damage = damage:gsub("%,", "")
|
|
damage = damage:gsub(" ", "")
|
|
damage = tonumber(damage)
|
|
--local damage = i * 23412
|
|
datatable[caster] = {["damage"] = damage, ["stacks"] = stacks, ["name"] = UnitName(caster), ["class"] = select(3, UnitClass(caster))} --UnitName(caster) UnitClass(caster)
|
|
if damage > maxdamage.d then maxdamage.d = damage; maxdamage.c = caster; maxstacks.s = stacks; maxstacks.c = caster end
|
|
totaldamage = totaldamage + damage; totalstacks = totalstacks + stacks
|
|
end
|
|
elseif not name then break end
|
|
end
|
|
local allstatesindex = 2
|
|
for k,v in pairs(datatable) do
|
|
allstates[allstatesindex] =
|
|
{
|
|
show = true,
|
|
changed = true,
|
|
progressType = "static",
|
|
caster = v.name,
|
|
class = v.class,
|
|
stacks = v.stacks,
|
|
damage = v.damage,
|
|
}
|
|
if aura_env.config.sort == 1 then
|
|
allstates[allstatesindex].resort = true
|
|
allstates[allstatesindex].index = v.damage --/ totaldamage
|
|
allstates[allstatesindex].value = v.damage --/ totaldamage
|
|
allstates[allstatesindex].total = maxdamage.d
|
|
elseif aura_env.config.sort == 2 then
|
|
allstates[allstatesindex].resort = true
|
|
allstates[allstatesindex].index = v.stacks
|
|
allstates[allstatesindex].value = v.stacks
|
|
allstates[allstatesindex].total = totalstacks
|
|
end
|
|
allstatesindex = allstatesindex + 1
|
|
end
|
|
dmgper = aura_env.round(((totaldamage / maxhp) * 100), 2)
|
|
allstates[1] =
|
|
{
|
|
show = true,
|
|
changed = true,
|
|
progressType = "static",
|
|
caster = "Total",
|
|
stacks = totalstacks,
|
|
damage = totaldamage,
|
|
resort = true,
|
|
percent = dmgper,
|
|
index = maxdamage.d + 1,
|
|
value = maxdamage.d + 1,
|
|
total = maxdamage.d + 1,
|
|
}
|
|
if totalstacks == 0 then totalstacks = 1 end
|
|
if aura_env.config.sort == 2 then allstates[1].index = totalstacks + 1 end
|
|
end
|
|
return true
|
|
else
|
|
for i = 1, #allstates do
|
|
if allstates[i] then
|
|
allstates[i].show = true
|
|
allstates[i].changed = true
|
|
allstates[i].sub30 = true
|
|
end
|
|
end
|
|
allstates[1].percent = "<30"
|
|
allstates[1].class = 15
|
|
return true
|
|
end
|
|
else
|
|
for i = 1, #allstates do
|
|
if allstates[i].sub30 == false or not allstates[i].sub30 then
|
|
allstates[i] = {["show"] = false, ["changed"] = true}
|
|
end
|
|
end
|
|
return true
|
|
end
|
|
end
|
|
end
|
|
|
|
--CUSTOM TRIGGER
|
|
function(t)
|
|
if aura_env.config.tsuenable == false then return t[1] and t[2] elseif aura_env.config.tsuenable == true then return t[3] and t[2] end
|
|
end
|
|
|
|
--COLOR ANIMATION
|
|
function()
|
|
if aura_env.statee then
|
|
return aura_env.classColor(aura_env.statee.class)
|
|
end
|
|
end
|
|
|
|
--DISPLAY
|
|
function()
|
|
if aura_env.config.tsuenable == false then
|
|
if aura_env.config.pdmg == true then
|
|
if aura_env.config.sh == true then aura_env.owndebuff.damage = aura_env.shorten(aura_env.owndebuff.damage); aura_env.totaldebuff.damage = aura_env.shorten(aura_env.totaldebuff.damage) end
|
|
aura_env.region.text2:SetText(aura_env.owndebuff.stacks .. "\n" .. aura_env.owndebuff.damage .. "\n" .. aura_env.totaldebuff.stacks .. "\n" .. aura_env.totaldebuff.damage .. "\n" .. aura_env.damagepercentage .. "%")
|
|
if aura_env.config.stext == true then aura_env.region.text3:SetText("Player stacks\nPlayer damage\nTotal stacks\nTotal damage\nDamage in %") else aura_env.region.text3:SetText("") end
|
|
else
|
|
if aura_env.config.sh == true then aura_env.totaldebuff.damage = aura_env.shorten(aura_env.totaldebuff.damage) end
|
|
aura_env.region.text2:SetText(aura_env.totaldebuff.stacks .. "\n" .. aura_env.totaldebuff.damage .. "\n" .. aura_env.damagepercentage .. "%")
|
|
if aura_env.config.stext == true then aura_env.region.text3:SetText("Total stacks\nTotal damage\nDamage in %") else aura_env.region.text3:SetText("") end
|
|
end
|
|
else
|
|
if aura_env.statee.caster == "Total" then
|
|
return aura_env.shorten(aura_env.statee.damage) .. " - " .. aura_env.statee.stacks .. " - " .. aura_env.statee.percent .. "%"
|
|
else
|
|
return aura_env.shorten(aura_env.statee.damage) .. " - " .. aura_env.statee.stacks
|
|
end
|
|
end
|
|
end
|
|
|
|
--INIT
|
|
aura_env.myTooltip = CreateFrame("GameTooltip", "MyAddOnTooltip", UIParent, "GameTooltipTemplate")
|
|
aura_env.myTooltip:SetOwner(UIParent, "ANCHOR_NONE")
|
|
aura_env.owndebuff = {["stacks"] = 0, ["damage"] = 0,}
|
|
aura_env.totaldebuff = {["stacks"] = 0, ["damage"] = 0,}
|
|
|
|
if aura_env.config.tsuenable == false then
|
|
if not aura_env.region.text2 then
|
|
local text2 = aura_env.region:CreateFontString(nil, aura_env.region)
|
|
aura_env.region.text2 = text2
|
|
end
|
|
local font, size, flags = aura_env.region.text:GetFont()
|
|
aura_env.region.text2:SetFont(font, size, flags)
|
|
aura_env.region.text2:SetTextColor(aura_env.config.color[1], aura_env.config.color[2], aura_env.config.color[3], aura_env.config.color[4])
|
|
aura_env.region.text2:SetPoint("CENTER", aura_env.region, "CENTER", aura_env.config.x, 0)
|
|
aura_env.region.text2:SetText("")
|
|
aura_env.region.text2:Show()
|
|
|
|
if not aura_env.region.text3 then
|
|
local text3 = aura_env.region:CreateFontString(nil, aura_env.region)
|
|
aura_env.region.text3 = text3
|
|
end
|
|
local font, size, flags = aura_env.region.text:GetFont()
|
|
aura_env.region.text3:SetFont(font, size, flags)
|
|
aura_env.region.text3:SetTextColor(aura_env.config.color[1], aura_env.config.color[2], aura_env.config.color[3], aura_env.config.color[4])
|
|
aura_env.region.text3:SetPoint("CENTER", aura_env.region, "CENTER", - aura_env.config.x, 0)
|
|
aura_env.region.text3:SetText("")
|
|
aura_env.region.text3:Show()
|
|
aura_env.region.bar:Hide()
|
|
end
|
|
|
|
if aura_env.config.tsuenable == true and aura_env.region.text2 then aura_env.region.text2:Hide() end
|
|
if aura_env.config.tsuenable == true and aura_env.region.text3 then aura_env.region.text3:Hide() end
|
|
if aura_env.config.tsuenable == true and aura_env.region.bar then aura_env.region.bar:Show() end
|
|
|
|
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
|
|
end
|
|
aura_env.round = function(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
|
|
aura_env.classColor = function(class)
|
|
if class == 1 then return 0.78, 0.61, 0.43
|
|
elseif class == 2 then return 0.96, 0.55, 0.73
|
|
elseif class == 3 then return 0.67, 0.83, 0.45
|
|
elseif class == 4 then return 1, 0.96, 0.41, 1
|
|
elseif class == 5 then return 1, 1, 1
|
|
elseif class == 6 then return 0.77, 0.12, 0.23
|
|
elseif class == 7 then return 0, 0.44, 0.87
|
|
elseif class == 8 then return 0.25, 0.78, 0.92
|
|
elseif class == 9 then return 0.53, 0.53, 0.93
|
|
elseif class == 10 then return 0, 1, 0.59
|
|
elseif class == 11 then return 1, 0.49, 0.04
|
|
elseif class == 12 then return 0.64, 0.19, 0.79
|
|
elseif class == 15 then return 0, 1, 0
|
|
else return 1, 1, 1 end
|
|
end
|
|
--TESTING
|
|
--Conductive Ink 1500960 1 Magic 120 119774.845 player false false 302565 false false true false 1
|
|
aura_env.UnitDebuffC = function(unit, i)
|
|
if i == 1 then return "Conductive Ink", 1500960, 1, 2, 120, 119774.845, "Pinko"
|
|
elseif i == 1 then return "Conductive Ink", 1500960, 3, 4, 120, 119774.845, "Billy"
|
|
elseif i == 2 then return "Conductive Ink", 1500960, 7, 7, 120, 119774.845, "Mary"
|
|
elseif i == 3 then return "Conductive Ink", 1500960, 35, 11, 120, 119774.845, "Anna"
|
|
elseif i == 4 then return "Conductive Ink", 1500960, 8, 6, 120, 119774.845, "John"
|
|
elseif i == 5 then return "Conductive Ink", 1500960, 72, 2, 120, 119774.845, "Frank"
|
|
elseif i == 6 then return "Conductive Ink", 1500960, 25, 7, 120, 119774.845, "Emma"
|
|
elseif i == 7 then return "Conductive Ink", 1500960, 45, 8, 120, 119774.845, "Sophia"
|
|
elseif i == 8 then return "Conductive Ink", 1500960, 37, 5, 120, 119774.845, "Henry"
|
|
elseif i == 9 then return "Conductive Ink", 1500960, 4, 3, 120, 119774.845, "Ethan"
|
|
elseif i == 10 then return "Conductive Ink", 1500960, 1, 1, 120, 119774.845, "Michael"
|
|
end
|
|
end |