44 lines
1.2 KiB
C#
44 lines
1.2 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
|
|||
|
};
|
|||
|
|
|||
|
foreach (ExcelRow row in _excelTables.GetAllRows(ExcelType.Avatar))
|
|||
|
{
|
|||
|
if (row is AvatarExcelRow avatarRow)
|
|||
|
{
|
|||
|
if (avatarRow.AvatarID >= 9000) continue;
|
|||
|
|
|||
|
rsp.AvatarList.Add(new Avatar
|
|||
|
{
|
|||
|
AvatarId = avatarRow.AvatarID,
|
|||
|
Level = 1
|
|||
|
});
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
Send(session, CmdType.CmdGetAvatarDataScRsp, rsp);
|
|||
|
return Task.CompletedTask;
|
|||
|
}
|
|||
|
}
|