调用方式
addon.Platform:GetGlyphItemInfo(itemID, classID)
可直接通过 addon 使用,无需依赖项。
作用
使用受保护的原生物品元数据,将一个数字物品归类为所请求职业的雕文。职业是可选的,默认为可读取的玩家职业。这只确定物品分类,不确定装备状态,也不提供物品到雕文法术 ID 的映射。
参数
| 名称 | 类型 | 作用 |
|---|---|---|
self | RMPlatform | Rotation Master 平台适配器(使用冒号调用时隐含传入)。 |
itemID | number | 条件中存储的正整数雕文物品 ID;数组、物品组键和法术 ID 不是物品引用。 |
classID | number | nil | 可选的正数职业 ID;为 nil 时会在保护下查询当前玩家的职业。 |
返回值
| 1 | table | nil | 当物品是所请求职业的雕文时,返回可读的规范 itemID/classID/subClassID 记录;元数据无效或不可用时为 nil。 |
|---|---|---|
| 2 | string | nil | 结果为 nil 时的分类、验证或可用性原因。 |
版本
内置辅助函数在每个版本上都会注册。不同的是它们读取的游戏 API;某个 API 缺失时,辅助函数会改用后备方案,或返回 nil 并附上原因。
- 该版本不可用(原因见提示)
- 仅在暴雪的弃用兼容层开启时
| 游戏 API | |||||
|---|---|---|---|---|---|
UnitClass |
秘密值(正式服和永久服)
在正式服和永久服上,游戏交给插件的是秘密值。此辅助函数会检查它读取的内容(addon.Platform:CanReadValue),遇到无法比较的秘密值时返回 nil 并附上原因(例如 restricted-value),而不是返回该秘密值。请将 nil 视为不可用,而不是假。
插件如何调用它
- 雕文 (valid)
return addon.Platform:GetGlyphItemInfo(value.item, unit_class_num) ~= nil
依赖项
integer→Platform.glyphs.integer
源码
Platform/glyphs.lua,第 26 行。在游戏中为只读;“复制”会生成一份可编辑的副本。
Platform.glyphs.GetGlyphItemInfo(self, itemID, classID)
if not self:CanReadValue(itemID) or not self:CanReadValue(classID) then return nil,'restricted-value' end
if not integer(itemID,1) then return nil,'invalid-item' end
if classID==nil then
if type(UnitClass)~='function' then return nil,'missing-api' end
local ok,tuple=pcall(function() return {UnitClass('player')} end)
if not ok then return nil,'api-error' end
classID=tuple[3]
if not self:CanReadValue(classID) then return nil,'restricted-value' end
if classID==nil then return nil,'class-data-unavailable' end
end
if not integer(classID,1) then return nil,'invalid-class' end
local record,reason=self:GetItemInfoInstant(itemID)
if not record then return nil,reason end
if record.classID~=16 or record.subClassID~=classID then return nil,'invalid-glyph-item' end
return record




