Revision 12

This commit is contained in:
Robin 2021-01-13 14:55:50 +01:00
commit 8b66c8c4f2
4 changed files with 121 additions and 0 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "Libs/LibCombatlog"]
path = Libs/LibCombatlog
url = https://git.grml.de/rilgamon/LibCombatlog.git

108
BurnBaby.lua Normal file
View File

@ -0,0 +1,108 @@
local addonName, addon = ...
local fname = format("%s", addonName)
addon['f'] = CreateFrame("Button", fname, UIParent, "ActionButtonTemplate")
addon['guid'] = UnitGUID('player')
local guid, f = addon['guid'], addon['f']
local spellInfo = {GetSpellInfo(336267)}
local wdlSpellInfo = {GetSpellInfo(109186)}
f['wdl1'] = CreateFrame("Button", format("%s1", fname), f, "ActionButtonTemplate")
f['wdl2'] = CreateFrame("Button", format("%s2", fname), f, "ActionButtonTemplate")
local auraName = spellInfo[1]
local auraName2 = wdlSpellInfo[1]
local buttons = {f, f['wdl1'], f['wdl2']}
for i = 1, #buttons do
local btn = buttons[i]
btn:SetSize(36, 36)
btn:SetScale(i == 1 and 2 or 0.5)
btn:Hide()
end
_G[format("%sIcon",fname)]:SetTexture(spellInfo[3])
_G[format("%sIcon",format("%s1", fname))]:SetTexture(wdlSpellInfo[3])
_G[format("%sIcon",format("%s2", fname))]:SetTexture(wdlSpellInfo[3])
f:SetPoint("CENTER")
f:SetMovable(true)
f:EnableMouse(true)
f:RegisterForDrag("LeftButton")
f:SetScript("OnDragStart", f.StartMoving)
f:SetScript("OnDragStop", f.StopMovingOrSizing)
local ct = _G[format("%sCount", fname)]
local cd = _G[format("%sCooldown", fname)]
local cd1 = _G[format("%sCooldown", format("%s1", fname))]
local cd2 = _G[format("%sCooldown", format("%s2", fname))]
f['elapsed'] = 0
f['wdl1']:SetPoint("BOTTOMRIGHT", f, "BOTTOMLEFT",-4,0)
f['wdl2']:SetPoint("BOTTOMLEFT", f, "BOTTOMRIGHT",4,0)
f:SetScript("OnUpdate", function(self, elapsed)
self['elapsed'] = self['elapsed'] + elapsed
if(self['elapsed']>0.1) then
local name, icon, count, debuffType, duration, expirationTime = AuraUtil.FindAuraByName(auraName, 'player')
if(name) then
local run = expirationTime - GetTime()
cd:SetCooldown(GetTime() - run, duration)
ct:SetText(count and count or 0)
end
local name, icon, count, debuffType, duration, expirationTime = AuraUtil.FindAuraByName(auraName2, 'player')
if(name) then
local run = expirationTime - GetTime()
if(count) then
if(count > 1) then
cd2:SetCooldown(GetTime() - run, duration)
end
cd1:SetCooldown(GetTime() - run, duration)
end
end
end
end)
function f:dmg(...)
local data, event = ...
if(data[9] == guid) then
if(data[13] == 336267) then
local name, icon, count, debuffType, duration, expirationTime, unitCaster, canStealOrPurge, nameplateShowPersonal, spellId, canApplyAura, isBossDebuff, isCastByPlayer, nameplateShowAll, timeMod = AuraUtil.FindAuraByName(auraName, 'player')
if(name and count > 0) then
f:Show()
else
f:Hide()
end
elseif(data[13] == 114255) then
local name, icon, count, debuffType, duration, expirationTime, unitCaster, canStealOrPurge, nameplateShowPersonal, spellId, canApplyAura, isBossDebuff, isCastByPlayer, nameplateShowAll, timeMod = AuraUtil.FindAuraByName(auraName2, 'player')
if(name and count and count > 0) then
local run = expirationTime - GetTime()
if(count > 1) then
f['wdl2']:Show()
else
f['wdl2']:Hide()
end
f['wdl1']:Show()
else
f['wdl1']:Hide()
f['wdl2']:Hide()
end
end
end
end
function f:Reset()
self:SetSize(36,36)
self:ClearAllPoints()
self:SetPoint("CENTER",UIParent,"CENTER")
spellInfo = {GetSpellInfo(336267)}
_G[format("%sIcon",fname)]:SetTexture(spellInfo[3])
self:Show()
end
function f:Scale(scale)
if(not scale or scale <= 0 or scale > 5) then
scale = 2
end
_G[format("%s%s", addonName, 'DB')] = scale
self:Reset()
self:SetScale(scale)
end
LibStub("LibCombatLog"):Embed(f)
f:RegisterCLEvent({'AURA_APPLIED','AURA_REMOVED','AURA_APPLIED_DOSE','AURA_REMOVED_DOSE','AURA_REFRESH','AURA_BROKEN','AURA_BROKEN_SPELL'}, 'dmg')
f:RegisterEvent("ADDON_LOADED")
f:SetScript("OnEvent", function(self,event,arg1)
if(event == "ADDON_LOADED" and arg1 == addonName) then
self:UnregisterEvent(event)
self:Scale(_G[format("%s%s", addonName, 'DB')])
self:Hide()
end
end)

9
BurnBaby.toc Normal file
View File

@ -0,0 +1,9 @@
## Interface: 90002
## X-Repository: https://git.grml.de/rilgamon/BurnBaby.git
## Title: BurnBaby
## X-WoWI-ID: 25853
## SavedVariables: BurnBabyDB
## OptionalDeps: Ace3, LibCombatlog
Libs/LibCombatlog/LibStub/LibStub.lua
Libs/LibCombatlog/LibCombatlog.lua
BurnBaby.lua

1
Libs/LibCombatlog Submodule

@ -0,0 +1 @@
Subproject commit b20f7ecfb0b98006d158ed372d0025fb9ec887bc