Référence › Référence des fonctions › Conditions

Conditions.item.get_item_desc

dépendance

Appel

Conditions.item.get_item_desc(items)

Enregistrez la dépendance Conditions.item.get_item_desc, puis appelez-la sous ce nom. Un appel par espace de noms ne transmet pas self : utilisez un appel avec deux-points ou passez l'objet vous-même.

Ce qu'elle fait

Describes an item reference for the item condition descriptions: an item set name (white for a profile set, cyan for a global one), or the first item's link or name followed by how many others are listed. Returns nil when the reference is invalid, the set is unknown, or the list is empty.

Arguments

NomTypeCe qu'elle fait
itemsstring | tableItem set name, or an array of item IDs or names.

Retours

1string | nilLocalized description, or nil when nothing can be described.

Éditions

Les fonctions utilitaires intégrées sont enregistrées sur toutes les éditions. Ce qui diffère, c'est l'API du jeu qu'elles lisent ; quand l'une manque, la fonction utilitaire se rabat sur une alternative ou renvoie nil avec une raison.

Elle ne lit directement aucune API du jeu.

Comment l'addon l'appelle

  • Objet dans les sacs (print)
    item = Functions.presentation.nullable(get_item_desc(value.item), L["<item>"]),
  • Objet équipé (print)
    return Literal.phrase(L["you {{!have|do not have}} {item} equipped"], {item = Functions.presentation.nullable(get_item_desc(value.item), L["<item>"])})
  • Objet disponible (print)
    item = Functions.presentation.nullable(get_item_desc(value.item), L["<item>"]),
  • Temps de recharge de l'objet (print)
    item = Functions.presentation.nullable(get_item_desc(value.item), L["<item>"]),
  • Objet à portée (print)
    item = Functions.presentation.nullable(get_item_desc(value.item), L["<item>"]),

Dépendances

Source

Conditions/item.lua, ligne 62. En lecture seule dans le jeu ; Dupliquer crée une copie modifiable.

Conditions.item.get_item_desc(items)
    if not addon:IsConditionItemReference(items) then return nil end
    local itemsets = addon.db.profile.itemsets
    local global_itemsets = addon.db.global.itemsets
    if itemsets~=nil and type(itemsets)~='table' or global_itemsets~=nil and type(global_itemsets)~='table' then return nil end

    if type(items) == "string" then
        local set=(itemsets or {})[items];local tint=color.WHITE
        if set==nil then set=(global_itemsets or {})[items];tint=color.CYAN end
        if type(set)=='table' and type(set.name)=='string' then return string.format(L["a %s item set item"],tint..set.name..color.RESET) end
    elseif items and #items > 0 then
        local info=addon.Platform:GetItemMetadata(items[1])
        local link=info and (info.link or info.name) or items[1]
        if #items > 1 then
            return string.format(L["%s or %d others"], link, #items-1)
        else
            return link
        end
    end
    return nil

Retour à Référence des fonctions