forked from Vae2009/ConRO
-
Notifications
You must be signed in to change notification settings - Fork 0
/
helper.lua
1507 lines (1336 loc) · 37.8 KB
/
helper.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
ConRO.RaidBuffs = {};
ConRO.WarningFlags = {};
-- Global cooldown spell id
-- GlobalCooldown = 61304;
local GetSpellInfo = function(spellID)
if not spellID then
return nil;
end
local spellInfo = C_Spell.GetSpellInfo(spellID);
if spellInfo then
return spellInfo.name, nil, spellInfo.iconID, spellInfo.castTime, spellInfo.minRange, spellInfo.maxRange, spellInfo.spellID, spellInfo.originalIconID;
end
end
local GetSpellCooldown = function(spellID)
local spellCooldownInfo = C_Spell.GetSpellCooldown(spellID);
if spellCooldownInfo then
return spellCooldownInfo.startTime, spellCooldownInfo.duration, spellCooldownInfo.isEnabled, spellCooldownInfo.modRate;
end
end
local UnitAura = function(unitToken, index, filter)
local auraData = C_UnitAuras.GetAuraDataByIndex(unitToken, index, filter);
if not auraData then
return nil;
end
return AuraUtil.UnpackAuraData(auraData);
end
local UnitDebuff = UnitAura
local GetSpellCharges = function(spellID)
local spellChargeInfo = C_Spell.GetSpellCharges(spellID);
if spellChargeInfo then
return spellChargeInfo.currentCharges, spellChargeInfo.maxCharges, spellChargeInfo.cooldownStartTime, spellChargeInfo.cooldownDuration, spellChargeInfo.chargeModRate;
end
end
local INF = 2147483647;
local BOOKTYPE_SPELL = "spell";
local GetSpellBookItemName = function(index, bookType)
local spellBank = (bookType == BOOKTYPE_SPELL) and Enum.SpellBookSpellBank.Player or Enum.SpellBookSpellBank.Pet;
return C_SpellBook.GetSpellBookItemName(index, spellBank);
end
GetSpellBookItemInfo = function(index, bookType)
local spellBank = (bookType == BOOKTYPE_SPELL) and Enum.SpellBookSpellBank.Player or Enum.SpellBookSpellBank.Pet;
return C_SpellBook.GetSpellBookItemType(index, spellBank);
end
function ConRO:SpecName()
local currentSpec = GetSpecialization();
local currentSpecName = currentSpec and select(2, GetSpecializationInfo(currentSpec)) or 'None';
return currentSpecName;
end
function ConRO:CheckTalents()
--print("Bing")
self.PlayerTalents = {};
wipe(self.PlayerTalents)
local configId = C_ClassTalents.GetActiveConfigID()
if configId ~= nil then
local configInfo = C_Traits.GetConfigInfo(configId)
if configInfo ~= nil then
for _, treeId in pairs(configInfo.treeIDs) do
local nodes = C_Traits.GetTreeNodes(treeId)
for _, nodeId in pairs(nodes) do
local node = C_Traits.GetNodeInfo(configId, nodeId)
if node.currentRank and node.currentRank > 0 then
local entryId = nil
if node.activeEntry ~= nil then
entryId = node.activeEntry.entryID
elseif node.nextEntry ~= nil then
entryId = node.nextEntry.entryID
elseif node.entryIDs ~= nil then
entryId = node.entryIDs[1]
end
if entryId ~= nil then
local entryInfo = C_Traits.GetEntryInfo(configId, entryId)
local definitionInfo = C_Traits.GetDefinitionInfo(entryInfo.definitionID)
if definitionInfo ~= nil then
local spellId = nil
if definitionInfo.spellID ~= nil then
spellId = definitionInfo.spellID
elseif definitionInfo.overriddenSpellID ~= nil then
spellId = definitionInfo.overriddenSpellID
end
if spellId ~= nil then
local name = GetSpellInfo(spellId)
tinsert(self.PlayerTalents, entryId);
self.PlayerTalents[entryId] = {};
tinsert(self.PlayerTalents[entryId], {
id = entryId,
talentName = name,
rank = node.currentRank,
})
end
end
end
end
end
end
end
end
end
function ConRO:IsPvP()
local _is_PvP = UnitIsPVP('player');
local _is_Arena, _is_Registered = IsActiveBattlefieldArena();
local _Flagged = false;
if _is_PvP or _is_Arena then
_Flagged = true;
end
return _Flagged;
end
function ConRO:CheckPvPTalents()
self.PvPTalents = {};
local talents = C_SpecializationInfo.GetAllSelectedPvpTalentIDs();
for k,v in ipairs(talents) do
local _, name, _, _, _, id = GetPvpTalentInfoByID(v or 0);
self.PvPTalents[id] = name;
end
end
function ConRO:TalentChosen(entryCheck, rankCheck)
if rankCheck ~= nil then
local talent = self.PlayerTalents[entryCheck];
if talent then
for _,i in pairs(talent) do
for k,v in pairs(i) do
if k == "rank" then
if v >= rankCheck then
return true;
end
end
end
return false;
end
end
else
return self.PlayerTalents[entryCheck];
end
end
function ConRO:PvPTalentChosen(talent)
return self.PvPTalents[talent];
end
function ConRO:BurstMode(_Spell_ID, timeShift)
local _Burst = ConRO_BurstButton:IsVisible();
timeShift = timeShift or ConRO:EndCast();
local _Burst_Threshold = ConRO.db.profile._Burst_Threshold;
local _, _, baseCooldown = ConRO:Cooldown(_Spell_ID, timeShift);
local _Burst_Mode = false;
if _Burst and baseCooldown >= _Burst_Threshold then
_Burst_Mode = true;
end
return _Burst_Mode;
end
function ConRO:FullMode(_Spell_ID, timeShift)
local _Full = ConRO_FullButton:IsVisible();
local _Burst = ConRO_BurstButton:IsVisible();
timeShift = timeShift or ConRO:EndCast();
local _Burst_Threshold = ConRO.db.profile._Burst_Threshold;
local _, _, baseCooldown = ConRO:Cooldown(_Spell_ID, timeShift);
local _Full_Mode = false;
if _Burst and baseCooldown < _Burst_Threshold then
_Full_Mode = true;
elseif _Full then
_Full_Mode = true;
end
return _Full_Mode;
end
function ConRO:Warnings(_Message, _Condition)
if self.WarningFlags[_Message] == nil then
self.WarningFlags[_Message] = 0;
end
if _Condition then
self.WarningFlags[_Message] = self.WarningFlags[_Message] + 1;
if self.WarningFlags[_Message] == 1 then
UIErrorsFrame:AddMessage(_Message, 1.0, 1.0, 0.0, 1.0);
elseif self.WarningFlags[_Message] == 15 then
self.WarningFlags[_Message] = 0;
end
else
self.WarningFlags[_Message] = 0;
end
end
ConRO.ItemSlotList = {
"HeadSlot",
"NeckSlot",
"ShoulderSlot",
"BackSlot",
"ChestSlot",
"WristSlot",
"HandsSlot",
"WaistSlot",
"LegsSlot",
"FeetSlot",
"Finger0Slot",
"Finger1Slot",
"Trinket0Slot",
"Trinket1Slot",
"MainHandSlot",
"SecondaryHandSlot",
}
ConRO.TierSlotList = {
"HeadSlot",
"ShoulderSlot",
"ChestSlot",
"HandsSlot",
"LegsSlot",
}
function ConRO:ItemEquipped(_item_string)
local _match_item_NAME = false;
local _, _item_LINK = GetItemInfo(_item_string);
if _item_LINK ~= nil then
local _item_NAME = GetItemInfo(_item_LINK);
for i, v in ipairs(ConRO.ItemSlotList) do
local _slot_LINK = GetInventoryItemLink("player", GetInventorySlotInfo(v));
if _slot_LINK then
local _slot_item_NAME = GetItemInfo(_slot_LINK);
if _slot_item_NAME == _item_NAME then
_match_item_NAME = true;
break;
end
end
end
end
return _match_item_NAME;
end
function ConRO:CountTier()
local _, _, classIndex = UnitClass("player");
local count = 0;
for _, v in pairs(ConRO.TierSlotList) do
local match = nil
local _slot_LINK = GetInventoryItemLink("player", GetInventorySlotInfo(v))
local _slot_item_NAME;
if _slot_LINK then
_slot_item_NAME = GetItemInfo(_slot_LINK)
else
break
end
if _slot_item_NAME == nil then
return 0;
end
-- Death Knight
if classIndex == 6 then
match = string.match(_slot_item_NAME,"of the Risen Nightmare")
end
-- Demon Hunter
if classIndex == 12 then
match = string.match(_slot_item_NAME,"Screaming Torchfiend's")
end
-- Druid
if classIndex == 11 then
match = string.match(_slot_item_NAME,"Benevolent Embersage's")
end
-- Evoker
if classIndex == 13 then
match = string.match(_slot_item_NAME,"Werynkeeper's Timeless")
end
-- Hunter
if classIndex == 3 then
match = string.match(_slot_item_NAME,"Blazing Dreamstalker's")
end
-- Mage
if classIndex == 8 then
match = string.match(_slot_item_NAME,"Wayward Chronomancer's")
end
-- Monk
if classIndex == 10 then
match = string.match(_slot_item_NAME,"Mystic Heron's")
end
-- Paladin
if classIndex == 2 then
match = string.match(_slot_item_NAME,"Zealous Pyreknight's")
end
-- Priest
if classIndex == 5 then
match = string.match(_slot_item_NAME,"of Lunar Communion")
end
-- Rogue
if classIndex == 4 then
match = string.match(_slot_item_NAME,"Lucid Shadewalker's")
end
-- Shaman
if classIndex == 7 then
match = string.match(_slot_item_NAME,"Greatwolf Outcast's")
end
-- Warlock
if classIndex == 9 then
match = string.match(_slot_item_NAME,"Devout Ashdevil's")
end
-- Warrior
if classIndex == 1 then
match = string.match(_slot_item_NAME,"Molten Vanguard's")
end
if match then count = count + 1 end
end
return count
end
function ConRO:PlayerSpeed()
local speed = (GetUnitSpeed("player") / 7) * 100;
local moving = false;
if speed > 0 then
moving = true;
else
moving = false;
end
return moving;
end
ConRO.EnergyList = {
[0] = 'Mana',
[1] = 'Rage',
[2] = 'Focus',
[3] = 'Energy',
[4] = 'Combo',
[6] = 'RunicPower',
[7] = 'SoulShards',
[8] = 'LunarPower',
[9] = 'HolyPower',
[11] = 'Maelstrom',
[12] = 'Chi',
[13] = 'Insanity',
[16] = 'ArcaneCharges',
[17] = 'Fury',
[19] = 'Essence',
}
function ConRO:PlayerPower(_EnergyType)
local resource;
for k, v in pairs(ConRO.EnergyList) do
if v == _EnergyType then
resource = k;
break
end
end
local _Resource = UnitPower('player', resource);
local _Resource_Max = UnitPowerMax('player', resource);
local _Resource_Percent = math.max(0, _Resource) / math.max(1, _Resource_Max) * 100;
return _Resource, _Resource_Max, _Resource_Percent;
end
--[[local FriendItems = {
[5] = {
37727, -- Ruby Acorn
},
[8] = {
34368, -- Attuned Crystal Cores
33278, -- Burning Torch
},
[10] = {
32321, -- Sparrowhawk Net
},
[15] = {
1251, -- Linen Bandage
2581, -- Heavy Linen Bandage
3530, -- Wool Bandage
3531, -- Heavy Wool Bandage
6450, -- Silk Bandage
6451, -- Heavy Silk Bandage
8544, -- Mageweave Bandage
8545, -- Heavy Mageweave Bandage
14529, -- Runecloth Bandage
14530, -- Heavy Runecloth Bandage
21990, -- Netherweave Bandage
21991, -- Heavy Netherweave Bandage
34721, -- Frostweave Bandage
34722, -- Heavy Frostweave Bandage
-- 38643, -- Thick Frostweave Bandage
-- 38640, -- Dense Frostweave Bandage
},
[20] = {
21519, -- Mistletoe
},
[25] = {
31463, -- Zezzak's Shard
},
[30] = {
1180, -- Scroll of Stamina
1478, -- Scroll of Protection II
3012, -- Scroll of Agility
1712, -- Scroll of Spirit II
2290, -- Scroll of Intellect II
1711, -- Scroll of Stamina II
34191, -- Handful of Snowflakes
},
[35] = {
18904, -- Zorbin's Ultra-Shrinker
},
[40] = {
34471, -- Vial of the Sunwell
},
[45] = {
32698, -- Wrangling Rope
},
[60] = {
32825, -- Soul Cannon
37887, -- Seeds of Nature's Wrath
},
[80] = {
35278, -- Reinforced Net
},
}
local HarmItems = {
[5] = {
37727, -- Ruby Acorn
},
[8] = {
34368, -- Attuned Crystal Cores
33278, -- Burning Torch
},
[10] = {
32321, -- Sparrowhawk Net
},
[15] = {
33069, -- Sturdy Rope
},
[20] = {
10645, -- Gnomish Death Ray
},
[25] = {
24268, -- Netherweave Net
41509, -- Frostweave Net
31463, -- Zezzak's Shard
},
[30] = {
835, -- Large Rope Net
7734, -- Six Demon Bag
34191, -- Handful of Snowflakes
},
[35] = {
24269, -- Heavy Netherweave Net
18904, -- Zorbin's Ultra-Shrinker
},
[40] = {
28767, -- The Decapitator
},
[45] = {
32698, -- Wrangling Rope
},
[60] = {
32825, -- Soul Cannon
37887, -- Seeds of Nature's Wrath
},
[80] = {
35278, -- Reinforced Net
},
}]]
function ConRO:Targets(spellID)
local target_in_range = false;
local number_in_range = 0;
if spellID == "Melee" then
if not UnitIsFriend("player", "target") and UnitExists("target") then
if IsItemInRange(37727, "target") then
target_in_range = true;
end
end
for i = 1, 15 do
if not UnitIsFriend("player", 'nameplate' .. i) then
if UnitExists('nameplate' .. i) and IsItemInRange(37727, "nameplate"..i) == true and UnitName('nameplate' .. i) ~= "Explosive" and UnitName('nameplate' .. i) ~= "Incorporeal Being" then
number_in_range = number_in_range + 1
end
end
end
elseif spellID == "10" then
if not UnitIsFriend("player", "target") and UnitExists("target") then
if IsItemInRange(32321, "target") then
target_in_range = true;
end
end
for i = 1, 15 do
if not UnitIsFriend("player", 'nameplate' .. i) then
if UnitExists('nameplate' .. i) and IsItemInRange(32321, "nameplate"..i) == true and UnitName('nameplate' .. i) ~= "Explosive" and UnitName('nameplate' .. i) ~= "Incorporeal Being" then
number_in_range = number_in_range + 1
end
end
end
elseif spellID == "15" then
if not UnitIsFriend("player", "target") and UnitExists("target") then
if IsItemInRange(33069, "target") then
target_in_range = true;
end
end
for i = 1, 15 do
if not UnitIsFriend("player", 'nameplate' .. i) then
if UnitExists('nameplate' .. i) and IsItemInRange(33069, "nameplate"..i) == true and UnitName('nameplate' .. i) ~= "Explosive" and UnitName('nameplate' .. i) ~= "Incorporeal Being" then
number_in_range = number_in_range + 1
end
end
end
elseif spellID == "25" then
if not UnitIsFriend("player", "target") and UnitExists("target") then
if IsItemInRange(24268, "target") then
target_in_range = true;
end
end
for i = 1, 15 do
if not UnitIsFriend("player", 'nameplate' .. i) then
if UnitExists('nameplate' .. i) and IsItemInRange(24268, "nameplate"..i) == true and UnitName('nameplate' .. i) ~= "Explosive" and UnitName('nameplate' .. i) ~= "Incorporeal Being" then
number_in_range = number_in_range + 1
end
end
end
elseif spellID == "40" then
if not UnitIsFriend("player", "target") and UnitExists("target") then
if IsItemInRange(28767, "target") then
target_in_range = true;
end
end
for i = 1, 15 do
if not UnitIsFriend("player", 'nameplate' .. i) then
if UnitExists('nameplate' .. i) and IsItemInRange(28767, "nameplate"..i) == true and UnitName('nameplate' .. i) ~= "Explosive" and UnitName('nameplate' .. i) ~= "Incorporeal Being" then
number_in_range = number_in_range + 1
end
end
end
else
if ConRO:IsSpellInRange(spellID, "target") then
target_in_range = true;
end
for i = 1, 15 do
if UnitExists('nameplate' .. i) and ConRO:IsSpellInRange(spellID, 'nameplate' .. i) and UnitName('nameplate' .. i) ~= "Explosive" and UnitName('nameplate' .. i) ~= "Incorporeal Being" then
number_in_range = number_in_range + 1
end
end
end
--print(number_in_range)
return number_in_range, target_in_range;
end
function ConRO:UnitAura(spellID, timeShift, unit, filter, isWeapon)
timeShift = timeShift or 0;
if isWeapon == "Weapon" then
local hasMainHandEnchant, mainHandExpiration, _, mainBuffId, hasOffHandEnchant, offHandExpiration, _, offBuffId = GetWeaponEnchantInfo()
if hasMainHandEnchant and mainBuffId == spellID then
if mainHandExpiration ~= nil and (mainHandExpiration/1000) > timeShift then
local dur = (mainHandExpiration/1000) - (timeShift or 0);
return true, count, dur;
end
elseif hasOffHandEnchant and offBuffId == spellID then
if offHandExpiration ~= nil and (offHandExpiration/1000) > timeShift then
local dur = (offHandExpiration/1000) - (timeShift or 0);
return true, count, dur;
end
end
else
for i=1,40 do
local _, _, count, _, _, expirationTime, _, _, _, spell = UnitAura(unit, i, filter);
if spell == spellID then
if expirationTime ~= nil and (expirationTime - GetTime()) > timeShift then
local dur = expirationTime - GetTime() - (timeShift or 0);
return true, count, dur;
end
end
end
end
return false, 0, 0;
end
function ConRO:Form(spellID)
for i=1,40 do
local _, _, count, _, _, _, _, _, _, spell = UnitAura("player", i);
if spell == spellID then
return true, count;
end
end
return false, 0;
end
function ConRO:PersistentDebuff(spellID)
for i=1,40 do
local _, _, count, _, _, _, _, _, _, spell = UnitAura("target", i, 'PLAYER|HARMFUL');
if spell == spellID then
return true, count;
end
end
return false, 0;
end
function ConRO:Aura(spellID, timeShift, filter)
return self:UnitAura(spellID, timeShift, 'player', filter);
end
function ConRO:TargetAura(spellID, timeShift)
return self:UnitAura(spellID, timeShift, 'target', 'PLAYER|HARMFUL');
end
function ConRO:AnyTargetAura(spellID)
local haveBuff = false;
local count = 0;
for i = 1, 15 do
if UnitExists('nameplate' .. i) then
for x=1, 40 do
local spell = select(10, UnitAura('nameplate' .. i, x, 'PLAYER|HARMFUL'));
if spell == spellID then
haveBuff = true;
count = count + 1;
break;
end
end
end
end
return haveBuff, count;
end
function ConRO:Purgable()
local purgable = false;
for i=1,40 do
local _, _, _, _, _, _, _, isStealable = UnitAura('target', i, 'HELPFUL');
if isStealable == true then
purgable = true;
end
end
return purgable;
end
function ConRO:Heroism()
local _Bloodlust = 2825;
local _TimeWarp = 80353;
local _Heroism = 32182;
local _PrimalRage = 264667;
local _AncientHysteria = 90355;
local _Netherwinds = 160452;
local _DrumsofFury = 120257;
local _DrumsofFuryBuff = 178207;
local _DrumsoftheMountain = 142406;
local _DrumsoftheMountainBuff = 230935;
local _FuryoftheAspects = 390386;
local _Exhaustion = 57723;
local _Sated = 57724;
local _TemporalDisplacement = 80354;
local _Insanity = 95809;
local _Fatigued = 264689;
local _Exhaustion2 = 390435;
local buffed = false;
local sated = false;
local hasteBuff = {
bl = ConRO:Aura(_Bloodlust, timeShift);
tw = ConRO:Aura(_TimeWarp, timeShift);
hero = ConRO:Aura(_Heroism, timeShift);
pr = ConRO:Aura(_PrimalRage, timeShift);
ah = ConRO:Aura(_AncientHysteria, timeShift);
nw = ConRO:Aura(_Netherwinds, timeShift);
dof = ConRO:Aura(_DrumsofFuryBuff, timeShift);
dotm = ConRO:Aura(_DrumsoftheMountainBuff, timeShift);
fota = ConRO:Aura(_FuryoftheAspects, timeShift);
}
local satedDebuff = {
ex = UnitDebuff('player', _Exhaustion);
sated = UnitDebuff('player', _Sated);
td = UnitDebuff('player', _TemporalDisplacement);
ins = UnitDebuff('player', _Insanity);
fat = UnitDebuff('player', _Fatigued);
ex2 = UnitDebuff('player', _Exhaustion2);
}
local hasteCount = 0;
for k, v in pairs(hasteBuff) do
if v then
hasteCount = hasteCount + 1;
end
end
if hasteCount > 0 then
buffed = true;
end
local satedCount = 0;
for k, v in pairs(satedDebuff) do
if v then
satedCount = satedCount + 1;
end
end
if satedCount > 0 then
sated = true;
end
return buffed, sated;
end
function ConRO:InRaid()
local numGroupMembers = GetNumGroupMembers();
if numGroupMembers >= 6 then
return true;
else
return false;
end
end
function ConRO:InParty()
local numGroupMembers = GetNumGroupMembers();
if numGroupMembers >= 2 and numGroupMembers <= 5 then
return true;
else
return false;
end
end
function ConRO:IsSolo()
local numGroupMembers = GetNumGroupMembers();
if numGroupMembers <= 1 then
return true;
else
return false;
end
end
function ConRO:RaidBuff(spellID)
local selfhasBuff = false;
local haveBuff = false;
local buffedRaid = false;
local numGroupMembers = GetNumGroupMembers();
if numGroupMembers >= 6 then
selfhasBuff = true;
for i = 1, numGroupMembers do -- For each raid member
local unit = "raid" .. i;
if UnitExists(unit) then
if not UnitIsDeadOrGhost(unit) and UnitInRange(unit) then
for x=1, 40 do
local spell = select(10, UnitAura(unit, x, 'HELPFUL'));
if spell == spellID then
haveBuff = true;
break;
end
end
if not haveBuff then
break;
end
else
haveBuff = true;
end
end
end
elseif numGroupMembers >= 2 and numGroupMembers <= 5 then
for i = 1, 4 do -- For each party member
local unit = "party" .. i;
if UnitExists(unit) then
if not UnitIsDeadOrGhost(unit) and UnitInRange(unit) then
for x=1, 40 do
local spell = select(10, UnitAura(unit, x, 'HELPFUL'));
if spell == spellID then
haveBuff = true;
break;
end
end
if not haveBuff then
break;
end
else
haveBuff = true;
end
end
end
for x=1, 40 do
local spell = select(10, UnitAura('player', x, 'HELPFUL'));
if spell == spellID then
selfhasBuff = true;
break;
end
end
elseif numGroupMembers <= 1 then
for x=1, 40 do
local spell = select(10, UnitAura('player', x, 'HELPFUL'));
if spell == spellID then
selfhasBuff = true;
haveBuff = true;
break;
end
end
end
if selfhasBuff and haveBuff then
buffedRaid = true;
end
-- self:Print(self.Colors.Info .. numGroupMembers);
return buffedRaid;
end
function ConRO:OneBuff(spellID)
local selfhasBuff = false;
local haveBuff = false;
local someoneHas = false;
local numGroupMembers = GetNumGroupMembers();
if numGroupMembers >= 6 then
for i = 1, numGroupMembers do -- For each raid member
local unit = "raid" .. i;
if UnitExists(unit) then
for x=1, 40 do
local spell = select(10, UnitAura(unit, x, 'PLAYER|HELPFUL'));
if spell == spellID then
haveBuff = true;
break;
end
end
if haveBuff then
break;
end
end
end
elseif numGroupMembers >= 2 and numGroupMembers <= 5 then
for x=1, 40 do
local spell = select(10, UnitAura('player', x, 'PLAYER|HELPFUL'));
if spell == spellID then
selfhasBuff = true;
break;
end
end
if not selfhasBuff then
for i = 1, 4 do -- For each party member
local unit = "party" .. i;
if UnitExists(unit) then
for x=1, 40 do
local spell = select(10, UnitAura(unit, x, 'PLAYER|HELPFUL'));
if spell == spellID then
haveBuff = true;
break;
end
end
if haveBuff then
break;
end
end
end
end
elseif numGroupMembers <= 1 then
for x=1, 40 do
local spell = select(10, UnitAura('player', x, 'PLAYER|HELPFUL'));
if spell == spellID then
selfhasBuff = true;
break;
end
end
end
if selfhasBuff or haveBuff then
someoneHas = true;
end
-- self:Print(self.Colors.Info .. numGroupMembers);
return someoneHas;
end
function ConRO:GroupBuffCount(spellID)
local buffCount = 0;
local numGroupMembers = GetNumGroupMembers();
if numGroupMembers >= 6 then
for i = 1, numGroupMembers do -- For each raid member
local unit = "raid" .. i;
if UnitExists(unit) then
for x=1, 40 do
local spell = select(10, UnitAura(unit, x, 'PLAYER|HELPFUL'));
if spell == spellID then
buffCount = buffCount + 1;
end
end
end
end
elseif numGroupMembers >= 2 and numGroupMembers <= 5 then
for i = 1, 4 do -- For each party member
local unit = "party" .. i;
if UnitExists(unit) then
for x=1, 40 do
local spell = select(10, UnitAura(unit, x, 'PLAYER|HELPFUL'));
if spell == spellID then
buffCount = buffCount + 1;
end
end
end
end
for x=1, 40 do
local spell = select(10, UnitAura('player', x, 'PLAYER|HELPFUL'));
if spell == spellID then
buffCount = buffCount + 1;
end
end
elseif numGroupMembers <= 1 then
for x=1, 40 do
local spell = select(10, UnitAura('player', x, 'PLAYER|HELPFUL'));
if spell == spellID then
buffCount = buffCount + 1;
end
end
end
-- self:Print(self.Colors.Info .. numGroupMembers);
return buffCount;
end
function ConRO:EndCast(target)
target = target or 'player';
local t = GetTime();
local c = t * 1000;
local gcd = 0;
local _, _, _, _, endTime, _, _, _, spellId = UnitCastingInfo(target or 'player');
-- we can only check player global cooldown
if target == 'player' then
local gstart, gduration = GetSpellCooldown(61304);
gcd = gduration - (t - gstart);
if gcd < 0 then
gcd = 0;
end;
end
if not endTime then
return gcd, nil, gcd;
end
local timeShift = (endTime - c) / 1000;
if gcd > timeShift then
timeShift = gcd;
end
return timeShift, spellId, gcd;
end
function ConRO:EndChannel(target)
target = target or 'player';
local t = GetTime();
local c = t * 1000;
local gcd = 0;
local _, _, _, _, endTime, _, _, spellId = UnitChannelInfo(target or 'player');
-- we can only check player global cooldown
if target == 'player' then
local gstart, gduration = GetSpellCooldown(61304);
gcd = gduration - (t - gstart);
if gcd < 0 then
gcd = 0;
end;
end
if not endTime then
return gcd, nil, gcd;
end
local timeShift = (endTime - c) / 1000;
if gcd > timeShift then
timeShift = gcd;
end
return timeShift, spellId, gcd;
end
function ConRO:SameSpell(spell1, spell2)
local spellName1 = GetSpellInfo(spell1);
local spellName2 = GetSpellInfo(spell2);