Chiamala come
Platform.actions.findSlot(id, bank)
Registra la dipendenza Platform.actions.findSlot, poi chiamala con quel nome. Una chiamata con spazio dei nomi non passa self: usa una chiamata con i due punti o passa tu l'oggetto.
Cosa fa
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).
Argomenti
| Nome | Tipo | Cosa fa |
|---|---|---|
id | number | Spell ID to locate; not validated here (callers check it with spellID first). |
bank | string | Spell-book scope: spell, pet or any. |
Valori restituiti
| 1 | number | nil | Positive integer spell-book slot, or nil when not found or unavailable. |
|---|---|---|
| 2 | string | nil | Book type for that slot: BOOKTYPE_PET (pet) or BOOKTYPE_SPELL (spell); nil on failure. |
| 3 | string | nil | Reason when the slot is nil. |
Edizioni
Le funzioni di supporto integrate sono registrate su ogni edizione. Ciò che cambia è l'API di gioco che leggono; dove ne manca una, la funzione di supporto ripiega su un'alternativa o restituisce nil con un motivo.
- Non disponibile su quell'edizione (il motivo è nel suggerimento)
- Solo mentre sono attivi i ripieghi di Blizzard per le API deprecate
| API di gioco | |||||
|---|---|---|---|---|---|
FindSpellBookSlotBySpellID |
Come la chiama l'addon
Platform.actions.GetSpellRangeStateif not slot then slot,book,slotReason=findSlot(id,bank) end
Dipendenze
call→Platform.actions.call
Sorgente
Platform/actions.lua, riga 92. Nel gioco è in sola lettura; Duplica crea una copia modificabile.
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")




