Example #1
0
        public static void AddCommander(this Packet packet, ICommander commander)
        {
            packet.PutString(commander.Name, 65);
            packet.PutString(commander.TeamName, 64);
            packet.PutEmptyBin(7);
            packet.PutLong(commander.AccountId);
            packet.PutShort(commander.Stance);
            packet.PutShort(0);
            packet.PutShort((short)commander.Job);
            packet.PutByte((byte)commander.Gender);
            packet.PutByte(0);
            packet.PutInt(commander.Level);

            // Items
            var equipIds = commander.GetEquipIds();

            if (equipIds.Length != Items.EquipSlotCount)
            {
                throw new InvalidOperationException("Incorrect amount of equipment (" + equipIds.Length + ").");
            }

            for (int i = 0; i < equipIds.Length; ++i)
            {
                packet.PutInt(equipIds[i]);
            }

            // [i10671, 2015-10-26 iCBT2] ?
            {
                packet.PutInt(0);
                packet.PutInt(0);
            }

            packet.PutShort(commander.Hair);
            packet.PutShort(0);             // Pose

            // [i11025 (2016-02-26)] ?
            {
                packet.PutInt(0);
                packet.PutInt(0);
            }
        }