-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMizusRaidTracker.lua
More file actions
2146 lines (2050 loc) · 97.3 KB
/
MizusRaidTracker.lua
File metadata and controls
2146 lines (2050 loc) · 97.3 KB
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
-- ********************************************************
-- ** Mizus RaidTracker - Core **
-- ** <http://cosmocanyon.de> **
-- ********************************************************
--
-- This addon is written and copyrighted by:
-- * Mîzukichan @ EU-Antonidas (2010-2021)
--
-- Contributors:
-- * Kevin (HTML-Export) (2010)
-- * Knoxa (various MoP fixes) (2013)
-- * Kravval (various MoP fixes, enhancements to boss kill detection) (2013)
-- * kjellt77 (base for tracking support while being solo or in a group) (2019)
-- * MrFIXIT (various fixes for Classic and TBC-classic) (2021)
-- * saberboi (JSON-Export) (2021)
-- * sbaydush (Onslaught Loot List Export) (2021)
--
-- This file is part of Mizus RaidTracker.
--
-- Mizus RaidTracker is free software: you can redistribute it and/or
-- modify it under the terms of the GNU General Public License as
-- published by the Free Software Foundation, either version 3 of the
-- License, or (at your option) any later version.
--
-- Mizus RaidTracker is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with Mizus RaidTracker.
-- If not, see <http://www.gnu.org/licenses/>.
-- Check for addon table
if (not MizusRaidTracker) then MizusRaidTracker = {}; end
local mrt = MizusRaidTracker
local _L = MizusRaidTracker._L
local _O = MRT_Options
-------------------------------
-- Globals/Default Options --
-------------------------------
MRT_ADDON_TITLE = GetAddOnMetadata("MizusRaidTracker", "Title");
MRT_ADDON_VERSION = GetAddOnMetadata("MizusRaidTracker", "Version");
--[===[@debug@
MRT_ADDON_VERSION = "v0.91.0"
--@end-debug@]===]
MRT_NumOfCurrentRaid = nil;
MRT_NumOfLastBoss = nil;
MRT_Options = {};
MRT_RaidLog = {};
MRT_PlayerDB = {};
MRT_ArrayBossID = {};
MRT_ArrayBosslast = nil;
local MRT_Defaults = {
["Options"] = {
["DB_Version"] = 4,
["General_MasterEnable"] = true, -- AddonEnable: true / nil
["General_OptionsVersion"] = 20, -- OptionsVersion - Counter, which increases after a new option has been added - if new option is added, then increase counter and add to update options function
["General_DebugEnabled"] = false, --
["General_SlashCmdHandler"] = "mrt", --
["General_PrunnRaidLog"] = false, -- Prunning - shall old be deleted after a certain amount of time
["General_PrunningTime"] = 90, -- Prunning time, after log shall be deleted (days)
["General_ShowMinimapIcon"] = false, --
["Attendance_GuildAttendanceCheckEnabled"] = false, --
["Attendance_GuildAttendanceCheckNoAuto"] = true, --
["Attendance_GuildAttendanceCheckUseTrigger"] = false,
["Attendance_GuildAttendanceCheckTrigger"] = "!triggerexample",
["Attendance_GuildAttendanceCheckDuration"] = 3, -- in minutes - 0..5
["Attendance_GuildAttendanceUseCustomText"] = false,
["Attendance_GuildAttendanceCustomText"] = MRT_GA_TEXT_CHARNAME_BOSS,
["Attendance_GroupRestriction"] = false, -- if true, track only first 2/5 groups in 10/25 player raids
["Attendance_TrackOffline"] = true, -- if true, track offline players
["Tracking_LogWhileSolo"] = false, -- Track raids while being solo: true / nil
["Tracking_LogWhileGroup"] = false, -- Track raids while being in a group (and not in a raid): true / nil
["Tracking_Log10MenRaids"] = true, -- Track 10 player raids: true / nil (pre WoD-Raids)
["Tracking_Log25MenRaids"] = true, -- Track 25 player raids: true / nil (pre WoD-Raids)
["Tracking_LogLFRRaids"] = true, -- Track LFR raids: true / nil (any)
["Tracking_LogNormalRaids"] = true, -- Track Normal raids (WoD+)
["Tracking_LogHeroicRaids"] = true, -- Track Heroic raids (WoD+)
["Tracking_LogMythicRaids"] = true, -- Track Mythic raids (WoD+)
["Tracking_LogAVRaids"] = false, -- Track PvP raids: true / nil
["Tracking_LogClassicRaids"] = false, -- Track classic raids: true / nil
["Tracking_LogBCRaids"] = false, -- Track BC raid true / nil
["Tracking_LogWotLKRaids"] = false, -- Track WotLK raid: true / nil
["Tracking_LogCataclysmRaids"] = false, -- Track Catacylsm raid: true / nil
["Tracking_LogMoPRaids"] = false, -- Track MoP raid: true / nil
["Tracking_LogWarlordsRaids"] = false, -- Track Warlords of Draenor raid: true / nil
["Tracking_LogLootModePersonal"] = true,
["Tracking_AskForDKPValue"] = true, --
["Tracking_AskForDKPValuePersonal"] = true, -- ask for points cost when in personal loot mode true/nil - not used when generic option is off
["Tracking_MinItemQualityToLog"] = 4, -- 0:poor, 1:common, 2:uncommon, 3:rare, 4:epic, 5:legendary, 6:artifact
["Tracking_MinItemQualityToGetDKPValue"] = 4, -- 0:poor, 1:common, 2:uncommon, 3:rare, 4:epic, 5:legendary, 6:artifact
["Tracking_AskCostAutoFocus"] = 2, -- 1: always AutoFocus, 2: when not in combat, 3: never
["Tracking_CreateNewRaidOnNewZone"] = true,
["Tracking_OnlyTrackItemsAboveILvl"] = 0,
["Tracking_UseServerTime"] = false,
["ItemTracking_IgnoreEnchantingMats"] = true,
["ItemTracking_IgnoreGems"] = true,
["ItemTracking_IgnoreStacks"] = true,
["ItemTracking_UseEPGPValues"] = false,
["Export_ExportFormat"] = 2, -- 1: CTRT compatible, 2: EQdkp-Plus XML, 3: MLdkp 1.5, 4: plain text, 5: BBCode, 6: BBCode with wowhead, 7: CSS based HTML
["Export_ExportEnglish"] = false, -- If activated, zone and boss names will be exported in english
["Export_CTRT_AddPoorItem"] = false, -- Add a poor item as loot to each boss - Fixes encounter detection for CTRT-Import for EQDKP: true / nil
["Export_CTRT_IgnorePerBossAttendance"] = false, -- This will create an export where each raid member has 100% attendance: true / nil
["Export_CTRT_RLIPerBossAttendanceFix"] = false,
["Export_EQDKP_RLIPerBossAttendanceFix"] = false,
["Export_DateTimeFormat"] = "%m/%d/%Y", -- lua date syntax - http://www.lua.org/pil/22.1.html
["Export_Currency"] = "DKP",
["MiniMap_SV"] = { -- Saved Variables for LibDBIcon
hide = true,
},
},
};
--------------
-- Locals --
--------------
MRT_DELAY_FIRST_RAID_ENTRY_FOR_RLI_BOSSATTENDANCE_FIX_DATA = 60;
local deformat = LibStub("LibDeformat-3.0");
local LDB = LibStub("LibDataBroker-1.1");
local LDBIcon = LibStub("LibDBIcon-1.0");
local LDialog = LibStub("LibDialog-1.0");
local LBB = LibStub("LibBabble-Boss-3.0");
local LBBL = LBB:GetUnstrictLookupTable();
local LibGP = LibStub("LibGearPoints-1.2-MRT");
local ScrollingTable = LibStub("ScrollingTable");
local tinsert = tinsert;
local pairs = pairs;
local ipairs = ipairs;
local MRT_TimerFrame = CreateFrame("Frame"); -- Timer for Guild-Attendance-Checks
local MRT_LoginTimer = CreateFrame("Frame"); -- Timer for Login (Wait 10 secs after Login - then check Raidstatus)
local MRT_RaidRosterScanTimer = CreateFrame("Frame"); -- Timer for regular scanning for the raid roster (there is no event for disconnecting players)
local MRT_RIWTimer = CreateFrame("Frame");
local MRT_GuildRoster = {};
local MRT_GuildRosterInitialUpdateDone = nil;
local MRT_GuildRosterUpdating = nil;
local MRT_AskCostQueue = {};
local MRT_AskCostQueueRunning = nil;
local MRT_UnknownRelogStatus = true;
local _, _, _, uiVersion = GetBuildInfo();
-- Vars for API
local MRT_ExternalItemCostHandler = {
func = nil,
suppressDialog = nil,
addonName = nil,
};
local MRT_ExternalLootNotifier = {};
-- Table definition for the drop down menu for the DKPFrame
local MRT_DKPFrame_DropDownTableColDef = {
{["name"] = "", ["width"] = 100},
};
-- Table for boss yells
-- ToDo: Check if win encounter events in old instances (WotLK and others) are fixed and replace yells with encounter IDs
for k, v in pairs(_L.yells) do
MRT_L.Bossyells[k] = {}
for k2, v2 in pairs(v) do
if (k2 == "Icecrown Gunship Battle Alliance") or (k2 == "Icecrown Gunship Battle Horde") then k2 = "Icecrown Gunship Battle"; end
MRT_L.Bossyells[k][v2] = k2
end
end
----------------------
-- RegisterEvents --
----------------------
function MRT_MainFrame_OnLoad(frame)
frame:RegisterEvent("ADDON_LOADED");
frame:RegisterEvent("BOSS_KILL");
frame:RegisterEvent("CHAT_MSG_LOOT");
frame:RegisterEvent("CHAT_MSG_WHISPER");
--frame:RegisterEvent("CHAT_MSG_MONSTER_YELL");
--frame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED");
frame:RegisterEvent("ENCOUNTER_END");
frame:RegisterEvent("PARTY_INVITE_REQUEST");
frame:RegisterEvent("PARTY_LOOT_METHOD_CHANGED");
frame:RegisterEvent("PLAYER_ENTERING_WORLD");
frame:RegisterEvent("PLAYER_REGEN_DISABLED");
frame:RegisterEvent("RAID_INSTANCE_WELCOME");
frame:RegisterEvent("RAID_ROSTER_UPDATE");
frame:RegisterEvent("ZONE_CHANGED_NEW_AREA");
end
-------------------------
-- Handler functions --
-------------------------
-- Event handler
function MRT_OnEvent(frame, event, ...)
if (event == "ADDON_LOADED") then
local addonName = ...;
if (addonName == "MizusRaidTracker") then
MRT_Debug("Initializing MRT...");
frame:UnregisterEvent("ADDON_LOADED");
MRT_Initialize(frame);
end
elseif (event == "BOSS_KILL") then
local encounterID, name = ...
MRT_Debug("BOSS_KILL fired! encounterID="..encounterID..", name="..name);
if (not MRT_Options["General_MasterEnable"]) then return end;
mrt:BossKillHandler(encounterID, name);
elseif (event == "CHAT_MSG_LOOT") then
if (MRT_NumOfCurrentRaid) then
MRT_AutoAddLoot(...);
end
elseif (event == "CHAT_MSG_WHISPER") then
if (not MRT_TimerFrame.GARunning) then return false; end
local msg, from = ...;
if ( MRT_Options["Attendance_GuildAttendanceCheckUseTrigger"] and (MRT_Options["Attendance_GuildAttendanceCheckTrigger"] == msg) ) then
MRT_Debug("Received valid trigger message from '"..from.."'");
MRT_GuildAttendanceWhisper(from, from);
elseif (not MRT_Options["Attendance_GuildAttendanceCheckUseTrigger"]) then
local player = MRT_GuildRoster[string.lower(msg)];
if (not player) then
MRT_Debug("Message does not match to a player name in MRT_GuildRoster. - Message from: "..from.." - Message: "..msg);
return;
end
MRT_GuildAttendanceWhisper(player, from);
end
elseif (event == "CHAT_MSG_MONSTER_YELL") then
if (not MRT_Options["General_MasterEnable"]) then return end;
if (not MRT_NumOfCurrentRaid) then return; end
local monsteryell, sourceName = ...;
-- local localInstanceInfoName, instanceInfoType, diffID, diffDesc, maxPlayers, _, _, areaID, iniGroupSize = MRT_GetInstanceInfo();
local areaID = GetCurrentMapAreaID();
if (not areaID) then return; end
if (MRT_L.Bossyells[areaID] and MRT_L.Bossyells[areaID][monsteryell]) then
MRT_Debug("NPC Yell from Bossyelllist detected. Source was "..sourceName);
local bossName = LBBL[MRT_L.Bossyells[areaID][monsteryell]] or MRT_L.Bossyells[areaID][monsteryell];
local NPCID = MRT_ReverseBossIDList[MRT_L.Bossyells[areaID][monsteryell]];
MRT_AddBosskill(bossName, nil, NPCID);
end
elseif (event == "COMBAT_LOG_EVENT_UNFILTERED") then
if (not MRT_Options["General_MasterEnable"]) then return end;
MRT_CombatLogHandler(...);
elseif (event == "ENCOUNTER_END") then
local encounterID, name, difficulty, size, success = ...
MRT_Debug("ENCOUNTER_END fired! encounterID="..encounterID..", name="..name..", difficulty="..difficulty..", size="..size..", success="..success)
if (not MRT_Options["General_MasterEnable"]) then return end;
-- MRT_EncounterEndHandler(encounterID, name, difficulty, size, success);
elseif (event == "ENCOUNTER_START") then
local encounterID, name, difficulty, size = ...
MRT_Debug("ENCOUNTER_START fired! encounterID="..encounterID..", name="..name..", difficulty="..difficulty..", size="..size)
elseif (event == "GUILD_ROSTER_UPDATE") then
MRT_GuildRosterUpdate(frame, event, ...);
elseif (event == "PARTY_INVITE_REQUEST") then
MRT_Debug("PARTY_INVITE_REQUEST fired!");
if (MRT_UnknownRelogStatus) then
MRT_UnknownRelogStatus = false;
MRT_EndActiveRaid();
end
elseif (event == "PLAYER_ENTERING_WORLD") then
frame:UnregisterEvent("PLAYER_ENTERING_WORLD");
MRT_LoginTimer.loginTime = time();
-- Delay data gathering a bit to make sure, that data is available after login
-- aka: ugly Dalaran latency fix - this is the part, which needs rework
MRT_LoginTimer:SetScript("OnUpdate", function (self)
if ((time() - self.loginTime) > 5) then
if (not MRT_GuildRosterInitialUpdateDone) then
MRT_GuildRosterUpdate(frame, nil, true);
end
MRT_GuildRosterInitialUpdateDone = true;
end
if ((time() - self.loginTime) > 15) then
MRT_Debug("Relog Timer: 15 seconds threshold reached...");
self:SetScript("OnUpdate", nil);
if (MRT_UnknownRelogStatus) then MRT_CheckRaidStatusAfterLogin(); end
MRT_UnknownRelogStatus = false;
end
end);
elseif (event == "PARTY_LOOT_METHOD_CHANGED") then
MRT_Debug("Event PARTY_LOOT_METHOD_CHANGED fired.");
if (not MRT_Options["General_MasterEnable"]) then
MRT_Debug("MRT seems to be disabled. Ignoring Event.");
return;
end;
MRT_CheckZoneAndSizeStatus();
elseif (event == "RAID_ROSTER_UPDATE") then
MRT_Debug("RAID_ROSTER_UPDATE fired!");
if (MRT_UnknownRelogStatus) then
MRT_UnknownRelogStatus = false;
MRT_CheckRaidStatusAfterLogin();
end
MRT_RaidRosterUpdate(frame);
elseif (event == "ZONE_CHANGED_NEW_AREA") then
MRT_Debug("Event ZONE_CHANGED_NEW_AREA fired.");
if (not MRT_Options["General_MasterEnable"]) then
MRT_Debug("MRT seems to be disabled. Ignoring Event.");
return;
end;
-- The WoW-Client randomly returns wrong zone information directly after a zone change for a relatively long period of time.
-- Use the DBM approach: wait 10 seconds after RIW-Event and then check instanceInfo stuff. Hopefully this fixes the problem....
-- A generic function to schedule functions would be nice! <- FIXME!
MRT_Debug("Setting up instance check timer - raid status will be checked in 10 seconds.");
MRT_RIWTimer.riwTime = time();
MRT_RIWTimer:SetScript("OnUpdate", function (self)
if ((time() - self.riwTime) > 10) then
self:SetScript("OnUpdate", nil);
MRT_CheckZoneAndSizeStatus();
end
end);
elseif(event == "PLAYER_REGEN_DISABLED") then
wipe(MRT_ArrayBossID)
--MRT_Debug("Tabelle gelöscht");
end
end
function MRT_PrintGR()
local concatTable = "";
for key, val in pairs(MRT_GuildRoster) do
concatTable = concatTable..val..", ";
end
MRT_Debug(concatTable);
end
-- Combatlog handler
function MRT_CombatLogHandler(...)
local _, combatEvent, _, _, _, _, _, destGUID, destName, _, _, spellID = ...;
if (not MRT_NumOfCurrentRaid) then return; end
if (combatEvent == "UNIT_DIED") then
local englishBossName;
local localBossName = destName;
local NPCID = MRT_GetNPCID(destGUID);
--MRT_Debug("localBossName: "..localBossName.." - NPCID: "..NPCID);
if (MRT_BossIDList[NPCID]) then
MRT_Debug("Valid NPCID found... - Match on "..MRT_BossIDList[NPCID]);
localBossName = LBBL[MRT_BossIDList[NPCID]] or MRT_BossIDList[NPCID];
if(MRT_ArrayBossIDList[MRT_BossIDList[NPCID]]) then
local count = 0;
local bosses = getn(MRT_ArrayBossIDList[MRT_BossIDList[NPCID]]);
MRT_ArrayBossID[NPCID] = NPCID;
MRT_Debug("Tabelle erweitert um "..NPCID);
for key, val in pairs(MRT_ArrayBossID) do
if(tContains(MRT_ArrayBossIDList[MRT_BossIDList[NPCID]], val)) then
count = count +1;
end
end
if (bosses == count) then
if (MRT_ArrayBosslast ~= localBossName) then
MRT_AddBosskill(localBossName, nil, NPCID);
end
end
else
MRT_AddBosskill(localBossName, nil, NPCID);
end
end
end
if (combatEvent == "SPELL_CAST_SUCCESS") then
-- MRT_Debug("SPELL_CAST_SUCCESS event found - SpellID is " .. spellID);
end
if (combatEvent == "SPELL_CAST_SUCCESS" and MRT_BossSpellIDTriggerList[spellID]) then
MRT_Debug("Matching SpellID in trigger list found - Processing...");
-- Get NPCID provided by the constants file
local NPCID = MRT_BossSpellIDTriggerList[spellID][2]
-- Get localized boss name, if available - else use english one supplied in the constants file
local localBossName = LBBL[MRT_BossSpellIDTriggerList[spellID][1]] or MRT_BossSpellIDTriggerList[spellID][1];
MRT_AddBosskill(localBossName, nil, NPCID);
end
end
function MRT_EncounterEndHandler(encounterID, name, difficulty, size, success)
if (not MRT_NumOfCurrentRaid) then return; end
if ((success == 1) and (MRT_EncounterIDList[encounterID])) then
MRT_Debug("Valid encounterID found... - Match on "..MRT_EncounterIDList[encounterID]);
MRT_AddBosskill(name, nil, MRT_EncounterIDList[encounterID]);
end
end
function mrt:BossKillHandler(encounterID, name)
if (not MRT_NumOfCurrentRaid) then return; end
if (MRT_EncounterIDList[encounterID]) then
-- Looks like classic is missing the localized name (or encounter name in general)
if (mrt.isClassic and (not name or name == "" or name == " ")) then
if (mrt.encounterNameList[encounterID]) then
name = LBBL[mrt.encounterNameList[encounterID]] or mrt.encounterNameList[encounterID];
else
name = "Unknown encounter";
end
end
MRT_Debug("Valid encounterID found... - Match on "..MRT_EncounterIDList[encounterID]);
MRT_AddBosskill(name, nil, MRT_EncounterIDList[encounterID]);
end
end
-- Slashcommand handler
function MRT_SlashCmdHandler(msg)
local msg_lower = string.lower(msg);
if (msg_lower == 'options' or msg_lower == 'o') then
InterfaceOptionsFrame_OpenToCategory("Mizus RaidTracker");
return;
elseif (msg_lower == 'dkpcheck') then
MRT_AddBosskill(MRT_L.Core["GuildAttendanceBossEntry"]);
MRT_StartGuildAttendanceCheck("_attendancecheck_");
return;
elseif (msg_lower == 'deleteall now') then
MRT_DeleteRaidLog();
return;
elseif (msg_lower == 'snapshot') then
MRT_TakeSnapshot();
return;
elseif (msg_lower == '') then
MRT_GUI_Toggle();
return;
elseif (msg_lower == 'dkpframe') then
if (MRT_GetDKPValueFrame:IsShown()) then
MRT_GetDKPValueFrame:Hide();
else
MRT_GetDKPValueFrame:Show();
end
return;
elseif (string.match(msg, 'additem')) then
local itemLink, looter, cost = string.match(msg, 'additem%s+(|c.+|r)%s+(%a+)%s+(%d*)');
if (not itemLink) then
itemLink, looter = string.match(msg, 'additem%s+(|c.+|r)%s+(%a+)');
cost = 0;
end
if (itemLink) then
MRT_ManualAddLoot(itemLink, looter, cost);
return;
end
end
local slashCmd = '/'..MRT_Options.General_SlashCmdHandler;
MRT_Print("Slash commands:");
MRT_Print("'"..slashCmd.."' opens the raid log broser.");
MRT_Print("'"..slashCmd.." options' opens the options menu.");
MRT_Print("'"..slashCmd.." dkpcheck' creates a new boss entry and starts an attendance check.");
MRT_Print("'"..slashCmd.." additem <ItemLink> <Looter> [<Costs>]' adds an item to the last boss kill.");
MRT_Print("Example: "..slashCmd.." additem \124cffffffff\124Hitem:6948:0:0:0:0:0:0:0:0\124h[Hearthstone]\124h\124r Mizukichan 10");
MRT_Print("'"..slashCmd.." snapshot' creates a snapshot of the current raid composition.");
MRT_Print("'"..slashCmd.." deleteall now' deletes the complete raid log. USE WITH CAUTION!");
end
-- Chat handler
-- These will filter out incoming messages handled by MRT for the user in order to avoid message spam
-- This should probably be optional.
local MRT_ChatHandler = {};
function MRT_ChatHandler:CHAT_MSG_WHISPER_Filter(event, msg, from, ...)
if (not MRT_TimerFrame.GARunning) then return false; end
if ( MRT_Options["Attendance_GuildAttendanceCheckUseTrigger"] and (MRT_Options["Attendance_GuildAttendanceCheckTrigger"] == msg) ) then
MRT_Debug("Message filtered... - Msg was '"..msg.."' from '"..from.."'");
return true;
elseif (not MRT_Options["Attendance_GuildAttendanceCheckUseTrigger"]) then
local player = MRT_GuildRoster[string.lower(msg)];
if (not player) then return false; end
MRT_Debug("Message filtered... - Msg was '"..msg.."' from '"..from.."'");
return true;
end
return false;
end
function MRT_ChatHandler:CHAT_MSG_WHISPER_INFORM_FILTER(event, msg, from, ...)
if (not MRT_TimerFrame.GARunning) then return false; end
if (msg == MRT_ChatHandler.MsgToBlock) then
MRT_Debug("Message filtered... - Msg was '"..msg.."' from '"..from.."'");
return true;
end
return false;
end
ChatFrame_AddMessageEventFilter("CHAT_MSG_WHISPER", MRT_ChatHandler.CHAT_MSG_WHISPER_Filter);
ChatFrame_AddMessageEventFilter("CHAT_MSG_WHISPER_INFORM", MRT_ChatHandler.CHAT_MSG_WHISPER_INFORM_FILTER);
-- Called when a player was awarded loot by the master looter, should only be called if the player is the active master looter as hooked function
-- Data for GetLootSlotInfo is still available, although the items itself was distributed at that time
function MRT_Hook_GiveMasterLoot(slot, index)
-- Do nothing if no active raid
if (not MRT_NumOfCurrentRaid) then return; end
-- Check required input
if (not slot) then return; end
if (not index) then return; end
MRT_Debug("MRT_Hook_GiveMasterLoot called - Slot="..slot.." - Index="..index);
-- local _, lootName, lootQuantity, lootQuality, locked, isQuestItem, questID, isActive = GetLootSlotInfo(slot);
local itemLink = GetLootSlotLink(slot);
if (not itemLink) then
MRT_Debug("No item found for given index.");
return;
else
MRT_Debug("Itemlink: "..itemLink);
end
-- GetMasterLootCandidate() - This doesn't seem return anything?!?
-- Available documentation outdated - blizz UI calls: GetMasterLootCandidate(LootFrame.selectedSlot, i)
local candidate = GetMasterLootCandidate(slot, index);
if (not candidate) then
MRT_Debug("No candidate returned...");
return;
else
MRT_Debug("Candidate: "..candidate);
end
-- At this point, we should have valid loot information
MRT_AutoAddLootItem(candidate, itemLink, 1);
end
hooksecurefunc("GiveMasterLoot", MRT_Hook_GiveMasterLoot);
------------------
-- Initialize --
------------------
function MRT_Initialize(frame)
-- Detect game version
mrt.isRetail = (_G.WOW_PROJECT_ID == _G.WOW_PROJECT_MAINLINE);
mrt.isClassic = (_G.WOW_PROJECT_ID == _G.WOW_PROJECT_CLASSIC);
mrt.isBCC = (_G.WOW_PROJECT_ID == _G.WOW_PROJECT_BURNING_CRUSADE_CLASSIC);
mrt.isWrath = (_G.WOW_PROJECT_ID == _G.WOW_PROJECT_WRATH_CLASSIC);
-- Update settings and DB
MRT_UpdateSavedOptions();
MRT_VersionUpdate();
-- Maintenance
MRT_PeriodicMaintenance();
-- Parse localization
MRT_Options_ParseValues();
MRT_GUI_ParseValues();
MRT_Core_Frames_ParseLocal();
-- set up slash command
if (MRT_Options["General_SlashCmdHandler"] and MRT_Options["General_SlashCmdHandler"] ~= "") then
SLASH_MIZUSRAIDTRACKER1 = "/"..MRT_Options["General_SlashCmdHandler"];
SlashCmdList["MIZUSRAIDTRACKER"] = function(msg) MRT_SlashCmdHandler(msg); end
end
-- set up LDB data source
MRT_LDB_DS = LDB:NewDataObject("Mizus RaidTracker", {
icon = "Interface\\AddOns\\MizusRaidTracker\\icons\\icon_disabled",
label = MRT_ADDON_TITLE,
text = "MRT",
type = "data source",
OnClick = function(self, button)
if (button == "LeftButton") then
MRT_GUI_Toggle();
elseif (button == "RightButton") then
InterfaceOptionsFrame_OpenToCategory("Mizus RaidTracker");
C_Timer.After(0.5, function() InterfaceOptionsFrame_OpenToCategory("Mizus RaidTracker"); end)
end
end,
OnTooltipShow = function(tooltip)
tooltip:AddLine(MRT_ADDON_TITLE);
tooltip:AddLine(" ");
tooltip:AddLine(MRT_L.Core["LDB Left-click to toggle the raidlog browser"]);
tooltip:AddLine(MRT_L.Core["LDB Right-click to open the options menu"]);
end,
});
-- set up minimap icon
LDBIcon:Register("Mizus RaidTracker", MRT_LDB_DS, MRT_Options["MiniMap_SV"]);
-- set up drop down menu for the DKPFrame
MRT_DKPFrame_DropDownTable = ScrollingTable:CreateST(MRT_DKPFrame_DropDownTableColDef, 9, nil, nil, MRT_GetDKPValueFrame);
MRT_DKPFrame_DropDownTable.head:SetHeight(1);
MRT_DKPFrame_DropDownTable.frame:SetFrameLevel(3);
MRT_DKPFrame_DropDownTable.frame:Hide();
MRT_DKPFrame_DropDownTable:EnableSelection(false);
MRT_DKPFrame_DropDownTable:RegisterEvents({
["OnClick"] = function (rowFrame, cellFrame, data, cols, row, realrow, column, scrollingTable, ...)
if (not realrow) then return true; end
local playerName = MRT_DKPFrame_DropDownTable:GetCell(realrow, column);
if (playerName) then
MRT_GetDKPValueFrame.Looter = playerName;
MRT_GetDKPValueFrame_TextThirdLine:SetText(string.format(MRT_L.Core.DKP_Frame_LootetBy, playerName));
MRT_GetDKPValueFrame_DropDownList_Toggle();
end
return true;
end
});
MRT_DKPFrame_DropDownTable.head:SetHeight(1);
-- check for open raids
if (not MRT_NumOfCurrentRaid) then
MRT_UnknownRelogStatus = false;
end
-- update version number in saved vars
MRT_Options["General_Version"] = MRT_ADDON_VERSION;
MRT_Options["General_ClientLocale"] = GetLocale();
-- Finish
MRT_Debug("Addon loaded.");
end
----------------------
-- Apply Defaults --
----------------------
-- Check variables - if missing, load defaults
function MRT_UpdateSavedOptions()
if not MRT_Options["General_OptionsVersion"] then
MRT_Debug("Setting Options to default values...");
for key, value in pairs(MRT_Defaults["Options"]) do
if (MRT_Options[key] == nil) then
MRT_Options[key] = value;
end
end
-- Default Options for WoW Classic - changes from retail default
if (mrt.isClassic) then
MRT_Options["Tracking_LogClassicRaids"] = true;
elseif (mrt.isBCC) then
MRT_Options["Tracking_LogBCRaids"] = true;
elseif (mrt.isWrath) then
MRT_Options["Tracking_LogWotLKRaids"] = true;
end
end
if MRT_Options["General_OptionsVersion"] == 1 then
MRT_Options["Tracking_CreateNewRaidOnNewZone"] = true;
MRT_Options["General_OptionsVersion"] = 2;
end
if MRT_Options["General_OptionsVersion"] == 2 then
if (MRT_Options["Export_ExportFormat"] > 1) then
MRT_Options["Export_ExportFormat"] = MRT_Options["Export_ExportFormat"] + 1;
end
MRT_Options["General_OptionsVersion"] = 3;
end
if MRT_Options["General_OptionsVersion"] == 3 then
if (MRT_Options["Export_ExportFormat"] > 2) then
MRT_Options["Export_ExportFormat"] = MRT_Options["Export_ExportFormat"] + 1;
end
MRT_Options["General_OptionsVersion"] = 4;
end
if MRT_Options["General_OptionsVersion"] == 4 then
MRT_Options["Tracking_OnlyTrackItemsAboveILvl"] = 0;
MRT_Options["General_OptionsVersion"] = 5;
end
if MRT_Options["General_OptionsVersion"] == 5 then
MRT_Options["Attendance_GuildAttendanceCheckUseTrigger"] = false;
MRT_Options["Attendance_GuildAttendanceCheckTrigger"] = "!triggerexample";
MRT_Options["General_OptionsVersion"] = 6;
end
if MRT_Options["General_OptionsVersion"] == 6 then
MRT_Options["General_PrunnRaidLog"] = false;
MRT_Options["General_PrunningTime"] = 90;
MRT_Options["Tracking_AskCostAutoFocus"] = 1;
MRT_Options["Export_ExportEnglish"] = false;
MRT_Options["General_OptionsVersion"] = 7;
end
if MRT_Options["General_OptionsVersion"] == 7 then
MRT_Options["General_ShowMinimapIcon"] = false;
MRT_Options["MiniMap_SV"] = {
hide = true,
};
MRT_Options["General_OptionsVersion"] = 8;
end
if MRT_Options["General_OptionsVersion"] == 8 then
if (MRT_Options["Export_ExportFormat"] > 3) then
MRT_Options["Export_ExportFormat"] = MRT_Options["Export_ExportFormat"] + 1;
end
MRT_Options["General_OptionsVersion"] = 9;
end
if MRT_Options["General_OptionsVersion"] == 9 then
MRT_Options["Attendance_GuildAttendanceUseCustomText"] = false;
MRT_Options["Attendance_GuildAttendanceCustomText"] = MRT_GA_TEXT_CHARNAME_BOSS;
MRT_Options["General_OptionsVersion"] = 10;
end
if MRT_Options["General_OptionsVersion"] == 10 then
MRT_Options["ItemTracking_IgnoreEnchantingMats"] = true;
MRT_Options["ItemTracking_IgnoreGems"] = true;
MRT_Options["General_OptionsVersion"] = 11;
end
if MRT_Options["General_OptionsVersion"] == 11 then
MRT_Options["Tracking_LogWotLKRaids"] = false;
MRT_Options["General_OptionsVersion"] = 12;
end
if MRT_Options["General_OptionsVersion"] == 12 then
MRT_Options["ItemTracking_UseEPGPValues"] = false;
MRT_Options["General_OptionsVersion"] = 13;
end
if MRT_Options["General_OptionsVersion"] == 13 then
MRT_Options["Tracking_LogLFRRaids"] = true;
MRT_Options["General_OptionsVersion"] = 14;
end
if MRT_Options["General_OptionsVersion"] == 14 then
MRT_Options["Tracking_LogCataclysmRaids"] = false;
MRT_Options["Tracking_LogMoPRaids"] = true;
MRT_Options["Tracking_LogLootModePersonal"] = true;
MRT_Options["General_OptionsVersion"] = 15;
end
if MRT_Options["General_OptionsVersion"] == 15 then
MRT_Options["Tracking_Log25MenRaids"] = true;
MRT_Options["Tracking_LogNormalRaids"] = true;
MRT_Options["Tracking_LogHeroicRaids"] = true;
MRT_Options["Tracking_LogMythicRaids"] = true;
MRT_Options["General_OptionsVersion"] = 16;
end
if MRT_Options["General_OptionsVersion"] == 16 then
MRT_Options["Tracking_AskForDKPValuePersonal"] = true;
MRT_Options["General_OptionsVersion"] = 17;
end
if MRT_Options["General_OptionsVersion"] == 17 then
MRT_Options["Tracking_LogWarlordsRaids"] = true;
MRT_Options["General_OptionsVersion"] = 18;
end
if MRT_Options["General_OptionsVersion"] == 18 then
-- BfA transition - reset logging of personal loot to true - it is the only loot mode available now
MRT_Options["Tracking_LogLootModePersonal"] = true;
MRT_Options["General_OptionsVersion"] = 19;
end
if MRT_Options["General_OptionsVersion"] == 19 then
-- Update for existing installations on WoW Classic: Force enable on first load
if (mrt.isClassic) then
MRT_Options["Tracking_LogClassicRaids"] = true;
end
MRT_Options["General_OptionsVersion"] = 20;
end
if MRT_Options["General_OptionsVersion"] == 20 then
-- Update for existing installations on WoW BC Classic: Force enable on first load
if (mrt.isBCC) then
MRT_Options["Tracking_LogBCRaids"] = true;
end
MRT_Options["General_OptionsVersion"] = 21;
end
if MRT_Options["General_OptionsVersion"] == 21 then
MRT_Options["ItemTracking_IgnoreStacks"] = true;
MRT_Options["General_OptionsVersion"] = 22;
end
if MRT_Options["General_OptionsVersion"] == 22 then
if (mrt.isWrath) then
MRT_Options["Tracking_LogWotLKRaids"] = true;
end
MRT_Options["General_OptionsVersion"] = 23;
end
end
-----------------------------------------------
-- Make configuration changes if necessary --
-----------------------------------------------
function MRT_VersionUpdate()
-- DB changes from v.nil to v.1: Move extended player information in extra database
if (MRT_Options["DB_Version"] == nil) then
if (#MRT_RaidLog > 0) then
local currentrealm = GetRealmName();
for i, raidInfoTable in ipairs(MRT_RaidLog) do
local realm;
if (raidInfoTable["Realm"]) then
realm = raidInfoTable["Realm"];
else
realm = currentrealm;
raidInfoTable["Realm"] = realm;
end
if (MRT_PlayerDB[realm] == nil) then
MRT_PlayerDB[realm] = {};
end
for j, playerInfo in pairs(raidInfoTable["Players"]) do
local name = playerInfo["Name"];
if (MRT_PlayerDB[realm][name] == nil) then
MRT_PlayerDB[realm][name] = {};
MRT_PlayerDB[realm][name]["Name"] = name;
end
if (playerInfo["Race"]) then
MRT_PlayerDB[realm][name]["Race"] = playerInfo["Race"];
playerInfo["Race"] = nil;
end
if (playerInfo["RaceL"]) then
MRT_PlayerDB[realm][name]["Race"] = playerInfo["RaceL"];
playerInfo["RaceL"] = nil;
end
if (playerInfo["Class"]) then
MRT_PlayerDB[realm][name]["Class"] = playerInfo["Class"];
playerInfo["Class"] = nil;
end
if (playerInfo["ClassL"]) then
MRT_PlayerDB[realm][name]["ClassL"] = playerInfo["ClassL"];
playerInfo["ClassL"] = nil;
end
if (playerInfo["Level"]) then
MRT_PlayerDB[realm][name]["Level"] = playerInfo["Level"];
playerInfo["Level"] = nil;
end
if (playerInfo["Sex"]) then
MRT_PlayerDB[realm][name]["Sex"] = playerInfo["Sex"];
playerInfo["Sex"] = nil;
end
end
end
end
MRT_Options["DB_Version"] = 1;
end
-- DB changes from v.1 to v.2: Add missing StopTime to each raid entry
if (MRT_Options["DB_Version"] == 1) then
if (#MRT_RaidLog > 0) then
for i, raidInfoTable in ipairs(MRT_RaidLog) do
local latestTimestamp = 1;
for j, playerInfo in pairs(raidInfoTable["Players"]) do
if (playerInfo["Leave"] > latestTimestamp) then
latestTimestamp = playerInfo["Leave"];
end
end
raidInfoTable["StopTime"] = latestTimestamp;
end
end
MRT_Options["DB_Version"] = 2;
end
-- DB changes from v.2 to v.3:
-- * Update from 3.4 difficulty IDs to 6.0 difficulty IDs
-- * Add raid difficulty IDs to raid entries
-- * Fix LFR (ID 17) entries
if (MRT_Options["DB_Version"] == 2) then
if (#MRT_RaidLog > 0) then
for i, raidInfoTable in ipairs(MRT_RaidLog) do
if (raidInfoTable["RaidSize"] == 10) then
raidInfoTable["DiffID"] = 3;
elseif (raidInfoTable["RaidSize"] == 25) then
raidInfoTable["DiffID"] = 4;
end
for j, bossInfo in ipairs(raidInfoTable["Bosskills"]) do
if (not bossInfo["Difficulty"]) then
raidInfoTable["DiffID"] = 17;
bossInfo["Difficulty"] = 17;
elseif (bossInfo["Difficulty"] == 1) then
bossInfo["Difficulty"] = 3;
elseif (bossInfo["Difficulty"] == 2) then
bossInfo["Difficulty"] = 4;
elseif (bossInfo["Difficulty"] == 3) then
bossInfo["Difficulty"] = 5;
elseif (bossInfo["Difficulty"] == 4) then
bossInfo["Difficulty"] = 6;
end
end
end
end
MRT_Options["DB_Version"] = 3;
end
-- DB change from v3 to v4:
-- * Fix missing boss encounter names on classic clients before boss name detection on non-EN clients was fixed
if (MRT_Options["DB_Version"] == 3) then
if (#MRT_RaidLog > 0 and mrt.isClassic) then
local bossIdToEncId = {};
for encId, bossId in pairs(MRT_EncounterIDList) do
bossIdToEncId[bossId] = encId;
end
for i, raidInfoTable in ipairs(MRT_RaidLog) do
for j, bossInfo in ipairs(raidInfoTable["Bosskills"]) do
if ((bossInfo["Name"] == "") or (bossInfo["Name"] == " ") or (not bossInfo["Name"])) then
if (bossInfo["BossId"] and bossIdToEncId[bossInfo["BossId"]] and mrt.encounterNameList[bossIdToEncId[bossInfo["BossId"]]]) then
bossInfo["Name"] = LBBL[mrt.encounterNameList[bossIdToEncId[bossInfo["BossId"]]]];
else
bossInfo["Name"] = "Unknown Encounter";
end
end
end
end
end
MRT_Options["DB_Version"] = 4;
end
end
----------------------------
-- Periodic maintenance --
----------------------------
-- delete unused PlayerDB-Entries and prun raidlog
function MRT_PeriodicMaintenance()
if (#MRT_RaidLog == 0) then return; end
local startTime = time();
-- process prunning - smaller raidIndex is older raid
if (MRT_Options["General_PrunnRaidLog"]) then
-- prunningTime in seconds
local prunningTime = MRT_Options["General_PrunningTime"] * 24 * 60 * 60;
local lastRaidOverPrunningTreshhold = nil;
for i, raidInfo in ipairs(MRT_RaidLog) do
if ( (startTime - raidInfo["StartTime"]) > prunningTime and i ~= MRT_NumOfCurrentRaid ) then
lastRaidOverPrunningTreshhold = i;
end
end
if (lastRaidOverPrunningTreshhold) then
-- if MRT_NumOfCurrentRaid not nil, then reduce it by the number of deleted raids
if (MRT_NumOfCurrentRaid) then
MRT_NumOfCurrentRaid = MRT_NumOfCurrentRaid - lastRaidOverPrunningTreshhold
if (MRT_NumOfCurrentRaid < 1) then MRT_NumOfCurrentRaid = nil; end
end
-- delete raid entries, that are too old
for i = lastRaidOverPrunningTreshhold, 1, -1 do
tremove(MRT_RaidLog, i);
end
end
end
-- process playerDB
local deletedEntries = 0;
local usedPlayerList = {};
for i, raidInfoTable in ipairs(MRT_RaidLog) do
local name;
local realm = raidInfoTable["Realm"];
if (not usedPlayerList[realm]) then usedPlayerList[realm] = {}; end
for j, playerInfo in pairs(raidInfoTable["Players"]) do
name = playerInfo.Name;
usedPlayerList[realm][name] = true;
end
for j, bossInfo in ipairs(raidInfoTable["Bosskills"]) do
for k, playerName in ipairs(bossInfo["Players"]) do
usedPlayerList[realm][playerName] = true;
end
end
end
for realm, playerInfoList in pairs(MRT_PlayerDB) do
for player, playerInfo in pairs(MRT_PlayerDB[realm]) do
-- realm-check is neccessary, because there may be PlayerDB-entries for realms, whose corresponding raids are deleted
if (not usedPlayerList[realm] or not usedPlayerList[realm][player]) then
MRT_PlayerDB[realm][player] = nil;
deletedEntries = deletedEntries + 1;
end
end
end
MRT_Debug("Maintenance finished in "..tostring(time() - startTime).." seconds. Deleted "..tostring(deletedEntries).." player entries.");
end
-----------------
-- API-Stuff --
-----------------
function MRT_RegisterItemCostHandlerCore(functionToCall, addonName)
if (functionToCall == nil or addonName == nil) then
return false;
end
if (not MRT_ExternalItemCostHandler.func) then
MRT_ExternalItemCostHandler.func = functionToCall;
MRT_ExternalItemCostHandler.addonName = addonName;
MRT_Print("Note: The addon '"..addonName.."' has registered itself to handle item tracking.");
return true;
else
return false;
end
end
function MRT_UnregisterItemCostHandlerCore(functionCalled)
if (functionCalled == nil) then
return false;
end
if (MRT_ExternalItemCostHandler.func == functionCalled) then
MRT_ExternalItemCostHandler.func = nil;
MRT_ExternalItemCostHandler.addonName = nil;
return true;
else
return false;
end
end
function MRT_RegisterLootNotifyCore(functionToCall)
local isRegistered = nil;
for i, val in ipairs(MRT_ExternalLootNotifier) do
if (val == functionToCall) then
isRegistered = true;
end
end
if (isRegistered) then
return false;
else
tinsert(MRT_ExternalLootNotifier, functionToCall);
return true;
end
end
function MRT_UnregisterLootNotifyCore(functionCalled)
local isRegistered = nil;
for i, val in ipairs(MRT_ExternalLootNotifier) do
if (val == functionCalled) then
isRegistered = i;
end
end
if (isRegistered) then
tremove(MRT_ExternalLootNotifier, isRegistered);
return true;
else
return false;
end
end
-------------------------------------
-- basic raid tracking functions --
-------------------------------------
function MRT_CheckRaidStatusAfterLogin()
if (not MRT_IsInRaid()) then
MRT_EndActiveRaid();
MRT_LDB_DS.icon = "Interface\\AddOns\\MizusRaidTracker\\icons\\icon_disabled";
return;
end
if (MRT_NumOfCurrentRaid) then
-- set up timer for regular raid roster scanning
MRT_RaidRosterScanTimer.lastCheck = time()
MRT_RaidRosterScanTimer:SetScript("OnUpdate", function (self)
if ((time() - self.lastCheck) > 5) then
self.lastCheck = time();
MRT_RaidRosterUpdate();
end
end);
-- update LDB text and icon
MRT_LDB_DS.icon = "Interface\\AddOns\\MizusRaidTracker\\icons\\icon_enabled";
end