Battlespire - Hacking SAVETREE.DAT

		  Created by Dave Humphrey - 8 March 1998
              aj589@freenet.carleton.ca - www.uesp.net

   COMMENTS
=======================================
This document started as simply an offset list for solely the character data
in the SAVETREE.DAT.  While this information is contained, I have expanded
things to include a more thorough explanation of the format of thise file.
Please remember that I am in no way related to Bethesda and that none of the
information below can be guaranteed to be 100% correct.  If you've been
hacking the file and have found additional information/corrections or have
any questions, feel free to contact me at the above address.



   OVERALL FILE FORMAT
=======================================
It took me a while to figure out the overall format since the structure I
first assumed was wrong, leading me down the wrong track.  The way I
currently understand it makes more sense and describes the entire file from
beginning to end.  The SAVETREE.DAT file is made of a number of blocks in the
following fomat.

    Begin Block
	[4 bytes] = Block Type
	[Integer] = Block Size from current position, in bytes
	[ Block Information] = Depends on Block Type
    End Block

This structure is repeated until a block of size 0 is encountered.  Following
this is 81 bytes at the end of the file which has not been identified yet.
The total size of each block is the Block Size read + 4 (due to the block
type). The following is a list of the various block types found in a number
of files (bytes appear as they found in file, in hexadecimal). As it turns
out the size of the block actually determines the main type, with the block
type bytes specifing some other data (such as sub-type).  The sizes of the
blocks along with their possible types are listed below. Block size is does
not include the 4 bytes of block type.


	   Size        Possible Description
	============  ============================
	  3Eh (62)     ?
	  ACh (172)    ?
	  B4h (180)    Spell
	 330h (816)    Item
	 354h (852)    Monster/Character Data
	 4F2h (1266)   Contains mostly a bunch of 01's, Only one/file?


The block type bytes may be different for various block sizes.


	 Block Type       Possible Description
       ==============    ============================
	00 00 00 00
	00 00 00 08
	00 00 00 14
	00 00 00 20
	00 00 00 30
	00 00 00 31
	00 00 00 32
	00 00 00 4D
	00 00 00 84
	00 00 00 89
	00 00 00 96
	00 00 00 FE
	00 00 00 FF
	00 01 00 00	  Occurs only for first field in file
	68 01 3F 96


There is currently nothing known about these bytes, save the one for
character data.




      CHARACTER DATA OFFSETS
=======================================
What follows is a list of offsets for the character data.  It also works
partially for mobs but not perfectly, indicating some difference between the
two.  These came from a variety of sources.  Initially someone (Ken,
jerry_fletcher@hotmail.com) emailed me some Battlespire modules for UGE,
some sort of univeral game editor.  This gave me the basis for most of the
attribute and skill offsets, but didn't describe the format very accurately.
From hacking the game by creating classes with various attributes and looking
at the savegame I was able to determine the other offsets in time.

The 'Normal' attribute and skills are the values when no spell or item
modifies are in place.  For example a characters natural Stealth is 45%.
He/she puts on a pair of boots which modifies Stealth by +10%.  Now their
stealth is at 55% while their normal stealth value remains at 45%.

The 'Count' attribute is related to skill advancement.  For instance, each
time the character jumps this count is incremented.  When it reaches a
certain level the jumping skill increases and the count is reset.

The 'Offset' is the distance from the start of the character field, including
the 4 bytes of block type characters.

