Referencia › Referencia de funciones › Platform

Platform.actions.findSlot

dependencia

Llamar como

Platform.actions.findSlot(id, bank)

Registra la dependencia Platform.actions.findSlot y luego llámala con ese nombre. Una llamada con espacio de nombres no pasa self: usa una llamada con dos puntos o pasa tú mismo el objeto.

Qué hace

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).

Argumentos

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

Retornos

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.

Ediciones

Las funciones auxiliares integradas se registran en todas las ediciones. Lo que cambia es la API del juego que leen; donde falta alguna, la función auxiliar recurre a una alternativa o devuelve nil con un motivo.

  • No disponible en esa edición (el motivo aparece en la información emergente)
  • Solo mientras estén activas las alternativas de Blizzard para API obsoletas
API del juegoClassic EraTBC AnniversaryClassic ProgressionForeverRetail
FindSpellBookSlotBySpellIDClassic EraTBC AnniversaryClassic ProgressionForeverRetail

Cómo la llama el addon

Dependencias

Código fuente

Platform/actions.lua, línea 92. Solo lectura en el juego; Duplicar crea una copia editable.

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")

Volver a Referencia de funciones