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

📄 aucutil.lua

📁 时间太紧了
💻 LUA
📖 第 1 页 / 共 2 页
字号:
	loadCategoryClasses(GetAuctionItemClasses());endfunction loadCategoryClasses(...)	for c=1, arg.n, 1 do		AuctionConfig.classes[c] = {};		AuctionConfig.classes[c].name = arg[c];		loadCategorySubClasses(c, GetAuctionItemSubClasses(c));	endendfunction loadCategorySubClasses(c, ...)	for s=1, arg.n, 1 do		AuctionConfig.classes[c][s] = arg[s];	endendfunction chatPrint(text, cRed, cGreen, cBlue, cAlpha, holdTime)	local frameIndex = Auctioneer.Command.GetFrameIndex();	if (cRed and cGreen and cBlue) then		if getglobal("ChatFrame"..frameIndex) then			getglobal("ChatFrame"..frameIndex):AddMessage(text, cRed, cGreen, cBlue, cAlpha, holdTime);		elseif (DEFAULT_CHAT_FRAME) then			DEFAULT_CHAT_FRAME:AddMessage(text, cRed, cGreen, cBlue, cAlpha, holdTime);		end	else		if getglobal("ChatFrame"..frameIndex) then			getglobal("ChatFrame"..frameIndex):AddMessage(text, 0.0, 1.0, 0.25);		elseif (DEFAULT_CHAT_FRAME) then			DEFAULT_CHAT_FRAME:AddMessage(text, 0.0, 1.0, 0.25);		end	endendfunction setFilterDefaults()	if (not AuctionConfig.filters) then		AuctionConfig.filters = {};	end	for k,v in ipairs(Auctioneer.Core.Constants.FilterDefaults) do		if (AuctionConfig.filters[k] == nil) then			AuctionConfig.filters[k] = v;		end	endend-- Pass true to protect the Auction Frame from being undesireably closed, not true to disable thisfunction protectAuctionFrame(enable)	--Make sure we have an AuctionFrame before doing anything	if (AuctionFrame) then		--Handle enabling of protection		if (enable and not Auctioneer_ProtectionEnabled and AuctionFrame:IsShown()) then			--Remember that we are now protecting the frame			Auctioneer_ProtectionEnabled = true;			--If the frame is the current doublewide frame, then clear the doublewide			if ( GetDoublewideFrame() == AuctionFrame ) then				SetDoublewideFrame(nil)			end			--Remove the frame from the UI frame handling system			UIPanelWindows["AuctionFrame"] = nil			--If mobile frames is around, then remove AuctionFrame from Mobile Frames handling system			if (MobileFrames_UIPanelWindowBackup) then				MobileFrames_UIPanelWindowBackup.AuctionFrame = nil;			end			if (MobileFrames_UIPanelsVisible) then				MobileFrames_UIPanelsVisible.AuctionFrame = nil;			end			--Hook the function to show the WorldMap, WorldMap has internal code that forces all these frames to close			--so for it, we have to prevent it from showing at all			if (not Auctioneer_ToggleWorldMap) then				Auctioneer_ToggleWorldMap = ToggleWorldMap;			end			ToggleWorldMap = function ()				if ( ( not Auctioneer_ProtectionEnabled ) or ( not ( AuctionFrame and AuctionFrame:IsVisible() ) ) ) then					Auctioneer_ToggleWorldMap();				else					UIErrorsFrame:AddMessage(_AUCT('GuiNoWorldMap'), 0, 1, 0, 1.0, UIERRORS_HOLD_TIME)				end			end		elseif (Auctioneer_ProtectionEnabled) then			--Handle disabling of protection			Auctioneer_ProtectionEnabled = nil;			--If Mobile Frames is around, then put the frame back under its control if it is proper to do so			if ( MobileFrames_UIPanelWindowBackup and MobileFrames_MasterEnableList and MobileFrames_MasterEnableList["AuctionFrame"] ) then				MobileFrames_UIPanelWindowBackup.AuctionFrame = { area = "doublewide", pushable = 0 };				if ( MobileFrames_UIPanelsVisible and AuctionFrame:IsVisible() ) then					MobileFrames_UIPanelsVisible.AuctionFrame = 0;				end			else				--Put the frame back into the UI frame handling system				UIPanelWindows["AuctionFrame"] = { area = "doublewide", pushable = 0 };				if ( AuctionFrame:IsVisible() ) then					SetDoublewideFrame(AuctionFrame)				end			end		end	endendfunction priceForOne(price, count)	price = nullSafe(price)	count = math.max(nullSafe(count), 1)	return math.ceil(price / count)endfunction round(x)	local y = math.floor(x);	if (x - y >= 0.5) then		return y + 1;	end	return y;end--------------------------------------------------------------------------------- Localization functions-------------------------------------------------------------------------------Auctioneer.Command.CommandMap = nil;Auctioneer.Command.CommandMapRev = nil;function delocalizeFilterVal(value)	if (value == _AUCT('CmdOn')) then		return 'on';	elseif (value == _AUCT('CmdOff')) then		return 'off';	elseif (value == _AUCT('CmdDefault')) then		return 'default';	elseif (value == _AUCT('CmdToggle')) then		return 'toggle';	else		return value;	endendfunction localizeFilterVal(value)	local result	if (value == 'on') then		result = _AUCT('CmdOn');	elseif (value == 'off') then		result = _AUCT('CmdOff');	elseif (value == 'default') then		result = _AUCT('CmdDefault');	elseif (value == 'toggle') then		result = _AUCT('CmdToggle');	end	if (result) then return result; else return value; endendfunction getLocalizedFilterVal(key)	return localizeFilterVal(Auctioneer.Command.GetFilterVal(key))end-- Turns a localized slash command into the generic English version of the commandfunction delocalizeCommand(cmd)	if (not Auctioneer.Command.CommandMap) then Auctioneer.Command.BuildCommandMap();end	local result = Auctioneer.Command.CommandMap[cmd];	if (result) then return result; else return cmd; endend-- Translate a generic English slash command to the localized version, if availablefunction localizeCommand(cmd)	if (not Auctioneer.Command.CommandMapRev) then Auctioneer.Command.BuildCommandMap(); end	local result = Auctioneer.Command.CommandMapRev[cmd];	if (result) then return result; else return cmd; endend--------------------------------------------------------------------------------- Inventory modifying functions-------------------------------------------------------------------------------function findEmptySlot()	local name, i	for bag = 0, 4 do		name = GetBagName(bag)		i = string.find(name, '(Quiver|Ammo|Bandolier)')		if not i then			for slot = 1, GetContainerNumSlots(bag),1 do				if not (GetContainerItemInfo(bag,slot)) then					return bag, slot;				end			end		end	endendfunction containerFrameItemButtonOnClick(hookParams, returnValue, button, ignoreShift) --Auctioneer_ContainerFrameItemButton_OnClick	local bag = this:GetParent():GetID()	local slot = this:GetID()	local texture, count, noSplit = GetContainerItemInfo(bag, slot)	local link = GetContainerItemLink(bag, slot)	if (count and count > 1 and not noSplit) then		if (button == "RightButton") and (IsControlKeyDown()) then			local splitCount = math.floor(count / 2)			local emptyBag, emptySlot = findEmptySlot()			if (emptyBag) then				SplitContainerItem(bag, slot, splitCount)				PickupContainerItem(emptyBag, emptySlot)			else				chatPrint("Can't split, all bags are full")			end			return "abort";		end	end	if (AuctionFrame and AuctionFrame:IsVisible()) then		if (link) then			if (button == "RightButton") and (IsAltKeyDown()) then				AuctionFrameTab_OnClick(1)				local itemID = EnhTooltip.BreakLink(link)				if (itemID) then					local itemName = GetItemInfo(tostring(itemID))					if (itemName) then						BrowseName:SetText(itemName)						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()						BrowseNoResultsText:SetText(BROWSE_NO_RESULTS)					end				end				return "abort";			end		end	end	if (not CursorHasItem() and AuctionFrameAuctions and AuctionFrameAuctions:IsVisible() and IsAltKeyDown()) then		PickupContainerItem(bag, slot)		if (CursorHasItem() and Auctioneer.Command.GetFilter('auction-click')) then			ClickAuctionSellItemButton()			AuctionsFrameAuctions_ValidateAuction()			local start = MoneyInputFrame_GetCopper(StartPrice)			local buy = MoneyInputFrame_GetCopper(BuyoutPrice)			local duration = AuctionFrameAuctions.duration			local warn = AuctionInfoWarnText:GetText()			if (AuctionsCreateAuctionButton:IsEnabled() and IsShiftKeyDown()) then				warn = ("|c"..getWarnColor(warn)..warn.."|r")				StartAuction(start, buy, duration);				chatPrint(string.format(_AUCT('FrmtAutostart'), link, EnhTooltip.GetTextGSC(start), EnhTooltip.GetTextGSC(buy), duration/60, warn));			end			return "abort";		end	end	if (not CursorHasItem() and AuctionFramePost and AuctionFramePost:IsVisible() and button == "LeftButton" and IsAltKeyDown()) then		local _, count = GetContainerItemInfo(bag, slot);		if (count) then			if (count > 1 and IsShiftKeyDown()) then				this.SplitStack = function(button, split)					local _, _, _, _, name = EnhTooltip.BreakLink(link);					AuctionFramePost:SetAuctionItem(bag, slot, split);				end				OpenStackSplitFrame(count, this, "BOTTOMRIGHT", "TOPRIGHT");			else				local _, _, _, _, name = EnhTooltip.BreakLink(link);				AuctionFramePost:SetAuctionItem(bag, slot, 1);			end			return "abort";		end	endendAuctioneer.Util = {	GetTimeLeftString = getTimeLeftString,	GetSecondsLeftString = getSecondsLeftString,	GetGSC = getGSC,	GetTextGSC = getTextGSC,	NilSafeString = nilSafeString,	ColorTextWhite = colorTextWhite,	GetWarnColor = getWarnColor,	NullSafe = nullSafe,	SanifyAHSnapshot = sanifyAHSnapshot,	GetAuctionKey = getAuctionKey,	GetOppositeKey = getOppositeKey,	GetNeutralKey = getNeutralKey,	GetHomeKey = getHomeKey,	IsValidAlso = isValidAlso,	BreakItemKey = breakItemKey,	Split = split,	FindClass = findClass,	GetCatName = getCatName,	GetCatNumberByName = getCatNumberByName,	GetCatForKey = getCatForKey,	GetKeyFromSig = getKeyFromSig,	GetCatForSig = getCatForSig,	GetItemLinks = getItemLinks,	GetItems = getItems,	GetItemHyperlinks = getItemHyperlinks,	LoadCategories = loadCategories,	LoadCategoryClasses = loadCategoryClasses,	LoadCategorySubClasses = loadCategorySubClasses,	ChatPrint = chatPrint,	SetFilterDefaults = setFilterDefaults,	ProtectAuctionFrame = protectAuctionFrame,	PriceForOne = priceForOne,	Round = round,	DelocalizeFilterVal = delocalizeFilterVal,	LocalizeFilterVal = localizeFilterVal,	GetLocalizedFilterVal = getLocalizedFilterVal,	DelocalizeCommand = delocalizeCommand,	LocalizeCommand = localizeCommand,	FindEmptySlot = findEmptySlot,	ContainerFrameItemButtonOnClick = containerFrameItemButtonOnClick,}

⌨️ 快捷键说明

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