|
Zerotorescue@0
|
1 local MailOpener = LibStub("AceAddon-3.0"):GetAddon("MailOpener");
|
|
Zerotorescue@31
|
2 local mod = MailOpener:NewModule("OpenAll", "AceEvent-3.0", "AceTimer-3.0");
|
|
Zerotorescue@68
|
3 local L = LibStub("AceLocale-3.0"):GetLocale("MailOpener");
|
|
Zerotorescue@31
|
4
|
|
Zerotorescue@68
|
5 mod.moduleDescription = L["The actual mail opening initiated by the core."];
|
|
Zerotorescue@31
|
6 mod.moduleRequired = true;
|
|
Zerotorescue@0
|
7
|
|
Zerotorescue@3
|
8 --[[
|
|
Zerotorescue@3
|
9 Dev notes:
|
|
Zerotorescue@3
|
10 When shift clicking the Open All button it should override all filters.
|
|
Zerotorescue@3
|
11 ]]
|
|
Zerotorescue@3
|
12
|
|
Zerotorescue@131
|
13 local MAIL_ITEM_INDEX, MAIL_OPEN_EVERYTHING, mailTimer, inventoryFull, inventoryFullSoundPlayed, inventoryFullSoundPlayedThisVisit, opening, lastSync, numCurrentMail, numHiddenMail, continue, firstOpenThisSync, takingSingleItem;
|
|
Zerotorescue@0
|
14
|
|
Zerotorescue@31
|
15 function mod:OnInitialize()
|
|
Zerotorescue@0
|
16 local defaults = {
|
|
Zerotorescue@0
|
17 profile = {
|
|
Zerotorescue@0
|
18 speed = 0.05,
|
|
Zerotorescue@0
|
19 keepFreeSpace = 0,
|
|
Zerotorescue@0
|
20 filter = {
|
|
Zerotorescue@0
|
21 AH = {
|
|
Zerotorescue@0
|
22 canceled = true,
|
|
Zerotorescue@0
|
23 expired = true,
|
|
Zerotorescue@0
|
24 outbid = true,
|
|
Zerotorescue@0
|
25 success = true,
|
|
Zerotorescue@0
|
26 won = true,
|
|
Zerotorescue@0
|
27 },
|
|
Zerotorescue@0
|
28 normalAttachments = false,
|
|
Zerotorescue@0
|
29 normalMoney = true,
|
|
Zerotorescue@50
|
30 allowShiftClick = true,
|
|
Zerotorescue@0
|
31 },
|
|
Zerotorescue@0
|
32 },
|
|
Zerotorescue@0
|
33 };
|
|
Zerotorescue@0
|
34
|
|
Zerotorescue@0
|
35 -- Register our saved variables NameSpace
|
|
Zerotorescue@0
|
36 self.db = MailOpener.db:RegisterNamespace("OpenAll", defaults);
|
|
Zerotorescue@0
|
37 end
|
|
Zerotorescue@0
|
38
|
|
Zerotorescue@31
|
39 function mod:OnEnable()
|
|
Zerotorescue@0
|
40 self:RegisterEvent("MAIL_SHOW");
|
|
Zerotorescue@42
|
41
|
|
Zerotorescue@0
|
42 if not self.btnOpenAll then
|
|
Zerotorescue@0
|
43 -- Open all button
|
|
Zerotorescue@46
|
44 local button = CreateFrame("Button", "btnMailOpenerOpenAll", InboxFrame, "UIPanelButtonTemplate");
|
|
Zerotorescue@68
|
45 button:SetText(L["Open all"]);
|
|
Zerotorescue@46
|
46 button:SetHeight(26);
|
|
Zerotorescue@46
|
47 button:SetWidth(120);
|
|
Zerotorescue@46
|
48 button:SetPoint("BOTTOM", InboxFrame, "CENTER", -10, -165);
|
|
Zerotorescue@112
|
49 button:RegisterForClicks("LeftButtonUp", "RightButtonUp", "MiddleButtonUp");
|
|
Zerotorescue@48
|
50 button:SetScript("OnClick", function(self, mouseButton)
|
|
Zerotorescue@112
|
51 local action = "open";
|
|
Zerotorescue@48
|
52 if mouseButton == "RightButton" then
|
|
Zerotorescue@112
|
53 action = "menu";
|
|
Zerotorescue@112
|
54 elseif mouseButton == "MiddleButton" or (mouseButton == "LeftButton" and IsAltKeyDown()) then
|
|
Zerotorescue@112
|
55 action = "stop";
|
|
Zerotorescue@112
|
56 end
|
|
Zerotorescue@112
|
57
|
|
Zerotorescue@112
|
58 if action == "menu" then
|
|
Zerotorescue@48
|
59 -- Hide the gametooltip
|
|
Zerotorescue@48
|
60 GameTooltip:Hide();
|
|
Zerotorescue@48
|
61
|
|
Zerotorescue@48
|
62 if not mod.ddmFilters then
|
|
Zerotorescue@48
|
63 -- Build the drop down menu
|
|
Zerotorescue@48
|
64 local info = {};
|
|
Zerotorescue@48
|
65
|
|
Zerotorescue@48
|
66 local dropDownMenu = CreateFrame("Frame", "MailOpenerFiltersDropDownMenu");
|
|
Zerotorescue@48
|
67 dropDownMenu.displayMode = "MENU";
|
|
Zerotorescue@48
|
68 dropDownMenu.initialize = function(s, level)
|
|
Zerotorescue@48
|
69 if not level then return; end
|
|
Zerotorescue@48
|
70
|
|
Zerotorescue@48
|
71 if level == 1 then
|
|
Zerotorescue@48
|
72 -- Create the title of the menu
|
|
Zerotorescue@48
|
73 info.isTitle = true;
|
|
Zerotorescue@68
|
74 info.text = L["Toggle filters for %s profile."]:format(MailOpener.db:GetCurrentProfile());
|
|
Zerotorescue@48
|
75 info.notCheckable = true;
|
|
Zerotorescue@48
|
76 UIDropDownMenu_AddButton(info, level);
|
|
Zerotorescue@48
|
77
|
|
Zerotorescue@48
|
78 -- Reset title specific values
|
|
Zerotorescue@48
|
79 info.isTitle = nil;
|
|
Zerotorescue@48
|
80 info.disabled = nil;
|
|
Zerotorescue@48
|
81 info.notCheckable = nil;
|
|
Zerotorescue@48
|
82
|
|
Zerotorescue@48
|
83 -- We don't want to close the DDM when something is toggled
|
|
Zerotorescue@48
|
84 info.keepShownOnClick = true;
|
|
Zerotorescue@48
|
85
|
|
Zerotorescue@48
|
86 -- Make Auction canceled option
|
|
Zerotorescue@68
|
87 info.text = L["Auction canceled"];
|
|
Zerotorescue@48
|
88 info.func = function(this) mod.db.profile.filter.AH.canceled = this.checked; end;
|
|
Zerotorescue@48
|
89 info.checked = mod.db.profile.filter.AH.canceled;
|
|
Zerotorescue@48
|
90 UIDropDownMenu_AddButton(info, level);
|
|
Zerotorescue@48
|
91
|
|
Zerotorescue@48
|
92 -- Make Auction expired option
|
|
Zerotorescue@68
|
93 info.text = L["Auction expired"];
|
|
Zerotorescue@48
|
94 info.func = function(this) mod.db.profile.filter.AH.expired = this.checked; end;
|
|
Zerotorescue@48
|
95 info.checked = mod.db.profile.filter.AH.expired;
|
|
Zerotorescue@48
|
96 UIDropDownMenu_AddButton(info, level);
|
|
Zerotorescue@48
|
97
|
|
Zerotorescue@48
|
98 -- Make Auction outbid option
|
|
Zerotorescue@68
|
99 info.text = L["Auction outbid"];
|
|
Zerotorescue@48
|
100 info.func = function(this) mod.db.profile.filter.AH.outbid = this.checked; end;
|
|
Zerotorescue@48
|
101 info.checked = mod.db.profile.filter.AH.outbid;
|
|
Zerotorescue@48
|
102 UIDropDownMenu_AddButton(info, level);
|
|
Zerotorescue@48
|
103
|
|
Zerotorescue@48
|
104 -- Make Auction successful option
|
|
Zerotorescue@68
|
105 info.text = L["Auction successful"];
|
|
Zerotorescue@48
|
106 info.func = function(this) mod.db.profile.filter.AH.success = this.checked; end;
|
|
Zerotorescue@48
|
107 info.checked = mod.db.profile.filter.AH.success;
|
|
Zerotorescue@48
|
108 UIDropDownMenu_AddButton(info, level);
|
|
Zerotorescue@48
|
109
|
|
Zerotorescue@48
|
110 -- Make Auction won option
|
|
Zerotorescue@68
|
111 info.text = L["Auction won"];
|
|
Zerotorescue@48
|
112 info.func = function(this) mod.db.profile.filter.AH.won = this.checked; end;
|
|
Zerotorescue@48
|
113 info.checked = mod.db.profile.filter.AH.won;
|
|
Zerotorescue@48
|
114 UIDropDownMenu_AddButton(info, level);
|
|
Zerotorescue@48
|
115
|
|
Zerotorescue@48
|
116 -- Make Other mail with attachments
|
|
Zerotorescue@68
|
117 info.text = L["Other mail with attachments"];
|
|
Zerotorescue@48
|
118 info.func = function(this) mod.db.profile.filter.normalAttachments = this.checked; end;
|
|
Zerotorescue@48
|
119 info.checked = mod.db.profile.filter.normalAttachments;
|
|
Zerotorescue@48
|
120 UIDropDownMenu_AddButton(info, level);
|
|
Zerotorescue@48
|
121
|
|
Zerotorescue@48
|
122 -- Make Other mail with gold
|
|
Zerotorescue@68
|
123 info.text = L["Other mail with gold"];
|
|
Zerotorescue@48
|
124 info.func = function(this) mod.db.profile.filter.normalMoney = this.checked; end;
|
|
Zerotorescue@48
|
125 info.checked = mod.db.profile.filter.normalMoney;
|
|
Zerotorescue@48
|
126 UIDropDownMenu_AddButton(info, level);
|
|
Zerotorescue@48
|
127
|
|
Zerotorescue@112
|
128 -- Close link
|
|
Zerotorescue@48
|
129 info.text = CLOSE;
|
|
Zerotorescue@48
|
130 info.func = function() CloseDropDownMenus(); end;
|
|
Zerotorescue@48
|
131 info.checked = nil;
|
|
Zerotorescue@48
|
132 info.notCheckable = true;
|
|
Zerotorescue@48
|
133 UIDropDownMenu_AddButton(info, level);
|
|
Zerotorescue@48
|
134
|
|
Zerotorescue@48
|
135 wipe(info);
|
|
Zerotorescue@48
|
136 end
|
|
Zerotorescue@48
|
137 end
|
|
Zerotorescue@48
|
138
|
|
Zerotorescue@48
|
139 mod.ddmFilters = dropDownMenu;
|
|
Zerotorescue@48
|
140 end
|
|
Zerotorescue@48
|
141
|
|
Zerotorescue@48
|
142 ToggleDropDownMenu(1, nil, mod.ddmFilters, self:GetName(), 0, 0);
|
|
Zerotorescue@112
|
143 elseif action == "stop" then
|
|
Zerotorescue@112
|
144 MailOpener:Print(L["Interrupting mail opening as the alt key was held down while clicking the open all button or the middle mouse-button was used on it."]);
|
|
Zerotorescue@112
|
145
|
|
Zerotorescue@112
|
146 mod:StopOpening(true);
|
|
Zerotorescue@48
|
147 else
|
|
Zerotorescue@48
|
148 mod:Open(true, IsShiftKeyDown());
|
|
Zerotorescue@48
|
149 end
|
|
Zerotorescue@48
|
150 end);
|
|
Zerotorescue@68
|
151 button.tooltipTitle = L["Open all"];
|
|
Zerotorescue@112
|
152 button.tooltip = L["Hold |cfffed000shift|r while clicking this button to temporarily override your filters and loot every single mail containing attachments and/or gold.\n\n|cfffed000Right|r click this button to quickly adjust mail opening filters for this profile.\n\n|cfffed000Middle|r click or hold |cfffed000alt|r while clicking this button to interrupt mail opening."];
|
|
Zerotorescue@48
|
153 button:SetScript("OnEnter", function(self)
|
|
Zerotorescue@51
|
154 if MailOpener.db.profile.general.showHelpTooltips then
|
|
Zerotorescue@51
|
155 GameTooltip:SetOwner(self, "ANCHOR_NONE")
|
|
Zerotorescue@51
|
156 GameTooltip:SetPoint("BOTTOM", self, "TOP")
|
|
Zerotorescue@51
|
157 GameTooltip:SetText(self.tooltipTitle, 1, .82, 0, 1)
|
|
Zerotorescue@51
|
158
|
|
Zerotorescue@51
|
159 if type(self.tooltip) == "string" then
|
|
Zerotorescue@51
|
160 GameTooltip:AddLine(self.tooltip, 1, 1, 1, 1);
|
|
Zerotorescue@51
|
161 end
|
|
Zerotorescue@51
|
162
|
|
Zerotorescue@51
|
163 GameTooltip:Show();
|
|
Zerotorescue@48
|
164 end
|
|
Zerotorescue@48
|
165 end);
|
|
Zerotorescue@48
|
166 button:SetScript("OnLeave", function(self)
|
|
Zerotorescue@48
|
167 GameTooltip:Hide();
|
|
Zerotorescue@46
|
168 end);
|
|
Zerotorescue@0
|
169
|
|
Zerotorescue@0
|
170 self.btnOpenAll = button;
|
|
Zerotorescue@0
|
171 end
|
|
Zerotorescue@0
|
172
|
|
Zerotorescue@0
|
173 self.btnOpenAll:Show();
|
|
Zerotorescue@0
|
174
|
|
Zerotorescue@0
|
175 if not self.timeLeftFrame then
|
|
Zerotorescue@0
|
176 -- If the timeLeftFrame doesn't exist we will have to build it
|
|
Zerotorescue@0
|
177
|
|
Zerotorescue@0
|
178 self:Debug("Building text frame");
|
|
Zerotorescue@0
|
179
|
|
Zerotorescue@0
|
180 local frame = CreateFrame("Button", "MailOpenerTimeLeftButton", InboxFrame);
|
|
Zerotorescue@0
|
181
|
|
Zerotorescue@0
|
182 -- Mail counter
|
|
Zerotorescue@0
|
183 frame.text = frame:CreateFontString("MailOpenerTimeLeftFrameMailCount", "OVERLAY", "GameFontHighlight");
|
|
Zerotorescue@0
|
184 frame.text:SetPoint("CENTER", MailFrame, "TOPLEFT", 40, -35);
|
|
Zerotorescue@0
|
185
|
|
Zerotorescue@0
|
186 -- Long time left indicator
|
|
Zerotorescue@0
|
187 frame.smallText = frame:CreateFontString("MailOpenerTimeLeftFrameTimeRemaining", "OVERLAY", "GameFontNormal");
|
|
Zerotorescue@0
|
188 frame.smallText:SetFont(GameFontHighlight:GetFont(), 11, "OUTLINE");
|
|
Zerotorescue@0
|
189 frame.smallText:SetPoint("TOPLEFT", MailFrame, "TOPLEFT", 75, -38);
|
|
Zerotorescue@0
|
190 frame.smallText:SetWidth(270);
|
|
Zerotorescue@0
|
191 frame.smallText:SetJustifyH("LEFT");
|
|
Zerotorescue@0
|
192 frame.smallText:SetJustifyV("MIDDLE");
|
|
Zerotorescue@0
|
193
|
|
Zerotorescue@0
|
194 frame:SetPoint("TOPLEFT", MailFrame, "TOPLEFT", 75, -38);
|
|
Zerotorescue@0
|
195 frame:SetWidth(270);
|
|
Zerotorescue@0
|
196 frame:SetHeight(35);
|
|
Zerotorescue@0
|
197 frame:SetScript("OnClick", function(self)
|
|
Zerotorescue@0
|
198 local timeRemainingUntillOpened = frame.smallText:GetText();
|
|
Zerotorescue@0
|
199 if timeRemainingUntillOpened then
|
|
Zerotorescue@0
|
200 MailOpener.currentPopupContents = "|cffffd700" .. timeRemainingUntillOpened .. "|r";
|
|
Zerotorescue@0
|
201
|
|
Zerotorescue@0
|
202 StaticPopup_Show("MailOpenerCopyWindow");
|
|
Zerotorescue@0
|
203 end
|
|
Zerotorescue@0
|
204 end);
|
|
Zerotorescue@0
|
205
|
|
Zerotorescue@0
|
206 self.timeLeftFrame = frame;
|
|
Zerotorescue@0
|
207 end
|
|
Zerotorescue@0
|
208
|
|
Zerotorescue@0
|
209 self.timeLeftFrame:Show();
|
|
Zerotorescue@0
|
210
|
|
Zerotorescue@3
|
211 -- Go through all children of the mail frame to find QA's element and hide it
|
|
Zerotorescue@42
|
212 -- 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)
|
|
Zerotorescue@0
|
213 local kids = { MailFrame:GetChildren() };
|
|
Zerotorescue@0
|
214
|
|
Zerotorescue@0
|
215 for _, child in ipairs(kids) do
|
|
Zerotorescue@0
|
216 if child and child.text then
|
|
Zerotorescue@0
|
217 child.text:Hide();
|
|
Zerotorescue@0
|
218 end
|
|
Zerotorescue@0
|
219 end
|
|
Zerotorescue@0
|
220
|
|
Zerotorescue@0
|
221 -- If we were toggling this module on while the mailbox is opened we must register all events again
|
|
Zerotorescue@0
|
222 if MailFrame:IsVisible() then
|
|
Zerotorescue@0
|
223 self:MAIL_SHOW();
|
|
Zerotorescue@0
|
224 end
|
|
Zerotorescue@0
|
225 end
|
|
Zerotorescue@0
|
226
|
|
Zerotorescue@31
|
227 function mod:OnDisable()
|
|
Zerotorescue@0
|
228 self:UnregisterEvent("MAIL_SHOW");
|
|
Zerotorescue@0
|
229
|
|
Zerotorescue@0
|
230 if self.btnOpenAll then
|
|
Zerotorescue@0
|
231 self.btnOpenAll:Hide();
|
|
Zerotorescue@0
|
232 end
|
|
Zerotorescue@0
|
233
|
|
Zerotorescue@0
|
234 if self.timeLeftFrame then
|
|
Zerotorescue@0
|
235 self.timeLeftFrame:Hide();
|
|
Zerotorescue@0
|
236 end
|
|
Zerotorescue@0
|
237
|
|
Zerotorescue@0
|
238 if MailOpener.PostalEnabled then
|
|
Zerotorescue@0
|
239 -- Enable Postal's openers again
|
|
Zerotorescue@0
|
240
|
|
Zerotorescue@0
|
241 MailOpener:TogglePostalModule("OpenAll", true);
|
|
Zerotorescue@0
|
242 MailOpener:TogglePostalModule("Select", true);
|
|
Zerotorescue@0
|
243 end
|
|
Zerotorescue@0
|
244
|
|
Zerotorescue@0
|
245 -- Go through all children of the mail frame to find QA's elements and SHOW these
|
|
Zerotorescue@42
|
246 -- 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)
|
|
Zerotorescue@0
|
247 local kids = { MailFrame:GetChildren() };
|
|
Zerotorescue@0
|
248
|
|
Zerotorescue@0
|
249 for _, child in ipairs(kids) do
|
|
Zerotorescue@0
|
250 if child and child.text then
|
|
Zerotorescue@0
|
251 child.text:Show();
|
|
Zerotorescue@0
|
252 end
|
|
Zerotorescue@0
|
253 end
|
|
Zerotorescue@0
|
254
|
|
Zerotorescue@0
|
255 self:Stop();
|
|
Zerotorescue@0
|
256 end
|
|
Zerotorescue@0
|
257
|
|
Zerotorescue@31
|
258 function mod:MAIL_SHOW()
|
|
Zerotorescue@0
|
259 self:Debug("MAIL_SHOW");
|
|
Zerotorescue@0
|
260
|
|
Zerotorescue@0
|
261 self:StopOpening(false);
|
|
Zerotorescue@42
|
262
|
|
Zerotorescue@42
|
263 inventoryFullSoundPlayedThisVisit = nil;
|
|
Zerotorescue@0
|
264
|
|
Zerotorescue@0
|
265 if MailOpener.PostalEnabled then
|
|
Zerotorescue@0
|
266 -- Disable Postal's openers so we can do it ourselves
|
|
Zerotorescue@0
|
267
|
|
Zerotorescue@0
|
268 MailOpener:TogglePostalModule("OpenAll", false);
|
|
Zerotorescue@0
|
269 MailOpener:TogglePostalModule("Select", false);
|
|
Zerotorescue@0
|
270 end
|
|
Zerotorescue@0
|
271
|
|
Zerotorescue@0
|
272 -- Keep an eye for closing of the mailbox
|
|
Zerotorescue@0
|
273 self:RegisterEvent("MAIL_CLOSED", "Stop");
|
|
Zerotorescue@0
|
274 self:RegisterEvent("PLAYER_LEAVING_WORLD", "Stop");
|
|
Zerotorescue@0
|
275
|
|
Zerotorescue@0
|
276 -- Look if the mailbox is full
|
|
Zerotorescue@0
|
277 self:RegisterEvent("UI_ERROR_MESSAGE");
|
|
Zerotorescue@0
|
278 -- Only look again after bags updated
|
|
Zerotorescue@0
|
279 self:RegisterEvent("BAG_UPDATE");
|
|
Zerotorescue@0
|
280
|
|
Zerotorescue@0
|
281 -- We need to know when to start opening
|
|
Zerotorescue@0
|
282 self:RegisterMessage("MO_OPEN_MAIL", "Open");
|
|
Zerotorescue@0
|
283 self:RegisterMessage("MO_SERVER_SYNCED");
|
|
Zerotorescue@3
|
284 self:RegisterMessage("MO_MAIL_EMPTIED");
|
|
Zerotorescue@112
|
285 self:RegisterMessage("MO_STOP_MAIL_OPENING");
|
|
Zerotorescue@0
|
286
|
|
Zerotorescue@0
|
287 self:CancelTimer(self.tmrTimeRemaining, true);
|
|
Zerotorescue@0
|
288 self.tmrTimeRemaining = self:ScheduleRepeatingTimer("UpdateTimer", 1);
|
|
Zerotorescue@0
|
289 self:UpdateTimer();
|
|
Zerotorescue@0
|
290 end
|
|
Zerotorescue@0
|
291
|
|
Zerotorescue@31
|
292 function mod:Stop()
|
|
Zerotorescue@0
|
293 self:Debug("Stop");
|
|
Zerotorescue@0
|
294
|
|
Zerotorescue@0
|
295 -- We shutdown, so nothing to do when the mailbox is closed anymore
|
|
Zerotorescue@0
|
296 self:UnregisterEvent("MAIL_CLOSED");
|
|
Zerotorescue@0
|
297 self:UnregisterEvent("PLAYER_LEAVING_WORLD");
|
|
Zerotorescue@0
|
298
|
|
Zerotorescue@0
|
299 -- We care about a full inventory just a little
|
|
Zerotorescue@0
|
300 self:UnregisterEvent("UI_ERROR_MESSAGE");
|
|
Zerotorescue@0
|
301 self:UnregisterEvent("BAG_UPDATE");
|
|
Zerotorescue@0
|
302
|
|
Zerotorescue@0
|
303 -- We no longer care
|
|
Zerotorescue@0
|
304 self:UnregisterMessage("MO_OPEN_MAIL");
|
|
Zerotorescue@0
|
305 self:UnregisterMessage("MO_SERVER_SYNCED");
|
|
Zerotorescue@3
|
306 self:UnregisterMessage("MO_MAIL_EMPTIED");
|
|
Zerotorescue@112
|
307 self:UnregisterMessage("MO_STOP_MAIL_OPENING");
|
|
Zerotorescue@0
|
308
|
|
Zerotorescue@0
|
309 self:CancelTimer(self.tmrMailOpener, true);
|
|
Zerotorescue@0
|
310 self:CancelTimer(self.tmrTimeRemaining, true);
|
|
Zerotorescue@0
|
311
|
|
Zerotorescue@0
|
312 self:SetOpeningStatus(false);
|
|
Zerotorescue@0
|
313 end
|
|
Zerotorescue@0
|
314
|
|
Zerotorescue@31
|
315 function mod:MO_SERVER_SYNCED()
|
|
Zerotorescue@0
|
316 self:Debug("MO_SERVER_SYNCED");
|
|
Zerotorescue@0
|
317
|
|
Zerotorescue@31
|
318 -- Stop opening now to prevent the opener from continueing while BeanCounter is counting
|
|
Zerotorescue@2
|
319 self:StopOpening(false);
|
|
Zerotorescue@2
|
320
|
|
Zerotorescue@0
|
321 lastSync = GetTime();
|
|
Zerotorescue@0
|
322
|
|
Zerotorescue@2
|
323 self:UpdateMailCount();
|
|
Zerotorescue@106
|
324
|
|
Zerotorescue@106
|
325 -- While this is true, we'll announce mail skipped - will be set to false after opening happened once
|
|
Zerotorescue@106
|
326 firstOpenThisSync = true;
|
|
Zerotorescue@2
|
327 end
|
|
Zerotorescue@2
|
328
|
|
Zerotorescue@31
|
329 function mod:MO_MAIL_EMPTIED()
|
|
Zerotorescue@3
|
330 -- A mail has been processed so we can process the next
|
|
Zerotorescue@2
|
331 continue = true;
|
|
Zerotorescue@2
|
332
|
|
Zerotorescue@3
|
333 self:UpdateTimer();
|
|
Zerotorescue@2
|
334 end
|
|
Zerotorescue@2
|
335
|
|
Zerotorescue@112
|
336 function mod:MO_STOP_MAIL_OPENING()
|
|
Zerotorescue@112
|
337 self:StopOpening(true);
|
|
Zerotorescue@112
|
338 end
|
|
Zerotorescue@112
|
339
|
|
Zerotorescue@31
|
340 function mod:UpdateMailCount()
|
|
Zerotorescue@0
|
341 local numItems, totalItems = GetInboxNumItems();
|
|
Zerotorescue@0
|
342
|
|
Zerotorescue@0
|
343 numCurrentMail = numItems;
|
|
Zerotorescue@0
|
344 numHiddenMail = ( totalItems - numItems );
|
|
Zerotorescue@0
|
345 end
|
|
Zerotorescue@0
|
346
|
|
Zerotorescue@31
|
347 function mod:BAG_UPDATE()
|
|
Zerotorescue@0
|
348 -- If the bags are updated we should check if the inventory is full again
|
|
Zerotorescue@0
|
349 inventoryFull = false;
|
|
Zerotorescue@1
|
350 -- Replay sound
|
|
Zerotorescue@1
|
351 inventoryFullSoundPlayed = nil;
|
|
Zerotorescue@131
|
352
|
|
Zerotorescue@131
|
353 if opening and takingSingleItem then
|
|
Zerotorescue@131
|
354 self:ScheduleTimer("Continue", self.db.profile.speed);
|
|
Zerotorescue@131
|
355 end
|
|
Zerotorescue@0
|
356 end
|
|
Zerotorescue@0
|
357
|
|
Zerotorescue@0
|
358 -- 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@31
|
359 function mod:UI_ERROR_MESSAGE(e, errorMessage)
|
|
Zerotorescue@0
|
360 if errorMessage == ERR_INV_FULL then
|
|
Zerotorescue@0
|
361 -- Inventory is full.
|
|
Zerotorescue@0
|
362
|
|
Zerotorescue@0
|
363 if not inventoryFull then
|
|
Zerotorescue@0
|
364 inventoryFull = true;
|
|
Zerotorescue@0
|
365
|
|
Zerotorescue@0
|
366 -- Play the sound
|
|
Zerotorescue@42
|
367 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
|
|
Zerotorescue@0
|
368 PlaySoundFile(MailOpener.db.profile.notifications.bagsFullSoundFile);
|
|
Zerotorescue@0
|
369 inventoryFullSoundPlayed = true;
|
|
Zerotorescue@42
|
370 inventoryFullSoundPlayedThisVisit = true;
|
|
Zerotorescue@0
|
371 end
|
|
Zerotorescue@0
|
372 end
|
|
Zerotorescue@0
|
373
|
|
Zerotorescue@0
|
374 -- Continue opening mail (we still want to open gold mail)
|
|
Zerotorescue@0
|
375 continue = true;
|
|
Zerotorescue@0
|
376 elseif errorMessage == ERR_ITEM_MAX_COUNT or errorMessage == ERR_MAIL_DATABASE_ERROR then
|
|
Zerotorescue@0
|
377 -- Can't carry more of this item OR mail database error
|
|
Zerotorescue@0
|
378
|
|
Zerotorescue@0
|
379 -- Continue opening mail (we still want to retrieve other items or gold)
|
|
Zerotorescue@0
|
380 continue = true;
|
|
Zerotorescue@0
|
381 end
|
|
Zerotorescue@0
|
382 end
|
|
Zerotorescue@0
|
383
|
|
Zerotorescue@46
|
384 function mod:Open(forced, everything)
|
|
Zerotorescue@46
|
385 self:Debug("Open (" .. ((everything and "1") or "0") .. ")");
|
|
Zerotorescue@0
|
386
|
|
Zerotorescue@0
|
387 if not opening or forced == true then
|
|
Zerotorescue@0
|
388 local numItems, totalItems = GetInboxNumItems();
|
|
Zerotorescue@0
|
389 -- Start at the end, add one because OpenNext will take it away again
|
|
Zerotorescue@0
|
390 local newMailItemIndex = ( ( numItems or 0 ) + 1 );
|
|
Zerotorescue@0
|
391
|
|
Zerotorescue@0
|
392 if newMailItemIndex > 1 then
|
|
Zerotorescue@0
|
393 self:Debug("Open succes");
|
|
Zerotorescue@0
|
394
|
|
Zerotorescue@0
|
395 -- Stop the previous opening and restart
|
|
Zerotorescue@0
|
396 if forced == true then
|
|
Zerotorescue@106
|
397 -- Show skips again
|
|
Zerotorescue@106
|
398 firstOpenThisSync = true;
|
|
Zerotorescue@106
|
399
|
|
Zerotorescue@0
|
400 self:StopOpening(false); -- this is not a "simple" stop, so also reset inventory full warning
|
|
Zerotorescue@0
|
401 else
|
|
Zerotorescue@0
|
402 self:StopOpening(true); -- forced is false - automated action - simple reset, skip inventory full reset to avoid sound spam
|
|
Zerotorescue@0
|
403 end
|
|
Zerotorescue@0
|
404
|
|
Zerotorescue@0
|
405 -- Update the caret
|
|
Zerotorescue@0
|
406 MAIL_ITEM_INDEX = newMailItemIndex;
|
|
Zerotorescue@46
|
407 -- Do we want to override filters and open every single mail?
|
|
Zerotorescue@50
|
408 if everything and self.db.profile.filter.allowShiftClick then
|
|
Zerotorescue@46
|
409 MAIL_OPEN_EVERYTHING = true;
|
|
Zerotorescue@46
|
410
|
|
Zerotorescue@68
|
411 MailOpener:Print(L["Shift key was held while pressing the open all button. Temporarily overriding filters; going to open every mail with attachments."]);
|
|
Zerotorescue@46
|
412 else
|
|
Zerotorescue@46
|
413 MAIL_OPEN_EVERYTHING = nil;
|
|
Zerotorescue@46
|
414 end
|
|
Zerotorescue@0
|
415
|
|
Zerotorescue@0
|
416 -- We're now going to be busy again
|
|
Zerotorescue@0
|
417 self:SetOpeningStatus(true);
|
|
Zerotorescue@0
|
418
|
|
Zerotorescue@0
|
419 -- Open the next mail in line
|
|
Zerotorescue@0
|
420 self:OpenNext();
|
|
Zerotorescue@0
|
421 else
|
|
Zerotorescue@0
|
422 if MailOpener.db.profile.notifications.mailboxIsEmpty then
|
|
Zerotorescue@68
|
423 print(L["|cffff0000There is currently no mail available.|r"]);
|
|
Zerotorescue@0
|
424 end
|
|
Zerotorescue@0
|
425
|
|
Zerotorescue@0
|
426 self:Debug("MO_OPEN_COMPLETE");
|
|
Zerotorescue@0
|
427
|
|
Zerotorescue@0
|
428 -- Report that we're all done
|
|
Zerotorescue@0
|
429 self:SendMessage("MO_OPEN_COMPLETE");
|
|
Zerotorescue@0
|
430 end
|
|
Zerotorescue@0
|
431 end
|
|
Zerotorescue@0
|
432 end
|
|
Zerotorescue@0
|
433
|
|
Zerotorescue@0
|
434 -- Return the type of mail a message subject is
|
|
Zerotorescue@0
|
435 local knownAHSubjectPatterns = {
|
|
Zerotorescue@150
|
436 canceled = AUCTION_REMOVED_MAIL_SUBJECT:format(""),
|
|
Zerotorescue@150
|
437 expired = AUCTION_EXPIRED_MAIL_SUBJECT:format(""),
|
|
Zerotorescue@150
|
438 outbid = AUCTION_OUTBID_MAIL_SUBJECT:format(""),
|
|
Zerotorescue@150
|
439 success = AUCTION_SOLD_MAIL_SUBJECT:format(""),
|
|
Zerotorescue@150
|
440 won = AUCTION_WON_MAIL_SUBJECT:format(""),
|
|
Zerotorescue@0
|
441 };
|
|
Zerotorescue@31
|
442 function mod:GetAuctionMailType(subject)
|
|
Zerotorescue@0
|
443 if subject then
|
|
Zerotorescue@0
|
444 -- 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
|
445 if subject:find(knownAHSubjectPatterns.expired) then
|
|
Zerotorescue@0
|
446 return "expired";
|
|
Zerotorescue@0
|
447 elseif subject:find(knownAHSubjectPatterns.success) then
|
|
Zerotorescue@0
|
448 return "success";
|
|
Zerotorescue@0
|
449 elseif subject:find(knownAHSubjectPatterns.won) then
|
|
Zerotorescue@0
|
450 return "won";
|
|
Zerotorescue@0
|
451 elseif subject:find(knownAHSubjectPatterns.canceled) then
|
|
Zerotorescue@0
|
452 return "canceled";
|
|
Zerotorescue@0
|
453 elseif subject:find(knownAHSubjectPatterns.outbid) then
|
|
Zerotorescue@0
|
454 return "outbid";
|
|
Zerotorescue@0
|
455 end
|
|
Zerotorescue@0
|
456 end
|
|
Zerotorescue@0
|
457
|
|
Zerotorescue@0
|
458 return; -- not auction mail
|
|
Zerotorescue@0
|
459 end
|
|
Zerotorescue@0
|
460
|
|
Zerotorescue@131
|
461 local slotsAvailable;
|
|
Zerotorescue@131
|
462
|
|
Zerotorescue@31
|
463 function mod:OpenMail(index)
|
|
Zerotorescue@68
|
464 if index and index > 0 then
|
|
Zerotorescue@0
|
465 -- LUA arrays start at 1, so mail with index 0 doesn't exist, so we're finished
|
|
Zerotorescue@0
|
466
|
|
Zerotorescue@0
|
467 local sender, subject, gold, cod, _, items, _, _, _, _, isGM = select(3, GetInboxHeaderInfo(index));
|
|
Zerotorescue@0
|
468 local auctionMailType = self:GetAuctionMailType(subject);
|
|
Zerotorescue@0
|
469
|
|
Zerotorescue@68
|
470 if not subject then subject = ""; end
|
|
Zerotorescue@68
|
471
|
|
Zerotorescue@106
|
472 local onlyShowOnceCheck = firstOpenThisSync;
|
|
Zerotorescue@106
|
473
|
|
Zerotorescue@68
|
474 local skippingString = L["Skipping %d: %s (%s)"];
|
|
Zerotorescue@68
|
475
|
|
Zerotorescue@0
|
476 if isGM then
|
|
Zerotorescue@68
|
477 -- Blizzard Mail
|
|
Zerotorescue@106
|
478 if MailOpener.db.profile.notifications.skipped.all and onlyShowOnceCheck and MailOpener.db.profile.notifications.skipped.GMMail then
|
|
Zerotorescue@68
|
479 print(skippingString:format(index, subject, L["Blizzard mail"]));
|
|
Zerotorescue@0
|
480 end
|
|
Zerotorescue@0
|
481
|
|
Zerotorescue@0
|
482 self:OpenNext();
|
|
Zerotorescue@0
|
483
|
|
Zerotorescue@0
|
484 return;
|
|
Zerotorescue@0
|
485 elseif cod and cod > 0 then
|
|
Zerotorescue@0
|
486 -- Cost on delivery
|
|
Zerotorescue@106
|
487 if MailOpener.db.profile.notifications.skipped.all and onlyShowOnceCheck and MailOpener.db.profile.notifications.skipped.COD then
|
|
Zerotorescue@68
|
488 print(skippingString:format(index, subject, L["C.O.D."]));
|
|
Zerotorescue@0
|
489 end
|
|
Zerotorescue@0
|
490
|
|
Zerotorescue@0
|
491 self:OpenNext();
|
|
Zerotorescue@0
|
492
|
|
Zerotorescue@0
|
493 return;
|
|
Zerotorescue@0
|
494 elseif ((gold and gold > 0) or (items and items > 0)) then
|
|
Zerotorescue@0
|
495 -- Mail with some sort of attachments
|
|
Zerotorescue@0
|
496
|
|
Zerotorescue@0
|
497 if self.db.profile.keepFreeSpace > 0 then
|
|
Zerotorescue@79
|
498 slotsAvailable = 0;
|
|
Zerotorescue@79
|
499
|
|
Zerotorescue@79
|
500 -- First find out the amount of empty bag slots
|
|
Zerotorescue@91
|
501 for bag = 0, NUM_BAG_SLOTS do
|
|
Zerotorescue@79
|
502 local numberOfFreeSlots, _ = GetContainerNumFreeSlots(bag);
|
|
Zerotorescue@0
|
503 slotsAvailable = ( slotsAvailable + numberOfFreeSlots );
|
|
Zerotorescue@0
|
504 end
|
|
Zerotorescue@79
|
505
|
|
Zerotorescue@79
|
506 -- Then calculate how much is available after the space we need to leave empty
|
|
Zerotorescue@79
|
507 slotsAvailable = ( slotsAvailable - self.db.profile.keepFreeSpace );
|
|
Zerotorescue@0
|
508 end
|
|
Zerotorescue@0
|
509
|
|
Zerotorescue@79
|
510 -- and not MAIL_OPEN_EVERYTHING
|
|
Zerotorescue@79
|
511 -- Removed above part from below if statement, I forgot why I put it here and now it makes no sense
|
|
Zerotorescue@79
|
512 if inventoryFull and not MailOpener.db.profile.general.continueOpeningStackableItems and items and items > 0 then
|
|
Zerotorescue@106
|
513 if MailOpener.db.profile.notifications.skipped.all and onlyShowOnceCheck and MailOpener.db.profile.notifications.skipped.inventoryFull then
|
|
Zerotorescue@68
|
514 print(skippingString:format(index, subject, L["inventory is full"]));
|
|
Zerotorescue@0
|
515 end
|
|
Zerotorescue@0
|
516
|
|
Zerotorescue@0
|
517 self:OpenNext();
|
|
Zerotorescue@0
|
518
|
|
Zerotorescue@0
|
519 return;
|
|
Zerotorescue@79
|
520 elseif self.db.profile.keepFreeSpace > 0 and items and slotsAvailable ~= nil and slotsAvailable <= 0 then
|
|
Zerotorescue@106
|
521 if MailOpener.db.profile.notifications.skipped.all and onlyShowOnceCheck and MailOpener.db.profile.notifications.skipped.keepFreeSpaceLimit then
|
|
Zerotorescue@68
|
522 print(skippingString:format(index, subject, L["keep free space limit"]));
|
|
Zerotorescue@0
|
523 end
|
|
Zerotorescue@0
|
524
|
|
Zerotorescue@0
|
525 self:OpenNext();
|
|
Zerotorescue@0
|
526
|
|
Zerotorescue@0
|
527 return;
|
|
Zerotorescue@0
|
528 else
|
|
Zerotorescue@0
|
529 -- This string will hold the mailtype, MailOpener.db.profile.notifications.skipped/processed[mailType] will be checked if this should be announced
|
|
Zerotorescue@0
|
530 local mailType = "other";
|
|
Zerotorescue@0
|
531
|
|
Zerotorescue@0
|
532 if not auctionMailType then
|
|
Zerotorescue@0
|
533 -- This is a normal mail
|
|
Zerotorescue@0
|
534
|
|
Zerotorescue@0
|
535 if gold and gold > 0 then
|
|
Zerotorescue@0
|
536 mailType = "normalGoldMail";
|
|
Zerotorescue@0
|
537 elseif items and items > 0 then
|
|
Zerotorescue@0
|
538 mailType = "normalItemsMail";
|
|
Zerotorescue@0
|
539 end
|
|
Zerotorescue@0
|
540 else
|
|
Zerotorescue@0
|
541 -- This is an auction house mail
|
|
Zerotorescue@0
|
542
|
|
Zerotorescue@0
|
543 mailType = "AH" .. auctionMailType;
|
|
Zerotorescue@0
|
544 end
|
|
Zerotorescue@0
|
545
|
|
Zerotorescue@46
|
546 if not MAIL_OPEN_EVERYTHING and not self.db.profile.filter.normalMoney and mailType == "normalGoldMail" then
|
|
Zerotorescue@106
|
547 if MailOpener.db.profile.notifications.skipped.all and onlyShowOnceCheck and MailOpener.db.profile.notifications.skipped[mailType] then
|
|
Zerotorescue@68
|
548 print(skippingString:format(index, subject, L["normal mail with gold"]));
|
|
Zerotorescue@0
|
549 end
|
|
Zerotorescue@0
|
550
|
|
Zerotorescue@0
|
551 self:OpenNext();
|
|
Zerotorescue@0
|
552
|
|
Zerotorescue@0
|
553 return;
|
|
Zerotorescue@46
|
554 elseif not MAIL_OPEN_EVERYTHING and not self.db.profile.filter.normalAttachments and mailType == "normalItemsMail" then
|
|
Zerotorescue@106
|
555 if MailOpener.db.profile.notifications.skipped.all and onlyShowOnceCheck and MailOpener.db.profile.notifications.skipped[mailType] then
|
|
Zerotorescue@68
|
556 print(skippingString:format(index, subject, L["normal mail with attachments"]));
|
|
Zerotorescue@0
|
557 end
|
|
Zerotorescue@0
|
558
|
|
Zerotorescue@0
|
559 self:OpenNext();
|
|
Zerotorescue@0
|
560
|
|
Zerotorescue@0
|
561 return;
|
|
Zerotorescue@46
|
562 elseif not MAIL_OPEN_EVERYTHING and not self.db.profile.filter.AH.expired and mailType == "AHexpired" then
|
|
Zerotorescue@106
|
563 if MailOpener.db.profile.notifications.skipped.all and onlyShowOnceCheck and MailOpener.db.profile.notifications.skipped[mailType] then
|
|
Zerotorescue@68
|
564 print(skippingString:format(index, subject, L["expired auction"]));
|
|
Zerotorescue@0
|
565 end
|
|
Zerotorescue@0
|
566
|
|
Zerotorescue@0
|
567 self:OpenNext();
|
|
Zerotorescue@0
|
568
|
|
Zerotorescue@0
|
569 return;
|
|
Zerotorescue@46
|
570 elseif not MAIL_OPEN_EVERYTHING and not self.db.profile.filter.AH.success and mailType == "AHsuccess" then
|
|
Zerotorescue@106
|
571 if MailOpener.db.profile.notifications.skipped.all and onlyShowOnceCheck and MailOpener.db.profile.notifications.skipped[mailType] then
|
|
Zerotorescue@68
|
572 print(skippingString:format(index, subject, L["successful auction"]));
|
|
Zerotorescue@0
|
573 end
|
|
Zerotorescue@0
|
574
|
|
Zerotorescue@0
|
575 self:OpenNext();
|
|
Zerotorescue@0
|
576
|
|
Zerotorescue@0
|
577 return;
|
|
Zerotorescue@46
|
578 elseif not MAIL_OPEN_EVERYTHING and not self.db.profile.filter.AH.won and mailType == "AHwon" then
|
|
Zerotorescue@106
|
579 if MailOpener.db.profile.notifications.skipped.all and onlyShowOnceCheck and MailOpener.db.profile.notifications.skipped[mailType] then
|
|
Zerotorescue@68
|
580 print(skippingString:format(index, subject, L["auction won"]));
|
|
Zerotorescue@0
|
581 end
|
|
Zerotorescue@0
|
582
|
|
Zerotorescue@0
|
583 self:OpenNext();
|
|
Zerotorescue@0
|
584
|
|
Zerotorescue@0
|
585 return;
|
|
Zerotorescue@46
|
586 elseif not MAIL_OPEN_EVERYTHING and not self.db.profile.filter.AH.canceled and mailType == "AHcanceled" then
|
|
Zerotorescue@106
|
587 if MailOpener.db.profile.notifications.skipped.all and onlyShowOnceCheck and MailOpener.db.profile.notifications.skipped[mailType] then
|
|
Zerotorescue@68
|
588 print(skippingString:format(index, subject, L["canceled auction"]));
|
|
Zerotorescue@0
|
589 end
|
|
Zerotorescue@0
|
590
|
|
Zerotorescue@0
|
591 self:OpenNext();
|
|
Zerotorescue@0
|
592
|
|
Zerotorescue@0
|
593 return;
|
|
Zerotorescue@46
|
594 elseif not MAIL_OPEN_EVERYTHING and not self.db.profile.filter.AH.outbid and mailType == "AHoutbid" then
|
|
Zerotorescue@106
|
595 if MailOpener.db.profile.notifications.skipped.all and onlyShowOnceCheck and MailOpener.db.profile.notifications.skipped[mailType] then
|
|
Zerotorescue@68
|
596 print(skippingString:format(index, subject, L["outbid on auction"]));
|
|
Zerotorescue@0
|
597 end
|
|
Zerotorescue@0
|
598
|
|
Zerotorescue@0
|
599 self:OpenNext();
|
|
Zerotorescue@0
|
600
|
|
Zerotorescue@0
|
601 return;
|
|
Zerotorescue@0
|
602 else
|
|
Zerotorescue@0
|
603 continue = false;
|
|
Zerotorescue@3
|
604
|
|
Zerotorescue@11
|
605 self:Debug("MO_OPENING_MAIL (#" .. index .. ")");
|
|
Zerotorescue@0
|
606
|
|
Zerotorescue@2
|
607 -- Notifiy other modules of opening
|
|
Zerotorescue@2
|
608 self:SendMessage("MO_OPENING_MAIL");
|
|
Zerotorescue@2
|
609
|
|
Zerotorescue@82
|
610 if self.db.profile.keepFreeSpace > 0 and items and slotsAvailable and items > slotsAvailable then
|
|
Zerotorescue@79
|
611 -- If this mail contains more items than the space available, we must only take a few attachments
|
|
Zerotorescue@79
|
612
|
|
Zerotorescue@79
|
613 for attachIndex = 1, ATTACHMENTS_MAX_RECEIVE do
|
|
Zerotorescue@79
|
614 if GetInboxItemLink(index, attachIndex) then
|
|
Zerotorescue@79
|
615 -- If this attachment actually exists
|
|
Zerotorescue@79
|
616
|
|
Zerotorescue@79
|
617 if slotsAvailable > 0 then
|
|
Zerotorescue@79
|
618 -- If we still have slots available, then loot this one item
|
|
Zerotorescue@79
|
619
|
|
Zerotorescue@79
|
620 self:Debug("Taking attachment " .. attachIndex);
|
|
Zerotorescue@79
|
621
|
|
Zerotorescue@79
|
622 TakeInboxItem(index, attachIndex);
|
|
Zerotorescue@131
|
623 takingSingleItem = true;
|
|
Zerotorescue@131
|
624
|
|
Zerotorescue@131
|
625 -- We want to open the next attachment for this same mail again, so set the index one back
|
|
Zerotorescue@131
|
626 MAIL_ITEM_INDEX = ( MAIL_ITEM_INDEX + 1 );
|
|
Zerotorescue@79
|
627
|
|
Zerotorescue@79
|
628 -- Gained an item, lost an available slot
|
|
Zerotorescue@79
|
629 slotsAvailable = ( slotsAvailable - 1 );
|
|
Zerotorescue@131
|
630
|
|
Zerotorescue@131
|
631 break;
|
|
Zerotorescue@79
|
632 else
|
|
Zerotorescue@79
|
633 -- No more room available, announce and go to next item
|
|
Zerotorescue@106
|
634 if MailOpener.db.profile.notifications.skipped.all and onlyShowOnceCheck and MailOpener.db.profile.notifications.skipped.keepFreeSpaceLimit then
|
|
Zerotorescue@79
|
635 print(skippingString:format(index, subject, L["keep free space limit"]));
|
|
Zerotorescue@79
|
636 end
|
|
Zerotorescue@79
|
637
|
|
Zerotorescue@79
|
638 -- We're done with this mail, it isn't empty so that event won't be triggered, but we may still continue
|
|
Zerotorescue@79
|
639 continue = true;
|
|
Zerotorescue@79
|
640
|
|
Zerotorescue@79
|
641 self:OpenNext();
|
|
Zerotorescue@79
|
642
|
|
Zerotorescue@79
|
643 return;
|
|
Zerotorescue@79
|
644 end
|
|
Zerotorescue@79
|
645 end
|
|
Zerotorescue@79
|
646 end
|
|
Zerotorescue@79
|
647 else
|
|
Zerotorescue@79
|
648 -- Take everything from this mail
|
|
Zerotorescue@79
|
649 AutoLootMailItem(index);
|
|
Zerotorescue@79
|
650 end
|
|
Zerotorescue@0
|
651
|
|
Zerotorescue@0
|
652 if MailOpener.db.profile.notifications.processed.all and MailOpener.db.profile.notifications.processed[mailType] then
|
|
Zerotorescue@0
|
653 if gold and gold > 0 then
|
|
Zerotorescue@68
|
654 print(L["Processing %d: %s (%s)"]:format(index, subject, MailOpener:FormatMoney(gold)));
|
|
Zerotorescue@0
|
655 else
|
|
Zerotorescue@68
|
656 print(L["Processing %d: %s"]:format(index, subject));
|
|
Zerotorescue@0
|
657 end
|
|
Zerotorescue@0
|
658 end
|
|
Zerotorescue@0
|
659
|
|
Zerotorescue@131
|
660 self:CancelTimer(self.tmrMailOpener, true);
|
|
Zerotorescue@0
|
661 -- And prepare for the next
|
|
Zerotorescue@0
|
662 self.tmrMailOpener = self:ScheduleTimer("OpenNext", self.db.profile.speed);
|
|
Zerotorescue@0
|
663 end
|
|
Zerotorescue@0
|
664 end
|
|
Zerotorescue@0
|
665 else
|
|
Zerotorescue@0
|
666 -- Unknown, probably just text
|
|
Zerotorescue@106
|
667 if MailOpener.db.profile.notifications.skipped.all and onlyShowOnceCheck and MailOpener.db.profile.notifications.skipped.other then
|
|
Zerotorescue@68
|
668 print(L["Skipping %d: %s"]:format(index, subject));
|
|
Zerotorescue@0
|
669 end
|
|
Zerotorescue@0
|
670
|
|
Zerotorescue@0
|
671 self:OpenNext();
|
|
Zerotorescue@0
|
672 end
|
|
Zerotorescue@0
|
673 else
|
|
Zerotorescue@0
|
674 -- Finished!
|
|
Zerotorescue@106
|
675 if MailOpener.db.profile.notifications.finishedCurrentBatch and firstOpenThisSync then
|
|
Zerotorescue@68
|
676 print(L["Finished opening the current batch."]);
|
|
Zerotorescue@0
|
677 end
|
|
Zerotorescue@0
|
678
|
|
Zerotorescue@106
|
679 -- We have opened mail once this batch, so quit notifying
|
|
Zerotorescue@106
|
680 firstOpenThisSync = nil;
|
|
Zerotorescue@106
|
681
|
|
Zerotorescue@0
|
682 self:SetOpeningStatus(false);
|
|
Zerotorescue@3
|
683
|
|
Zerotorescue@0
|
684 self:Debug("MO_OPEN_COMPLETE");
|
|
Zerotorescue@0
|
685
|
|
Zerotorescue@0
|
686 -- Report that we're all done
|
|
Zerotorescue@0
|
687 self:SendMessage("MO_OPEN_COMPLETE");
|
|
Zerotorescue@0
|
688 end
|
|
Zerotorescue@0
|
689 end
|
|
Zerotorescue@0
|
690
|
|
Zerotorescue@31
|
691 function mod:OpenNext()
|
|
Zerotorescue@0
|
692 if continue then
|
|
Zerotorescue@0
|
693 -- If the previous mail was opened successful, open the next
|
|
Zerotorescue@0
|
694
|
|
Zerotorescue@0
|
695 -- Next mail in line
|
|
Zerotorescue@0
|
696 MAIL_ITEM_INDEX = ( MAIL_ITEM_INDEX - 1 );
|
|
Zerotorescue@0
|
697
|
|
Zerotorescue@0
|
698 -- Open it
|
|
Zerotorescue@0
|
699 self:OpenMail(MAIL_ITEM_INDEX);
|
|
Zerotorescue@0
|
700 else
|
|
Zerotorescue@0
|
701 -- Try again at the next interval
|
|
Zerotorescue@0
|
702
|
|
Zerotorescue@131
|
703 self:CancelTimer(self.tmrMailOpener, true);
|
|
Zerotorescue@0
|
704 self.tmrMailOpener = self:ScheduleTimer("OpenNext", self.db.profile.speed);
|
|
Zerotorescue@0
|
705 end
|
|
Zerotorescue@0
|
706 end
|
|
Zerotorescue@0
|
707
|
|
Zerotorescue@31
|
708 function mod:Continue()
|
|
Zerotorescue@2
|
709 continue = true;
|
|
Zerotorescue@131
|
710 takingSingleItem = nil;
|
|
Zerotorescue@2
|
711 end
|
|
Zerotorescue@2
|
712
|
|
Zerotorescue@0
|
713 local mailRemainingPatterns = {
|
|
Zerotorescue@68
|
714 minutesSeconds = L["|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@68
|
715 minutes = L["|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@68
|
716 seconds = L["|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@68
|
717 nextRefresh = L["|cffffffff%d|r/|cffffffff%d|r mail remaining, next refresh in |cffffffff%d|r seconds."],
|
|
Zerotorescue@68
|
718 waitingBatch = L["|cffffffff%d|r/|cffffffff%d|r mail remaining - waiting for something from the current batch to be opened..."],
|
|
Zerotorescue@68
|
719 waitingSync = L["|cffffffff%d|r/|cffffffff%d|r mail remaining - waiting for the next mailbox refresh..."],
|
|
Zerotorescue@68
|
720 soon = L["|cffffffff%d|r/|cffffffff%d|r mail remaining - everything will be opened soon..."],
|
|
Zerotorescue@0
|
721 };
|
|
Zerotorescue@0
|
722
|
|
Zerotorescue@31
|
723 function mod:UpdateTimer()
|
|
Zerotorescue@0
|
724 if lastSync then
|
|
Zerotorescue@3
|
725 self:UpdateMailCount();
|
|
Zerotorescue@3
|
726
|
|
Zerotorescue@0
|
727 -- Calculate the total amount of mail waiting
|
|
Zerotorescue@0
|
728 local numTotalMail = ( numHiddenMail + numCurrentMail );
|
|
Zerotorescue@0
|
729
|
|
Zerotorescue@0
|
730 -- Resize the font based on mail left so the counter always fits perfectly
|
|
Zerotorescue@0
|
731 if numTotalMail < 100 then
|
|
Zerotorescue@0
|
732 self.timeLeftFrame.text:SetFont(GameFontHighlight:GetFont(), 30, "THICKOUTLINE");
|
|
Zerotorescue@0
|
733 elseif numTotalMail < 1000 then
|
|
Zerotorescue@0
|
734 self.timeLeftFrame.text:SetFont(GameFontHighlight:GetFont(), 24, "THICKOUTLINE");
|
|
Zerotorescue@0
|
735 else
|
|
Zerotorescue@0
|
736 self.timeLeftFrame.text:SetFont(GameFontHighlight:GetFont(), 18, "THICKOUTLINE");
|
|
Zerotorescue@0
|
737 end
|
|
Zerotorescue@0
|
738 self.timeLeftFrame.text:SetText(numTotalMail);
|
|
Zerotorescue@3
|
739
|
|
Zerotorescue@3
|
740 -- Calculate the next server sync based on the last server sync plus sync interval
|
|
Zerotorescue@3
|
741 local nextSync = ( lastSync + 61 );
|
|
Zerotorescue@0
|
742
|
|
Zerotorescue@3
|
743 -- Calculate the timer remaining untill the next sync
|
|
Zerotorescue@3
|
744 local timeRemaining = floor( nextSync - GetTime() );
|
|
Zerotorescue@3
|
745
|
|
Zerotorescue@3
|
746 if numHiddenMail > 0 or timeRemaining > 0 then
|
|
Zerotorescue@3
|
747 -- If there is still mail being hidden or the timer is still know, display stuff
|
|
Zerotorescue@0
|
748
|
|
Zerotorescue@0
|
749 -- If the next sync was already due, our nextSync calculation was wrong and we must wait a little longer (lag?)
|
|
Zerotorescue@0
|
750 local syncTimeOut = false;
|
|
Zerotorescue@0
|
751 -- If time remaining is below 0, next sync should be soon
|
|
Zerotorescue@0
|
752 if timeRemaining < 0 then
|
|
Zerotorescue@0
|
753 timeRemaining = 0;
|
|
Zerotorescue@0
|
754 syncTimeOut = true;
|
|
Zerotorescue@0
|
755 end
|
|
Zerotorescue@0
|
756
|
|
Zerotorescue@0
|
757 -- Calculate the amount of server syncs required to open all mail
|
|
Zerotorescue@0
|
758 local syncsRequired = ceil( numHiddenMail / 50 );
|
|
Zerotorescue@0
|
759 -- Calculate the time required to execute all these syncs
|
|
Zerotorescue@0
|
760 local timeRequired = ( ( syncsRequired - 1 ) * 61 ) + timeRemaining;
|
|
Zerotorescue@0
|
761
|
|
Zerotorescue@0
|
762 local minutes = floor( timeRequired / 60 );
|
|
Zerotorescue@0
|
763 local seconds = floor( timeRequired % 60 );
|
|
Zerotorescue@0
|
764
|
|
Zerotorescue@0
|
765 local remainingText;
|
|
Zerotorescue@0
|
766 if syncTimeOut then
|
|
Zerotorescue@3
|
767 -- Previous server sync was expected earlier, notify user
|
|
Zerotorescue@3
|
768
|
|
Zerotorescue@0
|
769 if numCurrentMail == 50 then
|
|
Zerotorescue@3
|
770 -- Sync couldn't occur because we were still waiting for the current batch to be opened
|
|
Zerotorescue@0
|
771 remainingText = format(mailRemainingPatterns.waitingBatch, numCurrentMail, numTotalMail);
|
|
Zerotorescue@0
|
772 else
|
|
Zerotorescue@0
|
773 remainingText = format(mailRemainingPatterns.waitingSync, numCurrentMail, numTotalMail);
|
|
Zerotorescue@0
|
774 end
|
|
Zerotorescue@3
|
775 elseif numHiddenMail == 0 then
|
|
Zerotorescue@3
|
776 -- If no hidden mail is remaining, only show the timer for as long as we can be sure
|
|
Zerotorescue@3
|
777
|
|
Zerotorescue@3
|
778 remainingText = format(mailRemainingPatterns.nextRefresh, numCurrentMail, numTotalMail, timeRemaining);
|
|
Zerotorescue@0
|
779 elseif minutes ~= 0 then
|
|
Zerotorescue@0
|
780 if seconds ~= 0 then
|
|
Zerotorescue@0
|
781 remainingText = format(mailRemainingPatterns.minutesSeconds, numCurrentMail, numTotalMail, minutes, seconds, timeRemaining);
|
|
Zerotorescue@0
|
782 else
|
|
Zerotorescue@0
|
783 remainingText = format(mailRemainingPatterns.minutes, numCurrentMail, numTotalMail, minutes, timeRemaining);
|
|
Zerotorescue@0
|
784 end
|
|
Zerotorescue@0
|
785 elseif seconds ~= 0 then
|
|
Zerotorescue@0
|
786 remainingText = format(mailRemainingPatterns.seconds, numCurrentMail, numTotalMail, seconds, timeRemaining);
|
|
Zerotorescue@0
|
787 else
|
|
Zerotorescue@0
|
788 remainingText = format(mailRemainingPatterns.soon, numCurrentMail, numTotalMail);
|
|
Zerotorescue@0
|
789 end
|
|
Zerotorescue@0
|
790
|
|
Zerotorescue@0
|
791 self.timeLeftFrame.smallText:SetText(remainingText);
|
|
Zerotorescue@3
|
792 else
|
|
Zerotorescue@0
|
793 self.timeLeftFrame.smallText:SetText("");
|
|
Zerotorescue@0
|
794 end
|
|
Zerotorescue@0
|
795 end
|
|
Zerotorescue@0
|
796 end
|
|
Zerotorescue@0
|
797
|
|
Zerotorescue@31
|
798 function mod:StopOpening(simple)
|
|
Zerotorescue@2
|
799 -- Stop opener timer
|
|
Zerotorescue@2
|
800 self:CancelTimer(self.tmrMailOpener, true);
|
|
Zerotorescue@2
|
801
|
|
Zerotorescue@0
|
802 if not simple then
|
|
Zerotorescue@39
|
803 -- A simple stop is an automated stop, an advanced stop is one manually or after a sever sync
|
|
Zerotorescue@2
|
804
|
|
Zerotorescue@0
|
805 -- Recheck inventory full
|
|
Zerotorescue@0
|
806 inventoryFull = false;
|
|
Zerotorescue@0
|
807 -- Replay sound
|
|
Zerotorescue@0
|
808 inventoryFullSoundPlayed = nil;
|
|
Zerotorescue@0
|
809 end
|
|
Zerotorescue@0
|
810
|
|
Zerotorescue@0
|
811 -- Reset opener position
|
|
Zerotorescue@0
|
812 MAIL_ITEM_INDEX = 0;
|
|
Zerotorescue@46
|
813 -- Reset open everything state
|
|
Zerotorescue@46
|
814 MAIL_OPEN_EVERYTHING = nil;
|
|
Zerotorescue@0
|
815 -- Stopped opening, so allow to continue
|
|
Zerotorescue@0
|
816 continue = true;
|
|
Zerotorescue@31
|
817
|
|
Zerotorescue@131
|
818 takingSingleItem = nil;
|
|
Zerotorescue@131
|
819
|
|
Zerotorescue@0
|
820 self:SetOpeningStatus(false);
|
|
Zerotorescue@0
|
821 end
|
|
Zerotorescue@0
|
822
|
|
Zerotorescue@31
|
823 function mod:SetOpeningStatus(openingStatus)
|
|
Zerotorescue@0
|
824 opening = openingStatus;
|
|
Zerotorescue@0
|
825
|
|
Zerotorescue@0
|
826 if openingStatus then
|
|
Zerotorescue@68
|
827 self.btnOpenAll:SetText(L["Opening..."]);
|
|
Zerotorescue@0
|
828 else
|
|
Zerotorescue@68
|
829 self.btnOpenAll:SetText(L["Open all"]);
|
|
Zerotorescue@0
|
830 end
|
|
Zerotorescue@0
|
831 end
|
|
Zerotorescue@0
|
832
|
|
Zerotorescue@31
|
833 function mod:GetOptionsGroup()
|
|
Zerotorescue@0
|
834 local configGroup = {
|
|
Zerotorescue@0
|
835 order = 300,
|
|
Zerotorescue@0
|
836 type = "group",
|
|
Zerotorescue@68
|
837 name = L["Open All"],
|
|
Zerotorescue@68
|
838 desc = L["Change open all settings."],
|
|
Zerotorescue@0
|
839 args = {
|
|
Zerotorescue@0
|
840 filters = {
|
|
Zerotorescue@0
|
841 order = 10,
|
|
Zerotorescue@0
|
842 type = "group",
|
|
Zerotorescue@0
|
843 inline = true,
|
|
Zerotorescue@68
|
844 name = L["Filters"],
|
|
Zerotorescue@0
|
845 args = {
|
|
Zerotorescue@0
|
846 description = {
|
|
Zerotorescue@0
|
847 order = 10,
|
|
Zerotorescue@0
|
848 type = "description",
|
|
Zerotorescue@68
|
849 name = L["Toggle which mail the opener should autoloot."],
|
|
Zerotorescue@0
|
850 },
|
|
Zerotorescue@0
|
851 AHHeader = {
|
|
Zerotorescue@0
|
852 order = 15,
|
|
Zerotorescue@0
|
853 type = "header",
|
|
Zerotorescue@68
|
854 name = L["Auction House Mail"],
|
|
Zerotorescue@0
|
855 },
|
|
Zerotorescue@0
|
856 canceled = {
|
|
Zerotorescue@0
|
857 order = 20,
|
|
Zerotorescue@0
|
858 type = "toggle",
|
|
Zerotorescue@68
|
859 name = L["Open all |cfffed000auction canceled|r mail"],
|
|
Zerotorescue@68
|
860 desc = L["Automatically loot all auction canceled mail from the auction house."],
|
|
Zerotorescue@0
|
861 set = function(i, v) self.db.profile.filter.AH.canceled = v; end,
|
|
Zerotorescue@0
|
862 get = function() return self.db.profile.filter.AH.canceled; end,
|
|
Zerotorescue@0
|
863 width = "double",
|
|
Zerotorescue@0
|
864 },
|
|
Zerotorescue@0
|
865 expired = {
|
|
Zerotorescue@0
|
866 order = 21,
|
|
Zerotorescue@0
|
867 type = "toggle",
|
|
Zerotorescue@68
|
868 name = L["Open all |cfffed000auction expired|r mail"],
|
|
Zerotorescue@68
|
869 desc = L["Automatically loot all auction expired mail from the auction house."],
|
|
Zerotorescue@0
|
870 set = function(i, v) self.db.profile.filter.AH.expired = v; end,
|
|
Zerotorescue@0
|
871 get = function() return self.db.profile.filter.AH.expired; end,
|
|
Zerotorescue@0
|
872 width = "double",
|
|
Zerotorescue@0
|
873 },
|
|
Zerotorescue@0
|
874 outbid = {
|
|
Zerotorescue@0
|
875 order = 22,
|
|
Zerotorescue@0
|
876 type = "toggle",
|
|
Zerotorescue@68
|
877 name = L["Open all |cfffed000outbid on|r mail"],
|
|
Zerotorescue@68
|
878 desc = L["Automatically loot all auction outbid mail from the auction house."],
|
|
Zerotorescue@0
|
879 set = function(i, v) self.db.profile.filter.AH.outbid = v; end,
|
|
Zerotorescue@0
|
880 get = function() return self.db.profile.filter.AH.outbid; end,
|
|
Zerotorescue@0
|
881 width = "double",
|
|
Zerotorescue@0
|
882 },
|
|
Zerotorescue@0
|
883 success = {
|
|
Zerotorescue@0
|
884 order = 23,
|
|
Zerotorescue@0
|
885 type = "toggle",
|
|
Zerotorescue@68
|
886 name = L["Open all |cfffed000auction successful|r mail"],
|
|
Zerotorescue@68
|
887 desc = L["Automatically loot all auction successful mail from the auction house."],
|
|
Zerotorescue@0
|
888 set = function(i, v) self.db.profile.filter.AH.success = v; end,
|
|
Zerotorescue@0
|
889 get = function() return self.db.profile.filter.AH.success; end,
|
|
Zerotorescue@0
|
890 width = "double",
|
|
Zerotorescue@0
|
891 },
|
|
Zerotorescue@0
|
892 won = {
|
|
Zerotorescue@0
|
893 order = 24,
|
|
Zerotorescue@0
|
894 type = "toggle",
|
|
Zerotorescue@68
|
895 name = L["Open all |cfffed000auction won|r mail"],
|
|
Zerotorescue@68
|
896 desc = L["Automatically loot all auction won mail from the auction house."],
|
|
Zerotorescue@0
|
897 set = function(i, v) self.db.profile.filter.AH.won = v; end,
|
|
Zerotorescue@0
|
898 get = function() return self.db.profile.filter.AH.won; end,
|
|
Zerotorescue@0
|
899 width = "double",
|
|
Zerotorescue@0
|
900 },
|
|
Zerotorescue@0
|
901 normalHeader = {
|
|
Zerotorescue@0
|
902 order = 30,
|
|
Zerotorescue@0
|
903 type = "header",
|
|
Zerotorescue@68
|
904 name = L["Remaining Mail"],
|
|
Zerotorescue@0
|
905 },
|
|
Zerotorescue@0
|
906 normalAttachments = {
|
|
Zerotorescue@0
|
907 order = 40,
|
|
Zerotorescue@0
|
908 type = "toggle",
|
|
Zerotorescue@68
|
909 name = L["Normal mail with |cfffed000attachments|r"],
|
|
Zerotorescue@68
|
910 desc = L["Automatically loot all normal mail containing attachments (CoDs and Blizzard mail will be skipped)."],
|
|
Zerotorescue@0
|
911 set = function(i, v) self.db.profile.filter.normalAttachments = v; end,
|
|
Zerotorescue@0
|
912 get = function() return self.db.profile.filter.normalAttachments; end,
|
|
Zerotorescue@0
|
913 width = "double",
|
|
Zerotorescue@0
|
914 },
|
|
Zerotorescue@0
|
915 normalMoney = {
|
|
Zerotorescue@0
|
916 order = 50,
|
|
Zerotorescue@0
|
917 type = "toggle",
|
|
Zerotorescue@68
|
918 name = L["Normal mail with |cfffed000gold|r"],
|
|
Zerotorescue@68
|
919 desc = L["Automatically loot all normal mail containing gold (CoDs and Blizzard mail will be skipped)."],
|
|
Zerotorescue@0
|
920 set = function(i, v) self.db.profile.filter.normalMoney = v; end,
|
|
Zerotorescue@0
|
921 get = function() return self.db.profile.filter.normalMoney; end,
|
|
Zerotorescue@0
|
922 width = "double",
|
|
Zerotorescue@0
|
923 },
|
|
Zerotorescue@50
|
924 allowShiftClick = {
|
|
Zerotorescue@50
|
925 order = 60,
|
|
Zerotorescue@50
|
926 type = "toggle",
|
|
Zerotorescue@68
|
927 name = L["Allow shift-clicking of the |cfffed000Open All|r button to autoloot |cfffed000everything|r, regardless of the above filters."],
|
|
Zerotorescue@68
|
928 desc = L["Allow shift-clicking of the |cfffed000Open All|r button to autoloot |cfffed000everything|r with attachments, temporarily overriding all filters."],
|
|
Zerotorescue@50
|
929 set = function(i, v) self.db.profile.filter.allowShiftClick = v; end,
|
|
Zerotorescue@50
|
930 get = function() return self.db.profile.filter.allowShiftClick; end,
|
|
Zerotorescue@50
|
931 width = "full",
|
|
Zerotorescue@50
|
932 },
|
|
Zerotorescue@0
|
933 },
|
|
Zerotorescue@0
|
934 },
|
|
Zerotorescue@0
|
935 -- Continuous opening config inline group
|
|
Zerotorescue@0
|
936 continuousOpening = {
|
|
Zerotorescue@0
|
937 order = 20,
|
|
Zerotorescue@0
|
938 type = "group",
|
|
Zerotorescue@0
|
939 inline = true,
|
|
Zerotorescue@68
|
940 name = L["Opening Interval"],
|
|
Zerotorescue@0
|
941 args = {
|
|
Zerotorescue@0
|
942 description = {
|
|
Zerotorescue@0
|
943 order = 10,
|
|
Zerotorescue@0
|
944 type = "description",
|
|
Zerotorescue@0
|
945 name = function()
|
|
Zerotorescue@68
|
946 local defaultString = L["The default behavior 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
|
947
|
|
Zerotorescue@0
|
948 local currentSettings = "";
|
|
Zerotorescue@0
|
949 if MailOpener.db.profile.general.continueOpening then
|
|
Zerotorescue@68
|
950 currentSettings = currentSettings .. L["Mail Opener will |cff00ff00continue|r to attempt to open the remaining mail every |cfffed000%d seconds|r."]:format(MailOpener.db.profile.general.waitTime) .. " ";
|
|
Zerotorescue@0
|
951 else
|
|
Zerotorescue@68
|
952 currentSettings = currentSettings .. L["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
|
953 end
|
|
Zerotorescue@68
|
954 currentSettings = currentSettings .. L["The first batch after each server refresh will be opened after waiting |cfffed000%d seconds|r."]:format(MailOpener.db.profile.general.initialDelay);
|
|
Zerotorescue@0
|
955 return defaultString .. currentSettings;
|
|
Zerotorescue@0
|
956 end,
|
|
Zerotorescue@0
|
957 },
|
|
Zerotorescue@0
|
958 header = {
|
|
Zerotorescue@0
|
959 order = 15,
|
|
Zerotorescue@0
|
960 type = "header",
|
|
Zerotorescue@0
|
961 name = "",
|
|
Zerotorescue@0
|
962 },
|
|
Zerotorescue@0
|
963 continueOpening = {
|
|
Zerotorescue@0
|
964 order = 20,
|
|
Zerotorescue@0
|
965 type = "toggle",
|
|
Zerotorescue@68
|
966 name = L["Continue opening mail"],
|
|
Zerotorescue@68
|
967 desc = L["Continue opening mail at the interval set below, even if the mailbox wasn't refreshed recently."],
|
|
Zerotorescue@0
|
968 width = "full",
|
|
Zerotorescue@0
|
969 get = function() return MailOpener.db.profile.general.continueOpening; end,
|
|
Zerotorescue@0
|
970 set = function(i, v) MailOpener.db.profile.general.continueOpening = v; end,
|
|
Zerotorescue@0
|
971 },
|
|
Zerotorescue@0
|
972 waitTime = {
|
|
Zerotorescue@0
|
973 order = 30,
|
|
Zerotorescue@0
|
974 type = "range",
|
|
Zerotorescue@0
|
975 width = "double",
|
|
Zerotorescue@0
|
976 min = 0.5,
|
|
Zerotorescue@0
|
977 max = 60,
|
|
Zerotorescue@0
|
978 step = 0.5,
|
|
Zerotorescue@68
|
979 name = L["Continued Mail Opening Interval"],
|
|
Zerotorescue@68
|
980 desc = L["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
|
981 get = function() return MailOpener.db.profile.general.waitTime; end,
|
|
Zerotorescue@0
|
982 set = function(i, v) MailOpener.db.profile.general.waitTime = v; end,
|
|
Zerotorescue@0
|
983 disabled = function() return (not MailOpener.db.profile.general.continueOpening); end,
|
|
Zerotorescue@0
|
984 },
|
|
Zerotorescue@0
|
985 initialDelay = {
|
|
Zerotorescue@0
|
986 order = 40,
|
|
Zerotorescue@0
|
987 type = "range",
|
|
Zerotorescue@0
|
988 width = "double",
|
|
Zerotorescue@0
|
989 min = 0.5,
|
|
Zerotorescue@0
|
990 max = 60,
|
|
Zerotorescue@0
|
991 step = 0.5,
|
|
Zerotorescue@68
|
992 name = L["Initial Mail Opening Delay"],
|
|
Zerotorescue@68
|
993 desc = L["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
|
994 get = function() return MailOpener.db.profile.general.initialDelay; end,
|
|
Zerotorescue@0
|
995 set = function(i, v) MailOpener.db.profile.general.initialDelay = v; end,
|
|
Zerotorescue@0
|
996 },
|
|
Zerotorescue@0
|
997 },
|
|
Zerotorescue@0
|
998 }, -- end Continuous opening config inline group
|
|
Zerotorescue@0
|
999 keepFree = {
|
|
Zerotorescue@0
|
1000 order = 30,
|
|
Zerotorescue@0
|
1001 type = "group",
|
|
Zerotorescue@0
|
1002 inline = true,
|
|
Zerotorescue@68
|
1003 name = L["Keep Free Space"],
|
|
Zerotorescue@0
|
1004 args = {
|
|
Zerotorescue@0
|
1005 description = {
|
|
Zerotorescue@0
|
1006 order = 10,
|
|
Zerotorescue@0
|
1007 type = "description",
|
|
Zerotorescue@79
|
1008 name = L["You can set an amount of bag space you wish to reserve when opening mail."],
|
|
Zerotorescue@0
|
1009 },
|
|
Zerotorescue@0
|
1010 header = {
|
|
Zerotorescue@0
|
1011 order = 15,
|
|
Zerotorescue@0
|
1012 type = "header",
|
|
Zerotorescue@0
|
1013 name = "",
|
|
Zerotorescue@0
|
1014 },
|
|
Zerotorescue@0
|
1015 keepFreeSpace = {
|
|
Zerotorescue@0
|
1016 order = 20,
|
|
Zerotorescue@0
|
1017 type = "range",
|
|
Zerotorescue@0
|
1018 min = 0,
|
|
Zerotorescue@0
|
1019 max = 100,
|
|
Zerotorescue@0
|
1020 step = 1,
|
|
Zerotorescue@0
|
1021 width = "double",
|
|
Zerotorescue@68
|
1022 name = L["Keep free space"],
|
|
Zerotorescue@79
|
1023 desc = L["Change the amount of space to reserve for other things when opening mail.\n\nEnabling this functionality by setting this value above 0 may increase resource usage slightly."],
|
|
Zerotorescue@0
|
1024 set = function(i, v) self.db.profile.keepFreeSpace = v; end,
|
|
Zerotorescue@0
|
1025 get = function() return self.db.profile.keepFreeSpace; end,
|
|
Zerotorescue@0
|
1026 },
|
|
Zerotorescue@0
|
1027 },
|
|
Zerotorescue@0
|
1028 },
|
|
Zerotorescue@0
|
1029 speed = {
|
|
Zerotorescue@0
|
1030 order = 40,
|
|
Zerotorescue@0
|
1031 type = "group",
|
|
Zerotorescue@0
|
1032 inline = true,
|
|
Zerotorescue@0
|
1033 name = "Opening Speed",
|
|
Zerotorescue@0
|
1034 args = {
|
|
Zerotorescue@0
|
1035 description = {
|
|
Zerotorescue@0
|
1036 order = 10,
|
|
Zerotorescue@0
|
1037 type = "description",
|
|
Zerotorescue@68
|
1038 name = L["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
|
1039 },
|
|
Zerotorescue@0
|
1040 header = {
|
|
Zerotorescue@0
|
1041 order = 15,
|
|
Zerotorescue@0
|
1042 type = "header",
|
|
Zerotorescue@0
|
1043 name = "",
|
|
Zerotorescue@0
|
1044 },
|
|
Zerotorescue@0
|
1045 openMailInterval = {
|
|
Zerotorescue@0
|
1046 order = 20,
|
|
Zerotorescue@0
|
1047 type = "range",
|
|
Zerotorescue@0
|
1048 min = 5,
|
|
Zerotorescue@0
|
1049 max = 2500,
|
|
Zerotorescue@0
|
1050 step = 5,
|
|
Zerotorescue@0
|
1051 width = "double",
|
|
Zerotorescue@68
|
1052 name = L["Open single mail interval"],
|
|
Zerotorescue@68
|
1053 desc = L["Change the mail opening speed (in microseconds) for each mail. Lower may not always be faster."],
|
|
Zerotorescue@0
|
1054 get = function() return ( self.db.profile.speed * 1000 ); end,
|
|
Zerotorescue@0
|
1055 set = function(i, v) self.db.profile.speed = ( v / 1000 ); end,
|
|
Zerotorescue@0
|
1056 },
|
|
Zerotorescue@0
|
1057 },
|
|
Zerotorescue@0
|
1058 },
|
|
Zerotorescue@0
|
1059 },
|
|
Zerotorescue@0
|
1060 };
|
|
Zerotorescue@0
|
1061
|
|
Zerotorescue@0
|
1062 return configGroup;
|
|
Zerotorescue@0
|
1063 end
|
|
Zerotorescue@0
|
1064
|
|
Zerotorescue@31
|
1065 function mod:Debug(t)
|
|
Zerotorescue@68
|
1066 return MailOpener:Debug(("|cff00ff00OpenAll|r:%s"):format(t));
|
|
Zerotorescue@0
|
1067 end |