-
Notifications
You must be signed in to change notification settings - Fork 3
/
Rotation.lua
3694 lines (3261 loc) · 104 KB
/
Rotation.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
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
local DMW = DMW
local Warrior = DMW.Rotations.WARRIOR
local Rotation = DMW.Helpers.Rotation
local Setting = DMW.Helpers.Rotation.Setting
local Player, Buff, Debuff, Spell, Stance, Target, Talent, Item, GCD, CDs, HUD, Enemy5Y, Enemy5YC, Enemy10Y, Enemy10YC, Enemy30Y,
Enemy30YC, Enemy8Y, Enemy8YC, dumpEnabled, castTime, syncSS, combatLeftCheck, stanceChangedSkill,
stanceChangedSkillTimer, stanceChangedSkillUnit, targetChange, whatIsQueued, oldTarget, firstCheck,
secondCheck, thirdCheck, SwingMH, SwingOH, MHSpeed, PosX, PosY, PosZ, name
local Enemy5YC = nil
local Enemy10YC = nil
local Enemy30YC = nil
local effectiveAP = 1500
local UseCDsTime = 0
local ExposeArmor = false
local Bandaged = false
local ExposedGUID = {}
local ReadyCooldownCountValue
local ItemUsage = GetTime()
local PrintTime = GetTime()
local armorMitigation = 0.5
local TargetArmor = 3500
local DmgModiBuffOrStance = 1
local TargetSundered = nil
local hasMainHandEnchant, mainHandExpiration, _ , mainHandEnchantID, hasOffHandEnchant, offHandExpiration, _ , offHandEnchantId = GetWeaponEnchantInfo()
local isTanking, threatStatus, threatPercent, rawThreatPercent, threatValue
local AggroMobCount = 0
local AggroEliteMobCount = 0
local WindFuryExTimeMainHand = 0
local WindFuryExTimeOffHand = 0
local WindFuryMainHand = false
local WindFuryOffHand = false
local function round(num, numDecimalPlaces)
local mult = 10^(numDecimalPlaces or 0)
return math.floor(num * mult + 0.5) / mult
end
local stanceNumber = {[1] = "Battle", [2] = "Defensive", [3] = "Berserk"}
local stanceCheck = {
Battle = {
["Bloodthirst"] = true,
["MortalStrike"] = true,
["Bloodrage"] = true,
["Overpower"] = true,
["Hamstring"] = true,
["MockingBLow"] = true,
["Rend"] = true,
["Retaliation"] = true,
["SweepStrikes"] = true,
["ThunderClap"] = true,
["Charge"] = true,
["Execute"] = true,
["Slam"] = true,
["SunderArmor"] = true,
["ShieldBash"] = true
},
Defensive = {
["Bloodthirst"] = true,
["MortalStrike"] = true,
["Bloodrage"] = true,
["Rend"] = true,
["Disarm"] = true,
["Revenge"] = true,
["ShieldBlock"] = true,
["ShieldBash"] = true,
["ShieldWall"] = true,
["ShieldSlam"] = true,
["Slam"] = true,
["SunderArmor"] = true,
["Taunt"] = true
},
Berserk = {
["BersRage"] = true,
["MortalStrike"] = true,
["Bloodthirst"] = true,
["Bloodrage"] = true,
["Hamstring"] = true,
["Intercept"] = true,
["Pummel"] = true,
["Slam"] = true,
["SunderArmor"] = true,
["Recklessness"] = true,
["Whirlwind"] = true,
["Execute"] = true
}
}
local interruptList = {
["Heal"] = true,
["Polymorph"] = true,
["Chain Heal"] = true,
["Venom Spit"] = true,
["Bansheee Curse"] = true,
["Polymorph"] = true,
["Holy Light"] = true,
["Fear"] = true,
["Flame Cannon"] = true,
["Renew"] = true
}
local SunderImmune = {["Totem"] = true, ["Mechanical"] = true}
local function EnemiesAroundTarget5Y()
if Target
then
return select(2, Target:GetEnemies(5))
else
return nil
end
end
--Checks what spell is in Q
local function checkOnHit()
-- for k,v in ipairs(Spell.HeroicStrike.Ranks) do
-- if IsCurrentSpell(v) then
-- return true
-- end
-- end
for k, v in ipairs(Spell.HeroicStrike.Ranks) do if IsCurrentSpell(v) then return "HS" end end
for k, v in ipairs(Spell.Cleave.Ranks) do if IsCurrentSpell(v) then return "CLEAVE" end end
return "NA"
end
local function CDKeyPressed()
if Setting("CoolD Mode") == 3
and Setting("Key for CDs") == 2 --LeftShift
and IsLeftShiftKeyDown()
then
return true
elseif Setting("CoolD Mode") == 3
and Setting("Key for CDs") == 3 --LeftControl
and IsLeftControlKeyDown()
then
return true
elseif Setting("CoolD Mode") == 3
and Setting("Key for CDs") == 4 --LeftAlt
and IsLeftAltKeyDown()
then
return true
elseif Setting("CoolD Mode") == 3
and Setting("Key for CDs") == 5 --RightShift
and IsRightShiftKeyDown()
then
return true
elseif Setting("CoolD Mode") == 3
and Setting("Key for CDs") == 6 --RightControl
and IsRightControlKeyDown()
then
return true
elseif Setting("CoolD Mode") == 3
and Setting("Key for CDs") == 7 --RightAlt
and IsRightAltKeyDown()
then
return true
end
end
local function ReadyCooldown()
ReadyCooldownCountValue = 0
if Setting("Trinkets")
and Item.DiamondFlask:Equipped()
and Item.DiamondFlask:CD() <= 1.6
then
ReadyCooldownCountValue = ReadyCooldownCountValue + 1
end
if Setting("DeathWish")
and Spell.DeathWish:Known()
and Spell.DeathWish:CD() <= 1.6
then
ReadyCooldownCountValue = ReadyCooldownCountValue + 1
end
if Setting("Trinkets")
and Item.Earthstrike:Equipped()
and Item.Earthstrike:CD() == 0
then
ReadyCooldownCountValue = ReadyCooldownCountValue + 1
end
if Setting("Trinkets")
and Item.JomGabbar:Equipped()
and Item.JomGabbar:CD() == 0
then
ReadyCooldownCountValue = ReadyCooldownCountValue + 1
end
if Setting("Trinkets")
and Item.BadgeoftheSwarmguard:Equipped()
and Item.BadgeoftheSwarmguard:CD() == 0
then
ReadyCooldownCountValue = ReadyCooldownCountValue + 1
end
if Setting("Trinkets")
and Item.KissoftheSpider:Equipped()
and Item.KissoftheSpider:CD() == 0
then
ReadyCooldownCountValue = ReadyCooldownCountValue + 1
end
if Setting("Trinkets")
and Item.SlayersCrest:Equipped()
and Item.SlayersCrest:CD() == 0
then
ReadyCooldownCountValue = ReadyCooldownCountValue + 1
end
if Setting("Racials")
and Spell.BloodFury:Known()
and Spell.BloodFury:CD() <= 1.6
then
ReadyCooldownCountValue = ReadyCooldownCountValue + 1
end
if Setting("Racials")
and Spell.BerserkingTroll:Known()
and Spell.BerserkingTroll:CD() == 0
then
ReadyCooldownCountValue = ReadyCooldownCountValue + 1
end
if Setting("Recklessness")
and Spell.Recklessness:Known()
and Spell.Recklessness:CD() <= 1.6
then
ReadyCooldownCountValue = ReadyCooldownCountValue + 1
end
if Setting("Use Best Rage Potion") and ((GetItemCount(13442) >= 1 and GetItemCooldown(13442) <= 1.6) or (GetItemCount(5633) >= 1 and GetItemCooldown(5633) <= 1.6))
then
ReadyCooldownCountValue = ReadyCooldownCountValue + 1
end
if ReadyCooldownCountValue > 0
then return true
elseif ReadyCooldownCountValue == 0
then return false
end
end
local function CdTriggers()
-- Sets sweeping strikes to of after use
if Setting("Auto Disable SS")
and HUD.Sweeping == 1
and Buff.SweepStrikes:Exist(Player)
then DMWHUDSWEEPING:Toggle(2)
end
-- activate Cds on Keypress
if Setting("CoolD Mode") == 3
and CDKeyPressed()
and ReadyCooldown()
and HUD.CDs == 3
then DMWHUDCDS:Toggle(2)
UseCDsTime = GetTime()
elseif Setting("CoolD Mode") == 3
and (not ReadyCooldown() or not Player.Combat)
and (HUD.CDs == 2 or HUD.CDs == 1)
then DMWHUDCDS:Toggle(3)
end
end
local function GetStanceAndChecks()
if Setting("RotationType") == 1 or Setting("Use Leveling Rotation")
then
firstCheck = "Berserk"
secondCheck = "Battle"
thirdCheck = "Defensive"
elseif Setting("RotationType") == 2
then
firstCheck = "Defensive"
secondCheck = "Battle"
thirdCheck = "Berserk"
end
-- getting actual Stance
if select(2, GetShapeshiftFormInfo(1)) then
Stance = "Battle"
elseif select(2, GetShapeshiftFormInfo(2)) then
Stance = "Defensive"
elseif select(2, GetShapeshiftFormInfo(3)) then
Stance = "Berserk"
end
end
local function RageLostOnStanceDanceF()
local TacticalM = 0
if Setting("Tactical Mastery") ~= nil
then TacticalM = Setting("Tactical Mastery")
end
-- Talent.TacticalMastery.Rank
local RageLost = Player.Power - TacticalM * 5
if not RageLost or RageLost == nil
then RageLost = Player.Power
return RageLost
elseif RageLost <= 0
then RageLost = 0
return RageLost
elseif RageLost > 0
then return RageLost
end
end
local function ArmorCalcThings()
if not (Target or not Player.Combat)
then
armorMitigation = 0.5
TargetArmor = 3500
end
local a,b,c = 1, 1, 1
if Buff.SaygesDarkFortuneofDamage:Exist(Player)
then a = 1.1
else a = 1
end
if Buff.TracesofSilithyst:Exist(Player)
then b = 1.05
else b = 1
end
if Stance == "Defensive"
then c = 0.9
else c = 1
end
DmgModiBuffOrStance = a * b * c
end
local function TableAndStanceReset()
if not Player.Combat
then
if next(ExposedGUID) ~= nil --then empty it
then
table.wipe(ExposedGUID)
end
stanceChangedSkill = nil
stanceChangedSkillUnit = nil
stanceChangedSkillTimer = nil
LastTargetFaced = nil
elseif stanceChangedSkillTimer
and DMW.Time - stanceChangedSkillTimer >= 0.5
then
stanceChangedSkill = nil
stanceChangedSkillUnit = nil
stanceChangedSkillTimer = nil
end
end
local function HasTargetExposedDebuff()
if Target
and next(ExposedGUID) ~= nil
and Player.Combat
and Target.Distance < 30
then
for k, v in pairs(ExposedGUID) do
if k == UnitGUID("target")
and v == true
then
ExposeArmor = true
break
elseif k == UnitGUID("target")
and v ~= true
then
ExposeArmor = false
break
end
end
else
ExposeArmor = false
end
end
local function NotInWWRangeWarning()
if Setting("Print WW Range Info")
and Player.Combat
and UnitInRaid("player") ~= nil
and Target
and Target:RawDistance() > 8
and IsSpellInRange("Hamstring", "target") == 1
then
print("Target not in 8 yards WW-Range...Distance= ", round(Target:RawDistance(), 2))
end
end
local function Locals()
Player = DMW.Player
Buff = Player.Buffs
Debuff = Player.Debuffs
Spell = Player.Spells
Talent = Player.Talents
Item = Player.Items
Target = (Player.Target or false)
HUD = DMW.Settings.profile.HUD
CDs = Player:CDs()
Enemy5Y, Enemy5YC = Player:GetEnemies(5)
Enemy8Y, Enemy8YC = Player:GetEnemies(8)
Enemy10Y, Enemy10YC = Player:GetEnemies(10)
Enemy30Y, Enemy30YC = Player:GetEnemies(30)
GCD = Player:GCDRemain()
dumpEnabled = false
syncSS = false
whatIsQueued = checkOnHit()
if castTime == nil then castTime = DMW.Time end
local base, posBuff, negBuff = UnitAttackPower("player")
local effectiveAP = base + posBuff + negBuff
if HUD.Spec == 1
then DMW.Settings.profile.Rotation.RotationType = 1
elseif HUD.Spec == 2
then DMW.Settings.profile.Rotation.RotationType = 2
end
CdTriggers()
GetStanceAndChecks()
ArmorCalcThings()
TableAndStanceReset()
if Setting("ExposedArmorRogue")
then
HasTargetExposedDebuff()
end
NotInWWRangeWarning()
end
-- Getting GetDebuffStacks
local function GetDebuffStacks()
--local timeStamp, subEvent, _, sourceID, sourceName, _, _, targetID = ...;
if Setting("ExposedArmorRogue")
and select(2, DMW.Player:GetEnemies(30)) ~= nil
and select(2, DMW.Player:GetEnemies(30)) > 0
then
for _, Unit in ipairs(DMW.Player:GetEnemies(30)) do
for i = 1, 16 do
if UnitDebuff(Unit.Pointer, i) == "Expose Armor" then
ExposedGUID[UnitGUID(Unit.Pointer)] = true
break
elseif UnitDebuff(Unit.Pointer, i) ~= "Expose Armor" then
ExposedGUID[UnitGUID(Unit.Pointer)] = false
end
end
end
end
if not IsMounted()
and not DMW.Player:IsPlayerReallyDead()
then
for i = 1, 16 do
if UnitDebuff("player", i) == "Recently Bandaged" then
Bandaged = true
break
elseif UnitDebuff("player", i) ~= "Recently Bandaged" then
Bandaged = false
end
end
end
end
local function Buffsniper()
local worldbufffound = false
if (Setting("WCB") or Setting("Ony_Nef") or Setting("ZG"))
then
if Setting("WCB")
and not Setting("Ony_Nef")
and not Setting("ZG")
then
for i = 1, 32 do
if select(10, UnitAura("player", i)) == 16609 then
worldbufffound = true
break end
end
elseif Setting("Ony_Nef")
and not Setting("WCB")
and not Setting("ZG")
then
for i = 1, 32 do
if select(10, UnitAura("player", i)) == 22888 then
worldbufffound = true
break end
end
elseif Setting("ZG")
and not Setting("WCB")
and not Setting("Ony_Nef")
then
for i = 1, 32 do
if select(10, UnitAura("player", i)) == 24425 then
worldbufffound = true
break end
end
end
if worldbufffound then
DMW.Settings.profile.Rotation.WCB = false
DMW.Settings.profile.Rotation.Ony_Nef = false
DMW.Settings.profile.Rotation.ZG = false
Logout()
end
end
end
local function GetWindfury()
hasMainHandEnchant, mainHandExpiration, _ , mainHandEnchantID, hasOffHandEnchant, offHandExpiration, _ , offHandEnchantId = GetWeaponEnchantInfo()
if hasMainHandEnchant
and (mainHandEnchantID == 563 or mainHandEnchantID == 564 or mainHandEnchantID == 1783)
and mainHandExpiration >= 0
then
WindFuryMainHand = true
WindFuryExTimeMainHand = DMW.Time + mainHandExpiration * 1000
elseif (hasMainHandEnchant and (mainHandEnchantID ~= 563 or mainHandEnchantID ~= 564 or mainHandEnchantID ~= 1783)) or not hasMainHandEnchant
then
WindFuryMainHand = false
WindFuryExTimeMainHand = DMW.Time
end
if hasOffHandEnchant
and (offHandEnchantIdD == 563 or offHandEnchantId == 564 or offHandEnchantId == 1783)
and offHandExpiration >= 0
then
WindFuryOffHand = true
WindFuryExTimeOffHand = DMW.Time + offHandExpiration * 1000
elseif (hasOffHandEnchant and (offHandEnchantID ~= 563 or offHandEnchantID ~= 564 or offHandEnchantID ~= 1783)) or not hasOffHandEnchant
then
WindFuryOffHand = false
WindFuryExTimeOffHand = DMW.Time
end
if Setting("Print WindfuryStatus")
then
print("Windfurry Status Mainhand: ", WindFuryMainHand)
end
end
local function GetDTfromDetails()
if IsAddOnLoaded("Details! Damage Meter")
and Player.CombatTime >= 5
then
local currentCombat = Details:GetCurrentCombat()
local cT = currentCombat:GetCombatTime()
local damageTaken = 0
local DTPS = 0
for _, actor in currentCombat:GetContainer(DETAILS_ATTRIBUTE_DAMAGE):ListActors() do
if (actor:IsPlayer())
then
damageTaken = damageTaken + actor.damage_taken
DTPS = DTPS + (actor.damage_taken/cT)
return damageTaken, DTPS
end
end
else
return 0, 0
end
end
-- Calculation of Units Armor
local function GetArmorOfTarget(...)
Locals()
local timeStamp, subEvent, _, sourceID, sourceName, _, _, targetID, _,_,_, SpellID, SpellName,_,BtDmg,_,_,_,_,_, critical, glancing = ...;
local BtCalcDmg = 0.45 * effectiveAP
local CritMuti
if Talent.Impale.Rank == 1
then CritMuti = 2.1
elseif Talent.Impale.Rank == 2
then CritMuti = 2.2
else CritMuti = 2
end
if critical
then
DamageBT = (BtDmg / DmgModiBuffOrStance) / CritMuti
else
DamageBT = (BtDmg / DmgModiBuffOrStance)
end
armorMitigation = (BtCalcDmg - DamageBT) / BtCalcDmg
TargetArmor = ((85 * UnitLevel("player") * armorMitigation + 400 * armorMitigation)/ (1 - armorMitigation))
-- if TargetArmor < 0
-- then TargetArmor = 0
-- end
if Setting("Print Target Armor")
and TargetArmor >= 0
then print("Target Armor: ", round(TargetArmor, 2))
elseif Setting("Print Target Armor")
and TargetArmor < 0
then print("Target Armor: 0")
end
if Setting("Print Armormitigation")
and round(armorMitigation, 4) >= 0
then print("Armormitigation: ", round(armorMitigation, 4))
elseif Setting("Print Armormitigation")
and round(armorMitigation, 4) < 0
then print("Armormitigation: 0")
end
end
--calculate rage values per MH and Offhand hit
local function ragegain(t)--t is the time for which we calculate the rage income
--calculate rage values per MH and Offhand hit
local minDamage, maxDamage, minOffHandDamage, maxOffHandDamage = UnitDamage("player")
local cFactor = 0.0091107836 * (UnitLevel("player"))^2 + 3.225598133 * (UnitLevel("player"))^2 + 4.2652911
local mainhandSpeed = select(1, UnitAttackSpeed("player"))
local calcDamageDoneMH = DmgModiBuffOrStance* (((maxDamage + minDamage) / 2) + (effectiveAP / 14) * mainhandSpeed)
local rageFromDamageMH = (calcDamageDoneMH * (1 - armorMitigation)) / cFactor * 7.5
local hasOffHand = false
local offhandSpeed = select(2, UnitAttackSpeed("player"))
local calcDamageOH = 0
local rageFromDamageOffH = 0
local RageFromAngerPerSec = Talent.AngerManagement.Rank / 3
if not t
then return 0
end
--Check for Offhand
if (not offhandSpeed) or (offhandSpeed == 0)
then
hasOffHand = false
else
hasOffHand = true
end
if hasOffHand
then
calcDamageOH = DmgModiBuffOrStance *(((minOffHandDamage + maxOffHandDamage)/2) + (effectiveAP / 14) * offhandSpeed * (0.5 + 0.025 * Talent.DuelWieldSpec.Rank))
rageFromDamageOffH = (calcDamageOH * (1 - armorMitigation)) / cFactor * 7.5
end
--calculate rage values per Damage Taken infight (via Deatails addon)
local damageTaken = select(1,GetDTfromDetails())
local DTPS = select(2,GetDTfromDetails())
local rageFromDamageTakenPerSec = DTPS / cFactor * 2.5
--calculate the summary of rage over t value
local rageFromDamageTakenOverTime = rageFromDamageTakenPerSec * t
local rageFromTalents = RageFromAngerPerSec * t
local rageFromDamage = 0
local MainHandSwings,OffHandSwings = 1, 1
if hasOffHand
then
if (Player.SwingMH + 2 * mainhandSpeed) <= t
then MainHandSwings = 3
elseif (Player.SwingMH + mainhandSpeed) <= t
then MainHandSwings = 2
elseif Player.SwingMH <= t
then MainHandSwings = 1
elseif Player.SwingMH > t
then MainHandSwings = 0
end
if (Player.SwingOH + 2 * offhandSpeed) <= t
then MainHandSwings = 3
elseif (Player.SwingOH + offhandSpeed) <= t
then OffHandSwings = 2
elseif Player.SwingOH <= t
then OffHandSwings = 1
elseif Player.SwingOH > t
then OffHandSwings = 0
end
rageFromDamage = MainHandSwings * rageFromDamageMH + OffHandSwings * rageFromDamageOffH + rageFromDamageTakenOverTime + rageFromTalents
return rageFromDamage
elseif not hasOffHand
then
if (Player.SwingMH + 2 * mainhandSpeed) <= t
then MainHandSwings = 3
elseif (Player.SwingMH + mainhandSpeed) <= t
then MainHandSwings = 2
elseif Player.SwingMH <= t
then MainHandSwings = 1
elseif Player.SwingMH > t
then MainHandSwings = 0
end
rageFromDamage = MainHandSwings * rageFromDamageMH + OffHandSwings * rageFromDamageOffH + rageFromDamageTakenOverTime + rageFromTalents
return rageFromDamage
end
return 0
end
--Can we Slam Function
local function CanSlam()
local latency = (select(4, GetNetStats()) / 1000) or 0
local slamSpeed = (1.5 - (0.1 * Talent.ImprovedSlam.Rank))
if not Player.Moving
and (select(1, UnitAttackSpeed("player")) - Player.SwingMH) <= 0.15
and select(1, UnitAttackSpeed("player")) >= (slamSpeed + latency)
and IsSpellInRange("Slam", "target") == 1
then
return true
end
end
-- cancel Yellow hit when the mod is called
local function cancelAAmod()
if IsCurrentSpell(Spell.Cleave.SpellID)
or IsCurrentSpell(Spell.HeroicStrike.SpellID)
then SpellStopCasting()
end
end
local function stanceDanceCast(spell, dest, stance)
if (Setting("FuckRage&StanceDance") or (RageLostOnStanceDanceF() <= Setting("RageLose on StanceChange"))) then
if GetShapeshiftFormCooldown(1) == 0 and not stanceChangedSkill and Player.Power >= Spell[spell]:Cost() and Spell[spell]:CD() <= 0.3 then
if stance == "Battle" then
if Spell.StanceBattle:Cast() then
stanceChangedSkill = spell
stanceChangedSkillTimer = DMW.Time
stanceChangedSkillUnit = dest
return true
end
elseif stance == "Defensive" then
if Spell.StanceDefense:Cast() then
stanceChangedSkill = spell
stanceChangedSkillTimer = DMW.Time
stanceChangedSkillUnit = dest
return true
end
elseif stance == "Berserk" then
if Spell.StanceBers:Cast() then
stanceChangedSkill = spell
stanceChangedSkillTimer = DMW.Time
stanceChangedSkillUnit = dest
return true
end
end
end
elseif (Setting("RotationType") == 1 or Setting("RotationType") == 2) and not Setting("Use Leveling Rotation")
then
if dumpRage(RageLostOnStanceDanceF(), true)
then return true
end
elseif Setting("Use Leveling Rotation")
then
if dumpRageLeveling(Player.Power)
then return true
end
end
end
-- Regular Spellcast
local function regularCast(spell, Unit, pool)
if pool and Spell[spell]:Cost() > Player.Power then return true end
if Spell[spell]:Cast(Unit) then
return true end
end
-- Smartcast Spell with Stance Check
local function smartCast(spell, Unit, pool)
if Spell[spell] ~= nil then
if (Setting("RotationType") == 1 or Setting("RotationType") == 2 or Setting("Use Leveling Rotation"))
then
if stanceCheck[firstCheck][spell] then
if Stance == firstCheck then
if Spell[spell]:Cast(Unit) then
return true end
else
if stanceDanceCast(spell, Unit, firstCheck) then
return true end
end
elseif stanceCheck[secondCheck][spell] then
if Stance == secondCheck then
if Spell[spell]:Cast(Unit) then
return true end
else
if stanceDanceCast(spell, Unit, secondCheck) then
return true end
end
elseif stanceCheck[thirdCheck][spell] then
if Stance == thirdCheck then
if Spell[spell]:Cast(Unit) then
return true end
else
if stanceDanceCast(spell, Unit, thirdCheck) then
return true end
end
else
if Spell[spell]:Cast(Unit) then
return true end
end
end
if pool and Spell[spell]:CD() <= 1.5 then return true end
end
end
local function UnitsInFrontOfUS()
local InFrontOfUsCount = 0
for _, Unit in ipairs(Enemy5Y) do
if Unit:IsInFront()
then
InFrontOfUsCount = InFrontOfUsCount + 1
end
end
return InFrontOfUsCount
end
local function GetPlayersAroundCount(Yards)
local Table = {}
local Count = 0
for _, Unit in pairs(DMW.Units) do
if Unit.Player
and not Unit.Dead
and not UnitIsUnit("target", Unit.Pointer)
and Unit:GetDistance(v) <= Yards
then
table.insert(Table, v)
Count = Count + 1
end
end
return Count - 1
end
-- Dumps Rage in first place with HS or Cleave -- if there is still rage it dumps it with the next part
local function dumpRage(dumpvalue,ignorecalc)
--------Slam Dump Harmstring over HS--------
if Setting("Slam")
and Setting("RotationType") == 1
and (Enemy5YC >= 2 or not Setting("Heroic Strike"))
-- and UnitsInFrontOfUS() >= 2
and Setting("Cleave")
and whatIsQueued == "NA"
and dumpvalue >= Spell.Cleave:Cost()
and (not Setting("Calculate Rage") or ignorecalc
or (Spell.Whirlwind:CD() < Spell.Bloodthirst:CD() and (Player.Power - Spell.Cleave:Cost() + ragegain(Spell.Whirlwind:CD())) >= Spell.Whirlwind:Cost())
or (Spell.Bloodthirst:CD() < Spell.Whirlwind:CD() and (Player.Power - Spell.Cleave:Cost() + ragegain(Spell.Bloodthirst:CD())) >= Spell.Bloodthirst:Cost()))
then
RunMacroText("/cast Cleave")
dumpvalue = dumpvalue - Spell.Cleave:Cost()
end
if Setting("Slam")
and Setting("Hamstring Dump")
and Setting("RotationType") == 1
and (stance == "Battle" or stance == "Berserk")
and Setting("Only HString MHSwing > 0.5")
and Player.Power >= Setting("Hamstring dump above # rage")
and Player.SwingMH > 0.5
and Spell.Hamstring:Known()
and dumpvalue >= Spell.Hamstring:Cost()
and GCD == 0
then
if Spell.Bloodthirst:Known()
and Spell.Bloodthirst:CD() >= 1.5
and Spell.Whirlwind:Known()
and Spell.Whirlwind:CD() >= 1.5
then
if regularCast("Hamstring", Target)
then
dumpvalue = dumpvalue - Spell.Hamstring:Cost()
end
elseif Spell.MortalStrike:Known()
and Spell.MortalStrike:CD() >= 1.5
and Spell.Whirlwind:Known()
and Spell.Whirlwind:CD() >= 1.5
then
if regularCast("Hamstring", Target)
then
dumpvalue = dumpvalue - Spell.Hamstring:Cost()
end
end
elseif Setting("Slam")
and Setting("Hamstring Dump")
and Setting("RotationType") == 1
and (stance == "Battle" or stance == "Berserk")
and not Setting("Only HString MHSwing > 0.5")
and Player.Power >= Setting("Hamstring dump above # rage")
and Spell.Hamstring:Known()
and dumpvalue >= Spell.Hamstring:Cost()
and GCD == 0
then
if Spell.Bloodthirst:Known()
and Spell.Bloodthirst:CD() >= 1.5
and Spell.Whirlwind:Known()
and Spell.Whirlwind:CD() >= 1.5
then
if regularCast("Hamstring", Target)
then
dumpvalue = dumpvalue - Spell.Hamstring:Cost()
end
elseif Spell.MortalStrike:Known()
and Spell.MortalStrike:CD() >= 1.5
and Spell.Whirlwind:Known()
and Spell.Whirlwind:CD() >= 1.5
then
if regularCast("Hamstring", Target)
then
dumpvalue = dumpvalue - Spell.Hamstring:Cost()
end
end
end
--------------normal dump part--------------
if whatIsQueued == "NA"
then
if (Setting("RotationType") == 1 and Setting("Cleave"))
and (Enemy5YC >= 2 or (Setting("RotationType") == 1 and not Setting("Heroic Strike")))
-- and UnitsInFrontOfUS() >= 2
and dumpvalue >= Spell.Cleave:Cost()
and (not Setting("Calculate Rage") or ignorecalc
or (Spell.Whirlwind:CD() < Spell.Bloodthirst:CD() and (Player.Power - Spell.Cleave:Cost() + ragegain(Spell.Whirlwind:CD())) >= Spell.Whirlwind:Cost())
or (Spell.Bloodthirst:CD() < Spell.Whirlwind:CD() and (Player.Power - Spell.Cleave:Cost() + ragegain(Spell.Bloodthirst:CD())) >= Spell.Bloodthirst:Cost()))
then
RunMacroText("/cast Cleave")
dumpvalue = dumpvalue - Spell.Cleave:Cost()
elseif (Setting("RotationType") == 2 and Setting("Cleave_FP"))
and Enemy5YC >= 2
-- and UnitsInFrontOfUS() >= 2
and dumpvalue >= Spell.Cleave:Cost()
and (not Setting("Calculate Rage") or ignorecalc
or (Player.Power - Spell.Cleave:Cost() + ragegain(Spell.Bloodthirst:CD())) >= Spell.Bloodthirst:Cost())
then
RunMacroText("/cast Cleave")
dumpvalue = dumpvalue - Spell.Cleave:Cost()
elseif dumpvalue >= Spell.HeroicStrike:Cost()
and (Setting("RotationType") == 1 and Setting("Heroic Strike"))
then
if Spell.Bloodthirst:Known()
and (not Setting("Calculate Rage") or ignorecalc
or (Spell.Bloodthirst:CD() < Spell.Whirlwind:CD() and (Player.Power - Spell.HeroicStrike:Cost() + ragegain(Spell.Bloodthirst:CD())) >= Spell.Bloodthirst:Cost())
or (Spell.Whirlwind:CD() < Spell.Bloodthirst:CD() and (Player.Power - Spell.HeroicStrike:Cost() + ragegain(Spell.Whirlwind:CD())) >= Spell.Whirlwind:Cost()))
then
RunMacroText("/cast Heroic Strike")
dumpvalue = dumpvalue - Spell.HeroicStrike:Cost()
elseif Spell.MortalStrike:Known()
and (not Setting("Calculate Rage") or ignorecalc
or (Spell.MortalStrike:CD() < Spell.Whirlwind:CD() and (Player.Power - Spell.HeroicStrike:Cost() + ragegain(Spell.MortalStrike:CD())) >= Spell.MortalStrike:Cost())
or (Spell.Whirlwind:CD() < Spell.MortalStrike:CD() and (Player.Power - Spell.HeroicStrike:Cost() + ragegain(Spell.Whirlwind:CD())) >= Spell.Whirlwind:Cost()))
then
RunMacroText("/cast Heroic Strike")
dumpvalue = dumpvalue - Spell.HeroicStrike:Cost()
end
elseif dumpvalue >= Spell.HeroicStrike:Cost()
and ((Setting("RotationType") == 2 and Setting("Heroic Strike_FP")))
then
if Spell.Bloodthirst:Known()
and (not Setting("Calculate Rage") or ignorecalc
or (Player.Power - Spell.HeroicStrike:Cost() + ragegain(Spell.Bloodthirst:CD())) >= Spell.Bloodthirst:Cost())
then