Notice something wrong, missing, or inadequate? Feel free to edit pages yourself and make use of discussion pages.
Wiki content is created, maintained, and administrated by players. Learn how you can help!

Spells/Parsing

From SoDWiki
< Spells(Redirected from Spell parsing)
Jump to navigationJump to search

Introduction

Here is a quick guide to spell parsing. This is based off of research done at www.eqemu.com and written by one Windcatcher there.

Why would I want to know this?

Well so you can write your own spell parser of course!

Why would I want to write my own spell parser?

For the challenge, perhaps. Or because your unhappy with how current parsers handle SoD, or think you can make a better solution. Also because some people like knowledge for knowledge sake.

Can you give this info away?

Probably... I figured out nearly all of it before I became staff, and at the time the wiki REALLY needed the information. I don't have the time to fix it up further, so maybe someone else can take up the reigns.


The EQ spell file

EQ spells are stored in the spells_us.txt file, which can be found locally. If opened, you'll notice each line looks something like this.

25^Pillage Enchantment^PLAYER_1^^^^You feel very dispelled.^ feels very dispelled.^^200^0^0^0^3500^2250^5000^0^0^0^70^4^4^4^4^0^0^0^0^0^0^0^0^0^0^0^0^0^0^0^0^0^0^0^0^0^0^0^0^0^0^0^0^0^0^0^0^2521^2122^-1^-1^-1^-1^1^1^1^1^-1^-1^-1^-1^100^100^100^100^100^100^100^100^100^100^100^100^0^2^0^1^27^27^27^27^254^254^254^254^254^254^254^254^5^0^4^-1^0^0^255^255^255^255^255^255^255^255^255^255^255^255^255^44^255^255^42^0^0^14^0^0^0^0^0^0^0^0^0^0^0^0^0^0^0^0^0^0^100^0^32^228^0^0^0^1^0^0^0^0^0^0^39004^39085^0^0^0^0^0^0^0^0^0^0^0^0^0^0^0^0^0

Quite a mouth full indeed. This line is how the client interprets spells. Each number is a value that corresponds to something about the spell.

The most important thing to realize is that ^ is a spacer. Thats how the internal game parser knows when one statement has ended and another has begun.

But what does everything else mean. Well we don't know everything for sure, but our friends over at EQemu have long since deciphered alot of it. The original can be found here: http://www.eqemulator.net/wiki/wikka.php?wakka=SpellsUsTxt

So, given this list, and the explanation on spacers, it gets pretty obvious.

  • The 25 above, is in slot 1, so is the id of the spell
  • The Pillage Enchantment above, is in slot 2 so is name
  • The PLAYER_1 above, appears to be filler, a common occurance as you'll soon find, but is still slot 3
  • You'll notice the next thing you read is You feel very dispelled., but this is not slot 4, the ^^^ are also slots, that happen to have no value in this spell. The next text you see is actually slot 7

And so on, and so forth. This knowledge makes writing a parser quite simple. All one has to do is tokenize each string, using ^ as the delimiter. One can store said results into an array, and then read the non filler slots and interpret the results. This is exactly how I did the spell templates on this wiki.

SoD specifics

Now of importance when interpreting results; In SoD, not every effect listed does what one expects. SoD has custom functions associated with certain spells. The most obvious one Balance Party Health actually means auto cast another spell, but others exist and some others, just aren't that obvious.

  • Balance Party Health - Auto-casts spells.
  • Divine Aura - Invulnerability.
  • Divine Might - Add Melee Proc.
  • Increase Spell Damage - Nuke and DoT damage focus, Nuke and DoT crits, Elemental damage focus, Bane spell focus.
  • Make Weapon Magic - Scrambles chat!
  • Manadrain - Increase/decrease total Manapool.
  • Reduce Healing - Increase/decrease Nuke damage
  • Screech - Filler. One way to specifically force a spell stacking, that no one really understands.

The old wiki spell parser

And finally, to get you started, my newly open sourced spell parser. It's written in Java, and is heavily commented. This was compiled under jdk 1.4, via eclipse, and I offer no support for it. If it doesn't work anymore, oh well, the code in it can still teach you a think or two. It is three files:

  • Main.java - The poorly named workhorse class, that interprets most numbers and makes numerous calls to...
  • Tables.java - Which is a glorified switch/case block, based off the original openspell.xml. Any of those random numbers that needs interpreting is done here, and the results returned to Main.java
  • MainFrame.java - The actual main class. Run this to get results. It has a GUI to make this simpler, and outputs everything to a file in a VERY specific format, which I eventually used to auto add to the wiki. If you don't care about improving the parsing, but still like to play around with how its displayed, this is the class you'll wanna mess with.

The files expect to be in the package 'com.zak.sod.extractor;', and will get upset if they are not, so keep that in mind. This was written before I had the above SoD specific information, and has many places where it can be improved.

Closing

So do what you will with this information. Hopefully someone takes up the reigns and helps make a better spell parser, since the current ones aren't that great. If so, be sure to add it to this page in some manner!