-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathWeaponSwingTimer_Core.lua
719 lines (695 loc) · 23.2 KB
/
WeaponSwingTimer_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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
local addon_name, addon_data = ...
local L = addon_data.localization_table
addon_data.core = {}
addon_data.core.core_frame = CreateFrame("Frame", addon_name .. "CoreFrame", UIParent)
addon_data.core.core_frame:RegisterEvent("ADDON_LOADED")
addon_data.core.all_timers = {
addon_data.player, addon_data.target
}
local version = "4.1.0"
local load_message = L["Thank you for installing WeaponSwingTimer Version"] .. " " .. version ..
" " .. L["by LeftHandedGlove! Use |cFFFFC300/wst|r for more options."]
addon_data.core.default_settings = {
one_frame = false
}
addon_data.core.in_combat = false
local swing_reset_spells = {}
swing_reset_spells['DRUID'] = {
-- --[[ Abolish Poison ]] 2893,
-- --[[ Aquatic Form ]] 1066,
-- --[[ Barkskin ]] 22812,
-- --[[ Bash ]] 5211, 6798, 8983,
-- --[[ Bear Form ]] 5487,
-- --[[ Cat Form ]] 768,
-- --[[ Challenging Roar ]] 5209,
-- --[[ Claw ]] 1082, 3029, 5201, 9849, 9850,
-- --[[ Cower ]] 8998, 9000, 9892,
-- --[[ Cure Poison ]] 8946,
-- --[[ Dash ]] 1850, 9821,
-- --[[ Demoralizing Roar ]] 99, 1735, 9490, 9747, 9898,
-- --[[ Dire Bear Form ]] 9634,
-- --[[ Enrage ]] 5229,
-- --[[ Entangling Roots ]] 339, 1062, 5195, 5196, 9852, 9853,
-- --[[ Faerie Fire ]] 770, 778, 9749, 9907,
-- --[[ Faerie Fire (Feral) ]] 16857, 17390, 17391, 17392,
-- --[[ Feral Charge ]] 16979,
-- --[[ Ferocious Bite ]] 22568, 22827, 22828, 22829, 31018,
-- --[[ Frenzied Regeneration ]]
-- --[[ Gift of the Wild ]]
-- --[[ Growl ]]
-- --[[ Healing Touch ]]
-- --[[ Hibernate ]]
-- --[[ Hurricane ]]
-- --[[ Innervate ]]
-- --[[ Insect Storm ]]
-- --[[ Mark of the Wild ]]
--[[ Maul ]] 6807, 6808, 6809, 8972, 9745, 9880, 9881
-- --[[ Moonfire ]]
-- --[[ Moonkin Form ]]
-- --[[ Nature's Grasp ]]
-- --[[ Nature's Swiftness ]]
-- --[[ Omen of Clarity ]]
-- --[[ Pounce ]]
-- --[[ Prowl ]]
-- --[[ Rake ]]
-- --[[ Ravage ]]
-- --[[ Rebirth ]]
-- --[[ Regrowth ]]
-- --[[ Rejuvenation ]]
-- --[[ Remove Curse ]]
-- --[[ Rip ]]
-- --[[ Shred ]]
-- --[[ Soothe Animal ]]
-- --[[ Starfire ]]
-- --[[ Swiftmend ]]
-- --[[ Swipe ]]
-- --[[ Teleport: Moonglade ]]
-- --[[ Thorns ]]
-- --[[ Tiger's Fury ]]
-- --[[ Track Humanoids ]]
-- --[[ Tranquility ]]
-- --[[ Travel Form ]]
-- --[[ Wrath ]]
}
swing_reset_spells['HUNTER'] = {
-- --[[ Aimed Shot ]]
-- --[[ Arcane Shot ]]
-- --[[ Aspect of the Beast ]]
-- --[[ Aspect of the Cheetah ]]
-- --[[ Aspect of the Hawk ]]
-- --[[ Aspect of the Monkey ]]
-- --[[ Aspect of the Pack ]]
-- --[[ Aspect of the Wild ]]
-- --[[ Auto Shot ]]
-- --[[ Beast Lore ]]
-- --[[ Bestial Wrath ]]
-- --[[ Call Pet ]]
-- --[[ Concussive Shot ]]
-- --[[ Counterattack ]]
-- --[[ Deterrence ]]
-- --[[ Disengage ]]
-- --[[ Dismiss Pet ]]
-- --[[ Distracting Shot ]]
-- --[[ Eagle Eye ]]
-- --[[ Explosive Trap ]]
-- --[[ Eyes of the Beast ]]
-- --[[ Feed Pet ]]
-- --[[ Feign Death ]]
-- --[[ Flare ]]
-- --[[ Freezing Trap ]]
-- --[[ Frost Trap ]]
-- --[[ Hunter's Mark ]]
-- --[[ Immolation Trap ]]
-- --[[ Intimidation ]]
-- --[[ Mend Pet ]]
-- --[[ Mongoose Bite ]]
-- --[[ Multi-Shot ]]
-- --[[ Rapid Fire ]]
--[[ Raptor Strike ]] 2973, 14260, 14261, 14262, 14263, 14264, 14265, 14266,
-- --[[ Readiness ]]
-- --[[ Revive Pet ]]
-- --[[ Scare Beast ]]
-- --[[ Scatter Shot ]]
-- --[[ Scorpid Sting ]]
-- --[[ Serpent Sting ]]
-- --[[ Tame Beast ]]
-- --[[ Throw ]]
-- --[[ Track Beast ]]
-- --[[ Track Demons ]]
-- --[[ Track Dragonkin ]]
-- --[[ Track Elements ]]
-- --[[ Track Giants ]]
-- --[[ Track Hidden ]]
-- --[[ Track Humanoids ]]
-- --[[ Track Undead ]]
-- --[[ Tranquilizing Shot ]]
-- --[[ Trueshot Aura ]]
-- --[[ Viper Sting ]]
-- --[[ Volley ]]
-- --[[ Wing Clip ]]
-- --[[ Wyvern Sting ]]
}
swing_reset_spells['MAGE'] = {
-- --[[ Amplify Magic ]]
-- --[[ Arcane Brilliance ]]
-- --[[ Arcane Explosion ]]
-- --[[ Arcane Intellect ]]
-- --[[ Arcane Missles ]]
-- --[[ Arcane Power ]]
-- --[[ Blast Wave ]]
-- --[[ Blink ]]
-- --[[ Blizzard ]]
-- --[[ Cold Snap ]]
-- --[[ Combustion ]]
-- --[[ Cone of Cold ]]
-- --[[ Counterspell ]]
-- --[[ Dampen Magic ]]
-- --[[ Detect Magic ]]
-- --[[ Evocation ]]
-- --[[ Fire Blast ]]
-- --[[ Fire Ward ]]
-- --[[ Fireball ]]
-- --[[ Flamestrike ]]
-- --[[ Frost Armor ]]
-- --[[ Frost Nova ]]
-- --[[ Frost Ward ]]
-- --[[ Frostbolt ]]
-- --[[ Ice Armor ]]
-- --[[ Ice Barrier ]]
-- --[[ Ice Block ]]
-- --[[ Mage Armor ]]
-- --[[ Mana Shield ]]
-- --[[ Polymorph ]]
-- --[[ Polymorph: Cow ]]
-- --[[ Polymorph: Pig ]]
-- --[[ Polymorph: Turtle ]]
-- --[[ Portal: Darnassus ]]
-- --[[ Portal: Ironforge ]]
-- --[[ Portal: Orgimmar ]]
-- --[[ Portal: Stormwind ]]
-- --[[ Portal: Thunder Bluff ]]
-- --[[ Portal: Undercity ]]
-- --[[ Presence of Mind ]]
-- --[[ Pyroblast ]]
-- --[[ Remove Lesser Curse ]]
-- --[[ Scorch ]]
-- --[[ Shoot ]]
-- --[[ Slow Fall ]]
-- --[[ Teleport: Darnassus ]]
-- --[[ Teleport: Ironforge ]]
-- --[[ Teleport: Orgimmar ]]
-- --[[ Teleport: Stormwind ]]
-- --[[ Teleport: Thunder Bluff ]]
-- --[[ Teleport: Undercity ]]
-- --[[ Conjure Food ]]
-- --[[ Conjure Mana Agate ]]
-- --[[ Conjure Mana Citrine ]]
-- --[[ Conjure Mana Jade ]]
-- --[[ Conjure Mana Ruby ]]
-- --[[ Conjure Water ]]
}
swing_reset_spells['PALADIN'] = {
-- --[[ Blessing of Freedom ]]
-- --[[ Blessing of Kings ]]
-- --[[ Blessing of Light ]]
-- --[[ Blessing of Might ]]
-- --[[ Blessing of Protection ]]
-- --[[ Blessing of Sacrifice ]]
-- --[[ Blessing of Salvation ]]
-- --[[ Blessing of Sanctuary ]]
-- --[[ Blessing of Wisdom ]]
-- --[[ Cleanse ]]
-- --[[ Concentration Aura ]]
-- --[[ Consecration ]]
-- --[[ Devotion Aura ]]
-- --[[ Divine Favor ]]
-- --[[ Divine Intervention ]]
-- --[[ Divine Protection ]]
-- --[[ Divine Shield ]]
-- --[[ Exorcism ]]
-- --[[ Fire Resistance Aura ]]
-- --[[ Flash of Light ]]
-- --[[ Frost Resistance Aura ]]
-- --[[ Greater Blessing of Kings ]]
-- --[[ Greater Blessing of Light ]]
-- --[[ Greater Blessing of Might ]]
-- --[[ Greater Blessing of Salvation ]]
-- --[[ Greater Blessing of Sanctuary ]]
-- --[[ Greater Blessing of Wisdom ]]
-- --[[ Hammer of Justice ]]
-- --[[ Hammer of Wrath ]]
-- --[[ Holy Light ]]
-- --[[ Holy Shield ]]
-- --[[ Holy Shock ]]
-- --[[ Holy Wrath ]]
-- --[[ Judgement ]]
-- --[[ Lay on Hands ]]
-- --[[ Purify ]]
-- --[[ Redemption ]]
-- --[[ Repentance ]]
-- --[[ Retribution Aura ]]
-- --[[ Righteous Fury ]]
-- --[[ Sanctity Aura ]]
-- --[[ Seal of Command ]]
-- --[[ Seal of Justice ]]
-- --[[ Seal of Light ]]
-- --[[ Seal of Righteousness ]]
-- --[[ Seal of the Crusader ]]
-- --[[ Seal of Wisdom ]]
-- --[[ Sense Undead ]]
-- --[[ Shadow Resistance Aura ]]
-- --[[ Summon Charger ]]
-- --[[ Summon Warhorse ]]
-- --[[ Turn Undead ]]
}
swing_reset_spells['PRIEST'] = {
-- --[[ Abolish Disease ]]
-- --[[ Cure Disease ]]
-- --[[ Desperate Prayer ]]
-- --[[ Devouring Plague ]]
-- --[[ Dispel Magic ]]
-- --[[ Divine Spirit ]]
-- --[[ Fade ]]
-- --[[ Fear Ward ]]
-- --[[ Feedback ]]
-- --[[ Flash Heal ]]
-- --[[ Greater Heal ]]
-- --[[ Heal ]]
-- --[[ Hex of Weakness ]]
-- --[[ Holy Fire ]]
-- --[[ Holy Nova ]]
-- --[[ Inner Fire ]]
-- --[[ Inner Focus ]]
-- --[[ Lesser Heal ]]
-- --[[ Levitate ]]
-- --[[ Lightwell ]]
-- --[[ Mana Burn ]]
-- --[[ Mind Blast ]]
-- --[[ Mind Control ]]
-- --[[ Mind Flay ]]
-- --[[ Mind Soothe ]]
-- --[[ Mind Vision ]]
-- --[[ Power Infusion ]]
-- --[[ Power Word: Fortitude ]]
-- --[[ Power Word: Shield ]]
-- --[[ Prayer of Fortitude ]]
-- --[[ Prayer of Healing ]]
-- --[[ Prayer of Shadow Protection ]]
-- --[[ Prayer of Spirit ]]
-- --[[ Psychic Scream ]]
-- --[[ Renew ]]
-- --[[ Resurrection ]]
-- --[[ Shackle Undead ]]
-- --[[ Shadow Protection ]]
-- --[[ Shadow Word: Pain ]]
-- --[[ Shadowform ]]
-- --[[ Shadowguard ]]
-- --[[ Shoot ]]
-- --[[ Silence ]]
-- --[[ Smite ]]
-- --[[ Starshards ]]
-- --[[ Touch of Weakness ]]
-- --[[ Vampiric Embrace ]]
}
swing_reset_spells['ROGUE'] = {
-- --[[ Adrenaline Rush ]]
-- --[[ Ambush ]]
-- --[[ Backstab ]]
-- --[[ Blade Flurry ]]
-- --[[ Blind ]]
-- --[[ Cheap Shot ]]
-- --[[ Cold Blood ]]
-- --[[ Detect Traps ]]
-- --[[ Disarm Trap ]]
-- --[[ Distract ]]
-- --[[ Evasion ]]
-- --[[ Eviscerate ]]
-- --[[ Expose Armor ]]
-- --[[ Feint ]]
-- --[[ Garrote ]]
-- --[[ Ghostly Strike ]]
-- --[[ Gouge ]]
-- --[[ Hemorrhage ]]
-- --[[ Kick ]]
-- --[[ Kidney Shot ]]
-- --[[ Pick Lock ]]
-- --[[ Pick Pocket ]]
-- --[[ Preparation ]]
-- --[[ Riposte ]]
-- --[[ Rupture ]]
-- --[[ Sap ]]
-- --[[ Shoot Bow ]]
-- --[[ Shoot Crossbow ]]
-- --[[ Shoot Gun ]]
-- --[[ Sinister Strike ]]
-- --[[ Slice and Dice ]]
-- --[[ Sprint ]]
-- --[[ Stealth ]]
-- --[[ Throw ]]
-- --[[ Vanish ]]
-- --[[ Blinding Powder ]]
-- --[[ Crippling Poison ]]
-- --[[ Crippling Poison II ]]
-- --[[ Deadly Poison ]]
-- --[[ Deadly Poison II ]]
-- --[[ Deadly Poison III ]]
-- --[[ Deadly Poison IV ]]
-- --[[ Deadly Poison V ]]
-- --[[ Instant Poison ]]
-- --[[ Instant Poison II ]]
-- --[[ Instant Poison III ]]
-- --[[ Instant Poison IV ]]
-- --[[ Instant Poison V ]]
-- --[[ Instant Poison VI ]]
-- --[[ Mind-numbing Poison ]]
-- --[[ Mind-numbing Poison II ]]
-- --[[ Mind-numbing Poison III ]]
-- --[[ Would Poison ]]
-- --[[ Would Poison II ]]
-- --[[ Would Poison III ]]
-- --[[ Would Poison IV ]]
}
swing_reset_spells['SHAMAN'] = {
-- --[[ Ancestral Spirit ]]
-- --[[ Astral Recall ]]
-- --[[ Chain Heal ]]
-- --[[ Chain Lightning ]]
-- --[[ Cure Disease ]]
-- --[[ Cure Poison ]]
-- --[[ Disease Cleansing Totem ]]
-- --[[ Earth Shock ]]
-- --[[ Earthbind Totem ]]
-- --[[ Elemental Mastery ]]
-- --[[ Farsight ]]
-- --[[ Fire Nova Totem ]]
-- --[[ Fire Resistance Totem ]]
-- --[[ Flame Shock ]]
-- --[[ Flametongue Totem ]]
-- --[[ Flametongue Weapon ]]
-- --[[ Frost Resistance Totem ]]
-- --[[ Frost Shock ]]
-- --[[ Frostbrand Weapon ]]
-- --[[ Ghost Wolf ]]
-- --[[ Grace of Air Totem ]]
-- --[[ Grounding Totem ]]
-- --[[ Healing Stream Totem ]]
-- --[[ Healing Wave ]]
-- --[[ Lesser Healing Wave ]]
-- --[[ Lightning Bolt ]]
-- --[[ Lightning Shield ]]
-- --[[ Magma Totem ]]
-- --[[ Mana Spring Totem ]]
-- --[[ Mana Tide Totem ]]
-- --[[ Nature Resistance Totem ]]
-- --[[ Nature's Swiftness ]]
-- --[[ Poison Cleansing Totem ]]
-- --[[ Purge ]]
-- --[[ Reincarnation ]]
-- --[[ Rockbiter Weapon ]]
-- --[[ Searing Totem ]]
-- --[[ Sentry Totem ]]
-- --[[ Stoneclaw Totem ]]
-- --[[ Stoneskin Totem ]]
-- --[[ Stormstrike ]]
-- --[[ Strength of Earth Totem ]]
-- --[[ Tranquil Air Totem ]]
-- --[[ Tremor Totem ]]
-- --[[ Water Breathing ]]
-- --[[ Water Walking ]]
-- --[[ Windfury Totem ]]
-- --[[ Windfury Weapon ]]
-- --[[ Windwall Totem ]]
}
swing_reset_spells['WARLOCK'] = {
-- --[[ Amplify Curse ]]
-- --[[ Banish ]]
-- --[[ Conflagrate ]]
-- --[[ Corruption ]]
-- --[[ Create Healthstone ]]
-- --[[ Create Healthstone (Greater) ]]
-- --[[ Create Healthstone (Lesser) ]]
-- --[[ Create Healthstone (Major) ]]
-- --[[ Create Healthstone (Minor) ]]
-- --[[ Curse of Agony ]]
-- --[[ Curse of Doom ]]
-- --[[ Curse of Exhaustion ]]
-- --[[ Curse of Recklessness ]]
-- --[[ Curse of Shadow ]]
-- --[[ Curse of the Elements ]]
-- --[[ Curse of Tongues ]]
-- --[[ Curse of Weakness ]]
-- --[[ Dark Pact ]]
-- --[[ Death Coil ]]
-- --[[ Demon Armor ]]
-- --[[ Demon Skin ]]
-- --[[ Demonic Sacrifice ]]
-- --[[ Detect Greater Invisibility ]]
-- --[[ Detect Invisibility ]]
-- --[[ Detect Lesser Invisibility ]]
-- --[[ Drain Life ]]
-- --[[ Drain Mana ]]
-- --[[ Drain Soul ]]
-- --[[ Enslave Demon ]]
-- --[[ Eye of Kilrogg ]]
-- --[[ Fear ]]
-- --[[ Fel Domination ]]
-- --[[ Health Funnel ]]
-- --[[ Hell Fire ]]
-- --[[ Howl of Terror ]]
-- --[[ Immolate ]]
-- --[[ Inferno ]]
-- --[[ Life Tap ]]
-- --[[ Rain of Fire ]]
-- --[[ Ritual of Doom ]]
-- --[[ Ritual of Summoning ]]
-- --[[ Searing Pain ]]
-- --[[ Sense Demons ]]
-- --[[ Shadow Bolt ]]
-- --[[ Shadow Ward ]]
-- --[[ Shadowburn ]]
-- --[[ Shoot ]]
-- --[[ Siphon Life ]]
-- --[[ Soul Fire ]]
-- --[[ Soul Link ]]
-- --[[ Summon Dreadsteed ]]
-- --[[ Summon Felhunter ]]
-- --[[ Summon Felsteed ]]
-- --[[ Summon Imp ]]
-- --[[ Summon Succubus ]]
-- --[[ Summon Voidwalker ]]
-- --[[ Unending Breath ]]
-- --[[ Create Firestone ]]
-- --[[ Create Firestone (Greater) ]]
-- --[[ Create Firestone (Lesser) ]]
-- --[[ Create Firestone (Major) ]]
-- --[[ Create Soulstone ]]
-- --[[ Create Soulstone (Greater) ]]
-- --[[ Create Soulstone (Lesser) ]]
-- --[[ Create Soulstone (Major) ]]
-- --[[ Create Spellstone ]]
-- --[[ Create Spellstone (Greater) ]]
-- --[[ Create Spellstone (Major) ]]
}
swing_reset_spells['WARRIOR'] = {
-- --[[ Battle Shout ]]
-- --[[ Battle Stance ]]
-- --[[ Berserker Rage ]]
-- --[[ Berserker Stance ]]
-- --[[ Bloodrage ]]
-- --[[ Bloodthirst ]]
-- --[[ Challenging Shout ]]
-- --[[ Charge ]]
--[[ Cleave ]] 845, 7369, 11608, 11609, 20569,
-- --[[ Death Wish ]]
-- --[[ Defensive Stance ]]
-- --[[ Demoralizing Shout ]]
-- --[[ Disarm ]]
-- --[[ Execute ]]
-- --[[ Hamstring ]]
--[[ Heroic Strike ]] 78, 284, 285, 1608, 11564, 11565, 11566, 11567, 25286,
-- --[[ Intercept ]]
-- --[[ Intimidating Shout ]]
-- --[[ Last Stand ]]
-- --[[ Mocking Blow ]]
-- --[[ Mortal Strike ]]
-- --[[ Overpower ]]
-- --[[ Piercing Howl ]]
-- --[[ Pummel ]]
-- --[[ Recklessness ]]
-- --[[ Rend ]]
-- --[[ Retaliation ]]
-- --[[ Revenge ]]
-- --[[ Shield Bash ]]
-- --[[ Shield Block ]]
-- --[[ Shield Slam ]]
-- --[[ Shield Wall ]]
-- --[[ Shoot Bow ]]
-- --[[ Shoot Crossbow ]]
-- --[[ Shoot Gun ]]
--[[ Slam ]] 1464, 8820, 11604, 11605
-- --[[ Sunder Armor ]]
-- --[[ Sweeping Strikes ]]
-- --[[ Taunt ]]
-- --[[ Throw ]]
-- --[[ Thunder Clap ]]
-- --[[ Whirlwind ]]
}
local function LoadAllSettings()
addon_data.core.LoadSettings()
addon_data.player.LoadSettings()
addon_data.target.LoadSettings()
addon_data.hunter.LoadSettings()
end
addon_data.core.RestoreAllDefaults = function()
addon_data.core.RestoreDefaults()
addon_data.player.RestoreDefaults()
addon_data.target.RestoreDefaults()
addon_data.hunter.RestoreDefaults()
end
local function InitializeAllVisuals()
addon_data.player.InitializeVisuals()
addon_data.target.InitializeVisuals()
addon_data.hunter.InitializeVisuals()
addon_data.config.InitializeVisuals()
end
addon_data.core.UpdateAllVisualsOnSettingsChange = function()
addon_data.player.UpdateVisualsOnSettingsChange()
addon_data.target.UpdateVisualsOnSettingsChange()
addon_data.hunter.UpdateVisualsOnSettingsChange()
end
addon_data.core.LoadSettings = function()
-- If the carried over settings dont exist then make them
if not character_core_settings then
character_core_settings = {}
end
-- If the carried over settings aren't set then set them to the defaults
for setting, value in pairs(addon_data.core.default_settings) do
if character_core_settings[setting] == nil then
character_core_settings[setting] = value
end
end
end
addon_data.core.RestoreDefaults = function()
for setting, value in pairs(addon_data.core.default_settings) do
character_core_settings[setting] = value
end
end
local function CoreFrame_OnUpdate(self, elapsed)
addon_data.player.OnUpdate(elapsed)
addon_data.target.OnUpdate(elapsed)
addon_data.hunter.OnUpdate(elapsed)
end
addon_data.core.MissHandler = function(unit, miss_type, is_offhand)
if miss_type == "PARRY" then
if unit == "player" then
min_swing_time = addon_data.target.main_weapon_speed * 0.2
if addon_data.target.main_swing_timer > min_swing_time then
addon_data.target.main_swing_timer = min_swing_time
end
if not is_offhand then
addon_data.player.ResetMainSwingTimer()
else
addon_data.player.ResetOffSwingTimer()
end
elseif unit == "target" then
min_swing_time = addon_data.player.main_weapon_speed * 0.2
if addon_data.player.main_swing_timer > min_swing_time then
addon_data.player.main_swing_timer = min_swing_time
end
if not is_offhand then
addon_data.target.ResetMainSwingTimer()
else
addon_data.target.ResetOffSwingTimer()
end
else
addon_data.utils.PrintMsg("Unexpected Unit Type in MissHandler().")
end
else
if unit == "player" then
if not is_offhand then
addon_data.player.ResetMainSwingTimer()
else
addon_data.player.ResetOffSwingTimer()
end
elseif unit == "target" then
if not is_offhand then
addon_data.target.ResetMainSwingTimer()
else
addon_data.target.ResetOffSwingTimer()
end
else
addon_data.utils.PrintMsg("Unexpected Unit Type in MissHandler().")
end
end
end
addon_data.core.SpellHandler = function(unit, spell_id)
local _, player_class, _ = UnitClass('player')
for class, spell_table in pairs(swing_reset_spells) do
if player_class == class then
for spell_index, curr_spell_id in ipairs(spell_table) do
if spell_id == curr_spell_id then
if unit == "player" then
addon_data.player.ResetMainSwingTimer()
elseif unit == "target" then
addon_data.target.ResetMainSwingTimer()
else
addon_data.utils.PrintMsg("Unexpected Unit Type in SpellHandler().")
end
end
end
end
end
end
local function OnAddonLoaded(self)
-- Attach the rest of the events and scripts to the core frame
addon_data.core.core_frame:SetScript("OnUpdate", CoreFrame_OnUpdate)
addon_data.core.core_frame:RegisterEvent("PLAYER_REGEN_ENABLED")
addon_data.core.core_frame:RegisterEvent("PLAYER_REGEN_DISABLED")
addon_data.core.core_frame:RegisterEvent("PLAYER_TARGET_CHANGED")
addon_data.core.core_frame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
addon_data.core.core_frame:RegisterEvent("UNIT_INVENTORY_CHANGED")
addon_data.core.core_frame:RegisterEvent("START_AUTOREPEAT_SPELL")
addon_data.core.core_frame:RegisterEvent("STOP_AUTOREPEAT_SPELL")
addon_data.core.core_frame:RegisterEvent("UNIT_SPELLCAST_START")
addon_data.core.core_frame:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED")
addon_data.core.core_frame:RegisterEvent("UNIT_SPELLCAST_DELAYED")
addon_data.core.core_frame:RegisterEvent("UNIT_SPELLCAST_FAILED")
addon_data.core.core_frame:RegisterEvent("UNIT_SPELLCAST_INTERRUPTED")
addon_data.core.core_frame:RegisterEvent("UNIT_SPELLCAST_FAILED_QUIET")
-- Load the settings for the core and all timers
LoadAllSettings()
InitializeAllVisuals()
-- Any other misc operations that happen at the start
addon_data.player.ZeroizeSwingTimers()
addon_data.target.ZeroizeSwingTimers()
addon_data.utils.PrintMsg(load_message)
end
local function CoreFrame_OnEvent(self, event, ...)
local args = {...}
if event == "ADDON_LOADED" then
if args[1] == "WeaponSwingTimer" then
OnAddonLoaded()
end
elseif event == "PLAYER_REGEN_ENABLED" then
addon_data.core.in_combat = false
elseif event == "PLAYER_REGEN_DISABLED" then
addon_data.core.in_combat = true
elseif event == "PLAYER_TARGET_CHANGED" then
addon_data.target.OnPlayerTargetChanged()
elseif event == "COMBAT_LOG_EVENT_UNFILTERED" then
local combat_info = {CombatLogGetCurrentEventInfo()}
addon_data.player.OnCombatLogUnfiltered(combat_info)
addon_data.target.OnCombatLogUnfiltered(combat_info)
elseif event == "UNIT_INVENTORY_CHANGED" then
addon_data.player.OnInventoryChange()
addon_data.target.OnInventoryChange()
elseif event == "START_AUTOREPEAT_SPELL" then
addon_data.hunter.OnStartAutorepeatSpell()
elseif event == "STOP_AUTOREPEAT_SPELL" then
addon_data.hunter.OnStopAutorepeatSpell()
elseif event == "UNIT_SPELLCAST_START" then
addon_data.hunter.OnUnitSpellCastStart(args[1], args[3])
elseif event == "UNIT_SPELLCAST_STOP" then
addon_data.hunter.OnUnitSpellCastStop(args[1], args[3])
elseif event == "UNIT_SPELLCAST_SUCCEEDED" then
addon_data.hunter.OnUnitSpellCastSucceeded(args[1], args[3])
elseif event == "UNIT_SPELLCAST_DELAYED" then
addon_data.hunter.OnUnitSpellCastDelayed(args[1], args[3])
elseif event == "UNIT_SPELLCAST_FAILED" then
addon_data.hunter.OnUnitSpellCastFailed(args[1], args[3])
elseif event == "UNIT_SPELLCAST_INTERRUPTED" then
addon_data.hunter.OnUnitSpellCastInterrupted(args[1], args[3])
elseif event == "UNIT_SPELLCAST_FAILED_QUIET" then
addon_data.hunter.OnUnitSpellCastFailedQuiet(args[1], args[3])
end
end
-- Add a slash command to bring up the config window
SLASH_WEAPONSWINGTIMER_CONFIG1 = "/WeaponSwingTimer"
SLASH_WEAPONSWINGTIMER_CONFIG2 = "/weaponswingtimer"
SLASH_WEAPONSWINGTIMER_CONFIG3 = "/wst"
SlashCmdList["WEAPONSWINGTIMER_CONFIG"] = function(option)
InterfaceOptionsFrame_OpenToCategory("WeaponSwingTimer")
InterfaceOptionsFrame_OpenToCategory("WeaponSwingTimer")
end
-- Setup the core of the addon (This is like calling main in C)
addon_data.core.core_frame:SetScript("OnEvent", CoreFrame_OnEvent)