Справочник › Справочник функций › Platform

Platform.actions.findSlot

зависимость

Как вызывать

Platform.actions.findSlot(id, bank)

Запишите зависимость Platform.actions.findSlot и вызывайте её по этому имени. Вызов через пространство имён не передаёт self: используйте вызов через двоеточие или передайте объект сами.

Что делает

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

Аргументы

ИмяТипЧто делает
idnumberSpell ID to locate; not validated here (callers check it with spellID first).
bankstringSpell-book scope: spell, pet or any.

Возвращает

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.

Издания

Встроенные помощники регистрируются во всех изданиях. Различается игровой API, который они читают; если нужного API нет, помощник использует запасной вариант или возвращает nil с причиной.

  • Недоступно в этом издании (причина — во всплывающей подсказке)
  • Только пока включены запасные реализации Blizzard для устаревших функций
Игровой APIClassic EraTBC AnniversaryClassic ProgressionForeverRetail
FindSpellBookSlotBySpellIDClassic EraTBC AnniversaryClassic ProgressionForeverRetail

Как его вызывает аддон

Зависимости

Исходный код

Platform/actions.lua, строка 92. В игре только для чтения; «Дублировать» создаёт редактируемую копию.

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

Назад: Справочник функций