using Microsoft.Extensions.Logging; using Supercell.GUT.Logic.Message.Account; using Supercell.GUT.Server.Network.Connection; using Supercell.GUT.Server.Protocol.Attributes; namespace Supercell.GUT.Server.Protocol.Handlers; [ServiceNode(1)] internal class AccountMessageHandler : MessageHandlerBase { private readonly ILogger _logger; private readonly ClientConnection _connection; public AccountMessageHandler(ClientConnection connection, ILogger logger) { _logger = logger; _connection = connection; } [MessageHandler(10105)] public async Task OnStartSecureConnection(StartSecureConnectionMessage startSecureConnectionMessage) { string nonce = "nonce"; await _connection.SendMessage(new SecureConnectionOkMessage() { Nonce = nonce }); _connection.SetNonce(nonce); } [MessageHandler(10103)] public async Task OnCreateAccount(CreateAccountMessage createAccountMessage) { _logger.LogInformation("Creating account! FacebookId: {fid} | GameCenterId: {gcid}", createAccountMessage.FacebookId, createAccountMessage.GameCenterId); await _connection.SendMessage(new CreateAccountOkMessage() { AccountIdHigherInt = 0, AccountIdLowerInt = 1, SessionKey = "telegram_is_@BL4D3_BR34D" }); } [MessageHandler(10102)] public async Task OnLoginUsingSession(LoginUsingSessionMessage loginUsingSessionMessage) { _logger.LogInformation("Logging account! sessionkey: {sk} | GameCenterId: {gcid} | GameVersion: {cgv} | account: ({h}-{l})", loginUsingSessionMessage.SessionKey, loginUsingSessionMessage.GamecenterId, loginUsingSessionMessage.ClientGameVersion, loginUsingSessionMessage.AccountIdHigherInt, loginUsingSessionMessage.AccountIdLowerInt); await _connection.SendMessage(new LoginOkMessage() { PrimaryAvatarIdHigherInt = loginUsingSessionMessage.AccountIdHigherInt, PrimaryAvatarIdLowerInt = loginUsingSessionMessage.AccountIdLowerInt, Fingerprint = "fece25cfc941db1a5bb3e79d4e6a60c34659f49e" }); } }