Mercurial > wow > mailopener
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 41:2b2bea9c7446 | 42:8168280420ae |
|---|---|
| 3 | 3 |
| 4 -- You can check if MailOpener is busy with the global MailAddonBusy (if not MailAddonBusy then ...do something... end) | 4 -- You can check if MailOpener is busy with the global MailAddonBusy (if not MailAddonBusy then ...do something... end) |
| 5 -- MailAddonBusy will be nil when nothing is happening or filled with the addon name when MO is working | 5 -- MailAddonBusy will be nil when nothing is happening or filled with the addon name when MO is working |
| 6 -- Another addon can use this variable to indicate they're working too, MailOpener will then wait for that to finish | 6 -- Another addon can use this variable to indicate they're working too, MailOpener will then wait for that to finish |
| 7 | 7 |
| 8 local AutoOpenMail, MailOpenerConfig, lastAmount, lastQuickAuctionsStatus, freshList, mailboxEmptySoundPlayed; | 8 local AutoOpenMail, MailOpenerConfig, lastAmount, lastQuickAuctionsStatus, freshList, mailboxEmptySoundPlayed, mailboxEmptySoundPlayedThisVisit; |
| 9 | 9 |
| 10 function MailOpener:OnInitialize() | 10 function MailOpener:OnInitialize() |
| 11 self:Debug("OnInitialize"); | 11 self:Debug("OnInitialize"); |
| 12 | 12 |
| 13 | 13 |
| 70 | 70 |
| 71 bagsFullSound = false, | 71 bagsFullSound = false, |
| 72 bagsFullSoundFile = "Sound\\Spells\\SimonGame_Visual_BadPress.wav", | 72 bagsFullSoundFile = "Sound\\Spells\\SimonGame_Visual_BadPress.wav", |
| 73 bagsFullSoundFileName = "Simon Error", | 73 bagsFullSoundFileName = "Simon Error", |
| 74 bagsFullSoundOnlyOnce = true, | 74 bagsFullSoundOnlyOnce = true, |
| 75 bagsFullSoundOnlyOncePerMailboxVisit = false, | |
| 75 mailboxEmptySound = false, | 76 mailboxEmptySound = false, |
| 76 mailboxEmptySoundFile = "Sound\\Spells\\SimonGame_Visual_GameStart.wav", | 77 mailboxEmptySoundFile = "Sound\\Spells\\SimonGame_Visual_GameStart.wav", |
| 77 mailboxEmptySoundFileName = "Simon Start", | 78 mailboxEmptySoundFileName = "Simon Start", |
| 78 mailboxEmptySoundOnlyOnce = true, | 79 mailboxEmptySoundOnlyOnce = true, |
| 80 mailboxEmptySoundOnlyOncePerMailboxVisit = false, | |
| 79 }, | 81 }, |
| 80 }, | 82 }, |
| 81 }; | 83 }; |
| 82 | 84 |
| 83 -- Register our saved variables database | 85 -- Register our saved variables database |
| 391 | 393 |
| 392 print("|cff15ff00Mail Opener|r: Welcome back "..c..UnitName("player").."|r. Requesting new mail from the local Postal Service, your mail will automatically be opened when it becomes available."); | 394 print("|cff15ff00Mail Opener|r: Welcome back "..c..UnitName("player").."|r. Requesting new mail from the local Postal Service, your mail will automatically be opened when it becomes available."); |
| 393 end | 395 end |
| 394 | 396 |
| 395 mailboxEmptySoundPlayed = nil; | 397 mailboxEmptySoundPlayed = nil; |
| 398 mailboxEmptySoundPlayedThisVisit = nil; | |
| 396 | 399 |
| 397 self:Recheck(); | 400 self:Recheck(); |
| 398 | 401 |
| 399 if self.db.profile.general.continueOpening then | 402 if self.db.profile.general.continueOpening then |
| 400 -- Continue opening mail, but use the "initial mail opening interval" as time | 403 -- Continue opening mail, but use the "initial mail opening interval" as time |
| 552 local current, total = GetInboxNumItems(); | 555 local current, total = GetInboxNumItems(); |
| 553 | 556 |
| 554 if (total - current) == 0 then | 557 if (total - current) == 0 then |
| 555 -- There is probably no unopenable mail remaining, so play the sound (if enabled) | 558 -- There is probably no unopenable mail remaining, so play the sound (if enabled) |
| 556 | 559 |
| 557 if self.db.profile.notifications.mailboxEmptySound and (not MailOpener.db.profile.notifications.mailboxEmptySoundOnlyOnce or not mailboxEmptySoundPlayed) then | 560 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 |
| 558 PlaySoundFile(self.db.profile.notifications.mailboxEmptySoundFile); | 561 PlaySoundFile(self.db.profile.notifications.mailboxEmptySoundFile); |
| 559 mailboxEmptySoundPlayed = true; | 562 mailboxEmptySoundPlayed = true; |
| 563 mailboxEmptySoundPlayedThisVisit = true; | |
| 560 end | 564 end |
| 561 end | 565 end |
| 562 | 566 |
| 563 if self.QuickAuctionsEnabled then | 567 if self.QuickAuctionsEnabled then |
| 564 -- Quick Auctions enabled? | 568 -- Quick Auctions enabled? |
