⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 auctionframesearch.lua

📁 时间太紧了
💻 LUA
📖 第 1 页 / 共 4 页
字号:
				auction.timeLeft = a.timeLeft;				auction.bid = currentBid;				auction.bidPer = math.floor(auction.bid / count);				auction.buyout = buyout;				auction.buyoutPer = math.floor(auction.buyout / count);				auction.profit = hspBuyout - currentBid;				auction.profitPer = math.floor(auction.profit / count);				auction.percentLess = percentLess;				auction.signature = a.signature;				if (a.highBidder) then					auction.status = AUCTION_STATUS_HIGH_BIDDER;				else					auction.status = AUCTION_STATUS_UNKNOWN;				end				auction.pendingBidCount = 0;				table.insert(frame.results, auction);			end		end	end	-- Hand the updated results to the list.	frame.resultsType = "PlainSearch";	frame:SelectResultByIndex(nil);	ListTemplate_Initialize(frame.resultsList, frame.plainSearchPhysicalColumns, frame.auctioneerListLogicalColumns);	ListTemplate_SetContent(frame.resultsList, frame.results);	ListTemplate_Sort(frame.resultsList, 2);	ListTemplate_Sort(frame.resultsList, 3);end--------------------------------------------------------------------------------- Select a search result by index.-------------------------------------------------------------------------------function AuctionFrameSearch_SelectResultByIndex(frame, index)	if (index and index <= table.getn(frame.results) and frame.resultsType) then		-- Select the item		frame.selectedResult = frame.results[index];		ListTemplate_SelectRow(frame.resultsList, index);	else		-- Clear the selection		frame.selectedResult = nil;		ListTemplate_SelectRow(frame.resultsList, nil);	end	AuctionFrameSearch_UpdateButtons(frame);end--------------------------------------------------------------------------------- Update the enabled/disabled state of the Bid and Buyout buttons-------------------------------------------------------------------------------function AuctionFrameSearch_UpdateButtons(frame)	if (frame.selectedResult) then		if (frame.selectedResult.status == AUCTION_STATUS_UNKNOWN) then			if (frame.resultsType == "BidSearch") then				frame.bidButton:Enable();				frame.buyoutButton:Disable();			elseif (frame.resultsType == "BuyoutSearch") then				frame.bidButton:Disable();				frame.buyoutButton:Enable();			elseif (frame.resultsType == "CompeteSearch") then				frame.bidButton:Enable();				frame.buyoutButton:Enable();			elseif (frame.resultsType == "PlainSearch") then				frame.bidButton:Enable();				frame.buyoutButton:Enable();			else				frame.bidButton:Disable();				frame.buyoutButton:Disable();			end		else			frame.bidButton:Disable();			frame.buyoutButton:Disable();		end	else		frame.bidButton:Disable();		frame.buyoutButton:Disable();	endend--------------------------------------------------------------------------------- An item in the list is moused over.-------------------------------------------------------------------------------function AuctionFrameSearch_ListItem_OnEnter(row)	local frame = this:GetParent():GetParent();	local results = frame.results;	if (results and row <= table.getn(results)) then		local result = results[row];		if (result) then			local _, link, rarity = GetItemInfo(result.item);			if (link) then				local name = result.name;				local count = result.count;				GameTooltip:SetOwner(this, "ANCHOR_RIGHT");				GameTooltip:SetHyperlink(link);				GameTooltip:Show();				EnhTooltip.TooltipCall(GameTooltip, name, result.link, rarity, count);			end		end	endend--------------------------------------------------------------------------------- An item in the list is clicked.-------------------------------------------------------------------------------function AuctionFrameSearch_ListItem_OnClick(row)	local frame = this:GetParent():GetParent();	-- Select the item clicked.	frame:SelectResultByIndex(row);	-- Bid or buyout the item if the alt key is down.	if (frame.resultsType and IsAltKeyDown()) then		if (IsShiftKeyDown()) then			-- Bid or buyout the item.			if (frame.resultsType == "BidSearch") then				AuctionFrameSearch_BidButton_OnClick(frame.bidButton);			elseif (frame.resultsType == "BuyoutSearch") then				AuctionFrameSearch_BuyoutButton_OnClick(frame.buyoutButton);			end		else			-- Search for the item and switch to the Browse tab.			BrowseName:SetText(frame.results[row].name)			BrowseMinLevel:SetText("")			BrowseMaxLevel:SetText("")			AuctionFrameBrowse.selectedInvtype = nil			AuctionFrameBrowse.selectedInvtypeIndex = nil			AuctionFrameBrowse.selectedClass = nil			AuctionFrameBrowse.selectedClassIndex = nil			AuctionFrameBrowse.selectedSubclass = nil			AuctionFrameBrowse.selectedSubclassIndex = nil			AuctionFrameFilters_Update()			IsUsableCheckButton:SetChecked(0)			UIDropDownMenu_SetSelectedValue(BrowseDropDown, -1)			AuctionFrameBrowse_Search()			AuctionFrameTab_OnClick(1);		end	--Thanks to Miravlix (from irc://irc.datavertex.com/cosmostesters) for the following codeblocks.	elseif (IsControlKeyDown()) then		DressUpItemLink(frame.results[row].item);	elseif (IsShiftKeyDown() and ChatFrameEditBox:IsVisible()) then		-- Trim leading whitespace		ChatFrameEditBox:Insert(string.gsub(frame.results[row].link, " *(.*)", "%1"));	endend--------------------------------------------------------------------------------- Initialize the content of a Category dropdown list-------------------------------------------------------------------------------function AuctionFrameSearch_CategoryDropDown_Initialize()	local dropdown = this:GetParent();	local frame = dropdown:GetParent();	UIDropDownMenu_AddButton({		text = "",		func = AuctionFrameSearch_CategoryDropDownItem_OnClick,		owner = dropdown	})	if (AuctionConfig.classes) then		for classid, cdata in AuctionConfig.classes do			UIDropDownMenu_AddButton({				text = cdata.name,				func = AuctionFrameSearch_CategoryDropDownItem_OnClick,				owner = dropdown			});		end	endend--------------------------------------------------------------------------------- An item in a CategoryDrownDown has been clicked-------------------------------------------------------------------------------function AuctionFrameSearch_CategoryDropDownItem_OnClick()	local index = this:GetID();	local dropdown = this.owner;	AuctioneerDropDownMenu_SetSelectedID(dropdown, index);end--------------------------------------------------------------------------------- Initialize the content of a TimeLeft dropdown list-------------------------------------------------------------------------------function AuctionFrameSearch_TimeLeftDropDown_Initialize()	local dropdown = this:GetParent();	local frame = dropdown:GetParent();	for index in TIME_LEFT_NAMES do		local info = {};		info.text = TIME_LEFT_NAMES[index];		info.func = AuctionFrameSearch_TimeLeftDropDownItem_OnClick;		info.owner = dropdown;		UIDropDownMenu_AddButton(info);	endend--------------------------------------------------------------------------------- An item a TimeLeftDrownDown has been clicked-------------------------------------------------------------------------------function AuctionFrameSearch_TimeLeftDropDownItem_OnClick()	local index = this:GetID();	local dropdown = this.owner;	AuctioneerDropDownMenu_SetSelectedID(dropdown, index);end--------------------------------------------------------------------------------------------------------------------------------------------------------------function AuctionFrameSearchBid_SearchButton_OnClick(button)	local frame = button:GetParent();	local frameName = frame:GetName();	local profitMoneyFrame = getglobal(frameName.."MinProfit");	local percentLessEdit = getglobal(frameName.."MinPercentLessEdit");	local timeLeftDropDown = getglobal(frameName.."TimeLeftDropDown");	local minProfit = MoneyInputFrame_GetCopper(profitMoneyFrame);	local minPercentLess = percentLessEdit:GetNumber();	local catID = (UIDropDownMenu_GetSelectedID(getglobal(frameName.."CategoryDropDown")) or 1) - 1;	local minQuality = (UIDropDownMenu_GetSelectedID(getglobal(frameName.."MinQualityDropDown")) or 1) - 1;	local itemName = getglobal(frameName.."SearchEdit"):GetText();	if (itemName == "") then itemName = nil end	local timeLeft = Auctioneer.Core.Constants.TimeLeft.Seconds[UIDropDownMenu_GetSelectedID(timeLeftDropDown)];	frame:GetParent():SearchBids(minProfit, minPercentLess, timeLeft, catID, minQuality, itemName);end--------------------------------------------------------------------------------------------------------------------------------------------------------------function AuctionFrameSearchBuyout_SearchButton_OnClick(button)	local frame = button:GetParent();	local frameName = frame:GetName();	local profitMoneyFrame = getglobal(frame:GetName().."MinProfit");	local percentLessEdit = getglobal(frame:GetName().."MinPercentLessEdit");	local minProfit = MoneyInputFrame_GetCopper(profitMoneyFrame);	local minPercentLess = percentLessEdit:GetNumber();	local catID = (UIDropDownMenu_GetSelectedID(getglobal(frameName.."CategoryDropDown")) or 1) - 1	local minQuality = (UIDropDownMenu_GetSelectedID(getglobal(frameName.."MinQualityDropDown")) or 1) - 1;	local itemName = getglobal(frameName.."SearchEdit"):GetText();	if (itemName == "") then itemName = nil end	frame:GetParent():SearchBuyouts(minProfit, minPercentLess, catID, minQuality, itemName);end--------------------------------------------------------------------------------------------------------------------------------------------------------------function AuctionFrameSearchPlain_SearchButton_OnClick(button)	local frame = button:GetParent();	local frameName = frame:GetName();	local maxPrice = MoneyInputFrame_GetCopper(getglobal(frameName.."MaxPrice")) or 0	local catID = (UIDropDownMenu_GetSelectedID(getglobal(frameName.."CategoryDropDown")) or 1) - 1	local minQuality = (UIDropDownMenu_GetSelectedID(getglobal(frameName.."MinQualityDropDown")) or 1) - 1;	local itemName = getglobal(frameName.."SearchEdit"):GetText();	if (itemName == "") then itemName = nil end	frame:GetParent():SearchPlain(maxPrice, catID, minQuality, itemName);end--------------------------------------------------------------------------------------------------------------------------------------------------------------function AuctionFrameSearchCompete_SearchButton_OnClick(button)	local frame = button:GetParent();	local undercutMoneyFrame = getglobal(frame:GetName().."Undercut");	local minUndercut = MoneyInputFrame_GetCopper(undercutMoneyFrame);	frame:GetParent():SearchCompetition(minUndercut);end--------------------------------------------------------------------------------------------------------------------------------------------------------------function AuctionFrameSearch_OnBidResult(context, bidRequest)	context.auction.pendingBidCount = context.auction.pendingBidCount - 1;	if (context.auction.pendingBidCount == 0) then		if (table.getn(bidRequest.results) == 0) then			-- No auctions matched.			context.auction.status = AUCTION_STATUS_NOT_FOUND;		else			-- Assume we are now the high bidder on all the matching auctions			-- until proven otherwise.			context.auction.status = AUCTION_STATUS_HIGH_BIDDER;			for _,result in pairs(bidRequest.results) do				if (result ~= BidResultCodes["BidAccepted"] and					result ~= BidResultCodes["AlreadyHighBidder"] and					result ~= BidResultCodes["OwnAuction"]) then					context.auction.status = AUCTION_STATUS_UNKNOWN;					break;				end			end		end		AuctionFrameSearch_UpdateButtons(context.frame);		ListTemplateScrollFrame_Update(getglobal(context.frame.resultsList:GetName().."ScrollFrame"));	end	AuctionFrameSearch_UpdatePendingBidStatus(context.frame);end--------------------------------------------------------------------------------------------------------------------------------------------------------------function AuctionFrameSearch_GetAuctionAlpha(auction)	local status = auction.status;	if (status and (status == AUCTION_STATUS_NOT_FOUND or status == AUCTION_STATUS_HIGH_BIDDER)) then		return 0.4;	end	return 1.0;end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -