呼叫方式
addon.Platform:GetRuneCooldownObservation(index)
可直接透過 addon 使用,不需要相依項目。
作用
為一個確切的原生欄位讀取一次受保護的 GetRuneCooldown 元組。分別標準化 ready、start 與 duration:ready 需要可讀的布林值,而每個時間值需要可讀的有限數字,並保留帶正負號、小數與零值。每個無法使用的欄位都附帶其自己的原因。成功傳回空元組時會產生部分記錄;缺少功能、政策或原生呼叫失敗時傳回 nil。絕不從計時推斷 ready,也不從 ready 推斷計時。請在呼叫端快取這份完整記錄,以便在符文計數與冷卻判斷之間共用一次觀測。
參數
| 名稱 | 類型 | 作用 |
|---|---|---|
self | RMPlatform | Rotation Master 平台轉接器(使用冒號呼叫時隱含傳入)。 |
index | number | 確切的整數原生符文欄位,範圍為 1 到 6。 |
傳回值
| 1 | table | nil | 部分記錄,包含 ready 或 readyReason、start 或 startReason,以及 duration 或 durationReason;僅當查詢本身無法使用時為 nil。 |
|---|---|---|
| 2 | string | nil | 記錄為 nil 時的政策、欄位驗證、功能或原生呼叫的可用性原因。 |
版本
內建輔助函式在每個版本上都會註冊。不同的是它們讀取的遊戲 API;某個 API 不存在時,輔助函式會改用備用方式,或傳回 nil 並附上原因。
- 該版本無法使用(原因請見提示)
- 僅在暴雪的棄用相容層開啟時
| 遊戲 API | |||||
|---|---|---|---|---|---|
GetRuneCooldown |
機密值(正式版與永久)
在正式版與永久上,遊戲交給插件的是機密值。此輔助函式會檢查它讀取的內容(addon.Platform:CanReadValue),遇到無法比較的機密值時,會傳回 nil 並附上原因(例如 restricted-value),而不是傳回該機密值。請將 nil 視為無法使用,而非假。
範例
local rune = addon.Platform:GetRuneCooldownObservation(1)
if not rune or rune.ready == nil then return nil end
return rune.ready相依項目
numberField→Platform.runes.numberFieldvalidIndex→Platform.runes.validIndex
原始碼
Platform/runes.lua,第 72 行。在遊戲中為唯讀;「複製」會產生一份可編輯的複本。
Platform.runes.GetRuneCooldownObservation(self, index)
local policy=self:GetCombatDataPolicy()
if policy~='probe' and policy~='restricted' then return nil,'unsupported-policy' end
local valid,reason=validIndex(self,index)
if not valid then return nil,reason end
local api=GetRuneCooldown
if type(api)~='function' then return nil,'missing-api' end
local ok,tuple=pcall(function() return {api(index)} end)
if not ok then return nil,'api-error' end
local record={}
record.start,record.startReason=numberField(self,tuple[1],'rune-start-unavailable')
record.duration,record.durationReason=numberField(self,tuple[2],'rune-duration-unavailable')
local ready=tuple[3]
if not self:CanReadValue(ready) then record.readyReason='restricted-value'
elseif ready==nil then record.readyReason='rune-ready-unavailable'
elseif type(ready)~='boolean' then record.readyReason='invalid-api-result'
else record.ready=ready end
return record




