-
-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathMuteSoundFile.lua
More file actions
47 lines (42 loc) · 1.3 KB
/
Copy pathMuteSoundFile.lua
File metadata and controls
47 lines (42 loc) · 1.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
local name = ...
local MuteSoundFile, UnmuteSoundFile = MuteSoundFile, UnmuteSoundFile
local frame = CreateFrame("Frame", "MuteSoundFileFrame")
frame.MuteSoundFile, frame.UnmuteSoundFile = MuteSoundFile, UnmuteSoundFile
do
local function openOpts()
C_AddOns.EnableAddOn("MuteSoundFile_Options") -- Make sure it wasn't left disabled for whatever reason
C_AddOns.LoadAddOn("MuteSoundFile_Options")
LibStub("AceConfigDialog-3.0"):Open(name)
end
SlashCmdList[name] = openOpts
SLASH_MuteSoundFile1 = "/msf"
SLASH_MuteSoundFile2 = "/mutesoundfile"
frame:RegisterEvent("ADDON_LOADED")
end
frame:SetScript("OnEvent", function(f, event, addon)
if addon ~= name then return end
f:UnregisterEvent(event)
-- saved variables database setup
local defaults = {
profile = {
soundList = {},
mutedPresets = {},
},
}
f.db = LibStub("AceDB-3.0"):New("MuteSoundFileDB", defaults, true)
do
local rl = function() ReloadUI() end
f.db.RegisterCallback(f, "OnProfileChanged", rl)
f.db.RegisterCallback(f, "OnProfileCopied", rl)
f.db.RegisterCallback(f, "OnProfileReset", rl)
end
for _, soundID in next, f.db.profile.soundList do
MuteSoundFile(soundID)
end
for _, presetTable in next, f.db.profile.mutedPresets do
for i = 1, #presetTable do
local id = presetTable[i]
MuteSoundFile(id)
end
end
end)