Ejemplo n.º 1
0
        private void OnSelectChain(BinaryReader packet)
        {
            packet.ReadByte(); // player
            int count = packet.ReadByte();

            packet.ReadByte(); // specount
            bool forced = packet.ReadByte() != 0;

            packet.ReadInt32(); // hint1
            packet.ReadInt32(); // hint2

            IList <ClientCard> cards = new List <ClientCard>();
            IList <int>        descs = new List <int>();

            for (int i = 0; i < count; ++i)
            {
                packet.ReadByte();  // flag
                packet.ReadInt32(); // card id
                int con  = GetLocalPlayer(packet.ReadByte());
                int loc  = packet.ReadByte();
                int seq  = packet.ReadByte();
                int sseq = packet.ReadByte();

                int desc = packet.ReadInt32();
                cards.Add(_duel.GetCard(con, loc, seq, sseq));
                descs.Add(desc);
            }

            if (cards.Count == 0)
            {
                Connection.Send(CtosMessage.Response, -1);
                return;
            }

            if (cards.Count == 1 && forced)
            {
                Connection.Send(CtosMessage.Response, 0);
                return;
            }

            Connection.Send(CtosMessage.Response, _ai.OnSelectChain(cards, descs, forced));
        }