Referenz › Funktionsreferenz › Platform

Platform.glyphs.GetGlyphSocketSnapshot

öffentlich

Aufruf als

addon.Platform:GetGlyphSocketSnapshot()

Direkt über addon verfügbar; keine Abhängigkeit nötig.

Was sie bewirkt

Glyphensockel auf verifizierten Client-Layouts von Wrath, Cata und Mists beobachten. Gibt slots und ein Flag complete zurück. Jeder Platz hat active=false, wenn er bekanntermaßen gesperrt oder leer ist, active=true plus spellID, wenn er belegt ist, oder active nil plus Grund, wenn er nicht verfügbar ist. Unbekannte Layouts und fehlgeschlagene Anzahlabfragen ergeben nil mit einem Grund. Dies vergleicht keine Gegenstandsnamen und belegt keine exakte Identität von Gegenstand und Zauber.

Argumente

NameTypWas sie bewirkt
selfRMPlatformPlattformadapter von Rotation Master (bei Doppelpunktaufrufen implizit).

Rückgabewerte

1table | nilNormalisierte begrenzte Sockel-Momentaufnahme mit slots und complete oder nil, wenn die Abfrage nicht verfügbar ist.
2string | nilGrund aus Richtlinie, Validierung oder Verfügbarkeit für eine nil-Momentaufnahme.

Editionen

Integrierte Hilfsfunktionen werden auf jeder Edition registriert. Unterschiedlich ist die Spiel-API, die sie lesen; fehlt eine, weicht die Hilfsfunktion aus oder gibt nil mit einem Grund zurück.

  • Auf dieser Edition nicht verfügbar (den Grund nennt der Tooltip)
  • Nur, solange Blizzards Ersatz für veraltete Funktionen aktiv ist
Spiel-APIClassic EraTBC AnniversaryClassic ProgressionForeverRetail
GetGlyphSocketInfoClassic EraTBC AnniversaryClassic ProgressionForeverRetail
GetNumGlyphSocketsClassic EraTBC AnniversaryClassic ProgressionForeverRetail

Geheime Werte (Retail und Forever)

Auf Retail und Forever übergibt das Spiel Addons geheime Werte. Diese Hilfsfunktion prüft, was sie liest (addon.Platform:CanReadValue), und gibt statt eines geheimen Werts, den sie nicht vergleichen kann, nil mit einem Grund wie restricted-value zurück. Behandeln Sie nil als nicht verfügbar, nicht als false.

Beispiel

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

Abhängigkeiten

Quelle

Platform/glyphs.lua, Zeile 97. Im Spiel schreibgeschützt; Duplizieren erstellt eine bearbeitbare Kopie.

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

Zurück zu Funktionsreferenz