vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | -- |
2 | -- LazyRogue |
||
3 | -- |
||
4 | -- Scriptable Rogue attacks. |
||
5 | -- |
||
6 | -- Copyright (c) 2005-2006 Ithilyn (Steve Kehlet) |
||
7 | -- |
||
8 | -- Developers: Ithilyn, FreeSpeech |
||
9 | -- |
||
10 | |||
11 | SLASH_LAZYROGUE1 = "/lazyrogue" |
||
12 | SLASH_LAZYROGUE2 = "/lr" |
||
13 | |||
14 | BINDING_HEADER_LAZYROGUE = "LazyRogue" |
||
15 | BINDING_NAME_LR_EXECUTE = "Execute Default Form" |
||
16 | |||
17 | lazyr = {} |
||
18 | lazyr.version = "3.1" |
||
19 | lazyr.addOnIsActive = false |
||
20 | lazyr.isInCombat = false |
||
21 | lazyr.attackSlot = nil |
||
22 | lazyr.eviscDamage = { |
||
23 | { (7+11)/2, (13+17)/2, (19+23)/2, (25+29)/2, (31+35)/2 }, |
||
24 | { (16+24)/2, (29+37)/2, (42+50)/2, (55+63)/2, (68+76)/2 }, |
||
25 | { (29+43)/2, (52+66)/2, (75+89)/2, (98+112)/2, (121+135)/2 }, |
||
26 | { (47+67)/2, (84+104)/2, (121+141)/2, (158+178)/2, (195+215)/2 }, |
||
27 | { (69+99)/2, (123+153)/2, (177+207)/2, (231+261)/2, (285+315)/2 }, |
||
28 | { (104+148)/2, (186+230)/2, (268+312)/2, (350+394)/2, (432+476)/2 }, |
||
29 | { (158+226)/2, (282+350)/2, (406+474)/2, (530+598)/2, (654+722)/2 }, |
||
30 | { (216+312)/2, (384+480)/2, (552+648)/2, (720+816)/2, (888+984)/2 }, |
||
31 | { (242+350)/2, (430+538)/2, (618+726)/2, (806+914)/2, (994+1102)/2 }, |
||
32 | } |
||
33 | lazyr.eviscComboPoints = 0 |
||
34 | lazyr.mock = false |
||
35 | lazyr.behindAttackLastFailedAt = 0 |
||
36 | lazyr.inFrontAttackLastFailedAt = 0 |
||
37 | lazyr.lastAttacker = "" |
||
38 | lazyr.numberOfAttackers = 0 |
||
39 | lazyr.ganked= nil |
||
40 | lazyr.InDuel = false |
||
41 | lazyr.talentCache = {} |
||
42 | lazyr.parsedFormCache = {} |
||
43 | lazyr.realmName = "Unknown" |
||
44 | lazyr.playerName = "Unknown" |
||
45 | lazyr.latestEnergy = 0 |
||
46 | lazyr.lastTickTime = 0 |
||
47 | lazyr.targetHealthHistory = nil |
||
48 | lazyr.perPlayerConf = nil |
||
49 | lazyr.defaultForms = {} |
||
50 | lazyr.defaultForms.lr = { |
||
51 | "--", |
||
52 | "-- This is the classic LazyRogue form. Nice and easy.", |
||
53 | "-- Sinister Strike until you have 5 combo points, then Eviscerate.", |
||
54 | "-- Uncomment Riposte (remove the leading '--') if you have it.", |
||
55 | "--", |
||
56 | "evisc-if5cp", |
||
57 | "--riposte", |
||
58 | "ss" |
||
59 | } |
||
60 | lazyr.defaultForms.lazy1 = { |
||
61 | "--", |
||
62 | "-- Open with Cheap Shot.", |
||
63 | "-- SS until you have 5 combo points, or enough to kill the target.", |
||
64 | "-- Throw in a Kidney Shot if your health is dropping, or a Rupture", |
||
65 | "-- if the guy's elite.", |
||
66 | "--", |
||
67 | "cs", |
||
68 | "evisc-ifKillShot", |
||
69 | "ks-5cp-ifPlayer<60%hp", |
||
70 | "rupture-5cp-ifTarget>65%hp-ifNotRuptureActive-ifTargetElite", |
||
71 | "evisc-if5cp", |
||
72 | "--riposte", |
||
73 | "ss" |
||
74 | } |
||
75 | lazyr.defaultForms.lazy2 = { |
||
76 | "--", |
||
77 | "-- This form works well both solo and in groups.", |
||
78 | "-- Note: Comment out the cbevisc entries if you don't have", |
||
79 | "-- Cold Blood.", |
||
80 | "--", |
||
81 | "stopAll-ifVanishActive", |
||
82 | "--stopAll-ifNotTargetNPC -- uncomment to avoid accidental PvP", |
||
83 | "dismount-ifMounted", |
||
84 | "stealth", |
||
85 | "stopAll-ifTargetCCd-ifNotShiftDown", |
||
86 | "vanish-ifPlayer<30%hp-ifInCombat-ifTargetOfTarget", |
||
87 | "cs", |
||
88 | "evisc-ifKillShot", |
||
89 | "evisc-ifInGroup-ifLastChance", |
||
90 | "cbEvisc-if3cp-ifCbKillShot-ifNotShiftDown", |
||
91 | "kick-ifTargetIsCasting-ifNotShiftDown", |
||
92 | "ks-if<3cp-ifTargetIsCasting-ifNotShiftDown", |
||
93 | "gouge-ifTargetIsCasting-ifNotShiftDown", |
||
94 | "ks-if5cp-ifPlayer<75%hp-ifTargetOfTarget-ifTarget>35%hp", |
||
95 | "rupture-if5cp-ifTarget>75%hp-ifNotRuptureActive-ifTargetElite", |
||
96 | "cbEvisc-if5cp-ifNotShiftDown", |
||
97 | "evisc-if5cp", |
||
98 | "snd-if=1cp-ifNotSndActive", |
||
99 | "feint-ifTargetOfTarget-ifInGroup-ifNotShiftDown", |
||
100 | "-- uncomment the following if you keep pulling aggro :-)", |
||
101 | "--feint-ifInGroup-every15s-ifNotShiftDown", |
||
102 | "--riposte", |
||
103 | "ss" |
||
104 | } |
||
105 | lazyr.defaultForms.lazy3 = { |
||
106 | "--", |
||
107 | "-- Here's a form I used as a Subtlety/Hemo build.", |
||
108 | "-- Apply Hemo when not active, SS the rest of the time.", |
||
109 | "--", |
||
110 | "dismount-ifMounted", |
||
111 | "--stealth", |
||
112 | "stopAll-ifTargetCCd-ifNotShiftDown", |
||
113 | "stopAll-ifVanishActive", |
||
114 | "vanish-ifPlayer<30%hp-ifInGroup-ifInCombat-ifTargetAlive", |
||
115 | "cs", |
||
116 | "evisc-ifKillShot", |
||
117 | "evisc-ifInGroup-ifLastChance", |
||
118 | "cbEvisc-if3cp-ifCbKillShot-ifNotShiftDown", |
||
119 | "kick-ifTargetIsCasting", |
||
120 | "ks-if<3cp-ifTargetIsCasting", |
||
121 | "gouge-ifTargetIsCasting", |
||
122 | "ks-if5cp-ifPlayer<60%hp-ifTargetOfTarget-ifTarget>35%hp", |
||
123 | "rupture-if5cp-ifTarget>60%hp-ifNotRuptureActive", |
||
124 | "cbEvisc-if5cp-ifNotShiftDown", |
||
125 | "evisc-if5cp", |
||
126 | "snd-if=1cp-ifNotSndActive", |
||
127 | "feint-ifTargetOfTarget-ifInGroup-ifNotShiftDown", |
||
128 | "--feint-ifInGroup-every20s-ifNotShiftDown", |
||
129 | "ghostly-ifNotGhostlyActive-ifTargetOfTarget", |
||
130 | "hemo-ifNotHemoActive", |
||
131 | "ss" |
||
132 | } |
||
133 | |||
134 | lrConf = {} |
||
135 | lrConf.confVersion = 6 |
||
136 | lrConf.forms = {} |
||
137 | lrConf.forms.lr = lazyr.defaultForms.lr |
||
138 | lrConf.forms.lazy1 = lazyr.defaultForms.lazy1 |
||
139 | lrConf.forms.lazy2 = lazyr.defaultForms.lazy2 |
||
140 | lrConf.forms.lazy3 = lazyr.defaultForms.lazy3 |
||
141 | lrConf.interruptExceptionCriteria = { |
||
142 | "-ifTargetIsCasting=^Shoot$", |
||
143 | "# The following almost always works great, but", |
||
144 | "# Reportedly some mobs in Winterspring may have", |
||
145 | "# 0 mana but can still cast.", |
||
146 | "-ifTarget=0mana-ifTargetNPC", |
||
147 | "# example of possibile options", |
||
148 | "#-ifTargetClass=Warrior", |
||
149 | "# the following is an example for a weird boss that", |
||
150 | "# behaves differently under 50% hp (no kicks)", |
||
151 | "#-ifTargetNamed=Some%sMajor%sBoss-ifTarget<50%hp", |
||
152 | } |
||
153 | lrConf.perPlayer = {} |
||
154 | |||
155 | |||
156 | function lazyr.OnLoad() |
||
157 | local junk, englishClass = UnitClass("player") |
||
158 | if (englishClass ~= "ROGUE") then |
||
159 | return |
||
160 | end |
||
161 | lazyr.addOnIsActive = true |
||
162 | this:RegisterEvent("PLAYER_ENTERING_WORLD") |
||
163 | this:RegisterEvent("VARIABLES_LOADED") |
||
164 | SlashCmdList["LAZYROGUE"] = lazyr.SlashCommand |
||
165 | lazyr.chat("LazyRogue v"..lazyr.version.." loaded.") |
||
166 | end |
||
167 | |||
168 | function lazyr.OnEvent() |
||
169 | if (event == "PLAYER_ENTERING_WORLD") then |
||
170 | |||
171 | this:RegisterEvent("PLAYER_ENTER_COMBAT") |
||
172 | this:RegisterEvent("PLAYER_LEAVE_COMBAT") |
||
173 | this:RegisterEvent("PLAYER_TARGET_CHANGED") |
||
174 | this:RegisterEvent("PLAYER_REGEN_DISABLED") |
||
175 | this:RegisterEvent("PLAYER_REGEN_ENABLED") |
||
176 | this:RegisterEvent("ACTIONBAR_SLOT_CHANGED") |
||
177 | this:RegisterEvent("SPELLS_CHANGED") |
||
178 | this:RegisterEvent("UI_ERROR_MESSAGE") |
||
179 | |||
180 | -- Deathstimator |
||
181 | lazyr.targetHealthHistory = lazyr.deathstimator.HealthHistory:New() |
||
182 | this:RegisterEvent("UNIT_HEALTH") |
||
183 | |||
184 | -- isLastChance |
||
185 | this:RegisterEvent("UNIT_ENERGY") |
||
186 | |||
187 | -- Eviscerate tracking |
||
188 | this:RegisterEvent("CHAT_MSG_SPELL_SELF_DAMAGE") |
||
189 | if (not lazyr.UseActionOrig) then |
||
190 | lazyr.UseActionOrig = UseAction |
||
191 | UseAction = lazyr.et.UseActionHook |
||
192 | end |
||
193 | |||
194 | -- Casting interrupts |
||
195 | -- PvE |
||
196 | this:RegisterEvent("CHAT_MSG_SPELL_CREATURE_VS_CREATURE_DAMAGE") |
||
197 | this:RegisterEvent("CHAT_MSG_SPELL_CREATURE_VS_CREATURE_BUFF") |
||
198 | -- PvP |
||
199 | this:RegisterEvent("CHAT_MSG_SPELL_HOSTILEPLAYER_DAMAGE") |
||
200 | this:RegisterEvent("CHAT_MSG_SPELL_HOSTILEPLAYER_BUFF") |
||
201 | |||
202 | -- Attacker tracking |
||
203 | this:RegisterEvent("CHAT_MSG_COMBAT_SELF_HITS") |
||
204 | this:RegisterEvent("CHAT_MSG_COMBAT_HOSTILEPLAYER_HITS") |
||
205 | this:RegisterEvent("CHAT_MSG_SPELL_HOSTILEPLAYER_DAMAGE") |
||
206 | |||
207 | --WG flag tracking |
||
208 | this:RegisterEvent("CHAT_MSG_BG_SYSTEM_ALLIANCE") |
||
209 | this:RegisterEvent("CHAT_MSG_BG_SYSTEM_HORDE") |
||
210 | |||
211 | --duel detection |
||
212 | this:RegisterEvent("CHAT_MSG_SYSTEM") |
||
213 | |||
214 | elseif (event == "VARIABLES_LOADED") then |
||
215 | lazyr.realmName = GetRealmName() |
||
216 | lazyr.playerName = UnitName("player") |
||
217 | |||
218 | -- our chance to upgrade any old saved variables |
||
219 | if (lrConf.confVersion < 2) then |
||
220 | lrConf.confVersion = 2 |
||
221 | lrConf.mmIsVisible = true |
||
222 | end |
||
223 | |||
224 | if (lrConf.confVersion < 3) then |
||
225 | lrConf.confVersion = 3 |
||
226 | lrConf.minionHidesOutOfCombat = false |
||
227 | lrConf.forms.lr = lazyr.defaultForms.lr |
||
228 | lrConf.forms.lazy1 = lazyr.defaultForms.lazy1 |
||
229 | lrConf.forms.lazy2 = lazyr.defaultForms.lazy2 |
||
230 | if (lrConf.defaultForm == "solo1") then |
||
231 | lrConf.defaultForm = "lr" |
||
232 | elseif (lrConf.defaultForm == "solo2") then |
||
233 | lrConf.defaultForm = "lr" |
||
234 | elseif (lrConf.defaultForm == "solo3") then |
||
235 | lrConf.defaultForm = "lr" |
||
236 | elseif (lrConf.defaultForm == "party1") then |
||
237 | lrConf.defaultForm = "lr" |
||
238 | elseif (lrConf.defaultForm == "party2") then |
||
239 | lrConf.defaultForm = "lr" |
||
240 | end |
||
241 | end |
||
242 | |||
243 | if (lrConf.confVersion < 4) then |
||
244 | lrConf.confVersion = 4 |
||
245 | lrConf.perPlayer = {} |
||
246 | lrConf.deathMinionIsVisible = false |
||
247 | lrConf.deathMinionHidesOutOfCombat = false |
||
248 | end |
||
249 | |||
250 | -- beginning with data version 4 we store per player |
||
251 | if (not lrConf.perPlayer[lazyr.realmName]) then |
||
252 | lrConf.perPlayer[lazyr.realmName] = {} |
||
253 | end |
||
254 | if (not lrConf.perPlayer[lazyr.realmName][lazyr.playerName]) then |
||
255 | -- first time this player has used LazyRogue, set him up |
||
256 | lrConf.perPlayer[lazyr.realmName][lazyr.playerName] = {} |
||
257 | end |
||
258 | -- quick reference for convenience |
||
259 | lazyr.perPlayerConf = lrConf.perPlayer[lazyr.realmName][lazyr.playerName] |
||
260 | |||
261 | if (lrConf.confVersion < 5) then |
||
262 | lrConf.confVersion = 5 |
||
263 | lrConf.interruptExceptionCriteria = { |
||
264 | "-ifTargetIsCasting=^Shoot$", |
||
265 | "# The following almost always works great, but", |
||
266 | "# Reportedly some mobs in Winterspring may have", |
||
267 | "# 0 mana but can still cast.", |
||
268 | "-ifTarget=0mana-ifTargetNPC", |
||
269 | "# example of possibile options", |
||
270 | "#-ifTargetClass=Warrior", |
||
271 | "# the following is an example for a weird boss that", |
||
272 | "# behaves differently under 50% hp (no kicks)", |
||
273 | "#-ifTargetNamed=Some%sMajor%sBoss-ifTarget<50%hp", |
||
274 | } |
||
275 | |||
276 | -- migrate all these options to per-player |
||
277 | lazyr.perPlayerConf.debug = lrConf.debug |
||
278 | lazyr.perPlayerConf.minionIsVisible = lrConf.minionIsVisible |
||
279 | lazyr.perPlayerConf.minionHidesOutOfCombat = lrConf.minionHidesOutOfCombat |
||
280 | lazyr.perPlayerConf.deathMinionIsVisible = lrConf.deathMinionIsVisible |
||
281 | lazyr.perPlayerConf.deathMinionHidesOutOfCombat = lrConf.deathMinionHidesOutOfCombat |
||
282 | lazyr.perPlayerConf.minimapButtonPos = lrConf.minimapButtonPos |
||
283 | lazyr.perPlayerConf.mmIsVisible = lrConf.mmIsVisible |
||
284 | lazyr.perPlayerConf.defaultForm = lrConf.defaultForm |
||
285 | lrConf.debug = nil |
||
286 | lrConf.minionIsVisible = nil |
||
287 | lrConf.minionHidesOutOfCombat = nil |
||
288 | lrConf.deathMinionIsVisible = nil |
||
289 | lrConf.deathMinionHidesOutOfCombat = nil |
||
290 | lrConf.minimapButtonPos = nil |
||
291 | lrConf.mmIsVisible = nil |
||
292 | lrConf.defaultForm = nil |
||
293 | end |
||
294 | |||
295 | local perPlayerDefaults = { |
||
296 | ["autoTarget"] = true, |
||
297 | ["deathMinionHidesOutOfCombat"] = false, |
||
298 | ["deathMinionIsVisible"] = false, |
||
299 | ["debug"] = false, |
||
300 | ["defaultForm"] = "lr", |
||
301 | ["eviscTracker"] = { {0,0}, {0,0}, {0,0}, {0,0}, {0,0} }, |
||
302 | ["eviscerateSample"] = 25, |
||
303 | ["healthHistorySize"] = 5, |
||
304 | ["initiateAutoAttack"] = true, |
||
305 | ["minimapButtonPos"] = 0, |
||
306 | ["minionHidesOutOfCombat"] = false, |
||
307 | ["minionIsVisible"] = true, |
||
308 | ["mmIsVisible"] = true, |
||
309 | ["showTargetCasts"] = false, |
||
310 | ["showReasonForTargetCCd"] = true, |
||
311 | ["trackEviscCrits"] = false, |
||
312 | ["useEviscTracking"] = true, |
||
313 | ["useImmunities"] = true, |
||
314 | ["Immunities"] = {} , |
||
315 | } |
||
316 | for var, val in perPlayerDefaults do |
||
317 | if (lazyr.perPlayerConf[var] == nil) then |
||
318 | lazyr.perPlayerConf[var] = val |
||
319 | end |
||
320 | end |
||
321 | |||
322 | if (lrConf.confVersion < 6) then |
||
323 | lrConf.confVersion = 6 |
||
324 | if (not lrConf.forms.lr) then |
||
325 | lrConf.forms.lr = lazyr.defaultForms.lr |
||
326 | end |
||
327 | lrConf.forms.lazy1 = lazyr.defaultForms.lazy1 |
||
328 | lrConf.forms.lazy2 = lazyr.defaultForms.lazy2 |
||
329 | lrConf.forms.lazy3 = lazyr.defaultForms.lazy3 |
||
330 | end |
||
331 | |||
332 | -- upgrades done |
||
333 | |||
334 | lazyr.minion.SetText(lazyr.perPlayerConf.defaultForm) |
||
335 | if (lazyr.perPlayerConf.minionIsVisible) then |
||
336 | LazyRogueMinionFrame:Show() |
||
337 | end |
||
338 | lazyr.deathstimator.minion.SetText("Deathstimator") |
||
339 | if (lazyr.perPlayerConf.deathMinionIsVisible) then |
||
340 | LazyRogueDeathstimatorFrame:Show() |
||
341 | end |
||
342 | |||
343 | elseif (event == "CHAT_MSG_SYSTEM") then |
||
344 | if lazyr.re(arg1,lrLocale.DUEL_COUNTDOWN) then |
||
345 | if lazyr.match1 == "3" then |
||
346 | lazyr.InDuel = true |
||
347 | lazyr.d("Entering Duel") |
||
348 | end |
||
349 | elseif lazyr.re(arg1,lrLocale.DUEL_WINNER_KNOCKOUT) or lazyr.re(arg1,lrLocale.DUEL_WINNER_RETREAT) then |
||
350 | if lazyr.match1 == UnitName("player") or lazyr.match2 == UnitName("player") then |
||
351 | lazyr.InDuel = false |
||
352 | lazyr.d("Leaving Duel") |
||
353 | end |
||
354 | end |
||
355 | |||
356 | elseif event == "CHAT_MSG_BG_SYSTEM_ALLIANCE" or event == "CHAT_MSG_BG_SYSTEM_HORDE" then |
||
357 | if (lrLocale.BGWGTEXT0) then |
||
358 | if string.find(GetZoneText(), lrLocale.BGWGTEXT0) then |
||
359 | if lazyr.re(arg1,string.format(lrLocale.BGWGTEXT1,UnitFactionGroup("player"))) then |
||
360 | lazyr.flagHolder = lazyr.match1 |
||
361 | lazyr.d(tostring("|cffe5e519WG Flag Holder: "..lazyr.flagHolder)) |
||
362 | elseif string.find(arg1,string.format(lrLocale.BGWGTEXT2,UnitFactionGroup("player"))) or string.find(arg1,string.format(lrLocale.BGWGTEXT3,UnitFactionGroup("player"))) or string.find(arg1,string.format(lrLocale.BGWGTEXT4,UnitFactionGroup("player"))) then |
||
363 | lazyr.d(tostring("|cffe5e519WG Flag Holder: Empty")) |
||
364 | lazyr.flagHolder = "" |
||
365 | end |
||
366 | end |
||
367 | end |
||
368 | |||
369 | elseif (event == "CHAT_MSG_COMBAT_SELF_HITS") then |
||
370 | if lazyr.ganked==nil then |
||
371 | lazyr.ganked = false |
||
372 | end |
||
373 | |||
374 | elseif (event == "PLAYER_ENTER_COMBAT") then |
||
375 | lazyr.ResetEveryTimers() |
||
376 | elseif (event == "PLAYER_LEAVE_COMBAT") then |
||
377 | --do nothing |
||
378 | elseif (event == "PLAYER_TARGET_CHANGED") then |
||
379 | lazyr.interrupt.targetCasting = nil |
||
380 | lazyr.ResetEveryTimers() |
||
381 | lazyr.targetHealthHistory:Reset() |
||
382 | elseif (event == "PLAYER_REGEN_DISABLED") then |
||
383 | lazyr.isInCombat = true |
||
384 | lazyr.minion.OnUpdate() -- force refresh, in case it's hidden |
||
385 | lazyr.deathstimator.minion.OnUpdate() -- force refresh, in case it's hidden |
||
386 | |||
387 | elseif (event == "PLAYER_REGEN_ENABLED") then |
||
388 | lazyr.isInCombat = false |
||
389 | lazyr.minion.SetText(lazyr.perPlayerConf.defaultForm) |
||
390 | lazyr.deathstimator.minion.SetText("Deathstimator") |
||
391 | |||
392 | if lazyr.numberOfAttackers ~= 0 then |
||
393 | if lazyr.ganked==true then |
||
394 | if lrLocale.GANKED~=nil then |
||
395 | lazyr.p(tostring("|cffe5e519"..string.format(lrLocale.GANKED,lazyr.lastAttacker,lazyr.numberOfAttackers))) |
||
396 | end |
||
397 | else |
||
398 | lazyr.d(tostring("|cffe5e519PVP Opponents:"..lazyr.lastAttacker.." Count:"..lazyr.numberOfAttackers)) |
||
399 | end |
||
400 | end |
||
401 | lazyr.lastAttacker = "" |
||
402 | lazyr.numberOfAttackers = 0 |
||
403 | lazyr.ganked=nil |
||
404 | |||
405 | elseif (event == "ACTIONBAR_SLOT_CHANGED") then |
||
406 | lazyr.DeCacheActionSlotIds() |
||
407 | lazyr.attackSlot = nil |
||
408 | lazyr.globalCooldownSlot = nil |
||
409 | |||
410 | elseif (event == "SPELLS_CHANGED") then |
||
411 | lazyr.DeCacheActionRanks() |
||
412 | elseif (event == "UI_ERROR_MESSAGE") then |
||
413 | if (arg1 == SPELL_FAILED_NOT_BEHIND) then |
||
414 | lazyr.d("I see your behind-only attack just failed, will wait to use it again.") |
||
415 | lazyr.behindAttackLastFailedAt = GetTime() |
||
416 | elseif (arg1 == SPELL_FAILED_NOT_INFRONT) then |
||
417 | lazyr.d("I see your infront-only attack just failed, will wait to use it again.") |
||
418 | lazyr.inFrontAttackLastFailedAt = GetTime() |
||
419 | end |
||
420 | |||
421 | elseif (event == "UNIT_ENERGY") then |
||
422 | if (arg1 == "player") then |
||
423 | local currentEnergy = UnitMana("player") |
||
424 | if (currentEnergy > lazyr.latestEnergy) then |
||
425 | -- a tick |
||
426 | lazyr.lastTickTime = GetTime() |
||
427 | --lazyr.d("ENERGY TICK: "..lazyr.lastTickTime) |
||
428 | end |
||
429 | lazyr.latestEnergy = currentEnergy |
||
430 | end |
||
431 | |||
432 | elseif (event == "UNIT_HEALTH") then |
||
433 | lazyr.deathstimator.OnUnitHealth(arg1) |
||
434 | |||
435 | elseif (event == "CHAT_MSG_SPELL_SELF_DAMAGE") then |
||
436 | if string.find(arg1, lrLocale.EVISCERATE_HIT ) then |
||
437 | lazyr.et.TrackEviscerates(arg1) |
||
438 | end |
||
439 | if (lrLocale.IMMUNE) then |
||
440 | if string.find(arg1, lrLocale.IMMUNE ) then |
||
441 | lazyr.WatchForImmunes(arg1) |
||
442 | end |
||
443 | end |
||
444 | |||
445 | elseif (event == "CHAT_MSG_COMBAT_HOSTILEPLAYER_HITS" or |
||
446 | event == "CHAT_MSG_SPELL_CREATURE_VS_CREATURE_DAMAGE" or |
||
447 | event == "CHAT_MSG_SPELL_CREATURE_VS_CREATURE_BUFF" or |
||
448 | event == "CHAT_MSG_SPELL_HOSTILEPLAYER_DAMAGE" or |
||
449 | event == "CHAT_MSG_SPELL_HOSTILEPLAYER_BUFF") then |
||
450 | |||
451 | -- have to lump these two together since |
||
452 | -- CHAT_MSG_SPELL_HOSTILEPLAYER_DAMAGE is used by both attacker |
||
453 | -- tracking and PvP kick support. |
||
454 | |||
455 | if (event == "CHAT_MSG_COMBAT_HOSTILEPLAYER_HITS" or |
||
456 | event == "CHAT_MSG_SPELL_HOSTILEPLAYER_DAMAGE") then |
||
457 | |||
458 | if (lrLocale.GANKED_CHATS) then |
||
459 | for idx, regex in lrLocale.GANKED_CHATS do |
||
460 | if (lazyr.re(arg1, regex)) then |
||
461 | if lazyr.ganked==nil then |
||
462 | lazyr.ganked = true |
||
463 | end |
||
464 | player = lazyr.match1 |
||
465 | |||
466 | if not(string.find(lazyr.lastAttacker," "..player..",")) then |
||
467 | lazyr.numberOfAttackers = lazyr.numberOfAttackers + 1 |
||
468 | lazyr.lastAttacker = lazyr.lastAttacker.." "..player.."," |
||
469 | end |
||
470 | end |
||
471 | end |
||
472 | end |
||
473 | end |
||
474 | |||
475 | if (event == "CHAT_MSG_SPELL_CREATURE_VS_CREATURE_DAMAGE" or |
||
476 | event == "CHAT_MSG_SPELL_CREATURE_VS_CREATURE_BUFF" or |
||
477 | event == "CHAT_MSG_SPELL_HOSTILEPLAYER_DAMAGE" or |
||
478 | event == "CHAT_MSG_SPELL_HOSTILEPLAYER_BUFF") then |
||
479 | lazyr.interrupt.OnChatMsgSpell(arg1) |
||
480 | end |
||
481 | |||
482 | else |
||
483 | lazyr.d("Unhandled event: "..event..": ") |
||
484 | end |
||
485 | end |
||
486 | |||
487 | function lazyr.Help() |
||
488 | lazyr.chat("LazyRogue v"..lazyr.version..".") |
||
489 | lazyr.chat("/lazyrogue do <attack1> [<attack2> ...]") |
||
490 | lazyr.chat("/lazyrogue list") |
||
491 | lazyr.chat("/lazyrogue edit <formName>") |
||
492 | lazyr.chat("/lazyrogue set <formName> <attack1> [<attack2> ...]") |
||
493 | lazyr.chat("/lazyrogue copy <formName> <formName2>") |
||
494 | lazyr.chat("/lazyrogue clear <formName>") |
||
495 | lazyr.chat("/lazyrogue default [<formName>]") |
||
496 | lazyr.chat("/lazyrogue [<formName>]") |
||
497 | lazyr.chat("/lazyrogue summon") |
||
498 | lazyr.chat("/lazyrogue dismiss") |
||
499 | lazyr.chat("/lazyrogue hideMinionOutOfCombat") |
||
500 | lazyr.chat("/lazyrogue summonDeath") |
||
501 | lazyr.chat("/lazyrogue dismissDeath") |
||
502 | lazyr.chat("/lazyrogue hideDeathMinionOutOfCombat") |
||
503 | lazyr.chat("/lazyrogue mmshow") |
||
504 | lazyr.chat("/lazyrogue mmhide") |
||
505 | lazyr.chat("/lazyrogue useEviscerateTracking") |
||
506 | lazyr.chat("/lazyrogue resetEviscerateStats") |
||
507 | lazyr.chat("/lazyrogue interruptExceptionCriteria") |
||
508 | lazyr.chat("/lazyrogue noLongerInterruptLastInterrupted") |
||
509 | lazyr.chat("/lazyrogue showTargetCasts") |
||
510 | lazyr.chat("/lazyrogue autoTarget") |
||
511 | lazyr.chat("/lazyrogue initiateAutoAttack") |
||
512 | lazyr.chat("/lazyrogue about") |
||
513 | lazyr.chat("/lazyrogue help") |
||
514 | lazyr.chat("/lazyrogue assist <playername>") |
||
515 | lazyr.chat("/lazyrogue useImmunitiesList") |
||
516 | lazyr.chat("/lazyrogue clearImmunitiesList") |
||
517 | lazyr.chat("/lazyrogue showImmunitiesList") |
||
518 | |||
519 | end |
||
520 | |||
521 | function lazyr.ListForms() |
||
522 | -- sigh, table.sort() sorts the values, no way to sort by keys... |
||
523 | local formNames = {} |
||
524 | for form, actions in lrConf.forms do |
||
525 | table.insert(formNames, form) |
||
526 | end |
||
527 | |||
528 | table.sort(formNames) |
||
529 | |||
530 | for idx, formName in formNames do |
||
531 | local name = formName |
||
532 | local actions = lrConf.forms[formName] |
||
533 | |||
534 | if (lazyr.perPlayerConf.defaultForm and formName == lazyr.perPlayerConf.defaultForm) then |
||
535 | name = "*"..name |
||
536 | end |
||
537 | lazyr.chat(name..": "..table.concat(actions, ' ')) |
||
538 | end |
||
539 | end |
||
540 | |||
541 | function lazyr.SlashCommand(line) |
||
542 | if (not line) then |
||
543 | line = "" |
||
544 | end |
||
545 | local args = lazyr.SplitArgs(line) |
||
546 | local cmd = args[1] |
||
547 | table.remove(args, 1) |
||
548 | |||
549 | if (cmd == "help") then |
||
550 | lazyr.Help() |
||
551 | |||
552 | elseif (cmd == "about") then |
||
553 | LazyRogueAboutFrame:Show() |
||
554 | |||
555 | elseif (cmd == "debug") then |
||
556 | if (lazyr.perPlayerConf.debug) then |
||
557 | lazyr.perPlayerConf.debug = false |
||
558 | lazyr.p("Debugging off.") |
||
559 | else |
||
560 | lazyr.perPlayerConf.debug = true |
||
561 | lazyr.p("Debugging on.") |
||
562 | end |
||
563 | |||
564 | elseif (cmd == "list") then |
||
565 | lazyr.ListForms() |
||
566 | |||
567 | elseif (cmd == "edit") then |
||
568 | local form = args[1] |
||
569 | LazyRogueFormEditFrame:Hide() |
||
570 | lazyr.lreb.currentForm = form |
||
571 | LazyRogueFormScrollFrame:SetWidth(LazyRogueFormEditFrame:GetWidth()-50); |
||
572 | LazyRogueFormEditFrameForm:SetWidth(LazyRogueFormScrollFrame:GetWidth()-50); |
||
573 | LazyRogueFormScrollFrame:SetHeight(LazyRogueFormEditFrame:GetHeight()-110); |
||
574 | LazyRogueFormEditFrameForm:SetHeight(LazyRogueFormScrollFrame:GetHeight()-110); |
||
575 | LazyRogueFormEditFrame:Show() |
||
576 | |||
577 | elseif (cmd == "set") then |
||
578 | local form = args[1] |
||
579 | table.remove(args, 1) |
||
580 | local verb |
||
581 | if (lrConf.forms[form]) then |
||
582 | verb = "updated" |
||
583 | else |
||
584 | verb = "created" |
||
585 | end |
||
586 | lrConf.forms[form] = args |
||
587 | lazyr.ClearParsedForm(form) |
||
588 | lazyr.p("Form "..form.." "..verb..".") |
||
589 | lazyr.ParseForm(args) |
||
590 | |||
591 | elseif (cmd == "copy") then |
||
592 | local form1 = args[1] |
||
593 | local form2 = args[2] |
||
594 | --lrConf.forms[form2] = form1 |
||
595 | if (not lrConf.forms[form1]) then |
||
596 | lazyr.p("Form "..form1.." doesn't exist.") |
||
597 | return false |
||
598 | end |
||
599 | -- I'm not sure exactly how lua works.. but I think I can't just |
||
600 | -- point form2 to form1's actions, because it's by reference, and |
||
601 | -- then any changes to form1 would affect form2. So copy... |
||
602 | local newActions = {} |
||
603 | for idx, action in lrConf.forms[form1] do |
||
604 | table.insert(newActions, action) |
||
605 | end |
||
606 | lrConf.forms[form2] = newActions |
||
607 | lazyr.p("Form "..form1.." copied to form "..form2..".") |
||
608 | |||
609 | elseif (cmd == "clear") then |
||
610 | local form = args[1] |
||
611 | -- destroy this form entry |
||
612 | -- this is how you do it in Lua, just set its value to nil |
||
613 | lrConf.forms[form] = nil |
||
614 | lazyr.ClearParsedForm(form) |
||
615 | lazyr.p("Form "..form.." removed.") |
||
616 | if (lazyr.perPlayerConf.defaultForm == form) then |
||
617 | if (lrConf.forms.lr) then |
||
618 | lazyr.perPlayerConf.defaultForm = "lr" |
||
619 | lazyr.p("Default form is now lazyr.") |
||
620 | else |
||
621 | lazyr.perPlayerConf.defaultForm = nil |
||
622 | lazyr.p("WARNING: you no longer have a default form. Choose one from the LR minimap bubble.") |
||
623 | end |
||
624 | end |
||
625 | |||
626 | elseif (cmd == "do") then |
||
627 | local actions = lazyr.ParseForm(args) |
||
628 | if (actions) then |
||
629 | lazyr.TryActions(actions) |
||
630 | end |
||
631 | |||
632 | elseif (cmd == "autoTarget") then |
||
633 | if (lazyr.perPlayerConf.autoTarget) then |
||
634 | lazyr.perPlayerConf.autoTarget = false |
||
635 | lazyr.p("LazyRogue will no longer auto-target.") |
||
636 | -- turning off autotargeting also means turning off initiating auto-attack |
||
637 | if (lazyr.perPlayerConf.initiateAutoAttack) then |
||
638 | lazyr.SlashCommand("initiateAutoAttack") |
||
639 | end |
||
640 | else |
||
641 | lazyr.perPlayerConf.autoTarget = true |
||
642 | lazyr.p("LazyRogue will now auto-target.") |
||
643 | end |
||
644 | |||
645 | elseif (cmd == "initiateAutoAttack") then |
||
646 | if (lazyr.perPlayerConf.initiateAutoAttack) then |
||
647 | lazyr.perPlayerConf.initiateAutoAttack = false |
||
648 | lazyr.p("LazyRogue will no longer initiate auto-attack.") |
||
649 | else |
||
650 | lazyr.perPlayerConf.initiateAutoAttack = true |
||
651 | lazyr.p("LazyRogue will now initiate auto-attack.") |
||
652 | end |
||
653 | |||
654 | elseif (cmd == "showImmunitiesList") then |
||
655 | lazyr.p("Current Immunities List...") |
||
656 | for action in lazyr.perPlayerConf.Immunities do |
||
657 | for mob in lazyr.perPlayerConf.Immunities[action] do |
||
658 | lazyr.p("Action ["..action.."] Immune To ["..mob.."]") |
||
659 | end |
||
660 | end |
||
661 | |||
662 | elseif (cmd == "useImmunitiesList") then |
||
663 | if (lazyr.perPlayerConf.useImmunities) then |
||
664 | lazyr.perPlayerConf.useImmunities = false |
||
665 | lazyr.p("LazyRogue will no longer check for immunities.") |
||
666 | else |
||
667 | lazyr.perPlayerConf.useImmunities = true |
||
668 | lazyr.p("LazyRogue will now check for immunities.") |
||
669 | end |
||
670 | |||
671 | elseif (cmd == "clearImmunitiesList") then |
||
672 | lazyr.perPlayerConf.Immunities = {} |
||
673 | lazyr.p("Immunities list cleared.") |
||
674 | |||
675 | elseif (cmd == "summon") then |
||
676 | lazyr.perPlayerConf.minionIsVisible = true |
||
677 | LazyRogueMinionFrame:Show() |
||
678 | lazyr.p("Now showing the minion.") |
||
679 | |||
680 | elseif (cmd == "dismiss") then |
||
681 | lazyr.perPlayerConf.minionIsVisible = false |
||
682 | LazyRogueMinionFrame:Hide() |
||
683 | lazyr.p("Hiding the minion.") |
||
684 | |||
685 | elseif (cmd == "hideMinionOutOfCombat") then |
||
686 | if (lazyr.perPlayerConf.minionHidesOutOfCombat) then |
||
687 | lazyr.perPlayerConf.minionHidesOutOfCombat = false |
||
688 | LazyRogueMinionFrame:Show() |
||
689 | lazyr.p("Minion will no longer hide out of combat.") |
||
690 | else |
||
691 | lazyr.perPlayerConf.minionHidesOutOfCombat = true |
||
692 | lazyr.p("Minion will now hide out of combat.") |
||
693 | end |
||
694 | |||
695 | elseif (cmd == "summonDeath") then |
||
696 | lazyr.perPlayerConf.deathMinionIsVisible = true |
||
697 | LazyRogueDeathstimatorFrame:Show() |
||
698 | lazyr.p("Now showing the deathstimator minion.") |
||
699 | |||
700 | elseif (cmd == "dismissDeath") then |
||
701 | lazyr.perPlayerConf.deathMinionIsVisible = false |
||
702 | LazyRogueDeathstimatorFrame:Hide() |
||
703 | lazyr.p("Hiding the deathstimator minion.") |
||
704 | |||
705 | elseif (cmd == "hideDeathMinionOutOfCombat") then |
||
706 | if (lazyr.perPlayerConf.deathMinionHidesOutOfCombat) then |
||
707 | lazyr.perPlayerConf.deathMinionHidesOutOfCombat = false |
||
708 | LazyRogueDeathstimatorFrame:Show() |
||
709 | lazyr.p("Death minion will no longer hide out of combat.") |
||
710 | else |
||
711 | lazyr.perPlayerConf.deathMinionHidesOutOfCombat = true |
||
712 | lazyr.p("Death minion will now hide out of combat.") |
||
713 | end |
||
714 | |||
715 | elseif (cmd == "showReasonForTargetCCd") then |
||
716 | if (lazyr.perPlayerConf.showReasonForTargetCCd) then |
||
717 | lazyr.perPlayerConf.showReasonForTargetCCd = false |
||
718 | lazyr.p("No longer showing why LR thinks a target is CCd") |
||
719 | else |
||
720 | lazyr.perPlayerConf.showReasonForTargetCCd = true |
||
721 | lazyr.p("Now showing why LR thinks a target is CCd") |
||
722 | end |
||
723 | |||
724 | elseif (cmd == "mmshow") then |
||
725 | lazyr.perPlayerConf.mmIsVisible = true |
||
726 | LazyRogueMinimapFrame:Show() |
||
727 | LazyRogueMinimapButton:Show() |
||
728 | |||
729 | elseif (cmd == "mmhide") then |
||
730 | lazyr.perPlayerConf.mmIsVisible = false |
||
731 | LazyRogueMinimapFrame:Hide() |
||
732 | LazyRogueMinimapButton:Hide() |
||
733 | |||
734 | elseif (cmd == "resetEviscerateStats") then |
||
735 | lazyr.et.ResetEviscTracking() |
||
736 | |||
737 | elseif (cmd == "useEviscerateTracking") then |
||
738 | if (lazyr.perPlayerConf.useEviscTracking) then |
||
739 | lazyr.perPlayerConf.useEviscTracking = false |
||
740 | lazyr.p("No longer using Eviscerate tracking.") |
||
741 | else |
||
742 | lazyr.perPlayerConf.useEviscTracking = true |
||
743 | lazyr.p("Now using Eviscerate tracking.") |
||
744 | end |
||
745 | |||
746 | elseif (cmd == "trackEviscCrits") then |
||
747 | if (lazyr.perPlayerConf.trackEviscCrits) then |
||
748 | lazyr.perPlayerConf.trackEviscCrits = false |
||
749 | lazyr.p("No longer tracking Eviscerate crits.") |
||
750 | else |
||
751 | lazyr.perPlayerConf.trackEviscCrits = true |
||
752 | lazyr.p("Now tracking Eviscerate crits.") |
||
753 | end |
||
754 | |||
755 | elseif (cmd == "interruptExceptionCriteria") then |
||
756 | LazyRogueInterruptExceptionCriteriaEditFrame:Show() |
||
757 | |||
758 | elseif (cmd == "noLongerInterruptLastInterrupted") then |
||
759 | if (not lazyr.interrupt.lastSpellInterrupted) then |
||
760 | lazyr.p("You haven't interrupted anything recently.") |
||
761 | else |
||
762 | local lastInterrupted = string.gsub(lazyr.interrupt.lastSpellInterrupted, |
||
763 | "([%^%$%(%)%%%.%[%]%*%+%-%?])", "%%%1") |
||
764 | lastInterrupted = string.gsub(lastInterrupted, "%s", "%%s") |
||
765 | local criteria = "-ifTargetIsCasting=^"..lastInterrupted.."$" |
||
766 | table.insert(lrConf.interruptExceptionCriteria, criteria) |
||
767 | lazyr.p("Added new exception ("..criteria..") to global interrupt criteria.") |
||
768 | end |
||
769 | |||
770 | elseif (cmd == "showTargetCasts") then |
||
771 | if (lazyr.perPlayerConf.showTargetCasts) then |
||
772 | lazyr.perPlayerConf.showTargetCasts = false |
||
773 | lazyr.p("No longer showing when the target casts.") |
||
774 | else |
||
775 | lazyr.perPlayerConf.showTargetCasts = true |
||
776 | lazyr.p("Now showing when the target casts.") |
||
777 | end |
||
778 | |||
779 | elseif (cmd == "assist") then |
||
780 | if UnitIsPlayer("target") and UnitIsFriend("target","player") and UnitName("target")~=UnitName("player") then |
||
781 | if UnitName("target") then |
||
782 | lazyr.assistName = UnitName("target") |
||
783 | if lazyr.masks.PlayerInRaid() then |
||
784 | SendChatMessage("Assist set to "..UnitName("target"), "Raid"); |
||
785 | elseif lazyr.masks.PlayerInGroup() then |
||
786 | SendChatMessage("Assist set to "..UnitName("target"), "Party"); |
||
787 | else |
||
788 | SendChatMessage("Assist set to "..UnitName("target"), "Say"); |
||
789 | end |
||
790 | else |
||
791 | lazyr.assistName = args[2] |
||
792 | lazyr.p("Assist set to "..UnitName("target")) |
||
793 | end |
||
794 | else |
||
795 | lazyr.p("Target Assist Not Set!") |
||
796 | end |
||
797 | |||
798 | elseif (cmd == "default") then |
||
799 | local form = args[1] |
||
800 | if (form) then |
||
801 | local actions = lazyr.FindForm(form) |
||
802 | if (not actions) then |
||
803 | lazyr.p("Form "..form.." not found.") |
||
804 | return false |
||
805 | end |
||
806 | lazyr.perPlayerConf.defaultForm = form |
||
807 | lazyr.p("Default form is now "..form) |
||
808 | else |
||
809 | lazyr.p("Default form is "..lazyr.nonil(lazyr.perPlayerConf.defaultForm)) |
||
810 | end |
||
811 | lazyr.minion.SetText(lazyr.perPlayerConf.defaultForm) |
||
812 | |||
813 | elseif (not cmd or cmd == "") then |
||
814 | if (not lazyr.perPlayerConf.defaultForm) then |
||
815 | lazyr.p("No default form assigned, use /lazyrogue default <form> to set one.") |
||
816 | return false |
||
817 | end |
||
818 | local actions = lazyr.FindParsedForm(lazyr.perPlayerConf.defaultForm) |
||
819 | if (not actions) then |
||
820 | lazyr.p("Your default form is "..lazyr.perPlayerConf.defaultForm..", but it doesn't exist! Please choose a form from the LR bubble.") |
||
821 | return false |
||
822 | end |
||
823 | lazyr.TryActions(actions) |
||
824 | |||
825 | else |
||
826 | local actions = lazyr.FindParsedForm(cmd) |
||
827 | if (not actions) then |
||
828 | lazyr.p("Form "..cmd.." not found. Try /lazyrogue help for help.") |
||
829 | return false |
||
830 | end |
||
831 | if (actions) then |
||
832 | lazyr.TryActions(actions) |
||
833 | end |
||
834 | |||
835 | end |
||
836 | end |
||
837 | |||
838 | -- previous API for compatibility |
||
839 | function LazyRogue() |
||
840 | lazyr.SlashCommand() |
||
841 | end |
||
842 |