예제 #1
0
        public override void ReadBodyInternal(PacketReader reader)
        {
            byte itemCount = reader.ReadByte();

            for (int i = 0; i < itemCount; i++)
            {
                var item = new ItemDataPacket();
                item.Slot         = reader.ReadByte();
                item.ItemsInSlot  = reader.ReadByte();
                item.SpellCharges = reader.ReadByte();
                item.ItemID       = reader.ReadItemID();
            }

            bool hasShield = reader.ReadBool();

            if (hasShield)
            {
                ShieldValues                    = new ShieldValues();
                ShieldValues.Magical            = reader.ReadFloat();
                ShieldValues.Phyisical          = reader.ReadFloat();
                ShieldValues.MagicalAndPhysical = reader.ReadFloat();
            }

            int countCharStack = reader.ReadInt32();

            for (int i = 0; i < countCharStack; i++)
            {
                var data = new CharacterStackData();
                data.SkinName = reader.ReadSizedString();
                data.SkinID   = reader.ReadUInt32();
                byte bitfield = reader.ReadByte();
                data.OverrideSpells          = (bitfield & 1) != 0;
                data.ModelOnly               = (bitfield & 2) != 0;
                data.ReplaceCharacterPackage = (bitfield & 4) != 0;
                data.ID = reader.ReadUInt32();
                CharacterDataStack.Add(data);
            }

            LookAtNetID    = reader.ReadNetID();
            LookAtType     = reader.ReadLookAtType();
            LookAtPosition = reader.ReadVector3();

            int numOfBuffCount = reader.ReadInt32();

            for (int i = 0; i < numOfBuffCount; i++)
            {
                byte slot  = reader.ReadByte();
                int  count = reader.ReadInt32();
                BuffCount.Add(new KeyValuePair <byte, int>(slot, count));
            }

            UnknownIsHero = reader.ReadBool();
        }
예제 #2
0
        public override void Deserialize(LittleEndianReader reader)
        {
            byte itemCount = reader.ReadByte();

            Items = new ItemData[itemCount];
            for (int i = 0; i < itemCount; i++)
            {
                var item = new ItemData();
                item.Deserialize(reader);
                Items[i] = item;
            }

            bool hasShield = reader.ReadBool();

            if (hasShield)
            {
                ShieldValues = new ShieldValues();
                ShieldValues.Deserialize(reader);
            }

            int countCharStack = reader.ReadInt();

            CharacterDataStack = new CharacterStackData[countCharStack];

            for (int i = 0; i < countCharStack; i++)
            {
                var data = new CharacterStackData();
                data.Deserialize(reader);
                CharacterDataStack[i] = data;
            }

            LookAtNetId    = reader.ReadUInt();
            LookAtType     = (LookAtType)reader.ReadByte();
            LookAtPosition = Core.Extensions.DeserializeVector3(reader);

            int numOfBuffCount = reader.ReadInt();

            for (int i = 0; i < numOfBuffCount; i++)
            {
                byte slot  = reader.ReadByte();
                int  count = reader.ReadInt();
                BuffCount.Add(new KeyValuePair <byte, int>(slot, count));
            }

            UnknownIsHero = reader.ReadBool();
        }
예제 #3
0
        protected override void ReadBody(ByteReader reader)
        {
            int totalSize = (ushort)(reader.ReadUInt16() & 0x1FFF);

            for (; totalSize > 0;)
            {
                ushort size = reader.ReadUInt16();
                byte[] data = reader.ReadBytes(size);
                this.Packets.Add(GamePacket.Create(data));
                totalSize -= 2;
                totalSize -= size;
            }

            if (reader.BytesLeft < 8)
            {
                if (reader.BytesLeft == 1)
                {
                    reader.ReadPad(1);
                }
                return;
            }

            byte itemCount = reader.ReadByte();

            for (int i = 0; i < itemCount; i++)
            {
                var item = new ItemData();
                item.Slot         = reader.ReadByte();
                item.ItemsInSlot  = reader.ReadByte();
                item.SpellCharges = reader.ReadByte();
                item.ItemID       = reader.ReadUInt32();
            }

            bool hasShield = reader.ReadBool();

            if (hasShield)
            {
                ShieldValues                    = new ShieldValues();
                ShieldValues.Magical            = reader.ReadFloat();
                ShieldValues.Phyisical          = reader.ReadFloat();
                ShieldValues.MagicalAndPhysical = reader.ReadFloat();
            }

            int countCharStack = reader.ReadInt32();

            for (int i = 0; i < countCharStack; i++)
            {
                var data = new CharacterStackData();
                data.SkinName = reader.ReadSizedString();
                data.SkinID   = reader.ReadUInt32();
                byte bitfield = reader.ReadByte();
                data.OverrideSpells          = (bitfield & 1) != 0;
                data.ModelOnly               = (bitfield & 2) != 0;
                data.ReplaceCharacterPackage = (bitfield & 4) != 0;
                data.ID = reader.ReadUInt32();
                CharacterDataStack.Add(data);
            }

            LookAtNetID    = reader.ReadUInt32();
            LookAtType     = reader.ReadByte();
            LookAtPosition = reader.ReadVector3();

            int numOfBuffCount = reader.ReadInt32();

            for (int i = 0; i < numOfBuffCount; i++)
            {
                byte slot  = reader.ReadByte();
                int  count = reader.ReadInt32();
                BuffCount.Add(new KeyValuePair <byte, int>(slot, count));
            }

            UnknownIsHero = reader.ReadBool();

            if (reader.BytesLeft < 5)
            {
                return;
            }

            MovementData = reader.ReadMovementDataWithHeader();
        }