Mercurial > wow > mailopener
diff Modules/OpenAll.lua @ 46:1805df31794d
Only when holding the shift key while opening the mailbox will toggle the opening status. If you want to do it somewhere in the middle of your mailbox visit, just untick the mail opener checkbox.
Holding shift while clicking the open all button will now auto loot every single mail with attachments.
/mo d will now return the id of the chatframe being used, if it's using one already existing.
Changelog and TOC update.
| author | Zerotorescue |
|---|---|
| date | Sun, 12 Sep 2010 16:36:18 +0200 |
| parents | 8168280420ae |
| children | f630d882d008 |
line wrap: on
line diff
--- a/Modules/OpenAll.lua Sun Sep 12 15:53:19 2010 +0200 +++ b/Modules/OpenAll.lua Sun Sep 12 16:36:18 2010 +0200 @@ -9,7 +9,7 @@ When shift clicking the Open All button it should override all filters. ]] -local MAIL_ITEM_INDEX, mailTimer, inventoryFull, inventoryFullSoundPlayed, inventoryFullSoundPlayedThisVisit, opening, lastSync, numCurrentMail, numHiddenMail, continue; +local MAIL_ITEM_INDEX, MAIL_OPEN_EVERYTHING, mailTimer, inventoryFull, inventoryFullSoundPlayed, inventoryFullSoundPlayedThisVisit, opening, lastSync, numCurrentMail, numHiddenMail, continue; function mod:OnInitialize() local defaults = { @@ -39,12 +39,14 @@ if not self.btnOpenAll then -- Open all button - local button = CreateFrame("Button", "btnMailOpenerOpenAll", InboxFrame, "UIPanelButtonTemplate") - button:SetText("Open all") - button:SetHeight(26) - button:SetWidth(120) - button:SetPoint("BOTTOM", InboxFrame, "CENTER", -10, -165) - button:SetScript("OnClick", function() mod:Open(true) end) + local button = CreateFrame("Button", "btnMailOpenerOpenAll", InboxFrame, "UIPanelButtonTemplate"); + button:SetText("Open all"); + button:SetHeight(26); + button:SetWidth(120); + button:SetPoint("BOTTOM", InboxFrame, "CENTER", -10, -165); + button:SetScript("OnClick", function() + mod:Open(true, IsShiftKeyDown()); + end); self.btnOpenAll = button; end @@ -247,8 +249,8 @@ end end -function mod:Open(forced) - self:Debug("Open"); +function mod:Open(forced, everything) + self:Debug("Open (" .. ((everything and "1") or "0") .. ")"); if not opening or forced == true then local numItems, totalItems = GetInboxNumItems(); @@ -267,6 +269,14 @@ -- Update the caret MAIL_ITEM_INDEX = newMailItemIndex; + -- Do we want to override filters and open every single mail? + if everything then + MAIL_OPEN_EVERYTHING = true; + + print("|cff15ff00Mail Opener|r: Shift key was held while pressing the open all button. Temporarily overriding filters; going to open every mail with attachments."); + else + MAIL_OPEN_EVERYTHING = nil; + end -- We're now going to be busy again self:SetOpeningStatus(true); @@ -349,7 +359,7 @@ end end - if inventoryFull and not MailOpener.db.profile.general.continueOpeningStackableItems and items and items > 0 then + if inventoryFull and not MAIL_OPEN_EVERYTHING and not MailOpener.db.profile.general.continueOpeningStackableItems and items and items > 0 then if MailOpener.db.profile.notifications.skipped.all and MailOpener.db.profile.notifications.skipped.inventoryFull then print("Skipping " .. index .. ": " .. subject .. " (inventory is full)"); end @@ -383,7 +393,7 @@ mailType = "AH" .. auctionMailType; end - if not self.db.profile.filter.normalMoney and mailType == "normalGoldMail" then + if not MAIL_OPEN_EVERYTHING and not self.db.profile.filter.normalMoney and mailType == "normalGoldMail" then if MailOpener.db.profile.notifications.skipped.all and MailOpener.db.profile.notifications.skipped[mailType] then print("Skipping " .. index .. ": " .. subject .. " (normal mail with gold)"); end @@ -391,7 +401,7 @@ self:OpenNext(); return; - elseif not self.db.profile.filter.normalAttachments and mailType == "normalItemsMail" then + elseif not MAIL_OPEN_EVERYTHING and not self.db.profile.filter.normalAttachments and mailType == "normalItemsMail" then if MailOpener.db.profile.notifications.skipped.all and MailOpener.db.profile.notifications.skipped[mailType] then print("Skipping " .. index .. ": " .. subject .. " (normal mail with attachments)"); end @@ -399,7 +409,7 @@ self:OpenNext(); return; - elseif not self.db.profile.filter.AH.expired and mailType == "AHexpired" then + elseif not MAIL_OPEN_EVERYTHING and not self.db.profile.filter.AH.expired and mailType == "AHexpired" then if MailOpener.db.profile.notifications.skipped.all and MailOpener.db.profile.notifications.skipped[mailType] then print("Skipping " .. index .. ": " .. subject .. " (expired auction)"); end @@ -407,7 +417,7 @@ self:OpenNext(); return; - elseif not self.db.profile.filter.AH.success and mailType == "AHsuccess" then + elseif not MAIL_OPEN_EVERYTHING and not self.db.profile.filter.AH.success and mailType == "AHsuccess" then if MailOpener.db.profile.notifications.skipped.all and MailOpener.db.profile.notifications.skipped[mailType] then print("Skipping " .. index .. ": " .. subject .. " (successful auction)"); end @@ -415,7 +425,7 @@ self:OpenNext(); return; - elseif not self.db.profile.filter.AH.won and mailType == "AHwon" then + elseif not MAIL_OPEN_EVERYTHING and not self.db.profile.filter.AH.won and mailType == "AHwon" then if MailOpener.db.profile.notifications.skipped.all and MailOpener.db.profile.notifications.skipped[mailType] then print("Skipping " .. index .. ": " .. subject .. " (auction won)"); end @@ -423,7 +433,7 @@ self:OpenNext(); return; - elseif not self.db.profile.filter.AH.canceled and mailType == "AHcanceled" then + elseif not MAIL_OPEN_EVERYTHING and not self.db.profile.filter.AH.canceled and mailType == "AHcanceled" then if MailOpener.db.profile.notifications.skipped.all and MailOpener.db.profile.notifications.skipped[mailType] then print("Skipping " .. index .. ": " .. subject .. " (canceled auction)"); end @@ -431,7 +441,7 @@ self:OpenNext(); return; - elseif not self.db.profile.filter.AH.outbid and mailType == "AHoutbid" then + elseif not MAIL_OPEN_EVERYTHING and not self.db.profile.filter.AH.outbid and mailType == "AHoutbid" then if MailOpener.db.profile.notifications.skipped.all and MailOpener.db.profile.notifications.skipped[mailType] then print("Skipping " .. index .. ": " .. subject .. " (outbid on auction)"); end @@ -610,6 +620,8 @@ -- Reset opener position MAIL_ITEM_INDEX = 0; + -- Reset open everything state + MAIL_OPEN_EVERYTHING = nil; -- Stopped opening, so allow to continue continue = true;
