-
Notifications
You must be signed in to change notification settings - Fork 1
/
Core.lua
36 lines (27 loc) · 1006 Bytes
/
Core.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
local frame = CreateFrame('Frame')
frame:RegisterEvent('PLAYER_REGEN_DISABLED')
frame:RegisterEvent('PLAYER_REGEN_ENABLED')
frame:RegisterEvent("ADDON_LOADED")
local soundsPath = 'Interface\\AddOns\\CombatIndicator\\Sounds\\'
frame:SetScript('OnEvent', function(self, event, arg1)
if event == 'PLAYER_REGEN_DISABLED' then
if (Preferences.notifyViaSound) then
PlaySoundFile(soundsPath .. 'combat_enter.ogg', 'Master')
end
if (Preferences.notifyViaIcon) then
VisualIndicator:Show()
end
elseif event == 'PLAYER_REGEN_ENABLED' then
if (Preferences.notifyViaSound) then
PlaySoundFile(soundsPath .. 'combat_exit.ogg', 'Master')
end
VisualIndicator:Hide()
elseif event == "ADDON_LOADED" and arg1 == 'CombatIndicator' then
if Preferences == nil then
Preferences = {
notifyViaIcon = true,
notifyViaSound = true
}
end
end
end)