📄 aucfilter.lua
字号:
local snap = Auctioneer.Core.GetSnapshot(auctKey, itemCat, signature); if (snap) then if (tonumber(snap.quality) >= tonumber(minQuality)) then local timeLeft = tonumber(snap.timeLeft); local elapsedTime = time() - tonumber(snap.lastSeenTime); local secondsLeft = Auctioneer.Core.Constants.TimeLeft.Seconds[timeLeft] - elapsedTime; if (secondsLeft > 0) then filterAuction = false; end end end end end return filterAuction;end--[[ generic function for querying the snapshot with a filter function that returns true if an auction should be filtered out of the result set. @return (array) all items in the current snapshot which are not filtered out by the given filter. Each entry of the array contains: {snapshotdata, (see Auctioneer.Core.GetSnapshotFromData for details) [signature] (snapshot signature) } If there are no matching entries in the snapshot, the function returns an empty array.]]function querySnapshot(filter, param, e1,e2,e3,e4,e5) local queryResults = {}; param = param or ""; local a; local auctKey = Auctioneer.Util.GetAuctionKey(); if (AuctionConfig and AuctionConfig.snap and AuctionConfig.snap[auctKey]) then for itemCat, iData in pairs(AuctionConfig.snap[auctKey]) do for auctionSignature, data in pairs(iData) do if (not filter(param, auctionSignature, e1,e2,e3,e4,e5)) then a = Auctioneer.Core.GetSnapshotFromData(data); a.signature = auctionSignature; table.insert(queryResults, a); end end end end return queryResults;end-- builds the list of auctions that can be bought and resold for profitfunction doBroker(minProfit) if not minProfit or minProfit == "" then minProfit = Auctioneer.Core.Constants.MinProfitMargin elseif (tonumber(minProfit)) then minProfit = tonumber(minProfit) * 100 else Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtActUnknown'), minProfit)) return end local output = string.format(_AUCT('FrmtBrokerHeader'), EnhTooltip.GetTextGSC(minProfit)); Auctioneer.Util.ChatPrint(output); local resellableAuctions = querySnapshot(brokerFilter, minProfit); -- sort by profit decending table.sort(resellableAuctions, Auctioneer.Statistic.ProfitComparisonSort); -- output the list of auctions local id,rprop,enchant,name,count,min,buyout,uniq,itemKey,hsp,seenCount,profit,output; if (resellableAuctions) then for pos,a in pairs(resellableAuctions) do id,rprop,enchant, name, count,min,buyout,uniq = Auctioneer.Core.GetItemSignature(a.signature); itemKey = id .. ":" .. rprop..":"..enchant; hsp, seenCount = Auctioneer.Statistic.GetHSP(itemKey, Auctioneer.Util.GetAuctionKey()); profit = (hsp * count) - buyout; output = string.format(_AUCT('FrmtBrokerLine'), Auctioneer.Util.ColorTextWhite(count.."x")..a.itemLink, seenCount, EnhTooltip.GetTextGSC(hsp * count), EnhTooltip.GetTextGSC(buyout), EnhTooltip.GetTextGSC(profit)); Auctioneer.Util.ChatPrint(output); end end Auctioneer.Util.ChatPrint(_AUCT('FrmtBrokerDone'));end-- builds the list of auctions that can be bought and resold for profitfunction doBidBroker(minProfit) if not minProfit or minProfit == "" then minProfit = Auctioneer.Core.Constants.MinProfitMargin elseif (tonumber(minProfit)) then minProfit = tonumber(minProfit) * 100 else Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtActUnknown'), minProfit)) return end local output = string.format(_AUCT('FrmtBidbrokerHeader'), EnhTooltip.GetTextGSC(minProfit)); Auctioneer.Util.ChatPrint(output); local bidWorthyAuctions = querySnapshot(bidBrokerFilter, minProfit, Auctioneer.Core.Constants.TimeLeft.Seconds[Auctioneer.Core.Constants.TimeLeft.Medium]); table.sort(bidWorthyAuctions, function(a, b) return (a.timeLeft < b.timeLeft) end); -- output the list of auctions local id,rprop,enchant, name, count,min,buyout,uniq,itemKey,hsp,seenCount,currentBid,profit,bidText,output; if (bidWorthyAuctions) then for pos,a in pairs(bidWorthyAuctions) do id,rprop,enchant, name, count,min,buyout,uniq = Auctioneer.Core.GetItemSignature(a.signature); itemKey = id .. ":" .. rprop..":"..enchant; hsp, seenCount = Auctioneer.Statistic.GetHSP(itemKey, Auctioneer.Util.GetAuctionKey()); currentBid = Auctioneer.Statistic.GetCurrentBid(a.signature); profit = (hsp * count) - currentBid; bidText = _AUCT('FrmtBidbrokerCurbid'); if (currentBid == min) then bidText = _AUCT('FrmtBidbrokerMinbid'); end EnhTooltip.DebugPrint("a", a); -- local secondsLeft = Auctioneer.Core.Constants.TimeLeft.Seconds[a.timeLeft] + a.lastSeenTime - time() output = string.format(_AUCT('FrmtBidbrokerLine'), Auctioneer.Util.ColorTextWhite(count.."x")..a.itemLink, seenCount, EnhTooltip.GetTextGSC(hsp * count), bidText, EnhTooltip.GetTextGSC(currentBid), EnhTooltip.GetTextGSC(profit), Auctioneer.Util.ColorTextWhite(Auctioneer.Util.GetTimeLeftString(a.timeLeft))); Auctioneer.Util.ChatPrint(output); end end Auctioneer.Util.ChatPrint(_AUCT('FrmtBidbrokerDone'));endfunction doCompeting(minLess) if not minLess or minLess == "" then minLess = Auctioneer.Core.Constants.DefaultCompeteLess * 100 elseif (tonumber(minLess)) then minLess = tonumber(minLess) * 100 else Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtActUnknown'), minLess)) return end local output = string.format(_AUCT('FrmtCompeteHeader'), EnhTooltip.GetTextGSC(minLess)); Auctioneer.Util.ChatPrint(output); local myAuctions = querySnapshot(auctionOwnerFilter, UnitName("player")); local myHighestPrices = {} local id,rprop,enchant,name,count,min,buyout,uniq,itemKey,competingAuctions,currentBid,buyoutForOne,bidForOne,bidPrice,myBuyout,buyPrice,myPrice,priceLess,lessPrice,output; if (myAuctions) then for pos,a in pairs(myAuctions) do id,rprop,enchant, name, count,min,buyout,uniq = Auctioneer.Core.GetItemSignature(a.signature); if (count > 1) then buyout = buyout/count; end itemKey = id .. ":" .. rprop..":"..enchant; if (not myHighestPrices[itemKey]) or (myHighestPrices[itemKey] < buyout) then myHighestPrices[itemKey] = buyout; end end end competingAuctions = querySnapshot(competingFilter, minLess, myHighestPrices); table.sort(competingAuctions, Auctioneer.Statistic.ProfitComparisonSort); -- output the list of auctions if (competingAuctions) then for pos,a in pairs(competingAuctions) do id,rprop,enchant, name, count,min,buyout,uniq = Auctioneer.Core.GetItemSignature(a.signature); itemKey = id .. ":" .. rprop..":"..enchant; currentBid = Auctioneer.Statistic.GetCurrentBid(a.signature); buyoutForOne = buyout; bidForOne = currentBid; if (count > 1) then buyoutForOne = buyout/count; bidForOne = currentBid/count; end bidPrice = EnhTooltip.GetTextGSC(bidForOne).."ea"; if (currentBid == min) then bidPrice = "No bids ("..bidPrice..")"; end myBuyout = myHighestPrices[itemKey]; buyPrice = EnhTooltip.GetTextGSC(buyoutForOne).."ea"; myPrice = EnhTooltip.GetTextGSC(myBuyout).."ea"; priceLess = myBuyout - buyoutForOne; lessPrice = EnhTooltip.GetTextGSC(priceLess); output = string.format(_AUCT('FrmtCompeteLine'), Auctioneer.Util.ColorTextWhite(count.."x")..a.itemLink, bidPrice, buyPrice, myPrice, lessPrice); Auctioneer.Util.ChatPrint(output); end end Auctioneer.Util.ChatPrint(_AUCT('FrmtCompeteDone'));end-- builds the list of auctions that can be bought and resold for profitfunction doPercentLess(percentLess) if not percentLess or percentLess == "" then percentLess = Auctioneer.Core.Constants.MinPercentLessThanHSP end local output = string.format(_AUCT('FrmtPctlessHeader'), percentLess); Auctioneer.Util.ChatPrint(output); local auctionsBelowHSP = querySnapshot(percentLessFilter, percentLess); -- sort by profit based on median table.sort(auctionsBelowHSP, Auctioneer.Statistic.ProfitComparisonSort); -- output the list of auctions local id,rprop,enchant,name,count,buyout,itemKey,hsp,seenCount,profit,output,x; if (auctionsBelowHSP) then for pos,a in pairs(auctionsBelowHSP) do id,rprop,enchant, name, count,x,buyout,x = Auctioneer.Core.GetItemSignature(a.signature); itemKey = id ..":"..rprop..":"..enchant; hsp, seenCount = Auctioneer.Statistic.GetHSP(itemKey, Auctioneer.Util.GetAuctionKey()); profit = (hsp * count) - buyout; output = string.format(_AUCT('FrmtPctlessLine'), Auctioneer.Util.ColorTextWhite(count.."x")..a.itemLink, seenCount, EnhTooltip.GetTextGSC(hsp * count), EnhTooltip.GetTextGSC(buyout), EnhTooltip.GetTextGSC(profit), Auctioneer.Util.ColorTextWhite(Auctioneer.Statistic.PercentLessThan(hsp, buyout / count).."%")); Auctioneer.Util.ChatPrint(output); end end Auctioneer.Util.ChatPrint(_AUCT('FrmtPctlessDone'));end-- Auctioneer.Filter.Auctioneer.Filter = { BrokerFilter = brokerFilter, BidBrokerFilter = bidBrokerFilter, AuctionOwnerFilter = auctionOwnerFilter, CompetingFilter = competingFilter, PercentLessFilter = percentLessFilter, PlainFilter = plainFilter, QuerySnapshot = querySnapshot, DoBroker = doBroker, DoBidBroker = doBidBroker, DoCompeting = doCompeting, DoPercentLess = doPercentLess,}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -