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

144 lines
4.5 KiB
C#
Raw Normal View History

2024-01-29 23:49:21 +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());
return Task.CompletedTask;
}
[OnCommand(CmdType.CmdGetLevelRewardTakenListCsReq)]
public Task OnCmdGetLevelRewardTakenListCsReq(PlayerSession session, ReadOnlyMemory<byte> _)
{
Send(session, CmdType.CmdGetLevelRewardTakenListScRsp, new GetLevelRewardTakenListScRsp());
return Task.CompletedTask;
}
[OnCommand(CmdType.CmdGetPrestigeInfoCsReq)]
public Task OnCmdGetPrestigeInfoCsReq(PlayerSession session, ReadOnlyMemory<byte> _)
{
Send(session, CmdType.CmdGetPrestigeInfoScRsp, new GetPrestigeInfoScRsp
{
PrestigeInfo = new()
});
return Task.CompletedTask;
}
[OnCommand(CmdType.CmdGetSpringRecoverDataCsReq)]
public Task OnCmdGetSpringRecoverDataCsReq(PlayerSession session, ReadOnlyMemory<byte> _)
{
Send(session, CmdType.CmdGetSpringRecoverDataScRsp, new GetSpringRecoverDataScRsp
{
SpringRecoverConfig = new(),
HealPoolInfo = new()
});
return Task.CompletedTask;
}
[OnCommand(CmdType.CmdGetHeroBasicTypeInfoCsReq)]
public Task OnCmdGetHeroBasicTypeInfoCsReq(PlayerSession session, ReadOnlyMemory<byte> _)
{
Send(session, CmdType.CmdGetHeroBasicTypeInfoScRsp, new GetHeroBasicTypeInfoScRsp
{
Gender = Gender.Woman,
CurBasicType = HeroBasicType.GirlWarrior,
BasicTypeInfoList =
{
new HeroBasicTypeInfo
{
BasicType = HeroBasicType.GirlWarrior,
Rank = 1
}
}
});
return Task.CompletedTask;
}
[OnCommand(CmdType.CmdGetHeroPathCsReq)]
public Task OnCmdGetHeroPathCsReq(PlayerSession session, ReadOnlyMemory<byte> _)
{
Send(session, CmdType.CmdGetHeroPathScRsp, new GetHeroPathScRsp());
return Task.CompletedTask;
}
[OnCommand(CmdType.CmdGetMissionEventDataCsReq)]
public Task OnCmdGetMissionEventDataCsReq(PlayerSession session, ReadOnlyMemory<byte> _)
{
Send(session, CmdType.CmdGetMissionEventDataScRsp, new GetMissionEventDataScRsp());
return Task.CompletedTask;
}
[OnCommand(CmdType.CmdGetMazeTimeOfDayCsReq)]
public Task OnCmdGetMazeTimeOfDayCsReq(PlayerSession session, ReadOnlyMemory<byte> _)
{
Send(session, CmdType.CmdGetMazeTimeOfDayScRsp, new GetMazeTimeOfDayScRsp());
return Task.CompletedTask;
}
[OnCommand(CmdType.CmdGetDialogueEventDataCsReq)]
public Task OnCmdGetDialogueEventDataCsReq(PlayerSession session, ReadOnlyMemory<byte> _)
{
Send(session, CmdType.CmdGetDialogueEventDataScRsp, new GetDialogueEventDataScRsp());
return Task.CompletedTask;
}
[OnCommand(CmdType.CmdGetRogueInfoCsReq)]
public Task OnCmdGetRogueInfoCsReq(PlayerSession session, ReadOnlyMemory<byte> _)
{
Send(session, CmdType.CmdGetRogueInfoScRsp, new GetRogueInfoScRsp
{
RogueChallengeInfo = new(),
RogueInfo = new()
});
return Task.CompletedTask;
}
[OnCommand(CmdType.CmdGetLoginActivityCsReq)]
public Task OnCmdGetLoginActivityCsReq(PlayerSession session, ReadOnlyMemory<byte> _)
{
Send(session, CmdType.CmdGetLoginActivityScRsp, new GetLoginActivityScRsp());
return Task.CompletedTask;
}
[OnCommand(CmdType.CmdGetChallengeRaidInfoCsReq)]
public Task OnCmdGetChallengeRaidInfoCsReq(PlayerSession session, ReadOnlyMemory<byte> _)
{
Send(session, CmdType.CmdGetChallengeRaidInfoScRsp, new GetChallengeRaidInfoScRsp());
return Task.CompletedTask;
}
}