Skip to content

Commit

Permalink
sto v1 format formalized, ref Gibberlings3#84
Browse files Browse the repository at this point in the history
  • Loading branch information
burner1024 committed Feb 5, 2023
1 parent 828045d commit e50e28f
Show file tree
Hide file tree
Showing 7 changed files with 382 additions and 684 deletions.
148 changes: 148 additions & 0 deletions _data/file_formats/item_types.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
- code: '0x00'
type: Books/misc
- code: '0x01'
type: Amulets and necklaces
- code: '0x02'
type: Armor
- code: '0x03'
type: Belts and girdles
- code: '0x04'
type: Boots
- code: '0x05'
type: <b><a name="Header_ItemType_5">Arrows</a></b>
- code: '0x06'
type: Bracers and gauntlets
- code: '0x07'
type: <a name="Header_ItemType_7">Headgear</a></b> (Helms, hats, and other head-wear)
- code: '0x08'
type: Keys (not in Icewind Dale?)
- code: '0x09'
type: Potions
- code: '0x0a'
type: Rings
- code: '0x0b'
type: Scrolls
- code: '0x0c'
type: Shields (not in IWD)
- code: '0x0d'
type: Food
- code: '0x0e'
type: <b><a name="Header_ItemType_14">Bullets</a></b> (for a sling)
- code: '0x0f'
type: Bows
- code: '0x10'
type: Daggers
- code: '0x11'
type: Maces (in BG, this includes clubs)
- code: '0x12'
type: Slings
- code: '0x13'
type: Small swords
- code: '0x14'
type: Large swords
- code: '0x15'
type: Hammers
- code: '0x16'
type: Morning stars
- code: '0x17'
type: Flails
- code: '0x18'
type: Darts
- code: '0x19'
type: Axes (specifically, 1-handed axes -- halberds and 2-handed polearms not included)
- code: '0x1a'
type: Quarterstaff
- code: '0x1b'
type: Crossbow
- code: '0x1c'
type: Hand-to-hand weapons (fist, fist irons, punch daggers, etc)
- code: '0x1d'
type: Spears
- code: '0x1e'
type: Halberds (2-handed polearms)
- code: '0x1f'
type: <b><a name="Header_ItemType_31">Crossbow bolts</a></b>
- code: '0x20'
type: Cloaks and robes
- code: '0x21'
type: Gold pieces (not an inventory item, but can appear as "monster dropped" treasure)
- code: '0x22'
type: Gems
- code: '0x23'
type: Wands
- code: '0x24'
type: Containers/eye/broken armor
- code: '0x25'
type: Books/Broken shields/bracelets
- code: '0x26'
type: Familiars/Broken swords/earrings
- code: '0x27'
type: Tattoos (PST)
- code: '0x28'
type: Lenses (PST)
- code: '0x29'
type: Bucklers/teeth
- code: '0x2a'
type: Candles
- code: '0x2b'
type: Unknown
- code: '0x2c'
type: Clubs (IWD)
- code: '0x2d'
type: Unknown
- code: '0x2e'
type: Unknown
- code: '0x2f'
type: Large Shields (IWD)
- code: '0x30'
type: Unknown
- code: '0x31'
type: Medium Shields (IWD)
- code: '0x32'
type: Notes
- code: '0x33'
type: Unknown
- code: '0x34'
type: Unknown
- code: '0x35'
type: Small Shields (IWD)
- code: '0x36'
type: Unknown
- code: '0x37'
type: Telescopes (IWD)
- code: '0x38'
type: Drinks (IWD)
- code: '0x39'
type: Great Swords (IWD)
- code: '0x3a'
type: Container
- code: '0x3b'
type: Fur/pelt
- code: '0x3c'
type: Leather Armor
- code: '0x3d'
type: Studded Leather Armor
- code: '0x3e'
type: Chain Mail
- code: '0x3f'
type: Splint Mail
- code: '0x40'
type: Half Plate
- code: '0x41'
type: Full Plate
- code: '0x42'
type: Hide Armor
- code: '0x43'
type: Robe
- code: '0x44'
type: Unknown
- code: '0x45'
type: Bastard Sword
- code: '0x46'
type: Scarf
- code: '0x47'
type: Food (IWD2)
- code: '0x48'
type: Hat
- code: '0x49'
type: Gauntlet
5 changes: 5 additions & 0 deletions _data/file_formats/sto_v1/cure.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- desc: Filename of SPL
type: resref
- desc: Spell price
type: dword
offset: 0x8
9 changes: 9 additions & 0 deletions _data/file_formats/sto_v1/drink.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
- desc: Rumour resource
type: resref
- desc: Drink name strref
type: strref
- desc: Drink price
type: dword
- desc: Alcoholic strength
type: dword
offset: 0x10
106 changes: 106 additions & 0 deletions _data/file_formats/sto_v1/header.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
- desc: Signature ('STOR')
type: char array
length: 4

