From 472f8d2be6166d56320af7e86abe1c87a09998b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lien=20Sell=C3=A6g?= Date: Sat, 3 Jan 2026 00:35:54 +0100 Subject: [PATCH] update auctiondb sync and accounting graph --- AGENTS.md | 2 +- TradeSkillMaster/TradeSkillMaster.toc | 4 +-- TradeSkillMaster_Accounting/Locale/enUS.lua | 4 +-- TradeSkillMaster_Accounting/Modules/gui.lua | 9 +++-- .../TradeSkillMaster_Accounting.lua | 4 +-- TradeSkillMaster_AuctionDB/Locale/enUS.lua | 1 + .../Modules/ChannelSync.lua | 36 +++++++++++++++++++ .../TradeSkillMaster_AuctionDB.toc | 4 +-- .../modules/PostScan.lua | 12 +++++-- 9 files changed, 60 insertions(+), 16 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index d538d0f..5951760 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -16,7 +16,7 @@ No automated test framework is present. Validate changes by enabling the addon i Recent commit messages are short and action-focused (for example “add group scan”, “skip wipe of data when searching”). Keep messages concise and imperative when possible. For pull requests, follow the template in `.github/PULL_REQUEST_TEPMLATE.md`: include a clear description, reference issues with `Fixes #`, select a change type, describe test steps, and complete the self-review checklist. ## Agent Notes -When adding or renaming modules, update the `.toc` and matching `.lua` filenames together, and ensure any new files are listed in the `.toc` manifest. Keep changes scoped to the relevant module folder to avoid cross-module regressions. +When adding or renaming modules, update the `.toc` and matching `.lua` filenames together, and ensure any new files are listed in the `.toc` manifest. Keep changes scoped to the relevant module folder to avoid cross-module regressions. Increment numeric `Version`/`X-Curse-Packaged-Version` in `TradeSkillMaster_AuctionDB/TradeSkillMaster_AuctionDB.toc` and `Version` in `TradeSkillMaster/TradeSkillMaster.toc` on each commit. Local Ascension client paths used in this workspace: - AddOns: `/home/zalox/Games/ascension-wow/drive_c/Program Files/Ascension Launcher/resources/client/Interface/AddOns` - SavedVariables: `/home/zalox/Games/ascension-wow/drive_c/Program Files/Ascension Launcher/resources/client/WTF/Account/omanfred/SavedVariables` diff --git a/TradeSkillMaster/TradeSkillMaster.toc b/TradeSkillMaster/TradeSkillMaster.toc index d058d7c..4cd190c 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: Rev668 +## Version: 2.3.13 ## 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 @@ -96,4 +96,4 @@ GUI\TSMWidgets\TSMGroupBox.lua Assistant\Assistant.lua Assistant\Questions.lua -Assistant\Steps.lua \ No newline at end of file +Assistant\Steps.lua diff --git a/TradeSkillMaster_Accounting/Locale/enUS.lua b/TradeSkillMaster_Accounting/Locale/enUS.lua index b7d735c..936afab 100644 --- a/TradeSkillMaster_Accounting/Locale/enUS.lua +++ b/TradeSkillMaster_Accounting/Locale/enUS.lua @@ -15,7 +15,7 @@ if not L then return end L["|cffff0000IMPORTANT:|r When TSM_Accounting last saved data for this realm, it was too big for WoW to handle, so old data was automatically trimmed in order to avoid corruption of the saved variables. The last %s of %s data has been preserved."] = true L["%s ago"] = true -L["Accounting has not yet collected enough information for this tab. This is likely due to not having recorded enough data points or not seeing any significant fluctuations (over 1k gold) in your gold on hand."] = true +L["Accounting has not yet collected enough information for this tab. This is likely due to not having recorded enough data points or not seeing any significant fluctuations in your gold on hand."] = true L["Activity Type"] = true L["All"] = true L["Amount"] = true @@ -26,7 +26,7 @@ L["Avg Resale Profit"] = true L["Avg Sell Price"] = true L["Back to Previous Page"] = true L["Balance"] = true -L["Below is a graph of the your character's gold on hand over time.\n\nThe x-axis is time and goes from %s to %s\nThe y-axis is thousands of gold."] = true +L["Below is a graph of the your character's gold on hand over time.\n\nThe x-axis is time and goes from %s to %s\nThe y-axis is gold."] = true L["Bought"] = true L["Buyer/Seller"] = true L["Cancelled Since Last Sale:"] = true diff --git a/TradeSkillMaster_Accounting/Modules/gui.lua b/TradeSkillMaster_Accounting/Modules/gui.lua index a5f11a9..d021b59 100644 --- a/TradeSkillMaster_Accounting/Modules/gui.lua +++ b/TradeSkillMaster_Accounting/Modules/gui.lua @@ -809,7 +809,7 @@ function private:GetGoldGraphPoints(goldLog) local data = {} for _, info in ipairs(goldLog) do local x1, x2 = info.startMinute, info.endMinute - local y = info.copper / COPPER_PER_GOLD / 1000 + local y = info.copper / COPPER_PER_GOLD minX = min(minX, x1) maxX = max(maxX, x2) minY = min(minY, floor(y)) @@ -831,7 +831,7 @@ function private:GetGoldGraphSumData() if i > 1 then data[i].startMinute = data[i-1].endMinute+1 end - data[i].copper = TSM:Round(data[i].copper, COPPER_PER_GOLD*1000) + data[i].copper = TSM:Round(data[i].copper, COPPER_PER_GOLD) end tinsert(players, data) tinsert(starts, data[1].startMinute) @@ -907,7 +907,7 @@ function GUI:DrawGoldGraph(container) children = { { type = "Label", - text = L["Accounting has not yet collected enough information for this tab. This is likely due to not having recorded enough data points or not seeing any significant fluctuations (over 1k gold) in your gold on hand."], + text = L["Accounting has not yet collected enough information for this tab. This is likely due to not having recorded enough data points or not seeing any significant fluctuations in your gold on hand."], relativeWidth = 1, }, { @@ -948,8 +948,7 @@ function GUI:DrawGoldGraph(container) children = { { type = "Label", - --text = format(L["Below is a graph of the your character's gold on hand over time.\n\nThe x-axis is time and goes from %s to %s\nThe y-axis is thousands of gold."], startDate, endDate), - text = format("Below is a graph of the your character's gold on hand over time.\nThe x-axis is time and goes from %s to %s. The y-axis is thousands of gold.", startDate, endDate), + text = format(L["Below is a graph of the your character's gold on hand over time.\n\nThe x-axis is time and goes from %s to %s\nThe y-axis is gold."], startDate, endDate), relativeWidth = 1, }, -- { diff --git a/TradeSkillMaster_Accounting/TradeSkillMaster_Accounting.lua b/TradeSkillMaster_Accounting/TradeSkillMaster_Accounting.lua index 546d1f9..63ee874 100644 --- a/TradeSkillMaster_Accounting/TradeSkillMaster_Accounting.lua +++ b/TradeSkillMaster_Accounting/TradeSkillMaster_Accounting.lua @@ -90,8 +90,8 @@ function TSM:OnInitialize() if data.startMinute == data.endMinute and data.copper == 0 then tremove(playerData, i) else - -- round to nearest 1k gold - data.copper = TSM:Round(data.copper, COPPER_PER_GOLD*1000) + -- round to nearest gold + data.copper = TSM:Round(data.copper, COPPER_PER_GOLD) end end if #playerData >= 2 then diff --git a/TradeSkillMaster_AuctionDB/Locale/enUS.lua b/TradeSkillMaster_AuctionDB/Locale/enUS.lua index 88f508a..0287988 100644 --- a/TradeSkillMaster_AuctionDB/Locale/enUS.lua +++ b/TradeSkillMaster_AuctionDB/Locale/enUS.lua @@ -16,6 +16,7 @@ if not L then return end L["%s ago"] = true L["A full auction house scan will scan every item on the auction house. Expect this scan to take several minutes or longer."] = true L["Any items in the AuctionDB database that contain the search phrase in their names will be displayed."] = true +L["A newer version of AuctionDB (%s) was received from %s. You are running %s."] = true L["Are you sure you want to clear your AuctionDB data?"] = true L["Ascending"] = true L["AuctionDB - Market Value"] = true diff --git a/TradeSkillMaster_AuctionDB/Modules/ChannelSync.lua b/TradeSkillMaster_AuctionDB/Modules/ChannelSync.lua index f5b1d78..0c54943 100644 --- a/TradeSkillMaster_AuctionDB/Modules/ChannelSync.lua +++ b/TradeSkillMaster_AuctionDB/Modules/ChannelSync.lua @@ -10,6 +10,7 @@ local TSM = select(2, ...) local ChannelSync = TSM:NewModule("ChannelSync", "AceEvent-3.0") +local L = LibStub("AceLocale-3.0"):GetLocale("TradeSkillMaster_AuctionDB") local CHANNEL_NAME = "TSM_AuctionDB" local COMM_PREFIX = "TSMADB1" @@ -26,6 +27,7 @@ local private = { incoming = {}, sendQueue = {}, isSending = false, + notifiedNewer = {}, } local strbyte = string.byte @@ -35,6 +37,26 @@ local libD = LibStub("LibDeflate", true) local warnedNoDeflate local debugEnabled = true +local function GetAddonVersion() + local version = GetAddOnMetadata("TradeSkillMaster_AuctionDB", "X-Curse-Packaged-Version") + or GetAddOnMetadata("TradeSkillMaster_AuctionDB", "Version") + if not version or version == "" then + return "unknown" + end + return version +end + +local function VersionKey(version) + local key = 0 + for part in tostring(version or ""):gmatch("%d+") do + key = key * 1000 + tonumber(part) + end + return key +end + +private.addonVersion = GetAddonVersion() +private.addonVersionKey = VersionKey(private.addonVersion) + local function DebugPrint(msg) if debugEnabled then TSM:Print("ChannelSync: " .. msg) @@ -148,6 +170,16 @@ local function DecodePayload(encoded) return payload end +local function MaybeNotifyNewerVersion(remoteVersion, sender) + local remoteKey = VersionKey(remoteVersion) + local localKey = private.addonVersionKey + if remoteKey == 0 or localKey == 0 or remoteKey <= localKey then return end + local noticeKey = tostring(sender or "unknown") .. ":" .. tostring(remoteVersion) + if private.notifiedNewer[noticeKey] then return end + private.notifiedNewer[noticeKey] = true + TSM:Printf(L["A newer version of AuctionDB (%s) was received from %s. You are running %s."], remoteVersion, sender or "unknown", private.addonVersion) +end + function ChannelSync:BroadcastScanData(scanType, items) if scanType ~= "Full" and scanType ~= "Group" and scanType ~= "Search" then return @@ -255,6 +287,7 @@ function ChannelSync:BuildPayloadFromItemIDs(scanType, itemIDList) v = 1, scanType = scanType, scanTime = TSM.db.realm.lastCompleteScan, + version = private.addonVersion, items = payloadItems, } end @@ -381,6 +414,9 @@ function ChannelSync:OnChannelMessage(_, msg, source, _, channelString, _, chann DebugPrint("Payload decode failed for bundle " .. format("%08x", hash)) return end + if payload.version then + MaybeNotifyNewerVersion(payload.version, source) + end MergeIncomingData(payload, source) end diff --git a/TradeSkillMaster_AuctionDB/TradeSkillMaster_AuctionDB.toc b/TradeSkillMaster_AuctionDB/TradeSkillMaster_AuctionDB.toc index b76158c..d17e2d5 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: v2.3.10 +## Version: 2.3.13 ## SavedVariables: AscensionTSM_AuctionDB ## Dependency: TradeSkillMaster -## X-Curse-Packaged-Version: v2.3.10 +## X-Curse-Packaged-Version: 2.3.13 ## 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/PostScan.lua b/TradeSkillMaster_Auctioning/modules/PostScan.lua index a373592..5240bb5 100644 --- a/TradeSkillMaster_Auctioning/modules/PostScan.lua +++ b/TradeSkillMaster_Auctioning/modules/PostScan.lua @@ -13,6 +13,7 @@ local L = LibStub("AceLocale-3.0"):GetLocale("TradeSkillMaster_Auctioning") -- l local bagInfo, bagState = {}, {} local bagInfoUpdate = 0 local postQueue, currentItem, itemLocations = {}, {}, {} +local scanItems local totalToPost, totalPosted, count = 0, 0, 0 local isScanning, GUI @@ -129,7 +130,11 @@ function Post:GetScanListAndSetup(GUIRef, options) tinsert(scanList, itemString) end end - + scanItems = {} + for _, itemString in ipairs(scanList) do + tinsert(scanItems, itemString) + end + TSMAPI:FireEvent("AUCTIONING:POST:START", {numItems=#scanList, isGroup=true}) return scanList end @@ -523,5 +528,8 @@ end function Post:DoneScanning() isScanning = false + if scanItems and next(TSM.Scan.auctionData) then + TSMAPI:ModuleAPI("AuctionDB", "processScanData", TSM.Scan.auctionData, scanItems, time()) + end return totalToPost -end \ No newline at end of file +end