Difference between revisions of "PURCHASE.DAT"

From UFOpaedia
Jump to navigation Jump to search
m (fixed a few mistakes)
m (→‎Notes on Sorting: change link)
Line 145: Line 145:
  
 
== Notes on Sorting ==
 
== Notes on Sorting ==
'''NOTE:''' Based on some hacking of [[GEOSCAPE.EXE]], the 'sort' value appears to be an index to arrays. See [[User Talk:Pi Masta]] for more details.
+
'''NOTE:''' Based on some hacking of [[GEOSCAPE.EXE]], the 'sort' value appears to be an index to arrays. See [[User:Pi Masta#Base Items store space|User:Pi Masta]] for more details.
  
 
'''1)''' For all screens, the order of the manufactured craft weapons is reversed (i.e. they are listed as Plasma Beam, Laser Cannon, Fusion Ball Launcher in this file, and follow that order for the 'Sort Order' (offset 1) value as well, but are displayed as Fusion Ball Launcher, Laser Cannon, Plasma Beam on the screens)
 
'''1)''' For all screens, the order of the manufactured craft weapons is reversed (i.e. they are listed as Plasma Beam, Laser Cannon, Fusion Ball Launcher in this file, and follow that order for the 'Sort Order' (offset 1) value as well, but are displayed as Fusion Ball Launcher, Laser Cannon, Plasma Beam on the screens)

Revision as of 00:05, 6 March 2007

General Notes

PURCHASE.DAT is found in the savegame directory (GAME_1 through GAME_10) and contains both buying and selling prices for all items. It also contains the value for delivery time (even for manufactured and alien items) and a flag for whether or not an item may purchased on the Purchase/Recruit Screen.

There are 91 entries, each of which is 20 bytes long, for a total of 1,820 bytes long.

Items are divided into three general categories: Personnel, Crafts, and all other items. Of the 91 entries, 3 are for Personnel, 5 for Crafts, and 83 for other items, including 11 for alien corpses (5 for the major races + 6 for the terrorists they bring along), and 3 entries that the game doesn't seem to use (UFO Construction, Alien Reproduction, and Alien Habitat.)

The order of items in this file is generally the same as on the Purchase/Recruit, Sell/Sack, or Transfer Screens. Each entry also contains a value that generally conforms to the sort order on the Base Information->Stores screen (which is slightly different from the sort order of the other screens.) See Notes on Sorting at the end of this article for more details.

Values are presented according to offset (0 to 19) in bold.

Structure

0: Item Category:

  0 General Item...basically, anything not Personnel or Crafts
  1 X-Com Craft
  2 Soldier
  3 Scientist
  4 Engineer

1: Sort Order (or Index, see below): for General Items(Item Category=0), this value seems to control sort order on the Base Information->Stores screen (only General Items appear there.)

  00-42 'Human' Items...all purchaseable equipment, all Craft weapons/ammo, all HWPs, Lasers,
        Motion Scanner, Medikit, and PsiAmp
  43-48 Not Used
  49-59 Alien Weapons/Ammo...Heavy Plasma through Alien Grenade
  60-61 E-115 & Mind Probe...Alien Non-Weapon items that can be picked up in Battlescape?
  62-64 Not Used
  65-75 Alien Corpses
  76-79 Not Used
  80-89 Alien Items...UFO Power Source through Alien Habitat
  90-92 Armor...Personal Armor, Power Suit, Flying Suit
  93-95 HWP Ammo...HWP Cannon Shells, HWP Rockets, HWP Fusion Bomb

For Personnel, this value is '0', while for Crafts, it indicates Craft Type:

  0 Skyranger
  1 Lightning
  2 Avenger
  3 Interceptor
  4 Firestorm

2-3: ?? These two bytes are set to [E8 03] (=1000) for all entries except manufactured Crafts (Firestorm, Lightning, Avenger) (See Below)

4-5: ?? These two bytes are set to [00 00] (0) for all entries (See Below)

6-8: Item Cost if Purchaseable. 24 bits = max value ~16.7mil, ~8.4mil if a signed integer. Curiously, starting with entry 56 (Heavy Plasma Clip), set to [E8 03 00] (=1000) for the remainder of entries (none of which is normally purchaseable.) Not sure why, or why it didn't start with entry 55 (Heavy Plasma), the first 'pure' alien item in the file. Needs more research...

9: Set to [00] (0) for all entries (See Below)

10-12: Item Selling Price. 24 bits = max value ~16.7mil, ~8.4mil if a signed integer

13: Set to [00] (0) for all entries (See Below)

14: Transfer time for new purchases, in hours. All items have this value, even manufacture-only and alien items, and it is usually a multiple of 24 (=1 day):

  96 for most Crafts, HWPs, and Craft Cannon Rounds
  72 for Skyranger and Personnel hires
  48 for Craft Weapons and Ammo (ex. Cannon Rounds), HWP Ammo, and non-Battlescape Alien Items
  32 for Alien Corpses and X-Com Armor
  24 for everything else

15-17: Set to [00 00 00] (0) for all entries (See Below)

18: Purchaseability flag: 1 for everything that you can buy on the Purchase/Recruit screen, 0 for everything else

19: Set to [00] (0) for all entries

Special Note

Alot of these 0 values can be explained by using 4 byte integers (longs), since the game stores these values in little-endian format. Also for values such as Item Cost and Item Selling Price, 24-bit integers are not common, however 32-bit integers (longs) are more common and are used in the game, the your current funds in LIGLOB.DAT for example is a long integer. It also makes sense that the prices would be in the same data type to help with calculations.

With offset 2, it also explains why offsets 3 and 4 are always 0, since the only values used are 0 and 1000, it would always set the higher bytes to 0. The last offset (19) is probably also the high byte for the Purchasability flag, and again would always be 0.

All of this is speculation (read: I'm too lazy to test this) but would make this file's values completely known. Only the Purchaseability and 'Manufactured' craft flags the only thing worth looking into more. --Pi Masta 15:14, 8 February 2007 (PST)


Entry Index

# Item Name # Item Name # Item Name # Item Name
0 Soldier 30 Heavy Cannon 60 Plasma Pistol Clip 90 Flying Suit
1 Scientist 31 HC-AP Ammo 61 Blaster Launcher
2 Engineer 32 HC-HE Ammo 62 Blaster Bomb
3 Skyranger 33 HC-I Ammo 63 Small Launcher
4 Lightning 34 Auto-Cannon 64 Stun Bomb
5 Avenger 35 AC-AP Ammo 65 Alien Grenade
6 Interceptor 36 AC-HE Ammo 66 Mind Probe
7 Firestorm 37 AC-I Ammo 67 Sectoid Corpse
8 Stingray Launcher 38 Rocket Launcher 68 Snakeman Corpse
9 Avalanche Launcher 39 Small Rocket 69 Ethereal Corpse
10 Cannon 40 Large Rocket 70 Muton Corpse
11 Fusion Ball Launcher 41 Incindiary Rocket 71 Floater Corpse
12 Laser Cannon 42 Laser Pistol 72 Celatid Corpse
13 Plasma Beam 43 Laser Rifle 73 Silacoid Corpse
14 Stingray Missile 44 Heavy Laser 74 Chryssalid Corpse
15 Avalanche Missile 45 Grenade 75 Reaper Corpse
16 Cannon Rounds[x50] 46 Smoke Grenade 76 Sectopod Corpse
17 Fusion Ball 47 Proximity Grenade 77 Cyberdisk Corpse
18 Tank/Cannon 48 High Explosive 78 UFO Power Source
19 HWP Cannon Shells 49 Motion Scanner 79 UFO Navigation
20 Tank/Rocket 50 Medi-Kit 80 UFO Construction
21 HWP Rockets 51 Psi-Amp 81 Alien Food
22 Tank/Laser Cannon 52 Stun Rod 82 Alien Reproduction
23 Hovertank/Plasma 53 Electro-flare 83 Alien Entertainment
24 Hovertank/Launcher 54 Elerium-115 84 Alien Surgery
25 HWP Fusion Bomb 55 Heavy Plasma 85 Examination Room
26 Pistol 56 Heavy Plasma Clip 86 Alien Alloys
27 Pistol Clip 57 Plasma Rifle 87 Alien Habitat
28 Rifle 58 Plasma Rifle Clip 88 Personal Armour
29 Rifle Clip 59 Plasma Pistol 89 Power Suit

Notes on Sorting

NOTE: Based on some hacking of GEOSCAPE.EXE, the 'sort' value appears to be an index to arrays. See User:Pi Masta for more details.

1) For all screens, the order of the manufactured craft weapons is reversed (i.e. they are listed as Plasma Beam, Laser Cannon, Fusion Ball Launcher in this file, and follow that order for the 'Sort Order' (offset 1) value as well, but are displayed as Fusion Ball Launcher, Laser Cannon, Plasma Beam on the screens)

2) Except as noted in 1), above, the Purchase/Recruit screen displays items in the order of their entries. If you hack Offset 18 so everything is purchaseable, they will display in that order.

3) On the Transfer and Sell/Sack screens, all soldiers not currently assigned to crafts will list individually first, then all crafts (but not neccessarily by the order listed in this file, e.g. in my test file, Interceptor-1 listed before Lightning-2,) then scientists and engineers, then the rest of the items will sort in the order of their entries (except as noted in 1), above)

4) Finally, on the Base Information->Stores screen, only General Items (i.e. anything for which Offset 0 = 0) will display, sorted according to the Sort Order (Offset 1) value (except as noted in 1), above.) This basically means that E-115, which normally sorts between Electro-flare and Heavy Plasma, will instead sort to between Alien Grenade and Mind Probe, and that HWP Ammo sorts to the end of the list instead of immediately following its HWP entry.

See Also