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. 20
      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.loopError(origStr)
end
TSM_PRICE_TEMP.num = TSM_PRICE_TEMP.num - 1
if isTop then
TSM_PRICE_TEMP.num = nil
end
return
end
local function isNAN(num)
@ -515,7 +519,9 @@ function TSMAPI:ParseCustomPrice(priceString, badPriceSource)
end
local function safeFunc(itemString)
local prevNum = TSM_PRICE_TEMP.num
local success, value = pcall(func, itemString)
TSM_PRICE_TEMP.num = prevNum
if success then
return value
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,
-- 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()
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 not skipMinBuyoutWipe then
if groupItems then
-- A list of items ("group scan") was provided. Wipe data for those items.
for itemString in pairs(groupItems) do
local itemID = TSMAPI:GetItemID(itemString)
if TSM.data[itemID] then -- If we have existing data for this item.
-- For group scans, only wipe items that are present in the incoming
-- payload. This avoids clearing data for timed out / missing queries.
for itemID in pairs(scanData) do
if TSM.data[itemID] then
TSM:DecodeItemData(itemID)
TSM.data[itemID].minBuyout = nil -- Erase its stored minBuyout value.
TSM.data[itemID].minBuyout = nil
TSM:EncodeItemData(itemID)
end
end

20
TradeSkillMaster_Auctioning/modules/PostScan.lua

@ -156,8 +156,11 @@ function Post:ProcessItem(itemString)
if toPost then
local bid
bid, buyout, reason = Post:GetPostPrice(itemString, operation)
if not bid or not buyout then
toPost = nil
reason = reason or "invalid"
else
local postTime = (operation.duration == 48 and 3) or (operation.duration == 24 and 2) or 1
for i = 1, #toPost do
local stackSize, numStacks = unpack(toPost[i])
@ -167,6 +170,7 @@ function Post:ProcessItem(itemString)
tinsert(data, { numStacks = numStacks, stackSize = stackSize, buyout = buyout, postTime = postTime })
end
end
end
TSM.Log:AddLogRecord(itemString, "post", (toPost and L["Post"] or L["Skip"]), reason, operation, buyout)
if #postQueue > 0 and not currentItem.bag then
@ -203,6 +207,9 @@ function Post:ShouldPost(itemString, operation, numInBags)
end
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
-- lowest is below min price
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 bid, buyout, info
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
-- No other auctions up, default to normalPrice
info = "postingNormal"
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
if operation.priceReset == "minPrice" then
info = "postingResetMin"
@ -270,10 +280,14 @@ function Post:GetPostPrice(itemString, operation)
error("Unknown 'below minimum' price setting.")
end
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
bid, buyout = min(lowestBid, lowestBuyout), lowestBuyout
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
-- we've been undercut and we are going to undercut back
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 .. ")")
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 profitPercText = format("%s%.0f%%|r", color, profitPercent)
profitPercText = format("%s%.0f%%|r", color, profitPercent)
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 moneyCoinsTooltip then
GameTooltip:AddLine("Profit: " .. (TSMAPI:FormatTextMoneyIcon(data.profit, color) or "---") .. " (" .. (profitPercText or "---") .. ")")

Loading…
Cancel
Save