Compare commits

...

4 Commits

  1. 4
      TradeSkillMaster/Auction/AuctionControl.lua
  2. 2
      TradeSkillMaster/TradeSkillMaster.toc
  3. 4
      TradeSkillMaster_AuctionDB/TradeSkillMaster_AuctionDB.toc
  4. 6
      TradeSkillMaster_Auctioning/modules/Options.lua
  5. 21
      TradeSkillMaster_Crafting/Modules/CraftingGUI.lua
  6. 34
      TradeSkillMaster_Crafting/Modules/Gather.lua
  7. 36
      TradeSkillMaster_Crafting/Modules/Inventory.lua
  8. 1
      TradeSkillMaster_Shopping/TradeSkillMaster_Shopping.lua
  9. 4
      TradeSkillMaster_Shopping/modules/Destroying.lua
  10. 3
      TradeSkillMaster_Shopping/modules/Search.lua
  11. 6
      TradeSkillMaster_Shopping/modules/Util.lua
  12. 1
      TradeSkillMaster_Shopping/sidebar/Groups.lua

4
TradeSkillMaster/Auction/AuctionControl.lua

@ -203,7 +203,7 @@ function private:DoBuyout()
TSM:Print("Max restock quantity reached for this item.")
return
end
if private.module == "Shopping" and not ShoppingBuyoutAllowed(private.currentAuction.itemString, private.currentAuction.count, perItemBuyout) then
if private.module == "Shopping" and TSM.shoppingGroupSearchActive and not ShoppingBuyoutAllowed(private.currentAuction.itemString, private.currentAuction.count, perItemBuyout) then
TSM:Print("Max restock quantity reached for this item.")
return
end
@ -422,7 +422,7 @@ function private:ShowConfirmationWindow()
TSM:Print("Max restock quantity reached for this item.")
return
end
if private.module == "Shopping" and not ShoppingBuyoutAllowed(private.currentAuction.itemString, private.currentAuction.count, perItemBuyout) then
if private.module == "Shopping" and TSM.shoppingGroupSearchActive and not ShoppingBuyoutAllowed(private.currentAuction.itemString, private.currentAuction.count, perItemBuyout) then
TSM:Print("Max restock quantity reached for this item.")
return
end

2
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.39
## Version: 2.3.44
## 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

4
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.39
## Version: 2.3.44
## SavedVariables: AscensionTSM_AuctionDB
## Dependency: TradeSkillMaster
## X-Curse-Packaged-Version: 2.3.39
## X-Curse-Packaged-Version: 2.3.44
## X-Curse-Project-Name: TradeSkillMaster_AuctionDB
## X-Curse-Project-ID: tradeskillmaster_auctiondb
## X-Curse-Repository-ID: wow/tradeskillmaster_auctiondb/mainline

6
TradeSkillMaster_Auctioning/modules/Options.lua

@ -548,7 +548,7 @@ function Options:DrawOperationPost(container, operationName)
type = "EditBox",
label = L["Minimum Price"],
settingInfo = { operation, "minPrice" },
relativeWidth = 0.49,
relativeWidth = 1,
acceptCustom = true,
disabled = operation.relationships.minPrice,
tooltip = L["The lowest price you want an item to be posted for. Auctioning will not undercut auctions below this price."],
@ -566,7 +566,7 @@ function Options:DrawOperationPost(container, operationName)
type = "EditBox",
label = L["Maximum Price"],
settingInfo = { operation, "maxPrice" },
relativeWidth = 0.49,
relativeWidth = 1,
acceptCustom = true,
disabled = operation.relationships.maxPrice,
tooltip = L["The maximum price you want an item to be posted for. Auctioning will not undercut auctions above this price."],
@ -584,7 +584,7 @@ function Options:DrawOperationPost(container, operationName)
type = "EditBox",
label = L["Normal Price"],
settingInfo = { operation, "normalPrice" },
relativeWidth = 0.49,
relativeWidth = 1,
acceptCustom = true,
disabled = operation.relationships.normalPrice,
tooltip = L["Price to post at if there are none of an item currently on the AH."],

21
TradeSkillMaster_Crafting/Modules/CraftingGUI.lua

