📄 aucscanner.lua
字号:
end -- Update the tab count. PanelTemplates_SetNumTabs(AuctionFrame, tabCount)endfunction auctionFrameFiltersUpdateClasses() --Auctioneer_AuctionFrameFilters_UpdateClasses local obj for i=1, 15 do obj = getglobal("AuctionFilterButton"..i.."Checkbox") if (obj) then obj:SetParent("AuctionFilterButton"..i) obj:SetPoint("RIGHT", "AuctionFilterButton"..i, "RIGHT", -5,0) end endendfunction rememberPrice() if (not Auctioneer_CurAuctionItem) then AuctPriceRememberCheck:SetChecked(false) return end if (not AuctPriceRememberCheck:GetChecked()) then Auctioneer.Storage.DeleteFixedPrice(Auctioneer_CurAuctionItem) else local count = Auctioneer_CurAuctionCount local start = MoneyInputFrame_GetCopper(StartPrice) local buy = MoneyInputFrame_GetCopper(BuyoutPrice) local dur = AuctionFrameAuctions.duration Auctioneer.Storage.SetFixedPrice(Auctioneer_CurAuctionItem, start, buy, dur, count) endendfunction auctionsClear() --Auctioneer_Auctions_Clear for i = 1, 5 do getglobal("AuctionInfoText"..i):Hide(); getglobal("AuctionInfoMoney"..i):Hide(); end AuctionInfoWarnText:Hide();endfunction auctionsSetWarn(textStr) --Auctioneer_Auctions_SetWarn if (AuctionInfoWarnText == nil) then EnhTooltip.DebugPrint("Error, no text for AuctionInfo line "..line); end local cHex, cRed, cGreen, cBlue = Auctioneer.Util.GetWarnColor(textStr) AuctionInfoWarnText:SetText(textStr); AuctionInfoWarnText:SetTextColor(cRed, cGreen, cBlue); AuctionInfoWarnText:Show();endfunction auctionsSetLine(line, textStr, moneyAmount) --Auctioneer_Auctions_SetLine local text = getglobal("AuctionInfoText"..line); local money = getglobal("AuctionInfoMoney"..line); if (text == nil) then EnhTooltip.DebugPrint("Error, no text for AuctionInfo line "..line); end if (money == nil) then EnhTooltip.DebugPrint("Error, no money for AuctionInfo line "..line); end text:SetText(textStr); text:Show(); if (money ~= nil) then MoneyFrame_Update("AuctionInfoMoney"..line, math.ceil(Auctioneer.Util.NullSafe(moneyAmount))); getglobal("AuctionInfoMoney"..line.."SilverButtonText"):SetTextColor(1.0,1.0,1.0); getglobal("AuctionInfoMoney"..line.."CopperButtonText"):SetTextColor(0.86,0.42,0.19); money:Show(); else money:Hide(); endendfunction newAuction() local name, texture, count, quality, canUse, price = GetAuctionSellItemInfo() local countFix = count if countFix == 0 then countFix = 1 end if (not name) then Auctioneer.Scanner.AuctionsClear() return end local bag, slot, id, rprop, enchant, uniq = EnhTooltip.FindItemInBags(name); if (bag == nil) then -- is the item one of your bags? local i for i = 0, 4, 1 do if name == GetBagName(i) then id, rprop, enchant, uniq = breakLink(GetInventoryItemLink("player", ContainerIDToInventoryID(i))) break end end end -- still no corresponding item found? if id == nil then Auctioneer.Scanner.AuctionsClear() return end local startPrice, buyoutPrice, x; local itemKey = id..":"..rprop..":"..enchant; Auctioneer_CurAuctionItem = itemKey; Auctioneer_CurAuctionCount = countFix; local auctionPriceItem = Auctioneer.Core.GetAuctionPriceItem(itemKey); local aCount,minCount,minPrice,bidCount,bidPrice,buyCount,buyPrice = Auctioneer.Core.GetAuctionPrices(auctionPriceItem.data); if (Auctioneer.Storage.GetFixedPrice(itemKey)) then AuctPriceRememberCheck:SetChecked(true) else AuctPriceRememberCheck:SetChecked(false) end -- Find the current lowest buyout for 1 of these in the current snapshot local currentLowestBuyout = Auctioneer.Statistic.FindLowestAuctions(itemKey); if currentLowestBuyout then x,x,x,x,lowStackCount,x,currentLowestBuyout = Auctioneer.Core.GetItemSignature(currentLowestBuyout); currentLowestBuyout = currentLowestBuyout / lowStackCount; end local historicalMedian, historicalMedCount = Auctioneer.Statistic.GetItemHistoricalMedianBuyout(itemKey); local snapshotMedian, snapshotMedCount = Auctioneer.Statistic.GetItemSnapshotMedianBuyout(itemKey); auctionsClear(); Auctioneer.Scanner.AuctionsSetLine(1, string.format(_AUCT('FrmtAuctinfoHist'), historicalMedCount), historicalMedian * count); Auctioneer.Scanner.AuctionsSetLine(2, string.format(_AUCT('FrmtAuctinfoSnap'), snapshotMedCount), snapshotMedian * count); if (snapshotMedCount and snapshotMedCount > 0 and currentLowestBuyout) then Auctioneer.Scanner.AuctionsSetLine(3, _AUCT('FrmtAuctinfoLow'), currentLowestBuyout * count); else Auctioneer.Scanner.AuctionsSetLine(3, _AUCT('FrmtAuctinfoNolow')); end local blizPrice = MoneyInputFrame_GetCopper(StartPrice); local hsp, hspCount, mktPrice, warn = Auctioneer.Statistic.GetHSP(itemKey, Auctioneer.Util.GetAuctionKey()); if hsp == 0 and buyCount > 0 then hsp = math.ceil(buyPrice / buyCount); -- use mean buyout if median not available end local discountBidPercent = tonumber(Auctioneer.Command.GetFilterVal('pct-bidmarkdown')); local buyPrice = Auctioneer.Statistic.RoundDownTo95(Auctioneer.Util.NullSafe(hsp) * countFix); local bidPrice = Auctioneer.Statistic.RoundDownTo95(Auctioneer.Statistic.SubtractPercent(buyPrice, discountBidPercent)); if (Auctioneer.Storage.GetFixedPrice(itemKey)) then local start, buy, dur = Auctioneer.Storage.GetFixedPrice(itemKey, countFix) Auctioneer.Scanner.AuctionsSetLine(4, _AUCT('FrmtAuctinfoSugbid'), bidPrice); Auctioneer.Scanner.AuctionsSetLine(5, _AUCT('FrmtAuctinfoSugbuy'), buyPrice); auctionsSetWarn(_AUCT('FrmtWarnUser')); MoneyInputFrame_SetCopper(StartPrice, start); MoneyInputFrame_SetCopper(BuyoutPrice, buy); setAuctionDuration(tonumber(dur)); elseif (Auctioneer.Command.GetFilter('autofill')) then Auctioneer.Scanner.AuctionsSetLine(4, _AUCT('FrmtAuctinfoMktprice'), Auctioneer.Util.NullSafe(mktPrice)*countFix); Auctioneer.Scanner.AuctionsSetLine(5, _AUCT('FrmtAuctinfoOrig'), blizPrice); auctionsSetWarn(warn); MoneyInputFrame_SetCopper(StartPrice, bidPrice); MoneyInputFrame_SetCopper(BuyoutPrice, buyPrice); else Auctioneer.Scanner.AuctionsSetLine(4, _AUCT('FrmtAuctinfoSugbid'), bidPrice); Auctioneer.Scanner.AuctionsSetLine(5, _AUCT('FrmtAuctinfoSugbuy'), buyPrice); auctionsSetWarn(warn); endendfunction auctHouseShow() -- Set the default auction duration if (Auctioneer.Command.GetFilterVal('auction-duration') > 0) then setAuctionDuration(Auctioneer.Command.GetFilterVal('auction-duration')) else setAuctionDuration(Auctioneer.Command.GetFilterVal('last-auction-duration')) end -- Protect the auction frame from being closed if we should if (Auctioneer.Command.GetFilterVal('protect-window') == 2) then Auctioneer.Util.ProtectAuctionFrame(true); end -- Start scanning if so requested if Auctioneer.Scanning.IsScanningRequested then Auctioneer.Scanning.StartAuctionScan(); endendfunction auctHouseClose() if Auctioneer.Scanning.IsScanningRequested then Auctioneer.Scanning.StopAuctionScan(); end -- Unprotect the auction frame Auctioneer.Util.ProtectAuctionFrame(false);endfunction auctHouseUpdate() if (Auctioneer.Scanning.IsScanningRequested and Auctioneer.Scanning.CheckCompleteScan()) then Auctioneer.Scanning.ScanAuction(); endendfunction filterButtonSetType(funcVars, retVal, button, type, text, isLast) --Auctioneer_FilterButton_SetType EnhTooltip.DebugPrint("Setting button", button:GetName(), type, text, isLast); local buttonName = button:GetName(); local i,j, buttonID = string.find(buttonName, "(%d+)$"); buttonID = tonumber(buttonID); local checkbox = getglobal(button:GetName().."Checkbox"); if checkbox then if (type == "class") then local classid, maxid = Auctioneer.Command.FindFilterClass(text); if (classid > 0) then Auctioneer.Command.FilterSetFilter(checkbox, "scan-class"..classid); if (classid == maxid) and (buttonID < 15) then for i=buttonID+1, 15 do getglobal("AuctionFilterButton"..i):Hide(); end end else checkbox:Hide(); end else checkbox:Hide(); end endendlocal ignoreAuctionDurationChange = nilfunction onChangeAuctionDuration() if (ignoreAuctionDurationChange) then ignoreAuctionDurationChange = nil; return end Auctioneer.Command.SetFilter('last-auction-duration', AuctionFrameAuctions.duration)endfunction setAuctionDuration(duration, persist) local durationIndex if (duration >= 1 and duration <= 3) then durationIndex = duration elseif (duration == 120) then durationIndex = 1 elseif (duration == 480) then durationIndex = 2 elseif (duration == 1440) then durationIndex = 3 else EnhTooltip.DebugPrint("Auctioneer.Scanner.SetAuctionDuration(): invalid duration ", duration) return end if (not persist) then ignoreAuctionDurationChange = true; end AuctionsRadioButton_OnClick(durationIndex);endAuctioneer.Scanner = { ProcessLink = processLink, InvalidateAHSnapshot = invalidateAHSnapshot, AuctionStartHook = auctionStartHook, FinishedAuctionScanHook = finishedAuctionScanHook, AuctionEntryHook = auctionEntryHook, StartAuction = startAuction, PlaceAuctionBid = placeAuctionBid, ConfigureAH = configureAH, AuctionFrameFiltersUpdateClasses = auctionFrameFiltersUpdateClasses, RememberPrice = rememberPrice, AuctionsClear = auctionsClear, AuctionsSetWarn = auctionsSetWarn, AuctionsSetLine = auctionsSetLine, NewAuction = newAuction, AuctHouseShow = auctHouseShow, AuctHouseClose = auctHouseClose, AuctHouseUpdate = auctHouseUpdate, FilterButtonSetType = filterButtonSetType, OnChangeAuctionDuration = onChangeAuctionDuration, SetAuctionDuration = setAuctionDuration,}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -