📄 aucscanner.lua
字号:
end end -- if this auction is not in the snapshot add it local auctKey = Auctioneer.Util.GetAuctionKey(); local snap = Auctioneer.Core.GetSnapshot(auctKey, itemCat, lAuctionSignature); -- If we haven't seen this item (its not in the old snapshot) if (not snap) then EnhTooltip.DebugPrint("No snap"); Auctioneer.Core.Variables.NewAuctionsCount = Auctioneer.Core.Variables.NewAuctionsCount + 1; -- now build the list of buyout prices seen for this auction to use to get the median local newBuyoutPricesList = Auctioneer.BalancedList.NewBalancedList(Auctioneer.Core.Constants.MaxBuyoutHistorySize); local auctionPriceItem = Auctioneer.Core.GetAuctionPriceItem(aiKey, auctKey); if (not auctionPriceItem) then auctionPriceItem = {} end local seenCount,minCount,minPrice,bidCount,bidPrice,buyCount,buyPrice = Auctioneer.Core.GetAuctionPrices(auctionPriceItem.data); seenCount = seenCount + 1; minCount = minCount + 1; minPrice = minPrice + Auctioneer.Util.PriceForOne(aiMinBid, aiCount); if (Auctioneer.Util.NullSafe(aiBidAmount) > 0) then bidCount = bidCount + 1; bidPrice = bidPrice + Auctioneer.Util.PriceForOne(aiBidAmount, aiCount); end if (Auctioneer.Util.NullSafe(aiBuyoutPrice) > 0) then buyCount = buyCount + 1; buyPrice = buyPrice + Auctioneer.Util.PriceForOne(aiBuyoutPrice, aiCount); end auctionPriceItem.data = string.format("%d:%d:%d:%d:%d:%d:%d", seenCount,minCount,minPrice,bidCount,bidPrice,buyCount,buyPrice); local bph = auctionPriceItem.buyoutPricesHistoryList; if (bph and table.getn(bph) > 0) then newBuyoutPricesList.setList(bph); end if (Auctioneer.Util.NullSafe(aiBuyoutPrice) > 0) then newBuyoutPricesList.insert(Auctioneer.Util.PriceForOne(aiBuyoutPrice, aiCount)); end auctionPriceItem.buyoutPricesHistoryList = newBuyoutPricesList.getList(); auctionPriceItem.name = aiName; auctionPriceItem.category = itemCat; Auctioneer.Core.SaveAuctionPriceItem(auctKey, aiKey, auctionPriceItem); -- finaly add the auction to the snapshot if (aiOwner == nil) then aiOwner = "unknown"; end local initialTimeSeen = time(); snap = { initialSeenTime=initialTimeSeen, lastSeenTime=initialTimeSeen, itemLink=aiLink, quality=Auctioneer.Util.NullSafe(aiQuality), level=Auctioneer.Util.NullSafe(aiLevel), bidamount=Auctioneer.Util.NullSafe(aiBidAmount), highBidder=aiHighBidder, owner=aiOwner, timeLeft=Auctioneer.Util.NullSafe(aiTimeLeft), category=itemCat, dirty=0 }; else EnhTooltip.DebugPrint("Snap!"); Auctioneer.Core.Variables.OldAuctionsCount = Auctioneer.Core.Variables.OldAuctionsCount + 1; --this is an auction that was already in the snapshot from a previous scan and is still in the auction house snap.dirty = 0; --set its dirty flag to false so we know to keep it in the snapshot snap.lastSeenTime = time(); --set the time we saw it last snap.timeLeft = Auctioneer.Util.NullSafe(aiTimeLeft); --update the time left snap.bidamount = Auctioneer.Util.NullSafe(aiBidAmount); --update the current bid amount snap.highBidder = aiHighBidder; --update the high bidder end -- Commit the snapshot back to the table. Auctioneer.Core.SaveSnapshot(auctKey, itemCat, lAuctionSignature, snap);end-- hook into the auction starting processfunction startAuction(funcArgs, retVal, start, buy, duration) if (AuctPriceRememberCheck:GetChecked()) then Auctioneer.Storage.SetFixedPrice(Auctioneer_CurAuctionItem, start, buy, duration, Auctioneer_CurAuctionCount) end Auctioneer_CurAuctionItem = nil Auctioneer_CurAuctionCount = nil AuctPriceRememberCheck:SetChecked(false)end-- hook to capture data about an auction that was boughtoutfunction placeAuctionBid(funcVars, retVal, itemtype, itemindex, bidamount) -- get the info for this auction local aiLink = GetAuctionItemLink(itemtype, itemindex); local aiItemID, aiRandomProp, aiEnchant, aiUniqID = EnhTooltip.BreakLink(aiLink); local aiKey = aiItemID..":"..aiRandomProp..":"..aiEnchant; local aiName, aiTexture, aiCount, aiQuality, aiCanUse, aiLevel, aiMinBid, aiMinIncrement, aiBuyout, aiBidAmount, aiHighBidder, aiOwner = GetAuctionItemInfo(itemtype, itemindex); local auctionSignature = string.format("%d:%d:%d:%s:%d:%d:%d:%d", aiItemID, aiRandomProp, aiEnchant, Auctioneer.Util.NilSafeString(aiName), Auctioneer.Util.NullSafe(aiCount), Auctioneer.Util.NullSafe(aiMinBid), Auctioneer.Util.NullSafe(aiBuyout), aiUniqID); local playerName = UnitName("player"); local eventTime = "e"..time(); if (not AuctionConfig.bids) then AuctionConfig.bids = {} end if (not AuctionConfig.bids[playerName]) then AuctionConfig.bids[playerName] = {}; end AuctionConfig.bids[playerName][eventTime] = string.format("%s|%s|%s|%s|%s", auctionSignature, bidamount, 0, aiOwner, aiHighBidder or "unknown"); if bidamount == aiBuyout then -- only capture buyouts local foundInSnapshot = false -- remove from snapshot Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtActRemove'), auctionSignature)); local auctKey = Auctioneer.Util.GetAuctionKey(); local itemCat = Auctioneer.Util.GetCatForKey(aiKey); if (itemCat and AuctionConfig and AuctionConfig.snap and AuctionConfig.snap[auctKey] and AuctionConfig.snap[auctKey][itemCat]) then if (AuctionConfig.snap[auctKey][itemCat][auctionSignature]) then foundInSnapshot = true; AuctionConfig.snap[auctKey][itemCat][auctionSignature] = nil; end end if (not AuctionConfig.bids) then AuctionConfig.bids = {} end if (not AuctionConfig.bids[playerName]) then AuctionConfig.bids[playerName] = {} end AuctionConfig.bids[playerName][eventTime] = string.format("%s|%s|%s|%s|%s", auctionSignature, bidamount, 1, aiOwner, aiHighBidder or "unknown"); if (foundInSnapshot) then if (Auctioneer_HSPCache and Auctioneer_HSPCache[auctKey]) then Auctioneer_HSPCache[auctKey][aiKey] = nil; end Auctioneer_Lowests = nil; -- Remove from snapshot buyout list local sbuy = Auctioneer.Core.GetSnapshotInfo(auctKey, aiKey) if sbuy then local price = Auctioneer.Util.PriceForOne(aiBuyout, aiCount); -- Find price in buyout list local found = table.foreachi(sbuy.buyoutPrices, function(k, v) if tonumber(v) == price then return k end end) if found then table.remove(sbuy.buyoutPrices, found) Auctioneer.Core.SaveSnapshotInfo(auctKey, aiKey, sbuy) end end end endendfunction relevel(frame) --Local local myLevel = frame:GetFrameLevel() + 1 local children = { frame:GetChildren() } for _,child in pairs(children) do child:SetFrameLevel(myLevel) relevel(child) endendlocal lAHConfigPending = truefunction configureAH() if (lAHConfigPending and IsAddOnLoaded("Blizzard_AuctionUI")) then EnhTooltip.DebugPrint("Configuring AuctionUI"); AuctionsPriceText:ClearAllPoints(); AuctionsPriceText:SetPoint("TOPLEFT", "AuctionsItemText", "TOPLEFT", 0, -53); AuctionsBuyoutText:ClearAllPoints(); AuctionsBuyoutText:SetPoint("TOPLEFT", "AuctionsPriceText", "TOPLEFT", 0, -33); AuctionsBuyoutErrorText:ClearAllPoints(); AuctionsBuyoutErrorText:SetPoint("TOPLEFT", "AuctionsBuyoutText", "TOPLEFT", 0, -29); AuctionsDurationText:ClearAllPoints(); AuctionsDurationText:SetPoint("TOPLEFT", "AuctionsBuyoutErrorText", "TOPLEFT", 0, -7); AuctionsDepositText:ClearAllPoints(); AuctionsDepositText:SetPoint("TOPLEFT", "AuctionsDurationText", "TOPLEFT", 0, -31); if (AuctionInfo ~= nil) then AuctionInfo:ClearAllPoints(); AuctionInfo:SetPoint("TOPLEFT", "AuctionsDepositText", "TOPLEFT", -4, -33); end AuctionsShortAuctionButtonText:SetText("2"); AuctionsMediumAuctionButton:SetPoint("TOPLEFT", "AuctionsDurationText", "BOTTOMLEFT", 3, 1); AuctionsMediumAuctionButtonText:SetText("8"); AuctionsMediumAuctionButton:ClearAllPoints(); AuctionsMediumAuctionButton:SetPoint("BOTTOMLEFT", "AuctionsShortAuctionButton", "BOTTOMRIGHT", 20,0); AuctionsLongAuctionButtonText:SetText("24 "..HOURS); AuctionsLongAuctionButton:ClearAllPoints(); AuctionsLongAuctionButton:SetPoint("BOTTOMLEFT", "AuctionsMediumAuctionButton", "BOTTOMRIGHT", 20,0); -- set UI-texts BrowseScanButton:SetText(_AUCT('TextScan')); BrowseScanButton:SetParent("AuctionFrameBrowse"); BrowseScanButton:SetPoint("LEFT", "AuctionFrameMoneyFrame", "RIGHT", 5,0); BrowseScanButton:Show(); if (AuctionInfo) then AuctionInfo:SetParent("AuctionFrameAuctions") AuctionInfo:SetPoint("TOPLEFT", "AuctionsDepositText", "TOPLEFT", -4, -51) AuctionInfo:Show() AuctPriceRemember:SetParent("AuctionFrameAuctions") AuctPriceRemember:SetPoint("TOPLEFT", "AuctionsDepositText", "BOTTOMLEFT", 0, -6) AuctPriceRemember:Show() AuctPriceRememberText:SetText(_AUCT('GuiRememberText')) AuctPriceRememberCheck:SetParent("AuctionFrameAuctions") AuctPriceRememberCheck:SetPoint("TOPLEFT", "AuctionsDepositText", "BOTTOMLEFT", 0, -2) AuctPriceRememberCheck:Show() end -- Protect the auction frame from being closed. -- This call is to ensure the window is protected even after you -- manually load Auctioneer while already showing the AuctionFrame if (Auctioneer.Command.GetFilterVal('protect-window') == 2) then Auctioneer.Util.ProtectAuctionFrame(true); end Auctioneer.Core.HookAuctionHouse() AuctionFrameFilters_UpdateClasses() lAHConfigPending = nil -- Count the number of auction house tabs local tabCount = 0; while (getglobal("AuctionFrameTab"..(tabCount + 1)) ~= nil) do tabCount = tabCount + 1; end -- Find the correct location to insert our Search Auctions and Post Auctions -- tabs. We want to insert them at the end or before BeanCounter's -- Transactions tab. local tabIndex = 1; while (getglobal("AuctionFrameTab"..(tabIndex)) ~= nil and getglobal("AuctionFrameTab"..(tabIndex)):GetName() ~= "AuctionFrameTabTransactions") do tabIndex = tabIndex + 1; end insertAHTab(tabIndex, AuctionFrameTabSearch, AuctionFrameSearch); insertAHTab(tabIndex + 1, AuctionFrameTabPost, AuctionFramePost); if (not AuctionUI_Hooked) then Stubby.RegisterFunctionHook("AuctionFrameTab_OnClick", 200, AuctioneerUI_AuctionFrameTab_OnClickHook) AuctionUI_Hooked = true end endendfunction insertAHTab(tabIndex, tabButton, tabFrame) -- Count the number of auction house tabs (including the tab we are going -- to insert). local tabCount = 1; while (getglobal("AuctionFrameTab"..(tabCount)) ~= nil) do tabCount = tabCount + 1; end -- Adjust the tabIndex to fit within the current tab count. if (tabIndex < 1 or tabIndex > tabCount) then tabIndex = tabCount; end -- Make room for the tab, if needed. for index = tabCount, tabIndex + 1, -1 do setglobal("AuctionFrameTab"..(index), getglobal("AuctionFrameTab"..(index - 1))); getglobal("AuctionFrameTab"..(index)):SetID(index); end -- Configure the frame. tabFrame:SetParent("AuctionFrame"); tabFrame:SetPoint("TOPLEFT", "AuctionFrame", "TOPLEFT", 0, 0); relevel(tabFrame); -- Configure the tab button. setglobal("AuctionFrameTab"..tabIndex, tabButton); tabButton:SetParent("AuctionFrame"); tabButton:SetPoint("TOPLEFT", getglobal("AuctionFrameTab"..(tabIndex - 1)):GetName(), "TOPRIGHT", -8, 0); tabButton:SetID(tabIndex); tabButton:Show(); -- If we inserted a tab in the middle, adjust the layout of the next tab button. if (tabIndex < tabCount) then nextTabButton = getglobal("AuctionFrameTab"..(tabIndex + 1)); nextTabButton:SetPoint("TOPLEFT", tabButton:GetName(), "TOPRIGHT", -8, 0);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -