Swords of Glass monster format

From ModdingWiki
Jump to: navigation, search
Swords of Glass monster format
Format typeConfiguration
StoringMonster stats
Games

The monsters in Swords of Glass are stored in the Monsters.dat file. Each record in the monster file is 46 bytes long, and there are 100 monsters in the file.

Items

Data type Description
UINT8 Monster id The id of the monster.
BYTE Unknown Always 0x57.
BYTE Unknown Always 0xB8.
BYTE Unknown Always 0x01.
UINT8 Hit Points Amount of hits the monster can take before it dies.
UINT8 Picture The shape graphic this monster uses.
UINT8 Defense Defensive power of this monster.
BYTE Unknown
BYTE Unknown
UINT8 Attack Attack power of this monster.
BYTE Unknown
UINT8 Range Attack Attack power of this monster when it shoots (also flag for if it can shoot).
UINT8 Magic Attack Attack power of this monster when it casts spells (also flag for if it can cast spells).
BYTE Unknown Always 0xC4.
BYTE Unknown
BYTE Unknown Always 0x4C.
INT16LE Experience Amount of experience you get from killing this monster.
UINT8 Poison Flag Whether this monster's attack can poison the player (0 - No, 1 - Yes).
UINT8 Blinds Flag Whether this monster's attack can blind the player (0 - No, 1 - Yes).
UINT8 Paralyses Flag Whether this monster's attack can paralyze the player (0 - No, 1 - Yes).
UINT8 Unknown Flag Unknown flag (0 - No, 1 - Yes).
UINT8 Engulfs Flag Whether this monster's attack can engulf the player's weapon (0 - No, 1 - Yes).
UINT8 Poisoned Flag Whether this monster can be poisoned (0 - No, 1 - Yes).
BYTE Unknown Always 0x00.
UINT8 Name length The length of the monster's name.
char[19] Name The name of the monster.
BYTE Unknown Always 0x50.
100 Monsters

Source Code

Exporter

This FreeBASIC program will export each of the game's monsters into a comma-separated values (CSV) file that can be opened as a spreadsheet.

Dim As Integer MonsterNo
Dim As UByte MonsterId, Unknown1, Unknown2, Unknown3, HitPoints, PictureId, DefensePower, Unknown4, Unknown5, AttackPower
Dim As UByte Unknown6, RangeAttackPower, MagicAttackPower, Unknown7, Unknown8, Unknown9, Poisons, Blinds, Paralyses
Dim As UByte UnknownFlag, Engulfs, Poisonable, Unknown10, NameLength, Unknown11
Dim As UShort Experience
Dim As String MonsterName

Open "Mons.dat" For Binary As #1
Open "Mons.csv" For Binary As #2

' Output the CSV header.
Put #2, , "Monster Id,Unknown 1,Unknown 2,Unknown 3,Hit Points,Picture Id,"
Put #2, , "Defense Power,Unknown 4,Unknown 5,Attack Power,Unknown 6,"
Put #2, , "Range Attack Power,Magic Attack Power,Unknown 7,Unknown 8,"
Put #2, , "Unknown 9,Experience,Poisons,Blinds,Paralyses,Unknown Flag,"
Put #2, , "Engulfs,Can Be Poisoned,Unknown 10,Name,Unknown 11" + Chr(13) + Chr(10)

For MonsterNo = 0 To 99
	' Load the monster record.
	MonsterName = Space(19)
	Get #1, , MonsterId
	Get #1, , Unknown1
	Get #1, , Unknown2
	Get #1, , Unknown3
	Get #1, , HitPoints
	Get #1, , PictureId
	Get #1, , DefensePower
	Get #1, , Unknown4
	Get #1, , Unknown5
	Get #1, , AttackPower
	Get #1, , Unknown6
	Get #1, , RangeAttackPower
	Get #1, , MagicAttackPower
	Get #1, , Unknown7
	Get #1, , Unknown8
	Get #1, , Unknown9
	Get #1, , Experience
	Get #1, , Poisons
	Get #1, , Blinds
	Get #1, , Paralyses
	Get #1, , UnknownFlag
	Get #1, , Engulfs
	Get #1, , Poisonable
	Get #1, , Unknown10
	Get #1, , NameLength
	Get #1, , MonsterName
	Get #1, , Unknown11

	' Output a CSV record.
	Put #2, , Str(MonsterId) + "," + Str(Unknown1) + "," + Str(Unknown2) + "," + Str(Unknown3) + ","
	Put #2, , Str(HitPoints) + "," + Str(PictureId) + "," + Str(DefensePower) + "," + Str(Unknown4) + ","
	Put #2, , Str(Unknown5) + "," + Str(AttackPower) + "," + Str(Unknown6) + "," + Str(RangeAttackPower) + ","
	Put #2, , Str(MagicAttackPower) + "," + Str(Unknown7) + "," + Str(Unknown8) + "," + Str(Unknown9) + ","
	Put #2, , Str(Experience) + "," + IIf(Poisons = 1, "Yes", "No") + "," + IIf(Blinds = 1, "Yes", "No") + ","
	Put #2, , IIf(Paralyses = 1, "Yes", "No") + "," + IIf(UnknownFlag = 1, "Yes", "No") + ","
	Put #2, , IIf(Engulfs = 1, "Yes", "No") + "," + IIf(Poisonable = 1, "Yes", "No") + "," + Str(Unknown10) + ","
	Put #2, , !"\"" + Left(MonsterName, NameLength) + !"\"," + Str(Unknown11) + Chr(13) + Chr(10)
Next MonsterNo

Credits

This format was reverse engineered by TheAlmightyGuru. If you find this information helpful in a project you're working on, please give credit where credit is due. (A link back to this wiki would be nice too!)