Snowflake/RPG.Services.Gameserver/Modules/PlayerModule.cs

40 lines
1.1 KiB
C#
Raw Normal View History

2024-01-19 14:45:18 +00:00
using RPG.Network.Proto;
using RPG.Services.Gameserver.Modules.Attributes;
using RPG.Services.Gameserver.Session;
namespace RPG.Services.Gameserver.Modules;
internal class PlayerModule : BaseModule
{
public PlayerModule(ModuleManager moduleManager) : base(moduleManager)
{
}
2024-01-19 14:45:18 +00:00
[OnCommand(CmdType.CmdSyncTimeCsReq)]
public Task OnCmdSyncTimeCsReq(PlayerSession session, ReadOnlyMemory<byte> body)
{
SyncTimeCsReq req = SyncTimeCsReq.Parser.ParseFrom(body.Span);
// TODO: TimeManager
Send(session, CmdType.CmdSyncTimeScRsp, new SyncTimeScRsp
{
ServerTimeMs = (ulong)DateTimeOffset.Now.ToUnixTimeMilliseconds(),
ClientTimeMs = req.ClientTimeMs,
Retcode = 0
});
return Task.CompletedTask;
}
[OnCommand(CmdType.CmdGetStaminaExchangeCsReq)]
public Task OnCmdGetStaminaExchangeCsReq(PlayerSession session, ReadOnlyMemory<byte> _)
{
Send(session, CmdType.CmdGetStaminaExchangeScRsp, new GetStaminaExchangeScRsp
{
Retcode = 0
});
return Task.CompletedTask;
}
}