Browse Source

fixes rart

dev
Jørgen Lien Sellæg 3 months ago
parent
commit
2e4092c0af
  1. 6
      TradeSkillMaster/Core/Prices.lua
  2. 2
      TradeSkillMaster_AuctionDB/Modules/Scanning.lua
  3. 10
      TradeSkillMaster_AuctionDB/Modules/data.lua
  4. 36
      TradeSkillMaster_Auctioning/modules/PostScan.lua
  5. 9
      TradeSkillMaster_Crafting/Modules/CraftingGUI.lua

6
TradeSkillMaster/Core/Prices.lua

@ -350,6 +350,10 @@ local function ParsePriceString(str, badPriceSource)
TSM_PRICE_TEMP.lastPrint = time() TSM_PRICE_TEMP.lastPrint = time()
TSM_PRICE_TEMP.loopError(origStr) TSM_PRICE_TEMP.loopError(origStr)
end end
TSM_PRICE_TEMP.num = TSM_PRICE_TEMP.num - 1
if isTop then
TSM_PRICE_TEMP.num = nil
end
return return
end end
local function isNAN(num) local function isNAN(num)
@ -515,7 +519,9 @@ function TSMAPI:ParseCustomPrice(priceString, badPriceSource)
end end
local function safeFunc(itemString) local function safeFunc(itemString)
local prevNum = TSM_PRICE_TEMP.num
local success, value = pcall(func, itemString) local success, value = pcall(func, itemString)
TSM_PRICE_TEMP.num = prevNum
if success then if success then
return value return value
end end

2
TradeSkillMaster_AuctionDB/Modules/Scanning.lua

@ -348,7 +348,7 @@ function Scan:ProcessScanData(scanData)
-- Mark the collected auction data as a new "complete scan" with today's date, -- Mark the collected auction data as a new "complete scan" with today's date,
-- but only if this was a normal "Full Scan" (not just a "TSM item group" scan). -- but only if this was a normal "Full Scan" (not just a "TSM item group" scan).
if Scan.isScanning ~= "group" then if Scan.isScanning ~= "Group" then
TSM.db.realm.lastCompleteScan = time() TSM.db.realm.lastCompleteScan = time()
end end

10
TradeSkillMaster_AuctionDB/Modules/data.lua

