Compare commits

...

6 Commits

11 changed files with 882 additions and 3 deletions

2
Meta

Submodule Meta updated: 0954354d7a...72956add4a

View File

@@ -6,4 +6,7 @@ aura_env.cloneId does something too maybe
taken from asakawa :)
aura_env.region:SetDesaturated(true)
easy desaturate
easy desaturate
Get namepalte for unit, pretty cool
C_NamePlate.GetNamePlateForUnit(unit)

View File

@@ -0,0 +1 @@
!9MvBVTnos4)lgybsa2OANK27qXTFWjrzR76ABykV5U9WkBAjAB2kt6srLxAX6F73mKuYYoYVTn5GlAeP4mCMHpZmuZe2imiKKgso3RX78UiKmpKeJ)dMDQs(qi5dD736p62jOz7qYyPkMPUIg9LyLCri5Qe(3(gvfVCuGuMO5Wup2DYKuMoSt9qYtLEMkIMjv9KCHoKCTFNa)(587AzIubByNg4k7CU5)VW8)xItceKLYAAzatnqW1HxbCmsZLIuJ8RPkn8aSYjCbpDM9zoUs8j4zTIpDktLA3NGIjWhJzJZMmj4PfmqD9B372bGUQndPzk65WgSGLK0ko1Y30SXS7zcnbOI)yiz41njbdjbn7dmtqNZ2yD9umZ6i98BdC2mhStmAIEgOBOuswKqFcKguxfRenTv4JKjzZfKf0igk9efnMNLcMQ6gllFofnfLTeKyqWXjhA1JuwKuaYVtTesbdz8CkxC4RUW2EyRhOGMWNkwDEdsNrXqabyC6ZM6obHLMiPguhCupmkHMMgo2y3JWjNNbOR8Js7B3C2u(3yBojm9yhyTmiRHbK1WaYAyaz19ERHhSKjBarTwxMryIOjw7Vf3IZzFYpEkO2KVMrvSLJUnljz5O7MXbYikJoAXwXpbGdEe4xLTiNuck2DqiMeo4SMo48wmHp1AxMQ4XwY7FdAqmyay9GZ5kabqayBf6BbNcqnj9BEtRbeWOYNdGRoVnF3YDiVeSZCWpVZF81pC5x6WAElE4jJUh8qqKuN)r9lqSfUMaQAktVCKuSCuhaCdivnOLoTafV74Xaqg3LjkybGRfvtnYL1R)wCwRoqUUVVFh0VsdVO7c9kaGvcBjmcisRkQntmf58fVRoQWAlmVu4ex0asNMFYVx7Mb(gtrmVeBb8uBJvymgqqZucAYVNRMN)odGQiOGmtNWXtGUdcA3QdWUhOtLTadF9ZznN9B38qSXBChqjt8QyEk6qhWEeg8tGhq6mAS8H)tU9)SgBjIyjchorQaO3Wfd185m3iJYhLLQLZX1myrmcoZdPawvjgliYEIqUL)ilUYiLoEecyKy5q3GXLcAwSamc4qM4EpyOIbH6)LLJ((FvMSR2iU7EI2MjkjT5HmY3T1cg6MnpidC8ZYCkCEaOqsdBid6yWbA8NKXmm3WMHyHfK5sByEfG2VR5WcuZWRB3L4FdGVHzgANAqNwbdBEZnvnDF)p19334fnh03YrcebOpo)GE3yqKBjnW65uYnaNDge64)tI2YpojtyWgNymUP)8Yrgjf(lAUG)455D6YpUCK9hFIBbakaGb1QqqRTCKEgtSIM8Fa(fyGb(0ay8L1xokw(8LL)lrcrBTIHHMAI8qp1qPcz1wPfftmUG)J8uD6jipoDBI1M)UEya4TP8AobcvCsDpuwlSsaxUJr)sta8L6rIOcFdy6KAvASR5mJavmr8PBFVH3(8xU2K2bB9COsSbyNOazotiA93cjLK41iPAdM7G5xh06gZbdAOXboZ8hR6WWU4DFaSrCM)lsZFA2bJ0CiaL8mv50yWj1otBMU2rHxSS6GrnoHWUtisTW0GzmxJJhkVeRs1(liSezupCS3VY0fdUvAYawy83l3To6LSUFF)0K)RqXwPN)8HtDbIbF4iORieGnK0btN5UigclmLhb1luYPkwAkETfBai0YXJQDe8atW9bESZMPYoM9pAgvm1LU9ijnDM8HJHU)6hkYuskBFHJC5KEnIU4wVbvBiyn8DLbJCRD3o2Mf5vyjNqb1CFREZJS9y5kltBj4Nrg3rKrbpPYefBjnr5C)12Zja8smrO1HLPXNpzlr3fsDjHe(4mx6MnM6FvIPNv6T2p2XtpdUGVozVNmM7rydH4qsCWgTGYvPNSHL60DFfJJnd1pi27GYDC8jV2tYm9XLiBNGt3jf(vYoxzCJALAYavZEPD8spRVNJumDMs48jQ2h4iYjASqNu7NsRD67TFt0jf5zDB8P)90tRY0ZOgBy322odxa(ASAeMQlSUiS5D2ogj5GcrDqz69eLtc(JYS9hHBF)y7mo6R5Lx27LAoYRZ8sFnNx6R)S)RfDq3P8fyhFjUk1RXvSEfU61l1vY(BCvTJ6kC7Y98hoa0XD3PxRiohKEVZfDOFwUBWAP5(O5vHKOzSOVuupQk6nqL9qOQgsurNbWQf(ztTjUhBvrsITuF3ZcSlZunSNvqYv1v0vsrcwFX4kQo6LVnK8GufFNIUiK4Na(zHKjsut8FCb6s)a9PqsrrJBS9Q6)nPGH16IaIiQWmB1i5IPMsQF(fRkCVz0vU6istqd3M16hRNhwfrtj43s7aQQZbBPhbOkzRdFJ3vPPsuyQS1N3wn3)DE1CBSEz(1MQ((S6qRGJNzA9I03)M3Gvv2JlFtrvLFtJT1iNsTuHWOPy11ZRk(27ddUWGk70Zle7w1kOxggQRSLaMEu81jQUKfK7N7F6AnuOhvHyJRq2ohXcKgE19QVRAO7AaZq4Bnyq8PK4WoyNfk6zzJ)jm6ZzPA(eax32)2GdQRif1xyx7n4VeXl8t2BJswVJgfDdQOLQN92Cy4b0(u0HlVlnMEgYfwHZb24tfW3l5m9MAA6RusvQT0(L6kMXKyoTUhy9LNJCp8)b

View File

@@ -0,0 +1 @@
aura_env.stored = {}

View File

@@ -0,0 +1,78 @@
-- WA_NAMEPLATE_CLOSED NAME_PLATE_UNIT_ADDED NAME_PLATE_UNIT_REMOVED NAME_PLATE_AURA_NAMES FRAME_UPDATE
function(states, event, unit, ...)
if event == "WA_NAMEPLATE_CLOSED" then
for i = 1, 40 do
local unit = "nameplate" .. i
if UnitExists(unit) then
C_Timer.After(0.1, function() WeakAuras.ScanEvents("NAME_PLATE_AURA_NAMES", unit) end)
end
end
end
if event == "NAME_PLATE_UNIT_ADDED" and unit or event == "NAME_PLATE_AURA_NAMES" and unit then
local GUID = UnitGUID(unit)
if GUID then
aura_env.stored[GUID] = unit
local unitTarget = unit .. "-target"
if UnitExists(unitTarget) then
local targetname = UnitName(unitTarget)
local nameplate = C_NamePlate.GetNamePlateForUnit(unit)
states[GUID] = {
name = targetname,
GUID = GUID,
unit = unit,
frame = nameplate,
progressType = "static",
autoHide = true,
changed = true,
show = true,
}
end
end
elseif event == "NAME_PLATE_UNIT_REMOVED" and unit then
local GUID = UnitGUID(unit)
local state = states[GUID]
if state then
state.show = false
state.changed = true
end
if aura_env.stored[GUID] then aura_env.stored[GUID] = nil end
end
if event == "FRAME_UPDATE" then
local theTime = GetTime()
if not aura_env.last or aura_env.last < theTime - aura_env.config.throttle then
for GUID, unit in pairs(aura_env.stored) do
if GUID then
local state = states[GUID]
local target = unit .. "-target"
if UnitExists(target) then
if aura_env.config.self and UnitIsUnit("player", target) then return true end
local name = ("%s"):format(UnitName(target))
if UnitIsPlayer(target) then name = ("%s"):format(WA_ClassColorName(target)) end
if state then
state.name = name
state.changed = true
else
states[GUID] = {
name = name,
GUID = GUID,
unit = unit,
frame = C_NamePlate.GetNamePlateForUnit(unit),
progressType = "static",
autoHide = true,
changed = true,
show = true,
}
end
elseif state then
state.show = false
state.changed = true
end
end
end
end
end
return true
end

View File

@@ -0,0 +1,6 @@
function()
if aura_env.state then
local hit = ("%-8s %-8s"):format(aura_env.state.amount, aura_env.state.percent)
return hit, aura_env.state.name
end
end

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,130 @@
aura_env.envTypes = {
["Drowning"] = 132322,
["Falling"] = 450905,
["Fatigue"] = 237555,
["Fire"] = 135805,
["Lava"] = 237583,
["Slime"] = 132108,
}
aura_env.spellSchools = {
--single schools
[1] = { "Physical", 1 },
[2] = { "Holy", 2 },
[4] = { "Fire", 4 },
[8] = { "Nature", 8 },
[16] = { "Frost", 16 },
[32] = { "Shadow", 32 },
[64] = { "Arcane", 64 },
--double schools
[3] = { "Holystrike (Holy+Physical)", 0 },
[5] = { "Flamestrike (Fire+Physical)", 0 },
[6] = { "Radiant (Fire+Holy)", 0 },
[9] = { "Stormstrike (Nature+Physical)", 0 },
[10] = { "Holystorm (Nature+Holy)", 0 },
[12] = { "Firestorm (Nature+Fire)", 0 },
[17] = { "Froststrike (Frost+Physical)", 0 },
[18] = { "Holyfrost (Frost+Holy)", 0 },
[20] = { "Frostfire (Frost+Fire)", 0 },
[24] = { "Froststorm (Frost+Nature)", 0 },
[33] = { "Shadowstrike (Shadow+Physical)", 0 },
[34] = { "Twilight (Shadow+Holy)", 0 },
[36] = { "Shadowflame (Shadow+Fire)", 0 },
[40] = { "Plague (Shadow+Nature)", 0 },
[48] = { "Shadowfrost (Shadow+Frost)", 0 },
[65] = { "Spellstrike (Arcane+Physical)", 0 },
[66] = { "Divine (Arcane+Holy)", 0 },
[68] = { "Spellfire (Arcane+Fire)", 0 },
[72] = { "Astral (Arcane+Nature)", 0 },
[80] = { "Spellfrost (Arcane+Frost)", 0 },
[96] = { "Spellshadow (Arcane+Shadow)", 0 },
--triple and multi schools
[28] = { "Elemental (Frost+Nature+Fire)", 0 },
[124] = { "Chromatic (Arcane+Shadow+Frost+Nature+Fire)", 0 },
[126] = { "Magic (Arcane+Shadow+Frost+Nature+Fire+Holy)", 0 },
[127] = { "Chaos (Arcane+Shadow+Frost+Nature+Fire+Holy+Physical)", 0 },
}
aura_env.schoolColors = {
[0] = "ffffff", --No school
[1] = "ffff00", --Physical
[2] = "ffe680", --Holy
[4] = "ff8000", --Fire
[8] = "50ff61", --Nature
[16] = "80ffff", --Frost
[32] = "8080ff", --Shadow
[64] = "ff80ff", --Arcane
[99] = "00ff00", --HEAL
}
aura_env.maxHealth = UnitHealthMax("player")
aura_env.format = function(value)
if not value or type(value) ~= "number" then return end
if aura_env.config.format == 1 then
if value > 999999999 then
value = string.format("%.2fB", value / 1000000000)
elseif value > 999999 then
value = string.format("%.2fM", value / 1000000)
elseif value > 99999 then
value = string.format("%.fK", value / 1000)
elseif value > 999 then
value = string.format("%.1fK", value / 1000)
elseif value <= 0 then
value = 0
end
elseif aura_env.config.format == 2 then
if value > 999999999 then
value = ("%d,%03d,%03d,%03d"):format(
floor(value / 1000000000),
floor(value / 1000000) % 1000,
floor(value / 1000) % 1000,
value % 1000
)
elseif value > 999999 then
value = ("%d,%03d,%03d"):format(floor(value / 1000000), floor(value / 1000) % 1000, value % 1000)
elseif value > 999 then
value = ("%d,%03d"):format(floor(value / 1000), value % 1000)
elseif value <= 0 then
value = 0
end
end
return value
end
local aura_env = aura_env
local sort1 = function(a, b) return a.state.index > b.state.index end
local sort2 = function(a, b) return a.state.index < b.state.index end
aura_env.sortAndOffset = function(options)
local spacing = aura_env.config.spacing or 2
local count = options and 1 or 0
local t = {}
for k, v in pairs(WeakAuras.clones[aura_env.id]) do
if v.state and v.state.show and v.state.index then table.insert(t, v) end
end
if aura_env.config.sorting == 1 then
table.sort(t, sort1)
elseif aura_env.config.sorting == 2 then
table.sort(t, sort2)
end
for i, region in pairs(t) do
if region.toShow then
local xOffset = 0
local yOffset = 0
if aura_env.config.side == 1 then --TOP
yOffset = 0 + (region.height + spacing) * count
elseif aura_env.config.side == 2 then --BOTTOM
yOffset = 0 - (region.height + spacing) * count
end
region:SetAnchor("CENTER", WeakAuras.regions[aura_env.id].region, "CENTER")
region:SetOffset(xOffset, yOffset)
count = count + 1
end
end
end

View File

@@ -0,0 +1,568 @@
-- COMBAT_LOG_EVENT_UNFILTERED AURA_INIT
function(
states,
event,
tstamp,
message,
hideCaster,
srcGUID,
srcName,
srcFlags,
srcRFlags,
destGUID,
destName,
destFlags,
destRFlags,
...
)
if event == "OPTIONS" then
local amount1 = Round(UnitHealth("player") / 100 * 25)
local amount2 = Round(UnitHealth("player") / 100 * 15)
states[""] = {
name = "PARRY",
icon = 644389,
amount = "",
percent = "",
school = "unknown",
index = 3,
value = UnitHealthMax("player"),
total = UnitHealthMax("player"),
progressType = "static",
autoHide = true,
changed = true,
show = true,
}
states[1] = {
name = "Evil Fire Spell",
icon = 644389,
amount = aura_env.format(amount1),
percent = "[25%]",
schoolIndex = 4,
index = 2,
value = UnitHealth("player") / 100 * 50,
total = UnitHealthMax("player"),
additionalProgress = { [1] = { direction = "forward", width = amount1 } },
progressType = "static",
autoHide = true,
changed = true,
show = true,
}
states[2] = {
name = "Evil Shadow Spell",
icon = 644389,
amount = aura_env.format(amount2),
percent = "[15%]",
schoolIndex = 32,
index = 1,
value = UnitHealth("player") / 100 * 35,
total = UnitHealthMax("player"),
additionalProgress = { [1] = { direction = "forward", width = amount2 } },
progressType = "static",
autoHide = true,
changed = true,
show = true,
}
states[3] = {
name = "Healing",
icon = 644389,
amount = aura_env.format(amount2),
percent = "[15%]",
schoolIndex = 99,
index = 1,
value = UnitHealth("player") / 100 * 35,
total = UnitHealthMax("player"),
additionalProgress = { [1] = { direction = "forward", width = amount2 } },
progressType = "static",
autoHide = true,
changed = true,
show = true,
}
local aura_env = aura_env
C_Timer.After(0.1, function() aura_env.sortAndOffset(true) end)
return true
end
if event == "COMBAT_LOG_EVENT_UNFILTERED" and destGUID == WeakAuras.myGUID and ... then
local c = aura_env.config
if message == "SWING_DAMAGE" and c.swing then
local amount, overkill, school, resisted, blocked, absorbed, critical, glancing, crushing = ...
if amount then
local healthCurrent, healthMax = UnitHealth("player"), UnitHealthMax("player")
local threshold = amount * 100 / healthMax
if threshold >= c.threshold then
local schools = aura_env.spellSchools
local SC, SCI = 0, 0
if schools[school] then
SC, SCI = schools[school][1], schools[school][2]
end
local healthPercentLost = string.format("%.1f%%", threshold)
--formatted health
local healthAfterHit = overkill > 0 and 0 or healthCurrent - amount
--formatted amount
local color = aura_env.schoolColors[school] or "ffffff"
local prefix = critical and "|cFFFFD100CRIT:|r"
or glancing and "|cFFFFD100GLANCE:|r"
or crushing and "|cFFFFD100CRUSH:|r"
or "|cFFFFD100HIT:|r"
local Famount = ("%s |cFF%s%s|r|n"):format(prefix, color, aura_env.format(amount))
--formatted absorb
local Fabsorbed = absorbed
and ("|cFFFFD100ABSORBED:|r |cFFFFFFFF%s|r|n"):format(aura_env.format(absorbed))
or ""
--formatted block
local Fblocked = blocked
and ("|cFFFFD100BLOCKED:|r |cFFFFFFFF%s|r|n"):format(aura_env.format(blocked))
or ""
--formatted resist
local Fresisted = resisted
and ("|cFFFFD100RESISTED:|r |cFFFFFFFF%s|r|n"):format(aura_env.format(resisted))
or ""
--formatted overkill
local Foverkill = overkill > 0
and ("|cFFFFD100OVERKILL:|r |cFFFFFFFF%s|r"):format(aura_env.format(overkill))
or ""
local Ftime = ('|cFFFFD100"%s"|r'):format(date("%H:%M:%S"))
local Fname = srcName and ("|cFFFFFFFF%s|r"):format(srcName) or "|cFFbbbbbbUNKNOWN|r"
local Finfo = ("|cFFFFFFFFMelee hit|r [%s]"):format(SC == 0 and "unknown" or SC)
local Fdamage = ("|cFF00FF00%s|r > |cFF00FF00%s|r (%s)"):format(
aura_env.format(healthCurrent),
aura_env.format(healthAfterHit),
healthPercentLost
)
local Fdetails = ("%s%s%s%s%s"):format(Famount, Fabsorbed, Fblocked, Fresisted, Foverkill)
local tooltip = ("%s %s|n|n%s|n%s|n|n%s"):format(Ftime, Fname, Finfo, Fdamage, Fdetails)
local new = {
name = "",
icon = 135274,
spellid = 0,
amount = aura_env.format(amount),
percent = ("[%s]"):format(healthPercentLost),
school = SC,
schoolIndex = SCI,
index = 0,
value = healthCurrent or 100,
total = healthMax or 100,
death = overkill > 0,
tooltip = tooltip,
duration = c.duration,
expirationTime = GetTime() + c.duration,
additionalProgress = { [1] = { direction = "backward", width = amount } },
progressType = "static",
autoHide = true,
show = true,
changed = true,
}
tinsert(states, new)
for k, v in pairs(states) do
v.index = v.index + 1
v.changed = true
if v.index > c.limit then --clone limit
v.show = false
end
end
return true
end
end
elseif message == "SWING_MISSED" and c.missType then
local missType, isOffHand, amount = ...
if amount and amount >= c.missThreshold or not amount then
local healthCurrent, healthMax = UnitHealth("player"), UnitHealthMax("player")
local Famount = amount and ("|cFFFFD100HIT:|r |cFFFFFFFF%s|r"):format(aura_env.format(amount)) or ""
local Ftime = ('|cFFFFD100"%s"|r'):format(date("%H:%M:%S"))
local Fname = srcName and ("|cFFFFFFFF%s|r"):format(srcName) or "|cFFbbbbbbUNKNOWN|r"
local tooltip = ("%s %s|n|n|cFFFFFFFFMelee hit|r |cFFFF0000%s|r|n%s"):format(
Ftime,
Fname,
missType,
Famount
)
local new = {
name = missType,
icon = 135274,
spellid = 0,
amount = amount and aura_env.format(amount) or "",
percent = "",
school = "unknown",
schoolIndex = 0,
index = 0,
value = healthCurrent or 100,
total = healthMax or 100,
tooltip = tooltip,
duration = c.duration,
expirationTime = GetTime() + c.duration,
additionalProgress = { [1] = {} },
progressType = "static",
autoHide = true,
show = true,
changed = true,
}
tinsert(states, new)
for k, v in pairs(states) do
v.index = v.index + 1
v.changed = true
if v.index > c.limit then --clone limit
v.show = false
end
end
return true
end
elseif message == "ENVIRONMENTAL_DAMAGE" and c.env then --enviromental
local envType, amount, overkill, school, resisted, blocked, absorbed, critical, glancing, crushing = ...
if amount then
local healthCurrent, healthMax = UnitHealth("player"), UnitHealthMax("player")
local threshold = amount * 100 / healthMax
if threshold >= c.threshold then
local schools = aura_env.spellSchools
local SC, SCI = 0, 0
if schools[school] then
SC, SCI = schools[school][1], schools[school][2]
end
local healthPercentLost = string.format("%.1f%%", threshold)
--formatted health
local healthAfterHit = overkill > 0 and 0 or healthCurrent - amount
--formatted amount
local color = aura_env.schoolColors[school] or "ffffff"
local prefix = critical and "|cFFFFD100CRIT:|r"
or glancing and "|cFFFFD100GLANCE:|r"
or crushing and "|cFFFFD100CRUSH:|r"
or "|cFFFFD100HIT:|r"
local Famount = ("%s |cFF%s%s|r|n"):format(prefix, color, aura_env.format(amount))
--formatted absorb
local Fabsorbed = absorbed
and ("|cFFFFD100ABSORBED:|r |cFFFFFFFF%s|r|n"):format(aura_env.format(absorbed))
or ""
--formatted block
local Fblocked = blocked
and ("|cFFFFD100BLOCKED:|r |cFFFFFFFF%s|r|n"):format(aura_env.format(blocked))
or ""
--formatted resist
local Fresisted = resisted
and ("|cFFFFD100RESISTED:|r |cFFFFFFFF%s|r|n"):format(aura_env.format(resisted))
or ""
--formatted overkill
local Foverkill = overkill > 0
and ("|cFFFFD100OVERKILL:|r |cFFFFFFFF%s|r"):format(aura_env.format(overkill))
or ""
local Ftime = ('|cFFFFD100"%s"|r'):format(date("%H:%M:%S"))
local Fname = srcName and ("|cFFFFFFFF%s|r"):format(srcName) or "|cFFbbbbbbUNKNOWN|r"
local Finfo = ("|cFFFFFFFFEnvironmental|r [%s]"):format(SC == 0 and "unknown" or SC)
local Fdamage = ("|cFF00FF00%s|r > |cFF00FF00%s|r (%s)"):format(
aura_env.format(healthCurrent),
aura_env.format(healthAfterHit),
healthPercentLost
)
local Fdetails = ("%s%s%s%s%s"):format(Famount, Fabsorbed, Fblocked, Fresisted, Foverkill)
local tooltip = ("%s %s|n|n%s|n%s|n|n%s"):format(Ftime, Fname, Finfo, Fdamage, Fdetails)
local eTypes = aura_env.envTypes
local new = {
name = envType,
icon = eTypes[envType] or 132996,
spellid = 0,
amount = aura_env.format(amount),
percent = ("[%s]"):format(healthPercentLost),
school = SC,
schoolIndex = SCI,
index = 0,
value = healthCurrent or 100,
total = healthMax or 100,
death = overkill > 0,
tooltip = tooltip,
duration = c.duration,
expirationTime = GetTime() + c.duration,
additionalProgress = { [1] = { direction = "forward", width = amount } },
progressType = "static",
autoHide = true,
show = true,
changed = true,
}
tinsert(states, new)
for k, v in pairs(states) do
v.index = v.index + 1
v.changed = true
if v.index > c.limit then --clone limit
v.show = false
end
end
return true
end
end
elseif message == "ENVIRONMENTAL_MISSED" and c.missType then
local envType, missType, isOffHand, amount = ...
if amount and amount >= c.missThreshold or not amount then
local healthCurrent, healthMax = UnitHealth("player"), UnitHealthMax("player")
local Famount = amount and ("|cFFFFD100HIT:|r |cFFFFFFFF%s|r"):format(aura_env.format(amount)) or ""
local Ftime = ('|cFFFFD100"%s"|r'):format(date("%H:%M:%S"))
local Fname = envType and ("|cFFFFFFFF%s|r"):format(envType) or "|cFFbbbbbbUNKNOWN|r"
local tooltip = ("%s %s|n|n|cFFFFFFFFEnvironmental|r |cFFFF0000%s|r|n%s"):format(
Ftime,
Fname,
missType,
Famount
)
local eTypes = aura_env.envTypes
local new = {
name = missType,
icon = eTypes[envType] or 132996,
spellid = 0,
amount = amount and aura_env.format(amount) or "",
percent = "",
school = "unknown",
schoolIndex = 0,
index = 0,
value = healthCurrent or 100,
total = healthMax or 100,
tooltip = tooltip,
duration = c.duration,
expirationTime = GetTime() + c.duration,
additionalProgress = { [1] = {} },
progressType = "static",
autoHide = true,
show = true,
changed = true,
}
tinsert(states, new)
for k, v in pairs(states) do
v.index = v.index + 1
v.changed = true
if v.index > c.limit then --clone limit
v.show = false
end
end
return true
end
elseif string.find(message, "_DAMAGE") and c.other then
--SPELL_DAMAGE SPELL_PERIODIC_DAMAGE RANGE_DAMAGE
local spellid, spellName, spellSchool, amount, overkill, school, resisted, blocked, absorbed, critical, glancing, crushing =
...
if (c.stagger and spellid ~= 124255 or not c.stagger) and amount then
local healthCurrent, healthMax = UnitHealth("player"), UnitHealthMax("player")
local threshold = amount * 100 / healthMax
if threshold >= c.threshold then
local schools = aura_env.spellSchools
local SC, SCI = 0, 0
if schools[school] then
SC, SCI = schools[school][1], schools[school][2]
end
local healthCurrent, healthMax = UnitHealth("player"), UnitHealthMax("player")
local healthPercentLost = string.format("%.1f%%", threshold)
--formatted health
local healthAfterHit = overkill > 0 and 0 or healthCurrent - amount
--formatted amount
local color = aura_env.schoolColors[school] or "ffffff"
local prefix = critical and "|cFFFFD100CRIT:|r"
or glancing and "|cFFFFD100GLANCE:|r"
or crushing and "|cFFFFD100CRUSH:|r"
or "|cFFFFD100HIT:|r"
local Famount = ("%s |cFF%s%s|r|n"):format(prefix, color, aura_env.format(amount))
--formatted absorb
local Fabsorbed = absorbed
and ("|cFFFFD100ABSORBED:|r |cFFFFFFFF%s|r|n"):format(aura_env.format(absorbed))
or ""
--formatted block
local Fblocked = blocked
and ("|cFFFFD100BLOCKED:|r |cFFFFFFFF%s|r|n"):format(aura_env.format(blocked))
or ""
--formatted resist
local Fresisted = resisted
and ("|cFFFFD100RESISTED:|r |cFFFFFFFF%s|r|n"):format(aura_env.format(resisted))
or ""
--formatted overkill
local Foverkill = overkill > 0
and ("|cFFFFD100OVERKILL:|r |cFFFFFFFF%s|r"):format(aura_env.format(overkill))
or ""
local Ftime = ('|cFFFFD100"%s"|r'):format(date("%H:%M:%S"))
local Fname = srcName and ("|cFFFFFFFF%s|r"):format(srcName) or "|cFFbbbbbbUNKNOWN|r"
local Finfo = ("|cFFFFFFFF%s|r [|cFF%s%s|r]"):format(
spellName or "unknown",
color,
SC == 0 and "unknown" or SC
)
local Fdamage = ("|cFF00FF00%s|r > |cFF00FF00%s|r (%s)"):format(
aura_env.format(healthCurrent),
aura_env.format(healthAfterHit),
healthPercentLost
)
local Fdetails = ("%s%s%s%s%s"):format(Famount, Fabsorbed, Fblocked, Fresisted, Foverkill)
local tooltip = ("%s %s|n|n%s|nspellID: |cFF00FFFF%s|r|n|n%s|n|n%s"):format(
Ftime,
Fname,
Finfo,
spellid or "",
Fdamage,
Fdetails
)
local new = {
name = spellName,
icon = GetSpellTexture(spellid),
spellid = spellid,
amount = aura_env.format(amount),
percent = ("[%s]"):format(healthPercentLost),
school = SC,
schoolIndex = SCI,
index = 0,
value = healthCurrent or 100,
total = healthMax or 100,
death = overkill > 0,
tooltip = tooltip,
duration = c.duration,
expirationTime = GetTime() + c.duration,
additionalProgress = { [1] = { direction = "forward", width = amount } },
progressType = "static",
autoHide = true,
show = true,
changed = true,
}
tinsert(states, new)
for k, v in pairs(states) do
v.index = v.index + 1
v.changed = true
if v.index > c.limit then --clone limit
v.show = false
end
end
return true
end
end
elseif string.find(message, "_HEAL") and c.other then
local spellid, spellName, spellSchool, amount, overkill, school, resisted, blocked, absorbed, critical, glancing, crushing =
...
if c.healing and amount then
local healthCurrent, healthMax = UnitHealth("player"), UnitHealthMax("player")
local threshold = amount * 100 / healthMax
if threshold >= c.hthreshold then
local SC, SCI = 0, 99
local healthCurrent, healthMax = UnitHealth("player"), UnitHealthMax("player")
local healthPercentLost = string.format("%.1f%%", threshold)
local healthAfterHit = min(healthMax, healthCurrent + amount)
local color = aura_env.schoolColors[school] or "ffffff"
local prefix = critical and "|cFFFFD100CRIT:|r" or "|cFFFFD100HIT:|r"
local Famount = ("%s |cFF%s%s|r|n"):format(prefix, color, aura_env.format(amount))
local Ftime = ('|cFFFFD100"%s"|r'):format(date("%H:%M:%S"))
local Fname = srcName and ("|cFFFFFFFF%s|r"):format(srcName) or "|cFFbbbbbbUNKNOWN|r"
local Finfo = ("|cFFFFFFFF%s|r [|cFF%s%s|r]"):format(
spellName or "unknown",
color,
SC == 0 and "" or SC
)
local Fdamage = ("|cFF00FF00%s|r > |cFF00FF00%s|r (%s)"):format(
aura_env.format(healthCurrent),
aura_env.format(healthAfterHit),
healthPercentLost
)
local Fdetails = ("%s"):format(Famount)
local tooltip = ("%s %s|n|n%s|nspellID: |cFF00FFFF%s|r|n|n%s|n|n%s"):format(
Ftime,
Fname,
Finfo,
spellid or "",
Fdamage,
Fdetails
)
local new = {
name = spellName,
icon = GetSpellTexture(spellid),
spellid = spellid,
amount = aura_env.format(amount),
percent = ("[%s]"):format(healthPercentLost),
school = SC,
schoolIndex = SCI,
index = 0,
value = healthCurrent or 100,
total = healthMax or 100,
death = overkill > 0,
tooltip = tooltip,
duration = c.duration,
expirationTime = GetTime() + c.duration,
additionalProgress = { [1] = { direction = "forward", width = amount } },
progressType = "static",
autoHide = true,
show = true,
changed = true,
}
tinsert(states, new)
for k, v in pairs(states) do
v.index = v.index + 1
v.changed = true
if v.index > c.limit then --clone limit
v.show = false
end
end
return true
end
end
elseif string.find(message, "_MISSED") and c.missType then
--SPELL_MISSED SPELL_PERIODIC_MISSED RANGE_MISSED
local spellid, spellName, school, missType, isOffHand, amount = ...
if c.stagger and spellid ~= 124255 or not c.stagger then
if amount and amount >= c.missThreshold or not amount then
local healthCurrent, healthMax = UnitHealth("player"), UnitHealthMax("player")
local Famount = amount and ("|cFFFFD100HIT:|r |cFFFFFFFF%s|r"):format(aura_env.format(amount)) or ""
local Ftime = ('|cFFFFD100"%s"|r'):format(date("%H:%M:%S"))
local Fname = srcName and ("|cFFFFFFFF%s|r"):format(srcName) or "|cFFbbbbbbUNKNOWN|r"
local tooltip = ("%s %s|n|n|cFFFFFFFF%s|r |cFFFF0000%s|r|nspellID: |cFF00FFFF%s|r|n%s"):format(
Ftime,
Fname,
spellName,
missType,
spellid,
Famount
)
local new = {
name = missType,
icon = GetSpellTexture(spellid),
spellid = spellid,
amount = amount and aura_env.format(amount) or "",
percent = "",
school = "unknown",
schoolIndex = 0,
index = 0,
value = healthCurrent or 100,
total = healthMax or 100,
tooltip = tooltip,
duration = c.duration,
expirationTime = GetTime() + c.duration,
additionalProgress = { [1] = {} },
progressType = "static",
autoHide = true,
show = true,
changed = true,
}
tinsert(states, new)
for k, v in pairs(states) do
v.index = v.index + 1
v.changed = true
if v.index > c.limit then --clone limit
v.show = false
end
end
return true
end
end
end
end
end

View File

@@ -0,0 +1,15 @@
{
school = {
display = "Damage School name",
type = "string",
},
schoolIndex = {
display = "Damage School index",
type = "number",
},
additionalProgress = 1,
death = {
display = "Death",
type = "bool",
},
}

77
scratch.lua Normal file
View File

@@ -0,0 +1,77 @@
function(states, event, unit, ...)
if event == "WA_NAMEPLATE_CLOSED" then
for i = 1, 40 do
local unit = "nameplate" .. i
if UnitExists(unit) and UnitCanAttack("player", unit) then
C_Timer.After(0.1, function() WeakAuras.ScanEvents("NAME_PLATE_AURA_NAMES", unit) end)
end
end
end
if event == "NAME_PLATE_UNIT_ADDED" and unit or event == "NAME_PLATE_AURA_NAMES" and unit then
local GUID = UnitGUID(unit)
if GUID then
aura_env.stored[GUID] = unit
local target = unit .. "-target"
if UnitExists(target) then
local name = ("[%s]"):format(UnitName(target))
if UnitIsPlayer(target) then name = ("[%s]"):format(target) end
states[GUID] = {
name = name,
GUID = GUID,
unit = unit,
frame = C_NamePlate.GetNamePlateForUnit(unit),
progressType = "static",
autoHide = true,
changed = true,
show = true,
}
end
end
elseif event == "NAME_PLATE_UNIT_REMOVED" and unit then
local GUID = UnitGUID(unit)
local state = states[GUID]
if state then
state.show = false
state.changed = true
end
if aura_env.stored[GUID] then aura_env.stored[GUID] = nil end
end
if event == "FRAME_UPDATE" then
local theTime = GetTime()
if not aura_env.last or aura_env.last < theTime - aura_env.config.throttle then
for GUID, unit in pairs(aura_env.stored) do
if GUID then
local state = states[GUID]
local target = unit .. "-target"
if UnitExists(target) then
if aura_env.config.self and UnitIsUnit("player", target) then return true end
local name = ("%s"):format(UnitName(target))
if UnitIsPlayer(target) then name = ("%s"):format(WA_ClassColorName(target)) end
if state then
state.name = name
state.changed = true
else
states[GUID] = {
name = name,
GUID = GUID,
unit = unit,
frame = C_NamePlate.GetNamePlateForUnit(unit),
progressType = "static",
autoHide = true,
changed = true,
show = true,
}
end
elseif state then
state.show = false
state.changed = true
end
end
end
end
end
return true
end