📄 auctionframesearch.lua
字号:
sortAscending = true; }, { width = 50; logicalColumn = this.logicalColumns.PercentLess; logicalColumns = { this.logicalColumns.PercentLess }; sortAscending = true; }, }; -- Configure the plain search physical columns this.plainSearchPhysicalColumns = { { width = 50; logicalColumn = this.logicalColumns.Quantity; logicalColumns = { this.logicalColumns.Quantity }; sortAscending = true; }, { width = 160; logicalColumn = this.logicalColumns.Name; logicalColumns = { this.logicalColumns.Name }; sortAscending = true; }, { width = 90; logicalColumn = this.logicalColumns.TimeLeft; logicalColumns = { this.logicalColumns.TimeLeft }; sortAscending = true; }, { width = 130; logicalColumn = this.logicalColumns.Bid; logicalColumns = { this.logicalColumns.Bid, this.logicalColumns.BidPer, this.logicalColumns.Buyout, this.logicalColumns.BuyoutPer }; sortAscending = true; }, { width = 130; logicalColumn = this.logicalColumns.Buyout; logicalColumns = { this.logicalColumns.Profit, this.logicalColumns.ProfitPer, this.logicalColumns.Buyout, this.logicalColumns.BuyoutPer }; sortAscending = true; }, { width = 50; logicalColumn = this.logicalColumns.PercentLess; logicalColumns = { this.logicalColumns.PercentLess, this.logicalColumns.ItemLevel }; sortAscending = true; }, }; -- Initialize the list to show nothing at first. ListTemplate_Initialize(this.resultsList, this.results, this.results); this:SelectResultByIndex(nil);end--------------------------------------------------------------------------------------------------------------------------------------------------------------function AuctionFrameSearch_OnShow() AuctionFrameSearch_UpdatePendingBidStatus(this);end--------------------------------------------------------------------------------------------------------------------------------------------------------------AUCTIONEER_SEARCH_TYPES = {}function AuctionFrameSearch_SearchDropDown_Initialize() local dropdown = this:GetParent(); local frame = dropdown:GetParent(); AUCTIONEER_SEARCH_TYPES[1] = _AUCT("UiSearchTypeBids"); AUCTIONEER_SEARCH_TYPES[2] = _AUCT("UiSearchTypeBuyouts"); AUCTIONEER_SEARCH_TYPES[3] = _AUCT("UiSearchTypeCompetition"); AUCTIONEER_SEARCH_TYPES[4] = _AUCT("UiSearchTypePlain"); for i=1, 4 do UIDropDownMenu_AddButton({ text = AUCTIONEER_SEARCH_TYPES[i], func = AuctionFrameSearch_SearchDropDownItem_OnClick, owner = dropdown }) endend--------------------------------------------------------------------------------------------------------------------------------------------------------------function AuctionFrameSearch_MinQualityDropDown_Initialize() local dropdown = this:GetParent(); local frame = dropdown:GetParent(); for i=0, 6 do UIDropDownMenu_AddButton({ text = getglobal("ITEM_QUALITY"..i.."_DESC"), func = AuctionFrameSearch_MinQualityDropDownItem_OnClick, value = i, owner = dropdown }); endend--------------------------------------------------------------------------------------------------------------------------------------------------------------function AuctionFrameSearch_SavedSearchDropDownItem_OnClick() local index = this:GetID(); local dropdown = this.owner; local frame = dropdown:GetParent(); local frameName = frame:GetName(); local text = ""; if (index > 1) then text = this.value local searchData = AuctionConfig.SavedSearches[text]; local searchParams = Auctioneer.Util.Split(searchData, "\t"); local searchType = tonumber(searchParams[1]) getglobal(frameName.."SearchDropDown").selectedID = searchType; getglobal(frameName.."SearchDropDownText"):SetText(AUCTIONEER_SEARCH_TYPES[searchType]); frame.bidFrame:Hide(); frame.buyoutFrame:Hide(); frame.competeFrame:Hide(); frame.plainFrame:Hide(); if (searchType == 1) then -- Bid search MoneyInputFrame_SetCopper(getglobal(frameName.."BidMinProfit"), tonumber(searchParams[2])) getglobal(frameName.."BidMinPercentLessEdit"):SetText(searchParams[3]) local timeLeft = tonumber(searchParams[4]) or 2 AuctioneerDropDownMenu_Initialize(getglobal(frameName.."BidTimeLeftDropDown"), AuctionFrameSearch_TimeLeftDropDown_Initialize); AuctioneerDropDownMenu_SetSelectedID(getglobal(frameName.."BidTimeLeftDropDown"), timeLeft); local catid = tonumber(searchParams[5]) or 1 local catName = "" if (AuctionConfig.classes[catid-1]) then catName = AuctionConfig.classes[catid-1].name end AuctioneerDropDownMenu_Initialize(getglobal(frameName.."BidCategoryDropDown"), AuctionFrameSearch_CategoryDropDown_Initialize); AuctioneerDropDownMenu_SetSelectedID(getglobal(frameName.."BidCategoryDropDown"), catid); local quality = tonumber(searchParams[6]) or 1 AuctioneerDropDownMenu_Initialize(getglobal(frameName.."BidMinQualityDropDown"), AuctionFrameSearch_MinQualityDropDown_Initialize); AuctioneerDropDownMenu_SetSelectedID(getglobal(frameName.."BidMinQualityDropDown"), quality); getglobal(frameName.."BidSearchEdit"):SetText(searchParams[7]) frame.bidFrame:Show(); elseif (searchType == 2) then -- Buyout search MoneyInputFrame_SetCopper(getglobal(frameName.."BuyoutMinProfit"), tonumber(searchParams[2])) getglobal(frameName.."BuyoutMinPercentLessEdit"):SetText(searchParams[3]) local catid = tonumber(searchParams[4]) or 1 local catName = "" if (AuctionConfig.classes[catid-1]) then catName = AuctionConfig.classes[catid-1].name end AuctioneerDropDownMenu_Initialize(getglobal(frameName.."BuyoutCategoryDropDown"), AuctionFrameSearch_CategoryDropDown_Initialize); AuctioneerDropDownMenu_SetSelectedID(getglobal(frameName.."BuyoutCategoryDropDown"), catid); local quality = tonumber(searchParams[5]) or 1 AuctioneerDropDownMenu_Initialize(getglobal(frameName.."BuyoutMinQualityDropDown"), AuctionFrameSearch_MinQualityDropDown_Initialize); AuctioneerDropDownMenu_SetSelectedID(getglobal(frameName.."BuyoutMinQualityDropDown"), quality); getglobal(frameName.."BuyoutSearchEdit"):SetText(searchParams[6]) frame.buyoutFrame:Show(); elseif (searchType == 3) then -- Compete search MoneyInputFrame_SetCopper(getglobal(frameName.."CompeteUndercut"), tonumber(searchParams[2])) frame.competeFrame:Show(); elseif (searchType == 4) then -- Plain search MoneyInputFrame_SetCopper(getglobal(frameName.."PlainMaxPrice"), tonumber(searchParams[2])) local catid = tonumber(searchParams[3]) or 1 local catName = "" if (AuctionConfig.classes[catid-1]) then catName = AuctionConfig.classes[catid-1].name end AuctioneerDropDownMenu_Initialize(getglobal(frameName.."PlainCategoryDropDownText"), AuctionFrameSearch_CategoryDropDown_Initialize); AuctioneerDropDownMenu_SetSelectedID(getglobal(frameName.."PlainCategoryDropDownText"), catid); local quality = tonumber(searchParams[4]) or 1 AuctioneerDropDownMenu_Initialize(getglobal(frameName.."PlainMinQualityDropDown"), AuctionFrameSearch_MinQualityDropDown_Initialize); AuctioneerDropDownMenu_SetSelectedID(getglobal(frameName.."PlainMinQualityDropDown"), quality); getglobal(frameName.."PlainSearchEdit"):SetText(searchParams[5]) frame.plainFrame:Show(); end end getglobal(frameName.."SaveSearchEdit"):SetText(text); AuctioneerDropDownMenu_SetSelectedID(dropdown, index);end--------------------------------------------------------------------------------------------------------------------------------------------------------------function AuctionFrameSearch_SavedSearchDropDown_Initialize() local dropdown = AuctionFrameSearchSavedSearchDropDown local frame = dropdown:GetParent() if (not AuctionConfig.SavedSearches) then UIDropDownMenu_AddButton({ text = "", func = AuctionFrameSearch_SavedSearchDropDownItem_OnClick, owner = dropdown }); return end local savedSearchDropDownElements = {} for name, search in pairs(AuctionConfig.SavedSearches) do table.insert(savedSearchDropDownElements, name); end table.sort(savedSearchDropDownElements); UIDropDownMenu_AddButton({ text = "", func = AuctionFrameSearch_SavedSearchDropDownItem_OnClick, owner = dropdown }); for pos, name in savedSearchDropDownElements do UIDropDownMenu_AddButton({ text = name, func = AuctionFrameSearch_SavedSearchDropDownItem_OnClick, owner = dropdown }); endend--------------------------------------------------------------------------------------------------------------------------------------------------------------function AuctionFrameSearch_MinQualityDropDownItem_OnClick() local index = this:GetID(); local dropdown = this.owner; AuctioneerDropDownMenu_SetSelectedID(dropdown, index);end--------------------------------------------------------------------------------------------------------------------------------------------------------------function AuctionFrameSearch_SearchDropDownItem_OnClick() local index = this:GetID(); local dropdown = this.owner; AuctionFrameSearch_SearchDropDownItem_SetSelectedID(dropdown, index);end--------------------------------------------------------------------------------------------------------------------------------------------------------------function AuctionFrameSearch_SearchDropDownItem_SetSelectedID(dropdown, index) local frame = dropdown:GetParent(); frame.bidFrame:Hide(); frame.buyoutFrame:Hide(); frame.competeFrame:Hide(); frame.plainFrame:Hide(); if (index == 1) then frame.bidFrame:Show(); elseif (index == 2) then frame.buyoutFrame:Show(); elseif (index == 3) then frame.competeFrame:Show(); elseif (index == 4) then frame.plainFrame:Show(); end AuctioneerDropDownMenu_SetSelectedID(dropdown, index);end--------------------------------------------------------------------------------------------------------------------------------------------------------------function AuctionFrameSearch_RemoveSearchButton_OnClick(button) local frame = button:GetParent(); local frameName = frame:GetName(); local searchName = getglobal(frameName.."SaveSearchEdit"):GetText() if (AuctionConfig.SavedSearches) then AuctionConfig.SavedSearches[searchName] = nil end getglobal(frameName.."SaveSearchEdit"):SetText("")end--------------------------------------------------------------------------------------------------------------------------------------------------------------function AuctionFrameSearch_SaveSearchButton_OnClick(button) local frame = button:GetParent(); local frameName = frame:GetName(); local searchDropdown = getglobal(frameName.."SearchDropDown") local searchType = UIDropDownMenu_GetSelectedID(searchDropdown); local searchData = nil if (searchType == 1) then -- Bid-based search searchData = string.format("%d\t%d\t%s\t%d\t%d\t%d\t%s", searchType,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -