Mercurial > wow > itemauditor
changeset 40:5273038322d7 release
Updated the way postage was counted so that if you mail multiple items at once, they will all have the postage counted. I also removed the 30c for postage from how QA thresholds are calculated now that they will be counted every time.
author | Asa Ayers <Asa.Ayers@Gmail.com> |
---|---|
date | Mon, 19 Jul 2010 20:55:50 -0700 |
parents | 003de902ae64 |
children | 36eb72329d69 aae189bf32ce |
files | CHANGELOG.txt Modules/Events.lua Modules/QuickAuctions.lua |
diffstat | 3 files changed, 43 insertions(+), 33 deletions(-) [+] |
line wrap: on
line diff
--- a/CHANGELOG.txt Mon Jul 19 20:16:40 2010 -0700 +++ b/CHANGELOG.txt Mon Jul 19 20:55:50 2010 -0700 @@ -1,3 +1,7 @@ +2010-07-18 Asa Ayers <Asa.Ayers@Gmail.com> + +- Implemented COD mail (Ticket #1) and updated the way postage was counted so that if you mail multiple items at once, they will all have the postage counted. I also removed the 30c for postage from how QA thresholds are calculated now that they will be counted every time. + 2010-07-18 Asa Ayers <Asa.Ayers@Gmail.com> - Added color coding to the minimum price tooltip. If your minimum price is below the current auction price, it wll be green, otherwise it is red.
--- a/Modules/Events.lua Mon Jul 19 20:16:40 2010 -0700 +++ b/Modules/Events.lua Mon Jul 19 20:55:50 2010 -0700 @@ -48,6 +48,7 @@ end end +local attachedItems = {} local Orig_SendMail = SendMail function SendMail(recipient, subject, body, ...) @@ -58,44 +59,56 @@ self.mailOutbox.COD = GetSendMailCOD() - if self.mailOutbox.COD == 0 then - self:Debug("Non-COD mail") - return Orig_SendMail(recipient, subject, body, ...) - end - - subject = format("[IA: %s] %s", self.mailOutbox.key, subject) - self.mailOutbox.subject = subject - self.mailOutbox.to = recipient - - self.mailOutbox.count = 0 + attachedItems = {} + local totalStacks = 0 local link - for index = 1, 12 do + for index = 1, ATTACHMENTS_MAX_SEND do local itemName, _, itemCount = GetSendMailItem(index) local newLink = GetSendMailItemLink(index) - if link == nil then - link = newLink + if newLink ~= nil then + newLink = self:GetSafeLink(newLink) + totalStacks = totalStacks + 1 + attachedItems[newLink] = (attachedItems[newLink] or {stacks = 0, count = 0}) + attachedItems[newLink].stacks = attachedItems[newLink].stacks + 1 + attachedItems[newLink].count = attachedItems[newLink].count + itemCount + attachedItems[newLink].price = 0 -- This is a placeholder for below. end - - if newLink ~= nil and self:GetIDFromLink(newLink) ~= self:GetIDFromLink(link) then - self:Print(self:GetIDFromLink(newLink)) - self:Print(self:GetIDFromLink(link)) - - self:Print("WARNING: ItemAuditor can't track COD mail with more than one item type.") + end + local pricePerStack = GetSendMailPrice() / totalStacks + for link, data in pairs(attachedItems) do + data.price = pricePerStack * data.stacks + end + + if self.mailOutbox.COD > 0 then + if self:tcount(attachedItems) > 1 then + self:Print("ERROR: ItemAuditor can't track COD mail with more than one item type.") self:GenerateBlankOutbox() + -- I need to make a prompt so the user can send the mail without interference return end - self.mailOutbox.link = link - self.mailOutbox.count = self.mailOutbox.count + itemCount + self:Debug("COD mail") + subject = format("[IA: %s] %s", self.mailOutbox.key, subject) + self.mailOutbox.subject = subject + self.mailOutbox.to = recipient + + -- At this point we know there is only one item + for link, data in pairs(attachedItems) do + self.mailOutbox.link = link + self.mailOutbox.count = data.count + end + else + self:Debug("Non-COD mail") end - - -- self:MAIL_SUCCESS("Mock Success") + return Orig_SendMail(recipient, subject, body, ...) end function addon:MAIL_SUCCESS(event) - + for link, data in pairs(attachedItems) do + self:SaveValue(link, data.price, data.count) + end if self.mailOutbox.COD > 0 then self:Debug(format("MAIL_SUCCESS %d [To: %s] [Subject: %s] [COD: %s]", self.mailOutbox.key, self.mailOutbox.to, self.mailOutbox.subject, self.mailOutbox.COD)) @@ -103,12 +116,8 @@ self.db.factionrealm.outbound_cod[self.mailOutbox.key] = self.mailOutbox end - self.mailOutbox = { - to = "", - subject = "", - items = {}, - COD = 0, - } + + self:GenerateBlankOutbox() end function addon:MAIL_CLOSED()
--- a/Modules/QuickAuctions.lua Mon Jul 19 20:16:40 2010 -0700 +++ b/Modules/QuickAuctions.lua Mon Jul 19 20:55:50 2010 -0700 @@ -46,9 +46,6 @@ -- GetAuctionThreshold returns a percent as a whole number. This will convert 25 to 1.25 copper = copper * (1+addon:GetAuctionThreshold()) - -- Adding the cost of mailing every item once. - copper = copper + 30 - -- add AH Cut local keep = 1 - addon:GetAHCut() return copper/keep