WoW:EnchantLink: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
m (catfix, Replaced: {{wowapitype}} → {{wowapitype}}<br>)
m (Move page script moved page EnchantLink to EnchantLink without leaving a redirect)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
{{wowapitype}}<br>
#REDIRECT [[API TYPE enchantLink]]
 
== enchantLink API Type (String) ==
 
enchantLinks are returned by several functions, e.g. [[API GetCraftItemLink|GetCraftItemLink]](), etc.
 
In essence, they are [[enchantString]]s with additional formatting to make in-game text controls display them as clickable hyperlinks. The same as [[itemString]]s are with [[itemLink]]s.
 
|cffffffff|Henchant:20024|h[Enchant Boots - Spirit]|h|r
 
Broken up in its components:
 
* <tt>"'''|cffffffff'''"</tt> &ndash; Colorizes the link with a white color (Enchant Boots - Spirit is a trainer recipe)
** The first two characters after pipe-c may be the alpha level, where <code>ff</code> is fully opaque.
** The next three sets of two characters represent the red, green, and blue levels, just like HTML.
* <tt>"'''|H'''"</tt> &ndash; "Hyperlink link data starts here"
* <tt>"'''enchant:20024'''"</tt> &ndash; Read more at [[enchantString]].
* <tt>"'''|h'''"</tt> &ndash; "End of link, text follows"
* <tt>"'''[Enchant Boots - Spirit]'''"</tt> &ndash; The actual text displayed
* <tt>"'''|h'''"</tt> &ndash; "End of hyperlink"
* <tt>"'''|r'''"</tt> &ndash; Restores color to normal
 
 
You can extract the enchantString from a given enchantLink with the following LUA-code:
 
local found, _, enchantString = string.find(enchantLink, "^|%x+|H(.+)|h%[.+%]")
 
 
EnchantLinks are also used in profession/craft links; for example:
 
|cffffffff|Henchant:44157|h[Engineering: Turbo-Charged Flying Machine]|h|r
 
where 44157 is the spellId used to create the product of crafting.

Latest revision as of 04:48, 15 August 2023