參考資料 › 函式參考 › Conditions

Conditions.talent.icon

相依項目

呼叫方式

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.

參數

名稱類型作用
parenttableCondition widget group the control is added to.
valuetableSaved TALENT condition settings the icon reflects.
specnumber | nilSpecialization the editor is for; on progression clients a value from 1 to 4 also selects the talent group to read.

傳回值

1RMConditionIconThe icon widget, already added to parent.

版本

內建輔助函式在每個版本上都會註冊。不同的是它們讀取的遊戲 API;某個 API 不存在時,輔助函式會改用備用方式,或傳回 nil 並附上原因。

  • 該版本無法使用(原因請見提示)
  • 僅在暴雪的棄用相容層開啟時
遊戲 API經典時代TBC 週年版經典進程永久正式版
GameTooltip經典時代TBC 週年版經典進程永久正式版

插件如何呼叫它

相依項目

原始碼

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

返回函式參考