@ -17,6 +17,17 @@ private.gather = {}
private.shown = {}
private.eventObj = nil
local function IsCrafterPlayer(crafter)
if not crafter then return false end
local player = UnitName("player")
if not player then return false end
if strlower(crafter) == strlower(player) then
return true
end
local baseName = strmatch(crafter, "^[^-]+")
return baseName and strlower(baseName) == strlower(player) or false
end
-- list of profession skills that do not have crafting. used by UpdateTradeSkills
local invalidTrade = {
["Herbalism"] = true,
@ -2816,9 +2827,9 @@ function GUI:UpdateGathering()
local crafterMail = TSMAPI:ModuleAPI("ItemTracker", "playermail", crafter) or {}
for itemString, quantity in pairs(neededMats) do
local need = quantity - (crafterBags[itemString] or 0)
if UnitName("player") ~= crafter then
need = need - (crafterMail[itemString] or 0)
end
if not IsCrafterPlayer(crafter) then
need = need - (crafterMail[itemString] or 0)
end
if need > 0 then
if next(sources) then
for _, source in ipairs(sources) do
@ -2836,7 +2847,7 @@ function GUI:UpdateGathering()
end
if task.taskType == L["Mail Items"] or task.taskType == L["Collect Mail"] then
availQty = min(need, taskQuantity)
elseif not crafter == UnitName("player") then
elseif not IsCrafterPlayer(crafter) then
availQty = min(need, taskQuantity) - (playerBags[itemString] or 0)
else
availQty = min(need, taskQuantity) -- (crafterBags[itemString] or 0)
@ -2922,7 +2933,7 @@ function GUI:GatheringEventHandler(event)
elseif event == "MAIL_SHOW" then
private.currentSource = UnitName("player")
local crafter = TSM.db.realm.gathering.crafter
if crafter and crafter == UnitName("player") then
if IsCrafterPlayer(crafter) then
private.currentTask = L["Collect Mail"]
else
private.currentTask = L["Mail Items"]

34
TradeSkillMaster_Crafting/Modules/Gather.lua

@ -14,15 +14,32 @@ local L = LibStub("AceLocale-3.0"):GetLocale("TradeSkillMaster_Crafting") -- loa
local next = next
local private = { shoppingItems = {} }
local function IsCrafterPlayer(crafter)
if not crafter then return false end
local player = UnitName("player")
if not player then return false end
if strlower(crafter) == strlower(player) then
return true
end
local baseName = strmatch(crafter, "^[^-]+")
return baseName and strlower(baseName) == strlower(player) or false
end
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
@ -31,12 +48,13 @@ end
function Gather:gatherItems(source, task)
local items = TSM.db.realm.gathering.availableMats
local crafter = TSM.db.realm.gathering.crafter
if source == L["Vendor"] then
Gather:BuyFromMerchant(items)
elseif source == UnitName("player") and (task == L["Visit Bank"] or task == L["Visit Guild Bank"]) then
Gather:GatherBank(items)
elseif source == UnitName("player") and task == L["Collect Mail"] then
elseif source == UnitName("player") and (task == L["Collect Mail"] or (task == L["Mail Items"] and IsCrafterPlayer(crafter))) then
TSMAPI:ModuleAPI("Mailing", "collectItems", items, Gather.PrintMsg)
elseif source == UnitName("player") and task == L["Mail Items"] then
Gather:MailItems(items)
@ -168,23 +186,23 @@ function Gather:ShoppingSearch(itemString, need, ignoreMaxQty)
TSMAPI:ModuleAPI("Shopping", "runDestroySearch", TSMAPI:GetSafeItemInfo(itemString) .. "/x" .. need, ShoppingCallback)
end
else
TSMAPI:ModuleAPI("Shopping", "runSearch", TSMAPI:GetSafeItemInfo(itemString) .. "/exact/x" .. need, ShoppingCallback)
TSMAPI:ModuleAPI("Shopping", "runSearch", TSMAPI:GetSafeItemInfo(itemString) .. "/exact/x" .. need, ShoppingCallback, true)
end
else
TSM.Inventory.gatherItem = nil
if ignoreMaxQty then
TSMAPI:ModuleAPI("Shopping", "runSearch", TSMAPI:GetSafeItemInfo(itemString) .. "/exact", ShoppingCallback)
TSMAPI:ModuleAPI("Shopping", "runSearch", TSMAPI:GetSafeItemInfo(itemString) .. "/exact", ShoppingCallback, true)
else
TSMAPI:ModuleAPI("Shopping", "runSearch", TSMAPI:GetSafeItemInfo(itemString) .. "/exact/x" .. need, ShoppingCallback)
TSMAPI:ModuleAPI("Shopping", "runSearch", TSMAPI:GetSafeItemInfo(itemString) .. "/exact/x" .. need, ShoppingCallback, true)
end
end
else
TSM.Inventory.gatherItem = nil
if ignoreMaxQty then
TSMAPI:ModuleAPI("Shopping", "runSearch", TSMAPI:GetSafeItemInfo(itemString) .. "/exact", ShoppingCallback)
TSMAPI:ModuleAPI("Shopping", "runSearch", TSMAPI:GetSafeItemInfo(itemString) .. "/exact", ShoppingCallback, true)
else
TSMAPI:ModuleAPI("Shopping", "runSearch", TSMAPI:GetSafeItemInfo(itemString) .. "/exact/x" .. need, ShoppingCallback)
TSMAPI:ModuleAPI("Shopping", "runSearch", TSMAPI:GetSafeItemInfo(itemString) .. "/exact/x" .. need, ShoppingCallback, true)
end
end
end

36
TradeSkillMaster_Crafting/Modules/Inventory.lua

@ -110,6 +110,15 @@
return count
end
local function IsSamePlayer(a, b)
if not a or not b then return false end
local function Normalize(name)
local base = strmatch(name, "^[^-]+") or name
return strlower(base)
end
return Normalize(a) == Normalize(b)
end
function Inventory:GetItemSources(crafter, neededMats)
if not neededMats then return end
@ -161,7 +170,7 @@
-- add bags/bank/mail "tasks" for needed items of all non-ignored characters (always include crafter)
for _, player in pairs(TSMAPI:ModuleAPI("ItemTracker", "playerlist") or {}) do
if player == crafter or not TSM.db.global.ignoreCharacters[player] then
if IsSamePlayer(player, crafter) or not TSM.db.global.ignoreCharacters[player] then
local task = {}
local bags = TSMAPI:ModuleAPI("ItemTracker", "playerbags", player) or {}
local bank = TSMAPI:ModuleAPI("ItemTracker", "playerbank", player) or {}
@ -182,24 +191,21 @@
soulboundBagCount = GetItemCount(itemString)
soulboundBankCount = GetItemCount(itemString, true) - soulboundBagCount
end
if (bank[itemString] or (soulboundBankCount and soulboundBankCount > 0)) and shortItems[itemString] then
if shortItems[itemString] - (crafterMail[itemString] or 0) - (player ~= crafter and bags[itemString] or 0) > 0 then
bankItems[itemString] = bank[itemString] or soulboundBankCount
local remainingNeed = shortItems[itemString] and shortItems[itemString] - (crafterMail[itemString] or 0) or 0
if remainingNeed > 0 then
if (bank[itemString] or (soulboundBankCount and soulboundBankCount > 0)) then
bankItems[itemString] = min(bank[itemString] or soulboundBankCount, remainingNeed)
end
end
if gbank[itemString] and shortItems[itemString] then
if shortItems[itemString] - (crafterMail[itemString] or 0) - (player ~= crafter and bags[itemString] or 0) > 0 then
gbankItems[itemString] = gbank[itemString]
if gbank[itemString] then
gbankItems[itemString] = min(gbank[itemString], remainingNeed)
end
end
if mail[itemString] and shortItems[itemString] then
mailItems[itemString] = mail[itemString]
end
if bags[itemString] and shortItems[itemString] then
if player ~= crafter then
if shortItems[itemString] - (crafterMail[itemString] or 0) > 0 then
bagItems[itemString] = bags[itemString]
end
if bags[itemString] and shortItems[itemString] and not IsSamePlayer(player, crafter) then
if remainingNeed > 0 then
bagItems[itemString] = min(bags[itemString], remainingNeed)
end
end
end
@ -223,7 +229,7 @@
tinsert(task, { taskType = L["Mail Items"], items = bagItems })
end
if next(task) then
tinsert(sources, { sourceName = player, isCrafter = player == crafter, isVendor = false, isAH = false, tasks = task, isCurrent = (player == UnitName("player")) })
tinsert(sources, { sourceName = player, isCrafter = IsSamePlayer(player, crafter), isVendor = false, isAH = false, tasks = task, isCurrent = (player == UnitName("player")) })
end
end
end
@ -337,4 +343,4 @@
if itemString and not TSMAPI.DisenchantingData.notDisenchantable[itemString] and (iType == ARMOR or iType == WEAPON) then
return true
end
end
end

1
TradeSkillMaster_Shopping/TradeSkillMaster_Shopping.lua

@ -95,6 +95,7 @@ end
function TSM:StartFilterSearch(searchQuery, callback)
if not TSMAPI:AHTabIsVisible("Shopping") then return end
TSM.Search:StartFilterSearch(searchQuery, nil, true)
TSM.shoppingGroupSearchActive = nil
TSM.moduleAPICallback = callback
end

4
TradeSkillMaster_Shopping/modules/Destroying.lua

@ -62,7 +62,9 @@ function Destroying:StartDestroyingSearch(target, filter, isCrafting)
if not private.sources[target] then return TSM:Printf(L["Invalid destroy target: '%s'"], target) end
TSM.isCrafting = isCrafting
TSM.shoppingGroupSearchActive = nil
Destroying.maxQuantity = filter.maxQuantity
filter.maxQuantity = nil
filter.maxPrice = nil
if private.sources[target] == "mill" then
private:TryStarting(private.StartMillingSearch, target, filter)
@ -271,4 +273,4 @@ function private.ScanCallback(event, ...)
elseif event == "done" then
TSM.Search:SetSearchBarDisabled(false)
end
end
end

3
TradeSkillMaster_Shopping/modules/Search.lua

@ -325,6 +325,7 @@ end
function Search:StartFilterSearch(filter, callback, isCrafting)
TSM.isCrafting = isCrafting
TSM.searchCallback = callback
TSM.shoppingGroupSearchActive = nil
if strfind(filter, "item:([0-9]+):?([0-9]*):?([0-9]*):?([0-9]*):?([0-9]*):?([0-9]*):?%-?([0-9]*)$") then --or strfind(filter, "battlepet:([0-9]+):?([0-9]*):?([0-9]*):?([0-9]*):?([0-9]*):?([0-9]*):?([0-9]*)$") then
filter = TSMAPI:GetSafeItemInfo(filter) or filter
end
@ -524,7 +525,7 @@ local function GetSearchFilterOptions(searchTerm)
minILevel = oldMaxILevel
end
return true, queryString or "", class or 0, subClass or 0, minLevel or 0, maxLevel or 0, minILevel or 0, maxILevel or 0, rarity or -1, usableOnly or 0, exactOnly or nil, evenOnly or nil, maxQuantity or 0, maxPrice
return true, queryString or "", class or 0, subClass or 0, minLevel or 0, maxLevel or 0, minILevel or 0, maxILevel or 0, rarity or -1, usableOnly or 0, exactOnly or nil, evenOnly or nil, maxQuantity, maxPrice
--return true, queryString or "", class or 0, subClass or 0, minLevel or 0, maxLevel or 0, minILevel or 0, maxILevel or 0, rarity or 0, usableOnly or 0, exactOnly or nil, evenOnly or nil, maxQuantity or 0, maxPrice
end

6
TradeSkillMaster_Shopping/modules/Util.lua

@ -151,6 +151,7 @@ function Util:HideSearchFrame(forceStop)
TSMAPI.AuctionScan:ClearCache()
TSM.searchCallback = nil
TSM.groupBuyoutCheck = nil
TSM.shoppingGroupSearchActive = nil
end
@ -199,6 +200,9 @@ function private:PrepareForScan(callback, isLastPageScan)
private.isLastPageScan = isLastPageScan
private.callback = callback
wipe(private.auctions)
if not isLastPageScan and not TSM.shoppingGroupSearchActive then
TSM.groupBuyoutCheck = nil
end
if private.isLastPageScan then
private.searchFrame.statusBar:SetStatusText("Scanning last page...")
else
@ -466,7 +470,7 @@ function private:RemoveAuction(auction, event, itemString)
-- handle max quantities on queries
local query = private.auctions[itemString].query
if event == "OnBuyout" and query then
if private.mode == "normal" and (query.maxQuantity or 0) > 0 then
if private.mode == "normal" and query.maxQuantity and query.maxQuantity > 0 then
query.maxQuantity = query.maxQuantity - auction.count
if TSM.moduleAPICallback then TSM.moduleAPICallback(max(query.maxQuantity, 0), itemString, auction.count) end
for item, auctionItem in pairs(private.auctions) do

1
TradeSkillMaster_Shopping/sidebar/Groups.lua

@ -122,6 +122,7 @@ end
function private.StartScan()
TSMAPI:FireEvent("SHOPPING:GROUPS:STARTSCAN")
TSM.shoppingGroupSearchActive = true
wipe(private.itemOperations)
wipe(private.purchasedCounts)
TSM.searchCallback = function(event, auction)

Loading…
Cancel
Save