-
Notifications
You must be signed in to change notification settings - Fork 11
/
Fury.lua
2672 lines (2463 loc) · 97.3 KB
/
Fury.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
--[[
Fury
Extended By: CubeNicke
Originally By: Bhaerau
]]--
--------------------------------------------------
--
-- Variables
--
--------------------------------------------------
-- Setup configuration to default or only new ones
local function DoUpdateConfiguration(defaults)
local configs = {
{"AutoAttack", true}, -- Set to false to disable auto-attack
{"BerserkHealth", 60}, -- Set this to the minimum percent of health to have when using Berserk
{"BloodrageHealth", 50}, -- Set this to the minimum percent of health to have when using Bloodrage
{"DeathWishHealth", 60}, -- Set this to the minimum percent of health to have when using Death Wish
{"Debug", false}, -- Set to true to enable debugging feedback
{"DebugChannel", nil}, -- Channel to log to
{"DemoDiff", 7}, -- When level difference is greater don't do Demoralizing Shout
{"Enabled", true}, -- Set to false to disable the addon
{"ExecuteSwap", false}, -- Swap weapon at execute
{"ExecuteSwapped", false}, -- If execute outfit is equipped
{"FlurryTriggerRage", 52}, -- Set this to the minimum rage to use Hamtring to trigger Flurry
{"HamstringHealth", 40}, -- Set this to the maximum percent of health allowed when using Hamstring on NPCs
{"InstantBuildTime", 2}, -- Set the time to spend building rage for upcoming 31 point instant attacks
{"MaximumRage", 60}, -- Set this to the maximum amount of rage allowed when using abilities to increase rage
{"NextAttackRage", 30}, -- Set this to the minimum rage to have to use next attack abilities (Cleave and Heroic Strike)
{"StanceChangeRage", 25}, -- Set this to the amount of rage allowed to be wasted when switching stances
{"PrimaryStance", false}, -- Set this to the stance to fall back to after performing an attack requiring another stance
{MODE_HEADER_PROT, false }, -- Use threat and defensive abilities
{MODE_HEADER_AOE, false}, -- Disable auto use of aoe (Disables OP, HS, BT, Exe, Enablse Cleave, Whirlwind)
{MODE_HEADER_DEBUFF, false}, -- use cures when player have a debuff
{ABILITY_BATTLE_SHOUT_FURY, true}, -- Set to false to disable use of ability
{ABILITY_BERSERKER_RAGE_FURY, true}, -- Used to counter fears
{ABILITY_BLOODRAGE_FURY, true}, -- Gives extra rage
{ABILITY_BLOODTHIRST_FURY, true}, -- Fury main attack
{ABILITY_CHARGE_FURY, true}, -- Charge when out of combat
{ABILITY_CLEAVE_FURY, false}, -- Cleave to lower threat and on used in aoe situations
{ABILITY_DEMORALIZING_SHOUT_FURY, true}, -- Decreases enemy attack power
{ABILITY_DISARM_FURY, true}, -- Used in pvp against hard hitters
{ABILITY_EXECUTE_FURY, true}, -- Execute
{ABILITY_HAMSTRING_FURY, true}, -- Hamstring
{ABILITY_PIERCING_HOWL_FURY, true}, -- Piercing Howl
{ABILITY_HEROIC_STRIKE_FURY, true}, -- HS, to dump rage and at low levels
{ABILITY_INTERCEPT_FURY, true}, -- in combat charge
{ABILITY_MORTAL_STRIKE_FURY, true}, -- Arms main attack
{ABILITY_SWEEPING_STRIKES_FURY, true}, -- Aoe for arms
{ABILITY_OVERPOWER_FURY, true}, -- Counterattack dodge
{ABILITY_PUMMEL_FURY, true}, -- Counter spellcast
{ABILITY_REND_FURY, true}, -- Counter rogues vanish
{ABILITY_SHIELD_BASH_FURY, true}, -- Prot
{ABILITY_SHIELD_SLAM_FURY, true}, -- Prot
{ABILITY_DEATH_WISH_FURY, true}, -- Death wish on cooldown
{ABILITY_THUNDER_CLAP_FURY, true}, -- slow enemies
{ABILITY_WHIRLWIND_FURY, true}, -- Fury rotation and aoe
{ABILITY_REVENGE_FURY, false}, -- Prot
{ITEM_CONS_JUJU_CHILL, true}, -- use on cooldown for bosses with frost dmg
{ITEM_CONS_JUJU_EMBER, true}, -- use on cooldown for bosses with fire dmg
{ITEM_CONS_JUJU_FLURRY, false}, -- use on cooldown
{ITEM_CONS_JUJU_MIGHT, false}, -- use on cooldown
{ITEM_CONS_JUJU_POWER, false}, -- use on cooldown
{ITEM_CONS_OIL_OF_IMMOLATION, false}, -- use on cooldown
{ITEM_TRINKET_EARTHSTRIKE, true}, -- use on cooldown
{ITEM_TRINKET_KOTS, true}, -- use on cooldown
{ITEM_TRINKET_SLAYERS_CREST, true}, -- use on cooldown
{RACIAL_BERSERKING_FURY, true}, -- Racial
{RACIAL_BLOOD_FURY, true}, -- Racial
{RACIAL_STONEFORM_FURY, true}, -- Racial
}
for _, v in pairs(configs) do
if defaults
or Fury_Configuration[v[1]] == nil then
Fury_Configuration[v[1]] = v[2]
end
end
end
--------------------------------------------------
-- Init function
local function Fury_Configuration_Init()
FURY_VERSION = "1.17.4"
if not Fury_Configuration then
Fury_Configuration = { }
end
if not Fury_Runners then
Fury_Runners = { }
end
if not Fury_ImmuneDisarm then
Fury_ImmuneDisarm = { }
end
DoUpdateConfiguration(false) -- Set to value if nil
end
--------------------------------------------------
--
-- Normal Functions
--
--------------------------------------------------
-- Print msg to console
local function Print(msg)
if not DEFAULT_CHAT_FRAME then
return
end
DEFAULT_CHAT_FRAME:AddMessage(BINDING_HEADER_FURY..": "..(msg or ""))
end
--------------------------------------------------
-- Output debug info to console
local function Debug(msg)
if (msg
or "") == "" then
FuryRageDumped = nil
return
end
if Fury_Configuration
and Fury_Configuration["Debug"] then
Print(msg)
end
if Fury_Configuration["DebugChannel"]
and UnitLevel("player") >= 10 then
if GetTime() > FuryLastLog + 0.1 then
SendChatMessage(msg..(FuryLogMsg or ""), "CHANNEL", nil, Fury_Configuration["DebugChannel"])
FuryLastLog = GetTime()
FuryLogMsg = nil
else
FuryLogMsg = (FuryLogMsg or "")..", "..msg
end
end
FuryRageDumped = nil
end
--------------------------------------------------
-- Log fury debug to channel and log file
local function LogToFile(enable)
if enable then
LoggingChat(1)
LoggingCombat(1)
if Fury_Configuration["DebugChannel"] == nil then
local channel = "Fury_"..tostring(GetTime() * 1000)
JoinChannelByName(channel, "test", nil, 1)
local id, _ = GetChannelName(channel)
Fury_Configuration["DebugChannel"] = id
else
local _, channel = GetChannelName(Fury_Configuration["DebugChannel"])
if channel ~= nil then
Print("Joining channel : "..channel)
JoinChannelByName(channel, "test", nil, 1)
else
Fury_Configuration["DebugChannel"] = nil
LogToFile(enable)
end
end
Print(TEXT_FURY_LOGGING_CHANNEL_ON)
else
LoggingChat(0)
LoggingCombat(0)
Fury_Configuration["DebugChannel"] = nil
Print(TEXT_FURY_LOGGING_CHANNEL_OFF)
end
end
--------------------------------------------------
-- Check if unit has debuff of specific type
local function HasDebuffType(unit, type)
local id = 1
if not type then
return nil
end
while UnitDebuff(unit, id) do
local _,_,debuffType = UnitDebuff(unit, id)
if type
and debuffType == type then
return true
end
id = id + 1
end
return nil
end
--------------------------------------------------
local function DoShapeShift(stance)
local stances = {ABILITY_BATTLE_STANCE_FURY, ABILITY_DEFENSIVE_STANCE_FURY, ABILITY_BERSERKER_STANCE_FURY}
CastShapeshiftForm(stance)
FuryLastStanceCast = GetTime()
Debug("Changed to "..stances[stance])
end
--------------------------------------------------
-- Print unit buffs and debuffs
local function PrintEffects(unit)
local id = 1
if UnitBuff(unit, id) then
Print(SLASH_BUFFS_FURY)
while (UnitBuff(unit, id)) do
Print(UnitBuff(unit, id))
id = id + 1
end
id = 1
end
if HasDebuffType(unit) then
Print(TEXT_FURY_HAVE_DEBUFF)
end
if UnitDebuff(unit, id) then
Print(CHAT_DEBUFFS_FURY)
while UnitDebuff(unit, id) do
Print(UnitDebuff(unit, id))
id = id + 1
end
end
end
--------------------------------------------------
-- list of targets where resistance is useful
local res = {
["fire"] = {
BOSS_NAX_GRAND_WIDOW_FAERLINA_FURY,
BOSS_NAX_THANE_KORTH_AZZ_FURY,
BOXX_MC_RAGNAROS_FURY,
BOSS_ONYXIA_FURY
},
["frost"] = {
BOSS_NAX_KEL_THUZAD_FURY,
BOSS_NAX_SAPPHIRON_FURY
},
["nature"] = {
BOSS_NAX_HEIGAN_THE_UNCLEAN_FURY,
BOSS_NAX_LOATHEB_FURY,
BOSS_AQ40_PRINCESS_HUHURAN_FURY,
BOSS_AQ40_VISCIDUS_FURY,
},
["shadow"] = {
BOSS_NAX_LOATHEB_FURY,
BOSS_STRAT_BARON_RIVENDERE_FURY,
BOSS_NAX_LADY_BLAUMEUX_FURY
},
["arcane"] = {
BOSS_NAX_GOTHIK_THE_HARVESTER_FURY,
BOSS_AQ40_THE_PROPHET_SKERAM_FURY,
BOSS_AQ40_EMPEROR_VEK_LOR_FURY,
BOSS_MC_SHAZZRATH_FURY
},
["holy"] = {
BOSS_NAX_SIR_ZELIEK_FURY
}
}
--------------------------------------------------
-- Check if boss 'requires' resistance of specific type
local function IsUseRes(type)
for _, name in pairs(res[type]) do
if UnitName("target") == name then
return true
end
end
return false
end
--------------------------------------------------
--
-- Distance handling
--
--------------------------------------------------
-- Detect spells on action bars, to be used for range checks
local function Fury_InitDistance()
local found = 0
yard30 = nil
yard25 = nil
yard10 = nil
yard08 = nil
yard05 = nil
for i = 1, 120 do
t = GetActionTexture(i)
if t then
if not yard30 then
if string.find(t, "Ability_Marksmanship") -- Shoot
or string.find(t, "Ability_Throw") then -- Throw
yard30 = i
Debug("30 yard: "..t)
found = found + 1
end
end
if not yard25 then
if string.find(t, "Ability_Warrior_Charge") -- Charge
or string.find(t, "Ability_Rogue_Sprint") then -- Intercept
yard25 = i
Debug("25 yard: "..t)
found = found + 1
end
end
if not yard10 then
if string.find(t, "Ability_GolemThunderClap")
or string.find(t, "Spell_Nature_ThunderClap") then -- Thunder Clap
yard10 = i
Debug("10 yard: "..t)
found = found + 1
end
end
if not yard08 then
if string.find(t, "Ability_Marksmanship") -- Shoot
or string.find(t, "Ability_Throw") then -- Throw
yard08 = i
Debug("8 yard: "..t)
found = found + 1
end
end
if not yard05 then
if string.find(t, "Ability_Warrior_Sunder") -- Sunder Armor
or string.find(t, "Ability_Warrior_DecisiveStrike") -- Slam
or string.find(t, "Ability_Warrior_Disarm") -- Disarm
or string.find(t, "INV_Gauntlets_04") -- Pummel
or string.find(t, "Ability_MeleeDamage") -- Overpower
or string.find(t, "Ability_Warrior_PunishingBlow") -- Mocking blow
or string.find(t, "Ability_Warrior_Revenge") -- Revenge
or string.find(t, "Ability_Gouge") -- Rend
or string.find(t, "INV_Sword_48") -- Execute
or string.find(t, "ability_warrior_savageblow") -- Mortal Strike
or string.find(t, "INV_Shield_05") -- Shield Slam
or string.find(t, "Ability_ShockWave") -- Hamtstring
or string.find(t, "Spell_Nature_Bloodlust") then -- Bloodthirst
yard05 = i
Debug("5 yard: "..t)
found = found + 1
end
end
if found == 5 then
Debug("Found all distance check spells ("..i..")")
return
end
end
end
-- Print message if any distance check spell is missing
if not yard30
or not yard08 then
Print(CHAT_MISSING_SPELL_SHOOT_THROW_FURY)
end
if not yard25 then
Print(CHAT_MISSING_SPELL_INTERCEPT_CHARGE_FURY)
end
if not yard10 then
Print(CHAT_MISSING_SPELL_THUNDERCLAP_FURY)
end
if not yard05 then
Print(CHAT_MISSING_SPELL_PUMMEL_FURY)
end
end
--------------------------------------------------
-- Detect distance to target
local function Fury_Distance()
if not UnitCanAttack("player", "target") then
return 100 -- invalid target
elseif yard05
and IsActionInRange(yard05) == 1 then
return 5 -- 0 - 5 yards
elseif yard10
and IsActionInRange(yard10) == 1 then
if yard08
and IsActionInRange(yard08) == 0 then
return 7 -- 6 - 7 yards
end
return 10 -- 8 - 10 yards
elseif yard25
and IsActionInRange(yard25) == 1 then
return 25 -- 11 - 25 yards
elseif yard30
and IsActionInRange(yard30) == 1 then
return 30 -- 26 - 30 yards
end
return 100 -- 31 - <na> yards
end
--------------------------------------------------
-- Get spell id from name
local function SpellId(spellname)
local id = 1
for i = 1, GetNumSpellTabs() do
local _, _, _, numSpells = GetSpellTabInfo(i)
for j = 1, numSpells do
local spellName = GetSpellName(id, BOOKTYPE_SPELL)
if spellName == spellname then
return id
end
id = id + 1
end
end
return nil
end
--------------------------------------------------
-- Check remaining cooldown on spell (0 - Ready)
local function IsSpellReadyIn(spellname)
local id = SpellId(spellname)
if id then
local start, duration = GetSpellCooldown(id, 0)
if start == 0
and duration == 0
and FuryLastSpellCast + 1 <= GetTime() then
return 0
end
local remaining = duration - (GetTime() - start)
if remaining >= 0 then
return remaining
end
end
return 86400 -- return max time (i.e not ready)
end
--------------------------------------------------
-- Return if spell is ready
local function IsSpellReady(spellname)
return IsSpellReadyIn(spellname) == 0
end
--------------------------------------------------
-- Detect if unit has specific number of debuffs
local function HasDebuff(unit, texturename, amount)
local id = 1
while UnitDebuff(unit, id) do
local debuffTexture, debuffAmount = UnitDebuff(unit, id)
if string.find(debuffTexture, texturename) then
if (amount
or 1) <= debuffAmount then
return true
else
return false
end
end
id = id + 1
end
return nil
end
--------------------------------------------------
-- Detect if unit has buff
local function HasBuff(unit, texturename)
local id = 1
while UnitBuff(unit, id) do
local buffTexture = UnitBuff(unit, id)
if string.find(buffTexture, texturename) then
return true
end
id = id + 1
end
return nil
end
--------------------------------------------------
-- Detect if unit has buff id
local function HasBuffId(unit, spellId)
for i = 1, 40 do
if select(11, UnitBuff(unit, i)) == spellid then
return true
end
end
return nil
end
--------------------------------------------------
-- Use item on player
local function UseContainerItemByNameOnPlayer(name)
for bag = 0, 4 do
for slot = 1,GetContainerNumSlots(bag) do
local item = GetContainerItemLink(bag, slot)
if item then
local _, _, itemCode = strfind(item, "(%d+):")
local itemName = GetItemInfo(itemCode)
if itemName == name then
UseContainerItem(bag, slot)
if SpellIsTargeting() then
SpellTargetUnit("player")
end
end
end
end
end
end
--------------------------------------------------
-- Return active stance
local function GetActiveStance()
--Detect the active stance
for i = 1, 3 do
local _, _, active = GetShapeshiftFormInfo(i)
if active then
return i
end
end
return nil
end
--------------------------------------------------
-- Detect if a suitable weapon (not a skinning knife/mining pick and not broken) is present
local function HasWeapon()
if HasDebuff("player", "Ability_Warrior_Disarm") then
return nil
end
local item = GetInventoryItemLink("player", 16)
if item then
local _, _, itemCode = strfind(item, "(%d+):")
local itemName, itemLink, _, _, itemType = GetItemInfo(itemCode)
if itemLink ~= "item:7005:0:0:0" -- Skining knife
and itemLink ~= "item:2901:0:0:0" -- Mining pick
and not GetInventoryItemBroken("player", 16) then
return true
end
end
return nil
end
--------------------------------------------------
-- Detect if a shield is present
local function HasShield()
if HasDebuff("player", "Ability_Warrior_Disarm") then
return nil
end
local item = GetInventoryItemLink("player", 17)
if item then
local _, _, itemCode = strfind(item, "(%d+):")
local _, _, _, _, _, itemType = GetItemInfo(itemCode)
if itemType == ITEM_TYPE_SHIELDS_FURY
and not GetInventoryItemBroken("player", 17) then
return true
end
end
return nil
end
--------------------------------------------------
-- Return trinket slot if trinket is equipped and not on cooldown
local function IsTrinketEquipped(name)
for slot = 13, 14 do
local item = GetInventoryItemLink("player", slot)
if item then
local _, _, itemCode = strfind(item, "(%d+):")
local itemName = GetItemInfo(itemCode)
if itemName == name
and GetInventoryItemCooldown("player", slot) == 0 then
return slot
end
end
end
return nil
end
--------------------------------------------------
local function Ranged()
--Detect if a ranged weapon is equipped and return type
local item = GetInventoryItemLink("player", 18)
if item then
local _, _, itemCode = strfind(item, "(%d+):")
local _, _, _, _, _, itemType = GetItemInfo(itemCode)
return itemType
end
return nil
end
--------------------------------------------------
local function HamstringCost()
-- Calculate the cost of Hamstring based on gear
local i = 0
local item = GetInventoryItemLink("player", 10)
if item then
local _, _, itemCode = strfind(item, "(%d+):")
local itemName = GetItemInfo(itemCode)
if itemName == ITEM_GAUNTLETS1_FURY
or itemName == ITEM_GAUNTLETS2_FURY
or itemName == ITEM_GAUNTLETS3_FURY
or itemName == ITEM_GAUNTLETS4_FURY then
i = i + 3
end
end
item = GetInventoryItemLink("player", 2)
if item then
local _, _, itemCode = strfind(item, "(%d+):")
local itemName = GetItemInfo(itemCode)
if itemName == ITEM_NECK_RAGE_OF_MUGAMBA_FURY then
i = i + 2
end
end
return 10 - i
end
--------------------------------------------------
local function CheckDebuffs(unit, list)
for _, v in pairs(list) do
if HasDebuff(unit, v) then
return true
end
end
return nil
end
--------------------------------------------------
local function HasAntiStealthDebuff()
--Detect anti-stealth debuffs
--Rend, Deep Wounds, Serpent Sting, Immolate, Curse of Agony , Garrote, Rupture, Deadly Poison, Fireball, Ignite, Pyroblast, Corruption, Siphon Life, Faerie Fire, Moonfire, Rake, Rip, Pounce, Insect Swarm, Holy Fire, Wyvern Sting, Devouring Plague
return CheckDebuffs("target", {
"Ability_Gouge",
"Ability_Hunter_Quickshot",
"Spell_Fire_Immolation",
"Spell_Shadow_CurseOfSargeras",
"Ability_Rogue_Garrote",
"Ability_Rogue_Rupture",
"Ability_Rogue_DualWeild",
"Spell_Shadow_ShadowWordPain",
"Spell_Fire_FlameBolt",
"Spell_Fire_Incinerate",
"Spell_Fire_Fireball02",
"Spell_Shadow_AbominationExplosion",
"Spell_Shadow_Requiem",
"Spell_Nature_FaerieFire",
"Spell_Nature_StarFall",
"Ability_Druid_Disembowel",
-- "Ability_GhoulFrenzy", -- triggered on fury warrs Flurry
"Ability_Druid_SurpriseAttack",
"Spell_Nature_InsectSwarm",
"Spell_Holy_SearingLight",
"INV_Spear_02",
"Spell_Shadow_BlackPlague"
})
end
--------------------------------------------------
local function HasImmobilizingDebuff()
return CheckDebuffs("player", {
"Spell_Frost_FrostNova",
"spell_Nature_StrangleVines"
})
end
--------------------------------------------------
local function SnareDebuff(unit)
-- Detect snaring debuffs
-- Hamstring, Wing Clip, Curse of Exhaustion, Crippling Poison, Frostbolt, Cone of Cold, Frost Shock, Piercing Howl
return CheckDebuffs(unit, {
"Ability_ShockWave",
"Ability_Rogue_Trip",
"Spell_Shadow_GrimWard",
"Ability_PoisonSting",
"Spell_Frost_FrostBolt02",
"Spell_Frost_Glacier",
"Spell_Shadow_DeathScream",
"Spell_Frost_FrostShock"
})
end
--------------------------------------------------
local function Fury_RunnerDetect(arg1, arg2)
-- Thanks to HateMe
if arg1 == CHAT_RUNNER_FURY then
Fury_Runners[arg2] = true
FuryFleeing = true
end
end
--------------------------------------------------
local function ItemExists(itemName)
for bag = 4, 0, -1 do
for slot = 1, GetContainerNumSlots(bag) do
local _, itemCount = GetContainerItemInfo(bag, slot)
if itemCount then
local itemLink = GetContainerItemLink(bag,slot)
local _, _, itemParse = strfind(itemLink, "(%d+):")
local queryName, _, _, _, _, _ = GetItemInfo(itemParse)
if queryName
and queryName ~= "" then
if queryName == itemName then
return true
end
end
end
end
end
return false
end
--------------------------------------------------
local function IsItemReady(item)
if ItemExists(item) == false then
return false
end
local _, duration, _ = GetItemCooldown(item)
if duration == 0 then
return true
end
return false
end
--------------------------------------------------
local function IsEquippedAndReady(slot, name)
local item = GetInventoryItemLink("player", slot)
if item then
local _, _, itemCode = strfind(item, "(%d+):")
local itemName = GetItemInfo(itemCode)
if itemName == name
and GetInventoryItemCooldown("player", slot) == 0 then
return true
end
end
return nil
end
--------------------------------------------------
local function CheckCooldown(slot)
local start, duration = GetInventoryItemCooldown("player", slot)
if duration > 30 then
-- Alllow duration for 30 seconds since it's when you equip the item
local item = GetInventoryItemLink("player", slot)
if item then
local _, _, itemCode = strfind(item, "(%d+):")
local itemName = GetItemInfo(itemCode)
return itemName
end
end
return nil
end
--------------------------------------------------
local function Fury_SetEnemies(count)
for i = 5, 1, -1 do
WWEnemies.Hist[i] = WWEnemies.Hist[i - 1]
end
WWEnemies.Hist[0] = Enemies
end
--------------------------------------------------
local function AddEnemyCount(Enemies)
Fury_SetEnemies(Enemies)
Debug("Enemies "..Enemies)
if Enemies < 2
and Fury_Configuration[MODE_HEADER_AOE] then
Print(TEXT_FURY_DISABLING_AOE)
Fury_Configuration[MODE_HEADER_AOE] = false
end
end
--------------------------------------------------
local function Fury_GetEnemies()
return WWEnemies.Hist[0] or 0
end
--------------------------------------------------
local function Fury_Shoot()
local ranged_type = Ranged()
local spell
if ranged_type == ITEM_TYPE_BOWS_FURY then
spell = ABILITY_SHOOT_BOW_FURY
elseif ranged_type == ITEM_TYPE_CROSSBOWS_FURY then
spell = ABILITY_SHOOT_CROSSBOW_FURY
elseif ranged_type == ITEM_TYPE_GUNS_FURY then
spell = ABILITY_SHOOT_GUN_FURY
elseif ranged_type == ITEM_TYPE_THROWN_FURY then
spell = ABILITY_THROW_FURY
else
return false
end
if IsSpellReady(spell) then
Debug(spell)
CastSpellByName(spell)
FuryLastSpellCast = GetTime()
end
return true
end
--------------------------------------------------
-- Treat debuff on player
local function Fury_TreatDebuffPlayer()
local allowCombatCooldown = true
if UnitName("target") == BOSS_NAX_LOATHEB_FURY
or UnitName("target") == BOSS_NAX_SAPPHIRON_FURY then
allowCombatCooldown = false -- Save for Shadow/frost Protection Potion
end
-- add Restorative Potion (magic, poison curse or disease)
if HasDebuffType("player", ITEM_DEBUFF_TYPE_POISON) then
if UnitName("target") == BOSS_NAX_GROBBULUS_FURY then
return false
end
if IsTrinketEquipped(ITEM_TRINKET_HEART_OF_NOXXION) then
local slot = IsTrinketEquipped(ITEM_TRINKET_HEART_OF_NOXXION)
UseInventoryItem(slot)
elseif UnitRace("player") == RACE_DWARF
and Fury_Configuration[RACIAL_STONEFORM_FURY]
and IsSpellReady(RACIAL_STONEFORM_FURY) then
CastSpellByName(RACIAL_STONEFORM_FURY)
elseif allowCombatCooldown
and IsItemReady(ITEM_CONS_JUNGLE_REMEDY) then
Print(ITEM_CONS_JUNGLE_REMEDY)
UseContainerItemByNameOnPlayer(ITEM_CONS_JUNGLE_REMEDY)
elseif IsItemReady(ITEM_CONS_POWERFUL_ANTIVENOM) then
Print(ITEM_CONS_POWERFUL_ANTIVENOM)
UseContainerItemByNameOnPlayer(ITEM_CONS_POWERFUL_ANTIVENOM)
elseif IsItemReady(ITEM_CONS_ELIXIR_OF_POISION_RESISTANCE) then
Print(ITEM_CONS_ELIXIR_OF_POISION_RESISTANCE)
UseContainerItemByNameOnPlayer(ITEM_CONS_ELIXIR_OF_POISION_RESISTANCE)
elseif allowCombatCooldown
and IsItemReady(ITEM_CONS_PURIFICATION_POTION) then
Print(ITEM_CONS_PURIFICATION_POTION)
UseContainerItemByNameOnPlayer(ITEM_CONS_PURIFICATION_POTION)
elseif allowCombatCooldown
and IsItemReady(ITEM_CONS_RESTORATIVE_POTION) then
Print(ITEM_CONS_RESTORATIVE_POTION_POTION)
UseContainerItemByNameOnPlayer(ITEM_CONS_RESTORATIVE_POTION_POTION)
else
return false
end
Print(ITEM_DEBUFF_TYPE_POISON)
elseif HasDebuffType("player", ITEM_DEBUFF_TYPE_DISEASE) then
if UnitRace("player") == RACE_DWARF
and IsSpellReady(ABILITY_STONEFORM_FURY) then
CastSpellByName(ABILITY_STONEFORM_FURY)
elseif allowCombatCooldown
and IsItemReady(ITEM_CONS_JUNGLE_REMEDY) then
Print(ITEM_CONS_JUNGLE_REMEDY)
UseContainerItemByNameOnPlayer(ITEM_CONS_JUNGLE_REMEDY)
elseif allowCombatCooldown
and IsItemReady(ITEM_CONS_RESTORATIVE_POTION) then
Print(ITEM_CONS_RESTORATIVE_POTION_POTION)
UseContainerItemByNameOnPlayer(ITEM_CONS_RESTORATIVE_POTION_POTION)
else
return false
end
Print(ITEM_DEBUFF_TYPE_DISEASE)
elseif HasDebuffType("player", ITEM_DEBUFF_TYPE_CURSE) then
if allowCombatCooldown
and IsItemReady(ITEM_CONS_PURIFICATION_POTION) then
Print(ITEM_CONS_PURIFICATION_POTION)
UseContainerItemByNameOnPlayer(ITEM_CONS_PURIFICATION_POTION)
elseif allowCombatCooldown
and IsItemReady(ITEM_CONS_RESTORATIVE_POTION) then
Print(ITEM_CONS_RESTORATIVE_POTION_POTION)
UseContainerItemByNameOnPlayer(ITEM_CONS_RESTORATIVE_POTION_POTION)
else
return false
end
Print(ITEM_DEBUFF_TYPE_CURSE)
elseif HasDebuffType("player", ITEM_DEBUFF_TYPE_MAGIC) then
if allowCombatCooldown
and IsItemReady(ITEM_CONS_RESTORATIVE_POTION) then
Print(ITEM_CONS_RESTORATIVE_POTION_POTION)
UseContainerItemByNameOnPlayer(ITEM_CONS_RESTORATIVE_POTION_POTION)
else
return false
end
Print(ITEM_DEBUFF_TYPE_MAGIC)
else
return false
end
return true
end
--------------------------------------------------
-- Fury - Handles the combat sequence
--------------------------------------------------
function Fury()
if Fury_Configuration["Enabled"]
and not UnitIsCivilian("target")
and UnitClass("player") == CLASS_WARRIOR_FURY
and FuryTalents then
local debuffImmobilizing = HasImmobilizingDebuff()
-- 1, Auto attack closest target
if Fury_Configuration["AutoAttack"]
and not FuryAttack then
AttackTarget()
end
-- 2, Overpower
if FuryOverpower then
if (GetTime() - FuryOverpower) > 4 then
FuryOverpower = nil
end
end
-- 3, Spell interrupts
if FurySpellInterrupt then
if (GetTime() - FurySpellInterrupt) > 2 then
FurySpellInterrupt = nil
end
end
-- 4, Add number of enemies
if WWEnemies.CleaveCount ~= nil
and (GetTime() - WWEnemies.CleaveTime ) > 1 then
AddEnemyCount(WWEnemies.CleaveCount)
WWEnemies.CleaveCount = nil
elseif WWEnemies.WWCount ~= nil
and (GetTime() - WWEnemies.WWTime) > 1 then
AddEnemyCount(WWEnemies.WWCount)
WWEnemies.WWCount = nil
end
-- 5, Dismount if mounted
if FuryMount then
Debug("5. Dismount")
Dismount()
FuryMount = nil
-- 6, Use Berserker rage to interrupt fears and....
elseif Fury_Configuration[ABILITY_BERSERKER_RAGE_FURY]
and (FuryIncapacitate
or FuryFear)
and GetActiveStance() == 3
and IsSpellReady(ABILITY_BERSERKER_RAGE_FURY) then
Debug("6. Berserker Rage")
CastSpellByName(ABILITY_BERSERKER_RAGE_FURY)
-- 7, Spider Belt, remove existing immobilizing effects
elseif debuffImmobilizing
and IsEquippedAndReady(6, ITEM_BELT_SPIDER_BELT_FURY) then
Debug("7. Spider Belt")
UseInventoryItem(6)
-- 8, Ornate Mithril Boots, remove existing immobilizing effects
elseif debuffImmobilizing
and IsEquippedAndReady(8, ITEM_BOOTS_ORNATE_MITHRIL_BOOTS_FURY) then
Debug("8. Ornate Mithril Boots")
UseInventoryItem(8)
-- 9, PVP Trinket, Horde
elseif (FuryFear
or FuryIncapacitate
or debuffImmobilizing)
and IsTrinketEquipped(ITEM_TRINKET_INSIGNIA_OF_THE_HORDE_FURY) then
slot = IsTrinketEquipped(ITEM_TRINKET_INSIGNIA_OF_THE_HORDE_FURY)
Debug("9. Insignia of the Horde")
UseInventoryItem(slot)
-- PVP Trinket, Alliance
elseif (FuryFear
or FuryIncapacitate
or debuffImmobilizing)
and IsTrinketEquipped(ITEM_TRINKET_INSIGNIA_OF_THE_ALLIANCE_FURY) then
slot = IsTrinketEquipped(ITEM_TRINKET_INSIGNIA_OF_THE_ALLIANCE_FURY)
Debug("10. Insignia of the Alliance")
UseInventoryItem(slot)
-- Execute, this will stance dance in prot mode?
elseif Fury_Configuration[ABILITY_EXECUTE_FURY]
and HasWeapon()
and not Fury_Configuration[MODE_HEADER_AOE]
and UnitMana("player") >= FuryExecuteCost
and (GetActiveStance() ~= 2
or (Fury_Configuration["PrimaryStance"] ~= 2
and UnitMana("player") <= (FuryTacticalMastery + Fury_Configuration["StanceChangeRage"])
and Fury_Configuration["PrimaryStance"] ~= 0))
and (UnitHealth("target") / UnitHealthMax("target") * 100) <= 20
and IsSpellReady(ABILITY_EXECUTE_FURY) then
if GetActiveStance() == 2 then
Debug("11. Berserker Stance (Execute)")
if not FuryOldStance then
FuryOldStance = GetActiveStance()
end
DoShapeShift(1)
else
Debug("11. Execute")
if FuryOldStance == GetActiveStance() then
FuryDanceDone = true
end
end
CastSpellByName(ABILITY_EXECUTE_FURY)
FuryLastSpellCast = GetTime()
-- Overpower when available
elseif Fury_Configuration[ABILITY_OVERPOWER_FURY]
and FuryOverpower
and HasWeapon()
and not Fury_Configuration[MODE_HEADER_AOE]
and UnitMana("player") >= 5
and (GetActiveStance() == 1
or (((Fury_Configuration["PrimaryStance"] ~= 2
and (UnitHealth("target") / UnitHealthMax("target") * 100) > 20
and not (Flurry and HasBuff("player", "Ability_GhoulFrenzy")))