Files
wow-weakauras/WeakAuras/Projects/ByExp/BFA/CD.lua

89 lines
4.0 KiB
Lua

--COMBAT_LOG_EVENT_UNFILTERED
function(...)
local se = select(3, ...)
if se == "SPELL_CAST_SUCCESS" then
local dest = select(6, ...)
if dest == UnitName("player") then
local name = select(14, ...)
if name == "Shield Block" or name == "Ignore Pain" then
local c1, c2, c3, c4 = "|cFFFFFFFF", "|cFFFFFFFF", "|cFFFFFFFF", "|cFFFFFFFF"
local Avatar = GetSpellCooldown("Avatar")
local AvatarD = select(2, GetSpellCooldown("Avatar"))
local LastStand = GetSpellCooldown("Last Stand")
local ShieldWall = GetSpellCooldown("Shield Wall")
local DemoralizingShout = GetSpellCooldown("Demoralizing Shout")
local DemoralizingShoutD = select(2, GetSpellCooldown("Demoralizing Shout"))
if Avatar > 0 and AvatarD > 2 then
if name == "Shield Block" then
aura_env.AvatarCD = aura_env.AvatarCD + 3
else
aura_env.AvatarCD = aura_env.AvatarCD + 4
end
end
if LastStand > 0 then
if name == "Shield Block" then
aura_env.LastStandCD = aura_env.LastStandCD + 3
else
aura_env.LastStandCD = aura_env.LastStandCD + 4
end
end
if ShieldWall > 0 then
if name == "Shield Block" then
aura_env.ShieldWallCD = aura_env.ShieldWallCD + 3
else
aura_env.ShieldWallCD = aura_env.ShieldWallCD + 4
end
end
if DemoralizingShout > 0 and DemoralizingShoutD > 2 then
if name == "Shield Block" then
aura_env.DemoralizingShoutCD = aura_env.DemoralizingShoutCD + 3
else
aura_env.DemoralizingShoutCD = aura_env.DemoralizingShoutCD + 4
end
end
if AvatarD < 2 then c1 = "|cFF0080FF" end
if LastStand == 0 then c2 = "|cFF0080FF" end
if ShieldWall == 0 then c3 = "|cFF0080FF" end
if DemoralizingShoutD < 2 then c4 = "|cFF0080FF" end
aura_env.region.text2:SetText(c1 .. aura_env.AvatarCD .. "|r\n" .. c2 .. aura_env.LastStandCD .. "|r\n" .. c3 .. aura_env.ShieldWallCD .. "|r\n" .. c4 .. aura_env.DemoralizingShoutCD .. "|r")
elseif name == "Avatar" then
aura_env.AvatarCD = 0
elseif name == "Last Stand" then
aura_env.LastStandCD = 0
elseif name == "Shield Wall" then
aura_env.ShieldWallCD = 0
elseif name == "Demoralizing Shout" then
aura_env.DemoralizingShoutCD = 0
end
end
end
end
--INIT
aura_env.AvatarCD, aura_env.LastStandCD, aura_env.ShieldWallCD, aura_env.DemoralizingShoutCD = 0, 0, 0, 0
local fontsize = 16
local font, size, flags = aura_env.region.text:GetFont()
if not aura_env.region.text then
local text = aura_env.region:CreateFontString(nil, aura_env.region)
aura_env.region.text = text
print("ok!")
end
aura_env.region:SetWidth(128)
aura_env.region.text:SetFont(font, size, flags)
aura_env.region.text:SetTextColor(1,1,1,1)
aura_env.region.text:SetPoint("CENTER", aura_env.region, "CENTER")
aura_env.region.text:SetJustifyH("LEFT")
aura_env.region.text:SetText("Avatar\nLast Stand\nShield Wall\nDemoralizing Shout")
aura_env.region.text:Show()
if not aura_env.region.text2 then
local text2 = aura_env.region:CreateFontString(nil, aura_env.region)
aura_env.region.text2 = text2
print("ok!")
end
aura_env.region.text2:SetFont(font, size, flags)
aura_env.region.text2:SetTextColor(1,1,1,1)
aura_env.region.text2:SetPoint("RIGHT", aura_env.region, "RIGHT", 128, 0)
aura_env.region.text2:SetJustifyH("LEFT")
aura_env.region.text2:SetText("0" .. "\n" .. "0" .. "\n" .. "0" .. "\n" .. "0")
aura_env.region.text2:Show()