Mercurial > wow > itemauditor
comparison Core.lua @ 24:554b30908b33 v0.1
- Fixed a bug with the mail where items get recorded by the mail scanner and the bag scanner.
- Fixed some minor issues not visible to the user.
| author | Asa Ayers <Asa.Ayers@Gmail.com> |
|---|---|
| date | Sun, 11 Jul 2010 09:24:33 -0700 |
| parents | 819bfdc5d73c |
| children | 75d917ccd942 |
comparison
equal
deleted
inserted
replaced
| 23:819bfdc5d73c | 24:554b30908b33 |
|---|---|
| 67 end | 67 end |
| 68 | 68 |
| 69 self:RefreshQAGroups() | 69 self:RefreshQAGroups() |
| 70 end | 70 end |
| 71 | 71 |
| 72 function addon:Print(message) | 72 local printPrefix = "|cFFA3CEFFItemAuditor|r: " |
| 73 local prefix = "|cFFA3CEFF"..tostring( self ).."|r: " | 73 function addon:Print(message, ...) |
| 74 DEFAULT_CHAT_FRAME:AddMessage( prefix .. tostring(message)) | 74 message = format(message, ...) |
| 75 DEFAULT_CHAT_FRAME:AddMessage( printPrefix .. tostring(message)) | |
| 75 self:Log(message) | 76 self:Log(message) |
| 76 end | 77 end |
| 77 | 78 |
| 78 function addon:GetCurrentInventory() | 79 function addon:GetCurrentInventory() |
| 79 local i = {} | 80 local i = {} |
| 175 local invoiceType, itemName, playerName, bid, buyout, deposit, consignment = GetInboxInvoiceInfo(mailIndex); | 176 local invoiceType, itemName, playerName, bid, buyout, deposit, consignment = GetInboxInvoiceInfo(mailIndex); |
| 176 results[mailType][itemName] = (results[mailType][itemName] or 0) + bid | 177 results[mailType][itemName] = (results[mailType][itemName] or 0) + bid |
| 177 elseif mailType == "AHExpired" or mailType == "AHCancelled" or mailType == "AHOutbid" then | 178 elseif mailType == "AHExpired" or mailType == "AHCancelled" or mailType == "AHOutbid" then |
| 178 -- These should be handled when you pay the deposit at the AH | 179 -- These should be handled when you pay the deposit at the AH |
| 179 else | 180 else |
| 180 self:Debug("Unhandled mail type: " .. mailType) | 181 -- self:Debug("Unhandled mail type: " .. mailType) |
| 181 self:Debug(msgSubject) | 182 -- self:Debug(msgSubject) |
| 182 end | 183 end |
| 183 | 184 |
| 184 end | 185 end |
| 185 | 186 |
| 186 for mailType, collection in pairs(results) do | 187 for mailType, collection in pairs(results) do |
| 198 end | 199 end |
| 199 | 200 |
| 200 local itemName = nil | 201 local itemName = nil |
| 201 if self:GetSafeLink(link) == nil then | 202 if self:GetSafeLink(link) == nil then |
| 202 itemName = link | 203 itemName = link |
| 203 link = self:GetSafeLink(link) | |
| 204 else | 204 else |
| 205 link = self:GetSafeLink(link) | 205 link = self:GetSafeLink(link) |
| 206 itemName = GetItemInfo(link) | 206 itemName = GetItemInfo(link) |
| 207 end | 207 end |
| 208 | 208 |
| 214 } | 214 } |
| 215 self.db.factionrealm.item_account[itemName] = nil | 215 self.db.factionrealm.item_account[itemName] = nil |
| 216 end | 216 end |
| 217 | 217 |
| 218 if viewOnly == false and self.items[link] == nil then | 218 if viewOnly == false and self.items[link] == nil then |
| 219 local itemName = GetItemInfo(link) | 219 |
| 220 | |
| 221 self.items[link] = { | 220 self.items[link] = { |
| 222 count = Altoholic:GetItemCount(self:GetIDFromLink(link)), | 221 count = Altoholic:GetItemCount(self:GetIDFromLink(link)), |
| 223 invested = abs(self.db.factionrealm.item_account[itemName] or 0), | 222 invested = abs(self.db.factionrealm.item_account[itemName] or 0), |
| 224 } | 223 } |
| 225 | 224 |
| 240 function addon:RemoveItem(link) | 239 function addon:RemoveItem(link) |
| 241 self.db.factionrealm.item_account[link] = nil | 240 self.db.factionrealm.item_account[link] = nil |
| 242 link = self:GetSafeLink(link) | 241 link = self:GetSafeLink(link) |
| 243 if link ~= nil then | 242 if link ~= nil then |
| 244 self.items[link] = nil | 243 self.items[link] = nil |
| 244 else | |
| 245 self:Debug('Failed to convert link' .. tostring(link)) | |
| 245 end | 246 end |
| 246 end | 247 end |
| 247 | 248 |
| 248 function addon:SaveValue(link, value) | 249 function addon:SaveValue(link, value) |
| 249 self:Debug(format("SaveValue(%s, %s)", tostring(link), value)) | 250 self:Debug(format("SaveValue(%s, %s)", tostring(link), value)) |
| 303 | 304 |
| 304 | 305 |
| 305 function addon:GetSafeLink(link) | 306 function addon:GetSafeLink(link) |
| 306 local newLink = nil | 307 local newLink = nil |
| 307 | 308 |
| 308 if link and link ~= string.match(link, '.-:[-0-9]+[:0-9]*') then | 309 if link and link == string.match(link, '.-:[-0-9]+[:0-9]*') then |
| 310 newLink = link | |
| 311 elseif link then | |
| 309 newLink = link and string.match(link, "|H(.-):([-0-9]+):([0-9]+)|h") | 312 newLink = link and string.match(link, "|H(.-):([-0-9]+):([0-9]+)|h") |
| 310 end | 313 end |
| 311 if newLink == nil then | 314 if newLink == nil then |
| 312 local itemID = self:GetItemID(link) | 315 local itemID = self:GetItemID(link) |
| 313 if itemID ~= nil then | 316 if itemID ~= nil then |
