2024-01-19 14:45:18 +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;
|
|
|
|
|
|
2024-01-23 17:54:53 +00:00
|
|
|
|
public AvatarModule(ModuleManager moduleManager, ExcelTables excelTables) : base(moduleManager)
|
2024-01-19 14:45:18 +00:00
|
|
|
|
{
|
|
|
|
|
_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))
|
|
|
|
|
{
|
2024-01-20 12:42:08 +00:00
|
|
|
|
if (row is AvatarRow avatarRow)
|
2024-01-19 14:45:18 +00:00
|
|
|
|
{
|
|
|
|
|
if (avatarRow.AvatarID >= 9000) continue;
|
|
|
|
|
|
|
|
|
|
rsp.AvatarList.Add(new Avatar
|
|
|
|
|
{
|
|
|
|
|
AvatarId = avatarRow.AvatarID,
|
|
|
|
|
Level = 1
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Send(session, CmdType.CmdGetAvatarDataScRsp, rsp);
|
|
|
|
|
return Task.CompletedTask;
|
|
|
|
|
}
|
|
|
|
|
}
|