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

  1. color String. "cff0070dd" as an example
  2. linkType String. "item", "spell", "enchant", "talent", or "quest"
  3. itemID Number suitable for searching Wowhead
  4. enchantID Number. Permanent enchant applied to an item See http://wow.gamepedia.com/EnchantId for a list
  5. gemID1 Embedded gem, if socketed. Re-uses enchantID indicies
  6. gemID2 Embedded gem, if socketed. Re-uses enchantID indicies
  7. gemID3 Embedded gem, if socketed. Re-uses enchantID indicies
  8. gemID4 Embedded gem, if socketed. Re-uses enchantID indicies
  9. suffixID Number. Random enchantment ID. May be negative See http://wow.gamepedia.com/SuffixId for a list
  10. uniqueID Number. Data pertaining to a specific instance of the item
  11. linkLevel Number. Level of the character supplying the link
  12. specializationID Number. Specialization ID of the character supplying the link See GetInspectSpecialization API for details
  13. upgradeTypeID Number. Used with upgradeID
  14. upgradeID Number.
  15. instanceDifficultyID Number. Dungeon or raid difficultyID item was obtained
  16. numBonuses Number. The number of bonusIDs
  17. 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

  1. uiScale Number. The corrected UI scale (768/resolutionY)
  2. resolutionX Number. Your screen's X dimension. IE 1920
  3. resolutionY Number. Your screen's Y dimension. IE 1080

Usage

local uiScale, resolutionX, resolutionY = myAddOn:VisualData()
UIParent:SetScale(uiScale)



Comments

Posts Quoted:
Reply
Clear All Quotes