-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInstance.lua
More file actions
74 lines (66 loc) · 1.71 KB
/
Instance.lua
File metadata and controls
74 lines (66 loc) · 1.71 KB
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
local _, addon = ...
addon.InInstance = false
addon.InstanceType = nil
addon.InEncounter = false
addon.Encounter = nil
function addon.GetInstanceChannel()
if IsInGroup(LE_PARTY_CATEGORY_INSTANCE) and addon.InInstance then
return 'INSTANCE_CHAT'
elseif IsInRaid() then
return 'RAID'
elseif IsInGroup() then
return 'PARTY'
end
end
local bw, bwClear
do
local isAdded = nil
local prevPhase = nil
function bw()
if isAdded then
return
end
if (BigWigsLoader) and BigWigsLoader.RegisterMessage then
local r = {}
function r:BigWigs_Message(event, module, key, text, ...)
if (key == 'stages') then
local phase = text:gsub ('.*%s', '')
phase = tonumber(phase)
if (phase and type(phase) == 'number' and prevPhase ~= phase) then
prevPhase = phase
addon.Encounter.phase = phase
end
end
end
BigWigsLoader.RegisterMessage(r, 'BigWigs_Message')
isAdded = true
end
end
function bwClear()
prevPhase = nil
end
end
function addon.IsRemix()
return PlayerGetTimerunningSeasonID and PlayerGetTimerunningSeasonID() ~= nil
end
AstralRaidEvents:Register('PLAYER_ENTERING_WORLD', function()
addon.InInstance, addon.InstanceType = IsInInstance()
end, 'GetInstance')
AstralRaidEvents:Register('ENCOUNTER_START', function(encounterID, encounterName, difficultyID, groupSize)
addon.InEncounter = true
addon.Encounter = {
encounterID = encounterID,
encounterName = encounterName,
difficultyID = difficultyID,
groupSize = groupSize,
start = GetTime(),
phase = 1,
whoPulled = nil,
}
bwClear()
bw()
end, 'StartEncounter')
AstralRaidEvents:Register('ENCOUNTER_END', function()
addon.InEncounter = false
addon.Encounter['end'] = GetTime()
end, 'EndEncounter')