Snowflake/RPG.Services.Gameserver/Modules/PlayerModule.cs
2024-01-19 17:45:18 +03:00

35 lines
1 KiB
C#

using RPG.Network.Proto;
using RPG.Services.Gameserver.Modules.Attributes;
using RPG.Services.Gameserver.Session;
namespace RPG.Services.Gameserver.Modules;
internal class PlayerModule : BaseModule
{
[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;
}
}