The 'Field Size/Type' gives the size of the field. Long Integers are defined
as 4 bytes while Integers are 2.


       Offset    Field Name	  	Field Size/Type
      =======  ====================    =====================
	69	Name 			32 Characters?
	101     Strength                Long Integer
	105     Intelligence            Long Integer
	109     Willpower               Long Integer
	113     Agility                 Long Integer
	117     Endurance               Long Integer
        121     Personality             Long Integer
        125     Speed                   Long Integer
        129     Luck                    Long Integer
        133     Normal Strength         Long Integer
	137     Normal Intelligence     Long Integer
        141     Normal Willpower        Long Integer
	145     Normal Agility          Long Integer
        149     Normal Endurance        Long Integer
        153     Normal Personality      Long Integer
        157     Normal Speed            Long Integer
	161     Normal Luck             Long Integer
        165     Current SP              Integer
        167     Max SP                  Integer
	169     Normal Max SP           Integer
	171     Current Wounds          Long Integer
	175     Max Wounds              Long Integer
	179     Normal Max Wounds       Long Integer
	183	???Medical		Long Integer
	187	???Medical Count	Long Integer
	191	Normal ???Medical	Long Integer
	195     Jumping                 Long Integer
	199	Jumping Count		Long Integer
	203     Normal Jumping          Long Integer
	207	???Lockpicking		Long Integer
	211	???Lockpicking Count	Long Integer
	215	Normal ???Lockpicking	Long Integer
	219     Stealth                 Long Integer
	223	Stealth Count		Long Integer
	227     Normal Stealth          Long Integer
	231     Swimming                Long Integer
	235	Swimming Count		Long Integer
	239     Normal Swimming         Long Integer
	243     Backstabbing            Long Integer
	247	Backstabbing Count	Long Integer
	251     Normal Backstabbing     Long Integer
	255     Dodging                 Long Integer
	259	Dodging Count		Long Integer
	263     Normal Dodging          Long Integer
	267	???Running		Long Integer
	271	???Running Count	Long Integer
	275	Normal ???Running	Long Integer
	279     Destruction             Long Integer
	283	Destruction Count	Long Integer
	287     Normal Destruction      Long Integer
	291     Restoration             Long Integer
	295	Restoration Count	Long Integer
        299     Normal Restoration      Long Integer
	303     Illusion                Long Integer
	307	Illusion Count		Long Integer
	311     Normal Illusion         Long Integer
	315     Alteration              Long Integer
	319	Alteration Count	Long Integer
	323     Normal Alteration       Long Integer
	327     Thaumaturgy             Long Integer
	331	Thaumaturgy Count	Long Integer
	335     Normal Thaumaturgy      Long Integer
	339     Mysticism               Long Integer
	343	Mysticism Count		Long Integer
	347     Normal Mysticism        Long Integer
	351     Short Blade             Long Integer
	355	Short Blade Count	Long Integer
	359     Normal Short Blade      Long Integer
	363     Long Blade              Long Integer
	367	Long Blade Count	Long Integer
	371     Normal Long Blade       Long Integer
	375     Hand-to-Hand            Long Integer
	379	Hand-to-Hand Count	Long Integer
	383     Normal Hand-to-Hand     Long Integer
	387     Axe                     Long Integer
	391	Axe Count		Long Integer
	395     Normal Axe              Long Integer
	399     Blunt Weapon            Long Integer
	403	Blunt Weapon Count	Long Integer
	407     Normal Blunt Weapon     Long Integer
	411     Missile                 Long Integer
	415	Missile Count		Long Integer
	419     Normal Missile          Long Integer
	423     Critical Strike         Long Integer
	427	Critical Strike Count	Long Integer
	431     Normal Critical Strike  Long Integer
	447 	Class Name		22 Characters
	471	Resistance		Character
			00001=Magic
			00010=Frost
			00100=Fire
			01000=Shock
			10000=Poison
	484	Immunity		Character
			00001=Magic
			00010=Frost
			00100=Fire
			01000=Shock
			10000=Poison
	473     Acute Hearing		Character
			00=No
			01=Yes
	474     Spell Absorption	Character
			00=No
			01=Yes
	475     Rapid Healing		Character
			00=No
			01=Yes
	476     Regenerate Health	Character
			00=No
			01=Yes
	477     Regenerate SP		Character
			00=No
			01=Yes
	478     Atheleticism		Character
			00=No
			01=Yes
	480	Spell Point Mult	Character
	483     Adrenaline Rush		Character
			00=No
			01=Yes
	484	Low Tolerance		Character
			00001=Magic
			00010=Frost
			00100=Fire
			01000=Shock
			10000=Poison
	485	Critical Weakness	Character
			00001=Magic
			00010=Frost
			00100=Fire
			01000=Shock
			10000=Poison
	486	Regenerate Spell Points Character
			00=Yes
			01=No
	487     Forbidden Weapon	Character
			00001=Short
			00010=Long
			00100=Blunt
			01000=Axe
			10000=Missile
	488	Forbidden Armor		Character
			03=Heavy
			02=Medium
			01=Light
	490	Forbidden Material	Character
			09=Daedric
			08=Orcish
			  etc....
	503	Class Name (again)?	22 Characters
	536	Spell Point Mult	Character
	544	Forbidden Armor		Character
	546	Forbidden Material	Character
	619	Gender 	00=Male		Character
			08=Female
	643	Hair Picture #		Character
	644	Mouth Picture #		Character
	645	Eye Picture #		Character
	674	Race (0-5)		Character


There are currently three unknown entries in the skill list. Their estimated
values are given although this is not yet confirmed.  They are based on the
skill offset list found in Daggerfall.  The skill order is the same except
for the skills not found in Battlespire (like the language skills etc...).
The running skill is uite certain, based on the position in the list and the
fact that running potions exist in the game.  The merchant skill is a best
guess but other possibilites for this offset are either streetwise or
etiquette.  Similarily lock-picking may be replaced by pick-pocketing or
mercantile. There is a possibility that a new skill exists at these locations,
one not found in Daggerfall.  Verification of these skills are still required
(e-mail me!).



   ITEM DATA OFFSETS
=======================================
The following is the list of known and some unknown variables found in the
item block.  Thanks to Cory Orndorff (orn9124@kutztown.edu) for sending me
some offsets to get me started.  Again, the 'Offset' is the distance from
the begginning of the block, including the 4 byte block type.


	Offset 		Description           	Size
       ========   ==========================   ===========
	 69 	    Name			32 Characters?
	 103	    Picture Number?	        ???
	 105	    Weight (1 bit=0.5 lbs)	???
	 112	    Current Usage		???
	 116	    Max Usage			???
	 120	    Material			???
		       00=Iron
		       01=Steel
		       02=Silver
		       03=Elven
		       04=Dwarven
		       05=Mithril
		       06=Adamantium
		       07=Ebony
		       08=Orcish
		       09=Daedric
	 131	    Number of Items		???





Any additions or corrections please contact me at
uesp@uesp.net, thanks.


If you have any problems, suggestions or comments on this page or website, please feel free to use the Contact Form to send a message to the WebMaster.
This document was last modified on: Saturday, 19 February 2011, at 09:55:52 and has been accessed 2154 times ( battle/batoff.txt ).
/text.shtml