Added option to ignore muting while in an interaction window, so quest chats didn't get cut out

Wobin [05-30-14 - 10:58]
Added option to ignore muting while in an interaction window, so quest chats didn't get cut out
Also fixed muting on non bank interacts after interacting with a bank
Filename
BorrowerAndLender.lua
diff --git a/BorrowerAndLender.lua b/BorrowerAndLender.lua
index 029cf4c..43c8adf 100644
--- a/BorrowerAndLender.lua
+++ b/BorrowerAndLender.lua
@@ -27,7 +27,7 @@ end

 local function WhoAmI(eventCode, options)
 	for i,v in ipairs(chatOptions) do
-		if v and EndsWith(v:GetText(), GetString(SI_INTERACT_OPTION_BANK)) then
+		if v and not v:IsHidden() and EndsWith(v:GetText(), GetString(SI_INTERACT_OPTION_BANK)) then
 			if currentWait then BorrowerAndLender:CancelTimer(currentWait) end
 			currentWait = BorrowerAndLender:ScheduleTimer(SpeakUpLad, (#ZO_InteractWindowTargetAreaBodyText:GetText()/15) + 5)
 			return Hush()
@@ -44,6 +44,9 @@ end

 local function FilterNPC(eventCode, channel, npc, chat)
 	if channel ~= CHAT_CHANNEL_MONSTER_SAY and channel ~= CHAT_CHANNEL_MONSTER_YELL then return end
+
+	if not settings.muteAmbientWhileChatting and not ZO_ChatterOption1:IsHidden() then return end
+
 	if settings.whitelist[npc] then return end

 	if not settings.chats[npc] then
@@ -90,7 +93,8 @@ local function BorrowerAndLenderLoaded(eventCode, addOnName)
 		whitelist = {},
 		defaultSoundLevel = control.currentChoice or control.value or 75,
 		muteBank = true,
-		muteAmbient = true
+		muteAmbient = true,
+		muteAmbientWhileChatting = false
 	}

 	settings = ZO_SavedVars:New("BorrowerAndLender_Settings", 6, nil, defaults)
@@ -125,6 +129,10 @@ local function BorrowerAndLenderLoaded(eventCode, addOnName)
 						end
 						settings.muteAmbient = value
 					end)
+	LAM:AddCheckbox(panel, "muteAmbientChatting", "Mute ambient NPCs while in a chat dialog", "Mute passing npcs when inside a chat dialog (eg quest)",
+					function() return settings.muteAmbientWhileChatting end,
+					function(value) settings.muteAmbientWhileChatting = value end)
+
 	if settings.muteBank then
 		EVENT_MANAGER:RegisterForEvent("BALWho", EVENT_CHATTER_BEGIN, WhoAmI)
 		EVENT_MANAGER:RegisterForEvent("BALTalk", EVENT_CHATTER_END, SpeakUpLad)