diff --git a/TradeSkillMaster/Auction/AuctionControl.lua b/TradeSkillMaster/Auction/AuctionControl.lua index fdaea22..a68e17f 100644 --- a/TradeSkillMaster/Auction/AuctionControl.lua +++ b/TradeSkillMaster/Auction/AuctionControl.lua @@ -277,6 +277,7 @@ function private:AUCTION_ITEM_LIST_UPDATE() end TSM:AuctionControlCallback("OnBuyout", prevAuction) + TSMAPI:FireEvent("TSM:AUCTIONCONTROL:ITEMBOUGHT", prevAuction) end end @@ -821,4 +822,4 @@ function private:CreateControlButtons(parent) frame.buyout = button return frame -end \ No newline at end of file +end diff --git a/TradeSkillMaster/TradeSkillMaster.toc b/TradeSkillMaster/TradeSkillMaster.toc index ece96ff..35eb4b8 100644 --- a/TradeSkillMaster/TradeSkillMaster.toc +++ b/TradeSkillMaster/TradeSkillMaster.toc @@ -2,7 +2,7 @@ ## Title: |cff00fe00TradeSkillMaster: Revived|r ## Notes: Core addon for the TradeSkillMaster suite, revived for Wrath of the Lich King. Does nothing without modules installed. ## Author: Sapu94, Bart39, Gnomezilla [Warmane-Icecrown(A)], BlueAo [Warmane], andrew6180, Yoshiyuka, DimaSheiko, and other contributors... -## Version: 2.3.15 +## Version: 2.3.16 ## SavedVariables: TradeSkillMasterAppDB, AscensionTSMDB ## OptionalDeps: AccurateTime, Ace3, LibDataBroker-1.1, LibDBIcon-1.0, LibExtraTip, TipHelper, LibParse, LibCompress, LibGraph-2.0, SharedMedia, TheUndermineJournal, TheUndermineJournalGE ## X-Embeds: AccurateTime, Ace3, LibDataBroker-1.1, LibDBIcon-1.0, LibExtraTip, TipHelper, LibParse, LibCompress, LibGraph-2.0 diff --git a/TradeSkillMaster_AuctionDB/TradeSkillMaster_AuctionDB.lua b/TradeSkillMaster_AuctionDB/TradeSkillMaster_AuctionDB.lua index 9feaf29..2267bff 100644 --- a/TradeSkillMaster_AuctionDB/TradeSkillMaster_AuctionDB.lua +++ b/TradeSkillMaster_AuctionDB/TradeSkillMaster_AuctionDB.lua @@ -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() diff --git a/TradeSkillMaster_AuctionDB/TradeSkillMaster_AuctionDB.toc b/TradeSkillMaster_AuctionDB/TradeSkillMaster_AuctionDB.toc index 70b267a..d814081 100644 --- a/TradeSkillMaster_AuctionDB/TradeSkillMaster_AuctionDB.toc +++ b/TradeSkillMaster_AuctionDB/TradeSkillMaster_AuctionDB.toc @@ -2,10 +2,10 @@ ## Title: |cff00ff00TradeSkillMaster_AuctionDB|r ## Notes: Stores auction house data and calculates market prices. ## Author: Sapu94, Bart39 -## Version: 2.3.15 +## Version: 2.3.16 ## SavedVariables: AscensionTSM_AuctionDB ## Dependency: TradeSkillMaster -## X-Curse-Packaged-Version: 2.3.15 +## X-Curse-Packaged-Version: 2.3.16 ## X-Curse-Project-Name: TradeSkillMaster_AuctionDB ## X-Curse-Project-ID: tradeskillmaster_auctiondb ## X-Curse-Repository-ID: wow/tradeskillmaster_auctiondb/mainline diff --git a/TradeSkillMaster_Auctioning/modules/ResetScan.lua b/TradeSkillMaster_Auctioning/modules/ResetScan.lua index 3fed8bb..8c6de04 100644 --- a/TradeSkillMaster_Auctioning/modules/ResetScan.lua +++ b/TradeSkillMaster_Auctioning/modules/ResetScan.lua @@ -14,6 +14,7 @@ local resetData, summarySTCache, showCache, itemsReset, justBought = {}, {}, {}, local isScanning, doneScanningText, currentItem, GUI local summaryST, auctionST, resetButtons local currentAuction +local pendingBuyout function Reset:Show(frame) summaryST = summaryST or Reset:CreateSummaryST(frame.content) @@ -604,6 +605,10 @@ function Reset:RemoveCurrentAuction() scanData:RemoveRecord(row.index) itemsReset[row.itemString] = true + if pendingBuyout then + TSMAPI:FireEvent("TSM:AUCTIONCONTROL:ITEMBOUGHT", pendingBuyout) + pendingBuyout = nil + end Reset:UpdateAuctionST() if #auctionST.rowData == 0 then @@ -697,6 +702,11 @@ function Reset:BuyAuction() PlaceAuctionBid("list", mainIndex or altIndex, currentAuction.buyout) foundAuction = true justBought[mainIndex or altIndex] = true + pendingBuyout = { + itemString = currentAuction.itemString, + count = currentAuction.count, + buyout = currentAuction.buyout, + } end resetButtons.buyout:Disable() @@ -732,4 +742,4 @@ function Reset:FindCurrentAuctionForBuyout(itemString, buyout, count) end end, 0.1) Reset.isSearching = true -end \ No newline at end of file +end