From 9f9d5b2c63e789b69a4f3433611b3bab8aa17e38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lien=20Sell=C3=A6g?= Date: Thu, 15 Jan 2026 04:37:47 +0100 Subject: [PATCH] fix vendor gather overbuying --- TradeSkillMaster/TradeSkillMaster.toc | 2 +- .../TradeSkillMaster_AuctionDB.toc | 4 ++-- TradeSkillMaster_Crafting/Modules/Gather.lua | 10 ++++++++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/TradeSkillMaster/TradeSkillMaster.toc b/TradeSkillMaster/TradeSkillMaster.toc index f9e7338..20f7377 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.40 +## Version: 2.3.41 ## 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 9b910cf..d38cf91 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.40 +## Version: 2.3.41 ## SavedVariables: AscensionTSM_AuctionDB ## Dependency: TradeSkillMaster -## X-Curse-Packaged-Version: 2.3.40 +## X-Curse-Packaged-Version: 2.3.41 ## X-Curse-Project-Name: TradeSkillMaster_AuctionDB ## X-Curse-Project-ID: tradeskillmaster_auctiondb ## X-Curse-Repository-ID: wow/tradeskillmaster_auctiondb/mainline diff --git a/TradeSkillMaster_Crafting/Modules/Gather.lua b/TradeSkillMaster_Crafting/Modules/Gather.lua index 64e0ccd..9f7e9c8 100644 --- a/TradeSkillMaster_Crafting/Modules/Gather.lua +++ b/TradeSkillMaster_Crafting/Modules/Gather.lua @@ -18,11 +18,17 @@ function Gather:BuyFromMerchant(neededMats) for i = 1, GetMerchantNumItems() do local itemString = TSMAPI:GetItemString(GetMerchantItemLink(i)) if neededMats[itemString] then + local _, _, _, quantity = GetMerchantItemInfo(i) local maxStack = GetMerchantItemMaxStack(i) + quantity = max(quantity or 1, 1) local toBuy = neededMats[itemString] while toBuy > 0 do - BuyMerchantItem(i, math.min(toBuy, maxStack)) - toBuy = toBuy - maxStack + local buyCount = math.ceil(toBuy / quantity) + if maxStack and maxStack > 0 then + buyCount = math.min(buyCount, maxStack) + end + BuyMerchantItem(i, buyCount) + toBuy = toBuy - (buyCount * quantity) TSM.db.realm.gathering.gatheredMats = true end end