Referenz › Funktionsreferenz › Conditions

Conditions.item.get_item_desc

Abhängigkeit

Aufruf als

Conditions.item.get_item_desc(items)

Erfassen Sie die Abhängigkeit Conditions.item.get_item_desc und rufen Sie sie dann unter diesem Namen auf. Ein Aufruf über den Namensraum übergibt kein self: Verwenden Sie einen Doppelpunkt-Aufruf oder übergeben Sie das Objekt selbst.

Was sie bewirkt

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.

Argumente

NameTypWas sie bewirkt
itemsstring | tableItem set name, or an array of item IDs or names.

Rückgabewerte

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

Editionen

Integrierte Hilfsfunktionen werden auf jeder Edition registriert. Unterschiedlich ist die Spiel-API, die sie lesen; fehlt eine, weicht die Hilfsfunktion aus oder gibt nil mit einem Grund zurück.

Sie liest keine Spiel-API direkt.

Wie das Addon sie aufruft

  • Gegenstand in Taschen (print)
    item = Functions.presentation.nullable(get_item_desc(value.item), L["<item>"]),
  • Gegenstand angelegt (print)
    return Literal.phrase(L["you {{!have|do not have}} {item} equipped"], {item = Functions.presentation.nullable(get_item_desc(value.item), L["<item>"])})
  • Gegenstand verfügbar (print)
    item = Functions.presentation.nullable(get_item_desc(value.item), L["<item>"]),
  • Gegenstandsabklingzeit (print)
    item = Functions.presentation.nullable(get_item_desc(value.item), L["<item>"]),
  • Gegenstand in Reichweite (print)
    item = Functions.presentation.nullable(get_item_desc(value.item), L["<item>"]),

Abhängigkeiten

Quelle

Conditions/item.lua, Zeile 62. Im Spiel schreibgeschützt; Duplizieren erstellt eine bearbeitbare Kopie.

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

Zurück zu Funktionsreferenz