Mercurial > wow > mailopener
comparison Modules/OpenAll.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 | b79bb7b449c3 |
| children | 1805df31794d |
comparison
equal
deleted
inserted
replaced
| 41:2b2bea9c7446 | 42:8168280420ae |
|---|---|
| 7 --[[ | 7 --[[ |
| 8 Dev notes: | 8 Dev notes: |
| 9 When shift clicking the Open All button it should override all filters. | 9 When shift clicking the Open All button it should override all filters. |
| 10 ]] | 10 ]] |
| 11 | 11 |
| 12 local MAIL_ITEM_INDEX, mailTimer, inventoryFull, inventoryFullSoundPlayed, opening, lastSync, numCurrentMail, numHiddenMail, continue; | 12 local MAIL_ITEM_INDEX, mailTimer, inventoryFull, inventoryFullSoundPlayed, inventoryFullSoundPlayedThisVisit, opening, lastSync, numCurrentMail, numHiddenMail, continue; |
| 13 | 13 |
| 14 function mod:OnInitialize() | 14 function mod:OnInitialize() |
| 15 local defaults = { | 15 local defaults = { |
| 16 profile = { | 16 profile = { |
| 17 speed = 0.05, | 17 speed = 0.05, |
| 34 self.db = MailOpener.db:RegisterNamespace("OpenAll", defaults); | 34 self.db = MailOpener.db:RegisterNamespace("OpenAll", defaults); |
| 35 end | 35 end |
| 36 | 36 |
| 37 function mod:OnEnable() | 37 function mod:OnEnable() |
| 38 self:RegisterEvent("MAIL_SHOW"); | 38 self:RegisterEvent("MAIL_SHOW"); |
| 39 | 39 |
| 40 if not self.btnOpenAll then | 40 if not self.btnOpenAll then |
| 41 -- Open all button | 41 -- Open all button |
| 42 local button = CreateFrame("Button", "btnMailOpenerOpenAll", InboxFrame, "UIPanelButtonTemplate") | 42 local button = CreateFrame("Button", "btnMailOpenerOpenAll", InboxFrame, "UIPanelButtonTemplate") |
| 43 button:SetText("Open all") | 43 button:SetText("Open all") |
| 44 button:SetHeight(26) | 44 button:SetHeight(26) |
| 86 end | 86 end |
| 87 | 87 |
| 88 self.timeLeftFrame:Show(); | 88 self.timeLeftFrame:Show(); |
| 89 | 89 |
| 90 -- Go through all children of the mail frame to find QA's element and hide it | 90 -- Go through all children of the mail frame to find QA's element and hide it |
| 91 -- There's no other way to do this because QuickAuctions has a local referrence to it (not as a property of the object like most other frames) | |
| 91 local kids = { MailFrame:GetChildren() }; | 92 local kids = { MailFrame:GetChildren() }; |
| 92 | 93 |
| 93 for _, child in ipairs(kids) do | 94 for _, child in ipairs(kids) do |
| 94 if child and child.text then | 95 if child and child.text then |
| 95 child.text:Hide(); | 96 child.text:Hide(); |
| 119 MailOpener:TogglePostalModule("OpenAll", true); | 120 MailOpener:TogglePostalModule("OpenAll", true); |
| 120 MailOpener:TogglePostalModule("Select", true); | 121 MailOpener:TogglePostalModule("Select", true); |
| 121 end | 122 end |
| 122 | 123 |
| 123 -- Go through all children of the mail frame to find QA's elements and SHOW these | 124 -- Go through all children of the mail frame to find QA's elements and SHOW these |
| 125 -- There's no other way to do this because QuickAuctions has a local referrence to it (not as a property of the object like most other frames) | |
| 124 local kids = { MailFrame:GetChildren() }; | 126 local kids = { MailFrame:GetChildren() }; |
| 125 | 127 |
| 126 for _, child in ipairs(kids) do | 128 for _, child in ipairs(kids) do |
| 127 if child and child.text then | 129 if child and child.text then |
| 128 child.text:Show(); | 130 child.text:Show(); |
| 134 | 136 |
| 135 function mod:MAIL_SHOW() | 137 function mod:MAIL_SHOW() |
| 136 self:Debug("MAIL_SHOW"); | 138 self:Debug("MAIL_SHOW"); |
| 137 | 139 |
| 138 self:StopOpening(false); | 140 self:StopOpening(false); |
| 141 | |
| 142 inventoryFullSoundPlayedThisVisit = nil; | |
| 139 | 143 |
| 140 if MailOpener.PostalEnabled then | 144 if MailOpener.PostalEnabled then |
| 141 -- Disable Postal's openers so we can do it ourselves | 145 -- Disable Postal's openers so we can do it ourselves |
| 142 | 146 |
| 143 MailOpener:TogglePostalModule("OpenAll", false); | 147 MailOpener:TogglePostalModule("OpenAll", false); |
| 224 | 228 |
| 225 if not inventoryFull then | 229 if not inventoryFull then |
| 226 inventoryFull = true; | 230 inventoryFull = true; |
| 227 | 231 |
| 228 -- Play the sound | 232 -- Play the sound |
| 229 if MailOpener.db.profile.notifications.bagsFullSound and (not MailOpener.db.profile.notifications.bagsFullSoundOnlyOnce or not inventoryFullSoundPlayed) then | 233 if MailOpener.db.profile.notifications.bagsFullSound and (not MailOpener.db.profile.notifications.bagsFullSoundOnlyOnce or not inventoryFullSoundPlayed) and (not MailOpener.db.profile.notifications.bagsFullSoundOnlyOncePerMailboxVisit or not inventoryFullSoundPlayedThisVisit) then |
| 230 PlaySoundFile(MailOpener.db.profile.notifications.bagsFullSoundFile); | 234 PlaySoundFile(MailOpener.db.profile.notifications.bagsFullSoundFile); |
| 231 inventoryFullSoundPlayed = true; | 235 inventoryFullSoundPlayed = true; |
| 236 inventoryFullSoundPlayedThisVisit = true; | |
| 232 end | 237 end |
| 233 end | 238 end |
| 234 | 239 |
| 235 -- Continue opening mail (we still want to open gold mail) | 240 -- Continue opening mail (we still want to open gold mail) |
| 236 continue = true; | 241 continue = true; |
