From 51a389d780a6d47f73636eae642c82054fef5aba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lien=20Sell=C3=A6g?= Date: Sun, 11 Jan 2026 05:05:14 +0100 Subject: [PATCH] add ah restock command --- TradeSkillMaster/TradeSkillMaster.toc | 2 +- .../TradeSkillMaster_AuctionDB.toc | 4 ++-- TradeSkillMaster_Warehousing/Locale/enUS.lua | 2 ++ TradeSkillMaster_Warehousing/Modules/move.lua | 24 +++++++++++++++++++ .../TradeSkillMaster_Warehousing.lua | 7 +++++- 5 files changed, 35 insertions(+), 4 deletions(-) diff --git a/TradeSkillMaster/TradeSkillMaster.toc b/TradeSkillMaster/TradeSkillMaster.toc index a8a95fe..5fbf8f3 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.23 +## Version: 2.3.24 ## 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.toc b/TradeSkillMaster_AuctionDB/TradeSkillMaster_AuctionDB.toc index 824d77c..dfbc0fa 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.23 +## Version: 2.3.24 ## SavedVariables: AscensionTSM_AuctionDB ## Dependency: TradeSkillMaster -## X-Curse-Packaged-Version: 2.3.23 +## X-Curse-Packaged-Version: 2.3.24 ## X-Curse-Project-Name: TradeSkillMaster_AuctionDB ## X-Curse-Project-ID: tradeskillmaster_auctiondb ## X-Curse-Repository-ID: wow/tradeskillmaster_auctiondb/mainline diff --git a/TradeSkillMaster_Warehousing/Locale/enUS.lua b/TradeSkillMaster_Warehousing/Locale/enUS.lua index 426c9a9..aba7fac 100644 --- a/TradeSkillMaster_Warehousing/Locale/enUS.lua +++ b/TradeSkillMaster_Warehousing/Locale/enUS.lua @@ -66,10 +66,12 @@ L["Puts items matching the itemstring, itemID or partial text entered into the b L["Relationships"] = true L["Restock Bags"] = true L["Restock from AH"] = true +L["Restocks items from the AH based on your Warehousing group selections."] = true L["Restock Quantity"] = true L["Restock Settings"] = true L["Restock Settings"] = true L["Restocking"] = true +L["No groups selected."] = true L["Restore Bags"] = true L["Set Keep in Bags Quantity"] = true L["Set Keep in Bank Quantity"] = true diff --git a/TradeSkillMaster_Warehousing/Modules/move.lua b/TradeSkillMaster_Warehousing/Modules/move.lua index ed334a4..05e4bb1 100644 --- a/TradeSkillMaster_Warehousing/Modules/move.lua +++ b/TradeSkillMaster_Warehousing/Modules/move.lua @@ -15,6 +15,22 @@ local move = TSM:NewModule("move", "AceEvent-3.0") local AceGUI = LibStub("AceGUI-3.0") -- load the AceGUI libraries local private = { shoppingItems = {} } +local function GetSelectedGroupInfoFallback() + local selection = TSM.db.profile.groupTreeSelectedGroupStatus and TSM.db.profile.groupTreeSelectedGroupStatus["Warehousing_Bank"] + if not selection then return end + local groupInfo = {} + for groupPath, isSelected in pairs(selection) do + if isSelected then + local operations = TSM:GetGroupOperations(groupPath, "Warehousing") + if operations then + groupInfo[groupPath] = { operations = operations, items = TSM:GetGroupItems(groupPath) } + end + end + end + if next(groupInfo) == nil then return end + return groupInfo +end + local function ShoppingNextSearch() if next(private.shoppingItems) then move:ShoppingSearch(private.shoppingItems[1].itemString, private.shoppingItems[1].quantity) @@ -58,6 +74,14 @@ function move:restockGroupAuction(grpInfo) return end + if not grpInfo then + grpInfo = GetSelectedGroupInfoFallback() + end + if not grpInfo or next(grpInfo) == nil then + TSM:Print(L["No groups selected."]) + return + end + local restockItems = TSM.data:unIndexRestockGroupTree(grpInfo) private.shoppingItems = {} for itemString, quantity in pairs(restockItems) do diff --git a/TradeSkillMaster_Warehousing/TradeSkillMaster_Warehousing.lua b/TradeSkillMaster_Warehousing/TradeSkillMaster_Warehousing.lua index c0dc0d2..fd8ccb7 100644 --- a/TradeSkillMaster_Warehousing/TradeSkillMaster_Warehousing.lua +++ b/TradeSkillMaster_Warehousing/TradeSkillMaster_Warehousing.lua @@ -89,6 +89,7 @@ function TSM:RegisterModule() { key = "movedata", label = L["Displays realtime move data."], callback = "SetLogFlag" }, { key = "get", label = L["Gets items from the bank or guild bank matching the itemstring, itemID or partial text entered."], callback = "GetItem" }, { key = "put", label = L["Puts items matching the itemstring, itemID or partial text entered into the bank or guild bank."], callback = "PutItem" }, + { key = "restockah", label = L["Restocks items from the AH based on your Warehousing group selections."], callback = "RestockFromAH" }, } TSM.operations = { maxOperations = 1, callbackOptions = "Options:Load", callbackInfo = "GetOperationInfo" } TSM.bankUiButton = { callback = "bankui:createTab" } @@ -237,4 +238,8 @@ function TSM:PutItem(args) else TSM:Print(L["Invalid criteria entered."]) end -end \ No newline at end of file +end + +function TSM:RestockFromAH() + TSM.move:restockGroupAuction() +end