Example #1
0
        /// <summary>
        /// Sends a newly created character to the client.
        /// </summary>
        /// <param name="conn"></param>
        /// <param name="character"></param>
        public static void BC_COMMANDER_CREATE(LoginConnection conn, Character character)
        {
            var packet = new Packet(Op.BC_COMMANDER_CREATE);

            packet.AddAppearancePC(character);


            packet.PutLong(character.Id);

            // [i11025 (2016-02-26)]
            // Index was previously stored as a short, now there seem
            // to be two byte, with the first being the index.
            {
                packet.PutByte(character.GetIndex());
                packet.PutByte(181);
            }

            packet.PutShort(character.MapId);
            packet.PutInt(0);
            packet.PutInt(0);
            packet.PutInt(0);             // maxXP ?
            packet.PutInt(0);

            // Position?
            packet.PutFloat(character.BarrackPosition.X);
            packet.PutFloat(character.BarrackPosition.Y);
            packet.PutFloat(character.BarrackPosition.Z);
            packet.PutFloat(0);             // Vector direction
            packet.PutFloat(0);             // Vector direction

            // ?
            packet.PutFloat(character.BarrackPosition.X);
            packet.PutFloat(character.BarrackPosition.Y);
            packet.PutFloat(character.BarrackPosition.Z);
            packet.PutFloat(0);             // Vector direction
            packet.PutFloat(0);             // Vector direction

            packet.PutInt(0);

            conn.Send(packet);
        }
Example #2
0
        /// <summary>
        /// Sends a list of characters to the client and account properties.
        /// </summary>
        /// <param name="conn"></param>
        /// <param name="layer"></param>
        public static void BC_COMMANDER_LIST(LoginConnection conn, int layer = 1)
        {
            var characters = conn.Account.GetCharacters()
                             .Where(x => x.BarrackLayer == layer)
                             .ToList();

            var packet = new Packet(Op.BC_COMMANDER_LIST);

            packet.PutLong(conn.Account.Id);
            packet.PutByte(0);
            packet.PutByte((byte)characters.Count);
            packet.PutString(conn.Account.TeamName, 64);

            packet.AddAccountProperties(conn.Account);

            foreach (var character in characters)
            {
                packet.AddAppearancePC(character);


                packet.PutLong(character.Id);

                // [i11025 (2016-02-26)]
                // Index was previously stored as a short, now there seem
                // to be two byte, with the first being the index.
                {
                    packet.PutByte(character.GetIndex());
                    packet.PutByte(181);
                }

                packet.PutShort(character.MapId);
                packet.PutInt(0);
                packet.PutInt(0);
                packet.PutInt(0);                 // maxXP ?
                packet.PutInt(0);

                // Position?
                packet.PutFloat(character.BarrackPosition.X);
                packet.PutFloat(character.BarrackPosition.Y);
                packet.PutFloat(character.BarrackPosition.Z);
                packet.PutFloat(0);                 // Vector direction
                packet.PutFloat(0);                 // Vector direction

                // ?
                packet.PutFloat(character.BarrackPosition.X);
                packet.PutFloat(character.BarrackPosition.Y);
                packet.PutFloat(character.BarrackPosition.Z);
                packet.PutFloat(0);                 // Vector direction
                packet.PutFloat(0);                 // Vector direction

                packet.PutInt(0);

                // Equip properties, short->length
                // This is an empty property list
                for (int i = 0; i < Items.EquipSlotCount; ++i)
                {
                    packet.PutShort(0);
                }

                packet.PutByte(1);
                packet.PutByte(1);
                packet.PutByte(1);
                packet.PutByte(1);
                packet.PutByte(0);

                packet.PutShort((short)character.Job);
                packet.PutInt(0);
            }

            packet.PutShort(conn.Account.GetCharacters().Count());             // unk

            conn.Send(packet);
        }