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

📄 tooltip.lua

📁 时间太紧了
💻 LUA
📖 第 1 页 / 共 4 页
字号:
--[[Additional function hooks to allow hooks into more tooltips3.5.0.0908 (Platypus)$Id: Tooltip.lua 867 2006-05-18 20:46:57Z mentalpower $You should hook into EnhTooltip using Stubby:	Stubby.RegisterFunctionHook("EnhTooltip.HOOK", 200, myHookingFunction)	Where myHooking function is one of your functions (see calling parameters below)	And HOOK is one of:		addTooltip		checkPopup		merchantHook		tradeHook		bankHook		bagHook	The number 200 is a number that determines calling order		A lower number will make your tooltip information display earlier (higher)		A higher number will call your tooltip later (lower)		Auctioneer (if installed) gets called at position 100.		Informant  (if installed) gets called at position 300.		Enchantrix (if installed) gets called at position 400.	The appropriate function calls are, respectively:		tooltip - A tooltip is being displayed, hookFunc will be called as:		addTooltipHook(frame, name, link, quality, count, price)		popup - A tooltip may be displayed, unless you want to popup something:		popped = checkPopupHook(name, link, quality, count, price, hyperlink)			If your function returns true, then we won't present a tooltip		merchant - Get called for each of a merchant's items.		merchantHook(frame, name, link, quality, count, price)		trade - Get called when a tradeskill window is displayed / item selected		tradeHook(type, selid)			valid types: 'trade', 'craft'			selID will be nil when the window is first displayed		bank - You are at the bank and are able to scan it's containers			bankHook()		bag - One or more of the items in your bags has updated.			bagHook()You may use the following methods of the EnhTooltip class:	EnhTooltip.HideTooltip()		Causes the enhanced tooltip to vanish.	EnhTooltip.ClearTooltip()		Clears the current tooltip of contents and hides it.	EnhTooltip.GetGSC(money)		Returns the given money (in copper) amount in gold, silver and copper.	EnhTooltip.GetTextGSC(money, exact)		Returns the money (in copper) amount as colored text, suitable for display.		If exact evaluates to true, then the text will be exact, otherwise rounded.	EnhTooltip.AddLine(lineText, moneyAmount, embed)		Adds the lineText to the tooltip.		If moneyAmount is supplied, the line has a money amount right-aligned after it.		It embed evaluates to true, then the line is placed at the end of the game tooltip		and the money amount is converted to a textual form.	EnhTooltip.AddSeparator()		Adds an empty line to the tooltip.	EnhTooltip.LineColor(r, g, b)		Changes the color of the most recently added line to the given R,G,B value.		The R,G,B values are floating point values from 0.0 (dark) to 1.0 (bright)	EnhTooltip.LineSize_Large()		Changes the size of the font string to 12	EnhTooltip.LineSize_Small()		Changes the size of the font string to 10	EnhTooltip.LineQuality(quality)		Changes the color of the most recently added line to the quality color of the		item that is supplied in the quality parameter.	EnhTooltip.SetIcon(iconPath)		Adds an icon to the current tooltip, where the texture path is set to that of		the iconPath parameter.	EnhTooltip.NameFromLink(link)		Given a link, returns the embedded item name.	EnhTooltip.HyperlinkFromLink(link)		Given a link, returns the blizzard hyperlink (eg: "item:12345:0:321:0")	EnhTooltip.BaselinkFromLink(link)		Given a link, returns the first 3 numbers from the item link (eg: "12345:0:321")	EnhTooltip.QualityFromLink(link)		Given a link, returns the numerical quality value (0=Poor/Gray ... 4=Epic/Purple)	EnhTooltip.FakeLink(hyperlink, quality, name)		Given a hyperlink, a numerical quality and an item name, does it's best to fabricate		as authentic a link as it can. This link may not be suitable for messaging however.	EnhTooltip.LinkType(link)		Given a link, returns the type of link (eg: "item", "enchant")	EnhTooltip.AddHook(hookType, hookFunc, position)		Allows dependant addons to register a function for inclusion at key moments.		Where:			hookType = The type of event to be notified of. One of:				tooltip - A tooltip is being displayed, hookFunc will be called as:				addTooltipHook(frame, name, link, quality, count, price)				popup - A tooltip may be displayed, unless you want to popup something:				popped = checkPopupHook(name, link, quality, count, price, hyperlink)					If your function returns true, then we won't present a tooltip				merchant - Get called for each of a merchant's items.				merchantHook(frame, name, link, quality, count, price)				trade - Get called when a tradeskill window is displayed / item selected				tradeHook(type, selid)					valid types: 'trade', 'craft'					selID will be nil when the window is first displayed				bank - You are at the bank and are able to scan it's containers				bankHook()				bag - One or more of the items in your bags has updated.					bagHook()			hookFunction = Your function (prototyped as above) that we will call.			position = A number that determines calling order				The default position if not supplied is 100.				A lower number will make your tooltip information display earlier (higher)				A higher number will call your tooltip later (lower)				Auctioneer (if installed) gets called at position 50.				Enchantrix (if installed) gets called at position 150.	EnhTooltip.BreakLink(link)		Given an item link, splits it into it's component parts as follows:			itemID, randomProperty, enchantment, uniqueID, itemName = EnhTooltip.BreakLink(link)			Note that the return order is not the same as the order of the items in the link			(ie: randomProp and enchant are reversed from their link order)	EnhTooltip.FindItemInBags(findName)		Searches through your bags to find an item with the given name (exact match)		It returns the following information about the item:			bag, slot, itemID, randomProp, enchant, uniqID = EnhTooltip.FindItemInBags(itemName)	EnhTooltip.SetElapsed(elapsed)		If a value is given, adds the elapsed interval to our own internal timer.			Checks to see if it is time to hide the tooltip.		Returns the total elapsed time that the tooltip has been displayed since startup.	EnhTooltip.SetMoneySpacing(spacing)		Sets the amount of padding (if provided) that money should be given in the tooltips.		Returns the current spacing.	EnhTooltip.SetPopupKey(key)		Sets a key (if provided), which if pressed while a tooltip is being displayed, checks			for hooked functions that may wish to provide popups.		Returns the current key.	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 GLP.txt); if not, write to the Free Software		Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.]]-- setting version numberENHTOOLTIP_VERSION = "3.5.0.0908"if (ENHTOOLTIP_VERSION == "<".."%version%>") then	ENHTOOLTIP_VERSION = "3.5.DEV"end--[[---- Initialize a storage space that all our functions can see--]]local self = {	showIgnore = false,	moneySpacing = 4,	embedLines = {},	eventTimer = 0,	hideTime = 0,	currentGametip = nil,	currentItem = nil,	forcePopupKey = "alt",	oldChatItem = nil,	hooks = {},	notify = { tooltip = {}, popup = {}, merchant = {}, bank = {}, bag = {}, trade = {} },	notifyFuncs = {},}-- =============== LOCAL FUNCTIONS =============== ---- prototypes for all local functionslocal addLine					-- AddLine(lineText,moneyAmount,embed)local addSeparator				-- AddSeparator(embed)local addTooltip				-- AddTooltip(frame,name,link,quality,count,price)local afHookOnEnter				-- AfHookOnEnter(type,index)local bagHook					-- BagHook()local bankHook					-- BankHook()local baselinkFromLink			-- BaselinkFromLink(link)local breakLink					-- BreakLink(link)local callBagHook				-- CallBagHook(event,bagNumber)local callBankHook				-- CallBankHook()local callCheckPopup			-- CallCheckPopup(name,link,quality,count,price,hyperlink)local callTradeHook				-- CallTradeHook(type,event,selID)local cfHookUpdate				-- CfHookUpdate(frame)local chatHookOnHyperlinkShow	-- ChatHookOnHyperlinkShow(reference,link,button)local checkHide					-- CheckHide()local checkPopup				-- CheckPopup(name,link,quality,count,price,hyperlink)local clearTooltip				-- ClearTooltip()local debugPrint				-- DebugPrint(...)local doHyperlink				-- DoHyperlink(reference,link,button)local embedRender				-- EmbedRender()local fakeLink					-- FakeLink(hyperlink,quality,name)local findItemInBags			-- FindItemInBags(findName)local getglobalIterator			-- GetglobalIterator(format,first,last)local getGSC					-- GetGSC(money)local getLootLinkLink			-- GetLootLinkLink(name)local getLootLinkServer			-- GetLootLinkServer()local getRect					-- GetRect(object,curRect)local getTextGSC				-- GetTextGSC(money,exact)local gtHookOnHide				-- GtHookOnHide()local gtHookSetAuctionSellItem	-- GtHookSetAuctionSellItem(frame)local gtHookSetBagItem			-- GtHookSetBagItem(frame,frameID,buttonID,retVal)local gtHookSetCraftItem		-- GtHookSetCraftItem(frame,skill,slot)local gtHookSetCraftSpell		-- GtHookSetCraftSpell(frame,skill,slot)local gtHookSetInboxItem		-- GtHookSetinboxItem(frame,index)local gtHookSetInventoryItem	-- GtHookSetInventoryItem(frame,unit,slot,retVal)local gtHookSetLootItem			-- GtHookSetLootItem(frame,slot)local gtHookSetMerchantItem		-- GtHookSetMerchantItem(frame,slot)local gtHookSetOwner			-- GtHookSetOwner(frame,owner,anchor)local gtHookSetQuestItem		-- GtHookSetQuestItem(frame,qtype,slot)local gtHookSetQuestLogItem		-- GtHookSetQuestLogItem(frame,qtype,slot)local gtHookSetTradeSkillItem	-- GtHookSetTradeSkillItem(frame,skill,slot)local gtHookSetText				-- GtHookSetText(funcArgs, retval, frame, text, r, g, b, unknown1, unknown2)local gtHookAppendText			-- GtHookAppendText(funcArgs, retVal, frame)local gtHookShow				-- GtHookShow(funcArgs, retVal, frame)local hideTooltip				-- HideTooltip()local hyperlinkFromLink			-- HyperlinkFromLink(link)local imHookOnEnter				-- ImHookOnEnter()local imiHookOnEnter			-- ImiHookOnEnter()local lineColor					-- LineColor(r,g,b)local lineQuality				-- LineQuality(quality)local lineSize_Large			-- LineSize_Large()local lineSize_Small			-- LineSize_Small()local linkType					-- LinkType()local llHookOnEnter				-- LlHookOnEnter()local merchantHook				-- MerchantHook(merchant,slot,name,link,quality,count,price,limit)local merchantScanner			-- MerchantScanner()local nameFromLink				-- NameFromLink(link)local qualityFromLink			-- QualityFromLink(link)local setElapsed				-- SetElapsed(elapsed)local setIcon					-- SetIcon(iconPath)local setMoneySpacing			-- SetMoneySpacing(spacing)local setPopupKey				-- SetPopupKey(key)local showTooltip				-- ShowTooltip(currentTooltip,skipEmbedRender)local tooltipCall				-- TooltipCall(frame,name,link,quality,count,price,forcePopup,hyperlink)local tradeHook					-- TradeHook(type,selID)local ttInitialize				-- TtInitialize()--------------------------  Hookable functions------------------------function addTooltip(frame, name, link, quality, count, price)	-- This is it.	-- Hook this function when you have something to put into the	-- tooltip and use the AddLine etc methods to do so.endfunction checkPopup(name, link, quality, count, price, hyperlink)	-- Hook this function to stop EnhTooltip putting up a tooltip	-- Return true to stop EnhTooltip's tooltip.endfunction merchantHook(merchant, slot, name, link, quality, count, price, limit)	-- Hook this function to be notified of an item at a merchantendfunction bankHook()	-- Hook this function to be alerted to do a bank scanendfunction bagHook()	-- Hook this function to be alerted to do a bag scanendfunction tradeHook(type,selID)	-- Hook this function to be notified when a trade window is	-- displayed or an item therein is selected.	--   type is one of: "trade", or "craft"	--   selID can be nil when first opened, or the id of the selected item.end-------------------------- Function definitions------------------------function hideTooltip()	EnhancedTooltip:Hide()	self.currentItem = ""	self.hideTime = 0end-- Iterate over numbered global objectsfunction getglobalIterator(fmt, first, last)	local i = tonumber(first) or 1	return function()		if last and (i > last) then			return		end		local obj = getglobal(string.format(fmt, i))		i = i + 1		return obj	endendfunction clearTooltip()	hideTooltip()	EnhancedTooltip.hasEmbed = false	EnhancedTooltip.curEmbed = false	EnhancedTooltip.hasData = false	EnhancedTooltip.hasIcon = false	EnhancedTooltipIcon:Hide()	EnhancedTooltipIcon:SetTexture("Interface\\Buttons\\UI-Quickslot2")	for ttText in getglobalIterator("EnhancedTooltipText%d") do		ttText:Hide()		ttText:SetTextColor(1.0,1.0,1.0)		ttText:SetFont(STANDARD_TEXT_FONT, 15);	end	for ttMoney in getglobalIterator("EnhancedTooltipMoney%d") do		ttMoney.myLine = nil		ttMoney:Hide()	end	EnhancedTooltip.lineCount = 0	EnhancedTooltip.moneyCount = 0	EnhancedTooltip.minWidth = 0	for curLine in self.embedLines do		self.embedLines[curLine] = nil;	end	table.setn(self.embedLines, 0);endfunction getRect(object, curRect)	local rect = curRect	if (not rect) then		rect = {}	end	rect.t = object:GetTop() or 0	rect.l = object:GetLeft() or 0	rect.b = object:GetBottom() or 0	rect.r = object:GetRight() or 0	rect.w = object:GetWidth() or 0	rect.h = object:GetHeight() or 0	rect.cx = rect.l + (rect.w / 2)	rect.cy = rect.t - (rect.h / 2)	return rectend

⌨️ 快捷键说明

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