EQWatcher Evolution > Scripting  > Spell Database


Introduction

Please note: The internal spell database functionality is handled by the plugin for whichever game.  This means that, although the information below is given for EverQuest, this functionality is available for all games if it is possible to provide.  The same pieces of information will be filled in in the same spots, but depending on the game, not all of the same messages will be available.  Read on :)

EQWatcher has the ability to parse the spell data file (spdat.eff), allowing script writers direct access to retrieve (but not modify) values for use in triggers, timers, etc.  If you have used another spell data file parser (such as EQCaster), you may be familiar with the information available and possible uses.

Please note that the data in the files is not always 100% accurate -- and the EQ developers advise against parsing this data as it is a spoiler, and they often put invalid/incorrect data in the file to play with people's minds.

"And this is often the source of the rumors that we so often have to respond to. Parsing the spdat file is really not going to make your game play more enjoyable, folks. Play, have fun, and enjoy the game. Tearing apart game files and then worrying about what you find there isn't something that we encourage (ok, we actively discourage it).

- Alan" http://boards.station.sony.com/ubb/everquest/Forum1/HTML/000246.html

Keeping this in mind, errors may be found in calculated values (and please report these either on the message boards or to me personally in email, and I will try to correct that).

Anyway, now that I've disclaimed that.  All of the spell database lookup is written with the need for speed.  A fairly quick hash function (if you don't know, don't ask) is used to convert a spell name (i.e. "ensnare") directly to a number (this number corresponds to the index used in EQWatcher, NOT to a number seen in anything else).  This number is then used to directly access an array of information about the spells.  Thus, one command is given to retrieve the spell number from the spell name (FindSpell), and the rest of the commands are to retrieve the different types of data (SpellDuration, SpellName, etc) from that specific spell. 

You can safely assume that the number for each spell is the same for the duration of EQWatcher running, and until spdat.eff is changed and EQWatcher is restarted.  EQWatcher currently does not actively monitor spdat.eff for changes (support might be added in the future, but we are working under the assumption that patches to spdat.eff are generally not critical to EQWatcher).  This means if you felt like doing so, you could store the indexes of spells you would otherwise be regularly looking up (it would save you some precious CPU cycles, but not enough to make this a highly recommended practice).

List of commands


FindSpell, SpellDuration, SpellFades, SpellHitThem, SpellHitYou, SpellName, SpellYouCast



The "FindSpell" Command

This command retrieves the index number of a specific spell, for use with the other spell commands.  Note that for repeated spell names with different associated data, the same one will be accessed each time whether it is the one you want or not. 

Syntax:

FindSpell([Name])


Name: A string containing the name of the spell you wish to access.  This is not case sensitive, but the name must match otherwise (later I may remove sensitivity to accent and apostrophe characters).


Return Value:

This command returns the signed long index number of a given spell.  If the value is -1, the spell does not exist (Error checking is in place in the rest of the functions, so you may safely use this value in the rest of the functions no matter what).


The "SpellDuration" Command

This command retrieves the spell duration given in milliseconds of a specified spell.

Syntax:

SpellDuration([Index])


Index: The signed long index from FindSpell of the spell you need the duration of


Return Value:

This command returns the unsigned long duration of the specified spell, given in milliseconds.  If no spell exists at the given Index, the function returns 0.


The "SpellFades" Command

This command retrieves the spell's "fades" message, "Your eyes stop tingling." for example.

Syntax:

SpellFades([Index])


Index: The signed long index from FindSpell of the spell you need the message from


Return Value:

This command returns the "fades" message of the specified spell.  If no spell exists at the given Index, or no such message is given, the function returns an empty string equal to "".


The "SpellHitThem" Command

This command retrieves the spell's "hit them" message, "'s eyes tingle." for example.  Note that when used with triggers you would use this similar to "[@Trash@] @Target@'s eyes tingle."

Syntax:

SpellHitThem([Index])


Index: The signed long index from FindSpell of the spell you need the message from


Return Value:

This command returns the "hit them" message of the specified spell.  If no spell exists at the given Index, or no such message is given, the function returns an empty string equal to "".


The "SpellHitYou" Command

This command retrieves the spell's "hit you" message, "Your eyes tingle." for example.

Syntax:

SpellHitYou([Index])


Index: The signed long index from FindSpell of the spell you need the message from


Return Value:

This command returns the "hit you" message of the specified spell.  If no spell exists at the given Index, or no such message is given, the function returns an empty string equal to "".


The "SpellName" Command

This command retrieves the spell's name, "Acumen" for example.

Syntax:

SpellName([Index])


Index: The signed long index from FindSpell of the spell you need the message from


Return Value:

This command returns the name of the specified spell.  If no spell exists at the given Index, the function returns an empty string equal to "".


The "SpellYouCast" Command

This command retrieves the spell's "you cast" message, "You throw your head back and let loose a great bellow." for example.

Syntax:

SpellYouCast([Index])


Index: The signed long index from FindSpell of the spell you need the message from


Return Value:

This command returns the "you cast" message of the specified spell.  If no spell exists at the given Index, or no such message is given, the function returns an empty string equal to "".