Chame como
Conditions.hero_talent.treeName(id)
Registre a dependência Conditions.hero_talent.treeName 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
Names a hero talent tree: the game's own name for it when Platform:GetHeroTreeName can read one, else "hero talent tree" followed by the ID.
Argumentos
| Nome | Tipo | O que faz |
|---|---|---|
id | number | Hero talent tree (subtree) ID. |
Retornos
| 1 | string | nil | The name, or nil when id is not a valid tree ID. |
|---|
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 de herói (print)
return string.format(L["your hero talent tree {{!is|is not}} %s"], Functions.presentation.nullable(treeName(value.subtree), L["<hero talent tree>"]))
Dependências
validTree→Conditions.hero_talent.validTree
Código-fonte
Conditions/hero_talent.lua, linha 42. Somente leitura no jogo; Duplicar cria uma cópia editável.
Conditions.hero_talent.treeName(id)
if not validTree(id) then return nil end
local platform = addon.Platform
local name = type(platform.GetHeroTreeName) == "function" and platform:GetHeroTreeName(id)
if name then return name end
return string.format(L["hero talent tree %d"], id)