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

37 lines
1 KiB
C#
Raw Normal View History

2024-01-29 23:49:21 +00:00
using RPG.GameCore.Excel;
using RPG.Network.Proto;
using RPG.Services.Gameserver.Modules.Attributes;
using RPG.Services.Gameserver.Session;
namespace RPG.Services.Gameserver.Modules;
internal class AvatarModule : BaseModule
{
private readonly ExcelTables _excelTables;
public AvatarModule(ExcelTables excelTables)
{
_excelTables = excelTables;
}
[OnCommand(CmdType.CmdGetAvatarDataCsReq)]
public Task OnCmdGetAvatarDataCsReq(PlayerSession session, ReadOnlyMemory<byte> body)
{
GetAvatarDataCsReq req = GetAvatarDataCsReq.Parser.ParseFrom(body.Span);
GetAvatarDataScRsp rsp = new()
{
IsAll = req.IsGetAll
};
rsp.AvatarList.AddRange(_excelTables.GetAllRows(ExcelType.Avatar).Where(row => row.Id is < 1200 or 8001).Select(row => new Avatar
{
BaseAvatarId = row.Id,
Level = 1,
Rank = 6
}));
Send(session, CmdType.CmdGetAvatarDataScRsp, rsp);
return Task.CompletedTask;
}
}