Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Help] key_ready_up field for Dota 2 Ready Up status #297

Closed
ErkoKnoll opened this issue Jun 29, 2016 · 13 comments
Closed

[Help] key_ready_up field for Dota 2 Ready Up status #297

ErkoKnoll opened this issue Jun 29, 2016 · 13 comments

Comments

@ErkoKnoll
Copy link

Does anyone know what "key_ready_up" (fixed64 type) field in k_EMsgGCReadyUp request is supposed to represent? It is the request to ready up for the Dota 2 game once the lobby is full but it seems that unless you get it right the GC won't accept your request.

Here are few samples:
18140159124970866610
18140159126220110694

They seem to change but not when someone declines a ready up call and you have to press ready up later again, then it remains the same.

@rossengeorgiev
Copy link
Contributor

It's probably a lobby id

@ErkoKnoll
Copy link
Author

Not quite.

I created 2 lobbies and readied up for both of them in quick succession and results are the following:
1.
ReadyUpKey: 17125086796796702954
LobbyId: 24616250373260038
2. ReadyUpKey: 17125086796794504130
LobbyId: 24616250375458862

Interestingly if we divide ready up key with lobby ID it yields 695 with little difference in fractions for both cases. However If i checked some older logs then division yielded something in 700 range so there does not seem to be huge correlation with lobby ID.

Has anyone managed to achieve it for their project? Don't think Dota devs are going to tell me how to calculate it.

@rossengeorgiev
Copy link
Contributor

Well then you'll have to RE how that key is generated.

@psychonic
Copy link
Member

This isn't really a s SteamKit issue, but specific to the Dota client.

Regardless, the formula is LobbyId ^ ~(AccountId | (AccountId << 32))

@elpaxdota
Copy link

I was searching this formula for too long and you give it. But its not working. Can you test it ? Because I tested it and it gives me wrong ready_up_key. I have used netanalyzer.

var lobby = 24929512591156764;
var steam = 76561198134061545;
var ready = lobby ^ ~(steam | (steam << 32));
Console.WriteLine(ready);

ready_up key from netanalyzer 17725191030481842186, but formula outputs -793610637265637366. What is wrong ?

@psychonic
Copy link
Member

psychonic commented Feb 19, 2017 via email

@ErkoKnoll
Copy link
Author

@elpaxdota you need to use ulong data types explicitly and not var keyword, otherwise compiler will infer some variables to be signed longs and not to unsigned longs such as lobbyId.

@psychonic proposed formula seems to be correct but I cant get it working in C#. There seems to be always 1 bit that is flipped in my results.

Examples:
1111101010110000111110001111111101110010110011101011000110111010 <- Computed result
1111101110110000111110001111111101110010110011101011000110111010 <- Actual result
---------^ difference

1110101010011011010000101010011110010110000101111010000111111010 <- Computed result
1110101010011011010000101010011010010110000101111010000111111010 <- Actual result
------------------------------------------^ difference

@psychonic
Copy link
Member

It's possible that the formula could have changed, but it's really odd that it would be off by one seemingly-random bit.

@ErkoKnoll
Copy link
Author

ErkoKnoll commented Jul 9, 2017

@psychonic May I ask how did you come by the formula in the first place? Could it be rechecked? And the bit is not that random either, in my example, first it is the 8th bit and in the second example 32th bit. I guess if I did more checks the bit that would be flipped would always be the last bit in the byte.

This is the code I'm testing with.

        ulong lobbyId = 25154023524253231;
        ulong userId = 76561198316642346;
        ulong actualResult = 16905178909515424250; //Actual ready up key
        ulong computedResult = (lobbyId ^ ~(userId | (userId << 32)));
        System.Diagnostics.Debug.WriteLine("DIFFERENCE: " + (actualResult - computedResult));
        System.Diagnostics.Debug.WriteLine(Convert.ToString((long)computedResult, 2));
        System.Diagnostics.Debug.WriteLine(Convert.ToString((long)actualResult, 2));

@rossengeorgiev
Copy link
Contributor

You are doing something wrong. Just re-checked it and its still the same.

@ErkoKnoll
Copy link
Author

ErkoKnoll commented Jul 9, 2017

@rossengeorgiev do happen to see an error in my code?

I even tried in C++ to rule out the possibility of data type differences. Result is very dependent on the actual data types being used, but I have tried all kinds of combinations between ulong, long and int.

This is the C++ code that yields the same result:

unsigned long long lobbyId = 25154023524253231;
unsigned long long userId = 76561198316642346;
unsigned long long result = lobbyId ^ ~(userId | (userId << 32));
std::cout << result << std::endl;

@psychonic
Copy link
Member

It looks like your userId there is a CSteamID, not an AccountId (which would be just the lower 32 bits of it).

@ErkoKnoll
Copy link
Author

@psychonic Thank you! This was it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants