L-Leite / cso2-master-server

A master server for CSO2
MIT License
155 stars 62 forks source link

Buy Menu non-responsive #10

Closed ReyZu closed 5 years ago

ReyZu commented 6 years ago

When playing TDM and your character dies, the buy menu doesn't respond after bringing it up (B key).

You cannot buy any weapons and the menu is simply empty.

Cannot exit too. Buttons do not respond. Menu only disappears once you respawn.

cso2 commented 5 years ago

cso2_0008 Items must be added to inventory to change weapons and character.

L-Leite commented 5 years ago

I think that data is handled by Packet_Inventory, if anyone wants to have a look at it

leang97 commented 5 years ago

I think that data is handled by Packet_Inventory, if anyone wants to have a look at it

I am not a nodejs and typescript coder, but I take a look at the source code for master server anyway, the Master Server Code itself doesn't handle the packet for Inventory yet, that's why its empty. I still have no idea how the master server worked with packets and how it responds, etc, will need more guidance and how the packet worked and how do we know what packet to reply in the first place anyway, we can't just snatch the packet from the official server since it was down.

L-Leite commented 5 years ago

@leang97 Sorry for the late reply, and thanks for your effort.

The master server waits for clients. When a client connects to the server, it replies an acknowledgement message.

When you log in, they exchange version information (they trade some hash, I haven't looked into it) and login information (username, nexon username and password - all in plaintext).

If the login is successful, the server sends a bunch of information, like user's info (name, level, avatar...), user's inventory, shop items, channels... At the moment this master server only sends user info and channel info.

Now the user can request whatever it wants. At the moment you can only request a channel's room list and some room functions (such as creating a room, joining a room, etc.).

The server also listens to an UDP port in order to get the users' client, server and SourceTV ports (CSO2 uses UDP hole punching).

I have logged the packets from login in to starting a bot match in Tiancity's CSO2.

I found these two inventory packets: 1, 2. My userID was 83890926 (0x050012EE in hexadecimal).

You can also check address offset 0x2AB4C0 in engine.dll for the method Packet_Inventory::Decode, which receives inventory info from the master server (its declaration looks like bool Packet_Inventory::Decode(uint8_t* pPacketData, uint32_t iPacketLength)).

Feel free to ask any other question. You can also email me at ochii@leite.xyz.