STOR file format
FileExtension : STO
Content : Description of stores files V.1
History : File done by IEFFHP
  CatTeamBG info (21.09.01)
  M (15.01.02)
Description

These files contain a description of the types of items and services available for sale in a given store, inn, tavern, or temple.
STOR file versions

    * V1.0: Baldur's Gate I-II
    * V1.1: Planescape: Torment
    * V9.0: Icewind Dale I-II


STOR V1.0

Overall structure

    * Header
    * Items for sale
    * Drinks for sale
    * Cures for sale
    * Items purchased here

STOR V1.0 Header
Offset Size (data type) Description
0x0000 4 (char array) Signature ('STOR')
0x0004 4 (char array) Version ('V1.0')
0x0008 4 (dword) Type? (0=store, 1=tavern, 2=inn, 3=temple, 4=container iwd2, 5=container bg2)
0x000c 4 (strref) Name
0x0010 4 (dword) Flags:

    * bit 0 (0x01) : User allowed to buy
    * bit 1 (0x02) : User allowed to sell
    * bit 2 (0x04) : User allowed to identify items
    * bit 3 (0x08) : User allowed to steal (not in V9.0)
    * bit 4 (0x10) : User allowed to donate money (doesn't set anything)
    * bit 5 (0x20) : User allowed to purchase cures
    * bit 6 (0x40) : User allowed to purchase drinks
    * bit 7 (0x80) : Unknown
    * bit 8 (0x100): Unknown
    * bit 9 (0x200): Buy Fenced Goods ?

0x0014 4 (dword) Store "sell price markup" (percentage of base price store charges for items)
0x0018 4 (dword) Store "buy price markup" (percentage of base price store is willing to pay)
0x001c 4 (dword) Price depreciation
0x0020 2 (word) Probability to fail to steal
0x0022 2 (word) Bag capacity for BG2
0x0024 8 (bytes) Dialog resource
0x002c 4 (dword) Offset to Items purchased here section
0x0030 4 (dword) Count of items in Items purchased here section.
0x0034 4 (dword) Offset to Items for sale section.
0x0038 4 (dword) Count of Items for sale
0x003c 4 (dword) Temple Lore
0x0040 4 (dword) ID price
0x0044 8 (resref) Dialog resource for tavern rumors.
0x004c 4 (dword) Offset to Drinks section.
0x0050 4 (dword) Count of Drinks.
0x0054 8 (resref) Dialog resource for temple rumours.
0x005c 4 (dword) Bitmapped flags indicating room types available for rent:

    * bit 0 (0x01) : peasant
    * bit 1 (0x02) : merchant
    * bit 2 (0x04) : noble
    * bit 3 (0x08) : royal

0x0060 4 (dword) Price of a peasant room.
0x0064 4 (dword) Price of a merchant room.
0x0068 4 (dword) Price of a noble room.
0x006c 4 (dword) Price of a royal room.
0x0070 4 (dword) Offset to Cures section.
0x0074 4 (dword) Count of Cures.
0x0078 36 (bytes) Unknown
For V9.0 only:
0x009c 4 (dword) Capacity
0x00a0 80 (bytes) Unknown

STOR V1.0 Items for Sale
Offset Size (data type) Description
0x0000 8 (resref) Resource name of the item in question
0x0008 2 (word) Unknown
0x000a 2 (word) Usage 1. This is the first parameter passed when CreateItem is called from a script, for instance. This value probably means "the number of 'primary' uses of this item". For quantity items, this is a quantity. For some magical items, this is a number of charges. (Some items may have more than one usable magical aspect -- for instance, cast fireball 5 times and aganazzar's scorcher 10 times. In a case like that, this would be 5.)
0x000c 2 (word) Usage 2. This is the second parameter passed when CreateItem is called from a script, for instance. This value probably means "the number of 'secondary' uses of this item". (For items which have more than one usable aspect -- for instance, cast fireball 5 times and aganazzar's scorcher 10 times. In a case like that, this would be 10.)
0x000e 2 (word) Usage 3. This is the third parameter passed when CreateItem is called from a script, for instance. This value probably means "the number of 'tertiary' uses of this item".
0x0010 4 (dword) Flags. 

    * bit 0 (0x01) is set, it means "identified" 
    * bit 1 (0x02) is set, it means "unstealable"
    * bit 2 (0x04) is set, it means "stolen".

0x0014 4 (dword) Number of this item in stock.
0x0018 4 (dword) Infinite supply flag (?)

STOR V1.1 Items for Sale (PST)
Offset Size (data type) Description
0x0000 8 (resref) Resource name of the item in question
0x0008 2 (word) Unknown
0x000a 2 (word) Usage 1. This is the first parameter passed when CreateItem is called from a script, for instance. This value probably means "the number of 'primary' uses of this item". For quantity items, this is a quantity. For some magical items, this is a number of charges. (Some items may have more than one usable magical aspect -- for instance, cast fireball 5 times and aganazzar's scorcher 10 times. In a case like that, this would be 5.)
0x000c 2 (word) Usage 2. This is the second parameter passed when CreateItem is called from a script, for instance. This value probably means "the number of 'secondary' uses of this item". (For items which have more than one usable aspect -- for instance, cast fireball 5 times and aganazzar's scorcher 10 times. In a case like that, this would be 10.)
0x000e 2 (word) Usage 3. This is the third parameter passed when CreateItem is called from a script, for instance. This value probably means "the number of 'tertiary' uses of this item".
0x0010 4 (dword) Flags. 

    * bit 0 (0x01) is set, it means "identified" 
    * bit 1 (0x02) is set, it means "unstealable"
    * bit 2 (0x04) is set, it means "stolen".

0x0014 4 (dword) Number of this item in stock.
0x0018 4 (dword) Infinite supply flag (?)
0x001c 4 (dword) Strref for item trigger
0x0020 56 (bytes) Unknown

STOR V1.0 Drinks for Sale
Offset Size (data type) Description
0x0000 8 (bytes) Unknown
0x0008 4 (strref) Drink name
0x000c 4 (dword) Drink price
0x0010 4 (dword) Unknown. Maybe "percentage chance of hearing a rumor if you buy this", or may indicate the strength of the alcohol's intoxicative facility.

STOR V1.0 Cures for Sale
Offset Size (data type) Description
0x0000 8 (resref) Resource name of the spell to be cast on the selected person
0x0008 4 (dword) Price of this cure

STOR V1.0 Items Purchased Here

This is an array of dwords. These dwords indicate categories of items from the Item category codes table. The category code can also be found inside the ITM file for an itm.
Item category codes

These codes are used in Stor files to indicate which types of items they will buy. They may also be used to determine which inventory slots the item is allowed to go into on the inventory screen.

Codes from Baldur's Gate, Planescape: Torment, and Icewind Dale
Code Item type
0x0000 Books/misc (this may be the default type, as several "monster items" are of this type.
0x0001 Amulets and necklaces
0x0002 Armor
0x0003 Belts and girdles
0x0004 Boots
0x0005 Arrows
0x0006 Bracers and gauntlets
0x0007 Helms, hats, and other head-wear
0x0008 Keys (not in Icewind Dale?)
0x0009 Potions
0x000a Rings
0x000b Scrolls
0x000c Shields (not in IWD)
0x000d ??? Unknown
0x000e Bullets (for a sling)
0x000f Bows
0x0010 Daggers
0x0011 Maces (in BG, this includes clubs)
0x0012 Slings
0x0013 Short swords
0x0014 Long swords (in BG, this includes 2-handed and bastard swords)
0x0015 Hammers
0x0016 Morning stars
0x0017 Flails
0x0018 Darts
0x0019 Axes (specifically, 1-handed axes -- halberds and 2-handed polearms not included)
0x001a Quarterstaff
0x001b Crossbow
0x001c Hand-to-hand weapons (fist, fist irons, punch daggers, etc)
0x001d Spears
0x001e Halberds (2-handed polearms)
0x001f Crossbow bolts
0x0020 Cloaks and robes
0x0021 Gold pieces (not an inventory item, but can appear as "monster dropped" treasure)
0x0022 Gems
0x0023 Wands
0x0024

    * Torment: Eyeballs
    * Icewind Dale: Keys
    * Baldur's Gate 2: Container

0x0025

    * Torment: Bracelets
    * Icewind Dale: (a broken shield?)

0x0026

    * Torment: Earrings
    * Icewind Dale: (2 broken swords, including the broken sword of Aihonen)

The following items are Torment/Icewind Dale only:
0x0027 Torment: Tattoos
0x0028 Torment: Lenses
0x0029

    * Torment: Teeth
    * Icewind Dale: Bucklers
    * Baldur's Gate: unused

The following items are Icewind Dale (1/2) only:
0x002a Icewind Dale: "Candle" (i.e. only 1 item)
0x002b ??? Unknown or unused
0x002c Icewind Dale: Clubs
0x002d ??? Unknown or unused
0x002e ??? Unknown or unused
0x002f Icewind Dale: Shields (large)
0x0030 ??? Unknown or unused
0x0031 Icewind Dale: Shields (medium)
0x0032 ??? Unknown or unused
0x0033 ??? Unknown or unused
0x0034 ??? Unknown or unused
0x0035 Icewind Dale: Shields (small)
0x0036 ??? Unknown or unused
0x0037 Icewind Dale: "Telescope" (only 1 item)
0x0038 Icewind Dale: "Bottle of wine" and "Container of Razorvine Extract" (only 2 items)
0x0039 Icewind Dale: Great swords
0x003a Icewind Dale: Container
Icewind Dale 2 only items:
0x003b Fur/pelt
0x003c Leather armour
0x003d Studded leather
0x003e Chain mail
0x003f Splint mail
0x0040 Half plate
0x0041 Full plate
0x0042 Hide armour
0x0043 Robe
0x0044 Unknown
0x0045 Bastard sword
0x0046 Scarf
0x0047 Food
0x0048 Hat
0x0049 Gauntlet
