Quantcast

Fix for #6 - Sound channles for chat alerts added

Joe Vaughan [10-24-16 - 17:07]
Fix for #6  - Sound channles for chat alerts added

Added option to choose channel to output mention and whisper alerts to.
Filename
SVUI_Chat/Loader.lua
SVUI_Chat/SVUI_Chat.lua
diff --git a/SVUI_Chat/Loader.lua b/SVUI_Chat/Loader.lua
index c6675f5..bda04cf 100644
--- a/SVUI_Chat/Loader.lua
+++ b/SVUI_Chat/Loader.lua
@@ -27,7 +27,7 @@ MOD.media = {}
 MOD.media.dockIcon = [[Interface\AddOns\SVUI_Chat\assets\DOCK-ICON-CHAT]];
 MOD.media.scrollIcon = [[Interface\AddOns\SVUI_Chat\assets\CHAT-SCROLL]];
 MOD.media.whisperIcon = [[Interface\AddOns\SVUI_Chat\assets\CHAT-WHISPER]];
-
+
 SV.defaults[Schema] = {
 	["docked"] = "BottomLeft",
 	["tabHeight"] = 20,
@@ -47,7 +47,9 @@ SV.defaults[Schema] = {
 	["shortChannels"] = true,
 	["hideRealms"] = false,
 	["mention"] = "Mention Alert",
+	["mention_channel"] = "Master",
 	["psst"] = "Whisper Alert",
+	["psst_channel"] = "Master",
 	["noWipe"] = false,
 	["timeStampFormat"] = "NONE",
 	["secretWords"] = "%MYNAME%, SVUI",
@@ -170,22 +172,52 @@ function MOD:LoadOptions()
 						values = AceVillainWidgets.sound,
 						set = function(a,b) MOD:ChangeDBVar(b,a[#a]) end
 					},
-					mention = {
+					psst_channel = {
 						order = 12,
 						type = "select",
+						name = L["Whisper Alert Sound Channel"],
+						desc = L["Select the sound channel for Whisper Alerts"],
+						disabled = function()return not SV.db[Schema].psst end,
+						values = {
+							["Master"] = "Master",
+							["Dialog"] = "Dialog",
+							["Sound"] = "SFX",
+							["Ambience"] = "Ambience",
+							["Music"] = "Music"
+						},
+						set = function(a,b) MOD:ChangeDBVar(b,a[#a]) end
+					},
+					mention = {
+						order = 13,
+						type = "select",
 						dialogControl = "LSM30_Sound",
 						name = L["Mention Alert"],
 						disabled = function()return not SV.db[Schema].mention end,
 						values = AceVillainWidgets.sound,
 						set = function(a,b) MOD:ChangeDBVar(b,a[#a]) end
 					},
+					mention_channel = {
+						order = 14,
+						type = "select",
+						name = L["Mention Alert Sound Channel"],
+						desc = L["Select the sound channel for Mention Alerts"],
+						disabled = function()return not SV.db[Schema].mention end,
+						values = {
+							["Master"] = "Master",
+							["Dialog"] = "Dialog",
+							["Sound"] = "SFX",
+							["Ambience"] = "Ambience",
+							["Music"] = "Music"
+						},
+						set = function(a,b) MOD:ChangeDBVar(b,a[#a]) end
+					},
 					spacer2 = {
-						order = 13,
+						order = 15,
 						type = "description",
 						name = ""
 					},
 					throttleInterval = {
-						order = 14,
+						order = 16,
 						type = "range",
 						name = L["Spam Interval"],
 						desc = L["Prevent the same messages from displaying in chat more than once within this set amount of seconds, set to zero to disable."],
diff --git a/SVUI_Chat/SVUI_Chat.lua b/SVUI_Chat/SVUI_Chat.lua
index 48aa78f..af2f163 100644
--- a/SVUI_Chat/SVUI_Chat.lua
+++ b/SVUI_Chat/SVUI_Chat.lua
@@ -48,7 +48,7 @@ local wipe          = _G.wipe;
 --BLIZZARD API
 local time 					= _G.time;
 local difftime 			= _G.difftime;
-
+
 local ChatFrame_AddMessageEventFilter = _G.ChatFrame_AddMessageEventFilter;
 local ChatEdit_ChooseBoxForSend = _G.ChatEdit_ChooseBoxForSend;
 --[[
@@ -407,7 +407,9 @@ do
 		end

 		if(message:find(PLAYERNAME_MATCH) and (not InCombatLockdown())) then
-			PlaySoundFile(SECRET_SOUND, "Master")
+
+
+			PlaySoundFile(SECRET_SOUND, SV.db.Chat.mention_channel or "Master")
 		end

 		return SVUI_ParseMessage(self, event, message, author, ...)
@@ -1432,14 +1434,14 @@ EVENTS
 ##########################################################
 ]]--
 function MOD:CHAT_MSG_WHISPER(event, ...)
-	if(not InCombatLockdown() and WHISPER_SOUND) then PlaySoundFile(WHISPER_SOUND, "Master") end
+	if(not InCombatLockdown() and WHISPER_SOUND) then PlaySoundFile(WHISPER_SOUND, SV.db.Chat.psst_channel or "Master") end
 	if(self.db.general.saveChats) then
 		self:SAVE_CHAT_HISTORY(event, ...)
 	end
 end

 function MOD:CHAT_MSG_BN_WHISPER(event, ...)
-	if(not InCombatLockdown() and WHISPER_SOUND) then PlaySoundFile(WHISPER_SOUND, "Master") end
+	if(not InCombatLockdown() and WHISPER_SOUND) then PlaySoundFile(WHISPER_SOUND, SV.db.Chat.psst or "Master") end
 	if(self.db.general.saveChats) then
 		self:SAVE_CHAT_HISTORY(event, ...)
 	end