2024-01-19 14:45:18 +00:00
|
|
|
|
using RPG.Network.Proto;
|
2024-01-23 17:54:53 +00:00
|
|
|
|
using RPG.Services.Gameserver.Game.Team;
|
2024-01-19 14:45:18 +00:00
|
|
|
|
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];
|
|
|
|
|
|
2024-01-23 17:54:53 +00:00
|
|
|
|
public PlayerTeam Team { get; } = new();
|
|
|
|
|
|
|
|
|
|
public TeamModule(ModuleManager moduleManager) : base(moduleManager)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-25 12:14:47 +00:00
|
|
|
|
public void InitStartingLineup()
|
2024-01-23 17:54:53 +00:00
|
|
|
|
{
|
|
|
|
|
for (uint i = 0; i < StartingLineup.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
Team.Join(StartingLineup[i], AvatarType.AvatarFormalType, i);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-19 14:45:18 +00:00
|
|
|
|
[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();
|
2024-01-23 17:54:53 +00:00
|
|
|
|
rsp.LineupList.Add(Team.LineupInfo);
|
2024-01-19 14:45:18 +00:00
|
|
|
|
Send(session, CmdType.CmdGetAllLineupDataScRsp, rsp);
|
|
|
|
|
|
|
|
|
|
return Task.CompletedTask;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[OnCommand(CmdType.CmdGetCurLineupDataCsReq)]
|
|
|
|
|
public Task OnCmdGetCurLineupDataCsReq(PlayerSession session, ReadOnlyMemory<byte> _)
|
|
|
|
|
{
|
2024-01-23 17:54:53 +00:00
|
|
|
|
Send(session, CmdType.CmdGetCurLineupDataScRsp, new GetCurLineupDataScRsp
|
2024-01-19 14:45:18 +00:00
|
|
|
|
{
|
2024-01-23 17:54:53 +00:00
|
|
|
|
Retcode = 0,
|
|
|
|
|
Lineup = Team.LineupInfo
|
|
|
|
|
});
|
2024-01-19 14:45:18 +00:00
|
|
|
|
|
|
|
|
|
return Task.CompletedTask;
|
|
|
|
|
}
|
|
|
|
|
}
|