37 lines
1 KiB
C#
37 lines
1 KiB
C#
|
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;
|
|||
|
}
|
|||
|
}
|