调用方式
addon.Platform:GetGlyphSocketSnapshot()
可直接通过 addon 使用,无需依赖项。
作用
在已验证的巫妖王之怒、大地的裂变和熊猫人之谜客户端布局上观测雕文插槽。返回 slots 和 complete 标记。每个插槽在已知锁定或为空时为 active=false,被占用时为 active=true 并附带 spellID,不可用时 active 为 nil 并附带原因。未知布局和失败的数量查询会返回 nil 及原因。这不会比较物品名称,也不能证明物品与法术身份的确切对应。
参数
| 名称 | 类型 | 作用 |
|---|---|---|
self | RMPlatform | Rotation Master 平台适配器(使用冒号调用时隐含传入)。 |
返回值
| 1 | table | nil | 规范化的有限插槽快照,包含 slots 和 complete;查询不可用时为 nil。 |
|---|---|---|
| 2 | string | nil | 快照为 nil 时的策略、验证或可用性原因。 |
版本
内置辅助函数在每个版本上都会注册。不同的是它们读取的游戏 API;某个 API 缺失时,辅助函数会改用后备方案,或返回 nil 并附上原因。
- 该版本不可用(原因见提示)
- 仅在暴雪的弃用兼容层开启时
秘密值(正式服和永久服)
在正式服和永久服上,游戏交给插件的是秘密值。此辅助函数会检查它读取的内容(addon.Platform:CanReadValue),遇到无法比较的秘密值时返回 nil 并附上原因(例如 restricted-value),而不是返回该秘密值。请将 nil 视为不可用,而不是假。
示例
local snapshot = addon.Platform:GetGlyphSocketSnapshot()
if not snapshot then return nil end
for _, slot in ipairs(snapshot.slots) do
if slot.active and slot.spellID == value.spell then return true end
end
if not snapshot.complete then return nil end
return false依赖项
integer→Platform.glyphs.integerlayout→Platform.glyphs.layoutsocket→Platform.glyphs.socket
源码
Platform/glyphs.lua,第 97 行。在游戏中为只读;“复制”会生成一份可编辑的副本。
Platform.glyphs.GetGlyphSocketSnapshot(self)
local position=layout(self:GetClientInfo())
if not position then return nil,'unsupported-glyph-layout' end
if type(GetNumGlyphSockets)~='function' then return nil,'missing-api' end
local ok,count=pcall(GetNumGlyphSockets)
if not ok then return nil,'api-error' end
if not self:CanReadValue(count) then return nil,'restricted-value' end
if count==nil then return nil,'glyph-data-unavailable' end
if not integer(count,0) or count>64 then return nil,'invalid-api-result' end
local fn=GetGlyphSocketInfo
if count>0 and type(fn)~='function' then return nil,'missing-api' end
local result={slots={},complete=true}
for index=1,count do
local record=socket(self,fn,index,position)
result.slots[index]=record
if record.active==nil then result.complete=false end
end
return result




