forked from PGR/ascnet
1
0
Fork 0
ascnet/AscNet.GameServer/Handlers/AccountModule.cs

47 lines
1.4 KiB
C#
Raw Normal View History

2023-10-10 09:56:08 +00:00
using AscNet.Common.MsgPack;
using MessagePack;
2023-10-11 13:20:26 +00:00
using Newtonsoft.Json;
2023-10-10 09:56:08 +00:00
namespace AscNet.GameServer.Handlers
{
internal class AccountModule
{
[RequestPacketHandler("HandshakeRequest")]
public static void HandshakeRequestHandler(Session session, Packet.Request packet)
2023-10-10 09:56:08 +00:00
{
// TODO: make this somehow universal, look into better architecture to handle packets
// and automatically log their deserialized form
2023-10-10 09:56:08 +00:00
HandshakeResponse response = new()
{
Code = 0,
UtcOpenTime = 0,
Sha1Table = null
};
session.SendResponse(response, packet.Id);
2023-10-10 09:56:08 +00:00
}
2023-10-10 13:59:08 +00:00
[RequestPacketHandler("LoginRequest")]
public static void LoginRequestHandler(Session session, Packet.Request packet)
2023-10-10 13:59:08 +00:00
{
session.SendResponse(new LoginResponse
{
Code = 0,
ReconnectToken = "eeeeeeeeeeeeeeh",
UtcOffset = 0,
UtcServerTime = DateTimeOffset.UtcNow.ToUnixTimeSeconds()
}, packet.Id);
2023-10-10 18:22:41 +00:00
2023-10-11 18:32:25 +00:00
DoLogin(session);
}
// TODO: Move somewhere else, also split.
2023-10-11 18:32:25 +00:00
static void DoLogin(Session session)
{
NotifyLogin notifyLogin = JsonConvert.DeserializeObject<NotifyLogin>(File.ReadAllText("Data/NotifyLogin.json"))!;
session.SendPush(notifyLogin);
2023-10-10 13:59:08 +00:00
}
2023-10-10 09:56:08 +00:00
}
}