local function BaudAuctionSortBrowseList()
BaudAuctionArrow:ClearAllPoints();
BaudAuctionArrow:SetPoint("RIGHT", getglobal(Columns[SortColumn].Header:GetName()), "RIGHT", 0, -2);
if SortReverse then
BaudAuctionArrow:SetTexCoord(0, 0.5625, 1.0, 0);
else
BaudAuctionArrow:SetTexCoord(0, 0.5625, 0, 1.0);
end
for Index =
#SearchResults + 1, #BrowseDisplay do
BrowseDisplay[Index] = nil;
end
for Index = 1, #SearchResults do
BrowseDisplay[Index] = Index;
end
local Sort = Columns[SortColumn].Sort;
local lastSort = lastSortColumn and Columns[lastSortColumn].Sort
table.sort(BrowseDisplay, function(a, b)
if (SearchResults and SearchResults[a] and SearchResults[b]) then
local sa,sb = SearchResults[a][Sort], SearchResults[b][Sort]
if Sort == 9 or Sort == 17 then
sa = sa == 0 and math.huge or sa
sb = sb == 0 and math.huge or sb
end
if (sa == sb) then
if lastSort and lastSort~= Sort then --按上次的排序
local lsa, lsb = SearchResults[a][lastSort], SearchResults[b][lastSort]
if lastSort == 9 or lastSort == 17 then
lsa = lsa == 0 and math.huge or lsa
lsb = lsb == 0 and math.huge or lsb
end
if (lsa == lsb) then
return (a < b);
elseif not lastSortReverse then
return (lsa < lsb);
else
return (lsa > lsb);
end
else
return (a < b);
end
elseif not SortReverse then
return (sa < sb);
else
return (sa > sb);
end
end
end);
BaudAuctionBrowseScrollBar_Update();
end
local function BaudAuction_Reset()
BaudAuctionProgress:Hide();
wipe(SearchResults);
SearchParam = nil;
ScanPage = nil;
SelectedItem = nil;
BaudAuctionSortBrowseList();
end
local function BaudAuctionUpdateProgress(Progress)
BaudAuctionProgressBar:SetValue(Progress);
BaudAuctionProgressBarText:SetText(floor(Progress * 100 + 0.5) .. "%");
if (Progress >= 1) then
BaudAuctionProgressBarText2:SetText("搜索完成");
BaudAuctionProgressBarDots:Hide();
BaudAuctionProgress.Finish = GetTime();
else
BaudAuctionProgressBarText2:SetText("搜索中");
BaudAuctionProgressBarDots:Show();
end
BaudAuctionProgress:Show();
end
local function make_disableBtn()
local btn = CreateFrame("Button", "bf_BA_btn", AuctionFrameBrowse, "UIPanelButtonTemplate");
btn:SetPoint("BOTTOM", AuctionFrameBrowse, "BOTTOM", -151 , 14);
btn:SetText("关闭拍卖增强");
btn:SetHeight(22);
btn:SetWidth(99);
btn:SetScript("OnClick", function()
StaticPopup_Show("AFFIRM_DISABLE_BA");
end);
btn:Hide();
end
local EventFuncs = {
ADDON_LOADED = function(self, AddOn)
if (AddOn ~= "BaudAuction") then
return;
end
BrowseSearchButton:SetScript("OnUpdate", nil);
-- BrowseResetButton:HookScript('OnClick', BaudAuction_Reset)
hooksecurefunc("AuctionFrameBrowse_Update", function()
BrowseNoResultsText:Hide();
end);
hooksecurefunc("QueryAuctionItems", function(...)
-- ChatFrame1:AddMessage("Item search page "..select(7, ...));
if AuctionFrameBuy and AuctionFrameBuy:IsVisible() then return end --AuctionLite
if AuctionFrameSell and AuctionFrameSell:IsVisible() then return end --AuctionLite
SearchDelay = GetTime() + 1;
--6.0 QueryAuctionItems(text, minLevel, maxLevel, invType, class, subclass, page, usable, rarity, false, exactMatch);
--7.0 QueryAuctionItems(text, minLevel, maxLevel, page, usable, rarity, false, exactMatch, filterData);
if (not select(7, ...) and select(4, ...) == 0 and SelectedItem == nil) then
SearchResults = {};
SelectedItem = nil;
ScanPage = 0;
ScanFrame:Show();
SearchParam = { ... };
BaudAuctionUpdateProgress(0);
BaudAuctionProgress.Finish = nil;
BaudAuctionProgress:SetAlpha(1);
BaudAuctionProgress:Show();
end
end);
hooksecurefunc("AuctionFrameBrowse_Search", function()
AuctionFrameBrowse.isSearching = nil;
BrowseNoResultsText:Hide();
BrowseSearchDotsText:Hide();
end);
make_disableBtn();
self:UnregisterEvent("ADDON_LOADED");
end,
AUCTION_HOUSE_CLOSED = function()
BaudAuction_Reset()
end,
AUCTION_ITEM_LIST_UPDATE = function()
if gAtr_FullScanState == nil or gAtr_FullScanState == 0 then -- ALA AUCTIONATOR
UpdateResults:Show();
end
end,
};