-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathRecount.lua
1959 lines (1861 loc) · 64.1 KB
/
Recount.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
Recount = LibStub("AceAddon-3.0"):NewAddon("Recount", "AceConsole-3.0", "AceComm-3.0", "AceTimer-3.0")
local Recount = _G.Recount
local AceConfigDialog = LibStub("AceConfigDialog-3.0")
local SM = LibStub:GetLibrary("LibSharedMedia-3.0")
local AceLocale = LibStub("AceLocale-3.0")
local L = AceLocale:GetLocale( "Recount" )
local DataVersion = "1.3"
local FilterSize = 20
local RampUp = 5
local RampDown = 10
Recount.Version = tonumber(string.sub("$Revision: 1603 $", 12, -3))
local _G = _G
local abs = abs
local assert = assert
local collectgarbage = collectgarbage
local date = date
local getmetatable = getmetatable
local ipairs = ipairs
local math_floor = math.floor
local math_fmod = math.fmod
local next = next
local pairs = pairs
local setmetatable = setmetatable
local string_format = string.format
local string_lower = string.lower
local string_match = string.match
local tinsert = table.insert
local tonumber = tonumber
local tremove = table.remove
local type = type
local unpack = unpack
local C_PetBattles = C_PetBattles
local GetNumGroupMembers = GetNumGroupMembers
local GetNumPartyMembers = GetNumPartyMembers or GetNumSubgroupMembers
local GetNumRaidMembers = GetNumRaidMembers or GetNumGroupMembers
local GetTime = GetTime
local IsInRaid = IsInRaid
local UnitAffectingCombat = UnitAffectingCombat
local UnitClass = UnitClass
local UnitExists = UnitExists
local UnitGUID = UnitGUID
local UnitInParty = UnitInParty
local UnitIsFriend = UnitIsFriend
local UnitIsPlayer = UnitIsPlayer
local UnitIsTrivial = UnitIsTrivial
local UnitLevel = UnitLevel
local UnitName = UnitName
local CreateFrame = CreateFrame
local InterfaceOptionsFrame = InterfaceOptionsFrame
local UIParent = UIParent
local RecountTempTooltip = RecountTempTooltip
local WOW_RETAIL = WOW_PROJECT_ID == WOW_PROJECT_MAINLINE
Recount.events = CreateFrame("Frame")
Recount.events:SetScript("OnEvent", function(self, event, ...)
if not Recount[event] then
return
end
Recount[event](Recount, ...)
end)
local dbCombatants
-- Elsia: This is straight from GUIDRegistryLib-0.1 by ArrowMaster
local bit_bor = bit.bor
local bit_band = bit.band
local COMBATLOG_OBJECT_AFFILIATION_MINE = COMBATLOG_OBJECT_AFFILIATION_MINE or 0x00000001
local COMBATLOG_OBJECT_AFFILIATION_PARTY = COMBATLOG_OBJECT_AFFILIATION_PARTY or 0x00000002
local COMBATLOG_OBJECT_AFFILIATION_RAID = COMBATLOG_OBJECT_AFFILIATION_RAID or 0x00000004
local COMBATLOG_OBJECT_AFFILIATION_OUTSIDER = COMBATLOG_OBJECT_AFFILIATION_OUTSIDER or 0x00000008
local COMBATLOG_OBJECT_AFFILIATION_MASK = COMBATLOG_OBJECT_AFFILIATION_MASK or 0x0000000F
-- Reaction
local COMBATLOG_OBJECT_REACTION_FRIENDLY = COMBATLOG_OBJECT_REACTION_FRIENDLY or 0x00000010
local COMBATLOG_OBJECT_REACTION_NEUTRAL = COMBATLOG_OBJECT_REACTION_NEUTRAL or 0x00000020
local COMBATLOG_OBJECT_REACTION_HOSTILE = COMBATLOG_OBJECT_REACTION_HOSTILE or 0x00000040
local COMBATLOG_OBJECT_REACTION_MASK = COMBATLOG_OBJECT_REACTION_MASK or 0x000000F0
-- Ownership
local COMBATLOG_OBJECT_CONTROL_PLAYER = COMBATLOG_OBJECT_CONTROL_PLAYER or 0x00000100
local COMBATLOG_OBJECT_CONTROL_NPC = COMBATLOG_OBJECT_CONTROL_NPC or 0x00000200
local COMBATLOG_OBJECT_CONTROL_MASK = COMBATLOG_OBJECT_CONTROL_MASK or 0x00000300
-- Unit type
local COMBATLOG_OBJECT_TYPE_PLAYER = COMBATLOG_OBJECT_TYPE_PLAYER or 0x00000400
local COMBATLOG_OBJECT_TYPE_NPC = COMBATLOG_OBJECT_TYPE_NPC or 0x00000800
local COMBATLOG_OBJECT_TYPE_PET = COMBATLOG_OBJECT_TYPE_PET or 0x00001000
local COMBATLOG_OBJECT_TYPE_GUARDIAN = COMBATLOG_OBJECT_TYPE_GUARDIAN or 0x00002000
local COMBATLOG_OBJECT_TYPE_OBJECT = COMBATLOG_OBJECT_TYPE_OBJECT or 0x00004000
local COMBATLOG_OBJECT_TYPE_MASK = COMBATLOG_OBJECT_TYPE_MASK or 0x0000FC00
-- Special cases (non-exclusive)
local COMBATLOG_OBJECT_TARGET = COMBATLOG_OBJECT_TARGET or 0x00010000
local COMBATLOG_OBJECT_FOCUS = COMBATLOG_OBJECT_FOCUS or 0x00020000
local COMBATLOG_OBJECT_MAINTANK = COMBATLOG_OBJECT_MAINTANK or 0x00040000
local COMBATLOG_OBJECT_MAINASSIST = COMBATLOG_OBJECT_MAINASSIST or 0x00080000
local COMBATLOG_OBJECT_RAIDTARGET1 = COMBATLOG_OBJECT_RAIDTARGET1 or 0x00100000
local COMBATLOG_OBJECT_RAIDTARGET2 = COMBATLOG_OBJECT_RAIDTARGET2 or 0x00200000
local COMBATLOG_OBJECT_RAIDTARGET3 = COMBATLOG_OBJECT_RAIDTARGET3 or 0x00400000
local COMBATLOG_OBJECT_RAIDTARGET4 = COMBATLOG_OBJECT_RAIDTARGET4 or 0x00800000
local COMBATLOG_OBJECT_RAIDTARGET5 = COMBATLOG_OBJECT_RAIDTARGET5 or 0x01000000
local COMBATLOG_OBJECT_RAIDTARGET6 = COMBATLOG_OBJECT_RAIDTARGET6 or 0x02000000
local COMBATLOG_OBJECT_RAIDTARGET7 = COMBATLOG_OBJECT_RAIDTARGET7 or 0x04000000
local COMBATLOG_OBJECT_RAIDTARGET8 = COMBATLOG_OBJECT_RAIDTARGET8 or 0x08000000
local COMBATLOG_OBJECT_NONE = COMBATLOG_OBJECT_NONE or 0x80000000
local COMBATLOG_OBJECT_SPECIAL_MASK = COMBATLOG_OBJECT_SPECIAL_MASK or 0xFFFF0000
local LIB_FILTER_RAIDTARGET = bit_bor(
COMBATLOG_OBJECT_RAIDTARGET1, COMBATLOG_OBJECT_RAIDTARGET2, COMBATLOG_OBJECT_RAIDTARGET3, COMBATLOG_OBJECT_RAIDTARGET4,
COMBATLOG_OBJECT_RAIDTARGET5, COMBATLOG_OBJECT_RAIDTARGET6, COMBATLOG_OBJECT_RAIDTARGET7, COMBATLOG_OBJECT_RAIDTARGET8
)
local LIB_FILTER_ME = bit_bor(
COMBATLOG_OBJECT_AFFILIATION_MINE, COMBATLOG_OBJECT_REACTION_FRIENDLY, COMBATLOG_OBJECT_CONTROL_PLAYER, COMBATLOG_OBJECT_TYPE_PLAYER
)
local LIB_FILTER_MY_PET = bit_bor(
COMBATLOG_OBJECT_AFFILIATION_MINE,
COMBATLOG_OBJECT_REACTION_FRIENDLY,
COMBATLOG_OBJECT_CONTROL_PLAYER,
COMBATLOG_OBJECT_TYPE_PET
)
local LIB_FILTER_PARTY = bit_bor(COMBATLOG_OBJECT_TYPE_PLAYER, COMBATLOG_OBJECT_AFFILIATION_PARTY)
local LIB_FILTER_RAID = bit_bor(COMBATLOG_OBJECT_TYPE_PLAYER, COMBATLOG_OBJECT_AFFILIATION_RAID)
local LIB_FILTER_GROUP = bit_bor(LIB_FILTER_PARTY, LIB_FILTER_RAID)
local Default_Profile = {
profile = {
Colors = {
["Window"] = {
["Title"] = { r = 1, g = 0, b = 0, a = 1},
["Background"]= { r = 24 / 255, g = 24 / 255, b = 24 / 255, a = 1},
["Title Text"] = {r = 1, g = 1, b = 1, a = 1},
},
["Bar"] = {
["Bar Text"] = {r = 1, g = 1, b = 1},
["Total Bar"] = { r = 0.75, g = 0.75, b = 0.75},
},
["Other Windows"] = {
["Title"] = { r = 1, g = 0, b = 0, a = 1},
["Background"] = { r = 24 / 255, g = 24 / 255, b = 24 / 255, a = 1},
["Title Text"] = {r = 1, g = 1, b = 1, a = 1},
},
["Detail Window"] = {
},
["Class"] = {
["HUNTER"] = { r = 0.67, g = 0.83, b = 0.45, a = 1 },
["WARLOCK"] = { r = 0.58, g = 0.51, b = 0.79, a = 1 },
["PRIEST"] = { r = 1.0, g = 1.0, b = 1.0, a = 1 },
["PALADIN"] = { r = 0.96, g = 0.55, b = 0.73, a = 1 },
["MAGE"] = { r = 0.41, g = 0.8, b = 0.94, a = 1 },
["ROGUE"] = { r = 1.0, g = 0.96, b = 0.41, a = 1 },
["DRUID"] = { r = 1.0, g = 0.49, b = 0.04, a = 1 },
["SHAMAN"] = { r = 0.14, g = 0.35, b = 1.0, a = 1 },
["WARRIOR"] = { r = 0.78, g = 0.61, b = 0.43, a = 1 },
["DEATHKNIGHT"] = { r = 0.77, g = 0.12, b = 0.23, a = 1 },
["MONK"] = { r = 0, g = 1.0, b = 0.59, a = 1 },
["DEMONHUNTER"] = { r = 0.64, g = 0.19, b = 0.79, a = 1 },
["EVOKER"] = { r = 0.20, g = 0.58, b = 0.50, a = 1 },
["PET"] = { r = 0.09, g = 0.61, b = 0.55, a = 1 },
--["GUARDIAN"] = { r = 0.61, g = 0.09, b = 0.09 },
["MOB"] = { r = 0.58, g = 0.24, b = 0.63, a = 1 },
["UNKNOWN"] = { r = 0.1, g = 0.1, b = 0.1, a = 1 },
["HOSTILE"] = { r = 0.5, g = 0, b = 0, a = 1 },
["UNGROUPED"] = { r = 0.63, g = 0.58, b = 0.24, a = 1 },
},
["Realtime"] = {
},
["Names"] = {
}
},
MaxFights = 5,
--[[Window = {
--ShowCurAndLast = false,
},]]
ReportLines = 10,
MessagesTracked = 50,
GlobalStatusBar = false,
AutoDelete = true,
AutoDeleteCombatants = true, -- Elsia: set this to true to reduce data accumulation
AutoDeleteTime = 180,
AutoDeleteNewInstance = true, -- Elsia: set this to true
ConfirmDeleteInstance = true, -- Elsia: Get annoying popup box?
LastInstanceName = "", -- Elsia: Last instance is empty by default
DeleteNewInstanceOnly = true,
DeleteJoinRaid = true,
ConfirmDeleteRaid = true,
DeleteJoinGroup = true,
ConfirmDeleteGroup = true,
BarTexture = "BantoBar",
MergePets = true,
MergeAbsorbs = true,
MergeDamageAbsorbs = true,
RecordCombatOnly = true,
SegmentBosses = false,
MainWindowVis = true,
MainWindowMode = 1,
Locked = false,
EnableSync = false, -- Elsia: Default enable sync is set to true again now, thanks to lazy syncing
GlobalDataCollect = true, -- Elsia: Global toggle for data collection
HideCollect = false, -- Elsia: Hide Recount window when not collecting data
HidePetBattle = false,
Font = "Arial Narrow",
Scaling = 1,
Modules = {
HealingTaken = true,
OverhealingDone = true,
Deaths = true,
DOTUptime = true,
HOTUptime = true,
Activity = true,
},
MainWindow = {
Buttons = {
ReportButton = true,
FileButton = true,
ConfigButton = true,
ResetButton = true,
LeftButton = true,
RightButton = true,
CloseButton = true,
},
RowHeight = 14,
RowSpacing = 1,
AutoHide = false,
ShowScrollbar = true, -- Elsia: Allow toggle of scrollbar
HideTotalBar = true,
BarText = {
RankNum = true,
ServerName = false,
PerSec = true,
Percent = true,
NumFormat = 1,
},
Position = {
x = 0,
y = 0,
w = 140,
h = 200,
},
},
Filters = {
Show = {
Self = true,
Grouped = true,
Ungrouped = true, -- Elsia: Default show leaving party members
Hostile = false,
Pet = false,
Trivial = false,
Nontrivial = false,
Boss = false,
Unknown = false,
},
Data = {
Self = true,
Grouped = true,
Ungrouped = false, -- Elsia: Removed to reduce default data accumulation
Hostile = false,
Pet = true,
Trivial = false,
Nontrivial = false,
Boss = true,
Unknown = true,
},
TimeData = {
Self = false,
Grouped = false, -- Elsia: Removed Default timed on for groups
Ungrouped = false,
Hostile = false,
Pet = false,
Trivial = false,
Nontrivial = false,
Boss = false, -- Elsia:Removed Default timed on for bosses
Unknown = false,
},
TrackDeaths = {
Self = true,
Grouped = true,
Ungrouped = false,
Hostile = false,
Pet = true,
Trivial = false,
Nontrivial = false,
Boss = true,
Unknown = false,
},
},
ZoneFilters = {
none = true, -- Elsia: These fields are named after what IsInInstance() returns for types.
pvp = true,
arena = true,
scenario = true,
party = true,
raid = true,
},
GroupFilters = {
[1] = true, -- Solo
[2] = true, -- Party
[3] = true, -- Raid
},
FilterDeathType = {
DAMAGE = true,
HEAL = true,
MISC = true,
},
FilterDeathIncoming = {
[true] = true,
[false] = false
},
RealtimeWindows = { },
ClampToScreen = false,
},
}
SM:Register("statusbar", "Aluminium", [[Interface\Addons\Recount\Textures\statusbar\Aluminium]])
SM:Register("statusbar", "Armory", [[Interface\Addons\Recount\Textures\statusbar\Armory]])
SM:Register("statusbar", "BantoBar", [[Interface\Addons\Recount\Textures\statusbar\BantoBar]])
SM:Register("statusbar", "Flat", [[Interface\Addons\Recount\Textures\statusbar\Flat]])
SM:Register("statusbar", "Minimalist", [[Interface\Addons\Recount\Textures\statusbar\Minimalist]])
SM:Register("statusbar", "Otravi", [[Interface\Addons\Recount\Textures\statusbar\Otravi]])
SM:Register("statusbar", "Empty", [[Interface\Addons\Recount\Textures\statusbar\Empty]])
BINDING_HEADER_RECOUNT = "Recount"
BINDING_NAME_RECOUNT_PREVIOUSPAGE = L["Show previous main page"]
BINDING_NAME_RECOUNT_NEXTPAGE = L["Show next main page"]
BINDING_NAME_RECOUNT_DAMAGE = L["Display"].." "..L["Damage Done"]
BINDING_NAME_RECOUNT_DPS = L["Display"].." "..L["DPS"]
BINDING_NAME_RECOUNT_FRIENDLYFIRE = L["Display"].." "..L["Friendly Fire"]
BINDING_NAME_RECOUNT_DAMAGETAKEN = L["Display"].." "..L["Damage Taken"]
BINDING_NAME_RECOUNT_HEALING = L["Display"].." "..L["Healing Done"]
BINDING_NAME_RECOUNT_HEALINGTAKEN = L["Display"].." "..L["Healing Taken"]
BINDING_NAME_RECOUNT_OVERHEALING = L["Display"].." "..L["Overhealing Done"]
BINDING_NAME_RECOUNT_DEATHS = L["Display"].." "..L["Deaths"]
BINDING_NAME_RECOUNT_DOTS = L["Display"].." "..L["DOT Uptime"]
BINDING_NAME_RECOUNT_HOTS = L["Display"].." "..L["HOT Uptime"]
BINDING_NAME_RECOUNT_ACTIVITY = L["Display"].." "..L["Activity"]
BINDING_NAME_RECOUNT_DISPELS = L["Display"].." "..L["Dispels"]
BINDING_NAME_RECOUNT_DISPELLED = L["Display"].." "..L["Dispelled"]
BINDING_NAME_RECOUNT_INTERRUPTS = L["Display"].." "..L["Interrupts"]
BINDING_NAME_RECOUNT_RESURRECT = L["Display"].." "..L["Ressers"]
BINDING_NAME_RECOUNT_CCBREAKER = L["Display"].." "..L["CC Breakers"]
BINDING_NAME_RECOUNT_MANA = L["Display"].." "..L["Mana Gained"]
BINDING_NAME_RECOUNT_ENERGY = L["Display"].." "..L["Energy Gained"]
BINDING_NAME_RECOUNT_RAGE = L["Display"].." "..L["Rage Gained"]
BINDING_NAME_RECOUNT_RUNICPOWER = L["Display"].." "..L["Runic Power Gained"]
BINDING_NAME_RECOUNT_LUNAR_POWER = L["Display"].." "..L["Astral Power Gained"]
BINDING_NAME_RECOUNT_MAELSTROM = L["Display"].." "..L["Maelstorm Gained"]
BINDING_NAME_RECOUNT_FURY = L["Display"].." "..L["Fury Gained"]
BINDING_NAME_RECOUNT_PAIN = L["Display"].." "..L["Pain Gained"]
BINDING_NAME_RECOUNT_REPORT_MAIN = L["Report the Main Window Data"]
BINDING_NAME_RECOUNT_REPORT_DETAILS = L["Report the Detail Window Data"]
BINDING_NAME_RECOUNT_RESET_DATA = L["Resets the data"]
BINDING_NAME_RECOUNT_SHOW_MAIN = L["Shows the main window"]
BINDING_NAME_RECOUNT_HIDE_MAIN = L["Hides the main window"]
BINDING_NAME_RECOUNT_TOGGLE_MAIN = L["Toggles the main window"]
BINDING_NAME_RECOUNT_TOGGLE_PAUSE = L["Toggle pause of global data collection"]
BINDING_NAME_RECOUNT_TOGGLE_MERGEPETS = L["Toggle merge pets"]
local optFrame
local function deepcopy(object)
local lookup_table = {}
local function _copy(object)
if type(object) ~= "table" then
return object
elseif lookup_table[object] then
return lookup_table[object]
end
local new_table = {}
lookup_table[object] = new_table
for index, value in pairs(object) do
new_table[_copy(index)] = _copy(value)
end
return setmetatable(new_table, getmetatable(object))
end
return _copy(object)
end
Recount.consoleOptions = {
name = L["Recount"],
type = 'group',
args = {
confdesc = {
order = 1,
type = "description",
name = L["Config Access"].."\n",
cmdHidden = true
},
windesc = {
order = 10,
type = "description",
name = L["Window Options"].."\n",
cmdHidden = true
},
syncdesc = {
order = 20,
type = "description",
name = L["Sync Options"].."\n",
cmdHidden = true
},
datadesc = {
order = 30,
type = "description",
name = L["Data Options"].."\n",
cmdHidden = true
},
[L["gui"]] = {
order = 2,
name = L["GUI"],
desc = L["Open Ace3 Config GUI"],
type = 'execute',
func = function()
AceConfigDialog:SetDefaultSize("Recount", 500, 550)
AceConfigDialog:Open("Recount")
end
},
[L["sync"]] = {
order = 21,
name = L["Sync"],
desc = L["Toggles sending synchronization messages"],
type = 'toggle',
get = function(info)
return Recount.db.profile.EnableSync
end,
set = function(info, v)
if v then -- Elsia: Make sure it's on before enabling, an event might intervene
Recount:ConfigComm()
Recount:Print("Lazy Sync enabled")
end
Recount.db.profile.EnableSync = v
if not v then -- Elsia: Make sure it's off before disabling, an event might intervene
Recount:FreeComm()
Recount:Print("Lazy Sync disabled")
end
end,
},
[L["reset"]] = {
order = 31,
name = L["Reset"],
desc = L["Resets the data"],
type = 'execute',
func = function()
Recount:ResetData()
end
},
[L["verChk"]] = {
order = 22,
name = L["VerChk"],
desc = L["Displays the versions of players in the raid"],
type = 'execute',
func = function()
Recount:ReportVersions()
end
},
[L["show"]] = {
order = 12,
name = L["Show"],
desc = L["Shows the main window"],
type = 'execute',
func = function()
Recount.MainWindow:Show()
Recount:RefreshMainWindow()
end,
dialogHidden = true
},
[L["pause"]] = {
order = 23,
name = L["Pause"],
desc = L["Toggle pause of global data collection"],
type = 'execute',
func = function()
if not Recount.db.profile.GlobalDataCollect then
Recount:SetGlobalDataCollect(true)
Recount:Print(L["Data collection turned on"])
else
Recount:SetGlobalDataCollect(false)
Recount:Print(L["Data collection turned off"])
end
end,
},
hide = {
order = 13,
name = L["Hide"],
desc = L["Hides the main window"],
type = 'execute',
func = function()
Recount.MainWindow:Hide()
end,
dialogHidden = true
},
toggle = {
order = 11,
name = L["Toggle"],
desc = L["Toggles the main window"],
type = 'execute',
func = function()
if Recount.MainWindow:IsShown() then
Recount.MainWindow:Hide()
else
Recount.MainWindow:Show()
Recount:RefreshMainWindow()
end
end
},
config = {
order = 3,
name = L["Config"],
desc = L["Shows the config window"],
type = 'execute',
func = function()
Recount:ShowConfig()
end
},
resetpos = {
order = 14,
name = L["ResetPos"],
desc = L["Resets the positions of the detail, graph, and main windows"],
type = 'execute',
func = function()
Recount:ResetPositions()
end
},
lock = {
order = 15,
name = L["Lock"],
desc = L["Toggles windows being locked"],
type = 'toggle',
get = function(info)
return Recount.db.profile.Locked
end,
set = function(info, v)
Recount.db.profile.Locked = v
Recount:LockWindows(v)
end,
},
maxfights = {
order = 31,
name = L["Recorded Fights"],
desc = L["Set the maximum number of recorded fight segments"],
type = 'range',
min = 1,
max = 25,
step = 1,
get = function(info)
return Recount.db.profile.MaxFights
end,
set = function(info, v)
if v < Recount.db.profile.MaxFights then
Recount.Fights:DeleteOverflowFights(v)
end
Recount.db.profile.MaxFights = v
end,
},
FrameStrata = {
type = "select",
order = 17,
name = L["Frame Strata"],
desc = L["Controls the frame strata of the Recount windows. Default: MEDIUM"],
values = { -- A hack to sort them in the menu
["1-BACKGROUND"] = "BACKGROUND",
["2-LOW"] = "LOW",
["3-MEDIUM"] = "MEDIUM",
["4-HIGH"] = "HIGH",
["5-DIALOG"] = "DIALOG",
["6-FULLSCREEN"] = "FULLSCREEN",
["7-FULLSCREEN_DIALOG"] = "FULLSCREEN_DIALOG",
["8-TOOLTIP"] = "TOOLTIP",
},
get = function(info)
return Recount.db.profile.FrameStrata or "3-MEDIUM"
end,
set = function(info, value)
Recount.db.profile.FrameStrata = value
Recount:SetStrataAndClamp()
end,
},
ClampToScreen = {
type = "toggle",
name = L["Clamp To Screen"],
desc = L["Controls whether the Recount windows can be dragged offscreen"],
order = 16,
get = function(info)
return Recount.db.profile.ClampToScreen
end,
set = function(info, value)
Recount.db.profile.ClampToScreen = value
Recount:SetStrataAndClamp()
end,
},
}
}
Recount.consoleOptions2 = deepcopy(Recount.consoleOptions)
Recount.consoleOptions2.args.report = {
order = 32,
name = L["Report"],
type = 'group',
desc = L["Allows the data of a window to be reported"],
args = {
detail = {
type = "select",
name = L["Detail"],
order = 2,
desc = L["Report the Detail Window Data"],
values = {
["Say"] = "Say",
["Party"] = "Party",
["Raid"] = "Raid",
["Guild"] = "Guild",
["Officer"] = "Officer",
["Gui"] = "GUI",
},
get = function(info)
return "Select"
end,
set = function(info, value)
if string_lower(value) == "gui" then
Recount:ShowReport("Detail", Recount.ReportDetail)
else
Recount.db.profile.ReportLines = Recount.db.profile.ReportLines or 10
Recount:ReportDetail(Recount.db.profile.ReportLines, string_lower(value), "")
end
end,
},
main = {
type = "select",
name = L["Main"],
order = 1,
desc = L["Report the Main Window Data"],
values = {
["Say"] = "Say",
["Party"] = "Party",
["Raid"] = "Raid",
["Guild"] = "Guild",
["Officer"] = "Officer",
["Gui"] = "GUI",
},
get = function(info)
return "Select"
end,
set = function(info, value)
if string_lower(value) == "gui" then
Recount:ShowReport("Main", Recount.ReportData)
else
Recount.db.profile.ReportLines = Recount.db.profile.ReportLines or 10
Recount:ReportData(Recount.db.profile.ReportLines, string_lower(value), "")
end
end,
},
lines = {
order = 3,
name = L["Lines Reported"],
desc = L["Set the maximum number of lines to report"],
type = 'range',
min = 1,
max = 25,
step = 1,
get = function(info)
return Recount.db.profile.ReportLines or 10
end,
set = function(info, v)
Recount.db.profile.ReportLines = v
end,
},
}
}
Recount.consoleOptions2.args.realtime = {
name = L["Realtime"],
type = 'group',
desc = L["Specialized Realtime Graphs"],
args = {
netfps = {
name = L["Network and FPS"],
type = 'group',
inline = true,
args = {
fps = {
name = L["FPS"],
desc = L["Starts a realtime window tracking your FPS"],
type = 'execute',
func = function()
Recount:CreateRealtimeWindow("FPS", "FPS", "")
end
},
lag = {
name = L["Lag"],
desc = L["Starts a realtime window tracking your latency"],
type = 'execute',
func = function()
Recount:CreateRealtimeWindow("Latency", "LAG", "")
end
},
uptraffic = {
name = L["Upstream Traffic"],
desc = L["Starts a realtime window tracking your upstream traffic"],
type = 'execute',
func = function()
Recount:CreateRealtimeWindow("Upstream Traffic", "UP_TRAFFIC", "")
end
},
downtraffic = {
name = L["Downstream Traffic"],
desc = L["Starts a realtime window tracking your downstream traffic"],
type = 'execute',
func = function()
Recount:CreateRealtimeWindow("Downstream Traffic", "DOWN_TRAFFIC", "")
end
},
bandwidth = {
name = L["Available Bandwidth"],
desc = L["Starts a realtime window tracking amount of available AceComm bandwidth left"],
type = 'execute',
func = function()
Recount:CreateRealtimeWindow("Bandwidth Available", "AVAILABLE_BANDWIDTH", "")
end
},
},
},
raid = {
name = L["Raid"],
desc = L["Tracks your entire raid"],
type = 'group',
inline = true,
args = {
dps = {
name = L["DPS"],
desc = L["Tracks Raid Damage Per Second"],
type = 'execute',
func = function()
Recount:CreateRealtimeWindow("!RAID", "DAMAGE", "Raid DPS")
end
},
dtps = {
name = L["DTPS"],
desc = L["Tracks Raid Damage Taken Per Second"],
type = 'execute',
func = function()
Recount:CreateRealtimeWindow("!RAID", "DAMAGETAKEN", "Raid DTPS")
end
},
hps = {
name = L["HPS"],
desc = L["Tracks Raid Healing Per Second"],
type = 'execute',
func = function()
Recount:CreateRealtimeWindow("!RAID", "HEALING", "Raid HPS")
end
},
htps = {
name = L["HTPS"],
desc = L["Tracks Raid Healing Taken Per Second"],
type = 'execute',
func = function()
Recount:CreateRealtimeWindow("!RAID", "HEALINGTAKEN", "Raid HTPS")
end
},
}
}
}
}
function Recount:PLAYER_REGEN_ENABLED()
Recount:ResetDataUnsafe()
end
function Recount:ZONE_CHANGED_NEW_AREA()
Recount:DetectInstanceChange()
end
function Recount:PLAYER_ENTERING_WORLD()
Recount:DetectInstanceChange()
end
function Recount:PET_BATTLE_OPENING_START()
Recount:PetBattleUpdate()
end
function Recount:PET_BATTLE_CLOSE()
Recount:PetBattleUpdate()
end
function Recount:INSTANCE_ENCOUNTER_ENGAGE_UNIT()
Recount:BossFound()
end
function Recount:ReportVersions() -- Elsia: Functionified so GUI can use it too
if not Recount.lazysync then
Recount:Print(L["Sync is disabled."])
elseif GetNumGroupMembers() == 0 then
Recount:Print(L["No other Recount users found."])
else
if Recount.VerTable and next(Recount.VerTable) then -- Elsia: Fixed nil error on non sync situation.
Recount:Print(L["Displaying Versions"]..":")
for k, v in pairs(Recount.VerTable) do
Recount:Print(k.." "..v)
end
end
end
end
function Recount:ShowCombatantList()
for k, v in pairs(dbCombatants) do
Recount:Print(k.." "..(v.Name or "nil").." "..(v.type or "nil").." "..(v.level or "nil").." "..(v.enClass or "nil").." "..(v.GUID or "nil"))
end
Recount:ShowNrCombatants()
end
function Recount:NrCombatants()
local counter = 0
for k, v in pairs(dbCombatants) do
counter = counter + 1
end
return counter
end
function Recount:ShowNrCombatants()
Recount:Print(Recount:NrCombatants())
end
function Recount:ResetData()
if UnitAffectingCombat("player") then
Recount.events:RegisterEvent("PLAYER_REGEN_ENABLED")
else
Recount:ResetDataUnsafe()
end
end
function Recount:ResetDataUnsafe()
Recount.events:UnregisterEvent("PLAYER_REGEN_ENABLED")
if Recount.GraphWindow then
Recount.GraphWindow:Hide()
Recount.GraphWindow.LineGraph:LockXMin(false)
Recount.GraphWindow.LineGraph:LockXMax(false)
Recount.GraphWindow.TimeRangeSet = false
end
if Recount.DetailWindow then
Recount.DetailWindow:Hide()
end
for k, v in pairs(dbCombatants) do
Recount:DeleteGuardianOwnerByGUID(dbCombatants[k])
dbCombatants[k] = nil
end
for k, v in pairs(Recount.db2.CombatTimes) do
Recount.db2.CombatTimes[k] = nil
end
if Recount.MainWindow and Recount.MainWindow.DispTableSorted then
Recount.MainWindow.DispTableSorted = Recount:GetTable()
Recount.MainWindow.DispTableLookup = Recount:GetTable()
end
if Recount.MainWindow then
Recount:RefreshMainWindow()
end
if #Recount.db2.FoughtWho > 0 then
Recount:SendReset() -- Elsia: Sync the reset if we actually fought something
end
Recount.db2.FoughtWho = { }
Recount:ResetTableCache()
if Recount.db.profile.CurDataSet ~= "CurrentFightData" and Recount.db.profile.CurDataSet ~= "LastFightData" then
Recount.db.profile.CurDataSet = "OverallData"
end
if RecountDeathTrack then
RecountDeathTrack:DeleteAllTracks()
RecountDeathTrack:SetFight(Recount.db.profile.CurDataSet)
end
Recount.db2.FightNum = 0
for k, v in pairs(dbCombatants) do
v.LastFightIn = 0
end
-- Perform a garbage collect if they are resetting the data
collectgarbage()
end
function Recount:FindUnit(name)
local unit = Recount:GetUnitIDFromName(name) -- We shouldn't need to find roster units.
if unit then
return unit
end
unit = Recount:FindTargetedUnit(name)
return unit
end
function Recount:ResetFightData(data)
if not data then
data = { }
else
for k, v in pairs(data) do
if type(v) == "table" then
Recount:ResetFightData(v)
elseif type(v) == "number" then
data[k] = 0
elseif type(v) == "string" then
data[k] = nil
elseif type(v) == "boolean" then
data[k] = nil
end
end
end
end
function Recount:InitFightData(data)
-- Init Data tracked
data.Damage = 0
data.FDamage = 0
data.DamageTaken = 0
data.Healing = 0
data.HealingTaken = 0
data.Overhealing = 0
data.DeathCount = 0
data.DOT_Time = 0
data.HOT_Time = 0
data.Interrupts = 0
data.Dispels = 0
data.Dispelled = 0
data.ActiveTime = 0
data.TimeHeal = 0
data.TimeDamage = 0
data.CCBreak = 0
data.ManaGain = 0
data.EnergyGain = 0
data.RageGain = 0
data.RunicPowerGain = 0
data.Ressed = 0
-- Ability Data
data.Attacks = Recount:GetTable()
data.FAttacks = Recount:GetTable()
data.Heals = Recount:GetTable()
data.OverHeals = Recount:GetTable()
data.DOTs = Recount:GetTable()
data.HOTs = Recount:GetTable()
data.InterruptData = Recount:GetTable()
data.CCBroken = Recount:GetTable()
-- Interaction Data
data.DamagedWho = Recount:GetTable() -- Who did I damage?
data.FDamagedWho = Recount:GetTable() -- Who did I damage?
data.WhoDamaged = Recount:GetTable() -- Who damaged me?
data.HealedWho = Recount:GetTable() -- Who did I heal?
data.WhoHealed = Recount:GetTable() -- Who healed me?
data.DispelledWho = Recount:GetTable() -- Who did I dispel?
data.WhoDispelled = Recount:GetTable() -- Who dispelled me?
data.TimeSpent = Recount:GetTable() -- Where did I spend my time
data.TimeDamaging = Recount:GetTable() -- Where did I spend my time attacking
data.TimeHealing = Recount:GetTable() -- Where did I spend my time healing
data.ManaGained = Recount:GetTable() -- Where did I gain mana
data.EnergyGained = Recount:GetTable() -- Where did I gain energy
data.RageGained = Recount:GetTable() -- Where did I gain rage
data.RunicPowerGained = Recount:GetTable() -- Where did I gain runic power
data.ManaGainedFrom = Recount:GetTable() -- Where did I gain mana
data.EnergyGainedFrom = Recount:GetTable() -- Where did I gain energy
data.RageGainedFrom = Recount:GetTable() -- Where did I gain rage
data.RunicPowerGainedFrom = Recount:GetTable() -- Where did I gain runic power
data.PartialResist = Recount:GetTable() -- What spells partially resisted
data.PartialBlock = Recount:GetTable() -- What attacks partially blocked
data.PartialAbsorb = Recount:GetTable() -- What damage partially absorbed
data.RessedWho = Recount:GetTable()
-- Elemental Tracking
data.ElementDone = Recount:GetTable()
data.ElementDoneResist = Recount:GetTable()
data.ElementDoneBlock = Recount:GetTable()
data.ElementDoneAbsorb = Recount:GetTable()
data.ElementTaken = Recount:GetTable()
data.ElementTakenResist = Recount:GetTable()
data.ElementTakenBlock = Recount:GetTable()
data.ElementTakenAbsorb = Recount:GetTable()
data.ElementHitsDone = Recount:GetTable()
data.ElementHitsTaken = Recount:GetTable()
end
function Recount:CreateOwnerFlags(nameFlags)
local ownerFlags = bit_band(nameFlags, COMBATLOG_OBJECT_AFFILIATION_MASK + COMBATLOG_OBJECT_REACTION_MASK + COMBATLOG_OBJECT_CONTROL_MASK)
if bit_band(nameFlags, COMBATLOG_OBJECT_CONTROL_PLAYER) ~= 0 then
ownerFlags = ownerFlags + COMBATLOG_OBJECT_TYPE_PLAYER
else -- NPC
ownerFlags = ownerFlags + COMBATLOG_OBJECT_TYPE_NPC
end
return ownerFlags
end
local FlagsToUnitID = {
[COMBATLOG_OBJECT_TARGET] = "target",
[COMBATLOG_OBJECT_FOCUS] = "focus",
[COMBATLOG_OBJECT_MAINTANK] = "maintank",
[COMBATLOG_OBJECT_MAINASSIST] = "mainassist",
[COMBATLOG_OBJECT_RAIDTARGET1] = "raid1target",
[COMBATLOG_OBJECT_RAIDTARGET2] = "raid2target",
[COMBATLOG_OBJECT_RAIDTARGET3] = "raid3target",
[COMBATLOG_OBJECT_RAIDTARGET4] = "raid4target",
[COMBATLOG_OBJECT_RAIDTARGET5] = "raid5target",
[COMBATLOG_OBJECT_RAIDTARGET6] = "raid6target",
[COMBATLOG_OBJECT_RAIDTARGET7] = "raid7target",
[COMBATLOG_OBJECT_RAIDTARGET8] = "raid8target",
}