Working on the shops for SBOL I found that half used data from local data files and others expected the server to provide the costs and items. For example; parts shops retrieve their costs from the parts file p.dat. However the car shop expects the server to provide this.

Starting with the parts shops. It makes things easier that the client already knows the prices this means I don’t need to worry about create such data from thin air. This does mean I’ll need to process the p.dat file as the client does. I already have my SBOL crypto library written which I can use to load the file and extract the costs from to verify that the costs provided by the client haven’t been altered. So I entered the shop to compare what was in game and in the file. The shop however didn’t show any items for sale. There is another packet which dictates if you have unlocked the item to show it in the shop. Also if you own the part so you can equip it without paying again. Part shops use the packet 0x900 type. When entering the shop the client will send a 0x900 packet, and as usual a response of Packet type + 0x80 is needed. So sending back a 0x980 packet I can include byte flags. These bytes are for if the player owns that part. I added the structure to the client data and store 3 states. Locked, Unlocked, Owned. Then use this data to construct the packet.

Whether or not the part is available to buy is also needed. This is sent in response to the 0x904 packet with an unexpected packet of 0x983. Shop packets aren’t the same as others. packets so a +0x80 response isn’t always a correct response.

Now with the shops showing items and with the server saving if a player has purchased an item I need to work on verifying these costs. This involved working out the structure of the p.dat file and s.dat file. I made a start documenting the p.dat structure. There are 5 tables in the file so suspected that which table to use was in the s.dat file which contains the car specs. Reversing the client code used to load the shop data it did indeed use the s.dat file.

Of each of the 5 part tables the engine, muffler and transmission have 3 tables within them. Each part also has 3 prices. This is for the class of car. A, B or C. Which table to use for the engine depends if its turbo or rotary. Non-turbos use engine table 1, Turbo use 2 and rotary use 3. Same goes for the Muffler. The transmission depends if there are 4, 5 or 6 gears on the standard car. So now I can verify the cost of the parts. With the exception of Wheels and Tyre/Brakes. These are calculated differently. Although there is a table in the p.dat file for tyres/brakes it is unused. Instead there are other tables hard coded in the client. So, I extract this table and have the server also use this table to verify the costs for wheels and tyre/brakes. This took a little longer to reverse but still pretty simple.

Finally, I’m finished with the parts shops.

Categories: General