-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCharacterStatsTbcMain.lua
74 lines (64 loc) · 2.61 KB
/
CharacterStatsTbcMain.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
-- Access the namespace
local _, core = ...;
local CharacterStatsTbcFrame = CreateFrame("Frame");
CharacterStatsTbcFrame:RegisterEvent("PLAYER_ENTERING_WORLD");
CharacterStatsTbcFrame:RegisterEvent("PLAYER_EQUIPMENT_CHANGED");
CharacterStatsTbcFrame:RegisterEvent("UNIT_AURA");
CharacterStatsTbcFrame:RegisterEvent("PLAYER_DAMAGE_DONE_MODS");
CharacterStatsTbcFrame:RegisterEvent("SKILL_LINES_CHANGED");
CharacterStatsTbcFrame:RegisterEvent("UPDATE_SHAPESHIFT_FORM");
CharacterStatsTbcFrame:RegisterEvent("UNIT_DAMAGE");
CharacterStatsTbcFrame:RegisterEvent("UNIT_ATTACK_SPEED");
CharacterStatsTbcFrame:RegisterEvent("UNIT_RANGEDDAMAGE");
CharacterStatsTbcFrame:RegisterEvent("UNIT_ATTACK");
CharacterStatsTbcFrame:RegisterEvent("UNIT_RESISTANCES");
CharacterStatsTbcFrame:RegisterEvent("UNIT_STATS");
CharacterStatsTbcFrame:RegisterEvent("UNIT_MAXHEALTH");
CharacterStatsTbcFrame:RegisterEvent("UNIT_ATTACK_POWER");
CharacterStatsTbcFrame:RegisterEvent("UNIT_RANGED_ATTACK_POWER");
CharacterStatsTbcFrame:RegisterEvent("COMBAT_RATING_UPDATE");
CharacterStatsTbcFrame:RegisterEvent("GROUP_ROSTER_UPDATE");
CharacterStatsTbcFrame:SetScript("OnEvent",
function(self, event, ...)
local args = {...};
if event == "VARIABLES_LOADED" then
core.UIConfig:UpdateStats();
core.UIConfig:UpdateSideStats();
end
if args[1] == "player" then
if ( event == "UNIT_DAMAGE" or
event == "PLAYER_DAMAGE_DONE_MODS" or
event == "UNIT_ATTACK_SPEED" or
event == "UNIT_RANGEDDAMAGE" or
event == "UNIT_ATTACK" or
event == "UNIT_RESISTANCES" or
event == "UNIT_STATS" or
event == "UNIT_AURA" or
event == "UNIT_MAXHEALTH" or
event == "UNIT_ATTACK_POWER" or
event == "UNIT_RANGED_ATTACK_POWER" or
event == "SKILL_LINES_CHANGED" or
event == "COMBAT_RATING_UPDATE" or
event == "GROUP_ROSTER_UPDATE") then
self:SetScript("OnUpdate", CSC_QueuedUpdate);
end
end
end)
function CSC_QueuedUpdate(self)
self:SetScript("OnUpdate", nil);
if core.UIConfig.CharacterStatsPanel:IsVisible() then
core.UIConfig:UpdateStats();
end
core.UIConfig:UpdateSideStats();
end
-- Exposing global functions for showing/hiding the stats panel. For compatibility with other addons
function CSC_HideStatsPanel()
core.UIConfig.CharacterStatsPanel:Hide();
core.UIConfig:SetStatsPanelVisibile(false);
end
function CSC_ShowStatsPanel()
core.UIConfig.CharacterStatsPanel:Show();
core.UIConfig:UpdateStats();
core.UIConfig:UpdateSideStats();
core.UIConfig:SetStatsPanelVisibile(true);
end