呼叫方式
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)




