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




