-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathRecount_Modes.lua
809 lines (719 loc) · 27.6 KB
/
Recount_Modes.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
local Recount = _G.Recount
local AceLocale = LibStub("AceLocale-3.0")
local L = AceLocale:GetLocale("Recount")
local Epsilon = 0.000000000000000001
local revision = tonumber(string.sub("$Revision: 1472 $", 12, -3))
if Recount.Version < revision then
Recount.Version = revision
end
local math_floor = math.floor
local next = next
local pairs = pairs
local setmetatable = setmetatable
local table_sort = table.sort
local tinsert = table.insert
local GameTooltip = GameTooltip
local dbCombatants
--.MainTitle = What you see on the window title
--.TopNames = Names of the entries for the top data
--.TopAmount = What we call the amount for the top
--.BotNames = Names of the entries for the bottom
--.BotMin = The minimum label for bottom
--.BotAvg = The average label for bottom
--.BotMax = The minimum label for bottom
--.BotAmount = Label for what the amount is on the bottom
local DetailTitles = { }
DetailTitles.Attacks = {
TopNames = L["Ability Name"],
TopCount = L["Count"],
TopAmount = L["Damage"],
BotNames = L["Type"],
BotMin = L["Min"],
BotAvg = L["Avg"],
BotMax = L["Max"],
BotAmount = L["Count"]
}
DetailTitles.Resisted = {
TopNames = L["Ability Name"],
TopCount = L["Resisted"],
TopAmount = L["Count"],
BotNames = L["Type"],
BotMin = L["Min"],
BotAvg = L["Avg"],
BotMax = L["Max"],
BotAmount = L["Count"]
}
DetailTitles.Blocked = {
TopNames = L["Ability Name"],
TopCount = "",
TopAmount = L["Blocked"],
BotNames = L["Type"],
BotMin = L["Min"],
BotAvg = L["Avg"],
BotMax = L["Max"],
BotAmount = L["Count"]
}
--[[DetailTitles.Absorbed = {
TopNames = L["Ability Name"],
TopCount = "",
TopAmount = L["Absorbed"],
BotNames = L["Type"],
BotMin = L["Min"],
BotAvg = L["Avg"],
BotMax = L["Max"],
BotAmount = L["Count"]
}]]
DetailTitles.DamagedWho = {
TopNames = L["Player/Mob Name"],
TopCount = "",
TopAmount = L["Damage"],
BotNames = L["Attack Name"],
BotMin = "",
BotAvg = "",
BotMax = "",
BotAmount = L["Damage"]
}
DetailTitles.DamageTime = {
TopNames = L["Player/Mob Name"],
TopCount = "",
TopAmount = L["Time (s)"],
BotNames = L["Attack Name"],
BotMin = "",
BotAvg = "",
BotMax = "",
BotAmount = L["Time (s)"]
}
DetailTitles.Heals = {
TopNames = L["Heal Name"],
TopCount = L["Count"],
TopAmount = L["Heal"],
BotNames = L["Type"],
BotMin = L["Min"],
BotAvg = L["Avg"],
BotMax = L["Max"],
BotAmount = L["Count"]
}
DetailTitles.HealedWho = {
TopNames = L["Player/Mob Name"],
TopCount = "",
TopAmount = L["Healed"],
BotNames = L["Heal Name"],
BotMin = "",
BotAvg = "",
BotMax = "",
BotAmount = L["Healed"]
}
DetailTitles.OverHeals = {
TopNames = L["Heal Name"],
TopCount = L["Count"],
TopAmount = L["Overheal"],
BotNames = L["Type"],
BotMin = L["Min"],
BotAvg = L["Avg"],
BotMax = L["Max"],
BotAmount = L["Count"]
}
DetailTitles.HealTime = {
TopNames = L["Player/Mob Name"],
TopCount = "",
TopAmount = L["Time (s)"],
BotNames = L["Heal Name"],
BotMin = "",
BotAvg = "",
BotMax = "",
BotAmount = L["Time (s)"]
}
DetailTitles.ActiveTime = {
TopNames = L["Player/Mob Name"],
TopCount = "",
TopAmount = L["Time (s)"],
BotNames = L["Ability"],
BotMin = "",
BotAvg = "",
BotMax = "",
BotAmount = L["Time (s)"]
}
DetailTitles.DOTs = {
TopNames = L["Ability Name"],
TopCount = "",
TopAmount = L["DOT Time"],
BotNames = L["Ticked on"],
BotMin = "",
BotAvg = "",
BotMax = "",
BotAmount = L["Duration"]
}
DetailTitles.HOTs = {
TopNames = L["Ability Name"],
TopCount = "",
TopAmount = L["HOT Time"],
BotNames = L["Ticked on"],
BotMin = "",
BotAvg = "",
BotMax = "",
BotAmount = L["Duration"]
}
DetailTitles.Absorbed = {
TopNames = L["Ability Name"],
TopCount = L["Count"],
TopAmount = L["Absorbed"],
BotNames = "Player Name",
BotMin = L["Min"],
BotAvg = L["Avg"],
BotMax = L["Max"],
BotAmount = L["Count"]
}
DetailTitles.ShieldedWho = {
TopNames = L["Player/Mob Name"],
TopCount = "",
TopAmount = L["Count"],
BotNames = L["Ability Name"],
BotMin = "",
BotAvg = "",
BotMax = "",
BotAmount = L["Count"]
}
DetailTitles.ShieldDamagedBy = {
TopNames = L["Player/Mob Name"],
TopCount = "",
TopAmount = L["Count"],
BotNames = L["Ability Name"],
BotMin = "",
BotAvg = "",
BotMax = "",
BotAmount = L["Count"]
}
DetailTitles.Network = {
TopNames = L["Prefix"],
TopCount = "",
TopAmount = L["Messages"],
BotNames = L["Distribution"],
BotMin = "",
BotAvg = "",
BotMax = "",
BotAmount = L["Messages"]
}
function Recount:MergedPetDamageDPS(data, fight)
if not data or not data.Fights or not data.Fights[fight] then
return 0, 0
end
local PetAmount = 0
local PetTime = 0
local Time = data.Fights[fight].TimeDamage or 0
if Recount.db.profile.MergePets and data.Pet then
for v, k in pairs(data.Pet) do
if dbCombatants[k] and dbCombatants[k].Fights and dbCombatants[k].Fights[fight] then
if dbCombatants[k].Fights[fight].Damage and dbCombatants[k].Fights[fight].Damage > 0 then -- Ignore pets which didn't do any damage like non-damage totems or idle pets.
PetAmount = PetAmount + (dbCombatants[k].Fights[fight].Damage or 0)
if (dbCombatants[k].Fights[fight].TimeDamage or 0) > PetTime then
PetTime = dbCombatants[k].Fights[fight].TimeDamage
--PetTime = PetTime + (dbCombatants[k].Fights[fight].TimeDamage or 0)
end
end
end
end
if Time < PetTime then
Time = PetTime
end
end
local damage = data.Fights[fight].Damage or 0
if Time == 0 then
damage = 0
PetAmount = 0
Time = Epsilon
end
return (damage + PetAmount), (damage + PetAmount) / Time
end
local DataModes = { }
function DataModes:DamageReturner(data, num)
if not data or not data.Fights[Recount.db.profile.CurDataSet] then
return 0, 0
end
local damage, dps = Recount:MergedPetDamageDPS(data, Recount.db.profile.CurDataSet)
if num == 1 then
return damage, dps
end
return damage, {{data.Fights[Recount.db.profile.CurDataSet].Attacks, L["'s Hostile Attacks"], DetailTitles.Attacks}, {data.Fights[Recount.db.profile.CurDataSet].DamagedWho, " "..L["Damaged Who"], DetailTitles.DamagedWho}, {data.Fights[Recount.db.profile.CurDataSet].PartialResist, L["'s Partial Resists"], DetailTitles.Resisted}, {data.Fights[Recount.db.profile.CurDataSet].TimeDamaging, L["'s Time Spent Attacking"], DetailTitles.DamageTime}}
end
function DataModes:DPSReturner(data, num)
if not data or not data.Fights[Recount.db.profile.CurDataSet] then
return 0
end
local _, dps = Recount:MergedPetDamageDPS(data, Recount.db.profile.CurDataSet)
if num == 1 then
return dps
end
return dps, {{data.Fights[Recount.db.profile.CurDataSet].Attacks, L["'s Hostile Attacks"], DetailTitles.Attacks}, {data.Fights[Recount.db.profile.CurDataSet].DamagedWho, " "..L["Damaged Who"], DetailTitles.DamagedWho}, {data.Fights[Recount.db.profile.CurDataSet].PartialResist, L["'s Partial Resists"], DetailTitles.Resisted}, {data.Fights[Recount.db.profile.CurDataSet].TimeDamaging, L["'s Time Spent Attacking"], DetailTitles.DamageTime}}
end
function DataModes:FriendlyDamageReturner(data, num)
if not data or not data.Fights[Recount.db.profile.CurDataSet] then
return 0
end
if num == 1 then
return (data.Fights[Recount.db.profile.CurDataSet].FDamage or 0)
end
return (data.Fights[Recount.db.profile.CurDataSet].FDamage or 0), {{data.Fights[Recount.db.profile.CurDataSet].FAttacks, L["'s Friendly Fire"], DetailTitles.Attacks}, {data.Fights[Recount.db.profile.CurDataSet].FDamagedWho, " "..L["Friendly Fired On"], DetailTitles.DamagedWho}}
end
function DataModes:DamageTakenReturner(data, num)
if not data or not data.Fights[Recount.db.profile.CurDataSet] then
return 0
end
if num == 1 then
return (data.Fights[Recount.db.profile.CurDataSet].DamageTaken or 0)
end
return (data.Fights[Recount.db.profile.CurDataSet].DamageTaken or 0), {{data.Fights[Recount.db.profile.CurDataSet].WhoDamaged," "..L["Took Damage From"],DetailTitles.DamagedWho}}
end
function Recount:MergedPetHealingDPS(data, fight)
if not data or not data.Fights or not data.Fights[fight] then
return 0, 0
end
local PetAmount = 0
local PetTime = 0
local Time = data.Fights[fight].TimeHeal or 0
if Recount.db.profile.MergePets and data.Pet then
for v, k in pairs(data.Pet) do
if dbCombatants[k] and dbCombatants[k].Fights and dbCombatants[k].Fights[fight] then
if dbCombatants[k].Fights[fight].Healing and dbCombatants[k].Fights[fight].Healing > 0 then -- Ignore pets which didn't do any healing like non-healing totems or idle pets.
PetAmount = PetAmount + (dbCombatants[k].Fights[fight].Healing or 0)
if (dbCombatants[k].Fights[fight].TimeHeal or 0) > PetTime then
PetTime = dbCombatants[k].Fights[fight].TimeHeal
--PetTime = PetTime + (dbCombatants[k].Fights[fight].TimeHeal or 0)
end
end
end
end
if Time < PetTime then
Time = PetTime
end
end
local healing = data.Fights[fight].Healing or 0
if Recount.db.profile.MergeAbsorbs then
healing = healing + (data.Fights[fight].Absorbs or 0)
end
if Time == 0 then
healing = 0
PetAmount = 0
Time = Epsilon
end
return (healing + PetAmount), (healing + PetAmount) / Time
end
function DataModes:HealingReturner(data, num)
if not data or not data.Fights[Recount.db.profile.CurDataSet] then
return 0, 0
end
local healing, hps = Recount:MergedPetHealingDPS(data, Recount.db.profile.CurDataSet)
if num == 1 then
return healing, hps
--return (data.Fights[Recount.db.profile.CurDataSet].Healing or 0), (data.Fights[Recount.db.profile.CurDataSet].Healing or 0)/((data.Fights[Recount.db.profile.CurDataSet].ActiveTime or 0) + Epsilon)
end
return healing, {{data.Fights[Recount.db.profile.CurDataSet].Heals, L["'s Effective Healing"], DetailTitles.Heals}, {data.Fights[Recount.db.profile.CurDataSet].HealedWho, " "..L["Healed Who"], DetailTitles.HealedWho}, {data.Fights[Recount.db.profile.CurDataSet].OverHeals, L["'s Overhealing"], DetailTitles.OverHeals}, {data.Fights[Recount.db.profile.CurDataSet].TimeHealing, L["'s Time Spent Healing"], DetailTitles.HealTime}}
end
function DataModes:HealingTaken(data, num)
if not data or not data.Fights[Recount.db.profile.CurDataSet] then
return 0
end
if num == 1 then
return (data.Fights[Recount.db.profile.CurDataSet].HealingTaken or 0)
end
return (data.Fights[Recount.db.profile.CurDataSet].HealingTaken or 0), {{data.Fights[Recount.db.profile.CurDataSet].WhoHealed," "..L["was Healed by"], DetailTitles.HealedWho}}
end
function DataModes:OverhealingReturner(data, num)
if not data or not data.Fights[Recount.db.profile.CurDataSet] then
return 0
end
local overhealing = data.Fights[Recount.db.profile.CurDataSet].Overhealing or 0
--local activetime = (data.Fights[Recount.db.profile.CurDataSet].ActiveTime or 0) + Epsilon
--local hps = (math_floor(10 * overhealing / (activetime) + 0.5) / 10)
if num == 1 then
local OverhealPercent = (math_floor(1000 * overhealing / (overhealing + (data.Fights[Recount.db.profile.CurDataSet].Healing or 0) + Epsilon) + 0.5) / 10).."%"
return overhealing, OverhealPercent
end
return overhealing, {{data.Fights[Recount.db.profile.CurDataSet].OverHeals, L["'s Overhealing"], DetailTitles.OverHeals}, {data.Fights[Recount.db.profile.CurDataSet].Heals, L["'s Effective Healing"], DetailTitles.Heals}, {data.Fights[Recount.db.profile.CurDataSet].HealedWho, " "..L["Healed Who"], DetailTitles.HealedWho}}
end
function DataModes:DeathReturner(data, num)
if not data or not data.Fights[Recount.db.profile.CurDataSet] then
return 0
end
if num == 1 then
return (data.Fights[Recount.db.profile.CurDataSet].DeathCount or 0)
end
return (data.Fights[Recount.db.profile.CurDataSet].DeathCount or 0), {{data.DeathLogs, Recount.SetDeathDetails, Recount.SetDeathLogDetails}}
end
function DataModes:DOTReturner(data, num)
if not data or not data.Fights[Recount.db.profile.CurDataSet] then
return 0, 0
end
if num == 1 then
return (data.Fights[Recount.db.profile.CurDataSet].DOT_Time or 0), (data.Fights[Recount.db.profile.CurDataSet].DOT_Time or 0) / ((data.Fights[Recount.db.profile.CurDataSet].ActiveTime or 0) + Epsilon)
end
return (data.Fights[Recount.db.profile.CurDataSet].DOT_Time or 0), {{data.Fights[Recount.db.profile.CurDataSet].DOTs, L["'s DOT Uptime"], DetailTitles.DOTs}}
end
function DataModes:HOTReturner(data, num)
if not data or not data.Fights[Recount.db.profile.CurDataSet] then
return 0, 0
end
if num == 1 then
return (data.Fights[Recount.db.profile.CurDataSet].HOT_Time or 0), (data.Fights[Recount.db.profile.CurDataSet].HOT_Time or 0) / ((data.Fights[Recount.db.profile.CurDataSet].ActiveTime or 0) + Epsilon)
end
return (data.Fights[Recount.db.profile.CurDataSet].HOT_Time or 0), {{data.Fights[Recount.db.profile.CurDataSet].HOTs, L["'s HOT Uptime"], DetailTitles.HOTs}}
end
function DataModes:ActiveTime(data, num)
if not data or not data.Fights[Recount.db.profile.CurDataSet] then
return 0
end
if num == 1 then
return (math_floor((data.Fights[Recount.db.profile.CurDataSet].ActiveTime or 0) * 100) / 100 or 0)
end
return (math_floor((data.Fights[Recount.db.profile.CurDataSet].ActiveTime or 0) * 100) / 100 or 0), {{data.Fights[Recount.db.profile.CurDataSet].TimeSpent, L["'s Time Spent"], DetailTitles.ActiveTime}, {data.Fights[Recount.db.profile.CurDataSet].TimeDamaging, L["'s Time Spent Attacking"], DetailTitles.DamageTime}, {data.Fights[Recount.db.profile.CurDataSet].TimeHealing, L["'s Time Spent Healing"], DetailTitles.HealTime}}
end
function DataModes:Absorbs(data, num)
if not data or not data.Fights[Recount.db.profile.CurDataSet] then
return 0, 0
end
if num == 1 then
return (data.Fights[Recount.db.profile.CurDataSet].Absorbs or 0), (data.Fights[Recount.db.profile.CurDataSet].Absorbs or 0) / ((data.Fights[Recount.db.profile.CurDataSet].ActiveTime or 1) + Epsilon)
else
return (data.Fights[Recount.db.profile.CurDataSet].Absorbs or 0), {{data.Fights[Recount.db.profile.CurDataSet].Absorbed, L["'s Absorbs"], DetailTitles.Absorbed}, {data.Fights[Recount.db.profile.CurDataSet].ShieldedWho, " "..L["Shielded Who"], DetailTitles.ShieldedWho}--[[, {data.Fights[Recount.db.profile.CurDataSet].ShieldDamagedBy, " "..L["Took Damage From"], DetailTitles.ShieldDamagedBy}]]}
end
end
-- Some code for table management from Ace2
local new, del
do
local cache = setmetatable({}, {__mode = "k"})
function new()
local t = next(cache)
if t then
cache[t] = nil
return t
else
return { }
end
end
function del(t)
for k in pairs(t) do
t[k] = nil
end
cache[t] = true
return nil
end
end
local function RecountSortFunc(a, b)
if a[2] > b[2] then
return true
end
return false
end
function Recount:AddSortedTooltipData(title, data, num)
local SortedData = Recount:GetTable()
GameTooltip:AddLine(title, 1, 0.82, 0)
local total = Epsilon
local i = 0
if data then
for k, v in pairs(data) do
if v.amount then
i = i + 1
if not SortedData[i] then
SortedData[i] = Recount:GetTable()
end
SortedData[i][1] = k
SortedData[i][2] = v.amount
total = total + v.amount
end
end
end
if num > i then
num = i
end
table_sort(SortedData, RecountSortFunc)
local percent
for i = 1, num do
if SortedData[i] then
if total ~= 0 then
percent = math_floor(100 * SortedData[i][2] / total)
else
percent = 100
end
local name = SortedData[i][1]
GameTooltip:AddDoubleLine(i..". "..name, Recount:FormatLongNums(SortedData[i][2]).." ("..percent.."%)", 1, 1, 1, 1, 1, 1)
end
end
Recount:FreeTableRecurse(SortedData)
end
-- The various tooltip functions used for each of the main window data displays
local TooltipFuncs = { }
function TooltipFuncs:Damage(name, data)
if data then
GameTooltip:ClearLines()
GameTooltip:AddLine(name)
Recount:AddSortedTooltipData(L["Top 3"].." "..L["Damage Abilities"], data and data.Fights[Recount.db.profile.CurDataSet] and data.Fights[Recount.db.profile.CurDataSet].Attacks, 3)
GameTooltip:AddLine("")
Recount:AddSortedTooltipData(L["Top 3"].." "..L["Attacked"], data and data.Fights[Recount.db.profile.CurDataSet] and data.Fights[Recount.db.profile.CurDataSet].DamagedWho, 3)
if Recount.db.profile.MergePets and data.Pet then
local MaxDamage, MaxPetIndex
for i in pairs(data.Pet) do
local PetDamage = data.Pet[i] and dbCombatants[data.Pet[i]] and dbCombatants[data.Pet[i]] and dbCombatants[data.Pet[i]].Fights and dbCombatants[data.Pet[i]].Fights[Recount.db.profile.CurDataSet] and dbCombatants[data.Pet[i]].Fights[Recount.db.profile.CurDataSet].Damage
if PetDamage and (MaxDamage or 0) <= PetDamage then
MaxDamage = PetDamage
MaxPetIndex = i
end
end
if MaxDamage and MaxDamage ~= 0 then
MaxDamage = MaxDamage / (MaxDamage + (data.Fights[Recount.db.profile.CurDataSet].Damage or 0))
GameTooltip:AddLine(" ")
GameTooltip:AddDoubleLine(L["Pet"]..":", data.Pet[MaxPetIndex].." ("..math_floor(MaxDamage * 100 + 0.5).."%)", nil, nil, nil, 1, 1, 1)
Recount:AddSortedTooltipData(L["Top 3"].." "..L["Pet Damage Abilities"], dbCombatants[data.Pet[MaxPetIndex]].Fights and dbCombatants[data.Pet[MaxPetIndex]].Fights[Recount.db.profile.CurDataSet].Attacks, 3)
GameTooltip:AddLine("")
Recount:AddSortedTooltipData(L["Top 3"].." "..L["Pet Attacked"], dbCombatants[data.Pet[MaxPetIndex]].Fights and dbCombatants[data.Pet[MaxPetIndex]].Fights[Recount.db.profile.CurDataSet].DamagedWho, 3)
end
end
GameTooltip:AddLine("<"..L["Click for more Details"]..">", 0, 0.9, 0)
end
end
function TooltipFuncs:FDamage(name, data)
GameTooltip:ClearLines()
GameTooltip:AddLine(name)
Recount:AddSortedTooltipData(L["Top 3"].." "..L["Friendly Attacks"], data and data.Fights[Recount.db.profile.CurDataSet] and data.Fights[Recount.db.profile.CurDataSet].FAttacks, 3)
GameTooltip:AddLine("")
Recount:AddSortedTooltipData(L["Top 3"].." "..L["Friendly Fired On"], data and data.Fights[Recount.db.profile.CurDataSet] and data.Fights[Recount.db.profile.CurDataSet].FDamagedWho, 3)
GameTooltip:AddLine("<"..L["Click for more Details"]..">", 0, 0.9, 0)
end
function TooltipFuncs:DamageTaken(name, data)
GameTooltip:ClearLines()
GameTooltip:AddLine(name)
Recount:AddSortedTooltipData(L["Top 3"].." "..L["Attacked by"], data and data.Fights[Recount.db.profile.CurDataSet] and data.Fights[Recount.db.profile.CurDataSet].WhoDamaged, 3)
GameTooltip:AddLine("<"..L["Click for more Details"]..">", 0, 0.9, 0)
end
function TooltipFuncs:Healing(name, data)
if data then
GameTooltip:ClearLines()
GameTooltip:AddLine(name)
Recount:AddSortedTooltipData(L["Top 3"].." "..L["Heals"], data and data.Fights[Recount.db.profile.CurDataSet] and data.Fights[Recount.db.profile.CurDataSet].Heals, 3)
GameTooltip:AddLine("")
Recount:AddSortedTooltipData(L["Top 3"].." "..L["Healed"], data and data.Fights[Recount.db.profile.CurDataSet] and data.Fights[Recount.db.profile.CurDataSet].HealedWho, 3)
if Recount.db.profile.MergePets and data.Pet then
local MaxHealing, MaxPetIndex
for i in pairs(data.Pet) do
local PetHealing = data.Pet[i] and dbCombatants[data.Pet[i]] and dbCombatants[data.Pet[i]] and dbCombatants[data.Pet[i]].Fights and dbCombatants[data.Pet[i]].Fights[Recount.db.profile.CurDataSet] and dbCombatants[data.Pet[i]].Fights[Recount.db.profile.CurDataSet].Healing
if PetHealing and (MaxHealing or 0) <= PetHealing then
MaxHealing = PetHealing
MaxPetIndex = i
end
end
if MaxHealing and MaxHealing ~= 0 then
MaxHealing = MaxHealing / (MaxHealing + (data.Fights[Recount.db.profile.CurDataSet].Healing or 0))
GameTooltip:AddLine(" ")
GameTooltip:AddDoubleLine(L["Pet"]..":", data.Pet[MaxPetIndex].." ("..math_floor(MaxHealing * 100 + 0.5).."%)", nil, nil, nil, 1, 1, 1)
Recount:AddSortedTooltipData(L["Top 3"].." "..L["Pet Healing Abilities"], dbCombatants[data.Pet[MaxPetIndex]].Fights and dbCombatants[data.Pet[MaxPetIndex]].Fights[Recount.db.profile.CurDataSet].Heals, 3)
GameTooltip:AddLine("")
Recount:AddSortedTooltipData(L["Top 3"].." "..L["Pet Healed"], dbCombatants[data.Pet[MaxPetIndex]].Fights and dbCombatants[data.Pet[MaxPetIndex]].Fights[Recount.db.profile.CurDataSet].HealedWho, 3)
end
end
GameTooltip:AddLine("<"..L["Click for more Details"]..">", 0, 0.9, 0)
end
end
function TooltipFuncs:HealingTaken(name, data)
GameTooltip:ClearLines()
GameTooltip:AddLine(name)
Recount:AddSortedTooltipData(L["Top 3"].." "..L["Healed By"], data and data.Fights[Recount.db.profile.CurDataSet] and data.Fights[Recount.db.profile.CurDataSet].WhoHealed, 3)
GameTooltip:AddLine("<"..L["Click for more Details"]..">", 0, 0.9, 0)
end
function TooltipFuncs:Overhealing(name, data)
GameTooltip:ClearLines()
GameTooltip:AddLine(name)
Recount:AddSortedTooltipData(L["Top 3"].." "..L["Over Heals"], data and data.Fights[Recount.db.profile.CurDataSet] and data.Fights[Recount.db.profile.CurDataSet].OverHeals, 3)
GameTooltip:AddLine("<"..L["Click for more Details"]..">", 0, 0.9, 0)
end
function TooltipFuncs:DOTs(name, data)
GameTooltip:ClearLines()
GameTooltip:AddLine(name)
Recount:AddSortedTooltipData(L["Top 3"].." "..L["DOTs"], data and data.Fights[Recount.db.profile.CurDataSet] and data.Fights[Recount.db.profile.CurDataSet].DOTs, 3)
GameTooltip:AddLine("<"..L["Click for more Details"]..">", 0, 0.9, 0)
end
function TooltipFuncs:HOTs(name, data)
GameTooltip:ClearLines()
GameTooltip:AddLine(name)
Recount:AddSortedTooltipData(L["Top 3"].." "..L["HOTs"], data and data.Fights[Recount.db.profile.CurDataSet] and data.Fights[Recount.db.profile.CurDataSet].HOTs, 3)
GameTooltip:AddLine("<"..L["Click for more Details"]..">", 0, 0.9, 0)
end
function TooltipFuncs:ActiveTime(name, data)
GameTooltip:ClearLines()
GameTooltip:AddLine(name)
Recount:AddSortedTooltipData(L["Top 3"].." "..L["Attacked/Healed"], data and data.Fights[Recount.db.profile.CurDataSet] and data.Fights[Recount.db.profile.CurDataSet].TimeSpent, 3)
local Heal, Damage
Heal = data and data.Fights[Recount.db.profile.CurDataSet].TimeHeal or 0
Damage = data and data.Fights[Recount.db.profile.CurDataSet].TimeDamage or 0
local Total = Heal + Damage + Epsilon
Heal = 100 * Heal / Total
Damage = 100 * Damage / Total
GameTooltip:AddDoubleLine(L["Time Damaging"]..":", math_floor(Damage + 0.5).."%", nil, nil, nil, 1, 1, 1)
GameTooltip:AddDoubleLine(L["Time Healing"]..":", math_floor(Heal + 0.5).."%", nil, nil, nil, 1, 1, 1)
GameTooltip:AddLine("<"..L["Click for more Details"]..">", 0, 0.9, 0)
end
function TooltipFuncs:DeathCounts(name, data)
GameTooltip:ClearLines()
GameTooltip:AddLine(name)
--GameTooltip:Hide()
end
function TooltipFuncs:Absorbs(name, data)
GameTooltip:ClearLines()
GameTooltip:AddLine(name)
Recount:AddSortedTooltipData(L["Top 3"].." "..L["Absorbs"], data and data.Fights[Recount.db.profile.CurDataSet] and data.Fights[Recount.db.profile.CurDataSet].Absorbed, 3)
GameTooltip:AddLine("")
Recount:AddSortedTooltipData(L["Top 3"].." "..L["Shielded"], data and data.Fights[Recount.db.profile.CurDataSet] and data.Fights[Recount.db.profile.CurDataSet].ShieldedWho, 3)
GameTooltip:AddLine("<"..L["Click for more Details"]..">", 0, 0.9, 0)
end
local MainWindowModes = {
{L["Damage Done"], DataModes.DamageReturner, TooltipFuncs.Damage, nil, {"DAMAGE", L["'s DPS"]}, nil, "Damage"},
{L["DPS"], DataModes.DPSReturner, TooltipFuncs.Damage, nil, {"DAMAGE", L["'s DPS"]}, nil, "Damage"},
{L["Friendly Fire"], DataModes.FriendlyDamageReturner, TooltipFuncs.FDamage},
{L["Damage Taken"], DataModes.DamageTakenReturner, TooltipFuncs.DamageTaken, nil, {"DAMAGETAKEN", L["'s DTPS"]}, nil, "DamageTaken"},
{L["Healing Done"], DataModes.HealingReturner, TooltipFuncs.Healing, nil, {"HEALING", L["'s HPS"]}, nil, "Healing"},
{L["Absorbs"], DataModes.Absorbs, TooltipFuncs.Absorbs, nil, nil, nil, nil},
{L["Healing Taken"], DataModes.HealingTaken, TooltipFuncs.HealingTaken, nil, {"HEALINGTAKEN", L["'s HTPS"]}, nil, "HealingTaken"},
{L["Overhealing Done"], DataModes.OverhealingReturner, TooltipFuncs.Overhealing},
{L["Deaths"], DataModes.DeathReturner, TooltipFuncs.DeathCounts},
{L["DOT Uptime"], DataModes.DOTReturner, TooltipFuncs.DOTs, nil, nil, nil, nil},
{L["HOT Uptime"], DataModes.HOTReturner, TooltipFuncs.HOTs, nil, nil, nil, nil},
{L["Activity"], DataModes.ActiveTime, TooltipFuncs.ActiveTime, nil, nil, nil, nil},
}
function Recount:AddModeTooltip(lname, modefunc, toolfunc, ...)
tinsert(MainWindowModes, {lname, modefunc, toolfunc, ...})
Recount:SetupMainWindow()
end
function Recount:SetupMainWindow()
if Recount.LoadMainWindowData then -- If we add modes early no need to inform the main window, it will get set up later.
if Recount.db.profile.Modules.HealingTaken then
local found
for k, v in pairs(MainWindowModes) do
if MainWindowModes[k][1] == L["Healing Taken"] then
found = true
break
end
end
if not found then
tinsert(MainWindowModes, {L["Healing Taken"], DataModes.HealingTaken, TooltipFuncs.HealingTaken, nil, {"HEALINGTAKEN", L["'s HTPS"]}, nil, "HealingTaken"})
end
else
for k, v in pairs(MainWindowModes) do
if MainWindowModes[k][1] == L["Healing Taken"] then
MainWindowModes[k] = nil
end
end
end
if Recount.db.profile.Modules.OverhealingDone then
local found
for k, v in pairs(MainWindowModes) do
if MainWindowModes[k][1] == L["Overhealing Done"] then
found = true
break
end
end
if not found then
tinsert(MainWindowModes, {L["Overhealing Done"], DataModes.OverhealingReturner, TooltipFuncs.Overhealing})
end
else
for k, v in pairs(MainWindowModes) do
if MainWindowModes[k][1] == L["Overhealing Done"] then
MainWindowModes[k] = nil
end
end
end
if Recount.db.profile.Modules.Deaths then
local found
for k, v in pairs(MainWindowModes) do
if MainWindowModes[k][1] == L["Deaths"] then
found = true
break
end
end
if not found then
tinsert(MainWindowModes, {L["Deaths"], DataModes.DeathReturner, TooltipFuncs.DeathCounts})
end
else
for k, v in pairs(MainWindowModes) do
if MainWindowModes[k][1] == L["Deaths"] then
MainWindowModes[k] = nil
end
end
end
if Recount.db.profile.Modules.DOTUptime then
local found
for k, v in pairs(MainWindowModes) do
if MainWindowModes[k][1] == L["DOT Uptime"] then
found = true
break
end
end
if not found then
tinsert(MainWindowModes, {L["DOT Uptime"], DataModes.DOTReturner, TooltipFuncs.DOTs, nil, nil, nil, nil})
end
else
for k, v in pairs(MainWindowModes) do
if MainWindowModes[k][1] == L["DOT Uptime"] then
MainWindowModes[k] = nil
end
end
end
if Recount.db.profile.Modules.HOTUptime then
local found
for k, v in pairs(MainWindowModes) do
if MainWindowModes[k][1] == L["HOT Uptime"] then
found = true
break
end
end
if not found then
tinsert(MainWindowModes, {L["HOT Uptime"], DataModes.HOTReturner, TooltipFuncs.HOTs, nil, nil, nil, nil})
end
else
for k, v in pairs(MainWindowModes) do
if MainWindowModes[k][1] == L["HOT Uptime"] then
MainWindowModes[k] = nil
end
end
end
if Recount.db.profile.Modules.Activity then
local found
for k, v in pairs(MainWindowModes) do
if MainWindowModes[k][1] == L["Activity"] then
found = true
break
end
end
if not found then
tinsert(MainWindowModes, {L["Activity"], DataModes.ActiveTime, TooltipFuncs.ActiveTime, nil, nil, nil, nil})
end
else
for k, v in pairs(MainWindowModes) do
if MainWindowModes[k][1] == L["Activity"] then
MainWindowModes[k] = nil
end
end
end
for i = 1, #MainWindowModes do
if MainWindowModes[i] == nil then
local x = i + 1
for k = x, #MainWindowModes do
MainWindowModes[k - 1] = MainWindowModes[k]
if k == #MainWindowModes then
MainWindowModes[k] = nil
end
end
end
end
Recount:LoadMainWindowData(MainWindowModes)
end
end
function Recount:SetMainWindowModeByLabel(label)
for k, v in pairs(Recount.MainWindowData) do
if v[1] == L[label] then
Recount:SetMainWindowMode(k)
return
end
end
end
local oldlocalizer = Recount.LocalizeCombatants
function Recount.LocalizeCombatants()
dbCombatants = Recount.db2.combatants
oldlocalizer()
end