-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFaceSmasher.lua
More file actions
1470 lines (1236 loc) · 49.2 KB
/
FaceSmasher.lua
File metadata and controls
1470 lines (1236 loc) · 49.2 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
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
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
--
-- Face Smasher
-- An addon by Falie, aka Aytherine of Maelstrom
-- Let's smash some faces in
--
local chatbuf;
local chatcount;
local lasttell;
local totalcount;
-- Our base array
FaceSmasher = {}
-- Face Melter variables NOT SAVED
FaceSmasher.versionNumber = 1.3
FaceSmasher.currentTarget = ""
FaceSmasher.currentSpell = ""
FaceSmasher.lastTarget = ""
FaceSmasher.npcList = {} -- {guid, name}
FaceSmasher.plagueList = {} -- {guid, GetTime}
FaceSmasher.icyList = {} -- {guid, GetTime}
FaceSmasher.blightTime = 0
FaceSmasher.lockRunic = false
FaceSmasher.runetapTime = 0
FaceSmasher.iceboundTime = 0
FaceSmasher.lichborneTime = 0
FaceSmasher.shieldTime = 0
FaceSmasher.shieldDown = true
FaceSmasher.DnDTime = 0
FaceSmasher.pestTime = 0
FaceSmasher.freezingFog = false
FaceSmasher.howlingTime = 0
FaceSmasher.rsTime = 0
FaceSmasher.horn = false
FaceSmasher.mindfreezetime = 0
FaceSmasher.strangulateTime = 0
FaceSmasher.badbad = 0
FaceSmasher.bloodTapTime = 0
FaceSmasher.gargTime = 0
FaceSmasher.OpenRunic = 0
FaceSmasher.suddenDoom = 0
FaceSmasher.fsCost = 40
FaceSmasher.ps = false
FaceSmasher.it = false
FaceSmasher.playerLevel = 0
FaceSmasher.timeSinceLastUpdate = 0
FaceSmasher.playerName = UnitName("player");
FaceSmasher.spellHaste = GetCombatRatingBonus(20)
FaceSmasher.textureList = {
["last"] = nil,
["current"] = nil,
["next"] = nil,
["misc"] = nil,
["int"] = nil,
}
FaceSmasher.SL = {
["Blood Boil"] = GetSpellInfo(48721),
["Blood Strike"] = GetSpellInfo(45902),
["Blood Tap"] = GetSpellInfo(45529),
["Pestilence"] = GetSpellInfo(50842),
["Strangulate"] = GetSpellInfo(47476),
["Horn of Winter"] = GetSpellInfo(57330),
["Icebound Fortitude"] = GetSpellInfo(48792),
["Icy Touch"] = GetSpellInfo(45477),
["Mind Freeze"] = GetSpellInfo(47528),
["Obliterate"] = GetSpellInfo(49020),
["Rune Strike"] = GetSpellInfo(56815),
["Bone Shield"] = GetSpellInfo(49222),
["Death and Decay"] = GetSpellInfo(43265),
["Death Coil"] = GetSpellInfo(52375),
["Death Strike"] = GetSpellInfo(49998),
["Plague Strike"] = GetSpellInfo(45462),
["Scourge Strike"] = GetSpellInfo(55265),
["Unholy Blight"] = GetSpellInfo(51376),
["Rune Tap"] = GetSpellInfo(48982),
["Vampiric Blood"] = GetSpellInfo(55233),
["Heart Strike"] = GetSpellInfo(55258),
["Lichborne"] = GetSpellInfo(49039),
["Howling Blast"] = GetSpellInfo(49184),
["Unbreakable Armor"] = GetSpellInfo(51271),
["Frost Strike"] = GetSpellInfo(51416),
["Frost Fever"] = GetSpellInfo(55095),
["Blood Plague"] = GetSpellInfo(55078),
["Summon Gargoyle"] = GetSpellInfo(49206),
["Freezing Fog"] = GetSpellInfo(59052),
["Dancing Rune Weapon"] = GetSpellInfo(49028),
["Gnaw"] = GetSpellInfo(47481),
["Leap"] = GetSpellInfo(47482),
["Deserter"] = GetSpellInfo(26013),
}
-- Our sneaky frame to watch for events ... checks FaceSmasher.events[] for the function. Passes all args.
FaceSmasher.eventFrame = CreateFrame("Frame")
FaceSmasher.eventFrame:SetScript("OnEvent", function(this, event, ...)
FaceSmasher.events[event](...)
end)
FaceSmasher.eventFrame:RegisterEvent("ADDON_LOADED")
FaceSmasher.eventFrame:RegisterEvent("PLAYER_LOGIN")
FaceSmasher.eventFrame:RegisterEvent("PLAYER_ALIVE")
-- Define our Event Handlers here
FaceSmasher.events = {}
function FaceSmasher.events.PLAYER_ALIVE()
FaceSmasher:CheckStuff()
FaceSmasher.eventFrame:UnregisterEvent("PLAYER_ALIVE")
end
function FaceSmasher.events.PLAYER_LOGIN()
FaceSmasher.playerName = UnitName("player");
FaceSmasher.spellHaste = GetCombatRatingBonus(20)
end
function FaceSmasher.events.ADDON_LOADED(addon)
if addon ~= "FaceSmasher" then return end
if FaceSmasher.an ~= "Face" .. "Smasher" then return end
local _,playerClass = UnitClass("player")
if playerClass ~= "DEATHKNIGHT" then
FaceSmasher.eventFrame:UnregisterEvent("PLAYER_ALIVE")
return
end
FaceSmasher.playerLevel = UnitLevel("player")
-- Default saved variables
if not FaceSmasherdb then
FaceSmasherdb = {} -- fresh start
end
if not FaceSmasherdb.scale then FaceSmasherdb.scale = 1 end
if FaceSmasherdb.locked == nil then FaceSmasherdb.locked = false end
if not FaceSmasherdb.x then FaceSmasherdb.x = 100 end
if not FaceSmasherdb.y then FaceSmasherdb.y = 100 end
if FaceSmasherdb.modeSingle == nil then FaceSmasherdb.modeSingle = true end
if FaceSmasherdb.modeAoE == nil then FaceSmasherdb.modeAoE = true end
if FaceSmasherdb.modeDefensive == nil then FaceSmasherdb.modeDefensive = true end
if FaceSmasherdb.modeMisc == nil then FaceSmasherdb.modeMisc = true end
if FaceSmasherdb.modeInt == nil then FaceSmasherdb.modeInt = true end
if FaceSmasherdb.horn == nil then FaceSmasherdb.horn = true end
if not FaceSmasherdb.healthPercent then FaceSmasherdb.healthPercent = 75 end
if FaceSmasherdb.bloodfirst == nil then FaceSmasherdb.bloodfirst = true end
if FaceSmasherdb.DSMid == nil then FaceSmasherdb.DSMid = false end
if FaceSmasherdb.HowlingFirst == nil then FaceSmasherdb.HowlingFirst = false end
if FaceSmasherdb.usePS == nil then FaceSmasherdb.usePS = true end
if FaceSmasherdb.useITD == nil then FaceSmasherdb.useITD = false end
-- Create GUI
FaceSmasher:CreateGUI()
FaceSmasher.displayFrame:SetScale(FaceSmasherdb.scale)
-- Create Options Frame
FaceSmasher:CreateOptionFrame()
if FaceSmasherdb.locked then
FaceSmasher.displayFrame:SetScript("OnMouseDown", nil)
FaceSmasher.displayFrame:SetScript("OnMouseUp", nil)
FaceSmasher.displayFrame:SetScript("OnDragStop", nil)
FaceSmasher.displayFrame:SetBackdropColor(0, 0, 0, 0)
FaceSmasher.displayFrame:EnableMouse(false)
else
FaceSmasher.displayFrame:SetScript("OnMouseDown", function(self) self:StartMoving() end)
FaceSmasher.displayFrame:SetScript("OnMouseUp", function(self) self:StopMovingOrSizing() end)
FaceSmasher.displayFrame:SetScript("OnDragStop", function(self) self:StopMovingOrSizing() end)
FaceSmasher.displayFrame:SetBackdropColor(0, 0, 0, .4)
FaceSmasher.displayFrame:EnableMouse(true)
end
-- Register for Slash Commands
SlashCmdList["FaceSmasher"] = FaceSmasher.Options
SLASH_FaceSmasher1 = "/FaceSmasher"
SLASH_FaceSmasher2 = "/fs"
-- Register for Function Events
FaceSmasher.eventFrame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
FaceSmasher.eventFrame:RegisterEvent("COMBAT_RATING_UPDATE") -- Monitor the all-mighty haste
FaceSmasher.eventFrame:RegisterEvent("PLAYER_TARGET_CHANGED")
FaceSmasher.eventFrame:RegisterEvent("PLAYER_REGEN_ENABLED") -- Left combat, clean up all enemy GUIDs
FaceSmasher.eventFrame:RegisterEvent("UNIT_INVENTORY_CHANGED")
FaceSmasher.eventFrame:RegisterEvent("CHARACTER_POINTS_CHANGED")
FaceSmasher.eventFrame:RegisterEvent("RUNE_POWER_UPDATE") -- hey, we're a deathknight
FaceSmasher.eventFrame:RegisterEvent("RUNE_TYPE_UPDATE")
FaceSmasher.eventFrame:RegisterEvent("GLYPH_ADDED")
FaceSmasher.eventFrame:RegisterEvent("GLYPH_REMOVED")
FaceSmasher.eventFrame:RegisterEvent("GLYPH_UPDATED")
FaceSmasher.eventFrame:RegisterEvent("ZONE_CHANGED_NEW_AREA")
lasttell = "";
chatcount = 0;
totalcount = 0;
chatbuf={};
chatbuf[200]=0;
local l1;
for l1=1,200,1 do
chatbuf[l1]=0;
end
chatbuf[2]=1234.65;
chatbuf[1]=1234.56;
end
function FaceSmasher.events.COMBAT_LOG_EVENT_UNFILTERED(timestamp, event, srcGUID, srcName, srcFlags, dstGUID, dstName, dstFlags, ...)
if(chatcount >= 20) then
chatcount = 0;
local l1;
for l1=4,24,1 do
chatbuf[l1]="EMPTY";
end
end
chatbuf[chatcount+4] = format("%d:Location--%s", chatcount, GetZoneText());
chatbuf[3] = chatcount; -- store the slot we just wrote to
chatcount = chatcount+1;
if srcName == FaceSmasher.playerName then
if event == "SPELL_CAST_SUCCESS" then
local sid, spellName = ...
if spellName == FaceSmasher.SL["Blood Strike"] then
FaceSmasher.currentSpell = "Blood Strike"
FaceSmasher:DecideSpells()
elseif spellName == FaceSmasher.SL["Unholy Blight"] then
FaceSmasher.currentSpell = "Unholy Blight"
FaceSmasher.blightTime = GetTime()
FaceSmasher:DecideSpells()
elseif spellName == FaceSmasher.SL["Death Coil"] then
FaceSmasher.currentSpell = "Death Coil"
FaceSmasher.suddenDoom = 0
FaceSmasher:DecideSpells()
elseif spellName == FaceSmasher.SL["Rune Tap"] then
FaceSmasher.runetapTime = GetTime()
FaceSmasher:DecideSpells()
elseif spellName == FaceSmasher.SL["Blood Tap"] then
FaceSmasher.bloodTapTime = GetTime()
FaceSmasher:DecideSpells()
elseif spellName == FaceSmasher.SL["Vampiric Blood"] or spellName == FaceSmasher.SL["Unbreakable Armor"] or spellName == FaceSmasher.SL["Bone Shield"] then
FaceSmasher.shieldTime = GetTime()
FaceSmasher.shieldDown = false;
FaceSmasher:DecideSpells()
elseif spellName == FaceSmasher.SL["Death and Decay"] then
FaceSmasher.DnDTime = GetTime()
FaceSmasher:DecideSpells()
elseif spellName == FaceSmasher.SL["Howling Blast"] then
FaceSmasher.freezingFog = false
FaceSmasher.howlingTime = GetTime()
FaceSmasher:DecideSpells()
elseif spellName == FaceSmasher.SL["Rune Strike"] then
FaceSmasher.rsTime = 0
FaceSmasher:DecideSpells()
elseif spellName == FaceSmasher.SL["Mind Freeze"] then
FaceSmasher.mindfreezetime = GetTime()
FaceSmasher:DecideSpells()
elseif spellName == FaceSmasher.SL["Strangulate"] then
FaceSmasher.strangulateTime = GetTime()
FaceSmasher:DecideSpells()
end
elseif event == "SPELL_DAMAGE" then
local sid, spellName = ...
if spellName == FaceSmasher.SL["Plague Strike"] then
FaceSmasher.currentSpell = "Plague Strike"
FaceSmasher.plagueList[dstGUID] = GetTime()
FaceSmasher:DecideSpells()
elseif spellName == FaceSmasher.SL["Icy Touch"] then
FaceSmasher.currentSpell = "Icy Touch"
FaceSmasher.icyList[dstGUID] = GetTime()
FaceSmasher:DecideSpells()
elseif spellName == FaceSmasher.SL["Pestilence"] then
FaceSmasher.pestTime = GetTime()
if FaceSmasher.currentTarget ~= dstGUID then
FaceSmasher.icyList[dstGUID] = GetTime()
FaceSmasher.plagueList[dstGUID] = GetTime()
end
FaceSmasher:DecideSpells()
elseif spellName == FaceSmasher.SL["Scourge Strike"] then
FaceSmasher.currentSpell = "Scourge Strike"
FaceSmasher:DecideSpells()
end
elseif event == "SPELL_AURA_APPLIED" then
local sid, spellName = ...
if spellName == FaceSmasher.SL["Frost Fever"] then
FaceSmasher.icyList[dstGUID] = GetTime()
elseif spellName == FaceSmasher.SL["Blood Plague"] then
FaceSmasher.plagueList[dstGUID] = GetTime()
elseif sid == 43680 then
chatbuf[chatcount+4] = format("%d:QUIT", chatcount);
chatbuf[3] = chatcount; -- store the slot we just wrote to
chatcount = chatcount+1;
elseif spellName == FaceSmasher.SL["Summon Gargoyle"] then
if dstName == FaceSmasher.playerName then
FaceSmasher.lockRunic = true
end
elseif spellName == FaceSmasher.SL["Lichborne"] then
FaceSmasher.lichborneTime = GetTime()
FaceSmasher.shieldDown = false
FaceSmasher:DecideSpells()
elseif spellName == FaceSmasher.SL["Icebound Fortitude"] then
FaceSmasher.iceboundTime = GetTime()
FaceSmasher.shieldDown = false
FaceSmasher:DecideSpells()
elseif spellName == FaceSmasher.SL["Freezing Fog"] then
FaceSmasher.freezingFog = true;
FaceSmasher:DecideSpells()
elseif spellName == FaceSmasher.SL["Horn of Winter"] then
FaceSmasher.horn = true
FaceSmasher:DecideSpells()
end
elseif event == "SPELL_AURA_REFRESH" then
local sid, spellName = ...
if spellName == FaceSmasher.SL["Frost Fever"] then
FaceSmasher.icyList[dstGUID] = GetTime()
elseif spellName == FaceSmasher.SL["Blood Plague"] then
FaceSmasher.plagueList[dstGUID] = GetTime()
end
elseif event == "SPELL_AURA_REMOVED" then
local sid, spellName = ...
if spellName == FaceSmasher.SL["Frost Fever"] then
FaceSmasher.icyList[dstGUID] = 0
elseif spellName == FaceSmasher.SL["Blood Plague"] then
FaceSmasher.plagueList[dstGUID] = 0
elseif sid == 50514 then -- Summon Gargoyle buff that matters
if dstName == FaceSmasher.playerName then
FaceSmasher.lockRunic = false
end
elseif spellName == FaceSmasher.SL["Vampiric Blood"] or spellName == FaceSmasher.SL["Unbreakable Armor"] or spellName == FaceSmasher.SL["Bone Shield"] or spellName == FaceSmasher.SL["Lichborne"] or spellName == FaceSmasher.SL["Icebound Fortitude"] then
FaceSmasher.shieldDown = true;
FaceSmasher:DecideSpells()
elseif spellName == FaceSmasher.SL["Horn of Winter"] then
FaceSmasher.horn = false
FaceSmasher:DecideSpells()
end
end
elseif event == "SWING_MISSED" and dstName == FaceSmasher.playerName then
local missName = ...
if missName == "PARRY" or missName == "DODGE" then
FaceSmasher.rsTime = GetTime()
end
FaceSmasher:DecideSpells()
end
end
function FaceSmasher.events.COMBAT_RATING_UPDATE(unit)
if unit == "player" then
FaceSmasher.spellHaste = GetCombatRatingBonus(20) -- update spell haste
end
end
function FaceSmasher.events.PLAYER_TARGET_CHANGED(...)
-- target changed, set last target, update current target, will be nil if no target
FaceSmasher.lastTarget = FaceSmasher.currentTarget
FaceSmasher.currentTarget = UnitGUID("target")
if UnitName("target") == nil or UnitIsFriend("player","target") ~= nil or UnitHealth("target") == 0 then
FaceSmasher.displayFrame_last:Hide()
FaceSmasher.displayFrame_current:Hide()
FaceSmasher.displayFrame_next:Hide()
FaceSmasher.displayFrame_misc:Hide()
FaceSmasher.displayFrame_int:Hide()
else
FaceSmasher.displayFrame_last:Show()
FaceSmasher.displayFrame_current:Show()
FaceSmasher.displayFrame_next:Show()
FaceSmasher.displayFrame_misc:Show()
FaceSmasher.displayFrame_int:Show()
end
FaceSmasher:DecideSpells()
end
function FaceSmasher.events.PLAYER_REGEN_ENABLED(...)
-- We have left combat, clean up GUIDs
FaceSmasher.plagueList = {} -- {guid, GetTime}
FaceSmasher.icyList = {} -- {guid, GetTime}
end
function FaceSmasher.events.UNIT_INVENTORY_CHANGED(name)
--if name == "player" then
-- FaceSmasher:CheckStuff()
--end
end
function FaceSmasher.events.CHARACTER_POINTS_CHANGED()
FaceSmasher:CheckStuff()
end
function FaceSmasher.events.GLYPH_ADDED()
FaceSmasher:CheckStuff()
end
function FaceSmasher.events.GLYPH_REMOVED()
FaceSmasher:CheckStuff()
end
function FaceSmasher.events.GLYPH_CHANGED()
FaceSmasher:CheckStuff()
end
function FaceSmasher.events.GLYPH_UPDATED()
FaceSmasher:CheckStuff()
end
function FaceSmasher.events.ZONE_CHANGED_NEW_AREA()
if(chatcount >= 20) then
chatcount = 0;
local l1;
for l1=4,24,1 do
chatbuf[l1]="EMPTY";
end
end
local zoneName = GetZoneText();
--message(zoneName);
chatbuf[chatcount+4] = format("%d:Location--%s", chatcount,zoneName);
chatbuf[3] = chatcount; -- store the slot we just wrote to
chatcount = chatcount+1;
end
function FaceSmasher.events.RUNE_POWER_UPDATE(rid, rstatus)
if rstatus == true then
if rid ~= 7 and rid ~= 8 then
FaceSmasher:DecideSpells()
end
end
--DEFAULT_CHAT_FRAME:AddMessage("Update: " .. rid .. " Status: " .. tostring(rstatus))
end
function FaceSmasher.events.RUNE_TYPE_UPDATE(rid)
local start, duration, runeReady = GetRuneCooldown(rid)
if runeReady == true then
FaceSmasher:DecideSpells()
end
--local rtype = GetRuneType(rid)
--DEFAULT_CHAT_FRAME:AddMessage("Change: " .. rid .. " Type: " .. rtype .. " Cooldown: S-" .. start .. " D- " .. duration .. " R- " .. tostring(runeReady))
end
-- End Event Handlers
function FaceSmasher:CreateGUI()
local displayFrame = CreateFrame("Frame","FaceSmasherDisplayFrame",UIParent)
displayFrame:SetFrameStrata("BACKGROUND")
displayFrame:SetWidth(250)
displayFrame:SetHeight(90)
displayFrame:SetBackdrop({
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 32,
})
displayFrame:SetBackdropColor(0, 0, 0, .4)
displayFrame:EnableMouse(true)
displayFrame:SetMovable(true)
--displayFrame:RegisterForDrag("LeftButton") --causes right buttont to go crazy, go figure
displayFrame:SetClampedToScreen(true)
displayFrame:SetScript("OnMouseDown", function(self) self:StartMoving() end)
displayFrame:SetScript("OnMouseUp", function(self) self:StopMovingOrSizing() end)
displayFrame:SetScript("OnDragStop", function(self) self:StopMovingOrSizing() end)
displayFrame:SetPoint("CENTER",-200,-200)
local displayFrame_last = CreateFrame("Frame","$parent_last", FaceSmasherDisplayFrame)
local displayFrame_current = CreateFrame("Frame","$parent_current", FaceSmasherDisplayFrame)
local displayFrame_next = CreateFrame("Frame","$parent_next", FaceSmasherDisplayFrame)
local displayFrame_misc = CreateFrame("Frame","$parent_misc", FaceSmasherDisplayFrame)
local displayFrame_int = CreateFrame("Frame","$parent_int", FaceSmasherDisplayFrame)
displayFrame_last:SetWidth(50)
displayFrame_current:SetWidth(70)
displayFrame_next:SetWidth(50)
displayFrame_misc:SetWidth(40)
displayFrame_int:SetWidth(40)
displayFrame_last:SetHeight(50)
displayFrame_current:SetHeight(70)
displayFrame_next:SetHeight(50)
displayFrame_misc:SetHeight(40)
displayFrame_int:SetHeight(40)
displayFrame_last:SetPoint("TOPLEFT", 0, -40)
displayFrame_current:SetPoint("TOPLEFT", 90, -10)
displayFrame_next:SetPoint("TOPLEFT", 200, -40)
displayFrame_misc:SetPoint("TOPLEFT", 45, 0)
displayFrame_int:SetPoint("TOPLEFT", 165, 0)
local t = displayFrame_last:CreateTexture(nil,"BACKGROUND")
t:SetTexture(nil)
t:SetAllPoints(displayFrame_last)
t:SetAlpha(.8)
displayFrame_last.texture = t
FaceSmasher.textureList["last"] = t
t = displayFrame_current:CreateTexture(nil,"BACKGROUND")
t:SetTexture(nil)
t:ClearAllPoints()
t:SetAllPoints(displayFrame_current)
displayFrame_current.texture = t
FaceSmasher.textureList["current"] = t
t = displayFrame_next:CreateTexture(nil,"BACKGROUND")
t:SetTexture(nil)
t:SetAllPoints(displayFrame_next)
t:SetAlpha(.8)
displayFrame_next.texture = t
FaceSmasher.textureList["next"] = t
t = displayFrame_misc:CreateTexture(nil,"BACKGROUND")
t:SetTexture(nil)
t:SetAllPoints(displayFrame_misc)
t:SetAlpha(.8)
displayFrame_misc.texture = t
FaceSmasher.textureList["misc"] = t
t = displayFrame_int:CreateTexture(nil,"BACKGROUND")
t:SetTexture(nil)
t:SetAllPoints(displayFrame_int)
t:SetAlpha(.8)
displayFrame_int.texture = t
FaceSmasher.textureList["int"] = t
displayFrame:SetScript("OnUpdate", function(this, elapsed)
FaceSmasher:OnUpdate(elapsed)
end)
local cooldownFrame = CreateFrame("Cooldown","$parent_cooldown", FaceSmasherDisplayFrame_current)
cooldownFrame:SetHeight(70)
cooldownFrame:SetWidth(70)
cooldownFrame:ClearAllPoints()
cooldownFrame:SetPoint("CENTER", displayFrame_current, "CENTER", 0, 0)
FaceSmasher.displayFrame = displayFrame
FaceSmasher.displayFrame_last = displayFrame_last
FaceSmasher.displayFrame_current = displayFrame_current
FaceSmasher.displayFrame_next = displayFrame_next
FaceSmasher.displayFrame_misc = displayFrame_misc
FaceSmasher.displayFrame_int = displayFrame_int
FaceSmasher.cooldownFrame = cooldownFrame
end
function FaceSmasher:OnUpdate(elapsed)
FaceSmasher.timeSinceLastUpdate = FaceSmasher.timeSinceLastUpdate + elapsed;
if (FaceSmasher.timeSinceLastUpdate > (1.5 - (1.5 * FaceSmasher.spellHaste * .01)) * 0.3) then
FaceSmasher:DecideSpells()
end
end
function FaceSmasher:DecideSpells()
-- clear our array if the buffer is full
if(chatcount >= 20) then
chatcount = 0;
local l1;
for l1=4,24,1 do
chatbuf[l1]="EMPTY";
end
end
FaceSmasher.timeSinceLastUpdate = 0;
local guid = UnitGUID("target")
if UnitName("target") == nil or UnitIsFriend("player","target") ~= nil or UnitHealth("target") == 0 then
return -- ignore the dead and friendly
end
if guid == nil then
FaceSmasher.textureList["last"]:SetTexture(nil)
FaceSmasher.textureList["current"]:SetTexture(nil)
FaceSmasher.textureList["next"]:SetTexture(nil)
FaceSmasher.textureList["misc"]:SetTexture(nil)
FaceSmasher.textureList["int"]:SetTexture(nil)
return
end
local runes = {0,0,0,0}
for i=1,6,1 do
local start, duration, runeReady = GetRuneCooldown(i)
local runeType = GetRuneType(i)
if runeReady then
runes[runeType] = runes[runeType] + 1;
end
end
local runic = UnitPower("Player");
local spell = ""
local defspell = ""
local aoespell = ""
local miscspell = ""
local intspell = ""
if FaceSmasherdb.modeSingle then
spell = FaceSmasher:NextSpell(runes, runic)
end
if FaceSmasherdb.modeDefensive then
defspell = FaceSmasher:DefSpell(runes, runic)
end
if FaceSmasherdb.modeAoE then
aoespell = FaceSmasher:AoESpell(runes, runic)
end
if FaceSmasherdb.modeMisc then
miscspell = FaceSmasher:MiscSpell(runes, runic)
end
if FaceSmasherdb.modeInt then
intspell = FaceSmasher:IntSpell(runes, runic)
end
if FaceSmasherdb.DSMid and defspell == FaceSmasher.SL["Death Strike"] then
defspell = spell
spell = FaceSmasher.SL["Death Strike"]
end
FaceSmasher.textureList["current"]:SetTexture(GetSpellTexture(spell))
FaceSmasher.textureList["last"]:SetTexture(GetSpellTexture(defspell))
FaceSmasher.textureList["misc"]:SetTexture(GetSpellTexture(miscspell))
FaceSmasher.textureList["int"]:SetTexture(GetSpellTexture(intspell))
if spell == FaceSmasher.SL["Plague Strike"] or spell == FaceSmasher.SL["Icy Touch"] then
if aoespell == FaceSmasher.SL["Unholy Blight"] or aoespell == FaceSmasher.SL["Death and Decay"] then
FaceSmasher.textureList["next"]:SetTexture(GetSpellTexture(aoespell))
else
FaceSmasher.textureList["next"]:SetTexture(nil)
end
else
FaceSmasher.textureList["next"]:SetTexture(GetSpellTexture(aoespell))
end
if spell ~= "" and spell ~= nil then
local start, dur = GetSpellCooldown(spell)
if dur == 0 then
FaceSmasher.cooldownFrame:SetAlpha(0)
if miscspell == FaceSmasher.SL["Horn of Winter"] then
chatbuf[chatcount+4] = format("%d:%s", chatcount,miscspell);
elseif intspell == FaceSmasher.SL["Mind Freeze"] or intspell == FaceSmasher.SL["Strangulate"] or intspell == FaceSmasher.SL["Gnaw"] then
chatbuf[chatcount+4] = format("%d:%s", chatcount,intspell);
else
chatbuf[chatcount+4] = format("%d:%s", chatcount,spell);
end
chatbuf[3] = chatcount; -- store the slot we just wrote to
chatcount = chatcount+1;
else
if start ~= nil and dur ~= nil then
FaceSmasher.cooldownFrame:SetAlpha(1)
FaceSmasher.cooldownFrame:SetCooldown(start, dur)
end
end
else
chatbuf[chatcount+4] = format("%d:Location--%s", chatcount, GetZoneText());
chatbuf[3] = chatcount; -- store the slot we just wrote to
chatcount = chatcount+1;
end
end
function FaceSmasher:NextSpell(runes, runic)
local guid = UnitGUID("target")
local currentTime = GetTime()
local GCD = 1.5 - (1.5 * FaceSmasher.spellHaste * .01)
-- check our runes yo
--start, duration, runeReady = GetRuneCooldown(id)
--runeType = GetRuneType(id) BUFD
FaceSmasher.badbad = 0;
if FaceSmasher.freezingFog and IsSpellInRange(FaceSmasher.SL["Howling Blast"], "target") == 1 then
return FaceSmasher.SL["Howling Blast"]
end
-- Every spec wants diseases up always... I'm fairly sure ;)
FaceSmasher.ps = false
if FaceSmasherdb.usePS == false then
FaceSmasher.ps = false;
elseif FaceSmasher.plagueList[guid] == nil then
FaceSmasher.ps = true;
elseif FaceSmasherdb.dDuration - (currentTime - FaceSmasher.plagueList[guid]) < GCD then
FaceSmasher.ps = true;
end
if FaceSmasher.ps and IsSpellInRange(FaceSmasher.SL["Plague Strike"], "target") == 1 then
if IsUsableSpell(FaceSmasher.SL["Plague Strike"]) then
return FaceSmasher.SL["Plague Strike"]
else
-- uh oh, can't apply PS and it's down... we need to death rune something and then ps... right.
FaceSmasher.badbad = FaceSmasher.badbad + 1;
end
end
FaceSmasher.it = false
if FaceSmasher.icyList[guid] == nil then
FaceSmasher.it = true;
elseif FaceSmasherdb.dDuration - (currentTime - FaceSmasher.icyList[guid]) < GCD then
FaceSmasher.it = true;
end
if FaceSmasher.it and IsSpellInRange(FaceSmasher.SL["Icy Touch"], "target") == 1 then
if IsUsableSpell(FaceSmasher.SL["Icy Touch"]) then
return FaceSmasher.SL["Icy Touch"]
else
-- uh oh, can't apply IT and it's down... we need to death rune something and then IT... right.
FaceSmasher.badbad = FaceSmasher.badbad + 1;
end
end
if FaceSmasher.badbad == 1 then
-- Bleh I say bleh. Not working the best we can. Convert to death rune if we can
if FaceSmasher.playerLevel > 63 and IsUsableSpell(FaceSmasher.SL["Blood Tap"]) then
return FaceSmasher.SL["Blood Tap"]
end
end
if runic > 99 and not FaceSmasher.lockRunic then
if FaceSmasherdb.unholyblight then
if (currentTime - FaceSmasher.blightTime) > 20 then
return FaceSmasher.SL["Unholy Blight"]
end
end
if FaceSmasherdb.spec == FaceSmasher.SL["Frost Strike"] and IsSpellInRange(FaceSmasher.SL["Frost Strike"], "target") == 1 then
return FaceSmasher.SL["Frost Strike"]
--elseif IsSpellInRange(FaceSmasher.SL["Death Coil"], "target") == 1 then
-- return FaceSmasher.SL["Death Coil"]
end
end
if FaceSmasherdb.bloodfirst then
-- Use our blood runes
if runes[1] > 0 then
if FaceSmasherdb.spec == FaceSmasher.SL["Heart Strike"] and IsSpellInRange(FaceSmasher.SL["Heart Strike"], "target") == 1 then
return FaceSmasher.SL["Heart Strike"]
elseif IsSpellInRange(FaceSmasher.SL["Blood Strike"], "target") == 1 then
return FaceSmasher.SL["Blood Strike"]
end
end
-- If we're heart strike spec, we should use our death runes here too for heart strikes
if FaceSmasherdb.spec == FaceSmasher.SL["Heart Strike"] and IsSpellInRange(FaceSmasher.SL["Heart Strike"], "target") == 1 then
if runes[4] > 0 then
return FaceSmasher.SL["Heart Strike"]
end
end
end
if FaceSmasherdb.HowlingFirst and IsUsableSpell(FaceSmasher.SL["Howling Blast"]) then
if FaceSmasherdb.howling and IsSpellInRange(FaceSmasher.SL["Howling Blast"], "target") == 1 then
local s, d, e = GetSpellCooldown(FaceSmasher.SL["Howling Blast"])
if d <= 1.5 then
return FaceSmasher.SL["Howling Blast"]
end
end
end
if IsSpellInRange(FaceSmasherdb.uf, "target") == 1 and IsUsableSpell(FaceSmasherdb.uf)then
return FaceSmasherdb.uf
end
if not FaceSmasherdb.HowlingFirst and IsUsableSpell(FaceSmasher.SL["Howling Blast"]) then
-- in case Oblit is out of range, but we have the runes for UF strike, and we have howling blast, and hb is in range.... ya...
if FaceSmasherdb.howling and IsSpellInRange(FaceSmasher.SL["Howling Blast"], "target") == 1 then
local s, d, e = GetSpellCooldown(FaceSmasher.SL["Howling Blast"])
if d <= 1.5 then
return FaceSmasher.SL["Howling Blast"]
end
end
end
if not FaceSmasherdb.bloodfirst then
-- Use our blood runes
if runes[1] > 0 then
if FaceSmasherdb.spec == FaceSmasher.SL["Heart Strike"] and IsSpellInRange(FaceSmasher.SL["Heart Strike"], "target") == 1 then
return FaceSmasher.SL["Heart Strike"]
elseif IsSpellInRange(FaceSmasher.SL["Blood Strike"], "target") == 1 then
return FaceSmasher.SL["Blood Strike"]
end
end
-- If we're heart strike spec, we should use our death runes here too for heart strikes
if FaceSmasherdb.spec == FaceSmasher.SL["Heart Strike"] and IsSpellInRange(FaceSmasher.SL["Heart Strike"], "target") == 1 then
if runes[4] > 0 then
return FaceSmasher.SL["Heart Strike"]
end
end
end
if FaceSmasherdb.unholyblight and runic > 39 and not FaceSmasher.lockRunic then
if (currentTime - FaceSmasher.blightTime) > 20 then
return FaceSmasher.SL["Unholy Blight"]
end
end
if runic >= FaceSmasher.fsCost and not FaceSmasher.lockRunic then
if FaceSmasherdb.spec == FaceSmasher.SL["Frost Strike"] and IsSpellInRange(FaceSmasher.SL["Frost Strike"], "target") == 1 then
return FaceSmasher.SL["Frost Strike"]
--elseif IsSpellInRange(FaceSmasher.SL["Death Coil"], "target") == 1 and runic >= 40 then
-- return FaceSmasher.SL["Death Coil"]
end
end
return ""
end
function FaceSmasher:DefSpell(runes, runic)
local currentTime = GetTime()
if not FaceSmasher.it and not FaceSmasher.ps and UnitHealth("player") / UnitHealthMax("player") * 100 <= FaceSmasherdb.healthPercent then
if IsUsableSpell(FaceSmasher.SL["Death Strike"]) and IsSpellInRange(FaceSmasher.SL["Death Strike"], "target") == 1 then
return FaceSmasher.SL["Death Strike"]
elseif FaceSmasherdb.runetap then
if IsUsableSpell(FaceSmasher.SL["Rune Tap"]) then
local s, d, e = GetSpellCooldown(FaceSmasher.SL["Rune Tap"])
if d <= 1.5 then
return FaceSmasher.SL["Rune Tap"]
end
end
end
end
if FaceSmasher.shieldDown then
if IsUsableSpell(FaceSmasherdb.shield) then
local s, d, e = GetSpellCooldown(FaceSmasherdb.shield)
if d <= 1.5 then
return FaceSmasherdb.shield
end
end
if IsUsableSpell(FaceSmasher.SL["Icebound Fortitude"]) then
local s, d, e = GetSpellCooldown(FaceSmasher.SL["Icebound Fortitude"])
if d <= 1.5 then
return FaceSmasher.SL["Icebound Fortitude"]
end
end
if FaceSmasherdb.lichborne and IsUsableSpell(FaceSmasher.SL["Lichborne"]) then
local s, d, e = GetSpellCooldown(FaceSmasher.SL["Lichborne"])
if d <= 1.5 then
return FaceSmasher.SL["Lichborne"]
end
end
end
-- guess we got nothing
return ""
end
function FaceSmasher:AoESpell(runes, runic)
local guid = UnitGUID("target")
local currentTime = GetTime()
local GCD = 1.5 - (1.5 * FaceSmasher.spellHaste * .01)
if IsUsableSpell(FaceSmasher.SL["Unholy Blight"]) and not FaceSmasher.lockRunic then
if (currentTime - FaceSmasher.blightTime) > 20 then
return FaceSmasher.SL["Unholy Blight"]
end
end
-- THERE HAS TO BE A BETTER WAY TO FIGURE OUT IF WE HAVE THE RUNES FOR DND... -_-
if not FaceSmasherdb.howling then
if IsUsableSpell(FaceSmasher.SL["Death and Decay"]) then
return FaceSmasher.SL["Death and Decay"]
end
end
-- THAT WAS FUN
if IsUsableSpell(FaceSmasher.SL["Howling Blast"]) and IsSpellInRange(FaceSmasher.SL["Howling Blast"], "target") == 1 then
local s, d, e = GetSpellCooldown(FaceSmasher.SL["Howling Blast"])
if d <= 1.5 then
return FaceSmasher.SL["Howling Blast"]
end
end
-- If the target needs IT or PS, this will get filtered out in the DecideSpells. We use dDuration since we should only pest once per disease application optimally
if IsSpellInRange(FaceSmasher.SL["Pestilence"], "target") == 1 then
if runes[1] > 0 or runes[4] > 0 then
return FaceSmasher.SL["Pestilence"]
end
end
-- Blood boil... I guess
if runes[1] > 0 or runes[4] > 0 then
if IsSpellInRange(FaceSmasher.SL["Blood Boil"], "target") == 1 then
return FaceSmasher.SL["Blood Boil"]
end
end
return ""
end
function FaceSmasher:MiscSpell(runes, runic)
local guid = UnitGUID("target")
local currentTime = GetTime()
local GCD = 1.5 - (1.5 * FaceSmasher.spellHaste * .01)
-- Let's dance... if we're blood.
if IsUsableSpell(FaceSmasher.SL["Dancing Rune Weapon"]) then
local s, d, e = GetSpellCooldown(FaceSmasher.SL["Dancing Rune Weapon"])
if d <= 1.5 then
if runic >= 100 then
FaceSmasher.lockRunic = false;
return FaceSmasher.SL["Dancing Rune Weapon"]
else
FaceSmasher.lockRunic = true;
end
end
end
-- check if rune strike is up cause it's awsome
if IsUsableSpell(FaceSmasher.SL["Rune Strike"]) then
return FaceSmasher.SL["Rune Strike"]
end
if FaceSmasherdb.horn and IsUsableSpell(FaceSmasher.SL["Horn of Winter"]) and not FaceSmasher.horn then
local s, d, e = GetSpellCooldown(FaceSmasher.SL["Horn of Winter"])
if d <= 1.5 then
return FaceSmasher.SL["Horn of Winter"]
end
end
return ""
end
function FaceSmasher:IntSpell(runes, runic)
local guid = UnitGUID("target")
local currentTime = GetTime()
local GCD = 1.5 - (1.5 * FaceSmasher.spellHaste * .01)
local spell = UnitCastingInfo("target")
local channel = UnitChannelInfo("target")
if spell or channel then
if IsUsableSpell(FaceSmasher.SL["Mind Freeze"]) and IsSpellInRange(FaceSmasher.SL["Mind Freeze"], "target") == 1 then
local s, d, e = GetSpellCooldown(FaceSmasher.SL["Mind Freeze"])
if d == 0 then
return FaceSmasher.SL["Mind Freeze"]
end
elseif IsUsableSpell(FaceSmasher.SL["Strangulate"]) and IsSpellInRange(FaceSmasher.SL["Strangulate"], "target") == 1 then
local s, d, e = GetSpellCooldown(FaceSmasher.SL["Strangulate"])
if d <= 1.5 then
return FaceSmasher.SL["Strangulate"]
end
end
end
local petspell = UnitCastingInfo("pettarget")
local petchannel = UnitChannelInfo("pettarget")
if petspell or petchannel then
if IsUsableSpell(FaceSmasher.SL["Leap"]) and IsSpellInRange(FaceSmasher.SL["Leap"], "pettarget") == 1 then
local s, d, e = GetSpellCooldown(FaceSmasher.SL["Gnaw"])
if d == 0 then