Along with parts, players can also obtain Items. Items can be exchanged for many things like cars, parts, boosts and warps. Most items were obtained from winning races. But some can be purchased from a shop. While working on shops I started on Items next. As I had the p.dat and s.dat files worked out I knew the prices for these items weren’t in those files and as there weren’t any other files locally and I wasn’t sending the values the client must have this data hard coded. Reversing the client code pointed me to the table. There are 2319 items in the table and each entry being 18 bytes. Amongst those bytes was the sale price. Not only that the resale price as the players can sell the items back. So I extracted this table also and have the server process the file for prices. However the sale prices for parts didn’t match up. But they did match the price it costs to buy the item from the parts shop. And sure enough parts do use the prices from the p.dat file.
These items can also be used to redeem cars and parts so I need to implement that. Not keen on creating a massive “if” or “switch” code block what these items do must be what these other bytes are for. Sure enough this is the case. It contains the item ID, Item type, Car Class, Car Manufacturer, Car ID, Part Category, Part Type, Type Value, Boosts, Resale value and finally Sale value. So using this data I can now process what to do based on the item ID sent to the server from the client. Which worked out to be a simple process.
There are many unused items but I can also add items to the game if i wanted. I’m gutted to see car items in the client for cars that weren’t in the game. Well technically all the cars from TXR are in the game they just don’t have the car models. I guess Genki planned on “adding” cars to the game as time went on.