-
What did you expect to happen?After CS2 update from February 6, 2024 I can't run the game using steam kit. Im logging in to steam, then i send welcome message to the GC but it doesn't hit my callback function. Instead of that, what actually happened?It used to work just fine before the update. I didn't change the code since then. Not sure if there is anything that I could do to get that fixed on my side. Which operating system are you running on?Windows Which .NET Runtime are you running on?.NET Core or .NET 5 or higher. Version.NET 8 Relevant log outputNo response Example Codeusing SteamKit2;
using SteamKit2.GC.CSGO.Internal;
using SteamKit2.GC;
using SteamKit2.Internal;
namespace CsGoFloatFinder.SteamClientManager
{
public class SteamClientInternal
{
const int APPID = 730;
private SteamUser _user;
private SteamClient _steamClient;
private SteamGameCoordinator _gameCoordinator;
private CallbackManager _callbackMgr;
private string _username = string.Empty;
private string _password = string.Empty;
private string _twoFactorAuth = string.Empty;
private Dictionary<uint, Action<IPacketGCMsg>> _gcMessagesMap;
public SteamClientInternal()
{
_steamClient = new SteamClient();
_gameCoordinator = _steamClient.GetHandler<SteamGameCoordinator>();
_user = _steamClient.GetHandler<SteamUser>();
_callbackMgr = new CallbackManager(_steamClient);
_callbackMgr.Subscribe<SteamClient.ConnectedCallback>(OnConnected);
_callbackMgr.Subscribe<SteamUser.LoggedOnCallback>(OnLoggedOn);
_callbackMgr.Subscribe<SteamGameCoordinator.MessageCallback>(OnGCMessage);
_gcMessagesMap = new Dictionary<uint, Action<IPacketGCMsg>>
{
{ (uint)EGCBaseClientMsg.k_EMsgGCClientWelcome, OnClientWelcome },
};
}
public void Login(string username, string password, string twoFactorAuth = null)
{
_username = username ?? _username;
_password = password ?? _password;
_twoFactorAuth = twoFactorAuth;
_steamClient.Connect();
}
public void RunGame()
{
var playGame = new ClientMsgProtobuf<CMsgClientGamesPlayed>(EMsg.ClientGamesPlayed);
playGame.Body.games_played.Add(new CMsgClientGamesPlayed.GamePlayed
{
game_id = new GameID(APPID),
});
_steamClient.Send(playGame);
// delay a little to give steam some time to establish a GC connection to us
Thread.Sleep(5000);
var clientHello = new ClientGCMsgProtobuf<SteamKit2.GC.CSGO.Internal.CMsgClientHello>((uint)EGCBaseClientMsg.k_EMsgGCClientHello);
_gameCoordinator.Send(clientHello, APPID);
}
#region Handlers
void OnConnected(SteamClient.ConnectedCallback callback)
{
Console.WriteLine("Connected to Steam! Logging in '{0}'...", _username);
_user.LogOn(new SteamUser.LogOnDetails
{
Username = _username,
Password = _password,
TwoFactorCode = _twoFactorAuth,
});
}
void OnLoggedOn(SteamUser.LoggedOnCallback callback)
{
bool isSteamGuard = callback.Result == EResult.AccountLogonDenied;
bool is2FA = callback.Result == EResult.AccountLoginDeniedNeedTwoFactor;
if (isSteamGuard || is2FA)
{
Console.WriteLine("This account is SteamGuard protected!");
if (is2FA)
{
Console.Write("Please enter your 2 factor auth code from your authenticator app: ");
}
else
{
Console.Write("Please enter the auth code sent to the email at {0}: ", callback.EmailDomain);
}
return;
}
if (callback.Result != EResult.OK)
{
Console.WriteLine("Unable to logon to Steam: {0} / {1}", callback.Result, callback.ExtendedResult);
return;
}
Console.WriteLine("Successfully logged on!");
}
void OnGCMessage(SteamGameCoordinator.MessageCallback callback)
{
Action<IPacketGCMsg> func;
if (!_gcMessagesMap.TryGetValue(callback.EMsg, out func))
{
return;
}
func(callback.Message);
}
void OnClientWelcome(IPacketGCMsg packetMsg)
{
var msg = new ClientGCMsgProtobuf<CMsgClientWelcome>(packetMsg);
Console.WriteLine("GC is welcoming us. Version: {0}", msg.Body.version);
}
#endregion
}
} Additional InformationI don't know if I'm missing something. Maybe I'm sending wrong Hello message? Please help, I can't figure it out. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Found the solution. I had to set version of ClientHello message: var clientHello = new ClientGCMsgProtobuf<SteamKit2.GC.CSGO.Internal.CMsgClientHello>((uint)EGCBaseClientMsg.k_EMsgGCClientHello); |
Beta Was this translation helpful? Give feedback.
Found the solution. I had to set version of ClientHello message:
var clientHello = new ClientGCMsgProtobuf<SteamKit2.GC.CSGO.Internal.CMsgClientHello>((uint)EGCBaseClientMsg.k_EMsgGCClientHello);
clientHello.Body.version = 2000202;
_gameCoordinator.Send(clientHello, APPID);