diff Core.lua @ 42:8168280420ae

Added a new option to both sound notifications to limit playing of the sound to once per mailbox visit, instead of once per mailbox refresh / bags update.
author Zerotorescue
date Sat, 11 Sep 2010 21:31:26 +0200
parents 90d58723ac0a
children 1805df31794d
line wrap: on
line diff
--- a/Core.lua	Sat Sep 11 18:43:14 2010 +0200
+++ b/Core.lua	Sat Sep 11 21:31:26 2010 +0200
@@ -5,7 +5,7 @@
 -- MailAddonBusy will be nil when nothing is happening or filled with the addon name when MO is working
 -- Another addon can use this variable to indicate they're working too, MailOpener will then wait for that to finish
 
-local AutoOpenMail, MailOpenerConfig, lastAmount, lastQuickAuctionsStatus, freshList, mailboxEmptySoundPlayed;
+local AutoOpenMail, MailOpenerConfig, lastAmount, lastQuickAuctionsStatus, freshList, mailboxEmptySoundPlayed, mailboxEmptySoundPlayedThisVisit;
 
 function MailOpener:OnInitialize()
 	self:Debug("OnInitialize");
@@ -72,10 +72,12 @@
 				bagsFullSoundFile = "Sound\\Spells\\SimonGame_Visual_BadPress.wav",
 				bagsFullSoundFileName = "Simon Error",
 				bagsFullSoundOnlyOnce = true,
+				bagsFullSoundOnlyOncePerMailboxVisit = false,
 				mailboxEmptySound = false,
 				mailboxEmptySoundFile = "Sound\\Spells\\SimonGame_Visual_GameStart.wav",
 				mailboxEmptySoundFileName = "Simon Start",
 				mailboxEmptySoundOnlyOnce = true,
+				mailboxEmptySoundOnlyOncePerMailboxVisit = false,
 			},
 		},
 	};
@@ -393,6 +395,7 @@
 	end
 	
 	mailboxEmptySoundPlayed = nil;
+	mailboxEmptySoundPlayedThisVisit = nil;
 	
 	self:Recheck();
 	
@@ -554,9 +557,10 @@
 	if (total - current) == 0 then
 		-- There is probably no unopenable mail remaining, so play the sound (if enabled)
 		
-		if self.db.profile.notifications.mailboxEmptySound and (not MailOpener.db.profile.notifications.mailboxEmptySoundOnlyOnce or not mailboxEmptySoundPlayed) then
+		if self.db.profile.notifications.mailboxEmptySound and (not MailOpener.db.profile.notifications.mailboxEmptySoundOnlyOnce or not mailboxEmptySoundPlayed) and (not MailOpener.db.profile.notifications.mailboxEmptySoundOnlyOncePerMailboxVisit or not mailboxEmptySoundPlayedThisVisit) then
 			PlaySoundFile(self.db.profile.notifications.mailboxEmptySoundFile);
 			mailboxEmptySoundPlayed = true;
+			mailboxEmptySoundPlayedThisVisit = true;
 		end
 	end