Swords of Glass vault format

From ModdingWiki
Jump to navigation Jump to search
Swords of Glass vault format
Format typeText
Text purposeStory
Line endingsNone
Character setCode Page 437

In Swords of Glass, items can be stored in the vault at the store. Items stored in the vault are saved in the Vault.dat file. Each record in the vault file is 15 bytes long, and the vault holds 18 items.


Data type Description
UINT8 Item id The id of the item found in the CNames.dat file. If zero, this slot is empty.
UINT8 Bonus The bonus to the item (like Sword +1). The game never creates a bonus above +9, but it handles hacked over-buffed items.
INT16LE Quantity/Durability For items like arrows, this holds the quantity, but for non-stackable items like a sword or armor, this is the durability of the item, which will break at 0. The game never has quantities greater than 9, but you can hack them higher.
UINT8 Name length The length of the item's name. Always 0x0A.
char[10] Name The name of the item. You can create custom names since the game uses id for everything.
18 items

Source Code


This FreeBASIC program will export the contents of the vault into a text file.

Dim As Integer VaultNo
Dim As String ItemName
Dim As UByte ItemId, NameLength, Bonus
Dim As Short QuantityOrDurability

Open "Vault.dat" For Binary As #1
Open "Vault.txt" For Binary As #2

For VaultNo = 0 To 17
	Put #2, , "Vault Slot: " + Str(VaultNo) + Chr(13) + Chr(10)

	ItemName = Space(10)

	Get #1, , ItemId
	Get #1, , Bonus
	Get #1, , QuantityOrDurability
	Get #1, , NameLength
	Get #1, , ItemName

	If ItemId = 0 Then
		Put #2, , "Item Id: None" + Chr(13) + Chr(10)
		Put #2, , "Item Id: " + Str(ItemId) + Chr(13) + Chr(10)
		Put #2, , "Item Name: " + Left(ItemName, NameLength) + Chr(13) + Chr(10)
		If Bonus > 0 Then
			Put #2, , "Bonus: +" + Str(Bonus) + Chr(13) + Chr(10)
		End If
		Put #2, , "Quantity or Durability: " + Str(QuantityOrDurability) + Chr(13) + Chr(10)
	End If

	Put #2, , Chr(13) + Chr(10) + Chr(13) + Chr(10)
Next VaultNo


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!)