37 lines
1.2 KiB
C#
37 lines
1.2 KiB
C#
using RPG.Network.Proto;
|
|
using RPG.Services.Gameserver.Game.Entity;
|
|
using RPG.Services.Gameserver.Modules.Attributes;
|
|
using RPG.Services.Gameserver.Session;
|
|
|
|
namespace RPG.Services.Gameserver.Modules;
|
|
internal class LoginModule : BaseModule
|
|
{
|
|
private readonly IEntityEventListener _mazeEventListener;
|
|
|
|
public LoginModule(ModuleManager moduleManager, IEntityEventListener mazeEventListener) : base(moduleManager)
|
|
{
|
|
_mazeEventListener = mazeEventListener;
|
|
}
|
|
|
|
[OnCommand(CmdType.CmdPlayerLoginCsReq)]
|
|
public async Task OnCmdPlayerLoginCsReq(PlayerSession session, ReadOnlyMemory<byte> body)
|
|
{
|
|
PlayerLoginCsReq req = PlayerLoginCsReq.Parser.ParseFrom(body.Span);
|
|
|
|
_mazeEventListener.Session = session;
|
|
await ModuleManager.OnLogin();
|
|
|
|
Send(session, CmdType.CmdPlayerLoginScRsp, new PlayerLoginScRsp
|
|
{
|
|
Retcode = 0,
|
|
LoginRandom = req.LoginRandom,
|
|
Stamina = 160,
|
|
ServerTimestampMs = (ulong)DateTimeOffset.Now.ToUnixTimeMilliseconds(),
|
|
BasicInfo = new()
|
|
{
|
|
Level = 5,
|
|
Nickname = "Snowflake"
|
|
}
|
|
});
|
|
}
|
|
}
|