호출 방법
Conditions.item.get_item_desc(items)
의존성 Conditions.item.get_item_desc을(를) 기록한 뒤 그 이름으로 호출하세요. 네임스페이스 호출은 self를 넘기지 않으므로 콜론 호출을 쓰거나 객체를 직접 넘기세요.
하는 일
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.
인수
| 이름 | 유형 | 하는 일 |
|---|---|---|
items | string | table | Item set name, or an array of item IDs or names. |
반환값
| 1 | string | nil | Localized description, or nil when nothing can be described. |
|---|
버전
기본 제공 도우미는 모든 버전에 등록됩니다. 다른 점은 읽는 게임 API이며, API가 없으면 도우미는 대체 동작을 하거나 이유와 함께 nil을 반환합니다.
게임 API를 직접 읽지 않습니다.
애드온에서 호출하는 방식
- 가방에 아이템 있음 (print)
item = Functions.presentation.nullable(get_item_desc(value.item), L["<item>"]), - 아이템 착용 중 (print)
return Literal.phrase(L["you {{!have|do not have}} {item} equipped"], {item = Functions.presentation.nullable(get_item_desc(value.item), L["<item>"])}) - 아이템 사용 가능 (print)
item = Functions.presentation.nullable(get_item_desc(value.item), L["<item>"]), - 아이템 재사용 대기시간 (print)
item = Functions.presentation.nullable(get_item_desc(value.item), L["<item>"]), - 아이템 사거리 내 (print)
item = Functions.presentation.nullable(get_item_desc(value.item), L["<item>"]),
의존성
color(builtin:Conditions/item.lua:color)
소스
Conditions/item.lua, 62번째 줄. 게임에서는 읽기 전용이며, 복제하면 편집 가능한 사본이 생깁니다.
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