libResearch has undergone a major revision. Please be aware of this as you prepare your addons for Update 4!
The old version couldn't handle the new item traits in Update 4, but otherwise would continue to work under API 100009. But it won't continue to be supported.
The new version features Nirnhoned trait support; new, more human-readable return values for functions; and some new function names. AND, it accepts itemLinks instead of bagId, slotIndex, so you can use it in the trading house!
The new API follows:
Warning: Spoiler
-- returns true if the character knows or is in the process of researching the supplied trait; else returns false
-- there are a few items, given to the character at the very beginning of the game, that are traited but unresearchable;
-- these will present bugs when used with this function, but these items are very rare
-- this function REPLACES the old function IsCraftingTraitKnownOrResearching()
function libResearch:WillCharacterKnowTrait(craftingSkillType, researchLineIndex, traitIndex)
-- returns three values: int traitKey, bool isResearchable, string reason
-- traitKey will be 0 if item is ornate, intricate, or traitless; else it will be the result of GetTraitKey()
-- if isResearchable, then reason will be nil
-- otherwise, reason will be: "WrongItemType", "Ornate", "Intricate", "Traitless", "AlreadyKnown"
-- this function REPLACES DetailedIsItemResearchable() and IsItemResearchable()
function libResearch:GetItemTraitResearchabilityInfo(itemLink)
-- Returns an integer representation of the parameters
-- craftingSkillType * 10000 + researchLineIndex * 100 + traitIndex
function libResearch:GetTraitKey( craftingSkillType, researchLineIndex, traitIndex )
-- returns the global enums CRAFTING_TYPE_BLACKSMITHING, CRAFTING_TYPE_CLOTHIER, or CRAFTING_TYPE_WOODWORKING
-- if applicable; else returns -1
function libResearch:GetItemCraftingSkill( itemLink )
-- returns a trait index suitable for feeding to the global functions GetSmithingLineTraitInfo() et. al.,
-- or returns the string "Ornate" if the item is ornate,
-- or returns the string "Intricate" if the item is intricate,
-- or returns -1 if no trait exists
function libResearch:GetResearchTraitIndex( itemLink )
-- returns an index that corresponds to the weapon or armor type within the given crafting skill
-- or returns -1 if not applicable
function libResearch:GetResearchLineIndex( itemLink )
-- returns three values: craftingSkill, researchLineIndex, traitIndex for the given item link
function libResearch:GetItemResearchInfo( itemLink )
-- returns true if the craftingSkillType is one of the researchable crafts, false otherwise
function libResearch:IsBigThreeCrafting( craftingSkillType )
-- returns the below table
function libResearch:GetResearchMap()
-- Returns true if the integer you pass in represents Blacksmithing, Clothier, or Woodworking; false otherwise
function libResearch:IsBigThreeCrafting( craftingSkillType )