Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PlayerHurtV2"/> class.
        /// </summary>
        /// <param name="br">br</param>
        public PlayerDeathV2(BinaryReader br)
            : base(br)
        {
            PlayerId          = br.ReadByte();
            PlayerDeathReason = br.ReadByte();

            if (PlayerDeathReason.ReadBit(0))
            {
                FromPlayerIndex = br.ReadInt16();
                _packetLength  += 2;
            }

            if (PlayerDeathReason.ReadBit(1))
            {
                FromNpcIndex   = br.ReadInt16();
                _packetLength += 2;
            }

            if (PlayerDeathReason.ReadBit(2))
            {
                FromProjectileIndex = br.ReadInt16();
                _packetLength      += 2;
            }

            if (PlayerDeathReason.ReadBit(3))
            {
                FromOther      = br.ReadByte();
                _packetLength += 1;
            }

            if (PlayerDeathReason.ReadBit(4))
            {
                FromProjectileType = br.ReadInt16();
                _length           += 2;
            }

            if (PlayerDeathReason.ReadBit(5))
            {
                FromItemType   = br.ReadInt16();
                _packetLength += 2;
            }

            if (PlayerDeathReason.ReadBit(6))
            {
                FromItemPrefix = br.ReadByte();
                _packetLength += 1;
            }

            if (PlayerDeathReason.ReadBit(7))
            {
                FromCustomReason = br.ReadString();
                _packetLength   += FromCustomReason.Length;
            }

            Damage       = br.ReadInt16();
            HitDirection = br.ReadByte();
            Flags        = br.ReadByte();
        }