comparison Modules/Collected.lua @ 37:81e7cfcc36b9

No longer showing spent ?0 minutes? when you spent less than 59 seconds at the mailbox. When you only opened a single mail, the summary will show ?from time mail? rather than ?from these mails?.
author Zerotorescue
date Sat, 11 Sep 2010 01:37:13 +0200
parents 90d58723ac0a
children 5f0e174c8adc
comparison
equal deleted inserted replaced
36:a918ec27126f 37:81e7cfcc36b9
233 233
234 -- Did we record any mail being opened? 234 -- Did we record any mail being opened?
235 if mailOpened and mailOpened > 0 then 235 if mailOpened and mailOpened > 0 then
236 -- Time Spent 236 -- Time Spent
237 if timeSpent and timeSpent > 0 then 237 if timeSpent and timeSpent > 0 then
238 printMessage = printMessage .. format("Collected a total of %d mails within %d minutes and %d seconds. ", mailOpened, floor( timeSpent / 60 ), ( timeSpent % 60 )); 238 local timeSpentMinutes = floor( timeSpent / 60 );
239 local timeSpentSeconds = ( timeSpent % 60 );
240 if timeSpentMinutes ~= 0 then
241 printMessage = printMessage .. format("Collected a total of %d mails within %d minutes and %d seconds. ", mailOpened, timeSpentMinutes, timeSpentSeconds);
242 else
243 printMessage = printMessage .. format("Collected a total of %d mails within %d seconds. ", mailOpened, timeSpentSeconds);
244 end
239 else 245 else
240 printMessage = printMessage .. format("Collected a total of %d mails. ", mailOpened); 246 printMessage = printMessage .. format("Collected a total of %d mails. ", mailOpened);
241 end 247 end
242 elseif timeSpent and timeSpent > 0 then 248 elseif timeSpent and timeSpent > 0 then
243 printMessage = printMessage .. format("Spent %d minutes and %d seconds collecting mail. ", floor( timeSpent / 60 ), ( timeSpent % 60 )); 249 local timeSpentMinutes = floor( timeSpent / 60 );
250 local timeSpentSeconds = ( timeSpent % 60 );
251 if timeSpentMinutes ~= 0 then
252 printMessage = printMessage .. format("Spent %d minutes and %d seconds collecting mail. ", mailOpened, timeSpentMinutes, timeSpentSeconds);
253 else
254 printMessage = printMessage .. format("Spent %d seconds collecting mail. ", mailOpened, timeSpentSeconds);
255 end
256 end
257
258 local mailsPrefix = "";
259 if mailOpened == 1 then
260 mailsPrefix = "From this mail";
261 else
262 mailsPrefix = "From these mails";
244 end 263 end
245 264
246 -- Did we record any items or gold being looted? 265 -- Did we record any items or gold being looted?
247 if (itemsGained and itemsGained > 0) and (earned and earned > 0) then 266 if (itemsGained and itemsGained > 0) and (earned and earned > 0) then
248 printMessage = printMessage .. format("From these mails you gained %d items and %s.", itemsGained, MailOpener:FormatMoney(earned)); 267 printMessage = printMessage .. format("%s you gained %d items and %s.", mailsPrefix, itemsGained, MailOpener:FormatMoney(earned));
249 elseif itemsGained and itemsGained > 0 then 268 elseif itemsGained and itemsGained > 0 then
250 printMessage = printMessage .. format("From these mails you gained %d items.", itemsGained); 269 printMessage = printMessage .. format("%s you gained %d items.", mailsPrefix, itemsGained);
251 elseif earned and earned > 0 then 270 elseif earned and earned > 0 then
252 printMessage = printMessage .. format("From these mails you gained %s.", MailOpener:FormatMoney(earned)); 271 printMessage = printMessage .. format("%s you gained %s.", mailsPrefix, MailOpener:FormatMoney(earned));
253 end 272 end
254 273
255 -- Did we record anything? print that! 274 -- Did we record anything? print that!
256 if printMessage ~= "" then 275 if printMessage ~= "" then
257 print("|cff15ff00Mail Opener|r: " .. printMessage); 276 print("|cff15ff00Mail Opener|r: " .. printMessage);
263 282
264 -- Did we record any mail being opened? 283 -- Did we record any mail being opened?
265 if sessionMailOpened and sessionMailOpened > 0 then 284 if sessionMailOpened and sessionMailOpened > 0 then
266 -- Time Spent 285 -- Time Spent
267 if sessionTimeSpent and sessionTimeSpent > 0 then 286 if sessionTimeSpent and sessionTimeSpent > 0 then
268 printMessage = printMessage .. format("Collected a total of %d mails within %d minutes and %d seconds this session. ", sessionMailOpened, floor( sessionTimeSpent / 60 ), ( sessionTimeSpent % 60 )); 287 local timeSpentMinutes = floor( sessionTimeSpent / 60 );
288 local timeSpentSeconds = ( sessionTimeSpent % 60 );
289 if timeSpentMinutes ~= 0 then
290 printMessage = printMessage .. format("Collected a total of %d mails within %d minutes and %d seconds this session. ", mailOpened, timeSpentMinutes, timeSpentSeconds);
291 else
292 printMessage = printMessage .. format("Collected a total of %d mails within %d seconds this session. ", mailOpened, timeSpentSeconds);
293 end
269 else 294 else
270 printMessage = printMessage .. format("Collected a total of %d mails this session. ", sessionMailOpened); 295 printMessage = printMessage .. format("Collected a total of %d mails this session. ", sessionMailOpened);
271 end 296 end
272 elseif sessionTimeSpent then 297 elseif sessionTimeSpent then
273 printMessage = printMessage .. format("Spent %d minutes and %d seconds collecting mail this session. ", floor( sessionTimeSpent / 60 ), ( sessionTimeSpent % 60 )); 298 local timeSpentMinutes = floor( sessionTimeSpent / 60 );
299 local timeSpentSeconds = ( sessionTimeSpent % 60 );
300 if timeSpentMinutes ~= 0 then
301 printMessage = printMessage .. format("Spent %d minutes and %d seconds collecting mail this session. ", mailOpened, timeSpentMinutes, timeSpentSeconds);
302 else
303 printMessage = printMessage .. format("Spent %d seconds collecting mail this session. ", mailOpened, timeSpentSeconds);
304 end
305 end
306
307 local mailsPrefix = "";
308 if sessionMailOpened == 1 then
309 mailsPrefix = "From this mail";
310 else
311 mailsPrefix = "From these mails";
274 end 312 end
275 313
276 -- Did we record any items or gold being looted? 314 -- Did we record any items or gold being looted?
277 if (sessionItemsgained and sessionItemsgained > 0) and (sessionEarned and sessionEarned > 0) then 315 if (sessionItemsgained and sessionItemsgained > 0) and (sessionEarned and sessionEarned > 0) then
278 printMessage = printMessage .. format("From these mails you gained %d items and %s.", sessionItemsgained, MailOpener:FormatMoney(sessionEarned)); 316 printMessage = printMessage .. format("%s you gained %d items and %s.", mailsPrefix, sessionItemsgained, MailOpener:FormatMoney(sessionEarned));
279 elseif sessionItemsgained and sessionItemsgained > 0 then 317 elseif sessionItemsgained and sessionItemsgained > 0 then
280 printMessage = printMessage .. format("From these mails you gained %d items.", sessionItemsgained); 318 printMessage = printMessage .. format("%s you gained %d items.", mailsPrefix, sessionItemsgained);
281 elseif sessionEarned and sessionEarned > 0 then 319 elseif sessionEarned and sessionEarned > 0 then
282 printMessage = printMessage .. format("From these mails you gained %s.", MailOpener:FormatMoney(sessionEarned)); 320 printMessage = printMessage .. format("%s you gained %s.", mailsPrefix, MailOpener:FormatMoney(sessionEarned));
283 end 321 end
284 322
285 -- Did we record anything? print that! 323 -- Did we record anything? print that!
286 if printMessage ~= "" then 324 if printMessage ~= "" then
287 print(printMessage); 325 print(printMessage);