2024-01-19 14:45:18 +00:00
|
|
|
|
using RPG.Network.Proto;
|
2024-01-23 17:54:53 +00:00
|
|
|
|
using RPG.Services.Gameserver.Game.Entity;
|
2024-01-19 14:45:18 +00:00
|
|
|
|
using RPG.Services.Gameserver.Modules.Attributes;
|
|
|
|
|
using RPG.Services.Gameserver.Session;
|
|
|
|
|
|
|
|
|
|
namespace RPG.Services.Gameserver.Modules;
|
|
|
|
|
internal class LoginModule : BaseModule
|
|
|
|
|
{
|
2024-01-23 17:54:53 +00:00
|
|
|
|
private readonly IEntityEventListener _mazeEventListener;
|
|
|
|
|
|
|
|
|
|
public LoginModule(ModuleManager moduleManager, IEntityEventListener mazeEventListener) : base(moduleManager)
|
|
|
|
|
{
|
|
|
|
|
_mazeEventListener = mazeEventListener;
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-19 14:45:18 +00:00
|
|
|
|
[OnCommand(CmdType.CmdPlayerLoginCsReq)]
|
2024-01-23 17:54:53 +00:00
|
|
|
|
public async Task OnCmdPlayerLoginCsReq(PlayerSession session, ReadOnlyMemory<byte> body)
|
2024-01-19 14:45:18 +00:00
|
|
|
|
{
|
|
|
|
|
PlayerLoginCsReq req = PlayerLoginCsReq.Parser.ParseFrom(body.Span);
|
2024-01-23 17:54:53 +00:00
|
|
|
|
|
|
|
|
|
_mazeEventListener.Session = session;
|
|
|
|
|
await ModuleManager.OnLogin();
|
|
|
|
|
|
2024-01-19 14:45:18 +00:00
|
|
|
|
Send(session, CmdType.CmdPlayerLoginScRsp, new PlayerLoginScRsp
|
|
|
|
|
{
|
|
|
|
|
Retcode = 0,
|
|
|
|
|
LoginRandom = req.LoginRandom,
|
|
|
|
|
Stamina = 160,
|
|
|
|
|
ServerTimestampMs = (ulong)DateTimeOffset.Now.ToUnixTimeMilliseconds(),
|
|
|
|
|
BasicInfo = new()
|
|
|
|
|
{
|
|
|
|
|
Level = 5,
|
2024-01-19 15:06:09 +00:00
|
|
|
|
Nickname = "Snowflake"
|
2024-01-19 14:45:18 +00:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|