Referenz › Funktionsreferenz › Platform

Platform.actions.findSlot

Abhängigkeit

Aufruf als

Platform.actions.findSlot(id, bank)

Erfassen Sie die Abhängigkeit Platform.actions.findSlot und rufen Sie sie dann unter diesem Namen auf. Ein Aufruf über den Namensraum übergibt kein self: Verwenden Sie einen Doppelpunkt-Aufruf oder übergeben Sie das Objekt selbst.

Was sie bewirkt

Finds the spell-book slot of a spell with FindSpellBookSlotBySpellID. bank "pet" searches the pet book, "any" searches the player book and then the pet book, and any other value searches the player book only. Returns the slot and its book type, or nil, nil and a reason: spell-not-in-book, invalid-api-result, or a reason from call (missing-api, api-error, restricted-value).

Argumente

NameTypWas sie bewirkt
idnumberSpell ID to locate; not validated here (callers check it with spellID first).
bankstringSpell-book scope: spell, pet or any.

Rückgabewerte

1number | nilPositive integer spell-book slot, or nil when not found or unavailable.
2string | nilBook type for that slot: BOOKTYPE_PET (pet) or BOOKTYPE_SPELL (spell); nil on failure.
3string | nilReason when the slot is nil.

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
FindSpellBookSlotBySpellIDClassic EraTBC AnniversaryClassic ProgressionForeverRetail

Wie das Addon sie aufruft

Abhängigkeiten

Quelle

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

Platform.actions.findSlot(id, bank)
    local pet=bank=="pet"
    local slot,reason=call(FindSpellBookSlotBySpellID,id,pet)
    if reason then return nil,nil,reason end
    if slot==nil and bank=="any" then
        pet=true;slot,reason=call(FindSpellBookSlotBySpellID,id,true)
        if reason then return nil,nil,reason end
    end
    if slot==nil then return nil,nil,"spell-not-in-book" end
    if type(slot)~="number" or slot<1 or slot==math.huge or slot%1~=0 then return nil,nil,"invalid-api-result" end
    return slot,pet and (BOOKTYPE_PET or "pet") or (BOOKTYPE_SPELL or "spell")

Zurück zu Funktionsreferenz