API
lib:DecodeItemLink(itemLink)
Utility function to break down returns for an item link like any other API Note that numbers default to 0 rather than nil if they normally would be empty strings ""
Parameters
- itemLink
- What you want parsed can be a quest, talent, spell, enchant, or item link
Return values
- color String. "cff0070dd" as an example
- linkType String. "item", "spell", "enchant", "talent", or "quest"
- itemID Number suitable for searching Wowhead
- enchantID Number. Permanent enchant applied to an item See http://wow.gamepedia.com/EnchantId for a list
- gemID1 Embedded gem, if socketed. Re-uses enchantID indicies
- gemID2 Embedded gem, if socketed. Re-uses enchantID indicies
- gemID3 Embedded gem, if socketed. Re-uses enchantID indicies
- gemID4 Embedded gem, if socketed. Re-uses enchantID indicies
- suffixID Number. Random enchantment ID. May be negative See http://wow.gamepedia.com/SuffixId for a list
- uniqueID Number. Data pertaining to a specific instance of the item
- linkLevel Number. Level of the character supplying the link
- specializationID Number. Specialization ID of the character supplying the link See GetInspectSpecialization API for details
- upgradeTypeID Number. Used with upgradeID
- upgradeID Number.
- instanceDifficultyID Number. Dungeon or raid difficultyID item was obtained
- numBonuses Number. The number of bonusIDs
- bonusIDs Table. A list of the bonuses by number or random suffix
Usage
local bonusTable = select(17, myAddOn:DecodeItemLink(itemLink)) for i = 1, #bonusTable do Print(i) end
lib:NumberToHex(number)
Converts a number into hexidecimal
Parameters
- number
- Number. Like 1234
Return value
hexString String. Like "04d2"
lib:PixelPerfect(number)
Scales an element to pixel perfection
Parameters
- number
- The height, width, or scale you want adjusted
Usage
myFrame:SetHeight(myAddOn:PixelPerfect(100))
FontInstance:SetFont("fileName", myAddOn:PixelPerfect(12), "OUTLINE")
lib:Round(number[, decimal]
) Rounds a number to n decimal places
Parameters
- number
- That you want rounded
- decimal
- The number of decimal places decimal defaults to 0 places
Return value
Your newly rounded number
Usage
local myNumber = 123.456 myNumber = self:Round(myNumber, 2) print(myNumber) -- 123.46
lib:TitleCase(str)
Creates Title Case for strings
Parameters
- str
- The string you want Title Cased
Return value
str now fixed
Usage
local myString = "obi-wan kenobi" myString = self:TitleCase(myString) print(myString) -- Obi-Wan Kenobi
lib:VisualData()
Useful visual data Probably good to call if user changes screen resolutions
Return values
- uiScale Number. The corrected UI scale (768/resolutionY)
- resolutionX Number. Your screen's X dimension. IE 1920
- resolutionY Number. Your screen's Y dimension. IE 1080
Usage
local uiScale, resolutionX, resolutionY = myAddOn:VisualData()
UIParent:SetScale(uiScale)
Comments