-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcore.lua
214 lines (172 loc) · 6.42 KB
/
core.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
AszharaHelper = LibStub("AceAddon-3.0"):NewAddon("AszharaHelper", "AceEvent-3.0", "AceTimer-3.0")
function AszharaHelper:OnInitialize()
self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
self:RegisterEvent("ENCOUNTER_START")
self:RegisterEvent("ENCOUNTER_END")
self.enabled = false
self.raid = {}
self.markedPlayers = {}
self.decrees = {
-- For debugging
-- [295842] = true, -- Null Barrier
-- [178740] = true, -- Immolation Aura
[299249] = true, -- Suffer!
[299251] = true, -- Obey!
[299254] = true, -- Stand Together!
[299255] = true, -- Stand Alone!
[299253] = true, -- Stay!
[299252] = true -- March!
}
self.casted = false
self.sufferAloneMarkerCount = 0
self.sufferTogetherMarkerCount = 0
self.stayStandAloneMarkerCount = 0
self.stayStandTogetherMarkerCount = 0
end
function AszharaHelper:OnEnable()
-- Called when the addon is enabled
end
function AszharaHelper:OnDisable()
-- Called when the addon is disabled
end
function AszharaHelper:ENCOUNTER_START(event, ...)
local encounterID, encounterName, difficultyID, groupSize = ...
-- Queen Azshara
if encounterID == 2299 then
self:Print("Event: " .. encounterName .. " started")
self.enabled = true
self:ResetDecrees()
end
end
function AszharaHelper:ENCOUNTER_END(event, ...)
local encounterID, encounterName, difficultyID, groupSize, success = ...
-- Queen Azshara
if encounterID == 2299 then
self:Print("Event: " .. encounterName .. " ended")
self.enabled = false
self:ResetDecrees()
end
end
function AszharaHelper:COMBAT_LOG_EVENT_UNFILTERED(event)
if self.enabled then
local timestamp, subevent, _, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags, auraType = CombatLogGetCurrentEventInfo()
-- Queen Azshara: Queen's Decree
if subevent == "SPELL_CAST_SUCCESS" and auraType == 299250 then
self:ScheduleTimer("EvaluateDecrees", 1)
self.casted = true
end
if subevent == "SPELL_AURA_APPLIED" then
if self.decrees[auraType] then
self:addSufferingPlayer(destName, auraType)
end
elseif subevent == "SPELL_AURA_REMOVED" then
if self.decrees[auraType] then
end
end
end
end
function AszharaHelper:addSufferingPlayer(player, spell)
if self.casted == false then
self:ScheduleTimer("EvaluateDecrees", 1)
self.casted = true
end
if self.raid[player] == nil then
table.insert(self.raid, player)
self.raid[player] = {}
end
if self.raid[player][spell] == nil then
self.raid[player][spell] = {}
end
table.insert(self.raid[player][spell], true)
end
function AszharaHelper:dump()
for _, player in ipairs(self.raid) do
local decrees = {}
for decree, _ in pairs(self.raid[player]) do
local decreeName = GetSpellInfo(decree)
table.insert(decrees, decreeName)
end
self:Print("Player: ".. player .. " suffering from: " .. table.concat(decrees, ", "))
end
end
function AszharaHelper:EvaluateDecrees()
self:Print("Evaluating decrees ...")
self:dump()
for _, player in ipairs(self.raid) do
local decrees = self.raid[player]
-- Debugging Null Barrier + Immolation Aura
--[[
if decrees[295842] and decrees[178740] then
self:Print("### WHISPER ###")
self.sufferTogetherMarkerCount = self.sufferTogetherMarkerCount + 1
table.insert(self.markedPlayers, player)
if self.sufferTogetherMarkerCount >= 1 and self.sufferTogetherMarkerCount <= 2 then
SendChatMessage("Go soak TOGETHER", "WHISPER", nil, player);
SetRaidTarget(player, self.sufferTogetherMarkerCount + 3);
end
if self.sufferTogetherMarkerCount > 2 and self.sufferTogetherMarkerCount % 2 == 0 then
SendChatMessage("Go soak TOGETHER with: {triangle}", "WHISPER", nil, player);
else
SendChatMessage("Go soak TOGETHER with: {moon}", "WHISPER", nil, player);
end
end
--]]
-- March! + Stand Alone!
if decrees[299252] and decrees[299255] then
SendChatMessage("Walk ALONE at the corner of the room", "WHISPER", nil, player);
end
-- Suffer! + Stand Alone!
-- Marker: Star, Circle, Diamond - 1, 2, 3
if decrees[299249] and decrees[299255] then
self.sufferAloneMarkerCount = self.sufferAloneMarkerCount + 1
table.insert(self.markedPlayers, player)
SendChatMessage("Go soak ALONE", "WHISPER", nil, player);
if self.sufferAloneMarkerCount >= 1 and self.sufferAloneMarkerCount <= 3 then
SetRaidTarget(player, self.sufferAloneMarkerCount);
end
end
-- Suffer! + Stand Together!
-- Marker: Triangle, Moon - 4, 5
if decrees[299249] and decrees[299254] then
self.sufferTogetherMarkerCount = self.sufferTogetherMarkerCount + 1
table.insert(self.markedPlayers, player)
if self.sufferTogetherMarkerCount >= 1 and self.sufferTogetherMarkerCount <= 2 then
SendChatMessage("Go soak", "WHISPER", nil, player);
SetRaidTarget(player, self.sufferTogetherMarkerCount + 3);
end
if self.sufferTogetherMarkerCount > 2 and self.sufferTogetherMarkerCount % 2 == 0 then
SendChatMessage("Go soak TOGETHER with: {triangle}", "WHISPER", nil, player);
else
SendChatMessage("Go soak TOGETHER with: {moon}", "WHISPER", nil, player);
end
end
-- Stay! + Stand Alone!
-- Marker: Cross - 7
if decrees[299253] and decrees[299255] then
table.insert(self.markedPlayers, player)
SendChatMessage("Just stand still", "WHISPER", nil, player);
SetRaidTarget(player, 7);
end
-- Stay! + Stand Together!
-- Marker: Skull - 8
if decrees[299253] and decrees[299254] then
table.insert(self.markedPlayers, player)
SendChatMessage("Stick to someone and stand still", "WHISPER", nil, player);
SetRaidTarget(player, 8);
end
end
self:ScheduleTimer("ResetDecrees", 15)
end
function AszharaHelper:ResetDecrees()
self:Print("Resetting decrees ...")
for i,v in ipairs(self.markedPlayers) do
SetRaidTarget(v, 0);
end
self.raid = {}
self.markedPlayers = {}
self.casted = false
self.sufferAloneMarkerCount = 0
self.sufferTogetherMarkerCount = 0
self.stayStandAloneMarkerCount = 0
self.stayStandTogetherMarkerCount = 0
end