ValvePython / csgo

🔫 Python package for interacting with CS:GO Game Coordinator
http://csgo.readthedocs.io
123 stars 17 forks source link

How does receive CSOEconGameAccountClient work ? #32

Closed S0PEX closed 3 years ago

S0PEX commented 3 years ago

Hey,

I am currently working on this functionality of retrieving CSOEconGameAccountClient in my C# library and can't figure out how CSOEconGameAccountClient is received. If I understood correctly the coordinator sends the message k_ESOMsg_Update(22) or k_ESOMsg_UpdateMultiple(26) then this message is parsed and the types are checked based on the cs.socache.ESOType if this type equals cs.socache.ESOType.CSOEconGameAccountClient then the proto CSOEconGameAccountClient is parsed. I am currently now understanding where this payload and type is located. Would it be possible that you guys could give me a brief overview how I would intercept the CSOEconGameAccountClient message ?

My understanding is that after the player played a game or logs in the k_ESOMsg_ are send where one contains the CSOEconGameAccountClient message but none if the protos contains the CSOEconGameAccountClient as a field so I am currently not sure how u are obtaining it.

Regards Artur

rossengeorgiev commented 3 years ago

You have to listen for the ESO messages:

https://github.com/ValvePython/csgo/blob/64f4007808c40d6cf6550762fceaea3956caca7b/csgo/features/sharedobjects.py#L122-L128

You the have a type_id and object_data. You use type_id to determine to correct protobuf message. Then use that to de-serialize object_data . The ESOMsg tells the action, such create, update, destroy, etc.

https://github.com/ValvePython/csgo/blob/64f4007808c40d6cf6550762fceaea3956caca7b/csgo/features/sharedobjects.py#L192

Since this is in a way shared state, you have to keep it around, and update it when message come in. You cannot change the values directly. Account data, lobbies, parties, inventory is handled like that

S0PEX commented 3 years ago

Thanks for the info.