annotate Core.lua @ 70:3930518cb8d9

Added a public API so other addon developers can register themselves as a queue destination and added a UI so users can select that destination.
author Asa Ayers <Asa.Ayers@Gmail.com>
date Wed, 28 Jul 2010 22:19:38 -0700
parents 2d65db19d3ce
children aaf9a155995b
rev   line source
Asa@63 1 local ItemAuditor = select(2, ...)
Asa@63 2 ItemAuditor = LibStub("AceAddon-3.0"):NewAddon(ItemAuditor, "ItemAuditor", "AceEvent-3.0", "AceBucket-3.0")
Asa@65 3 --@debug@
Asa@65 4 _G['ItemAuditor'] = ItemAuditor
Asa@65 5 --@end-debug@
Asa@0 6
Asa@0 7 local WHITE = "|cFFFFFFFF"
Asa@0 8 local RED = "|cFFFF0000"
Asa@0 9 local GREEN = "|cFF00FF00"
Asa@0 10 local YELLOW = "|cFFFFFF00"
Asa@0 11 local ORANGE = "|cFFFF7F00"
Asa@0 12 local TEAL = "|cFF00FF9A"
Asa@0 13 local GOLD = "|cFFFFD700"
Asa@0 14
Asa@67 15
Asa@67 16 ItemAuditor.Options = {
Asa@67 17 handler = ItemAuditor,
Asa@67 18 name = "ItemAuditor @project-version@",
Asa@67 19 type = 'group',
Asa@67 20 args = {
Asa@67 21 options = {
Asa@67 22 type = "execute",
Asa@67 23 name = "options",
Asa@67 24 desc = "Show Blizzard's options GUI",
Asa@67 25 func = "ShowOptionsGUI",
Asa@67 26 guiHidden = true,
Asa@67 27 },
Asa@67 28 debug = {
Asa@67 29 type = "execute",
Asa@67 30 name = "debug",
Asa@67 31 desc = "Shows the debug frame",
Asa@67 32 func = function() ItemAuditor_DebugFrame:Show() end,
Asa@67 33 guiHidden = true,
Asa@67 34 },
Asa@67 35 suspend = {
Asa@67 36 type = "toggle",
Asa@67 37 name = "suspend",
Asa@67 38 desc = "Suspends ItemAuditor",
Asa@67 39 get = "IsEnabled",
Asa@67 40 set = "SetEnabled",
Asa@67 41 guiHidden = true,
Asa@67 42 },
Asa@67 43 },
Asa@67 44 }
Asa@67 45
Asa@63 46 function ItemAuditor:OnInitialize()
Asa@0 47 local DB_defaults = {
Asa@0 48 char = {
Asa@13 49 ah = 1,
Asa@13 50 use_quick_auctions = false,
Asa@20 51 crafting_threshold = 1,
Asa@20 52 auction_threshold = 0.15,
Asa@55 53 output_chat_frame = nil,
Asa@0 54 },
Asa@16 55 profile = {
Asa@16 56 messages = {
Asa@16 57 cost_updates = true,
Asa@20 58 queue_skip = false,
Asa@23 59 },
Asa@63 60 ItemAuditor_enabled = true,
Asa@70 61 queue_destination = nil,
Asa@16 62 },
Asa@0 63 factionrealm = {
Asa@8 64 item_account = {},
Asa@8 65 items = {},
Asa@39 66 outbound_cod = {},
Asa@0 67 },
Asa@0 68 }
Asa@0 69 self.db = LibStub("AceDB-3.0"):New("ItemAuditorDB", DB_defaults, true)
Asa@0 70
Asa@67 71 self.optionsFrame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("ItemAuditor", "ItemAuditor")
Asa@67 72
Asa@67 73 LibStub("AceConfig-3.0"):RegisterOptionsTable("ItemAuditor", ItemAuditor.Options, {"ia"})
Asa@38 74 ItemAuditor:RegisterFrame(ItemAuditor_DebugFrame)
Asa@23 75
Asa@65 76 --@debug@
Asa@59 77 -- ItemAuditor_DebugFrame:Show()
Asa@59 78 -- self:CreateFrame('tab_crafting')
Asa@68 79 -- self:RegisterEvent("TRADE_SKILL_SHOW", function()
Asa@68 80 -- ItemAuditor:CreateFrame('tab_crafting')
Asa@68 81 -- end)
Asa@65 82 --@end-debug@
Asa@0 83 end
Asa@0 84
Asa@67 85
Asa@67 86
Asa@38 87 local registeredEvents = {}
Asa@63 88 local originalRegisterEvent = ItemAuditor.RegisterEvent
Asa@63 89 function ItemAuditor:RegisterEvent(event, callback, arg)
Asa@38 90 registeredEvents[event] = true
Asa@38 91 if arg ~= nil then
Asa@38 92 return originalRegisterEvent(self, event, callback, arg)
Asa@38 93 elseif callback ~= nil then
Asa@38 94 return originalRegisterEvent(self, event, callback)
Asa@38 95 else
Asa@38 96 return originalRegisterEvent(self, event)
Asa@38 97 end
Asa@38 98 end
Asa@38 99
Asa@63 100 local originalUnregisterEvent = ItemAuditor.UnregisterEvent
Asa@63 101 function ItemAuditor:UnregisterEvent(event)
Asa@38 102 registeredEvents[event] = nil
Asa@38 103 return originalUnregisterEvent(self, event)
Asa@38 104 end
Asa@38 105
Asa@63 106 function ItemAuditor:UnregisterAllEvents()
Asa@38 107 for event in pairs(registeredEvents) do
Asa@38 108 self:UnregisterEvent(event)
Asa@38 109 end
Asa@38 110 end
Asa@38 111
Asa@38 112 local registeredFrames = {}
Asa@63 113 function ItemAuditor:RegisterFrame(frame)
Asa@38 114 tinsert(registeredFrames, frame)
Asa@38 115 end
Asa@38 116
Asa@63 117 function ItemAuditor:HideAllFrames()
Asa@38 118 for key, frame in pairs(registeredFrames) do
Asa@38 119 if frame then
Asa@38 120 frame:Hide()
Asa@38 121 end
Asa@38 122 end
Asa@38 123 end
Asa@38 124
Asa@63 125 function ItemAuditor:ConvertItems()
Asa@8 126 for itemName, value in pairs(self.db.factionrealm.item_account) do
Asa@15 127 local itemID = self:GetItemID(itemName)
Asa@8 128 if itemID ~= nil then
Asa@8 129 self:GetItem('item:' .. itemID)
Asa@8 130 end
Asa@8 131 if value == 0 then
Asa@8 132 self.db.factionrealm.item_account[itemName] = nil
Asa@8 133 end
Asa@8 134 end
Asa@8 135
Asa@8 136 for link, data in pairs(self.db.factionrealm.items) do
Asa@8 137 if self:GetItem(link).count == 0 or self:GetItem(link).invested == 0 then
Asa@8 138 self:RemoveItem(link)
Asa@8 139 end
Asa@10 140 end
Asa@10 141
Asa@12 142 self:RefreshQAGroups()
Asa@12 143 end
Asa@12 144
Asa@65 145 -- Options doesn't exist when this file is created the first time, so getOptions will
Asa@65 146 -- make one call to :GetModule and return the result and replace itself with a
Asa@65 147 -- function that simply returns the same object. The permanent solution will probably be
Asa@65 148 -- to move :Print to a different module.
Asa@65 149 local function getOptions()
Asa@65 150 local Options = ItemAuditor:GetModule("Options")
Asa@65 151 getOptions = function() return Options end
Asa@65 152 return Options
Asa@65 153 end
Asa@65 154
Asa@24 155 local printPrefix = "|cFFA3CEFFItemAuditor|r: "
Asa@63 156 function ItemAuditor:Print(message, ...)
Asa@24 157 message = format(message, ...)
Asa@65 158 getOptions().GetSelectedChatWindow():AddMessage( printPrefix .. tostring(message))
Asa@16 159 end
Asa@16 160
Asa@63 161 function ItemAuditor:GetCurrentInventory()
Asa@8 162 local i = {}
Asa@8 163 local bagID
Asa@8 164 local slotID
Asa@8 165
Asa@8 166 for bagID = 0, NUM_BAG_SLOTS do
Asa@8 167 bagSize=GetContainerNumSlots(bagID)
Asa@8 168 for slotID = 0, bagSize do
Asa@8 169 local link= GetContainerItemLink(bagID, slotID);
Asa@10 170 link = link and self:GetSafeLink(link)
Asa@8 171
Asa@8 172 if link ~= nil and i[link] == nil then
Asa@8 173 i[link] = GetItemCount(link);
Asa@8 174 end
Asa@8 175 end
Asa@8 176
Asa@8 177 end
Asa@8 178 return {items = i, money = GetMoney()}
Asa@0 179 end
Asa@0 180
Asa@63 181 function ItemAuditor:GetInventoryDiff(pastInventory, current)
Asa@8 182 if current == nil then
Asa@8 183 current = self:GetCurrentInventory()
Asa@8 184 end
Asa@8 185 local diff = {}
Asa@8 186
Asa@8 187 for link, count in pairs(current.items) do
Asa@8 188 if pastInventory.items[link] == nil then
Asa@8 189 diff[link] = count
Asa@23 190 self:Debug("1 diff[" .. link .. "]=" .. diff[link])
Asa@8 191 elseif count - pastInventory.items[link] ~= 0 then
Asa@8 192 diff[link] = count - pastInventory.items[link]
Asa@23 193 self:Debug("2 diff[" .. link .. "]=" .. diff[link])
Asa@8 194 end
Asa@8 195 end
Asa@8 196
Asa@8 197 for link, count in pairs(pastInventory.items) do
Asa@8 198 if current.items[link] == nil then
Asa@8 199 diff[link] = -count
Asa@23 200 self:Debug("3 diff[" .. link .. "]=" .. diff[link])
Asa@8 201 elseif current.items[link] - count ~= 0 then
Asa@8 202 diff[link] = current.items[link] - pastInventory.items[link]
Asa@23 203 self:Debug("4 diff[" .. link .. "]=" .. diff[link])
Asa@8 204 end
Asa@8 205 end
Asa@8 206
Asa@8 207 local moneyDiff = current.money - pastInventory.money
Asa@23 208 if abs(moneyDiff) > 0 then
Asa@23 209 self:Debug("moneyDiff: " .. moneyDiff)
Asa@23 210 end
Asa@8 211
Asa@8 212 return {items = diff, money = moneyDiff}
Asa@0 213 end
Asa@0 214
Asa@39 215 local inboundCOD = {}
Asa@39 216 local skipMail = {}
Asa@63 217 function ItemAuditor:ScanMail()
Asa@0 218 local results = {}
Asa@39 219 local CODPaymentRegex = gsub(COD_PAYMENT, "%%s", "(.*)")
Asa@39 220
Asa@0 221 for mailIndex = 1, GetInboxNumItems() or 0 do
Asa@39 222 local sender, msgSubject, msgMoney, msgCOD, daysLeft, msgItem, _, _, msgText, _, isGM = select(3, GetInboxHeaderInfo(mailIndex))
Asa@15 223 local mailType = self:GetMailType(msgSubject)
Asa@6 224
Asa@39 225 local mailSignature = msgSubject .. '-' .. msgMoney .. '-' .. msgCOD .. '-' .. daysLeft
Asa@39 226
Asa@6 227 results[mailType] = (results[mailType] or {})
Asa@6 228
Asa@39 229 if skipMail[mailSignature] ~= nil then
Asa@39 230 -- do nothing
Asa@39 231 elseif mailType == "NonAHMail" and msgCOD > 0 then
Asa@6 232 mailType = 'COD'
Asa@6 233 results[mailType] = (results[mailType] or {})
Asa@5 234
Asa@5 235 local itemTypes = {}
Asa@5 236 for itemIndex = 1, ATTACHMENTS_MAX_RECEIVE do
Asa@5 237 local itemName, _, count, _, _= GetInboxItem(mailIndex, itemIndex)
Asa@5 238 if itemName ~= nil then
Asa@39 239 itemTypes[itemName] = (itemTypes[itemName] or 0) + count
Asa@5 240 end
Asa@5 241 end
Asa@5 242
Asa@15 243 if self:tcount(itemTypes) == 1 then
Asa@5 244 for itemName, count in pairs(itemTypes) do
Asa@39 245 results[mailType][itemName] = (results[mailType][itemName] or {total=0,count=0})
Asa@39 246 results[mailType][itemName].total = results[mailType][itemName].total + msgCOD
Asa@39 247
Asa@39 248 if inboundCOD[mailSignature] == nil then
Asa@39 249 results[mailType][itemName].count = results[mailType][itemName].count + count
Asa@39 250 inboundCOD[mailSignature] = (inboundCOD[mailSignature] or 0) + count
Asa@39 251 else
Asa@39 252 results[mailType][itemName].count = inboundCOD[mailSignature]
Asa@39 253 end
Asa@39 254
Asa@39 255
Asa@5 256 end
Asa@5 257 else
Asa@5 258 self:Debug("Don't know what to do with more than one item type on COD mail.")
Asa@5 259 end
Asa@6 260 elseif mailType == "CODPayment" then
Asa@39 261 -- /dump ItemAuditor.db.factionrealm.outbound_cod
Asa@39 262 self:Debug(msgSubject)
Asa@39 263 self:Debug(CODPaymentRegex)
Asa@39 264 local outboundSubject = select(3, msgSubject:find(CODPaymentRegex))
Asa@39 265 local trackID
Asa@39 266 if outboundSubject ~= nil then
Asa@39 267 self:Debug(outboundSubject)
Asa@45 268 trackID = select(3, outboundSubject:find('[[]IA: (%d*)[]]'))
Asa@39 269
Asa@39 270 if trackID ~= nil then
Asa@45 271 trackID = tonumber(trackID)
Asa@45 272 self:Debug('COD ID: %s', trackID)
Asa@39 273 local cod = self.db.factionrealm.outbound_cod[trackID]
Asa@39 274 if cod == nil then
Asa@39 275 skipMail[mailSignature] = true
Asa@39 276 self:Print("WARNING: {%s} has an invalid ItemAuditor tracking number.", msgSubject)
Asa@39 277 else
Asa@39 278 itemName = trackID .. "|" .. cod['link']
Asa@39 279
Asa@39 280
Asa@39 281 results[mailType][itemName] = (results[mailType][itemName] or {total=0,count=0})
Asa@39 282 results[mailType][itemName].total = results[mailType][itemName].total - msgMoney
Asa@39 283 results[mailType][itemName].count = results[mailType][itemName].count - cod.count
Asa@39 284 end
Asa@39 285 end
Asa@39 286 end
Asa@5 287
Asa@39 288 if trackID == nil then
Asa@39 289 skipMail[mailSignature] = true
Asa@39 290 self:Print("WARNING: {%s} is a COD payment but doesn't have an ItemAuditor tracking number.", msgSubject)
Asa@39 291 end
Asa@5 292
Asa@0 293 elseif mailType == "AHSuccess" then
Asa@0 294 local invoiceType, itemName, playerName, bid, buyout, deposit, consignment = GetInboxInvoiceInfo(mailIndex);
Asa@26 295 results[mailType][itemName] = (results[mailType][itemName] or {total=0,count=0})
Asa@26 296 results[mailType][itemName].total = results[mailType][itemName].total - deposit - buyout + consignment
Asa@26 297
Asa@0 298
Asa@0 299 elseif mailType == "AHWon" then
Asa@0 300 local invoiceType, itemName, playerName, bid, buyout, deposit, consignment = GetInboxInvoiceInfo(mailIndex);
Asa@26 301 results[mailType][itemName] = (results[mailType][itemName] or {total=0,count=0})
Asa@26 302 results[mailType][itemName].total = results[mailType][itemName].total + bid
Asa@26 303
Asa@26 304 local count = select(3, GetInboxItem(1,1))
Asa@26 305 results[mailType][itemName].count = results[mailType][itemName].count + count
Asa@5 306 elseif mailType == "AHExpired" or mailType == "AHCancelled" or mailType == "AHOutbid" then
Asa@0 307 -- These should be handled when you pay the deposit at the AH
Asa@0 308 else
Asa@24 309 -- self:Debug("Unhandled mail type: " .. mailType)
Asa@24 310 -- self:Debug(msgSubject)
Asa@0 311 end
Asa@0 312
Asa@0 313 end
Asa@23 314
Asa@23 315 for mailType, collection in pairs(results) do
Asa@26 316 for item, data in pairs(collection) do
Asa@26 317 self:Debug(format("|cFF00FF00MailScan|r: %s - %s - %s x %s", mailType, item, data.total, data.count))
Asa@23 318 end
Asa@23 319 end
Asa@23 320
Asa@0 321 return results
Asa@0 322 end
Asa@0 323
Asa@63 324 function ItemAuditor:GetItem(link, viewOnly)
Asa@9 325 if viewOnly == nil then
Asa@9 326 viewOnly = false
Asa@9 327 end
Asa@8 328
Asa@9 329 local itemName = nil
Asa@9 330 if self:GetSafeLink(link) == nil then
Asa@9 331 itemName = link
Asa@9 332 else
Asa@9 333 link = self:GetSafeLink(link)
Asa@9 334 itemName = GetItemInfo(link)
Asa@9 335 end
Asa@9 336
Asa@12 337
Asa@9 338 if self.db.factionrealm.item_account[itemName] ~= nil then
Asa@65 339 self.db.factionrealm.items[link] = {
Asa@12 340 count = Altoholic:GetItemCount(self:GetIDFromLink(link)),
Asa@8 341 invested = abs(self.db.factionrealm.item_account[itemName] or 0),
Asa@8 342 }
Asa@8 343 self.db.factionrealm.item_account[itemName] = nil
Asa@8 344 end
Asa@8 345
Asa@65 346 if viewOnly == false and self.db.factionrealm.items[link] == nil then
Asa@24 347
Asa@65 348 self.db.factionrealm.items[link] = {
Asa@10 349 count = Altoholic:GetItemCount(self:GetIDFromLink(link)),
Asa@9 350 invested = abs(self.db.factionrealm.item_account[itemName] or 0),
Asa@9 351 }
Asa@9 352
Asa@9 353 end
Asa@9 354
Asa@65 355 if self.db.factionrealm.items[link] ~= nil then
Asa@65 356 self.db.factionrealm.items[link].count = Altoholic:GetItemCount(self:GetIDFromLink(link))
Asa@45 357
Asa@65 358 if self.db.factionrealm.items[link].invested == nil then
Asa@65 359 self.db.factionrealm.items[link].invested = 0
Asa@45 360 end
Asa@37 361 end
Asa@37 362
Asa@65 363 if viewOnly == true and self.db.factionrealm.items[link] == nil then
Asa@9 364 return {count = 0, invested = 0}
Asa@9 365 elseif viewOnly == true then
Asa@28 366
Asa@65 367 return {count = self.db.factionrealm.items[link].count, invested = self.db.factionrealm.items[link].invested}
Asa@9 368 end
Asa@37 369
Asa@28 370
Asa@28 371
Asa@65 372 return self.db.factionrealm.items[link]
Asa@8 373 end
Asa@8 374
Asa@63 375 function ItemAuditor:RemoveItem(link)
Asa@9 376 self.db.factionrealm.item_account[link] = nil
Asa@9 377 link = self:GetSafeLink(link)
Asa@9 378 if link ~= nil then
Asa@63 379 local item = ItemAuditor:GetItem(link)
Asa@35 380 item.invested = 0
Asa@24 381 else
Asa@24 382 self:Debug('Failed to convert link' .. tostring(link))
Asa@9 383 end
Asa@8 384 end
Asa@8 385
Asa@63 386 function ItemAuditor:SaveValue(link, value, countChange)
Asa@26 387 self:Debug("SaveValue(%s, %s, %s)", tostring(link), value, (countChange or 'default'))
Asa@26 388 countChange = countChange or 0
Asa@9 389 local item = nil
Asa@9 390 local realLink = self:GetSafeLink(link)
Asa@9 391 local itemName = nil
Asa@9 392 if realLink == nil then
Asa@26 393 itemName = link
Asa@23 394 self:Debug('SaveValue: GetSafeLink failed, falling back to storing by name: ' .. tostring(itemName))
Asa@9 395 self.db.factionrealm.item_account[itemName] = (self.db.factionrealm.item_account[itemName] or 0) + value
Asa@9 396 item = {invested = self.db.factionrealm.item_account[itemName], count = 1}
Asa@9 397 else
Asa@23 398
Asa@9 399 item = self:GetItem(realLink)
Asa@9 400 item.invested = item.invested + value
Asa@9 401 itemName = GetItemInfo(realLink)
Asa@9 402 end
Asa@8 403
Asa@26 404 if value > 0 and countChange > 0 and item.invested == value and item.count ~= countChange then
Asa@26 405 local costPerItem = value / countChange
Asa@26 406 value = costPerItem * item.count
Asa@26 407 item.invested = value
Asa@26 408 self:Print("You already owned %s %s with an unknown price, so they have also been updated to %s each", (item.count - countChange), itemName, self:FormatMoney(costPerItem))
Asa@26 409 end
Asa@26 410
Asa@7 411 if abs(value) > 0 then
Asa@22 412 if item.invested < 0 then
Asa@16 413 if self.db.profile.messages.cost_updates then
Asa@16 414 self:Print(format("Updated price of %s from %s to %s. %sYou just made a profit of %s.", itemName, self:FormatMoney(item.invested - value), self:FormatMoney(0), GREEN, self:FormatMoney(abs(item.invested))))
Asa@16 415 end
Asa@12 416 self:RemoveItem(link)
Asa@12 417 -- This doesn't work when you mail the only copy of an item you have to another character.
Asa@12 418 --[[
Asa@12 419 elseif item.count == 0 and realLink and Altoholic:GetItemCount(self:GetIDFromLink(realLink)) then
Asa@15 420 self:Print("You ran out of " .. itemName .. " and never recovered " .. self:FormatMoney(item.invested))
Asa@12 421 self:RemoveItem(link)
Asa@12 422 ]]
Asa@16 423 else
Asa@16 424 if self.db.profile.messages.cost_updates then
Asa@16 425 self:Print(format("Updated price of %s from %s to %s. (total change:%s)", itemName, self:FormatMoney(item.invested - value), self:FormatMoney(item.invested), self:FormatMoney(value)))
Asa@16 426 end
Asa@12 427 end
Asa@0 428 end
Asa@10 429
Asa@10 430 if realLink ~= nil then
Asa@63 431 ItemAuditor:UpdateQAThreshold(realLink)
Asa@10 432 end
Asa@35 433 UpdateInvestedData()
Asa@10 434 end
Asa@12 435
Asa@0 436
Asa@63 437 function ItemAuditor:WatchBags()
Asa@4 438 if self.watch_handle == nil then
Asa@63 439 ItemAuditor:UpdateCurrentInventory()
Asa@23 440 self.watch_handle = self:RegisterBucketEvent({"BAG_UPDATE", "PLAYER_MONEY"}, 0.3, "UpdateAudit")
Asa@4 441 end
Asa@0 442 end
Asa@0 443
Asa@63 444 function ItemAuditor:UnwatchBags()
Asa@4 445 if self.watch_handle ~= nil then
Asa@4 446 self:UnregisterBucket(self.watch_handle)
Asa@4 447 self.watch_handle = nil
Asa@4 448 end
Asa@0 449 end
Asa@0 450
Asa@9 451
Asa@63 452 function ItemAuditor:GetSafeLink(link)
Asa@9 453 local newLink = nil
Asa@9 454
Asa@24 455 if link and link == string.match(link, '.-:[-0-9]+[:0-9]*') then
Asa@24 456 newLink = link
Asa@24 457 elseif link then
Asa@9 458 newLink = link and string.match(link, "|H(.-):([-0-9]+):([0-9]+)|h")
Asa@9 459 end
Asa@9 460 if newLink == nil then
Asa@9 461 local itemID = self:GetItemID(link)
Asa@9 462 if itemID ~= nil then
Asa@9 463 _, newLink = GetItemInfo(itemID)
Asa@9 464 return self:GetSafeLink(newLink)
Asa@9 465 end
Asa@9 466 end
Asa@9 467 return newLink and string.gsub(newLink, ":0:0:0:0:0:0", "")
Asa@9 468 end
Asa@9 469
Asa@63 470 function ItemAuditor:GetIDFromLink(link)
Asa@9 471 local _, _, _, _, Id = string.find(link, "|?c?f?f?(%x*)|?H?([^:]*):?(%d+):?(%d*):?(%d*):?(%d*):?(%d*):?(%d*):?(%-?%d*):?(%-?%d*):?(%d*)|?h?%[?([^%[%]]*)%]?|?h?|?r?")
Asa@9 472 return tonumber(Id)
Asa@9 473 end
Asa@9 474
Asa@63 475 function ItemAuditor:GetItemCost(link, countModifier)
Asa@9 476 local item = self:GetItem(link, true)
Asa@8 477
Asa@9 478 if item.invested > 0 then
Asa@9 479 local count = item.count
Asa@9 480
Asa@9 481 if countModifier ~= nil then
Asa@9 482 count = count - countModifier
Asa@0 483 end
Asa@9 484 if count > 0 then
Asa@45 485 return ceil(item.invested), ceil(item.invested/count), count
Asa@9 486 end
Asa@9 487
Asa@0 488 end
Asa@35 489 return 0, 0, Altoholic:GetItemCount(ItemAuditor:GetIDFromLink(link))
Asa@0 490 end