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

📄 auccore.lua

📁 时间太紧了
💻 LUA
📖 第 1 页 / 共 2 页
字号:
	if (auctionItem) then		buyoutHistory = auctionItem.buyoutPricesHistoryList;	end	return buyoutHistory;end-- Returns the parsed auction price datafunction getAuctionPrices(priceData)	if (not priceData) then return 0,0,0,0,0,0,0 end	local i,j, count,minCount,minPrice,bidCount,bidPrice,buyCount,buyPrice = string.find(priceData, "^(%d+):(%d+):(%d+):(%d+):(%d+):(%d+):(%d+)");	return Auctioneer.Util.NullSafe(count),Auctioneer.Util.NullSafe(minCount),Auctioneer.Util.NullSafe(minPrice),Auctioneer.Util.NullSafe(bidCount),Auctioneer.Util.NullSafe(bidPrice),Auctioneer.Util.NullSafe(buyCount),Auctioneer.Util.NullSafe(buyPrice);end-- Parse the data from the auction signaturefunction getItemSignature(sigData)	if (not sigData) then return nil end	for id,rprop,enchant,name,count,min,buyout,uniq in string.gfind(sigData, "(%d+):(%d+):(%d+):(.-):(%d+):(.-):(%d+):(.+)") do		if (name == nil) then name = ""; end		return tonumber(id),tonumber(rprop),tonumber(enchant),name,tonumber(count),tonumber(min),tonumber(buyout),tonumber(uniq);	end	return nil;end-- Returns the category i.e. 1, 2 for an itemfunction getItemCategory(itemKey)	local category;	local auctionItem = getAuctionPriceItem(itemKey);	if auctionItem then		category = auctionItem.category;	end	return category;endfunction isPlayerMade(itemKey, itemData)	if (not itemData) and (Informant) then		local itemID, itemRand, enchant = Auctioneer.Util.BreakItemKey(itemKey)		itemData = Informant.GetItem(itemID)	end	local reqSkill = 0	local reqLevel = 0	if (itemData) then		reqSkill = itemData.reqSkill		reqLevel = itemData.reqLevel	end	return (reqSkill ~= 0), reqSkill, reqLevelendfunction getInfo(itemKey)	if (not AuctionConfig.info[itemKey]) then return {}; end	local info = AuctionConfig.info[itemKey];	local infosplit = Auctioneer.Util.Split(info, "|");	local cat = tonumber(infosplit[1]);	local name = infosplit[2];	return {		category = cat,		name = name,	};endfunction getSnapshot(auctKey, catID, auctSig)	if (not catID) then catID = 0 end	if (not AuctionConfig.snap[auctKey]) then		AuctionConfig.snap[auctKey] = {};	end	if (not AuctionConfig.snap[auctKey][catID]) then		AuctionConfig.snap[auctKey][catID] = {};	end	if (not AuctionConfig.snap[auctKey][catID][auctSig]) then		return nil;	end	local snap = AuctionConfig.snap[auctKey][catID][auctSig];	return getSnapshotFromData(snap);endfunction getSnapshotFromData(snap)	if (not snap) then return nil end	for dirty,bid,level,quality,left,fseen,last,link,owner in string.gfind(snap, "(%d+);(%d+);(%d+);(%d+);(%d+);(%d+);(%d+);([^;]+);(.+)") do		return {			bidamount = tonumber(bid),			owner = owner,			dirty = dirty,			lastSeenTime = tonumber(last),			itemLink = link,			category = cat,			initialSeenTime = tonumber(fseen),			level = level,			timeLeft = tonumber(left),			quality = quality,		};	end	return nil;endfunction getSnapshotInfo(auctKey, itemKey)	if (not AuctionConfig.sbuy) then AuctionConfig.sbuy = {}; end	if (not AuctionConfig.sbuy[auctKey]) then AuctionConfig.sbuy[auctKey] = {}; end	if (not AuctionConfig.sbuy[auctKey][itemKey]) then return nil; end	local buy = AuctionConfig.sbuy[auctKey][itemKey];	return getSnapshotInfoFromData(buy);endfunction getSnapshotInfoFromData(buy)	local buysplit = loadMedianList(buy);	return {		buyoutPrices = buysplit,	};endfunction saveSnapshot(server, cat, sig, iData)	local bid = iData.bidamount;	local owner = iData.owner;	local dirty = iData.dirty;	local last = iData.lastSeenTime;	local link = iData.itemLink;	local fseen = iData.initialSeenTime;	local level = iData.level;	local left = iData.timeLeft;	local qual = iData.quality;	if (not cat) then cat = 0 end	if (not AuctionConfig.snap[server]) then		AuctionConfig.snap[server] = {};	end	if (not AuctionConfig.snap[server][cat]) then		AuctionConfig.snap[server][cat] = {};	end	if (dirty~=nil and bid~=nil and level~=nil and qual~=nil and left~=nil and fseen~=nil and last~=nil and link~=nil and owner~=nil) then		local saveData = string.format("%d;%d;%d;%d;%d;%d;%d;%s;%s", dirty, bid, level, qual, left, fseen, last, link, owner);		EnhTooltip.DebugPrint("Saving", server, cat, sig, "as", saveData);		AuctionConfig.snap[server][cat][sig] = saveData;		local itemKey = Auctioneer.Util.GetKeyFromSig(sig);		Auctioneer_Lowests = nil;		Auctioneer.Storage.SetSnapMed(server, itemKey, nil)	else		EnhTooltip.DebugPrint("Not saving", server, cat, sig, "because", dirty, bid, level, qual, left, fseen, last, link, owner);	endendfunction saveSnapshotInfo(server, itemKey, iData)	AuctionConfig.sbuy[server][itemKey] = storeMedianList(iData.buyoutPrices);	Auctioneer_Lowests = nil;	Auctioneer.Storage.SetSnapMed(server, itemKey, Auctioneer.Statistic.GetMedian(iData.buyoutPrices))endfunction addonLoaded()	-- Load the category and subcategory id's	Auctioneer.Util.LoadCategories();	Auctioneer.Util.SetFilterDefaults();	if (not AuctionConfig.version) then AuctionConfig.version = 30000; end	if (AuctionConfig.version < 30200) then		StaticPopupDialogs["CONVERT_AUCTIONEER"] = {			text = _AUCT('MesgConvert'),			button1 = _AUCT('MesgConvertYes'),			button2 = _AUCT('MesgConvertNo'),			OnAccept = function()				Auctioneer.Convert.Convert();			end,			OnCancel = function()				Auctioneer.Util.ChatPrint(_AUCT('MesgNotconverting'));			end,			timeout = 0,			whileDead = 1,			exclusive = 1		};		StaticPopup_Show("CONVERT_AUCTIONEER", "","");	end	-- Auto-convert to per-auctKey fixed prices	if (AuctionConfig.version == 30200) then		if (AuctionConfig.fixedprice) then			local fixedPrices = AuctionConfig.fixedprice;			for k, v in fixedPrices do				local i,j, start,buy,dur = string.find(v, "(%d+):(%d+):(%d+)");				fixedPrices[k] = string.format("%s:%s:%d:%s", start, buy, 1, dur)			end			AuctionConfig.fixedprice = { ["global"] = fixedPrices };		end		AuctionConfig.version = 30201	end	lockAndLoad();end-- This is the old (local) hookAuctionHouse() functionfunction hookAuctionHouse()	Stubby.RegisterEventHook("NEW_AUCTION_UPDATE", "Auctioneer", Auctioneer.Scanner.NewAuction);	Stubby.RegisterFunctionHook("AuctionFrame_Show", 200, Auctioneer.Scanner.AuctHouseShow);	Stubby.RegisterEventHook("AUCTION_HOUSE_CLOSED", "Auctioneer", Auctioneer.Scanner.AuctHouseClose);	Stubby.RegisterEventHook("AUCTION_ITEM_LIST_UPDATE", "Auctioneer", Auctioneer.Scanner.AuctHouseUpdate);	Stubby.RegisterFunctionHook("Auctioneer.Event.StartAuctionScan", 200, Auctioneer.Scanner.AuctionStartHook);	Stubby.RegisterFunctionHook("Auctioneer.Event.ScanAuction", 200, Auctioneer.Scanner.AuctionEntryHook);	Stubby.RegisterFunctionHook("Auctioneer.Event.FinishedAuctionScan", 200, Auctioneer.Scanner.FinishedAuctionScanHook);	Stubby.RegisterFunctionHook("StartAuction", 200, Auctioneer.Scanner.StartAuction)	Stubby.RegisterFunctionHook("PlaceAuctionBid", 200, Auctioneer.Scanner.PlaceAuctionBid)	Stubby.RegisterFunctionHook("FilterButton_SetType", 200, Auctioneer.Scanner.FilterButtonSetType);	Stubby.RegisterFunctionHook("AuctionFrameFilters_UpdateClasses", 200, Auctioneer.Scanner.AuctionFrameFiltersUpdateClasses);	Stubby.RegisterFunctionHook("AuctionsRadioButton_OnClick", 200, Auctioneer.Scanner.OnChangeAuctionDuration);endfunction lockAndLoad()	Stubby.RegisterFunctionHook("AuctionFrame_LoadUI", 200, Auctioneer.Scanner.ConfigureAH);	Stubby.RegisterFunctionHook("ContainerFrameItemButton_OnClick", -200, Auctioneer.Util.ContainerFrameItemButtonOnClick);	SLASH_AUCTIONEER1 = "/auctioneer";	SLASH_AUCTIONEER2 = "/auction";	SLASH_AUCTIONEER3 = "/auc";	SlashCmdList["AUCTIONEER"] = function(msg)		Auctioneer.Command.MainHandler(msg);	end	-- Rearranges elements in the AH window.	Auctioneer.Scanner.ConfigureAH();	--GUI Registration code added by MentalPower	Auctioneer.Command.Register();	--Init AskPrice	Auctioneer.AskPrice.Init();--[[	--Register Auctioneer with Babylonian	if not Babylonian.IsAddOnRegistered("Auctioneer") then		Babylonian.RegisterAddOn("Auctioneer", Auctioneer.Command.SetLocale);	end]]	Auctioneer.Util.ChatPrint(string.format(_AUCT('FrmtWelcome'), Auctioneer.Version), 0.8, 0.8, 0.2);endAuctioneer.Core = {	Variables = {},	Constants = {},	GetItemData = getItemData,	GetItemDataByID = getItemDataByID,	StoreMedianList = storeMedianList,	LoadMedianList = loadMedianList,	GetAuctionPriceItem = getAuctionPriceItem,	SaveAuctionPriceItem = saveAuctionPriceItem,	GetAuctionBuyoutHistory = getAuctionBuyoutHistory,	GetAuctionPrices = getAuctionPrices,	GetItemSignature = getItemSignature,	GetItemCategory = getItemCategory,	IsPlayerMade = isPlayerMade,	GetInfo = getInfo,	GetSnapshot = getSnapshot,	GetSnapshotFromData = getSnapshotFromData,	GetSnapshotInfo = getSnapshotInfo,	GetSnapshotInfoFromData = getSnapshotInfoFromData,	SaveSnapshot = saveSnapshot,	SaveSnapshotInfo = saveSnapshotInfo,	AddonLoaded = addonLoaded,	HookAuctionHouse = hookAuctionHouse,	LockAndLoad = lockAndLoad,}Auctioneer.Core.Variables = {	TotalAuctionsScannedCount = totalAuctionsScannedCount,	NewAuctionsCount = newAuctionsCount,	OldAuctionsCount = oldAuctionsCount,	DefunctAuctionsCount = defunctAuctionsCount,	SnapshotItemPrices = snapshotItemPrices,}Auctioneer.Core.Constants = {	MaxAllowedFormatInt = maxAllowedFormatInt,	TimeLeft = timeLeft,	Quality = quality,	MaxBuyoutHistorySize = maxBuyoutHistorySize,	MinProfitMargin = minProfitMargin,	DefaultCompeteLess = defaultCompeteLess,	MinBuyoutSeenCount = minBuyoutSeenCount,	MaxBuyoutPrice = maxBuyoutPrice,	MinPercentLessThanHSP = minPercentLessThanHSP,	MinProfitPricePercent = minProfitPricePercent,	MinBidPercent = minBidPercent,	BidBasedCategories = bidBasedCategories,	FilterDefaults = filterDefaults,}

⌨️ 快捷键说明

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