コード例 #1
0
ファイル: Movements.cs プロジェクト: fyang93/Destiny
        public void Encode(OutPacket oPacket)
        {
            oPacket
            .WritePoint(this.Position)
            .WriteByte((byte)this.Count);

            foreach (Movement movement in this)
            {
                oPacket.WriteByte((byte)movement.Type);

                switch (movement.Type)
                {
                case MovementType.Normal:
                case MovementType.Unknown5:
                case MovementType.Unknown15:
                case MovementType.Unknown17:
                {
                    oPacket
                    .WritePoint(movement.Position)
                    .WritePoint(movement.Velocity)
                    .WriteShort(movement.Foothold);

                    if (movement.Type != MovementType.Unknown15)
                    {
                        oPacket
                        .WriteByte(movement.Stance)
                        .WriteShort(movement.Duration);
                    }
                }
                break;

                case MovementType.Unknown1:
                case MovementType.Unknown2:
                case MovementType.Unknown6:
                case MovementType.Unknown12:
                case MovementType.Unknown13:
                case MovementType.Unknown16:
                case MovementType.Unknown18:
                case MovementType.Unknown19:
                case MovementType.Unknown20:
                case MovementType.Unknown22:
                {
                    oPacket
                    .WritePoint(movement.Velocity)
                    .WriteByte(movement.Stance)
                    .WriteShort(movement.Duration);
                }
                break;

                case MovementType.Unknown3:
                case MovementType.Unknown4:
                case MovementType.Unknown7:
                case MovementType.Unknown8:
                case MovementType.Unknown9:
                case MovementType.Unknown11:
                {
                    oPacket
                    .WritePoint(movement.Position)
                    .WriteShort(movement.Foothold)
                    .WriteByte(movement.Stance)
                    .WriteShort(movement.Duration);
                }
                break;

                case MovementType.Unknown14:
                {
                    // TODO: Jump down or equipment, not sure.
                }
                break;

                case MovementType.Unknown10:
                {
                    oPacket.WriteByte(movement.Statistic);
                }
                break;
                }
            }
        }