ValvePython / csgo

🔫 Python package for interacting with CS:GO Game Coordinator

Home Page:http://csgo.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How does receive CSOEconGameAccountClient work ?

S0PEX opened this issue · comments

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

You have to listen for the ESO messages:

# register our handlers
csgo_client.on(ESOMsg.Create, self._handle_create)
csgo_client.on(ESOMsg.Update, self._handle_update)
csgo_client.on(ESOMsg.Destroy, self._handle_destroy)
csgo_client.on(ESOMsg.UpdateMultiple, self._handle_update_multiple)
csgo_client.on(ESOMsg.CacheSubscribed, self._handle_cache_subscribed)
csgo_client.on(ESOMsg.CacheUnsubscribed, self._handle_cache_unsubscribed)

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.

result = self._parse_object_data(type_id, object_data)

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

Thanks for the info.