# resolve_spell function library

Dependencies:

## Description

This library rewrites the core WEIDU spell-lookup functions RES_NUM_OF_SPELL_NAME and NAME_NUM_OF_SPELL_RES, partly to let them resolves spells in the extended namespace introduced by SFO-LUA and partly so they fail a bit more gracefully. Note that I don't bother to rewrite RES_NAME_OF_SPELL_NUM, which I have found to be of very limited use.

## Public functions

NAME_NUM_OF_SPELL_RES(silent:i, spell_res:s)=(spell_name:s, spell_num:s, success:s) dimorphic

Given a resref intended to be the resref of a spell in the main spell namespace (e.g. SPWI304), returns 'spell_name' (the id assigned to the spell by spell.ids, e.g. WIZARD_FIREBALL) and 'spell_num' (the 4-digit number assigned to the spell by spell.ids, e.g. 1304). The function can look up entries in the SFO-lua extended spell system and returns spell_name in that case (and -1 for spell_num).

We return 'success', which is 1 if the lookup is successful and 0 otherwise. By default, the function throws a WARNING if success=0; you can suppress this by putting silent=1.

This is an overwrite of the core WEIDU function of the same name; the differences are (i) SFO's version can handle the SFO-lua extended spell namespace, and (ii) SFO's version throws a warning instead of failing hard if the spell can't be looked up.

RES_NUM_OF_SPELL_NAME(silent:i, spell_name:s)=(spell_res:s, spell_num:s, success:s) dimorphic

Given a string intended to be the IDS name of a spell (e.g., WIZARD_FIREBALL), returns 'spell_res' (the (uppercase) resref assigned to the spell by spell.ids, e.g. SPWI304) and 'spell_num' (the 4-digit number assigned to the spell by spell.ids, e.g. 2304). The function can look up entries in the SFO-lua extended spell system and returns spell_res in that case (and -1 for spell_num).

We return 'success', which is 1 if the lookup is successful and 0 otherwise. By default, the function throws a WARNING if success=0; you can suppress this by putting silent=1.

This is an overwrite of the core WEIDU function of the same name; the differences are (i) SFO's version can handle the SFO-lua extended spell namespace, and (ii) SFO's version throws a warning instead of failing hard if the spell can't be looked up.