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

📄 auctionframepost.lua

📁 时间太紧了
💻 LUA
📖 第 1 页 / 共 3 页
字号:
--[[	Auctioneer Addon for World of Warcraft(tm).	Version: 3.5.0.0917 (Platypus)	Revision: $Id: AuctionFramePost.lua 883 2006-06-01 06:06:51Z vindicator $	Auctioneer Post Auctions tab	License:		This program is free software; you can redistribute it and/or		modify it under the terms of the GNU General Public License		as published by the Free Software Foundation; either version 2		of the License, or (at your option) any later version.		This program is distributed in the hope that it will be useful,		but WITHOUT ANY WARRANTY; without even the implied warranty of		MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the		GNU General Public License for more details.		You should have received a copy of the GNU General Public License		along with this program(see GPL.txt); if not, write to the Free Software		Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.--]]--------------------------------------------------------------------------------------------------------------------------------------------------------------function AuctionFramePost_OnLoad()	-- Methods	this.CalculateAuctionDeposit = AuctionFramePost_CalculateAuctionDeposit;	this.UpdateDeposit = AuctionFramePost_UpdateDeposit;	this.GetItemID = AuctionFramePost_GetItemID;	this.GetItemName = AuctionFramePost_GetItemName;	this.SetNoteText = AuctionFramePost_SetNoteText;	this.GetSavePrice = AuctionFramePost_GetSavePrice;	this.GetStartPrice = AuctionFramePost_GetStartPrice;	this.SetStartPrice = AuctionFramePost_SetStartPrice;	this.GetBuyoutPrice = AuctionFramePost_GetBuyoutPrice;	this.SetBuyoutPrice = AuctionFramePost_SetBuyoutPrice;	this.GetStackSize = AuctionFramePost_GetStackSize;	this.SetStackSize = AuctionFramePost_SetStackSize;	this.GetStackCount = AuctionFramePost_GetStackCount;	this.SetStackCount = AuctionFramePost_SetStackCount;	this.GetDuration = AuctionFramePost_GetDuration;	this.SetDuration = AuctionFramePost_SetDuration;	this.GetDeposit = AuctionFramePost_GetDeposit;	this.SetAuctionItem = AuctionFramePost_SetAuctionItem;	this.ValidateAuction = AuctionFramePost_ValidateAuction;	this.UpdateAuctionList = AuctionFramePost_UpdateAuctionList;	this.UpdatePriceModels = AuctionFramePost_UpdatePriceModels;	-- Data Members	this.itemID = nil;	this.itemName = nil;	this.updating = false;	this.prices = {};	-- Controls	this.auctionList = getglobal(this:GetName().."List");	this.bidMoneyInputFrame = getglobal(this:GetName().."StartPrice");	this.buyoutMoneyInputFrame = getglobal(this:GetName().."BuyoutPrice");	this.stackSizeEdit = getglobal(this:GetName().."StackSize");	this.stackSizeCount = getglobal(this:GetName().."StackCount");	this.depositMoneyFrame = getglobal(this:GetName().."DepositMoneyFrame");	this.depositErrorLabel = getglobal(this:GetName().."UnknownDepositText");	-- Setup the tab order for the money input frames.	MoneyInputFrame_SetPreviousFocus(this.bidMoneyInputFrame, this.stackSizeCount);	MoneyInputFrame_SetNextFocus(this.bidMoneyInputFrame, getglobal(this.buyoutMoneyInputFrame:GetName().."Gold"));	MoneyInputFrame_SetPreviousFocus(this.buyoutMoneyInputFrame, getglobal(this.bidMoneyInputFrame:GetName().."Copper"));	MoneyInputFrame_SetNextFocus(this.buyoutMoneyInputFrame, this.stackSizeEdit);	-- Configure the logical columns	this.logicalColumns =	{		Quantity =		{			title = _AUCT("UiQuantityHeader");			dataType = "Number";			valueFunc = (function(record) return record.quantity end);			alphaFunc = AuctionFramePost_GetItemAlpha;			compareAscendingFunc = (function(record1, record2) return record1.quantity < record2.quantity end);			compareDescendingFunc = (function(record1, record2) return record1.quantity > record2.quantity end);		},		Name =		{			title = _AUCT("UiNameHeader");			dataType = "String";			valueFunc = (function(record) return record.name end);			colorFunc = AuctionFramePost_GetItemColor;			alphaFunc = AuctionFramePost_GetItemAlpha;			compareAscendingFunc = (function(record1, record2) return record1.name < record2.name end);			compareDescendingFunc = (function(record1, record2) return record1.name > record2.name end);		},		TimeLeft =		{			title = _AUCT("UiTimeLeftHeader");			dataType = "String";			valueFunc = (function(record) return Auctioneer.Util.GetTimeLeftString(record.timeLeft) end);			alphaFunc = AuctionFramePost_GetItemAlpha;			compareAscendingFunc = (function(record1, record2) return record1.timeLeft < record2.timeLeft end);			compareDescendingFunc = (function(record1, record2) return record1.timeLeft > record2.timeLeft end);		},		Bid =		{			title = _AUCT("UiBidHeader");			dataType = "Money";			valueFunc = (function(record) return record.bid end);			alphaFunc = AuctionFramePost_GetItemAlpha;			compareAscendingFunc = (function(record1, record2) return record1.bid < record2.bid end);			compareDescendingFunc = (function(record1, record2) return record1.bid > record2.bid end);		},		BidPer =		{			title = _AUCT("UiBidPerHeader");			dataType = "Money";			valueFunc = (function(record) return record.bidPer end);			alphaFunc = AuctionFramePost_GetItemAlpha;			compareAscendingFunc = (function(record1, record2) return record1.bidPer < record2.bidPer end);			compareDescendingFunc = (function(record1, record2) return record1.bidPer > record2.bidPer end);		},		Buyout =		{			title = _AUCT("UiBuyoutHeader");			dataType = "Money";			valueFunc = (function(record) return record.buyout end);			alphaFunc = AuctionFramePost_GetItemAlpha;			compareAscendingFunc = (function(record1, record2) return record1.buyout < record2.buyout end);			compareDescendingFunc = (function(record1, record2) return record1.buyout > record2.buyout end);		},		BuyoutPer =		{			title = _AUCT("UiBuyoutPerHeader");			dataType = "Money";			valueFunc = (function(record) return record.buyoutPer end);			alphaFunc = AuctionFramePost_GetItemAlpha;			compareAscendingFunc = (function(record1, record2) return record1.buyoutPer < record2.buyoutPer end);			compareDescendingFunc = (function(record1, record2) return record1.buyoutPer > record2.buyoutPer end);		},	};	-- Configure the physical columns	this.physicalColumns =	{		{			width = 50;			logicalColumn = this.logicalColumns.Quantity;			logicalColumns = { this.logicalColumns.Quantity };			sortAscending = true;		},		{			width = 210;			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			};			sortAscending = true;		},		{			width = 130;			logicalColumn = this.logicalColumns.Buyout;			logicalColumns =			{				this.logicalColumns.Buyout,				this.logicalColumns.BuyoutPer			};			sortAscending = true;		},	};	this.auctions = {};	ListTemplate_Initialize(this.auctionList, this.physicalColumns, this.logicalColumns);	ListTemplate_SetContent(this.auctionList, this.auctions);	this:ValidateAuction();end--------------------------------------------------------------------------------------------------------------------------------------------------------------function AuctionFramePost_UpdatePriceModels(frame)	if (not frame.updating) then		frame.prices = {};		local name = frame:GetItemName();		local count = frame:GetStackSize();		if (name and count) then			local bag, slot, id, rprop, enchant, uniq = EnhTooltip.FindItemInBags(name);			local itemKey = id..":"..rprop..":"..enchant;			local hsp, histCount, market, warn, nexthsp, nextwarn = Auctioneer.Statistic.GetHSP(itemKey, Auctioneer.Util.GetAuctionKey());			-- Get the fixed price			if (Auctioneer.Storage.GetFixedPrice(itemKey)) then				local startPrice, buyPrice = Auctioneer.Storage.GetFixedPrice(itemKey, count);				local fixedPrice = {};				fixedPrice.text = _AUCT('UiPriceModelFixed');				fixedPrice.note = "";				fixedPrice.bid = startPrice;				fixedPrice.buyout = buyPrice;				table.insert(frame.prices, fixedPrice);			end			-- Calculate auctioneer's suggested resale price.			if (hsp == 0) then				local auctionPriceItem = Auctioneer.Core.GetAuctionPriceItem(itemKey, Auctioneer.Util.GetAuctionKey());				local aCount,minCount,minPrice,bidCount,bidPrice,buyCount,buyPrice = Auctioneer.Core.GetAuctionPrices(auctionPriceItem.data);				hsp = math.floor(buyPrice / buyCount); -- use mean buyout if median not available			end			local discountBidPercent = tonumber(Auctioneer.Command.GetFilterVal('pct-bidmarkdown'));			local auctioneerPrice = {};			auctioneerPrice.text = _AUCT('UiPriceModelAuctioneer');			auctioneerPrice.note = warn;			auctioneerPrice.buyout = Auctioneer.Statistic.RoundDownTo95(Auctioneer.Util.NullSafe(hsp) * count);			auctioneerPrice.bid = Auctioneer.Statistic.RoundDownTo95(Auctioneer.Statistic.SubtractPercent(auctioneerPrice.buyout, discountBidPercent));			table.insert(frame.prices, auctioneerPrice);			-- Add the fallback custom price			local customPrice = {}			customPrice.text = _AUCT('UiPriceModelCustom');			customPrice.note = "";			customPrice.bid = nil;			customPrice.buyout = nil;			table.insert(frame.prices, customPrice);			-- Update the price model combo.			local dropdown = getglobal(frame:GetName().."PriceModelDropDown");			local index = UIDropDownMenu_GetSelectedID(dropdown);			if (index == nil) then				index = 1;			end			AuctionFramePost_PriceModelDropDownItem_SetSelectedID(dropdown, index);		else			-- Update the price model combo.			local dropdown = getglobal(frame:GetName().."PriceModelDropDown");			AuctionFramePost_PriceModelDropDownItem_SetSelectedID(dropdown, nil);		end	endend--------------------------------------------------------------------------------- Updates the content of the auction list based on the current auction item.-------------------------------------------------------------------------------function AuctionFramePost_UpdateAuctionList(frame)	frame.auctions = {};	local itemName = frame:GetItemName();	if (itemName) then		local auctions = Auctioneer.Filter.QuerySnapshot(AuctionFramePost_ItemNameFilter, itemName);		if (auctions) then			for _,a in pairs(auctions) do				local id,rprop,enchant,name,count,min,buyout,uniq = Auctioneer.Core.GetItemSignature(a.signature);				local auction = {};				auction.item = string.format("item:%s:%s:%s:0", id, enchant, rprop);				auction.quantity = count;				auction.name = itemName;				auction.owner = a.owner;				auction.timeLeft = a.timeLeft;				auction.bid = Auctioneer.Statistic.GetCurrentBid(a.signature);				auction.bidPer = math.floor(auction.bid / auction.quantity);				auction.buyout = buyout;				auction.buyoutPer = math.floor(auction.buyout / auction.quantity);				table.insert(frame.auctions, auction);			end		end	end	ListTemplate_SetContent(frame.auctionList, frame.auctions);	ListTemplate_Sort(frame.auctionList, 5);end--------------------------------------------------------------------------------- Updates the deposit value.-------------------------------------------------------------------------------function AuctionFramePost_UpdateDeposit(frame)	if (not frame.updating) then		local itemID = frame:GetItemID();		local duration = frame:GetDuration();		local stackSize = frame:GetStackSize();		local stackCount = frame:GetStackCount();		if (itemID) then			local deposit = AuctionFramePost_CalculateAuctionDeposit(itemID, stackSize, duration);			if (deposit) then				MoneyFrame_Update(frame.depositMoneyFrame:GetName(), deposit * stackCount);				frame.depositMoneyFrame:Show();				frame.depositErrorLabel:Hide();

⌨️ 快捷键说明

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