Mercurial > wow > itemauditor
comparison Core.lua @ 15:44e70a3fdb19
Merged utils into ItemAuditor.
author | Asa Ayers <Asa.Ayers@Gmail.com> |
---|---|
date | Sat, 03 Jul 2010 07:40:01 -0700 |
parents | 8c83d5f6e306 |
children | 56de19d9bd8d |
comparison
equal
deleted
inserted
replaced
14:6fc9fbaa94b3 | 15:44e70a3fdb19 |
---|---|
35 self:RegisterEvent("PLAYER_ENTERING_WORLD") | 35 self:RegisterEvent("PLAYER_ENTERING_WORLD") |
36 end | 36 end |
37 | 37 |
38 function addon:ConvertItems() | 38 function addon:ConvertItems() |
39 for itemName, value in pairs(self.db.factionrealm.item_account) do | 39 for itemName, value in pairs(self.db.factionrealm.item_account) do |
40 local itemID = utils:GetItemID(itemName) | 40 local itemID = self:GetItemID(itemName) |
41 if itemID ~= nil then | 41 if itemID ~= nil then |
42 self:GetItem('item:' .. itemID) | 42 self:GetItem('item:' .. itemID) |
43 end | 43 end |
44 if value == 0 then | 44 if value == 0 then |
45 self.db.factionrealm.item_account[itemName] = nil | 45 self.db.factionrealm.item_account[itemName] = nil |
110 | 110 |
111 function addon:ScanMail() | 111 function addon:ScanMail() |
112 local results = {} | 112 local results = {} |
113 for mailIndex = 1, GetInboxNumItems() or 0 do | 113 for mailIndex = 1, GetInboxNumItems() or 0 do |
114 local sender, msgSubject, msgMoney, msgCOD, _, msgItem, _, _, msgText, _, isGM = select(3, GetInboxHeaderInfo(mailIndex)) | 114 local sender, msgSubject, msgMoney, msgCOD, _, msgItem, _, _, msgText, _, isGM = select(3, GetInboxHeaderInfo(mailIndex)) |
115 local mailType = utils:GetMailType(msgSubject) | 115 local mailType = self:GetMailType(msgSubject) |
116 | 116 |
117 results[mailType] = (results[mailType] or {}) | 117 results[mailType] = (results[mailType] or {}) |
118 | 118 |
119 if mailType == "NonAHMail" then | 119 if mailType == "NonAHMail" then |
120 --[[ | 120 --[[ |
129 if itemName ~= nil then | 129 if itemName ~= nil then |
130 itemTypdes[itemName] = (itemTypes[itemName] or 0) + count | 130 itemTypdes[itemName] = (itemTypes[itemName] or 0) + count |
131 end | 131 end |
132 end | 132 end |
133 | 133 |
134 if utils:tcount(itemTypes) == 1 then | 134 if self:tcount(itemTypes) == 1 then |
135 for itemName, count in pairs(itemTypes) do | 135 for itemName, count in pairs(itemTypes) do |
136 results[mailType][itemName] = (results[mailType][itemName] or 0) - msgCOD | 136 results[mailType][itemName] = (results[mailType][itemName] or 0) - msgCOD |
137 end | 137 end |
138 else | 138 else |
139 self:Debug("Don't know what to do with more than one item type on COD mail.") | 139 self:Debug("Don't know what to do with more than one item type on COD mail.") |
227 item.invested = item.invested + value | 227 item.invested = item.invested + value |
228 itemName = GetItemInfo(realLink) | 228 itemName = GetItemInfo(realLink) |
229 end | 229 end |
230 | 230 |
231 if abs(value) > 0 then | 231 if abs(value) > 0 then |
232 self:Debug("Updated price of " .. itemName .. " to " .. utils:FormatMoney(item.invested) .. "(change: " .. utils:FormatMoney(value) .. ")") | 232 self:Debug("Updated price of " .. itemName .. " to " .. self:FormatMoney(item.invested) .. "(change: " .. self:FormatMoney(value) .. ")") |
233 | 233 |
234 if item.invested <= 0 then | 234 if item.invested <= 0 then |
235 self:Debug("Updated price of " .. itemName .. " to " .. utils:FormatMoney(0)) | 235 self:Debug("Updated price of " .. itemName .. " to " ..self:FormatMoney(0)) |
236 self:RemoveItem(link) | 236 self:RemoveItem(link) |
237 -- This doesn't work when you mail the only copy of an item you have to another character. | 237 -- This doesn't work when you mail the only copy of an item you have to another character. |
238 --[[ | 238 --[[ |
239 elseif item.count == 0 and realLink and Altoholic:GetItemCount(self:GetIDFromLink(realLink)) then | 239 elseif item.count == 0 and realLink and Altoholic:GetItemCount(self:GetIDFromLink(realLink)) then |
240 self:Print("You ran out of " .. itemName .. " and never recovered " .. utils:FormatMoney(item.invested)) | 240 self:Print("You ran out of " .. itemName .. " and never recovered " .. self:FormatMoney(item.invested)) |
241 self:RemoveItem(link) | 241 self:RemoveItem(link) |
242 ]] | 242 ]] |
243 end | 243 end |
244 end | 244 end |
245 | 245 |
270 self:UnregisterBucket(self.watch_handle) | 270 self:UnregisterBucket(self.watch_handle) |
271 self.watch_handle = nil | 271 self.watch_handle = nil |
272 end | 272 end |
273 end | 273 end |
274 | 274 |
275 function addon:GetItemID(itemName) | |
276 return utils:GetItemID(itemName) | |
277 end | |
278 | 275 |
279 function addon:GetSafeLink(link) | 276 function addon:GetSafeLink(link) |
280 local newLink = nil | 277 local newLink = nil |
281 | 278 |
282 if link and link ~= string.match(link, '.-:[-0-9]+[:0-9]*') then | 279 if link and link ~= string.match(link, '.-:[-0-9]+[:0-9]*') then |