STF

From OHRRPGCE-Wiki
Jump to: navigation, search

.STF holds shop stuff. The length of each record is stored in BINSIZE.BIN and is currently 84 bytes. 50 records per shop corresponding to 50 items.

There are always at least 1 more record in the .STF lump then the last store needs. The reason why, it is a secret to everyone.

If you have more than one shop, there should be at least this many records..:

( ( num_shops - 1 ) * 50 ) + num_things_in_last_shop.

When the file size is smaller than this, the last N shops are empty (and hence no data ever got stored for them.)

The last shop having <50 records as shown above, is caused by OHRRPGCE's use of random-access I/O.

If a record is stored but not used, it is likely to be uninitialised.

Offsets are in INTs from the start of the record.

About Formal Specs

Offset Data Meaning
0-16 VSTR(1i+16i=34b) Thing name
17 INT Thing type (0 = item, 1 = hero)
18 INT Thing hero/item ID
19 INT In stock (-1 = infinite, >= 0 is amount initially in-stock)
20 INT Buy require tag.. (0 = n/a, -n = tag n must be off +n = tag n must be on)
21 INT Sell require tag.. (see Buy)
22 INT Buy set tag
23 INT Sell set tag
24 INT Buy price
25 INT Must trade in item 1 type (item ID + 1 or 0 for none)
26 INT If this is an item, Sell type:

0 = Don't Change Inventory
1 = Acquire Inventory (store aquires infinite inventory)
2 = Increment Inventory (store gains 1 item if it has a finite amount in stock)
3 = Refuse to Buy
If this is a hero, Level:
-1 = Default
0-99 = Level

27 INT Sell price
28 INT Trade in for type (item ID + 1 or 0 for none)
29 INT Trade in for amount - 1
30 INT Must trade in item 1 number - 1
31 INT Must trade in item 2 type (item ID + 1 or 0 for none)
32 INT Must trade in item 2 number - 1
33 INT Must trade in item 3 type (item ID + 1 or 0 for none)
34 INT Must trade in item 3 number - 1
35 INT Must trade in item 4 type (item ID + 1 or 0 for none)
36 INT Must trade in item 4 number - 1
37-41 INT * 3 unused

Replacement proposal[edit]

Here is a proposal for a RELOAD file format that could replace the STF lump. This will probably not have its own lump, rather it will be a sub-node in a format that replaces both SHO and STF. A converter from STF format to this reload format has already been implemented, and is already being used for in-memory representation of shop stuff data, but it is not yet being used for on-disk storage

  • shop_stuff - parent node for all the stuff in a shop
    • stuff_slot int - Integer value is the stuff slot number
      • item int - An item. the integer value is the item ID
        • name string - The name of the item. If this node is missing, use the default item name
        • infinite - if this node is present, the shop has infinite stock of this item. (if this is present, the stock node is ignored)
        • stock int - if this node is present, the integer value is the number of this item that is available. Value is 0 for unavailable items
        • buy - parent node for buying cost (exactly the same as the hire node for heroes)
          • price int - price to buy this item
          • trade int - id number of an item for trade. This node can appear more than once.
            • count int - number of this item to require in trade
          • require_tag int - require this tag to be set for the item to be available to buy
          • set_tag int - set this tag when the item is purchased
        • sell - parent node for selling value
          • sell_type string - one of "normal", "acquire", "increment", or "refuse"
          • price int - price to sell this item
          • trade int - id number of an item for trade. This node can appear more than once.
            • count int - number of this item to require in trade
          • require_tag int - require this tag to be set for the shop to be willing to purchase this item from you
          • set_tag int - set this tag when the item is sold to the shop
      • hero int - A hero for hire. The integer value is the hero ID
        • name string - The name of the hero. If this node is missing, use the default hero name
        • level int - the level of the hero when hired. If this node is not present, use the default level.
        • infinite - if this node is present, the shop has infinite stock of this hero. (if this is present, the stock node is ignored)
        • stock int - if this node is present, the integer value is the number of this hero that is available. Value is 0 for unavailable heroes
        • hire - parent node for hiring cost (exactly the same as the buy node for items)
          • price int - price to hire this hero
          • trade int - id number of an item for trade. This node can appear more than once.
            • count int - number of this item to require in trade
          • require_tag int - require this tag to be set for the hero to be available to hire
          • set_tag int - set this tag when the hero is hired