- desc: Version ('V1.0')
type: char array
length: 4

- desc: Type (0=Store, 1=Tavern, 2=Inn, 3=Temple, 5=Container)
type: dword

- desc: name
type: strref

- desc: |
Flags
- bit 0: User allowed to buy
- bit 1: User allowed to sell
- bit 2: User allowed to identify items
- bit 3: User allowed to steal
- bit 4: User allowed to donate money
- bit 5: User allowed to purchase cures
- bit 6: User allowed to purchase drinks
- bit 7: Unknown
- bit 8: Unknown
- bit 9: Quality 1 (tvrnqul0-3)
- bit 10: Quality 2 (tvrnqul0-3)
- bit 11: Unknown
- bit 12: Buy Fenced Goods
- bit 13: Reputation doesn't affect prices (BGEE)
- bit 14: Toggle item recharge (TobEx)
- bit 15: **User allowed to sell [critical]({{ "/file_formats/ie_formats/itm_v1.htm#Header_Flags_BIT0" | prepend: relurl }}) items** (BGEE)
type: dword

- desc: Store "sell price markup" (percentage of base price store charges for items)
type: dword

- desc: Store "buy price markup" (percentage of base price store is willing to pay)
type: dword

- desc: Depreciation rate
type: dword

- desc: "% chance of steal failure"
type: word

- desc: Capacity (0=unlimited)
type: word

- desc: Unknown
type: byte array
length: 8

- desc: Offset to [items purchased](#storv1_0_Buy) section
type: dword
- desc: Count of items in [items purchased](#storv1_0_Buy) section
type: dword

- desc: Offset to [items for sale](#storv1_0_Sale) section
type: dword
- desc: Count of [items for sale](#storv1_0_Sale)
type: dword

- desc: Lore
type: dword

- desc: ID Price
type: dword

- desc: Rumours (Tavern)
type: resref

- desc: Offset to [drinks](#storv1_0_Drink) section
type: dword
- desc: Count of [drinks](#storv1_0_Drink)
type: dword

- desc: Rumours (Temple)
type: resref

- desc: |
Room flags
- bit 0: Peasant
- bit 1: Merchant
- bit 2: Noble
- bit 3: Royal
type: dword

- desc: Price of a peasant room
type: dword
- desc: Price of a merchant room
type: dword
- desc: Price of a noble room
type: dword
- desc: Price of a royal room
type: dword

- desc: Offset to [cures](#storv1_0_Cure) section
type: dword
- desc: Count of [cures](#storv1_0_Cure)
type: dword

- desc: Unknown
type: byte array
length: 36
offset: 0x78
25 changes: 25 additions & 0 deletions _data/file_formats/sto_v1/item.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
- desc: Filename of ITM
type: resref
- desc: Item expiration time (replace with drained item)
type: word
- desc: Quantity/Charges 1
type: word
- desc: Quantity/Charges 2
type: word
- desc: Quantity/Charges 3
type: word
- desc: |
Flags
- bit 0: Identified
- bit 1: Unstealable
- bit 2: Stolen
- bit 3: <a name="storv1_0_Sale_0x10_BIT3">**Undroppable**</a>
type: dword
- desc: Amount of this item in stock
type: dword
- desc: |
Infinite supply flag (0=limited stock, 1=infinite stock)
Items with this flag set are automatically shown as identified
type: dword
offset: 0x18
37 changes: 37 additions & 0 deletions _includes/item_types.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<br />
<div class="fileHeader"><a id="Header_ItemType">Item Types</a></div>
<div class="indent1">
<br />
These codes are used in store files to indicate which types of items they will
buy. They are also used to determine which inventory slots the item is allowed
to go into on the inventory screen and the sound the item makes when moved in
the inventory.<br />
<br />
<table border="1" width="98%">
<colgroup>
<col width="10%" />
<col width="*" />
</colgroup>
<thead>
<tr>
<th>Code</th>
<th>Item type</th>
</tr>
</thead>
<tbody>
{% for item in site.data.file_formats.item_types %}
<tr>
<td>{{ item.code }}</td>

{% if item.type == "Unknown" %}
{% assign type = '<div class="unknown">Unknown</div>' %}
{% else %}
{% assign type = item.type %}
{% endif %}

<td>{{ type }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
Loading

0 comments on commit e50e28f

Please sign in to comment.