呼叫方式
addon.Platform:IsAutoRepeatActive(spellID)
可直接透過 addon 使用,不需要相依項目。
作用
讀取玩家某個法術(例如射擊或自動射擊)的自動重複狀態。這與目前或佇列中的施法不同。現代用戶端會收到確切的法術 ID;舊版查詢會先解析玩家的法術書欄位。受限的用戶端政策、無法讀取的結果以及無法使用的法術書欄位會傳回 nil 及原因。這只觀測狀態,從不開始或停止法術。
參數
| 名稱 | 類型 | 作用 |
|---|---|---|
self | RMPlatform | Rotation Master 平台轉接器(使用冒號呼叫時隱含傳入)。 |
spellID | number | 正整數法術 ID,而不是法術書欄位。 |
傳回值
| 1 | boolean | nil | 用戶端回報此法術正在自動重複時為 true;回報未啟動時為 false;無法使用時為 nil。 |
|---|---|---|
| 2 | string | nil | 結果為 nil 時的驗證或可用性原因。 |
版本
內建輔助函式在每個版本上都會註冊。不同的是它們讀取的遊戲 API;某個 API 不存在時,輔助函式會改用備用方式,或傳回 nil 並附上原因。
- 該版本無法使用(原因請見提示)
- 僅在暴雪的棄用相容層開啟時
機密值(正式版與永久)
在正式版與永久上,遊戲交給插件的是機密值。此輔助函式會檢查它讀取的內容(addon.Platform:CanReadValue),遇到無法比較的機密值時,會傳回 nil 並附上原因(例如 restricted-value),而不是傳回該機密值。請將 nil 視為無法使用,而非假。
範例
local shooting = addon.Platform:IsAutoRepeatActive(75) -- Auto Shot
if shooting == nil then return nil end
return not shooting相依項目
identifier→Platform.spells.identifier
原始碼
Platform/spells.lua,第 697 行。在遊戲中為唯讀;「複製」會產生一份可編輯的複本。
Platform.spells.IsAutoRepeatActive(self, spellID)
local policy=self:GetCombatDataPolicy()
if policy~='probe' and policy~='restricted' then return nil,'unsupported-policy' end
local valid,reason=identifier(spellID,true)
if not valid then return nil,reason end
local native=C_Spell and C_Spell.IsAutoRepeatSpell
local ok,active
if type(native)=='function' then
ok,active=pcall(native,spellID)
else
if type(IsAutoRepeatSpell)~='function' or type(FindSpellBookSlotBySpellID)~='function' then return nil,'missing-api' end
local found,slot=pcall(FindSpellBookSlotBySpellID,spellID,false)
if not found then return nil,'api-error' end
if not self:CanReadValue(slot) then return nil,'restricted-value' end
if slot==nil then return nil,'spell-not-in-book' end
if type(slot)~='number' or slot<1 or slot==math.huge or slot%1~=0 then return nil,'invalid-api-result' end
ok,active=pcall(IsAutoRepeatSpell,slot,BOOKTYPE_SPELL or 'spell')
end
if not ok then return nil,'api-error' end
if not self:CanReadValue(active) then return nil,'restricted-value' end
if type(native)~='function' then
if active==0 then active=false elseif active==1 then active=true end
end
if type(active)~='boolean' then return nil,'invalid-api-result' end
return active




