呼叫方式
Conditions.talent.icon(parent, value, spec)
記錄相依項目 Conditions.talent.icon,然後以該名稱呼叫。含命名空間的呼叫不會傳入 self:請使用冒號呼叫,或自行傳入該物件。
作用
Creates the 44-pixel talent icon for the TALENT editors, showing the referenced talent's icon and, on hover, its spell tooltip (or its name), and adds it to parent.
參數
| 名稱 | 類型 | 作用 |
|---|---|---|
parent | table | Condition widget group the control is added to. |
value | table | Saved TALENT condition settings the icon reflects. |
spec | number | nil | Specialization the editor is for; on progression clients a value from 1 to 4 also selects the talent group to read. |
傳回值
| 1 | RMConditionIcon | The icon widget, already added to parent. |
|---|
版本
內建輔助函式在每個版本上都會註冊。不同的是它們讀取的遊戲 API;某個 API 不存在時,輔助函式會改用備用方式,或傳回 nil 並附上原因。
- 該版本無法使用(原因請見提示)
- 僅在暴雪的棄用相容層開啟時
| 遊戲 API | |||||
|---|---|---|---|---|---|
GameTooltip |
插件如何呼叫它
Conditions.talent.gridWidgetlocal talentIcon=icon(box,value,spec)Conditions.talent.traitsWidgettalentIcon=icon(box,value,spec)Conditions.talent.treeWidgettalentIcon=icon(box,value,spec)
相依項目
PLACEHOLDER(builtin:Conditions/talent.lua:PLACEHOLDER)info→Conditions.talent.info
原始碼
Conditions/talent.lua,第 167 行。在遊戲中為唯讀;「複製」會產生一份可編輯的複本。
Conditions.talent.icon(parent, value, spec)
local widget=addon:CreateConditionIcon();widget:SetWidth(64);widget:SetImageSize(60,60)
local current=info(value,spec);widget:SetImage(current and current.icon or PLACEHOLDER)
widget:SetCallback("OnEnter",function()
local observed=info(value,spec)
if observed then
GameTooltip:SetOwner(widget.frame,"ANCHOR_BOTTOMRIGHT",3)
if observed.spellID then GameTooltip:SetHyperlink("spell:"..observed.spellID)
else GameTooltip:SetText(observed.name) end
end
end)
widget:SetCallback("OnLeave",function() if GameTooltip:IsOwned(widget.frame) then GameTooltip:Hide() end end)
parent:AddChild(widget)
return widget




