Chame como
Conditions.talent.treePicker(parent, spec, value, update)
Registre a dependência Conditions.talent.treePicker e depois chame-a por esse nome. Uma chamada com namespace não passa self: use uma chamada com dois-pontos ou passe o objeto você mesmo.
O que faz
Builds the Talent tree dropdown for the TALENT_TREE_POINTS and PRIMARY_TALENT_TREE editors, listing the client's talent trees, storing the selection in value.tree and calling update. Shows a note when the client has no Classic talent-tree layout; the dropdown is disabled when there are no trees or value.disabled is true.
Argumentos
| Nome | Tipo | O que faz |
|---|---|---|
parent | table | Condition widget group the control is added to. |
spec | number | nil | Specialization the editor is for; on progression clients a value from 1 to 4 also selects the talent group to read. |
value | table | Saved condition settings; the tree field is read and written, and disabled is honored. |
update | function | Called with no arguments after every change so the editor can refresh. |
Retornos
Nada.
Edições
As funções auxiliares integradas são registradas em todas as edições. O que muda é a API do jogo que elas leem; quando uma está ausente, a função auxiliar recorre a uma alternativa ou retorna nil com um motivo.
Não lê nenhuma API do jogo diretamente.
Como o addon a chama
- Árvore de talentos principal (widget)
local top=parent:GetUserData('top');treePicker(parent,spec,value,function() top:SetStatusText(top:GetUserData('funcs'):print(top:GetUserData('root'),spec)) end) - Pontos na árvore de talentos (widget)
treePicker(parent,spec,value,update);parent:AddChild(addon:Widget_OperatorWidget(value,L['Points'],update))
Dependências
dropdown→Conditions.talent.dropdowngroup→Conditions.talent.grouptext→Conditions.talent.text
Código-fonte
Conditions/talent.lua, linha 636. Somente leitura no jogo; Duplicar cria uma cópia editável.
Conditions.talent.treePicker(parent, spec, value, update)
local choices,order={},{}
local listed=addon.TalentTrees.Choices(addon.TalentTrees.ContextClass(),group(spec))
if listed then choices,order=listed.choices,listed.order
else text(parent,L['This client does not expose a Classic talent-tree layout. The saved tree reference is preserved.']) end
local picker=dropdown(parent,L['Talent tree'],function(selected) value.tree=selected;update() end)
picker:SetDisabled(#order==0 or value.disabled==true)
picker.configure=function() picker:SetList(choices,order);picker:SetValue(value.tree) end