WoW:API GetGlyphSocketInfo: Difference between revisions
Jump to navigation
Jump to search
(formatting, 3.1) |
(→Examples: fixed code) |
||
Line 18: | Line 18: | ||
local enabled, glyphType, glyphSpellID, icon = GetGlyphSocketInfo(i); | local enabled, glyphType, glyphSpellID, icon = GetGlyphSocketInfo(i); | ||
if ( enabled ) then | if ( enabled ) then | ||
local link = [[API GetGlyphLink|GetGlyphLink]](i);-- Retrieves the Glyph's link ( | local link = [[API GetGlyphLink|GetGlyphLink]](i);-- Retrieves the Glyph's link ("" if no glyph in Socket); | ||
if ( link ) then | if ( link ~= "") then | ||
DEFAULT_CHAT_FRAME:AddMessage("Glyph Socket "..i.." contains "..link); | DEFAULT_CHAT_FRAME:AddMessage("Glyph Socket "..i.." contains "..link); | ||
else | else |
Revision as of 19:51, 17 December 2009
← WoW API < GetGlyphSocketInfo
Returns information on a glyph socket.
enabled, glyphType, glyphSpellID, icon = GetGlyphSocketInfo(socketID[, talentGroup]);
Arguments
- socketID
- Number - glyph [Glyph SocketID|socket index]] (1 to GetNumGlyphSockets() )
- talentGroup
- Optional Number - (dual) specialization index (1 to GetNumTalentGroups(...)).
Returns
- enabled
- Boolean - 1 if available, nil if locked.
- glyphType
- Number - GLYPHTYPE_MAJOR (1) or GLYPHTYPE_MINOR (2)
- glyphSpellID
- Number - spell ID of socketted glyph, nil if no glyph is socketed.
- icon
- String - Glyph rune texture path.
Examples
The following code scans all the glyph sockets and prints out the status of each one.
for i = 1, NUM_GLYPH_SLOTS do local enabled, glyphType, glyphSpellID, icon = GetGlyphSocketInfo(i); if ( enabled ) then local link = GetGlyphLink(i);-- Retrieves the Glyph's link ("" if no glyph in Socket); if ( link ~= "") then DEFAULT_CHAT_FRAME:AddMessage("Glyph Socket "..i.." contains "..link); else DEFAULT_CHAT_FRAME:AddMessage("Glyph Socket "..i.." is unlocked and empty!"); end else DEFAULT_CHAT_FRAME:AddMessage("Glyph Socket "..i.." is locked!"); end end
Notes
- GetSpellInfo can be used to translate glyphSpellID to a glyph name.
- The talentGroup argument was added in Patch 3.1.