Compare commits

...

6 Commits

  1. 127
      .gitignore
  2. 2
      TradeSkillMaster/Auction/AuctionScanning.lua
  3. 2
      TradeSkillMaster/Libs/LibAuctionScan-1.0/LibAuctionScan-1.0.lua
  4. 2
      TradeSkillMaster_AuctionDB/Modules/Scanning.lua
  5. 83
      TradeSkillMaster_AuctionDB/Modules/data.lua
  6. 3
      TradeSkillMaster_AuctionDB/TradeSkillMaster_AuctionDB.lua
  7. 6
      TradeSkillMaster_Shopping/modules/Util.lua

127
.gitignore vendored

@ -1,7 +1,132 @@
*~
.env .env
.DS_Store .DS_Store
.release .release
.install .install
.lua/* .lua/*
.vscode .vscode
.idea .idea.
02a7e8db-fd8d-4213-8d9c-ab66009a487d.zip
408e9dd4-e03b-4a89-b1f1-a488136d6283.zip
4a37aaf8-9aa6-4246-8c0d-1cafc6b994a1.zip
4dfc20a9-9140-4893-b179-be02e48463be.zip
90bb9009-f7ef-46ff-8a2e-38192b1823a9.zip
9bc9a709-ad9d-4536-9841-f0c5f04b6822.zip
a1464a44-7ec6-4cec-896d-d24131e2ac4a.zip
AI_VoiceOver
AI_VoiceOverData_Vanilla
AllStats
AtlasLoot
AtlasLoot_BurningCrusade
AtlasLoot_Cache
AtlasLoot_Crafting_OriginalWoW
AtlasLoot_Crafting_TBC
AtlasLoot_Crafting_Wrath
AtlasLoot_OriginalWoW
AtlasLoot_Vanity
AtlasLoot_WorldEvents
AtlasLoot_WrathoftheLichKing
AutoQuest
b823d87f-b909-4698-9ac1-a6d9934e618e.zip
Bagnon
Bagnon_Config
Bagnon_Forever
Bagnon_GuildBank
Bagnon_Tooltips
Blizzard_AchievementUI
Blizzard_ArenaUI
Blizzard_AuctionUI
Blizzard_BarbershopUI
Blizzard_BattlefieldMinimap
Blizzard_BindingUI
Blizzard_Calendar
Blizzard_CombatLog
Blizzard_CombatText
Blizzard_DebugTools
Blizzard_GlyphUI
Blizzard_GMChatUI
Blizzard_GMSurveyUI
Blizzard_GuildBankUI
Blizzard_InspectUI
Blizzard_ItemSocketingUI
Blizzard_MacroUI
Blizzard_RaidUI
Blizzard_TalentUI
Blizzard_TimeManager
Blizzard_TokenUI
Blizzard_TradeSkillUI
Blizzard_TrainerUI.old
c81d84c4-62a1-4839-b245-b48123ba3973.zip
Chatter
d5d9dbc2-4e0f-4472-9301-ee99107f0039.zip
d613bf63-a1bb-4311-b82a-4cbe7c2fd272.zip
DBM-AQ20
DBM-AQ40
DBM-BlackTemple
DBM-BurningCrusade
DBM-BWL
DBM-Core
DBM-GruulsLair
DBM-GUI
DBM-Hyjal
DBM-Karazhan
DBM-MagtheridonsLair
DBM-MC
DBM-Naxx
DBM-Onyxia
DBM-Outlands
DBM-Party-BC
DBM-Party-Vanilla
DBM-PvP
DBM-Serpentshrine
DBM-SpellTimers
DBM-Sunwell
DBM-TheEye
DBM-WorldEvents
DBM-ZG
DBM-ZulAman
dcfbd3bc-59dd-4f48-b9c0-4b7db6beb0ec.zip
Decursive
Details
Details_Compare2
Details_DataStorage
Details_EncounterDetails
Details_RaidCheck
Details_Streamer
Details_TargetCaller
Details_TinyThreat
Details_Vanguard
df1a0fb8-4b69-4468-99ad-6fdb2ef72b78.zip
e0910ca2-c063-47de-a651-8705d6d70be8.zip
ElvUI
ElvUI_AddOnSkins
ElvUI_Enhanced
ElvUI_EnhancedFriendsList
ElvUI_ExtraActionBars
ElvUI_OptionsUI
ESN_Rare
f024ba61-e2a4-47a5-86c7-3d1d5542cc5d.zip
f33cd75c-e6a9-4330-ad26-f94483d0f8a7.zip
fa9e16f2-0fbb-4f77-b4b5-af33af8987e8.zip
GatherMate2
.git
.github
LootCollector
New Folder
Omen
OmniCC
OmniCC_Config
Outfitter
Passloot
pfQuest
pfQuest-ascension
README.md
SilverDragon
SilverDragon_Data
tmp
TomTom
TrinketMenu
WeakAuras
WeakAurasArchive
WeakAurasModelPaths
WeakAurasOptions

2
TradeSkillMaster/Auction/AuctionScanning.lua

@ -34,7 +34,7 @@ local function eventHandler(event)
-- auction house was closed, make sure all scanning is stopped -- auction house was closed, make sure all scanning is stopped
AuctionScanning:UnregisterEvent("AUCTION_ITEM_LIST_UPDATE") AuctionScanning:UnregisterEvent("AUCTION_ITEM_LIST_UPDATE")
private.auctionHouseShown = false private.auctionHouseShown = false
DoCallback("INTERRUPTED") DoCallback("INTERRUPTED", private.data)
private:StopScanning() private:StopScanning()
elseif event == "AUCTION_ITEM_LIST_UPDATE" then elseif event == "AUCTION_ITEM_LIST_UPDATE" then
-- gets called whenever the AH window is updated (something is shown in the results section) -- gets called whenever the AH window is updated (something is shown in the results section)

2
TradeSkillMaster/Libs/LibAuctionScan-1.0/LibAuctionScan-1.0.lua

@ -522,7 +522,7 @@ do
if interrupted then if interrupted then
-- fires if the scan was interrupted -- fires if the scan was interrupted
DoCallback("SCAN_INTERRUPTED") DoCallback("SCAN_INTERRUPTED", status.data)
else else
-- fires if the scan completed sucessfully -- fires if the scan completed sucessfully
DoCallback("SCAN_COMPLETE", status.data) DoCallback("SCAN_COMPLETE", status.data)

2
TradeSkillMaster_AuctionDB/Modules/Scanning.lua

@ -161,6 +161,8 @@ local function FullScanCallback(event, ...)
-- NOTE: "SCAN_INTERRUPTED" is from LibAuctionScan-1.0, which isn't used -- NOTE: "SCAN_INTERRUPTED" is from LibAuctionScan-1.0, which isn't used
-- by TSM anymore, and "INTERRUPTED" is from "TSM/Auction/AuctionScanning.lua", -- by TSM anymore, and "INTERRUPTED" is from "TSM/Auction/AuctionScanning.lua",
-- which is what this scanner uses nowadays. -- which is what this scanner uses nowadays.
local data = ...
Scan:ProcessScanData(data)
Scan:DoneScanning() Scan:DoneScanning()
end end
end end

83
TradeSkillMaster_AuctionDB/Modules/data.lua

@ -130,15 +130,59 @@ function Data:GetMarketValue(scans)
return totalWeight > 0 and floor(totalAmount / totalWeight + 0.5) or 0 return totalWeight > 0 and floor(totalAmount / totalWeight + 0.5) or 0
end end
function Data:ProcessExternalScanData(scanData, groupItems, scanTime)
if type(scanData) ~= "table" then return end
local data = {}
local groupSet = {}
if type(groupItems) == "table" then
if #groupItems > 0 then
for _, itemString in ipairs(groupItems) do
groupSet[itemString] = true
end
else
for itemString in pairs(groupItems) do
groupSet[itemString] = true
end
end
end
for itemString, obj in pairs(scanData) do
if TSMAPI:GetBaseItemString(itemString) == itemString then
local itemID = obj:GetItemID()
local quantity, minBuyout = 0, 0
local records = {}
for _, record in ipairs(obj.records) do
if record.buyout and record.buyout > 0 then
local itemBuyout = record:GetItemBuyout()
if itemBuyout then
if (itemBuyout < minBuyout or minBuyout == 0) then
minBuyout = itemBuyout
end
quantity = quantity + record.count
tinsert(records, {record.count, itemBuyout})
end
end
end
data[itemID] = {records=records, minBuyout=minBuyout, quantity=quantity}
groupSet[itemString] = true
end
end
if not next(data) then return end
Data:ProcessData(data, groupSet, nil, scanTime or time(), true)
end
--- Process a table of new market scan data. --- Process a table of new market scan data.
-- @param scanData The market scan data. -- @param scanData The market scan data.
-- @param[opt] groupItems Affects how the minBuyout data is wiped. Use nil for regular behavior. -- @param[opt] groupItems Affects how the minBuyout data is wiped. Use nil for regular behavior.
-- @param[opt] verifyNewAlgorithm Boolean 'true' if you want to benchmark and verify the new market value algorithm. -- @param[opt] verifyNewAlgorithm Boolean 'true' if you want to benchmark and verify the new market value algorithm.
function Data:ProcessData(scanData, groupItems, verifyNewAlgorithm) -- @param[opt] scanTime Unix time to use for lastScan values.
-- @param[opt] skipMinBuyoutWipe If true, do not wipe minBuyout data before processing.
function Data:ProcessData(scanData, groupItems, verifyNewAlgorithm, scanTime, skipMinBuyoutWipe)
-- If we're currently processing data, retry in 0.2 seconds. -- If we're currently processing data, retry in 0.2 seconds.
-- NOTE: This will retry itself over and over until it's able to process. -- NOTE: This will retry itself over and over until it's able to process.
if TSM.processingData then if TSM.processingData then
return TSMAPI:CreateTimeDelay(0.2, function() Data:ProcessData(scanData, groupItems, verifyNewAlgorithm) end) return TSMAPI:CreateTimeDelay(0.2, function() Data:ProcessData(scanData, groupItems, verifyNewAlgorithm, scanTime, skipMinBuyoutWipe) end)
end end
@ -148,24 +192,26 @@ function Data:ProcessData(scanData, groupItems, verifyNewAlgorithm)
-- NOTE: It's no problem if we leave some items empty with "nil" minBuyout -- NOTE: It's no problem if we leave some items empty with "nil" minBuyout
-- values. That's how TSM is supposed to work, with items having an empty "minBuyout" -- values. That's how TSM is supposed to work, with items having an empty "minBuyout"
-- if there wasn't any "minBuyout" data for that item in the newest data batch. -- if there wasn't any "minBuyout" data for that item in the newest data batch.
if groupItems then if not skipMinBuyoutWipe then
-- A list of items ("group scan") was provided. Wipe data for those items. if groupItems then
for itemString in pairs(groupItems) do -- A list of items ("group scan") was provided. Wipe data for those items.
local itemID = TSMAPI:GetItemID(itemString) for itemString in pairs(groupItems) do
if TSM.data[itemID] then -- If we have existing data for this item. local itemID = TSMAPI:GetItemID(itemString)
if TSM.data[itemID] then -- If we have existing data for this item.
TSM:DecodeItemData(itemID)
TSM.data[itemID].minBuyout = nil -- Erase its stored minBuyout value.
TSM:EncodeItemData(itemID)
end
end
else
-- Wipe data for all items in memory, regardless of whether they're actually
-- included in the incoming scan data or not...
for itemID, data in pairs(TSM.data) do
TSM:DecodeItemData(itemID) TSM:DecodeItemData(itemID)
TSM.data[itemID].minBuyout = nil -- Erase its stored minBuyout value. data.minBuyout = nil -- Directly updates TSM.data[itemID] via reference.
TSM:EncodeItemData(itemID) TSM:EncodeItemData(itemID)
end end
end end
else
-- Wipe data for all items in memory, regardless of whether they're actually
-- included in the incoming scan data or not...
for itemID, data in pairs(TSM.data) do
TSM:DecodeItemData(itemID)
data.minBuyout = nil -- Directly updates TSM.data[itemID] via reference.
TSM:EncodeItemData(itemID)
end
end end
@ -184,6 +230,7 @@ function Data:ProcessData(scanData, groupItems, verifyNewAlgorithm)
-- pausing between each chunk to allow the game client to avoid freezing. -- pausing between each chunk to allow the game client to avoid freezing.
local index = 1 local index = 1
local day = Data:GetDay() local day = Data:GetDay()
local scanTimestamp = scanTime or TSM.db.realm.lastCompleteScan
local function DoDataProcessing() local function DoDataProcessing()
for i = 1, 500 do for i = 1, 500 do
-- Abort if we've reached the end of the processing queue. -- Abort if we've reached the end of the processing queue.
@ -316,7 +363,7 @@ function Data:ProcessData(scanData, groupItems, verifyNewAlgorithm)
-- item contains a "greater than 0" buyout value. That was mostly -- item contains a "greater than 0" buyout value. That was mostly
-- necessary in the past, when TSM sloppily included bid-only items -- necessary in the past, when TSM sloppily included bid-only items
-- in the data, but should no longer be able to happen with our new code! -- in the data, but should no longer be able to happen with our new code!
TSM.data[itemID].lastScan = TSM.db.realm.lastCompleteScan TSM.data[itemID].lastScan = scanTimestamp
TSM.data[itemID].minBuyout = data.minBuyout > 0 and data.minBuyout or nil TSM.data[itemID].minBuyout = data.minBuyout > 0 and data.minBuyout or nil
TSM.data[itemID].quantity = data.quantity -- Counts all items of all stacks. TSM.data[itemID].quantity = data.quantity -- Counts all items of all stacks.
Data:UpdateMarketValue(TSM.data[itemID]) Data:UpdateMarketValue(TSM.data[itemID])
@ -666,4 +713,4 @@ function Data:CalculateMarketValue(data, hide_oldschool_warning)
return corrected_mean return corrected_mean
end end
end end

3
TradeSkillMaster_AuctionDB/TradeSkillMaster_AuctionDB.lua

@ -75,6 +75,7 @@ function TSM:RegisterModule()
{ key = "lastCompleteScan", callback = TSM.GetLastCompleteScan }, { key = "lastCompleteScan", callback = TSM.GetLastCompleteScan },
{ key = "lastCompleteScanTime", callback = TSM.GetLastCompleteScanTime }, { key = "lastCompleteScanTime", callback = TSM.GetLastCompleteScanTime },
{ key = "adbScans", callback = TSM.GetScans }, { key = "adbScans", callback = TSM.GetScans },
{ key = "processScanData", callback = "Data:ProcessExternalScanData" },
--{ key = "adbOppositeFaction", callback = TSM.GetOppositeFactionData }, --{ key = "adbOppositeFaction", callback = TSM.GetOppositeFactionData },
} }
TSM.tooltipOptions = {callback = "Config:LoadTooltipOptions"} TSM.tooltipOptions = {callback = "Config:LoadTooltipOptions"}
@ -563,4 +564,4 @@ function TSM:GetMinBuyout(itemID)
if not itemID or not TSM.data[itemID] then return end if not itemID or not TSM.data[itemID] then return end
TSM:DecodeItemData(itemID) TSM:DecodeItemData(itemID)
return TSM.data[itemID].minBuyout return TSM.data[itemID].minBuyout
end end

6
TradeSkillMaster_Shopping/modules/Util.lua

@ -231,6 +231,10 @@ function private.ScanCallback(event, ...)
elseif event == "SCAN_COMPLETE" then elseif event == "SCAN_COMPLETE" then
if not private.filterList or not private.filterList[1] then return end -- protect against sniper scan starts causing issues if not private.filterList or not private.filterList[1] then return end -- protect against sniper scan starts causing issues
local data = ... local data = ...
local groupItems = private.filterList[1].items
if not private.isLastPageScan then
TSMAPI:ModuleAPI("AuctionDB", "processScanData", data, groupItems, time())
end
if private.filterList[1].items then if private.filterList[1].items then
for _, itemString in ipairs(private.filterList[1].items) do for _, itemString in ipairs(private.filterList[1].items) do
if data[itemString] then if data[itemString] then
@ -511,4 +515,4 @@ function private:AddPostedAuction(postInfo)
private.auctions[postInfo.itemString]:PopulateCompactRecords() private.auctions[postInfo.itemString]:PopulateCompactRecords()
private:UpdateRT() private:UpdateRT()
private.searchFrame.rt:SetSelectedAuction() private.searchFrame.rt:SetSelectedAuction()
end end

Loading…
Cancel
Save