WoW:EnchantLink: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
(initial documentation)
 
No edit summary
Line 25: Line 25:


  local found, _, enchantString = string.find(enchantLink, "^|%x+|H(.+)|h%[.+%]")
  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.

Revision as of 17:18, 16 February 2008

API types

enchantLink API Type (String)

enchantLinks are returned by several functions, e.g. GetCraftItemLink(), etc.

In essence, they are enchantStrings with additional formatting to make in-game text controls display them as clickable hyperlinks. The same as itemStrings are with itemLinks.

|cffffffff|Henchant:20024|h[Enchant Boots - Spirit]|h|r

Broken up in its components:

  • "|cffffffff" – 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 ff is fully opaque.
    • The next three sets of two characters represent the red, green, and blue levels, just like HTML.
  • "|H" – "Hyperlink link data starts here"
  • "enchant:20024" – Read more at enchantString.
  • "|h" – "End of link, text follows"
  • "[Enchant Boots - Spirit]" – The actual text displayed
  • "|h" – "End of hyperlink"
  • "|r" – 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.