PURCHASE.DAT

Contents

General Notes

PURCHASE.DAT is found in the savegame directories (GAME_1 through GAME_10 and MISSDAT) 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

1 (1 Byte): Index to an array of the amount of inventory space used, (see Notes on Sorting below). For General Items (Item Category=0), this value perhaps controls the sort order on the Base Information Stores screen (only General Items appear there). Or more likely, the Stores listing just shares a common index order with the array of inventory space used.

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

0 Skyranger
1 Lightning
2 Avenger
3 Interceptor
4 Firestorm

2-5 (4 Bytes): These four bytes are set to [E8 03 00 00] (=1000) for all entries except manufactured Crafts (Firestorm, Lightning, Avenger)

6-9 (4 Bytes): Item Cost (buy price) if Purchaseable. 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...

10-13 (4 Bytes): Item Selling Price.

14 (1 Byte): 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):

15: Set to 00 (0) for all entries. It's possible that it is the high bit for transfer time, but editing this doesn't change anything...

16: Usually set to 0, but seems to hold the quantity purchased last time (i.e. will be set to 5 on grenades if you just bought 5 of them). Unsure when this gets cleared, and unsure why it is saved. Probably because they just used the same structure as in the Purchase screen in saving this file.

17: Appears to always be set to 00. It's possible this is the high bit for offset 16 but since you can only buy (and transfer) 255 items at a time this seems unlikely. Might be another variable of some sort.

18 (1 Byte): Purchase-ability flag: 1 for everything that you can buy on the Purchase/Recruit screen, 0 for everything else

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

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

0

Soldier

1

Scientist

2

Engineer

3

Skyranger

4

Lightning

5

Avenger

6

Interceptor

7

Firestorm

8

Stingray Launcher

9

Avalanche Launcher

10

Cannon

11

Fusion Ball Launcher

12

Laser Cannon

13

Plasma Beam

14

Stingray Missile

15

Avalanche Missile

16

Cannon Rounds[x50]

17

Fusion Ball

18

Tank/Cannon

19

HWP Cannon Shells

20

Tank/Rocket

21

HWP Rockets

22

Tank/Laser Cannon

23

Hovertank/Plasma

24

Hovertank/Launcher

25

HWP Fusion Bomb

26

Pistol

27

Pistol Clip

28

Rifle

29

Rifle Clip

#

Item

30

Heavy Cannon

31

HC-AP Ammo

32

HC-HE Ammo

33

HC-I Ammo

34

Auto-Cannon

35

AC-AP Ammo

36

AC-HE Ammo

37

AC-I Ammo

38

Rocket Launcher

39

Small Rocket

40

Large Rocket

41

Incindiary Rocket

42

Laser Pistol

43

Laser Rifle

44

Heavy Laser

45

Grenade

46

Smoke Grenade

47

Proximity Grenade

48

High Explosive

49

Motion Scanner

50

Medi-Kit

51

Psi-Amp

52

Stun Rod

53

Electro-flare

54

Elerium-115

55

Heavy Plasma

56

Heavy Plasma Clip

57

Plasma Rifle

58

Plasma Rifle Clip

59

Plasma Pistol

#

Item

60

Plasma Pistol Clip

61

Blaster Launcher

62

Blaster Bomb

63

Small Launcher

64

Stun Bomb

65

Alien Grenade

66

Mind Probe

67

Sectoid Corpse

68

Snakeman Corpse

69

Ethereal Corpse

70

Muton Corpse

71

Floater Corpse

72

Celatid Corpse

73

Silacoid Corpse

74

Chryssalid Corpse

75

Reaper Corpse

76

Sectopod Corpse

77

Cyberdisk Corpse

78

UFO Power Source

79

UFO Navigation

80

UFO Construction

81

Alien Food

82

Alien Reproduction

83

Alien Entertainment

84

Alien Surgery

85

Examination Room

86

Alien Alloys

87

Alien Habitat

88

Personal Armour

89

Power Suit

#

Item

90

Flying 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.