-
Notifications
You must be signed in to change notification settings - Fork 1
/
integrations.lua
executable file
·88 lines (76 loc) · 2.72 KB
/
integrations.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
local addonName, SheepMonitor = ...
function SheepMonitor:ShowQuartz(aura)
if aura and IsAddOnLoaded('Quartz') then
local Mirror = LibStub('AceAddon-3.0'):GetAddon('Quartz3'):GetModule('Mirror')
Mirror.ExternalTimers[aura.destName .. ' (' .. aura.spellName .. ')'] = {
startTime = aura.timestamp,
endTime = aura.timestamp + aura.duration,
icon = aura.texture,
color = { 1, 0, 0 },
spellid = aura.spellId,
spellname = aura.spellName,
expires = aura.timestamp + aura.duration,
cooldown = false,
spelltype = 'combatlog',
}
Mirror:SendMessage('Quartz3Mirror_UpdateCustom')
end
end
function SheepMonitor:HideQuartz(aura)
if aura and IsAddOnLoaded('Quartz') then
local Mirror = LibStub('AceAddon-3.0'):GetAddon('Quartz3'):GetModule('Mirror')
for k, v in pairs(Mirror.ExternalTimers) do
if (tostring(v.spellid) == tostring(aura.spellId)) and (v.spelltype == 'combatlog') then
Mirror.ExternalTimers[k] = nil
Mirror:SendMessage('Quartz3Mirror_UpdateCustom')
end
end
end
end
-- logic copied from Dominos
local function GetActionBarButtonFrame(id)
if id <= 12 then
return _G['ActionButton' .. id]
elseif id <= 24 then
return nil
elseif id <= 36 then
return _G['MultiBarRightButton' .. (id - 24)]
elseif id <= 48 then
return _G['MultiBarLeftButton' .. (id - 36)]
elseif id <= 60 then
return _G['MultiBarBottomRightButton' .. (id - 48)]
elseif id <= 72 then
return _G['MultiBarBottomLeftButton' .. (id - 60)]
end
return nil
end
function SheepMonitor:ShowOmniCC(aura)
if aura and IsAddOnLoaded('OmniCC') then
for i = 1, 120 do
local spellId = select(2, GetActionInfo(i))
if spellId == aura.spellId then
local button = GetActionBarButtonFrame(i)
if button then
local timer = OmniCC.Timer:Get(button) or OmniCC.Timer:New(button)
timer:Start(aura.timestamp, aura.duration)
end
end
end
end
end
function SheepMonitor:HideOmniCC(aura)
if aura and IsAddOnLoaded('OmniCC') then
for i = 1, 120 do
local spellId = select(2, GetActionInfo(i))
if spellId == aura.spellId then
local button = GetActionBarButtonFrame(i)
if button then
local timer = OmniCC.Timer:Get(button)
if timer and timer.enabled then
timer:Stop()
end
end
end
end
end
end