|
Zerotorescue@0
|
1 local MailOpener = LibStub("AceAddon-3.0"):GetAddon("MailOpener");
|
|
Zerotorescue@0
|
2 local OpenAll = MailOpener:NewModule("OpenAll", "AceEvent-3.0", "AceTimer-3.0");
|
|
Zerotorescue@0
|
3
|
|
Zerotorescue@0
|
4 local MAIL_ITEM_INDEX, mailTimer, inventoryFull, inventoryFullSoundPlayed, opening, lastSync, numCurrentMail, numHiddenMail, continue;
|
|
Zerotorescue@0
|
5
|
|
Zerotorescue@0
|
6 function OpenAll:OnInitialize()
|
|
Zerotorescue@0
|
7 local defaults = {
|
|
Zerotorescue@0
|
8 profile = {
|
|
Zerotorescue@0
|
9 speed = 0.05,
|
|
Zerotorescue@0
|
10 keepFreeSpace = 0,
|
|
Zerotorescue@0
|
11 filter = {
|
|
Zerotorescue@0
|
12 AH = {
|
|
Zerotorescue@0
|
13 canceled = true,
|
|
Zerotorescue@0
|
14 expired = true,
|
|
Zerotorescue@0
|
15 outbid = true,
|
|
Zerotorescue@0
|
16 success = true,
|
|
Zerotorescue@0
|
17 won = true,
|
|
Zerotorescue@0
|
18 },
|
|
Zerotorescue@0
|
19 normalAttachments = false,
|
|
Zerotorescue@0
|
20 normalMoney = true,
|
|
Zerotorescue@0
|
21 },
|
|
Zerotorescue@0
|
22 },
|
|
Zerotorescue@0
|
23 };
|
|
Zerotorescue@0
|
24
|
|
Zerotorescue@0
|
25 -- Register our saved variables NameSpace
|
|
Zerotorescue@0
|
26 self.db = MailOpener.db:RegisterNamespace("OpenAll", defaults);
|
|
Zerotorescue@0
|
27 end
|
|
Zerotorescue@0
|
28
|
|
Zerotorescue@0
|
29 function OpenAll:OnEnable()
|
|
Zerotorescue@0
|
30 self:RegisterEvent("MAIL_SHOW");
|
|
Zerotorescue@0
|
31
|
|
Zerotorescue@0
|
32 if not self.btnOpenAll then
|
|
Zerotorescue@0
|
33 -- Open all button
|
|
Zerotorescue@0
|
34 local button = CreateFrame("Button", "btnMailOpenerOpenAll", InboxFrame, "UIPanelButtonTemplate")
|
|
Zerotorescue@0
|
35 button:SetText("Open all")
|
|
Zerotorescue@0
|
36 button:SetHeight(26)
|
|
Zerotorescue@0
|
37 button:SetWidth(120)
|
|
Zerotorescue@0
|
38 button:SetPoint("BOTTOM", InboxFrame, "CENTER", -10, -165)
|
|
Zerotorescue@0
|
39 button:SetScript("OnClick", function() OpenAll:Open(true) end)
|
|
Zerotorescue@0
|
40
|
|
Zerotorescue@0
|
41 self.btnOpenAll = button;
|
|
Zerotorescue@0
|
42 end
|
|
Zerotorescue@0
|
43
|
|
Zerotorescue@0
|
44 self.btnOpenAll:Show();
|
|
Zerotorescue@0
|
45
|
|
Zerotorescue@0
|
46 if not self.timeLeftFrame then
|
|
Zerotorescue@0
|
47 -- If the timeLeftFrame doesn't exist we will have to build it
|
|
Zerotorescue@0
|
48
|
|
Zerotorescue@0
|
49 self:Debug("Building text frame");
|
|
Zerotorescue@0
|
50
|
|
Zerotorescue@0
|
51 local frame = CreateFrame("Button", "MailOpenerTimeLeftButton", InboxFrame);
|
|
Zerotorescue@0
|
52
|
|
Zerotorescue@0
|
53 -- Mail counter
|
|
Zerotorescue@0
|
54 frame.text = frame:CreateFontString("MailOpenerTimeLeftFrameMailCount", "OVERLAY", "GameFontHighlight");
|
|
Zerotorescue@0
|
55 frame.text:SetPoint("CENTER", MailFrame, "TOPLEFT", 40, -35);
|
|
Zerotorescue@0
|
56
|
|
Zerotorescue@0
|
57 -- Long time left indicator
|
|
Zerotorescue@0
|
58 frame.smallText = frame:CreateFontString("MailOpenerTimeLeftFrameTimeRemaining", "OVERLAY", "GameFontNormal");
|
|
Zerotorescue@0
|
59 frame.smallText:SetFont(GameFontHighlight:GetFont(), 11, "OUTLINE");
|
|
Zerotorescue@0
|
60 frame.smallText:SetPoint("TOPLEFT", MailFrame, "TOPLEFT", 75, -38);
|
|
Zerotorescue@0
|
61 frame.smallText:SetWidth(270);
|
|
Zerotorescue@0
|
62 frame.smallText:SetJustifyH("LEFT");
|
|
Zerotorescue@0
|
63 frame.smallText:SetJustifyV("MIDDLE");
|
|
Zerotorescue@0
|
64
|
|
Zerotorescue@0
|
65 frame:SetPoint("TOPLEFT", MailFrame, "TOPLEFT", 75, -38);
|
|
Zerotorescue@0
|
66 frame:SetWidth(270);
|
|
Zerotorescue@0
|
67 frame:SetHeight(35);
|
|
Zerotorescue@0
|
68 frame:SetScript("OnClick", function(self)
|
|
Zerotorescue@0
|
69 local timeRemainingUntillOpened = frame.smallText:GetText();
|
|
Zerotorescue@0
|
70 if timeRemainingUntillOpened then
|
|
Zerotorescue@0
|
71 MailOpener.currentPopupContents = "|cffffd700" .. timeRemainingUntillOpened .. "|r";
|
|
Zerotorescue@0
|
72
|
|
Zerotorescue@0
|
73 StaticPopup_Show("MailOpenerCopyWindow");
|
|
Zerotorescue@0
|
74 end
|
|
Zerotorescue@0
|
75 end);
|
|
Zerotorescue@0
|
76
|
|
Zerotorescue@0
|
77 self.timeLeftFrame = frame;
|
|
Zerotorescue@0
|
78 end
|
|
Zerotorescue@0
|
79
|
|
Zerotorescue@0
|
80 self.timeLeftFrame:Show();
|
|
Zerotorescue@0
|
81
|
|
Zerotorescue@0
|
82 -- Go through all children of the mail frame to find QA's elements and hide these
|
|
Zerotorescue@0
|
83 local kids = { MailFrame:GetChildren() };
|
|
Zerotorescue@0
|
84
|
|
Zerotorescue@0
|
85 for _, child in ipairs(kids) do
|
|
Zerotorescue@0
|
86 if child and child.text then
|
|
Zerotorescue@0
|
87 child.text:Hide();
|
|
Zerotorescue@0
|
88 end
|
|
Zerotorescue@0
|
89 end
|
|
Zerotorescue@0
|
90
|
|
Zerotorescue@0
|
91 -- If we were toggling this module on while the mailbox is opened we must register all events again
|
|
Zerotorescue@0
|
92 if MailFrame:IsVisible() then
|
|
Zerotorescue@0
|
93 self:MAIL_SHOW();
|
|
Zerotorescue@0
|
94 end
|
|
Zerotorescue@0
|
95 end
|
|
Zerotorescue@0
|
96
|
|
Zerotorescue@0
|
97 function OpenAll:OnDisable()
|
|
Zerotorescue@0
|
98 self:UnregisterEvent("MAIL_SHOW");
|
|
Zerotorescue@0
|
99
|
|
Zerotorescue@0
|
100 if self.btnOpenAll then
|
|
Zerotorescue@0
|
101 self.btnOpenAll:Hide();
|
|
Zerotorescue@0
|
102 end
|
|
Zerotorescue@0
|
103
|
|
Zerotorescue@0
|
104 if self.timeLeftFrame then
|
|
Zerotorescue@0
|
105 self.timeLeftFrame:Hide();
|
|
Zerotorescue@0
|
106 end
|
|
Zerotorescue@0
|
107
|
|
Zerotorescue@0
|
108 if MailOpener.PostalEnabled then
|
|
Zerotorescue@0
|
109 -- Enable Postal's openers again
|
|
Zerotorescue@0
|
110
|
|
Zerotorescue@0
|
111 MailOpener:TogglePostalModule("OpenAll", true);
|
|
Zerotorescue@0
|
112 MailOpener:TogglePostalModule("Select", true);
|
|
Zerotorescue@0
|
113 end
|
|
Zerotorescue@0
|
114
|
|
Zerotorescue@0
|
115 -- Go through all children of the mail frame to find QA's elements and SHOW these
|
|
Zerotorescue@0
|
116 local kids = { MailFrame:GetChildren() };
|
|
Zerotorescue@0
|
117
|
|
Zerotorescue@0
|
118 for _, child in ipairs(kids) do
|
|
Zerotorescue@0
|
119 if child and child.text then
|
|
Zerotorescue@0
|
120 child.text:Show();
|
|
Zerotorescue@0
|
121 end
|
|
Zerotorescue@0
|
122 end
|
|
Zerotorescue@0
|
123
|
|
Zerotorescue@0
|
124 self:Stop();
|
|
Zerotorescue@0
|
125 end
|
|
Zerotorescue@0
|
126
|
|
Zerotorescue@0
|
127 function OpenAll:MAIL_SHOW()
|
|
Zerotorescue@0
|
128 self:Debug("MAIL_SHOW");
|
|
Zerotorescue@0
|
129
|
|
Zerotorescue@0
|
130 self:StopOpening(false);
|
|
Zerotorescue@0
|
131
|
|
Zerotorescue@0
|
132 if MailOpener.PostalEnabled then
|
|
Zerotorescue@0
|
133 -- Disable Postal's openers so we can do it ourselves
|
|
Zerotorescue@0
|
134
|
|
Zerotorescue@0
|
135 MailOpener:TogglePostalModule("OpenAll", false);
|
|
Zerotorescue@0
|
136 MailOpener:TogglePostalModule("Select", false);
|
|
Zerotorescue@0
|
137 end
|
|
Zerotorescue@0
|
138
|
|
Zerotorescue@0
|
139 -- Keep an eye for closing of the mailbox
|
|
Zerotorescue@0
|
140 self:RegisterEvent("MAIL_CLOSED", "Stop");
|
|
Zerotorescue@0
|
141 self:RegisterEvent("PLAYER_LEAVING_WORLD", "Stop");
|
|
Zerotorescue@0
|
142
|
|
Zerotorescue@0
|
143 -- Look if the mailbox is full
|
|
Zerotorescue@0
|
144 self:RegisterEvent("UI_ERROR_MESSAGE");
|
|
Zerotorescue@0
|
145 -- Only look again after bags updated
|
|
Zerotorescue@0
|
146 self:RegisterEvent("BAG_UPDATE");
|
|
Zerotorescue@0
|
147
|
|
Zerotorescue@0
|
148 -- We need to know when to start opening
|
|
Zerotorescue@0
|
149 self:RegisterMessage("MO_OPEN_MAIL", "Open");
|
|
Zerotorescue@0
|
150 self:RegisterMessage("MO_SERVER_SYNCED");
|
|
Zerotorescue@2
|
151 self:RegisterMessage("MO_MAIL_DELETED");
|
|
Zerotorescue@0
|
152
|
|
Zerotorescue@0
|
153 self:CancelTimer(self.tmrTimeRemaining, true);
|
|
Zerotorescue@0
|
154 self.tmrTimeRemaining = self:ScheduleRepeatingTimer("UpdateTimer", 1);
|
|
Zerotorescue@0
|
155 self:UpdateTimer();
|
|
Zerotorescue@0
|
156 end
|
|
Zerotorescue@0
|
157
|
|
Zerotorescue@0
|
158 function OpenAll:Stop()
|
|
Zerotorescue@0
|
159 self:Debug("Stop");
|
|
Zerotorescue@0
|
160
|
|
Zerotorescue@0
|
161 -- We shutdown, so nothing to do when the mailbox is closed anymore
|
|
Zerotorescue@0
|
162 self:UnregisterEvent("MAIL_CLOSED");
|
|
Zerotorescue@0
|
163 self:UnregisterEvent("PLAYER_LEAVING_WORLD");
|
|
Zerotorescue@0
|
164
|
|
Zerotorescue@0
|
165 -- We care about a full inventory just a little
|
|
Zerotorescue@0
|
166 self:UnregisterEvent("UI_ERROR_MESSAGE");
|
|
Zerotorescue@0
|
167 self:UnregisterEvent("BAG_UPDATE");
|
|
Zerotorescue@0
|
168
|
|
Zerotorescue@0
|
169 -- We no longer care
|
|
Zerotorescue@0
|
170 self:UnregisterMessage("MO_OPEN_MAIL");
|
|
Zerotorescue@0
|
171 self:UnregisterMessage("MO_SERVER_SYNCED");
|
|
Zerotorescue@2
|
172 self:UnregisterMessage("MO_MAIL_DELETED");
|
|
Zerotorescue@0
|
173
|
|
Zerotorescue@0
|
174 self:CancelTimer(self.tmrMailOpener, true);
|
|
Zerotorescue@0
|
175 self:CancelTimer(self.tmrTimeRemaining, true);
|
|
Zerotorescue@0
|
176
|
|
Zerotorescue@0
|
177 self:SetOpeningStatus(false);
|
|
Zerotorescue@0
|
178 end
|
|
Zerotorescue@0
|
179
|
|
Zerotorescue@0
|
180 function OpenAll:MO_SERVER_SYNCED()
|
|
Zerotorescue@0
|
181 self:Debug("MO_SERVER_SYNCED");
|
|
Zerotorescue@0
|
182
|
|
Zerotorescue@2
|
183 -- Stop opening now to prevent the opener from continue while Beancounter is counting
|
|
Zerotorescue@2
|
184 self:StopOpening(false);
|
|
Zerotorescue@2
|
185
|
|
Zerotorescue@0
|
186 lastSync = GetTime();
|
|
Zerotorescue@0
|
187
|
|
Zerotorescue@2
|
188 self:UpdateMailCount();
|
|
Zerotorescue@2
|
189 end
|
|
Zerotorescue@2
|
190
|
|
Zerotorescue@2
|
191 function OpenAll:MO_MAIL_DELETED()
|
|
Zerotorescue@2
|
192 self:Debug("MO_MAIL_DELETED");
|
|
Zerotorescue@2
|
193
|
|
Zerotorescue@2
|
194 -- A mail has been deleted so we can process the next
|
|
Zerotorescue@2
|
195 continue = true;
|
|
Zerotorescue@2
|
196
|
|
Zerotorescue@2
|
197 self:UpdateMailCount();
|
|
Zerotorescue@2
|
198 end
|
|
Zerotorescue@2
|
199
|
|
Zerotorescue@2
|
200 function OpenAll:UpdateMailCount()
|
|
Zerotorescue@0
|
201 local numItems, totalItems = GetInboxNumItems();
|
|
Zerotorescue@0
|
202
|
|
Zerotorescue@0
|
203 numCurrentMail = numItems;
|
|
Zerotorescue@0
|
204 numHiddenMail = ( totalItems - numItems );
|
|
Zerotorescue@2
|
205
|
|
Zerotorescue@2
|
206 self:UpdateTimer();
|
|
Zerotorescue@0
|
207 end
|
|
Zerotorescue@0
|
208
|
|
Zerotorescue@0
|
209 function OpenAll:BAG_UPDATE()
|
|
Zerotorescue@0
|
210 -- If the bags are updated we should check if the inventory is full again
|
|
Zerotorescue@0
|
211 inventoryFull = false;
|
|
Zerotorescue@1
|
212 -- Replay sound
|
|
Zerotorescue@1
|
213 inventoryFullSoundPlayed = nil;
|
|
Zerotorescue@0
|
214 end
|
|
Zerotorescue@0
|
215
|
|
Zerotorescue@0
|
216 -- We registered this event to look for the inventory full error message because this is faster than counting the amount of items in the inventory all the time
|
|
Zerotorescue@0
|
217 function OpenAll:UI_ERROR_MESSAGE(e, errorMessage)
|
|
Zerotorescue@0
|
218 if errorMessage == ERR_INV_FULL then
|
|
Zerotorescue@0
|
219 -- Inventory is full.
|
|
Zerotorescue@0
|
220
|
|
Zerotorescue@0
|
221 if not inventoryFull then
|
|
Zerotorescue@0
|
222 inventoryFull = true;
|
|
Zerotorescue@0
|
223
|
|
Zerotorescue@0
|
224 -- Play the sound
|
|
Zerotorescue@0
|
225 if MailOpener.db.profile.notifications.bagsFullSound and (not MailOpener.db.profile.notifications.bagsFullSoundOnlyOnce or not inventoryFullSoundPlayed) then
|
|
Zerotorescue@0
|
226 PlaySoundFile(MailOpener.db.profile.notifications.bagsFullSoundFile);
|
|
Zerotorescue@0
|
227 inventoryFullSoundPlayed = true;
|
|
Zerotorescue@0
|
228 end
|
|
Zerotorescue@0
|
229 end
|
|
Zerotorescue@0
|
230
|
|
Zerotorescue@0
|
231 -- Continue opening mail (we still want to open gold mail)
|
|
Zerotorescue@0
|
232 continue = true;
|
|
Zerotorescue@0
|
233 elseif errorMessage == ERR_ITEM_MAX_COUNT or errorMessage == ERR_MAIL_DATABASE_ERROR then
|
|
Zerotorescue@0
|
234 -- Can't carry more of this item OR mail database error
|
|
Zerotorescue@0
|
235
|
|
Zerotorescue@0
|
236 -- Continue opening mail (we still want to retrieve other items or gold)
|
|
Zerotorescue@0
|
237 continue = true;
|
|
Zerotorescue@0
|
238 end
|
|
Zerotorescue@0
|
239 end
|
|
Zerotorescue@0
|
240
|
|
Zerotorescue@0
|
241 function OpenAll:Open(forced)
|
|
Zerotorescue@0
|
242 self:Debug("Open");
|
|
Zerotorescue@0
|
243
|
|
Zerotorescue@0
|
244 if not opening or forced == true then
|
|
Zerotorescue@0
|
245 local numItems, totalItems = GetInboxNumItems();
|
|
Zerotorescue@0
|
246 -- Start at the end, add one because OpenNext will take it away again
|
|
Zerotorescue@0
|
247 local newMailItemIndex = ( ( numItems or 0 ) + 1 );
|
|
Zerotorescue@0
|
248
|
|
Zerotorescue@0
|
249 if newMailItemIndex > 1 then
|
|
Zerotorescue@0
|
250 self:Debug("Open succes");
|
|
Zerotorescue@0
|
251
|
|
Zerotorescue@0
|
252 -- Stop the previous opening and restart
|
|
Zerotorescue@0
|
253 if forced == true then
|
|
Zerotorescue@0
|
254 self:StopOpening(false); -- this is not a "simple" stop, so also reset inventory full warning
|
|
Zerotorescue@0
|
255 else
|
|
Zerotorescue@0
|
256 self:StopOpening(true); -- forced is false - automated action - simple reset, skip inventory full reset to avoid sound spam
|
|
Zerotorescue@0
|
257 end
|
|
Zerotorescue@0
|
258
|
|
Zerotorescue@0
|
259 -- Update the caret
|
|
Zerotorescue@0
|
260 MAIL_ITEM_INDEX = newMailItemIndex;
|
|
Zerotorescue@0
|
261
|
|
Zerotorescue@0
|
262 -- We're now going to be busy again
|
|
Zerotorescue@0
|
263 self:SetOpeningStatus(true);
|
|
Zerotorescue@0
|
264
|
|
Zerotorescue@0
|
265 -- Open the next mail in line
|
|
Zerotorescue@0
|
266 self:OpenNext();
|
|
Zerotorescue@0
|
267 else
|
|
Zerotorescue@0
|
268 if MailOpener.db.profile.notifications.mailboxIsEmpty then
|
|
Zerotorescue@0
|
269 print("|cffff0000There is currently no mail available.|r");
|
|
Zerotorescue@0
|
270 end
|
|
Zerotorescue@0
|
271
|
|
Zerotorescue@0
|
272 self:Debug("MO_OPEN_COMPLETE");
|
|
Zerotorescue@0
|
273
|
|
Zerotorescue@0
|
274 -- Report that we're all done
|
|
Zerotorescue@0
|
275 self:SendMessage("MO_OPEN_COMPLETE");
|
|
Zerotorescue@0
|
276 end
|
|
Zerotorescue@0
|
277 end
|
|
Zerotorescue@0
|
278 end
|
|
Zerotorescue@0
|
279
|
|
Zerotorescue@0
|
280 -- Return the type of mail a message subject is
|
|
Zerotorescue@0
|
281 local knownAHSubjectPatterns = {
|
|
Zerotorescue@0
|
282 canceled = AUCTION_REMOVED_MAIL_SUBJECT:replace("%s", ""),
|
|
Zerotorescue@0
|
283 expired = AUCTION_EXPIRED_MAIL_SUBJECT:replace("%s", ""),
|
|
Zerotorescue@0
|
284 outbid = AUCTION_OUTBID_MAIL_SUBJECT:replace("%s", ""),
|
|
Zerotorescue@0
|
285 success = AUCTION_SOLD_MAIL_SUBJECT:replace("%s", ""),
|
|
Zerotorescue@0
|
286 won = AUCTION_WON_MAIL_SUBJECT:replace("%s", ""),
|
|
Zerotorescue@0
|
287 };
|
|
Zerotorescue@0
|
288 function OpenAll:GetAuctionMailType(subject)
|
|
Zerotorescue@0
|
289 if subject then
|
|
Zerotorescue@0
|
290 -- Check if any of our patterns match, sorted by most likely matches first (if one is true the rest shouldn't be evaluated)
|
|
Zerotorescue@0
|
291 if subject:find(knownAHSubjectPatterns.expired) then
|
|
Zerotorescue@0
|
292 return "expired";
|
|
Zerotorescue@0
|
293 elseif subject:find(knownAHSubjectPatterns.success) then
|
|
Zerotorescue@0
|
294 return "success";
|
|
Zerotorescue@0
|
295 elseif subject:find(knownAHSubjectPatterns.won) then
|
|
Zerotorescue@0
|
296 return "won";
|
|
Zerotorescue@0
|
297 elseif subject:find(knownAHSubjectPatterns.canceled) then
|
|
Zerotorescue@0
|
298 return "canceled";
|
|
Zerotorescue@0
|
299 elseif subject:find(knownAHSubjectPatterns.outbid) then
|
|
Zerotorescue@0
|
300 return "outbid";
|
|
Zerotorescue@0
|
301 end
|
|
Zerotorescue@0
|
302 end
|
|
Zerotorescue@0
|
303
|
|
Zerotorescue@0
|
304 return; -- not auction mail
|
|
Zerotorescue@0
|
305 end
|
|
Zerotorescue@0
|
306
|
|
Zerotorescue@0
|
307 function OpenAll:OpenMail(index)
|
|
Zerotorescue@0
|
308 if index > 0 then
|
|
Zerotorescue@0
|
309 -- LUA arrays start at 1, so mail with index 0 doesn't exist, so we're finished
|
|
Zerotorescue@0
|
310
|
|
Zerotorescue@0
|
311 local sender, subject, gold, cod, _, items, _, _, _, _, isGM = select(3, GetInboxHeaderInfo(index));
|
|
Zerotorescue@0
|
312 local auctionMailType = self:GetAuctionMailType(subject);
|
|
Zerotorescue@0
|
313
|
|
Zerotorescue@0
|
314 if isGM then
|
|
Zerotorescue@0
|
315 -- GM Mail
|
|
Zerotorescue@0
|
316 if MailOpener.db.profile.notifications.skipped.all and MailOpener.db.profile.notifications.skipped.GMMail then
|
|
Zerotorescue@0
|
317 print("Skipping " .. index .. ": " .. subject .. " (GM mail)");
|
|
Zerotorescue@0
|
318 end
|
|
Zerotorescue@0
|
319
|
|
Zerotorescue@0
|
320 self:OpenNext();
|
|
Zerotorescue@0
|
321
|
|
Zerotorescue@0
|
322 return;
|
|
Zerotorescue@0
|
323 elseif cod and cod > 0 then
|
|
Zerotorescue@0
|
324 -- Cost on delivery
|
|
Zerotorescue@0
|
325 if MailOpener.db.profile.notifications.skipped.all and MailOpener.db.profile.notifications.skipped.COD then
|
|
Zerotorescue@0
|
326 print("Skipping " .. index .. ": " .. subject .. " (C.O.D.)");
|
|
Zerotorescue@0
|
327 end
|
|
Zerotorescue@0
|
328
|
|
Zerotorescue@0
|
329 self:OpenNext();
|
|
Zerotorescue@0
|
330
|
|
Zerotorescue@0
|
331 return;
|
|
Zerotorescue@0
|
332 elseif ((gold and gold > 0) or (items and items > 0)) then
|
|
Zerotorescue@0
|
333 -- Mail with some sort of attachments
|
|
Zerotorescue@0
|
334
|
|
Zerotorescue@0
|
335 local slotsAvailable = 0;
|
|
Zerotorescue@0
|
336 if self.db.profile.keepFreeSpace > 0 then
|
|
Zerotorescue@0
|
337 for bag = 0, 4 do
|
|
Zerotorescue@0
|
338 local numberOfFreeSlots = GetContainerNumFreeSlots(bag);
|
|
Zerotorescue@0
|
339 slotsAvailable = ( slotsAvailable + numberOfFreeSlots );
|
|
Zerotorescue@0
|
340 end
|
|
Zerotorescue@0
|
341 end
|
|
Zerotorescue@0
|
342
|
|
Zerotorescue@0
|
343 if inventoryFull and not MailOpener.db.profile.general.continueOpeningStackableItems and items and items > 0 then
|
|
Zerotorescue@0
|
344 if MailOpener.db.profile.notifications.skipped.all and MailOpener.db.profile.notifications.skipped.inventoryFull then
|
|
Zerotorescue@0
|
345 print("Skipping " .. index .. ": " .. subject .. " (inventory is full)");
|
|
Zerotorescue@0
|
346 end
|
|
Zerotorescue@0
|
347
|
|
Zerotorescue@0
|
348 self:OpenNext();
|
|
Zerotorescue@0
|
349
|
|
Zerotorescue@0
|
350 return;
|
|
Zerotorescue@0
|
351 elseif self.db.profile.keepFreeSpace > 0 and items and ( slotsAvailable - items ) < self.db.profile.keepFreeSpace then
|
|
Zerotorescue@0
|
352 if MailOpener.db.profile.notifications.skipped.all and MailOpener.db.profile.notifications.skipped.keepFreeSpaceLimit then
|
|
Zerotorescue@0
|
353 print("Skipping " .. index .. ": " .. subject .. " (keep free space limit)");
|
|
Zerotorescue@0
|
354 end
|
|
Zerotorescue@0
|
355
|
|
Zerotorescue@0
|
356 self:OpenNext();
|
|
Zerotorescue@0
|
357
|
|
Zerotorescue@0
|
358 return;
|
|
Zerotorescue@0
|
359 else
|
|
Zerotorescue@0
|
360 -- This string will hold the mailtype, MailOpener.db.profile.notifications.skipped/processed[mailType] will be checked if this should be announced
|
|
Zerotorescue@0
|
361 local mailType = "other";
|
|
Zerotorescue@0
|
362
|
|
Zerotorescue@0
|
363 if not auctionMailType then
|
|
Zerotorescue@0
|
364 -- This is a normal mail
|
|
Zerotorescue@0
|
365
|
|
Zerotorescue@0
|
366 if gold and gold > 0 then
|
|
Zerotorescue@0
|
367 mailType = "normalGoldMail";
|
|
Zerotorescue@0
|
368 elseif items and items > 0 then
|
|
Zerotorescue@0
|
369 mailType = "normalItemsMail";
|
|
Zerotorescue@0
|
370 end
|
|
Zerotorescue@0
|
371 else
|
|
Zerotorescue@0
|
372 -- This is an auction house mail
|
|
Zerotorescue@0
|
373
|
|
Zerotorescue@0
|
374 mailType = "AH" .. auctionMailType;
|
|
Zerotorescue@0
|
375 end
|
|
Zerotorescue@0
|
376
|
|
Zerotorescue@0
|
377 if not self.db.profile.filter.normalMoney and mailType == "normalGoldMail" then
|
|
Zerotorescue@0
|
378 if MailOpener.db.profile.notifications.skipped.all and MailOpener.db.profile.notifications.skipped[mailType] then
|
|
Zerotorescue@0
|
379 print("Skipping " .. index .. ": " .. subject .. " (normal mail with gold)");
|
|
Zerotorescue@0
|
380 end
|
|
Zerotorescue@0
|
381
|
|
Zerotorescue@0
|
382 self:OpenNext();
|
|
Zerotorescue@0
|
383
|
|
Zerotorescue@0
|
384 return;
|
|
Zerotorescue@0
|
385 elseif not self.db.profile.filter.normalAttachments and mailType == "normalItemsMail" then
|
|
Zerotorescue@0
|
386 if MailOpener.db.profile.notifications.skipped.all and MailOpener.db.profile.notifications.skipped[mailType] then
|
|
Zerotorescue@0
|
387 print("Skipping " .. index .. ": " .. subject .. " (normal mail with attachments)");
|
|
Zerotorescue@0
|
388 end
|
|
Zerotorescue@0
|
389
|
|
Zerotorescue@0
|
390 self:OpenNext();
|
|
Zerotorescue@0
|
391
|
|
Zerotorescue@0
|
392 return;
|
|
Zerotorescue@0
|
393 elseif not self.db.profile.filter.AH.expired and mailType == "AHexpired" then
|
|
Zerotorescue@0
|
394 if MailOpener.db.profile.notifications.skipped.all and MailOpener.db.profile.notifications.skipped[mailType] then
|
|
Zerotorescue@0
|
395 print("Skipping " .. index .. ": " .. subject .. " (expired auction)");
|
|
Zerotorescue@0
|
396 end
|
|
Zerotorescue@0
|
397
|
|
Zerotorescue@0
|
398 self:OpenNext();
|
|
Zerotorescue@0
|
399
|
|
Zerotorescue@0
|
400 return;
|
|
Zerotorescue@0
|
401 elseif not self.db.profile.filter.AH.success and mailType == "AHsuccess" then
|
|
Zerotorescue@0
|
402 if MailOpener.db.profile.notifications.skipped.all and MailOpener.db.profile.notifications.skipped[mailType] then
|
|
Zerotorescue@0
|
403 print("Skipping " .. index .. ": " .. subject .. " (successful auction)");
|
|
Zerotorescue@0
|
404 end
|
|
Zerotorescue@0
|
405
|
|
Zerotorescue@0
|
406 self:OpenNext();
|
|
Zerotorescue@0
|
407
|
|
Zerotorescue@0
|
408 return;
|
|
Zerotorescue@0
|
409 elseif not self.db.profile.filter.AH.won and mailType == "AHwon" then
|
|
Zerotorescue@0
|
410 if MailOpener.db.profile.notifications.skipped.all and MailOpener.db.profile.notifications.skipped[mailType] then
|
|
Zerotorescue@0
|
411 print("Skipping " .. index .. ": " .. subject .. " (auction won)");
|
|
Zerotorescue@0
|
412 end
|
|
Zerotorescue@0
|
413
|
|
Zerotorescue@0
|
414 self:OpenNext();
|
|
Zerotorescue@0
|
415
|
|
Zerotorescue@0
|
416 return;
|
|
Zerotorescue@0
|
417 elseif not self.db.profile.filter.AH.canceled and mailType == "AHcanceled" then
|
|
Zerotorescue@0
|
418 if MailOpener.db.profile.notifications.skipped.all and MailOpener.db.profile.notifications.skipped[mailType] then
|
|
Zerotorescue@0
|
419 print("Skipping " .. index .. ": " .. subject .. " (canceled auction)");
|
|
Zerotorescue@0
|
420 end
|
|
Zerotorescue@0
|
421
|
|
Zerotorescue@0
|
422 self:OpenNext();
|
|
Zerotorescue@0
|
423
|
|
Zerotorescue@0
|
424 return;
|
|
Zerotorescue@0
|
425 elseif not self.db.profile.filter.AH.outbid and mailType == "AHoutbid" then
|
|
Zerotorescue@0
|
426 if MailOpener.db.profile.notifications.skipped.all and MailOpener.db.profile.notifications.skipped[mailType] then
|
|
Zerotorescue@0
|
427 print("Skipping " .. index .. ": " .. subject .. " (outbid on auction)");
|
|
Zerotorescue@0
|
428 end
|
|
Zerotorescue@0
|
429
|
|
Zerotorescue@0
|
430 self:OpenNext();
|
|
Zerotorescue@0
|
431
|
|
Zerotorescue@0
|
432 return;
|
|
Zerotorescue@0
|
433 else
|
|
Zerotorescue@0
|
434 continue = false;
|
|
Zerotorescue@0
|
435
|
|
Zerotorescue@2
|
436 -- Notifiy other modules of opening
|
|
Zerotorescue@2
|
437 self:SendMessage("MO_OPENING_MAIL");
|
|
Zerotorescue@2
|
438
|
|
Zerotorescue@0
|
439 -- Open current mail
|
|
Zerotorescue@0
|
440 AutoLootMailItem(index);
|
|
Zerotorescue@0
|
441
|
|
Zerotorescue@0
|
442 if MailOpener.db.profile.notifications.processed.all and MailOpener.db.profile.notifications.processed[mailType] then
|
|
Zerotorescue@0
|
443 if gold and gold > 0 then
|
|
Zerotorescue@0
|
444 print("Processing " .. index .. ": " .. subject .. " (" .. MailOpener:FormatMoney(gold) .. ")");
|
|
Zerotorescue@0
|
445 else
|
|
Zerotorescue@0
|
446 print("Processing " .. index .. ": " .. subject);
|
|
Zerotorescue@0
|
447 end
|
|
Zerotorescue@0
|
448 end
|
|
Zerotorescue@0
|
449
|
|
Zerotorescue@0
|
450 -- And prepare for the next
|
|
Zerotorescue@0
|
451 self.tmrMailOpener = self:ScheduleTimer("OpenNext", self.db.profile.speed);
|
|
Zerotorescue@0
|
452 end
|
|
Zerotorescue@0
|
453 end
|
|
Zerotorescue@0
|
454 else
|
|
Zerotorescue@0
|
455 -- Unknown, probably just text
|
|
Zerotorescue@0
|
456 if MailOpener.db.profile.notifications.skipped.all and MailOpener.db.profile.notifications.skipped.other then
|
|
Zerotorescue@0
|
457 if subject then
|
|
Zerotorescue@0
|
458 print("Skipping " .. index .. ": " .. subject);
|
|
Zerotorescue@0
|
459 else
|
|
Zerotorescue@0
|
460 print("Skipping " .. index);
|
|
Zerotorescue@0
|
461 end
|
|
Zerotorescue@0
|
462 end
|
|
Zerotorescue@0
|
463
|
|
Zerotorescue@0
|
464 self:OpenNext();
|
|
Zerotorescue@0
|
465 end
|
|
Zerotorescue@0
|
466 else
|
|
Zerotorescue@0
|
467 -- Finished!
|
|
Zerotorescue@0
|
468 if MailOpener.db.profile.notifications.finishedCurrentBatch then
|
|
Zerotorescue@0
|
469 print("Finished opening the current batch.");
|
|
Zerotorescue@0
|
470 end
|
|
Zerotorescue@0
|
471
|
|
Zerotorescue@0
|
472 self:SetOpeningStatus(false);
|
|
Zerotorescue@0
|
473
|
|
Zerotorescue@0
|
474 self:Debug("MO_OPEN_COMPLETE");
|
|
Zerotorescue@0
|
475
|
|
Zerotorescue@0
|
476 -- Report that we're all done
|
|
Zerotorescue@0
|
477 self:SendMessage("MO_OPEN_COMPLETE");
|
|
Zerotorescue@0
|
478 end
|
|
Zerotorescue@0
|
479 end
|
|
Zerotorescue@0
|
480
|
|
Zerotorescue@0
|
481 function OpenAll:OpenNext()
|
|
Zerotorescue@0
|
482 if continue then
|
|
Zerotorescue@0
|
483 -- If the previous mail was opened successful, open the next
|
|
Zerotorescue@0
|
484
|
|
Zerotorescue@0
|
485 -- Next mail in line
|
|
Zerotorescue@0
|
486 MAIL_ITEM_INDEX = ( MAIL_ITEM_INDEX - 1 );
|
|
Zerotorescue@0
|
487
|
|
Zerotorescue@0
|
488 -- Open it
|
|
Zerotorescue@0
|
489 self:OpenMail(MAIL_ITEM_INDEX);
|
|
Zerotorescue@0
|
490 else
|
|
Zerotorescue@0
|
491 -- Try again at the next interval
|
|
Zerotorescue@0
|
492
|
|
Zerotorescue@0
|
493 self.tmrMailOpener = self:ScheduleTimer("OpenNext", self.db.profile.speed);
|
|
Zerotorescue@0
|
494 end
|
|
Zerotorescue@0
|
495 end
|
|
Zerotorescue@0
|
496
|
|
Zerotorescue@2
|
497 function OpenAll:Continue()
|
|
Zerotorescue@2
|
498 continue = true;
|
|
Zerotorescue@2
|
499 self:OpenNext();
|
|
Zerotorescue@2
|
500 end
|
|
Zerotorescue@2
|
501
|
|
Zerotorescue@0
|
502 local mailRemainingPatterns = {
|
|
Zerotorescue@0
|
503 minutesSeconds = "|cffffffff%d|r/|cffffffff%d|r mail remaining, opening everything will take about |cffffffff%d|r minutes and |cffffffff%d|r seconds (next refresh in |cffffffff%d|r seconds)";
|
|
Zerotorescue@0
|
504 minutes = "|cffffffff%d|r/|cffffffff%d|r mail remaining, opening everything will take about |cffffffff%d|r minutes (next refresh in |cffffffff%d|r seconds)";
|
|
Zerotorescue@0
|
505 seconds = "|cffffffff%d|r/|cffffffff%d|r mail remaining, opening everything will take about |cffffffff%d|r seconds (next refresh in |cffffffff%d|r seconds)";
|
|
Zerotorescue@0
|
506 waitingBatch = "|cffffffff%d|r/|cffffffff%d|r mail remaining - waiting for something from the current batch to be opened...";
|
|
Zerotorescue@0
|
507 waitingSync = "|cffffffff%d|r/|cffffffff%d|r mail remaining - waiting for the next mailbox refresh...";
|
|
Zerotorescue@0
|
508 soon = "|cffffffff%d|r/|cffffffff%d|r mail remaining - everything will be opened soon...";
|
|
Zerotorescue@0
|
509 };
|
|
Zerotorescue@0
|
510
|
|
Zerotorescue@0
|
511 function OpenAll:UpdateTimer()
|
|
Zerotorescue@0
|
512 if lastSync then
|
|
Zerotorescue@0
|
513 -- Calculate the total amount of mail waiting
|
|
Zerotorescue@0
|
514 local numTotalMail = ( numHiddenMail + numCurrentMail );
|
|
Zerotorescue@0
|
515
|
|
Zerotorescue@0
|
516 -- Resize the font based on mail left so the counter always fits perfectly
|
|
Zerotorescue@0
|
517 if numTotalMail < 100 then
|
|
Zerotorescue@0
|
518 self.timeLeftFrame.text:SetFont(GameFontHighlight:GetFont(), 30, "THICKOUTLINE");
|
|
Zerotorescue@0
|
519 elseif numTotalMail < 1000 then
|
|
Zerotorescue@0
|
520 self.timeLeftFrame.text:SetFont(GameFontHighlight:GetFont(), 24, "THICKOUTLINE");
|
|
Zerotorescue@0
|
521 else
|
|
Zerotorescue@0
|
522 self.timeLeftFrame.text:SetFont(GameFontHighlight:GetFont(), 18, "THICKOUTLINE");
|
|
Zerotorescue@0
|
523 end
|
|
Zerotorescue@0
|
524 self.timeLeftFrame.text:SetText(numTotalMail);
|
|
Zerotorescue@0
|
525
|
|
Zerotorescue@0
|
526 if numHiddenMail > 0 then
|
|
Zerotorescue@0
|
527 -- Calculate the next server sync based on the last server sync plus sync interval
|
|
Zerotorescue@0
|
528 local nextSync = ( lastSync + 61 );
|
|
Zerotorescue@0
|
529
|
|
Zerotorescue@0
|
530 -- Calculate the timer remaining untill the next sync
|
|
Zerotorescue@0
|
531 local timeRemaining = floor( nextSync - GetTime() );
|
|
Zerotorescue@0
|
532 -- If the next sync was already due, our nextSync calculation was wrong and we must wait a little longer (lag?)
|
|
Zerotorescue@0
|
533 local syncTimeOut = false;
|
|
Zerotorescue@0
|
534 -- If time remaining is below 0, next sync should be soon
|
|
Zerotorescue@0
|
535 if timeRemaining < 0 then
|
|
Zerotorescue@0
|
536 timeRemaining = 0;
|
|
Zerotorescue@0
|
537 syncTimeOut = true;
|
|
Zerotorescue@0
|
538 end
|
|
Zerotorescue@0
|
539
|
|
Zerotorescue@0
|
540 -- Calculate the amount of server syncs required to open all mail
|
|
Zerotorescue@0
|
541 local syncsRequired = ceil( numHiddenMail / 50 );
|
|
Zerotorescue@0
|
542 -- Calculate the time required to execute all these syncs
|
|
Zerotorescue@0
|
543 local timeRequired = ( ( syncsRequired - 1 ) * 61 ) + timeRemaining;
|
|
Zerotorescue@0
|
544
|
|
Zerotorescue@0
|
545 local minutes = floor( timeRequired / 60 );
|
|
Zerotorescue@0
|
546 local seconds = floor( timeRequired % 60 );
|
|
Zerotorescue@0
|
547
|
|
Zerotorescue@0
|
548 local remainingText;
|
|
Zerotorescue@0
|
549 if syncTimeOut then
|
|
Zerotorescue@0
|
550 if numCurrentMail == 50 then
|
|
Zerotorescue@0
|
551 remainingText = format(mailRemainingPatterns.waitingBatch, numCurrentMail, numTotalMail);
|
|
Zerotorescue@0
|
552 else
|
|
Zerotorescue@0
|
553 remainingText = format(mailRemainingPatterns.waitingSync, numCurrentMail, numTotalMail);
|
|
Zerotorescue@0
|
554 end
|
|
Zerotorescue@0
|
555 elseif minutes ~= 0 then
|
|
Zerotorescue@0
|
556 if seconds ~= 0 then
|
|
Zerotorescue@0
|
557 remainingText = format(mailRemainingPatterns.minutesSeconds, numCurrentMail, numTotalMail, minutes, seconds, timeRemaining);
|
|
Zerotorescue@0
|
558 else
|
|
Zerotorescue@0
|
559 remainingText = format(mailRemainingPatterns.minutes, numCurrentMail, numTotalMail, minutes, timeRemaining);
|
|
Zerotorescue@0
|
560 end
|
|
Zerotorescue@0
|
561 elseif seconds ~= 0 then
|
|
Zerotorescue@0
|
562 remainingText = format(mailRemainingPatterns.seconds, numCurrentMail, numTotalMail, seconds, timeRemaining);
|
|
Zerotorescue@0
|
563 else
|
|
Zerotorescue@0
|
564 remainingText = format(mailRemainingPatterns.soon, numCurrentMail, numTotalMail);
|
|
Zerotorescue@0
|
565 end
|
|
Zerotorescue@0
|
566
|
|
Zerotorescue@0
|
567 self.timeLeftFrame.smallText:SetText(remainingText);
|
|
Zerotorescue@0
|
568 elseif numHiddenMail == 0 then
|
|
Zerotorescue@0
|
569 self.timeLeftFrame.smallText:SetText("");
|
|
Zerotorescue@0
|
570 end
|
|
Zerotorescue@0
|
571 end
|
|
Zerotorescue@0
|
572 end
|
|
Zerotorescue@0
|
573
|
|
Zerotorescue@0
|
574 function OpenAll:StopOpening(simple)
|
|
Zerotorescue@2
|
575 -- Stop opener timer
|
|
Zerotorescue@2
|
576 self:CancelTimer(self.tmrMailOpener, true);
|
|
Zerotorescue@2
|
577
|
|
Zerotorescue@0
|
578 if not simple then
|
|
Zerotorescue@2
|
579 -- A simple stop is an automated stop, an advance stop is one manually or after a sever sync
|
|
Zerotorescue@2
|
580
|
|
Zerotorescue@0
|
581 -- Recheck inventory full
|
|
Zerotorescue@0
|
582 inventoryFull = false;
|
|
Zerotorescue@0
|
583 -- Replay sound
|
|
Zerotorescue@0
|
584 inventoryFullSoundPlayed = nil;
|
|
Zerotorescue@0
|
585 end
|
|
Zerotorescue@0
|
586
|
|
Zerotorescue@0
|
587 -- Reset opener position
|
|
Zerotorescue@0
|
588 MAIL_ITEM_INDEX = 0;
|
|
Zerotorescue@0
|
589 -- Stopped opening, so allow to continue
|
|
Zerotorescue@0
|
590 continue = true;
|
|
Zerotorescue@0
|
591 self:SetOpeningStatus(false);
|
|
Zerotorescue@0
|
592 end
|
|
Zerotorescue@0
|
593
|
|
Zerotorescue@0
|
594 function OpenAll:SetOpeningStatus(openingStatus)
|
|
Zerotorescue@0
|
595 opening = openingStatus;
|
|
Zerotorescue@0
|
596
|
|
Zerotorescue@0
|
597 if openingStatus then
|
|
Zerotorescue@0
|
598 self.btnOpenAll:SetText("Opening...");
|
|
Zerotorescue@0
|
599 else
|
|
Zerotorescue@0
|
600 self.btnOpenAll:SetText("Open all");
|
|
Zerotorescue@0
|
601 end
|
|
Zerotorescue@0
|
602 end
|
|
Zerotorescue@0
|
603
|
|
Zerotorescue@0
|
604 function OpenAll:GetOptionsGroup()
|
|
Zerotorescue@0
|
605 local configGroup = {
|
|
Zerotorescue@0
|
606 order = 300,
|
|
Zerotorescue@0
|
607 type = "group",
|
|
Zerotorescue@0
|
608 name = "Open All",
|
|
Zerotorescue@0
|
609 desc = "Change open all settings.",
|
|
Zerotorescue@0
|
610 args = {
|
|
Zerotorescue@0
|
611 filters = {
|
|
Zerotorescue@0
|
612 order = 10,
|
|
Zerotorescue@0
|
613 type = "group",
|
|
Zerotorescue@0
|
614 inline = true,
|
|
Zerotorescue@0
|
615 name = "Filters",
|
|
Zerotorescue@0
|
616 args = {
|
|
Zerotorescue@0
|
617 description = {
|
|
Zerotorescue@0
|
618 order = 10,
|
|
Zerotorescue@0
|
619 type = "description",
|
|
Zerotorescue@0
|
620 name = "Toggle which mail the opener should autoloot.",
|
|
Zerotorescue@0
|
621 },
|
|
Zerotorescue@0
|
622 AHHeader = {
|
|
Zerotorescue@0
|
623 order = 15,
|
|
Zerotorescue@0
|
624 type = "header",
|
|
Zerotorescue@0
|
625 name = "Auction House Mail",
|
|
Zerotorescue@0
|
626 },
|
|
Zerotorescue@0
|
627 canceled = {
|
|
Zerotorescue@0
|
628 order = 20,
|
|
Zerotorescue@0
|
629 type = "toggle",
|
|
Zerotorescue@0
|
630 name = "Open all |cfffed000auction canceled|r mail",
|
|
Zerotorescue@0
|
631 desc = "Automatically loot all auction canceled mails from the auction house.",
|
|
Zerotorescue@0
|
632 set = function(i, v) self.db.profile.filter.AH.canceled = v; end,
|
|
Zerotorescue@0
|
633 get = function() return self.db.profile.filter.AH.canceled; end,
|
|
Zerotorescue@0
|
634 width = "double",
|
|
Zerotorescue@0
|
635 },
|
|
Zerotorescue@0
|
636 expired = {
|
|
Zerotorescue@0
|
637 order = 21,
|
|
Zerotorescue@0
|
638 type = "toggle",
|
|
Zerotorescue@0
|
639 name = "Open all |cfffed000auction expired|r mail",
|
|
Zerotorescue@0
|
640 desc = "Automatically loot all auction canceled mails from the auction house.",
|
|
Zerotorescue@0
|
641 set = function(i, v) self.db.profile.filter.AH.expired = v; end,
|
|
Zerotorescue@0
|
642 get = function() return self.db.profile.filter.AH.expired; end,
|
|
Zerotorescue@0
|
643 width = "double",
|
|
Zerotorescue@0
|
644 },
|
|
Zerotorescue@0
|
645 outbid = {
|
|
Zerotorescue@0
|
646 order = 22,
|
|
Zerotorescue@0
|
647 type = "toggle",
|
|
Zerotorescue@0
|
648 name = "Open all |cfffed000outbid on|r mail",
|
|
Zerotorescue@0
|
649 desc = "Automatically loot all auction outbid mails from the auction house.",
|
|
Zerotorescue@0
|
650 set = function(i, v) self.db.profile.filter.AH.outbid = v; end,
|
|
Zerotorescue@0
|
651 get = function() return self.db.profile.filter.AH.outbid; end,
|
|
Zerotorescue@0
|
652 width = "double",
|
|
Zerotorescue@0
|
653 },
|
|
Zerotorescue@0
|
654 success = {
|
|
Zerotorescue@0
|
655 order = 23,
|
|
Zerotorescue@0
|
656 type = "toggle",
|
|
Zerotorescue@0
|
657 name = "Open all |cfffed000auction successful|r mail",
|
|
Zerotorescue@0
|
658 desc = "Automatically loot all auction successful mails from the auction house.",
|
|
Zerotorescue@0
|
659 set = function(i, v) self.db.profile.filter.AH.success = v; end,
|
|
Zerotorescue@0
|
660 get = function() return self.db.profile.filter.AH.success; end,
|
|
Zerotorescue@0
|
661 width = "double",
|
|
Zerotorescue@0
|
662 },
|
|
Zerotorescue@0
|
663 won = {
|
|
Zerotorescue@0
|
664 order = 24,
|
|
Zerotorescue@0
|
665 type = "toggle",
|
|
Zerotorescue@0
|
666 name = "Open all |cfffed000auction won|r mail",
|
|
Zerotorescue@0
|
667 desc = "Automatically loot all auction won mails from the auction house.",
|
|
Zerotorescue@0
|
668 set = function(i, v) self.db.profile.filter.AH.won = v; end,
|
|
Zerotorescue@0
|
669 get = function() return self.db.profile.filter.AH.won; end,
|
|
Zerotorescue@0
|
670 width = "double",
|
|
Zerotorescue@0
|
671 },
|
|
Zerotorescue@0
|
672 normalHeader = {
|
|
Zerotorescue@0
|
673 order = 30,
|
|
Zerotorescue@0
|
674 type = "header",
|
|
Zerotorescue@0
|
675 name = "Remaining Mail",
|
|
Zerotorescue@0
|
676 },
|
|
Zerotorescue@0
|
677 normalAttachments = {
|
|
Zerotorescue@0
|
678 order = 40,
|
|
Zerotorescue@0
|
679 type = "toggle",
|
|
Zerotorescue@0
|
680 name = "Other mail with |cfffed000attachments|r",
|
|
Zerotorescue@0
|
681 desc = "Automatically loot all mails with attachments not sent by any of the above sources.",
|
|
Zerotorescue@0
|
682 set = function(i, v) self.db.profile.filter.normalAttachments = v; end,
|
|
Zerotorescue@0
|
683 get = function() return self.db.profile.filter.normalAttachments; end,
|
|
Zerotorescue@0
|
684 width = "double",
|
|
Zerotorescue@0
|
685 },
|
|
Zerotorescue@0
|
686 normalMoney = {
|
|
Zerotorescue@0
|
687 order = 50,
|
|
Zerotorescue@0
|
688 type = "toggle",
|
|
Zerotorescue@0
|
689 name = "Other mail with |cfffed000gold|r",
|
|
Zerotorescue@0
|
690 desc = "Automatically loot all mails with gold not sent by any of the above sources.",
|
|
Zerotorescue@0
|
691 set = function(i, v) self.db.profile.filter.normalMoney = v; end,
|
|
Zerotorescue@0
|
692 get = function() return self.db.profile.filter.normalMoney; end,
|
|
Zerotorescue@0
|
693 width = "double",
|
|
Zerotorescue@0
|
694 },
|
|
Zerotorescue@0
|
695 },
|
|
Zerotorescue@0
|
696 },
|
|
Zerotorescue@0
|
697 -- Continuous opening config inline group
|
|
Zerotorescue@0
|
698 continuousOpening = {
|
|
Zerotorescue@0
|
699 order = 20,
|
|
Zerotorescue@0
|
700 type = "group",
|
|
Zerotorescue@0
|
701 inline = true,
|
|
Zerotorescue@0
|
702 name = "Opening Interval",
|
|
Zerotorescue@0
|
703 args = {
|
|
Zerotorescue@0
|
704 description = {
|
|
Zerotorescue@0
|
705 order = 10,
|
|
Zerotorescue@0
|
706 type = "description",
|
|
Zerotorescue@0
|
707 name = function()
|
|
Zerotorescue@0
|
708 local defaultString = "The default behaviour for opening mail is to only do so right after new mail was received from the server. If you close the mailbox or your inventory is full before everything is opened you will have to click the open all button manually or wait for a next mailbox refresh.\n\n";
|
|
Zerotorescue@0
|
709
|
|
Zerotorescue@0
|
710 local currentSettings = "";
|
|
Zerotorescue@0
|
711 if MailOpener.db.profile.general.continueOpening then
|
|
Zerotorescue@0
|
712 currentSettings = currentSettings .. "Mail Opener will |cff00ff00continue|r to attempt to open the remaining mail every |cfffed000" .. MailOpener.db.profile.general.waitTime .. " seconds|r. ";
|
|
Zerotorescue@0
|
713 else
|
|
Zerotorescue@0
|
714 currentSettings = currentSettings .. "Mail Opener will |cffff0000not|r continue to attempt to open the remaining mail and will only start opening when new mail has just been received from the server. ";
|
|
Zerotorescue@0
|
715 end
|
|
Zerotorescue@0
|
716 currentSettings = currentSettings .. "The first batch after each server refresh will be opened after waiting |cfffed000" .. MailOpener.db.profile.general.initialDelay .. " seconds|r.";
|
|
Zerotorescue@0
|
717 return defaultString .. currentSettings;
|
|
Zerotorescue@0
|
718 end,
|
|
Zerotorescue@0
|
719 },
|
|
Zerotorescue@0
|
720 header = {
|
|
Zerotorescue@0
|
721 order = 15,
|
|
Zerotorescue@0
|
722 type = "header",
|
|
Zerotorescue@0
|
723 name = "",
|
|
Zerotorescue@0
|
724 },
|
|
Zerotorescue@0
|
725 continueOpening = {
|
|
Zerotorescue@0
|
726 order = 20,
|
|
Zerotorescue@0
|
727 type = "toggle",
|
|
Zerotorescue@0
|
728 name = "Continue opening mail",
|
|
Zerotorescue@0
|
729 desc = "Continue opening mail at the interval set below, even if the mailbox wasn't refreshed recently.",
|
|
Zerotorescue@0
|
730 width = "full",
|
|
Zerotorescue@0
|
731 get = function() return MailOpener.db.profile.general.continueOpening; end,
|
|
Zerotorescue@0
|
732 set = function(i, v) MailOpener.db.profile.general.continueOpening = v; end,
|
|
Zerotorescue@0
|
733 },
|
|
Zerotorescue@0
|
734 waitTime = {
|
|
Zerotorescue@0
|
735 order = 30,
|
|
Zerotorescue@0
|
736 type = "range",
|
|
Zerotorescue@0
|
737 width = "double",
|
|
Zerotorescue@0
|
738 min = 0.5,
|
|
Zerotorescue@0
|
739 max = 60,
|
|
Zerotorescue@0
|
740 step = 0.5,
|
|
Zerotorescue@0
|
741 name = "Continued Mail Opening Interval",
|
|
Zerotorescue@0
|
742 desc = "Change the interval at which Mail Opener tries to continue opening mail after opening the mailbox. Please note that this setting does not reduce the game's normal 60 seconds wait time for mail.\n\nThe default value is 5 seconds",
|
|
Zerotorescue@0
|
743 get = function() return MailOpener.db.profile.general.waitTime; end,
|
|
Zerotorescue@0
|
744 set = function(i, v) MailOpener.db.profile.general.waitTime = v; end,
|
|
Zerotorescue@0
|
745 disabled = function() return (not MailOpener.db.profile.general.continueOpening); end,
|
|
Zerotorescue@0
|
746 },
|
|
Zerotorescue@0
|
747 initialDelay = {
|
|
Zerotorescue@0
|
748 order = 40,
|
|
Zerotorescue@0
|
749 type = "range",
|
|
Zerotorescue@0
|
750 width = "double",
|
|
Zerotorescue@0
|
751 min = 0.5,
|
|
Zerotorescue@0
|
752 max = 60,
|
|
Zerotorescue@0
|
753 step = 0.5,
|
|
Zerotorescue@0
|
754 name = "Initial Mail Opening Delay",
|
|
Zerotorescue@0
|
755 desc = "Change the delay before Mail Opener tries opening mail after opening the mailbox or new mail has been received from the server.\n\nThe default value is 0.5 seconds.",
|
|
Zerotorescue@0
|
756 get = function() return MailOpener.db.profile.general.initialDelay; end,
|
|
Zerotorescue@0
|
757 set = function(i, v) MailOpener.db.profile.general.initialDelay = v; end,
|
|
Zerotorescue@0
|
758 },
|
|
Zerotorescue@0
|
759 },
|
|
Zerotorescue@0
|
760 }, -- end Continuous opening config inline group
|
|
Zerotorescue@0
|
761 keepFree = {
|
|
Zerotorescue@0
|
762 order = 30,
|
|
Zerotorescue@0
|
763 type = "group",
|
|
Zerotorescue@0
|
764 inline = true,
|
|
Zerotorescue@0
|
765 name = "Keep Free Space",
|
|
Zerotorescue@0
|
766 args = {
|
|
Zerotorescue@0
|
767 description = {
|
|
Zerotorescue@0
|
768 order = 10,
|
|
Zerotorescue@0
|
769 type = "description",
|
|
Zerotorescue@0
|
770 name = "You can set an amount of bag space you wish to reserve when opening mail. Mail with a higher amount of attachments than available space will be skipped completely with this option set above 0.",
|
|
Zerotorescue@0
|
771 },
|
|
Zerotorescue@0
|
772 header = {
|
|
Zerotorescue@0
|
773 order = 15,
|
|
Zerotorescue@0
|
774 type = "header",
|
|
Zerotorescue@0
|
775 name = "",
|
|
Zerotorescue@0
|
776 },
|
|
Zerotorescue@0
|
777 keepFreeSpace = {
|
|
Zerotorescue@0
|
778 order = 20,
|
|
Zerotorescue@0
|
779 type = "range",
|
|
Zerotorescue@0
|
780 min = 0,
|
|
Zerotorescue@0
|
781 max = 100,
|
|
Zerotorescue@0
|
782 step = 1,
|
|
Zerotorescue@0
|
783 width = "double",
|
|
Zerotorescue@0
|
784 name = "Keep free space",
|
|
Zerotorescue@0
|
785 desc = "Change the amount of space to reserve for other things when opening mail. If this option is set higher than 0, mail with a higher amount of attachments than available space will be skipped completely.\n\nE.g. If this is set to 1 and you have a total of 12 slots left then any mail with 12 attachments will be skipped while one with 11 attachments would be opened.",
|
|
Zerotorescue@0
|
786 set = function(i, v) self.db.profile.keepFreeSpace = v; end,
|
|
Zerotorescue@0
|
787 get = function() return self.db.profile.keepFreeSpace; end,
|
|
Zerotorescue@0
|
788 },
|
|
Zerotorescue@0
|
789 },
|
|
Zerotorescue@0
|
790 },
|
|
Zerotorescue@0
|
791 speed = {
|
|
Zerotorescue@0
|
792 order = 40,
|
|
Zerotorescue@0
|
793 type = "group",
|
|
Zerotorescue@0
|
794 inline = true,
|
|
Zerotorescue@0
|
795 name = "Opening Speed",
|
|
Zerotorescue@0
|
796 args = {
|
|
Zerotorescue@0
|
797 description = {
|
|
Zerotorescue@0
|
798 order = 10,
|
|
Zerotorescue@0
|
799 type = "description",
|
|
Zerotorescue@0
|
800 name = "Change the speed at which mail is opened. You should set the opening speed to the lowest latency you have in a city or experiment with setting it to the minimum.",
|
|
Zerotorescue@0
|
801 },
|
|
Zerotorescue@0
|
802 header = {
|
|
Zerotorescue@0
|
803 order = 15,
|
|
Zerotorescue@0
|
804 type = "header",
|
|
Zerotorescue@0
|
805 name = "",
|
|
Zerotorescue@0
|
806 },
|
|
Zerotorescue@0
|
807 openMailInterval = {
|
|
Zerotorescue@0
|
808 order = 20,
|
|
Zerotorescue@0
|
809 type = "range",
|
|
Zerotorescue@0
|
810 min = 5,
|
|
Zerotorescue@0
|
811 max = 2500,
|
|
Zerotorescue@0
|
812 step = 5,
|
|
Zerotorescue@0
|
813 width = "double",
|
|
Zerotorescue@0
|
814 name = "Open single mail interval",
|
|
Zerotorescue@0
|
815 desc = "Change the mail opening speed (in microseconds) for each mail. Lower may not always be faster.",
|
|
Zerotorescue@0
|
816 get = function() return ( self.db.profile.speed * 1000 ); end,
|
|
Zerotorescue@0
|
817 set = function(i, v) self.db.profile.speed = ( v / 1000 ); end,
|
|
Zerotorescue@0
|
818 },
|
|
Zerotorescue@0
|
819 },
|
|
Zerotorescue@0
|
820 },
|
|
Zerotorescue@0
|
821 },
|
|
Zerotorescue@0
|
822 };
|
|
Zerotorescue@0
|
823
|
|
Zerotorescue@0
|
824 return configGroup;
|
|
Zerotorescue@0
|
825 end
|
|
Zerotorescue@0
|
826
|
|
Zerotorescue@0
|
827 function OpenAll:Debug(t)
|
|
Zerotorescue@0
|
828 return MailOpener:Debug("|cff00ff00OpenAll|r:" .. t);
|
|
Zerotorescue@0
|
829 end |