调用方式
addon.Platform:GetTalentGroupRoleObservation(group)
可直接通过 addon 使用,无需依赖项。
作用
在探测或受限策略客户端上,观测确切的旧版 GetTalentGroupRole(group) 点号调用的第一个职责结果。将可读的所选天赋组原样转发,包括将 nil 作为一个参数;不推断天赋组范围、不替换为其他 API,也不查询玩家单位。完整的旧版主要声明并未成立。职责数据缺失、失败、受限、为空或格式错误时为不可用;可读的非空未来字符串保持原样。
参数
| 名称 | 类型 | 作用 |
|---|---|---|
self | RMPlatform | Rotation Master 平台适配器(使用冒号调用时隐含传入)。 |
group | any | 实时的所选天赋组参数,经可读性检查后作为单个参数原样转发。 |
返回值
| 1 | string | nil | 已知的非空职责字符串;不可用时为 nil。 |
|---|---|---|
| 2 | string | nil | 策略、能力或所需观测的可用性原因。 |
版本
内置辅助函数在每个版本上都会注册。不同的是它们读取的游戏 API;某个 API 缺失时,辅助函数会改用后备方案,或返回 nil 并附上原因。
- 该版本不可用(原因见提示)
- 仅在暴雪的弃用兼容层开启时
| 游戏 API | |||||
|---|---|---|---|---|---|
GetTalentGroupRole |
秘密值(正式服和永久服)
在正式服和永久服上,游戏交给插件的是秘密值。此辅助函数会检查它读取的内容(addon.Platform:CanReadValue),遇到无法比较的秘密值时返回 nil 并附上原因(例如 restricted-value),而不是返回该秘密值。请将 nil 视为不可用,而不是假。
示例
local group = GetActiveTalentGroup and GetActiveTalentGroup()
local role = addon.Platform:GetTalentGroupRoleObservation(group)
if role == nil then return nil end
return role == "TANK"依赖项
readField→Platform.role.readFieldroleValue→Platform.role.roleValue
源码
Platform/role.lua,第 96 行。在游戏中为只读;“复制”会生成一份可编辑的副本。
Platform.role.GetTalentGroupRoleObservation(self, group)
local policy=self:GetCombatDataPolicy()
if policy~='probe' and policy~='restricted' then return nil,'unsupported-policy' end
if not self:CanReadValue(group) then return nil,'restricted-value' end
local query,reason=readField(self,_G,'GetTalentGroupRole')
if reason then return nil,reason end
if type(query)~='function' then return nil,'missing-api' end
local ok,role=pcall(query,group)
if not ok then return nil,'api-error' end
return roleValue(self,role)




