调用方式
Conditions.talent.classSpecs()
记录依赖项 Conditions.talent.classSpecs,然后按该名称调用。带命名空间的调用不会传入 self:请使用冒号调用,或自行传入该对象。
作用
Lists the specializations of the player's class for the Talent condition's Specialization picker, so a rotation can pick the talents of a specialization other than the one being played. Only the Retail client has more than one talent tree per class; everywhere else, and when the class cannot be read, it returns nil and the picker is not shown.
参数
无。
返回值
| 1 | table | nil | The class's specialization choices (id, name, icon), or nil where there is nothing to choose. |
|---|
版本
内置辅助函数在每个版本上都会注册。不同的是它们读取的游戏 API;某个 API 缺失时,辅助函数会改用后备方案,或返回 nil 并附上原因。
- 该版本不可用(原因见提示)
- 仅在暴雪的弃用兼容层开启时
| 游戏 API | |||||
|---|---|---|---|---|---|
UnitClass |
秘密值(正式服和永久服)
在正式服和永久服上,游戏交给插件的是秘密值。此辅助函数会检查它读取的内容(addon.Platform:CanReadValue),遇到无法比较的秘密值时返回 nil 并附上原因(例如 restricted-value),而不是返回该秘密值。请将 nil 视为不可用,而不是假。
插件如何调用它
Conditions.talent.traitsWidgetlocal specs=classSpecs()
依赖项
platform(builtin:Conditions/talent.lua:platform)
源码
Conditions/talent.lua,第 282 行。在游戏中为只读;“复制”会生成一份可编辑的副本。
Conditions.talent.classSpecs()
if platform:GetClientFamily()~="retail" or not platform.GetClassSpecializationChoices then return nil end
local ok,_,_,classID=pcall(UnitClass,"player")
if not ok or not platform:CanReadValue(classID) then return nil end
local choices=platform:GetClassSpecializationChoices(classID)
return choices and #choices>1 and choices or nil




