SpellFinder¶
Methods to find and compare spell images
SpellFinder constants¶
The spell icons come straight from the game cache. Every spellbook is an enum listing one item per spell, and each of those items carries the spell’s name and icons as params:
SPELLBOOK_ENUMSare the enums of the standard, ancient, lunar and arceuus spellbooks.JEWELLERY_ENCHANT_ENUMis the standard spellbook’s jewellery enchantment menu, with theLvl-1toLvl-7 Enchantspells and itsBackbutton.SPELL_NAME_PARAMis the param holding the spell’s name.SPELL_SPRITE_PARAMSare the params holding the large and the small castable icon.
ESpell.Spellbook¶
function ESpell.Spellbook(): Integer;
Index of the spellbook spell belongs to in SPELLBOOK_ENUMS: 0 standard, 1 ancient,
2 lunar and 3 arceuus. ESpell.UNKNOWN gives -1.
ESpell.CacheName¶
function ESpell.CacheName(): String;
The spell’s name the way the game cache has it, lowercased and without apostrophes or dashes so
Fenkenstrain's and Lvl-1 compare to FENKENSTRAINS and LVL1.
SpellFinder.Resolve¶
procedure TSpellFinder.Resolve();
Internal method that reads every spellbook enum out of the cache and fills SpriteIDs with the
icons of each ESpell, matched by name within its own spellbook. The ape atoll teleports of
the standard and arceuus spellbooks share a name, which is why the spellbook matters.
A spell the cache no longer has, like the removed BOUNTY_TELEPORT, is left at -1.
It runs once, the first time a spell image is needed.
SpellFinder.GetImages¶
function TSpellFinder.GetImages(spell: ESpell): array [0..1] of TImage;
The large and the small icon of spell, as the magic tab draws them when the spell can be cast.
They are read from the game cache the first time they are asked for and kept in memory after that.
A spell the cache has no icons for gives nil images, which SpellFinder.Find skips.