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

36 lines
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
{
[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;
}
}