84 lines
2.6 KiB
Lua
84 lines
2.6 KiB
Lua
--COMBAT_LOG_EVENT_UNFILTERED UNIT_STATS PLAYER_TARGET_CHANGED
|
|
function(e, ...)
|
|
local function updateStats()
|
|
aura_env.output = "BUFFS "
|
|
local noBuffs = 0
|
|
local hitPercent = 0
|
|
local critPercent = 0
|
|
local attackPower = 0
|
|
local effArmor = 0
|
|
local armorPercent = 0
|
|
|
|
for i = 1, 40 do
|
|
if UnitBuff("player", i) then
|
|
noBuffs = noBuffs + 1
|
|
end
|
|
end
|
|
hitPercent = GetCombatRatingBonus(6) + GetHitModifier()
|
|
critPercent = GetCritChance()
|
|
local base, pos, neg = UnitAttackPower("player")
|
|
attackPower = base + pos - neg
|
|
effArmor = select(2, UnitArmor("player"))
|
|
if UnitExists("target") then
|
|
local tlevel = UnitLevel("target")
|
|
if tlevel < 60 then
|
|
armorPercent = (effArmor / ((85 * tlevel) + effArmor + 400)) * 100
|
|
elseif tlevel >= 60 then
|
|
armorPercent = (effArmor / ((467.5 * tlevel) + effArmor - 22167.5)) * 100
|
|
end
|
|
end
|
|
|
|
-- BUFFS %d%d (5 + 2 + 1 = 8 + 4)
|
|
aura_env.output = aura_env.output .. noBuffs
|
|
while string.len(aura_env.output) < 12 do
|
|
aura_env.output = aura_env.output .. " "
|
|
end
|
|
-- BUFFS %d%d<4>HIT %d%d.%d (12 + 3 + 1 + 4 = 20 + 4)
|
|
aura_env.output = aura_env.output .. "HIT " .. math.ceil((hitPercent * 10)) / 10 .. "%"
|
|
while string.len(aura_env.output) < 24 do
|
|
aura_env.output = aura_env.output .. " "
|
|
end
|
|
-- BUFFS %d%d<4>HIT %d%d.%d<4>CRIT %d%d.%d (24 + 4 + 1 + 4 = 33 + 4)
|
|
aura_env.output = aura_env.output .. "CRIT " .. math.ceil((critPercent * 10)) / 10 .. "%"
|
|
while string.len(aura_env.output) < 37 do
|
|
aura_env.output = aura_env.output .. " "
|
|
end
|
|
-- BUFFS %d%d<4>HIT %d%d.%d<4>CRIT %d%d.%d<4>AP %d+
|
|
-- APPEND AP
|
|
-- 37 + 3 + 8 = 48
|
|
aura_env.output = aura_env.output .. "AP " .. attackPower
|
|
while string.len(aura_env.output) < 48 do
|
|
aura_env.output = aura_env.output .. " "
|
|
end
|
|
aura_env.output = aura_env.output .. "A " .. effArmor .. " " .. math.ceil((armorPercent * 10)) / 10 .. "%"
|
|
end
|
|
if e == "COMBAT_LOG_EVENT_UNFILTERED" then
|
|
local se = select(2, ...)
|
|
local subevents = {
|
|
["SPELL_AURA_APPLIED"] = true,
|
|
["SPELL_AURA_APPLIED_DOSE"] = true,
|
|
["SPELL_AURA_REMOVED"] = true,
|
|
["SPELL_AURA_REMOVED_DOSE"] = true,
|
|
["SPELL_AURA_REFRESH"] = true,
|
|
}
|
|
if subevents[se] then
|
|
local target = select(9, ...)
|
|
if target == UnitName("player") then
|
|
updateStats()
|
|
return true
|
|
end
|
|
end
|
|
elseif e == "UNIT_STATS" or e == "PLAYER_TARGET_CHANGED" then
|
|
updateStats()
|
|
return true
|
|
end
|
|
end
|
|
|
|
--DISPLAY
|
|
function()
|
|
return aura_env.output or ""
|
|
end
|
|
|
|
--INIT
|
|
aura_env.output = ""
|
|
WeakAuras.ScanEvents("UNIT_STATS") |