调用方式
addon.Platform:GetRuneTypeObservation(index)
可直接通过 addon 使用,无需依赖项。
作用
使用只带单个索引参数的 GetRuneType 观测一个确切的原生符文栏位。要求类型可读且为正的有限整数;已知的未来数字类型与所选类型保持区分,死亡符文是一个确切的类型而不是通配符。缺失、失败、受限或格式错误的观测保持为不可用。不会添加职业、单位、数量或推断基础符文的查询。
参数
| 名称 | 类型 | 作用 |
|---|---|---|
self | RMPlatform | Rotation Master 平台适配器(使用冒号调用时隐含传入)。 |
index | number | 确切的整数原生符文栏位,范围为 1 到 6。 |
返回值
| 1 | number | nil | 可读的有限正整数符文类型;不可用时为 nil。 |
|---|---|---|
| 2 | string | nil | 类型为 nil 时的策略、栏位验证或所需观测的可用性原因。 |
版本
内置辅助函数在每个版本上都会注册。不同的是它们读取的游戏 API;某个 API 缺失时,辅助函数会改用后备方案,或返回 nil 并附上原因。
- 该版本不可用(原因见提示)
- 仅在暴雪的弃用兼容层开启时
| 游戏 API | |||||
|---|---|---|---|---|---|
GetRuneType |
秘密值(正式服和永久服)
在正式服和永久服上,游戏交给插件的是秘密值。此辅助函数会检查它读取的内容(addon.Platform:CanReadValue),遇到无法比较的秘密值时返回 nil 并附上原因(例如 restricted-value),而不是返回该秘密值。请将 nil 视为不可用,而不是假。
示例
local death = 0
for index = 1, 6 do
local runeType = addon.Platform:GetRuneTypeObservation(index)
if runeType == nil then return nil end
if runeType == 4 then death = death + 1 end -- 4 is a Death rune
end
return death >= 2依赖项
numberField→Platform.runes.numberFieldvalidIndex→Platform.runes.validIndex
源码
Platform/runes.lua,第 48 行。在游戏中为只读;“复制”会生成一份可编辑的副本。
Platform.runes.GetRuneTypeObservation(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=GetRuneType
if type(api)~='function' then return nil,'missing-api' end
local ok,value=pcall(api,index)
if not ok then return nil,'api-error' end
local runeType,why=numberField(self,value,'rune-type-unavailable')
if runeType==nil then return nil,why end
if runeType<=0 or runeType%1~=0 then return nil,'invalid-api-result' end
return runeType




