Browse Source

fix vendor gather overbuying

dev
Jørgen Lien Sellæg 4 months ago
parent
commit
9f9d5b2c63
  1. 2
      TradeSkillMaster/TradeSkillMaster.toc
  2. 4
      TradeSkillMaster_AuctionDB/TradeSkillMaster_AuctionDB.toc
  3. 10
      TradeSkillMaster_Crafting/Modules/Gather.lua

2
TradeSkillMaster/TradeSkillMaster.toc

@ -2,7 +2,7 @@
## Title: |cff00fe00TradeSkillMaster: Revived|r ## Title: |cff00fe00TradeSkillMaster: Revived|r
## Notes: Core addon for the TradeSkillMaster suite, revived for Wrath of the Lich King. Does nothing without modules installed. ## 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... ## 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 ## SavedVariables: TradeSkillMasterAppDB, AscensionTSMDB
## OptionalDeps: AccurateTime, Ace3, LibDataBroker-1.1, LibDBIcon-1.0, LibExtraTip, TipHelper, LibParse, LibCompress, LibGraph-2.0, SharedMedia, TheUndermineJournal, TheUndermineJournalGE ## 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 ## X-Embeds: AccurateTime, Ace3, LibDataBroker-1.1, LibDBIcon-1.0, LibExtraTip, TipHelper, LibParse, LibCompress, LibGraph-2.0

4
TradeSkillMaster_AuctionDB/TradeSkillMaster_AuctionDB.toc

@ -2,10 +2,10 @@
## Title: |cff00ff00TradeSkillMaster_AuctionDB|r ## Title: |cff00ff00TradeSkillMaster_AuctionDB|r
## Notes: Stores auction house data and calculates market prices. ## Notes: Stores auction house data and calculates market prices.
## Author: Sapu94, Bart39 ## Author: Sapu94, Bart39
## Version: 2.3.40 ## Version: 2.3.41
## SavedVariables: AscensionTSM_AuctionDB ## SavedVariables: AscensionTSM_AuctionDB
## Dependency: TradeSkillMaster ## 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-Name: TradeSkillMaster_AuctionDB
## X-Curse-Project-ID: tradeskillmaster_auctiondb ## X-Curse-Project-ID: tradeskillmaster_auctiondb
## X-Curse-Repository-ID: wow/tradeskillmaster_auctiondb/mainline ## X-Curse-Repository-ID: wow/tradeskillmaster_auctiondb/mainline

10
TradeSkillMaster_Crafting/Modules/Gather.lua

@ -18,11 +18,17 @@ function Gather:BuyFromMerchant(neededMats)
for i = 1, GetMerchantNumItems() do for i = 1, GetMerchantNumItems() do
local itemString = TSMAPI:GetItemString(GetMerchantItemLink(i)) local itemString = TSMAPI:GetItemString(GetMerchantItemLink(i))
if neededMats[itemString] then if neededMats[itemString] then
local _, _, _, quantity = GetMerchantItemInfo(i)
local maxStack = GetMerchantItemMaxStack(i) local maxStack = GetMerchantItemMaxStack(i)
quantity = max(quantity or 1, 1)
local toBuy = neededMats[itemString] local toBuy = neededMats[itemString]
while toBuy > 0 do while toBuy > 0 do
BuyMerchantItem(i, math.min(toBuy, maxStack)) local buyCount = math.ceil(toBuy / quantity)
toBuy = toBuy - maxStack 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 TSM.db.realm.gathering.gatheredMats = true
end end
end end

Loading…
Cancel
Save