Code:
local yellowAt = 4000
local greenAt = 10000
local PyroblastId = 11366
local IPyroblastId = 92315
local LivingBomgId = 44461
local LivingBomgDotId = 44457
local IgniteId = 12654
LBdmg = 0
PBdmg = 0
IGdmg = 0
amount = 0
loadUI = function ()
local fbFrame = CreateFrame("Button", "fbFrame", UIParent)
local fbdb
fbFrame:SetFrameStrata("TOOLTIP")
fbFrame:SetWidth(124)
fbFrame:SetHeight(45)
fbFrame:Show()
fbFrame:SetPoint("CENTER",0,0)
fbFrame:EnableMouse(true)
fbFrame:SetMovable(true)
fbFrame:RegisterForDrag("LeftButton")
fbFrame:CreateTitleRegion()
fbFrame:GetTitleRegion():SetAllPoints(true)
fbFrame:SetScript("OnUpdate", OnUpdate)
fbFrame:SetScript("OnEvent", OnEvent)
fbFrame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
fbFrame:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED")
fbFrame:RegisterEvent("PLAYER_TARGET_CHANGED")
FontString = fbFrame:CreateFontString("CFontString")
FontString:SetFont("Fonts\\FRIZQT__.TTF", 24) ;
FontString:SetPoint("CENTER", fbFrame, "CENTER", 0, 0)
FontString:SetWidth(fbFrame:GetWidth())
FontString:SetHeight(fbFrame:GetHeight())
FontString:SetText(" ")
FontString:SetTextColor(1,0,0)
fbFrame:RegisterEvent("ADDON_LOADED")
end
local function VerifyDB(self)
fbdb = fbdb or {}
if fbdb.lock == nil then
fbdb = {
lock = "u"
}
end
return self
end
local lastamount = 0
function OnUpdate(elapsed)
local IgniteComp = 0
local LivingComp = 0
local PyroblastComp = 0
if UnitBuffInfoById(IgniteId, "target", UnitDebuff, true) ~= nil then
IgniteComp = IGdmg /2.8
end
if UnitBuffInfoById(LivingBomgDotId, "target", UnitDebuff, true) ~= nil then
LivingComp = LBdmg / (2.98*0.78)
end
if UnitBuffInfoById(IPyroblastId, "target", UnitDebuff, true) ~= nil then
PyroblastComp = PBdmg /(2.98*0.73)
end
if UnitBuffInfoById(PyroblastId, "target", UnitDebuff, true) ~= nil then
PyroblastComp = PBdmg /(2.98*0.73)
end
amount = floor (IgniteComp+LivingComp+PyroblastComp)
FontString:SetText(amount)
if amount >= greenAt then
FontString:SetFont("Fonts\\FRIZQT__.TTF", 24, "THICKOUTLINE") ;
FontString:SetTextColor(0,1,0)
elseif amount >= yellowAt then
FontString:SetFont("Fonts\\FRIZQT__.TTF", 24) ;
FontString:SetTextColor(1,1,0)
else
FontString:SetFont("Fonts\\FRIZQT__.TTF", 24) ;
FontString:SetTextColor(1,0,0)
end
if amount == 0 then
FontString:SetText(" ")
end
end
function OnEvent(frame, event, ...)
if event == "ADDON_LOADED" then
VerifyDB(frame)
if(fbdb.lock == "u") then
frame:EnableMouse(true)
else
frame:EnableMouse(false)
end
end
if event == "COMBAT_LOG_EVENT_UNFILTERED" then
local type, _, castGUID, _, _, _, targGUID = select(2, ...)
if targGUID == UnitGUID("target") and castGUID == UnitGUID("player") then
local spellId, _, _, amount = select(12, ...)
local crit = select(21, ...)
if type == "SPELL_PERIODIC_DAMAGE" then
if (not crit) and spellId == LivingBomgDotId then
LBdmg = 1.3571 * (amount+GetMastery()) * (1+GetMastery()*2.8/100) /3 -6
end
if (crit) and spellId == LivingBomgDotId then
LBdmg = 1.3571 * (amount+GetMastery()) * (1+GetMastery()*2.8/100) /3 -6
LBdmg = LBdmg / 2.05
end
if (not crit) and spellId == IPyroblastId then
PBdmg = (0.15134) * ((1 +GetMastery() *2.8 /100)-0.08771) * (amount + ((1 +GetMastery() *2.8 /100) + 10.21) / 0.27950) * 3
end
if (not crit) and spellId == PyroblastId then
PBdmg = (0.15134) * ((1 +GetMastery() *2.8 /100)-0.08771) * (amount + ((1 +GetMastery() *2.8 /100) + 10.21) / 0.27950) * 3
end
if (crit) and spellId == IPyroblastId then
PBdmg = (0.15134) * ((1 +GetMastery() *2.8 /100)-0.08771) * (amount + ((1 +GetMastery() *2.8 /100) + 10.21) / 0.27950) * 3
PBdmg = PBdmg / 2.05
end
if (crit) and spellId == PyroblastId then
PBdmg = (0.15134) * ((1 +GetMastery() *2.8 /100)-0.08771) * (amount + ((1 +GetMastery() *2.8 /100) + 10.21) / 0.27950) * 3
PBdmg = PBdmg / 2.05
end
if (not crit) and spellId == IgniteId then
IGdmg = amount
end
if (crit) and spellId == IgniteId then
IGdmg = amount/2.05
end
end
end
end
end
function UnitBuffInfoById( buff, unit, func, own )
local i = 1
local buffName, buffRank, buffTexture, buffApplications, school, duration, timeLeft, unitCaster, buffId, isStealable, buffId2 = func( unit, i, 0 )
while buffName ~= nil do
if (buffId == buff or buffId2 == buff) and ((own == nil) or unitCaster == "player" ) then
return buffRank, buffTexture, buffApplications, duration, (timeLeft - GetTime()), unitCaster, buffId, isStealable, buffId2
end
i = i + 1
buffName, buffRank, buffTexture, buffApplications, school, duration, timeLeft, unitCaster, buffId, isStealable, buffId2 = func( unit, i, 0 )
end
return nil, nil, 0, 0, 0, nil, 0, nil
end
SLASH_FIREBUNNY1 = "/fb"
SLASH_FIREBUNNY2 = "/firebunny"
function SlashCmdList.FIREBUNNY(msg, editbox)
if msg:lower() == "lock" then
if(fbFrame:IsMouseEnabled()) then
fbFrame:EnableMouse(false)
fbdb.lock = "l"
else
if not(fbFrame:IsMouseEnabled()) then
fbFrame:EnableMouse(true)
fbdb.lock = "u"
end
end
else
print("Please use /fb lock or /firebunny lock to toggle locking of the frame")
end
end
loadUI()