mirror of
https://github.com/MikuLeaks/MikuSB.git
synced 2026-06-04 15:03:57 +00:00
38 lines
1.2 KiB
C#
38 lines
1.2 KiB
C#
using MikuSB.Proto;
|
|
using System.Text.Json;
|
|
using System.Text.Json.Nodes;
|
|
using System.Text.Json.Serialization;
|
|
|
|
namespace MikuSB.GameServer.Server.CallGS.Handlers.Girl;
|
|
|
|
[CallGSApi("RoleCard_SetSupporterTeamIndex")]
|
|
public class RoleCard_SetSupporterTeamIndex : ICallGSHandler
|
|
{
|
|
public async Task Handle(Connection connection, string param, ushort seqNo)
|
|
{
|
|
var req = JsonSerializer.Deserialize<SetSupporterTeamIndexParam>(param);
|
|
if (req == null)
|
|
{
|
|
await CallGSRouter.SendScript(connection, "RoleCard_SetSupporterTeamIndex", "{\"err\":\"error.BadParam\"}");
|
|
return;
|
|
}
|
|
var player = connection.Player!;
|
|
var cardData = player.CharacterManager.GetCharacterByGUID(req.CardId);
|
|
if (cardData == null) return;
|
|
|
|
cardData.SupportTeamIndex = req.Index;
|
|
var sync = new NtfSyncPlayer
|
|
{
|
|
Items = { cardData.ToProto() }
|
|
};
|
|
await CallGSRouter.SendScript(connection, "RoleCard_SetSupporterTeamIndex", "null", sync);
|
|
}
|
|
}
|
|
|
|
internal sealed class SetSupporterTeamIndexParam
|
|
{
|
|
[JsonPropertyName("Id")]
|
|
public uint CardId { get; set; }
|
|
public uint Index { get; set; }
|
|
}
|