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

📄 auccore.lua

📁 时间太紧了
💻 LUA
📖 第 1 页 / 共 2 页
字号:
--[[	Auctioneer Addon for World of Warcraft(tm).	Version: 3.5.0.0917 (Platypus)	Revision: $Id: AucCore.lua 873 2006-05-21 09:32:02Z luke1410 $	Auctioneer core functions and variables.	Functions central to the major operation of Auctioneer.	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.]]--Local function prototypeslocal getItemData, getItemDataByID, storeMedianList, loadMedianList, getAuctionPriceItem, saveAuctionPriceItem, getAuctionBuyoutHistory, getAuctionPrices, getItemSignature, getItemCategory, isPlayerMade, getInfo, getSnapshot, getSnapshotFromData, getSnapshotInfo, getSnapshotInfoFromData, saveSnapshot, saveSnapshotInfo, addonLoaded, hookAuctionHouse, lockAndLoad;--Local variables-- Counter to count the total number of auctions scannedlocal totalAuctionsScannedCount = 0;local newAuctionsCount = 0;local oldAuctionsCount = 0;local defunctAuctionsCount = 0;-- Temp table that is copied into AHSnapshotItemPrices only when a scan fully completeslocal snapshotItemPrices = {};--Local constantslocal maxAllowedFormatInt = 2000000000; -- numbers much greater than this overflow when using format("%d") --MAX_ALLOWED_FORMAT_INT-- Auction time constants--Auctioneer.Core.Constants.TimeLeft.local timeLeft = {	Short = 1;		--TIME_LEFT_SHORT	Medium = 2;		--TIME_LEFT_MEDIUM	Long = 3;		--TIME_LEFT_LONG	VeryLong = 4;	--TIME_LEFT_VERY_LONG	Seconds = {		--TIME_LEFT_SECONDS		[0] = 0,		-- Could expire any second... the current bid is relatively accurate.		[1] = 1800,		-- If it disappears within 30 mins of last seing it, it was BO'd		[2] = 7200,		-- Ditto but for 2 hours.		[3] = 28800,	-- 8 hours.		[4] = 86400,	-- 24 hours.	}}-- Item quality constants--Auctioneer.Core.Constants.Qualitylocal quality = {	Legendary	=	5;	--QUALITY_LEGENDARY	Epic		=	4;	--QUALITY_EPIC	Rare		=	3;	--QUALITY_RARE	Uncommon	=	2;	--QUALITY_UNCOMMON	Common		=	1;	--QUALITY_COMMON	Poor		=	0;	--QUALITY_POOR}-- The maximum number of elements we store in our buyout prices history tablelocal maxBuyoutHistorySize = 35;-- Min median buyout price for an item to show up in the list of items below medianlocal minProfitMargin = 5000; --MIN_PROFIT_MARGIN-- Min median buyout price for an item to show up in the list of items below medianlocal defaultCompeteLess = 5; --DEFAULT_COMPETE_LESS-- Min times an item must be seen before it can show up in the list of items below medianlocal minBuyoutSeenCount = 5; --MIN_BUYOUT_SEEN_COUNT-- Max buyout price for an auction to display as a good deal itemlocal maxBuyoutPrice = 800000; --MAX_BUYOUT_PRICE-- The default percent less, only find auctions that are at a minimum this percent less than the medianlocal minPercentLessThanHSP = 60; -- 60% default --MIN_PERCENT_LESS_THAN_HSP-- The minimum profit/price percent that an auction needs to be displayed as a resellable auctionlocal minProfitPricePercent = 30; -- 30% default --MIN_PROFIT_PRICE_PERCENT-- The minimum percent of bids placed on an item to be considered an "in-demand" enough item to be traded, this is only applied to Weapons and Armor and Recipieslocal minBidPercent = 10; --MIN_BID_PERCENT-- categories that the brokers and HSP look at the bid data for--  1 = weapon--  2 = armor--  3 = container--  4 = dissipatable--  5 = tradeskillitems--  6 = projectile--  7 = quiver--  8 = recipe--  9 = reagence-- 10 = miscellaneouslocal bidBasedCategories = {[1]=true, [2]=true, [8]=true, [10]=true} --BID_BASED_CATEGORIES--[[ SavedVariables --]]AuctionConfig = {};			--Table that stores config settingsAuction_DoneItems = {};		--Table to keep a record of auction items that have been scannedAuctionBackup = {}			--Table to backup old data which can't be converted at onceAuctionConfig.version = 30200;-- Table to store our cached HSP values (since they're expensive to calculate)Auctioneer_HSPCache = {};Auctioneer_Lowests = {};-- Default filter configurationlocal filterDefaults = { --Auctioneer_FilterDefaults	["all"]						=	"on",	["autofill"]				=	"on",	["embed"]					=	"off",	["also"]					=	"off",	["auction-click"]			=	"on",	["show-link"]				=	"off",	["show-embed-blankline"]	=	"off",	["show-verbose"]			=	"on",	["show-stats"]				=	"on",	["show-average"]			=	"on",	["show-median"]				=	"on",	["show-suggest"]			=	"on",	["show-warning"]			=	"on",	["scan-class1"]				=	"on",	["scan-class2"]				=	"on",	["scan-class3"]				=	"on",	["scan-class4"]				=	"on",	["scan-class5"]				=	"on",	["scan-class6"]				=	"on",	["scan-class7"]				=	"on",	["scan-class8"]				=	"on",	["scan-class9"]				=	"on",	["scan-class10"]			=	"on",	["warn-color"]				=	"on",	["printframe"]				=	1,	["last-auction-duration"]	=	1440,	["auction-duration"]		=	3,	["protect-window"]			=	1,	["finish"]					=	0,	["pct-bidmarkdown"]			=	20,	["pct-markup"]				=	300,	["pct-maxless"]				=	30,	["pct-nocomp"]				=	2,	["pct-underlow"]			=	5,	["pct-undermkt"]			=	20,	["locale"]					=	"default",	--AskPrice related commands	["askprice"]				=	"on",	["askprice-vendor"]			=	"off",	["askprice-guild"]			=	"off",	["askprice-party"]			=	"off",	["askprice-smart"]			=	"off",	["askprice-trigger"]		=	"?",	["askprice-ad"]				=	"on",	-- Auction House tab UI	["bid-limit"]				=	1,	["update-price"]			=	"off",}function getItemData(itemKey)	local itemID, itemRand, enchant = Auctioneer.Util.BreakItemKey(itemKey);	if (Informant) then		return Informant.GetItem(itemID);	end	return nil;endfunction getItemDataByID(itemID)	if (Informant) then		return Informant.GetItem(itemID);	end	return nil;endfunction storeMedianList(list)	local hist = "";	local function GrowList(last, n)		if (n == 1) then			if (hist == "") then hist = last;			else hist = string.format("%s:%d", hist, last); end		elseif (n ~= 0) then			if (hist == "") then hist = string.format("%dx%d", last, n);			else hist = string.format("%s:%dx%d", hist, last, n); end		end	end	local n = 0;	local last = 0;	for pos, hPrice in pairs(list) do		if (pos == 1) then			last = hPrice;		elseif (hPrice ~= last) then			GrowList(last, n)			last = hPrice;			n = 0;		end		n = n + 1	end	GrowList(last, n)	return hist;endfunction loadMedianList(str)	local splut = {};	if (str) then		for x,c in string.gfind(str, '([^%:]*)(%:?)') do			local _,_,y,n = string.find(x, '(%d*)x(%d*)')			if (y == nil) then				table.insert(splut, tonumber(x));			else				for i = 1,n do					table.insert(splut, tonumber(y));				end			end			if (c == '') then break end		end	end	return splut;end-- Returns an AuctionConfig.data item from the table based on an item namefunction getAuctionPriceItem(itemKey, from)	local serverFaction;	local auctionPriceItem, data,info;	if (from ~= nil) then serverFaction = from;	else serverFaction = Auctioneer.Util.GetAuctionKey(); end;	EnhTooltip.DebugPrint("Getting data from/for", serverFaction, itemKey);	if (AuctionConfig.data == nil) then AuctionConfig.data = {}; end	if (AuctionConfig.info == nil) then AuctionConfig.info = {}; end	if (AuctionConfig.data[serverFaction] == nil) then		EnhTooltip.DebugPrint("Data from serverfaction is nil");		AuctionConfig.data[serverFaction] = {};	else		data = AuctionConfig.data[serverFaction][itemKey];		info = AuctionConfig.info[itemKey];	end	auctionPriceItem = {};	if (data) then		local dataItem = Auctioneer.Util.Split(data, "|");		auctionPriceItem.data = dataItem[1];		auctionPriceItem.buyoutPricesHistoryList = loadMedianList(dataItem[2]);	end	if (info) then		local infoItem = Auctioneer.Util.Split(info, "|");		auctionPriceItem.category = infoItem[1];		auctionPriceItem.name = infoItem[2];	end	local playerMade, reqSkill, reqLevel = isPlayerMade(itemKey);	auctionPriceItem.playerMade = playerMade;	auctionPriceItem.reqSkill = reqSkill;	auctionPriceItem.reqLevel = reqLevel;	return auctionPriceItem;endfunction saveAuctionPriceItem(auctKey, itemKey, iData)	if (not auctKey) then return end	if (not itemKey) then return end	if (not iData) then return end	if (not AuctionConfig.info) then AuctionConfig.info = {}; end	if (not AuctionConfig.data) then AuctionConfig.data = {}; end	if (not AuctionConfig.data[auctKey]) then AuctionConfig.data[auctKey] = {}; end	local hist = storeMedianList(iData.buyoutPricesHistoryList);	AuctionConfig.data[auctKey][itemKey] = string.format("%s|%s", iData.data, hist);	AuctionConfig.info[itemKey] = string.format("%s|%s", iData.category, iData.name);	Auctioneer_Lowests = nil;	-- save median to the savedvariablesfile	Auctioneer.Storage.SetHistMed(auctKey, itemKey, Auctioneer.Statistic.GetMedian(iData.buyoutPricesHistoryList))end-- Returns the auction buyout history for this itemfunction getAuctionBuyoutHistory(itemKey, auctKey)	local auctionItem = getAuctionPriceItem(itemKey, auctKey);	local buyoutHistory = {};

⌨️ 快捷键说明

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