LibItemSets

Developer Reference

Table of Contents

  1. Getting Started
  2. Constants
  3. Functions

Getting Started

First, add LibItemSets (LIS) as a dependency in your addon's manifest:

## DependsOn: LibItemSets

The library can be accessed via the LibItemSets global variable, and it is recommended that you localize it for usage; for example:

local LIS = LibItemSets

Constants

Bitwise flags:

-- Armor weights
LIS.ARMOR_WEIGHT_L
LIS.ARMOR_WEIGHT_M
LIS.ARMOR_WEIGHT_H
LIS.ARMOR_WEIGHT_ALL  -- Equivalent to LIS.ARMOR_WEIGHT_L | LIS.ARMOR_WEIGHT_M | LIS.ARMOR_WEIGHT_H
LIS.ARMOR_WEIGHT_NONE
LIS.ARMOR_WEIGHT_MASK -- A bitmask to isolate flags related to armor weights

-- Special set types
LIS.SPECIAL_CRAFTABLE
LIS.SPECIAL_ABILITY_WEAPON
LIS.SPECIAL_MONSTER_SET
LIS.SPECIAL_MYTHIC

-- Sourcing classifications
LIS.SOURCE_TYPE_OVERLAND
LIS.SOURCE_TYPE_PVP
LIS.SOURCE_TYPE_DUNGEON
LIS.SOURCE_TYPE_TRIAL
LIS.SOURCE_TYPE_ARENA
LIS.SOURCE_TYPE_ANTIQUITIES

-- Miscellanea
LIS.SET_IS_BIND_ON_EQUIP
LIS.SET_IS_BIND_ON_PICKUP
LIS.SET_IS_COLLECTIBLE

Special sourceId values:

LIS.SPECIAL_SOURCE_RANDOM_DUNGEON_REWARD
LIS.SPECIAL_SOURCE_BATTLEGROUNDS
LIS.SPECIAL_SOURCE_REWARDS_FOR_THE_WORTHY
LIS.SPECIAL_SOURCE_ANTIQUITIES

Functions

Obtain information about an item set:

LIS.GetItemSetInfo( itemSetId )

itemSetId is an integer item set ID.

If itemSetId is invalid or data does not exist for the item set, nil is returned. Otherwise, the return is a table in the following format:

-- Sample output of LIS.GetItemSetInfo(480)
{
   setName = "Critical Riposte",  -- Localized and formatted name (string)
   flags = 0x102017,              -- Bitwise flags (integer)
   numBonuses = 4,                -- Number of set bonuses (integer)
   numCollectiblePieces = 0,      -- Number of collectible pieces (integer; 0 if the set is not collectible)
   craftTraits = 3,               -- Number of traits needed to craft (integer or nil if the set is not craftable)
   sourceIds = { 181 },           -- List of sources (list of integers)
   extraSourceInfo = "Vlastarus", -- Extra sourcing information (string or nil)
   sampleItemLink = "|H1:item:158419:370:50:26580:370:50:0:0:0:0:0:0:0:0:0:1:1:0:0:10000:0|h|h", -- itemLink of sample piece (string)
}

A positive sourceId corresponds to a zoneId, while a negative sourceId corresponds to one of the special sources defined by the LIS.SPECIAL_SOURCE_* constants. In either case, a sourceId can be converted to a localized name via the LIS.GetSourceName function.

The bitwise flags that comprise the flags field are defined by the constants listed above. In the example shown above for item set ID 480, the flags correspond to LIS.ARMOR_WEIGHT_ALL | LIS.SPECIAL_CRAFTABLE | LIS.SOURCE_TYPE_PVP | LIS.SET_IS_BIND_ON_EQUIP.

Get the number of traits required to craft an item set:

LIS.GetNumTraitsRequiredToCraftItemSet( itemSetId )

itemSetId is an integer item set ID.

If itemSetId is invalid or the item set is not craftable, -1 is returned. Otherwise, the return is the number of required traits.

Get a list of all itemSetIds for which data is available:

LIS.GetAllItemSetIds( )

Get a list of all itemSetIds corresponding to craftable sets:

LIS.GetCraftableItemSetIds( )

Get a list of all itemSetIds corresponding to collectible sets:

LIS.GetCollectibleItemSetIds( )

Get a list of all itemSetIds that are acquired from a particular source:

LIS.GetAllItemSetIdsForSource( sourceId )

sourceId can either be a zoneId or one of the LIS.SPECIAL_SOURCE_* constants.

An empty list is returned if there are no item sets associated with the specified source.

Get a list of all itemSetIds corresponding to craftable sets that are acquired from a particular source:

LIS.GetCraftableItemSetIdsForSource( sourceId )

sourceId can either be a zoneId or one of the LIS.SPECIAL_SOURCE_* constants.

An empty list is returned if there are no craftable item sets associated with the specified source.

Get a list of all itemSetIds corresponding to collectible sets that are acquired from a particular source:

LIS.GetCollectibleItemSetIdsForSource( sourceId )

sourceId can either be a zoneId or one of the LIS.SPECIAL_SOURCE_* constants.

An empty list is returned if there are no collectible item sets associated with the specified source.

Get the localized and formatted name name of a source:

LIS.GetSourceName( sourceId )

sourceId can either be a zoneId or one of the LIS.SPECIAL_SOURCE_* constants.

Check a bitwise flag:

LIS.CheckFlag( flags, flagToCheck )

This is a trivial convenience function that returns flagToCheck ~= 0 and BitAnd(flags, flagToCheck) == flagToCheck.

Check an armor weight flag:

LIS.CheckArmorWeight( flags, flagToCheck )

This is a trivial convenience function that returns BitAnd(flags, LIS.ARMOR_WEIGHT_MASK) == flagToCheck.

Note: The difference between LIS.CheckArmorWeight and LIS.CheckFlag is that the former determines whether a set is exclusively that weight while the latter determines whether a set supports that weight. This also means that LIS.ARMOR_WEIGHT_NONE can only be meaningfully used with LIS.CheckArmorWeight and not LIS.CheckFlag. For example, when checking LIS.ARMOR_WEIGHT_H with an all-weights set like “Armor of the Trainee”, LIS.CheckFlag will return true since the set has heavy pieces while LIS.CheckArmorWeight will return false since the set is not exclusively a heavy set.

Get the slots mask for the collected slots of a collectible item set:

LIS.GetItemSetCollectionSlotsMask( itemSetId )

itemSetId is an integer item set ID.

The return is an ItemSetCollectionSlot_id64 representing all collected slots that can be used with the base-game GetItemSetCollectionSlotsInMask function.

Note: If the return is passed through Id64ToNumber, it should be identical to LMAS.GetRawData(nil, itemSetId).

Get name of a gear slot:

LIS.GetItemSetCollectionSlotName( slot )

slot is an ItemSetCollectionSlot_id64, such as the return from GetItemSetCollectionPieceInfo or GetItemSetCollectionSlotsInMask.

The return is a localized generic name string that identifies the slot (e.g., "Cuirass" or "Greatsword" if the client language is English).