Check if collectible is known

From ESOUI Wiki

Jump to: navigation, search

This function (code example by code65536, modified by Baertram) determines if an itemlink is a collectible container, or a set collectible item, and if it is already collected or not.

local function GetItemLinkSetCollectionStatus( itemLink )
    -- Returns:
    -- 0: Not a collectible
    -- 1: Collectible and not collected
    -- 2: Collectible and collected
    -- 3: Item Set Collectible and not collected
    -- 4: Item Set Collectible and collected
 
    if (IsItemLinkSetCollectionPiece(itemLink)) then
        if (IsItemSetCollectionPieceUnlocked(GetItemLinkItemId(itemLink))) then
            return 4
        else
            return 3
        end
    else
        local id = GetItemLinkContainerCollectibleId(itemLink)
        if (id > 0) then
            if (IsCollectibleOwnedByDefId(id)) then
                return 2
            elseif (GetCollectibleCategoryType(id) == COLLECTIBLE_CATEGORY_TYPE_COMBINATION_FRAGMENT and not CanCombinationFragmentBeUnlocked(id)) then
                return 2
            else
                return 1
            end
        end
        return 0
    end
end
Personal tools
Namespaces
Variants
Actions
Menu
Wiki
Toolbox