@ -197,12 +197,12 @@ function Data:ProcessData(scanData, groupItems, verifyNewAlgorithm, scanTime, sk
-- if there wasn't any "minBuyout" data for that item in the newest data batch. -- if there wasn't any "minBuyout" data for that item in the newest data batch.
if not skipMinBuyoutWipe then if not skipMinBuyoutWipe then
if groupItems then if groupItems then
-- A list of items ("group scan") was provided. Wipe data for those items. -- For group scans, only wipe items that are present in the incoming
for itemString in pairs(groupItems) do -- payload. This avoids clearing data for timed out / missing queries.
local itemID = TSMAPI:GetItemID(itemString) for itemID in pairs(scanData) do
if TSM.data[itemID] then -- If we have existing data for this item. if TSM.data[itemID] then
TSM:DecodeItemData(itemID) TSM:DecodeItemData(itemID)
TSM.data[itemID].minBuyout = nil -- Erase its stored minBuyout value. TSM.data[itemID].minBuyout = nil
TSM:EncodeItemData(itemID) TSM:EncodeItemData(itemID)
end end
end end

36
TradeSkillMaster_Auctioning/modules/PostScan.lua

@ -156,15 +156,19 @@ function Post:ProcessItem(itemString)
if toPost then if toPost then
local bid local bid
bid, buyout, reason = Post:GetPostPrice(itemString, operation) bid, buyout, reason = Post:GetPostPrice(itemString, operation)
local postTime = (operation.duration == 48 and 3) or (operation.duration == 24 and 2) or 1 if not bid or not buyout then
toPost = nil
for i = 1, #toPost do reason = reason or "invalid"
local stackSize, numStacks = unpack(toPost[i]) else
local postTime = (operation.duration == 48 and 3) or (operation.duration == 24 and 2) or 1
-- Increase the bid/buyout based on how many items we're posting for i = 1, #toPost do
local stackBid, stackBuyout = floor(bid * stackSize), floor(buyout * stackSize) local stackSize, numStacks = unpack(toPost[i])
Post:QueueItemToPost(itemString, numStacks, stackSize, stackBid, stackBuyout, postTime, operation)
tinsert(data, { numStacks = numStacks, stackSize = stackSize, buyout = buyout, postTime = postTime }) -- Increase the bid/buyout based on how many items we're posting
local stackBid, stackBuyout = floor(bid * stackSize), floor(buyout * stackSize)
Post:QueueItemToPost(itemString, numStacks, stackSize, stackBid, stackBuyout, postTime, operation)
tinsert(data, { numStacks = numStacks, stackSize = stackSize, buyout = buyout, postTime = postTime })
end
end end
end end
@ -203,6 +207,9 @@ function Post:ShouldPost(itemString, operation, numInBags)
end end
local prices = TSM.Util:GetItemPrices(operation, itemString) local prices = TSM.Util:GetItemPrices(operation, itemString)
if not prices.minPrice or not prices.maxPrice or not prices.normalPrice or not prices.undercut then
return nil, "invalid", numInBags
end
if buyout and buyout <= prices.minPrice then if buyout and buyout <= prices.minPrice then
-- lowest is below min price -- lowest is below min price
if not prices.resetPrice then if not prices.resetPrice then
@ -253,11 +260,14 @@ function Post:GetPostPrice(itemString, operation)
local lowestBuyout, lowestBid, lowestOwner, isWhitelist, isPlayer = TSM.Scan:GetLowestAuction(itemString, operation) local lowestBuyout, lowestBid, lowestOwner, isWhitelist, isPlayer = TSM.Scan:GetLowestAuction(itemString, operation)
local bid, buyout, info local bid, buyout, info
local prices = TSM.Util:GetItemPrices(operation, itemString) local prices = TSM.Util:GetItemPrices(operation, itemString)
if not prices.minPrice or not prices.maxPrice or not prices.normalPrice or not prices.undercut then
return nil, nil, "invalid"
end
if not lowestOwner then if not lowestOwner then
-- No other auctions up, default to normalPrice -- No other auctions up, default to normalPrice
info = "postingNormal" info = "postingNormal"
buyout = prices.normalPrice buyout = prices.normalPrice
elseif prices.resetPrice and lowestBuyout <= prices.minPrice then elseif prices.resetPrice and lowestBuyout and lowestBuyout <= prices.minPrice then
-- item is below min price and a priceReset is set -- item is below min price and a priceReset is set
if operation.priceReset == "minPrice" then if operation.priceReset == "minPrice" then
info = "postingResetMin" info = "postingResetMin"
@ -270,10 +280,14 @@ function Post:GetPostPrice(itemString, operation)
error("Unknown 'below minimum' price setting.") error("Unknown 'below minimum' price setting.")
end end
buyout = prices.resetPrice buyout = prices.resetPrice
elseif isPlayer or (isWhitelist and lowestBuyout - prices.undercut <= prices.maxPrice) then elseif isPlayer or (isWhitelist and lowestBuyout and lowestBuyout - prices.undercut <= prices.maxPrice) then
-- Either we already have one up or someone on the whitelist does -- Either we already have one up or someone on the whitelist does
bid, buyout = min(lowestBid, lowestBuyout), lowestBuyout bid, buyout = min(lowestBid, lowestBuyout), lowestBuyout
info = isPlayer and "postingPlayer" or "postingWhitelist" info = isPlayer and "postingPlayer" or "postingWhitelist"
elseif not lowestBuyout then
-- We have an owner record but no valid buyout; treat as no reliable floor.
info = "postingNormal"
buyout = prices.normalPrice
else else
-- we've been undercut and we are going to undercut back -- we've been undercut and we are going to undercut back
buyout = lowestBuyout - prices.undercut buyout = lowestBuyout - prices.undercut

9
TradeSkillMaster_Crafting/Modules/CraftingGUI.lua

@ -579,11 +579,14 @@ function GUI:CreateQueueFrame(parent)
GameTooltip:AddLine(TSM.db.realm.crafts[data.spellID].name .. " (x" .. data.numQueued .. ")") GameTooltip:AddLine(TSM.db.realm.crafts[data.spellID].name .. " (x" .. data.numQueued .. ")")
local cost = TSM.Cost:GetCraftPrices(data.spellID) local cost = TSM.Cost:GetCraftPrices(data.spellID)
if data.profit then local profitPercText, profitPercTextM = "---", "---"
if data.profit and cost and cost > 0 then
local profitPercent = data.profit / cost * 100 local profitPercent = data.profit / cost * 100
local profitPercText = format("%s%.0f%%|r", color, profitPercent) profitPercText = format("%s%.0f%%|r", color, profitPercent)
local profitPercentM = data.profit / cost * data.numQueued * 100 local profitPercentM = data.profit / cost * data.numQueued * 100
local profitPercTextM = format("%s%.0f%%|r", color, profitPercentM) profitPercTextM = format("%s%.0f%%|r", color, profitPercentM)
end
if data.profit then
if data.profit>0 then if data.profit>0 then
if moneyCoinsTooltip then if moneyCoinsTooltip then
GameTooltip:AddLine("Profit: " .. (TSMAPI:FormatTextMoneyIcon(data.profit, color) or "---") .. " (" .. (profitPercText or "---") .. ")") GameTooltip:AddLine("Profit: " .. (TSMAPI:FormatTextMoneyIcon(data.profit, color) or "---") .. " (" .. (profitPercText or "---") .. ")")

Loading…
Cancel
Save