Mercurial > wow > itemauditor
view Modules/Utils.lua @ 6:5dddd73b2220
Removed dependency on postal. It was only being used to determine the mail type which has been moved into ItemAuditor so I can support CODPayments. Paying for COD items works, but getting the payments back can't reliably associate the payment with an item yet.
author | Asa Ayers <Asa.Ayers@Gmail.com> |
---|---|
date | Wed, 26 May 2010 22:41:47 -0700 |
parents | bbcf81868171 |
children | bbba2fae0f69 |
line wrap: on
line source
local addonName, addonTable = ...; local addon = {} local AceConsole = LibStub("AceConsole-3.0") AceConsole:Embed(addon) addonTable.utils = addon function addon:FormatMoney(money) local prefix = "" if money < 0 then prefix = "-" end return prefix .. Altoholic:GetMoneyString(abs(money), WHITE, false) end local SubjectPatterns = { AHCancelled = gsub(AUCTION_REMOVED_MAIL_SUBJECT, "%%s", ".*"), AHExpired = gsub(AUCTION_EXPIRED_MAIL_SUBJECT, "%%s", ".*"), AHOutbid = gsub(AUCTION_OUTBID_MAIL_SUBJECT, "%%s", ".*"), AHSuccess = gsub(AUCTION_SOLD_MAIL_SUBJECT, "%%s", ".*"), AHWon = gsub(AUCTION_WON_MAIL_SUBJECT, "%%s", ".*"), CODPayment = gsub(COD_PAYMENT, "%%s", "(.*)"), } function addon:GetMailType(msgSubject) if msgSubject then for k, v in pairs(SubjectPatterns) do if msgSubject:find(v) then return k end end end return "NonAHMail" end function addon:tcount(tab) local n = #tab if (n == 0) then for _ in pairs(tab) do n = n + 1 end end return n end function addon:GetDebug(info) return true -- return self.db.char.debug end function addon:SetDebug(info, input) self:Print("Debugging is now: " .. value) self.db.char.debug = input local value = "off" if input then value = "on" end end