using BeyondTools.VFS.Crypto;
using Campofinale.Network;
using Campofinale.Packets.Sc;
using Campofinale.Protocol;
using Campofinale.Resource;
using Google.Protobuf;
using Google.Protobuf.WellKnownTypes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Sockets;

using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
using static Campofinale.Resource.ResourceManager;
using static System.Net.Mime.MediaTypeNames;

namespace Campofinale.Packets.Cs
{
    
    public class HandleCsCharBagSetCurrTeamIndex
    {
        [Server.Handler(CsMsgId.CsCharBagSetCurrTeamIndex)]
        public static void Handle(Player session, CsMsgId cmdId, Packet packet)
        {
            CsCharBagSetCurrTeamIndex req = packet.DecodeBody<CsCharBagSetCurrTeamIndex>();
            session.teamIndex = req.TeamIndex;
            session.teams[session.teamIndex].leader = req.LeaderId;
            
            session.Send(new PacketScCharBagSetCurrTeamIndex(session));
            session.Send(new PacketScSelfSceneInfo(session,SelfInfoReasonType.SlrChangeTeam));
        }
    }
}
