|
|
|
|
@ -15,6 +15,8 @@ local L = LibStub("AceLocale-3.0"):GetLocale("TradeSkillMaster_AuctionDB") -- lo
|
|
|
|
|
|
|
|
|
|
TSM.MAX_AVG_DAY = 1 |
|
|
|
|
local SECONDS_PER_DAY = 60 * 60 * 24 |
|
|
|
|
local eventObj |
|
|
|
|
local private = {} |
|
|
|
|
|
|
|
|
|
local savedDBDefaults = { |
|
|
|
|
realm = { |
|
|
|
|
@ -223,6 +225,23 @@ function TSM:OnEnable()
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
TSM:LoadAuctionData() |
|
|
|
|
eventObj = eventObj or TSMAPI:GetEventObject() |
|
|
|
|
eventObj:SetCallback("TSM:AUCTIONCONTROL:ITEMBOUGHT", private.OnItemBought) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
function private.OnItemBought(_, data) |
|
|
|
|
if type(data) ~= "table" or not data.itemString then return end |
|
|
|
|
local itemID = TSMAPI:GetItemID(data.itemString) |
|
|
|
|
if not itemID or not TSM.data[itemID] then return end |
|
|
|
|
TSM:DecodeItemData(itemID) |
|
|
|
|
local link = data.link or select(2, TSMAPI:GetSafeItemInfo(data.itemString)) or data.itemString |
|
|
|
|
local buyoutText = data.buyout and (TSMAPI:FormatTextMoney(data.buyout, "|cffffffff", true) or "---") or "---" |
|
|
|
|
local total = TSM.data[itemID].quantity |
|
|
|
|
local minBuyout = TSM:GetMinBuyout(itemID) |
|
|
|
|
local marketValue = TSM:GetMarketValue(itemID) |
|
|
|
|
local minText = minBuyout and (TSMAPI:FormatTextMoney(minBuyout, "|cffffffff", true) or "---") or "---" |
|
|
|
|
local marketText = marketValue and (TSMAPI:FormatTextMoney(marketValue, "|cffffffff", true) or "---") or "---" |
|
|
|
|
TSM:Printf("Bought %s for %s (x%d). total=%s dbmin=%s dbmarket=%s", link, buyoutText, data.count or 1, total and tostring(total) or "?", minText, marketText) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
function TSM:OnTSMDBShutdown() |
|
|
|
|
|