呼叫方式
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




