comparison Core.lua @ 45:a66f6fc57cfb

Fixed two nil related errors and an error with calculating how much an item is worth when it is being created or destroyed.
author Asa Ayers <Asa.Ayers@Gmail.com>
date Tue, 20 Jul 2010 00:09:54 -0700
parents 003de902ae64
children 234896be4087
comparison
equal deleted inserted replaced
44:9a6d4e2768fd 45:a66f6fc57cfb
218 self:Debug(CODPaymentRegex) 218 self:Debug(CODPaymentRegex)
219 local outboundSubject = select(3, msgSubject:find(CODPaymentRegex)) 219 local outboundSubject = select(3, msgSubject:find(CODPaymentRegex))
220 local trackID 220 local trackID
221 if outboundSubject ~= nil then 221 if outboundSubject ~= nil then
222 self:Debug(outboundSubject) 222 self:Debug(outboundSubject)
223 trackID = tonumber(select(3, outboundSubject:find('[[]IA: (%d*)[]]'))) 223 trackID = select(3, outboundSubject:find('[[]IA: (%d*)[]]'))
224 224
225 self:Debug('COD ID: %s', trackID)
226 if trackID ~= nil then 225 if trackID ~= nil then
226 trackID = tonumber(trackID)
227 self:Debug('COD ID: %s', trackID)
227 local cod = self.db.factionrealm.outbound_cod[trackID] 228 local cod = self.db.factionrealm.outbound_cod[trackID]
228 if cod == nil then 229 if cod == nil then
229 skipMail[mailSignature] = true 230 skipMail[mailSignature] = true
230 self:Print("WARNING: {%s} has an invalid ItemAuditor tracking number.", msgSubject) 231 self:Print("WARNING: {%s} has an invalid ItemAuditor tracking number.", msgSubject)
231 else 232 else
306 307
307 end 308 end
308 309
309 if self.items[link] ~= nil then 310 if self.items[link] ~= nil then
310 self.items[link].count = Altoholic:GetItemCount(self:GetIDFromLink(link)) 311 self.items[link].count = Altoholic:GetItemCount(self:GetIDFromLink(link))
312
313 if self.items[link].invested == nil then
314 self.items[link].invested = 0
315 end
311 end 316 end
312 317
313 if viewOnly == true and self.items[link] == nil then 318 if viewOnly == true and self.items[link] == nil then
314 return {count = 0, invested = 0} 319 return {count = 0, invested = 0}
315 elseif viewOnly == true then 320 elseif viewOnly == true then
430 435
431 if countModifier ~= nil then 436 if countModifier ~= nil then
432 count = count - countModifier 437 count = count - countModifier
433 end 438 end
434 if count > 0 then 439 if count > 0 then
435 return ceil(item.invested), ceil(item.invested/item.count), count 440 return ceil(item.invested), ceil(item.invested/count), count
436 end 441 end
437 442
438 end 443 end
439 return 0, 0, Altoholic:GetItemCount(ItemAuditor:GetIDFromLink(link)) 444 return 0, 0, Altoholic:GetItemCount(ItemAuditor:GetIDFromLink(link))
440 end 445 end