Snowflake/RPG.Services.Gameserver/Modules/TeamModule.cs

86 lines
2.5 KiB
C#
Raw Normal View History

2024-01-19 14:45:18 +00:00
using RPG.Network.Proto;
using RPG.Services.Gameserver.Modules.Attributes;
using RPG.Services.Gameserver.Session;
namespace RPG.Services.Gameserver.Modules;
internal class TeamModule : BaseModule
{
private static readonly uint[] StartingLineup = [1007, 1102, 1101, 1003];
[OnCommand(CmdType.CmdChangeLineupLeaderCsReq)]
public Task OnCmdChangeLineupLeaderCsReq(PlayerSession session, ReadOnlyMemory<byte> body)
{
ChangeLineupLeaderCsReq req = ChangeLineupLeaderCsReq.Parser.ParseFrom(body.Span);
Send(session, CmdType.CmdChangeLineupLeaderScRsp, new ChangeLineupLeaderScRsp
{
Retcode = 0,
Slot = req.Slot
});
return Task.CompletedTask;
}
[OnCommand(CmdType.CmdGetAllLineupDataCsReq)]
public Task OnCmdGetAllLineupDataCsReq(PlayerSession session, ReadOnlyMemory<byte> _)
{
GetAllLineupDataScRsp rsp = new();
rsp.LineupList.Add(new LineupInfo
{
Name = "Test Squad",
LeaderSlot = 0,
ExtraLineupType = ExtraLineupType.LineupNone,
Mp = 3
});
for (uint i = 0; i < StartingLineup.Length; i++)
{
rsp.LineupList[0].AvatarList.Add(new LineupAvatar
{
Id = StartingLineup[i],
Satiety = 100,
Sp = 10000,
Hp = 10000,
Slot = i,
AvatarType = AvatarType.AvatarFormalType
});
}
Send(session, CmdType.CmdGetAllLineupDataScRsp, rsp);
return Task.CompletedTask;
}
[OnCommand(CmdType.CmdGetCurLineupDataCsReq)]
public Task OnCmdGetCurLineupDataCsReq(PlayerSession session, ReadOnlyMemory<byte> _)
{
GetCurLineupDataScRsp rsp = new()
{
Lineup = new LineupInfo
{
Name = "Test Squad",
LeaderSlot = 0,
ExtraLineupType = ExtraLineupType.LineupNone,
Mp = 3
}
};
for (uint i = 0; i < StartingLineup.Length; i++)
{
rsp.Lineup.AvatarList.Add(new LineupAvatar
{
Id = StartingLineup[i],
Satiety = 100,
Sp = 10000,
Hp = 10000,
Slot = i,
AvatarType = AvatarType.AvatarFormalType
});
}
Send(session, CmdType.CmdGetCurLineupDataScRsp, rsp);
return Task.CompletedTask;
}
}