public override void Serialize(LittleEndianWriter writer)
        {
            writer.WriteUInt(targetNetId);
            writer.WriteByte((byte)extraTime);       // extraTime
            writer.WriteUInt(futureProjectileNetId); // Basic attack projectile ID, to be spawned later

            writer.WriteByte((byte)slot);            // attackSlot

            writer.WriteByte((byte)0x80);            // not sure what this is, but it should be correct (or maybe attacked x z y?) - 4.18
            writer.WriteByte((byte)0x01);

            writer.WriteShort((short)MovementVector.TargetXToNormalFormat(targetPosition.X, middleOfMap));
            writer.WriteByte((byte)0x80);
            writer.WriteByte((byte)0x01);
            writer.WriteShort((short)MovementVector.TargetYToNormalFormat(targetPosition.Y, middleOfMap));

            //    writer.WriteFloat(targetPosition.X);
            //    writer.WriteFloat(targetPosition.Y);



            writer.WriteByte((byte)0xCC);
            writer.WriteByte((byte)0x35);
            writer.WriteByte((byte)0xC4);
            writer.WriteByte((byte)0xD1);
            writer.WriteFloat(sourcePosition.X);
            writer.WriteFloat(sourcePosition.Y);
        }
 public override void Serialize(LittleEndianWriter writer)
 {
     writer.WriteInt(unk1);
     writer.WriteLong(userId);
     writer.WriteFloat(loaded);
     writer.WriteFloat(ping);
     writer.WriteShort(unk2);
     writer.WriteShort(unk3);
     writer.WriteByte(unk4);
 }
Beispiel #3
0
        public static void WriteCompressedWaypoints(this LittleEndianWriter writer, GridPosition[] data)
        {
            int size = data.Length;

            if (size < 1)
            {
                throw new IOException("Need at least 1 waypoint!");
            }
            byte[] flagsBuffer;
            if (size > 1)
            {
                flagsBuffer = new byte[(size - 2) / 4 + 1u];
            }
            else
            {
                flagsBuffer = new byte[0];
            }
            var flags = new BitArray(flagsBuffer);

            for (int i = 1, flag = 0; i < size; i++)
            {
                int relativeX = data[i].X - data[i - 1].X;
                flags[flag] = (relativeX <= SByte.MaxValue && relativeX >= SByte.MinValue);
                flag++;

                int realtiveZ = data[i].Y - data[i - 1].Y;
                flags[flag] = (realtiveZ <= SByte.MaxValue && realtiveZ >= SByte.MinValue);
                flag++;
            }
            flags.CopyTo(flagsBuffer, 0);
            writer.WriteBytes(flagsBuffer);
            writer.WriteShort(data[0].X);
            writer.WriteShort(data[0].Y);
            for (int i = 1, flag = 0; i < size; i++)
            {
                if (flags[flag])
                {
                    writer.WriteSByte((SByte)(data[i].X - data[i - 1].X));
                }
                else
                {
                    writer.WriteShort(data[i].X);
                }
                flag++;
                if (flags[flag])
                {
                    writer.WriteSByte((SByte)(data[i].Y - data[i - 1].Y));
                }
                else
                {
                    writer.WriteShort(data[i].Y);
                }
                flag++;
            }
        }
Beispiel #4
0
        public override void Serialize(LittleEndianWriter writer)
        {
            writer.WriteShort((short)1); // Number of dashes

            writer.WriteByte((byte)4);   // Waypoints size * 2
            writer.WriteUInt((uint)sourceNetId);
            writer.WriteFloat((float)dashSpeed);
            writer.WriteFloat((float)leapHeight);
            writer.WriteFloat((float)unitPosition.X);
            writer.WriteFloat((float)unitPosition.Y);

            writer.WriteByte((byte)(keepFacingLastDirection ? 0x01 : 0x00));

            writer.WriteUInt(targetNetId);

            writer.WriteFloat((float)followTargetMaxDistance);
            writer.WriteFloat((float)backDistance);
            writer.WriteFloat((float)travelTime);

            var waypoints = new List <Vector2>
            {
                new Vector2(unitPosition.X, unitPosition.Y),
                new Vector2(targetPosition.X, targetPosition.Y)
            };

            writer.WriteBytes(MovementVector.EncodeWaypoints(waypoints.ToArray(), mapSize));
        }
Beispiel #5
0
 public override void Serialize(LittleEndianWriter writer)
 {
     writer.WriteByte((byte)damageResult);
     writer.WriteShort((short)((short)damageType << 8));
     writer.WriteFloat((float)value);
     writer.WriteUInt(targetNetId);
     writer.WriteUInt(sourceNetId);
 }
        public void Serialize(LittleEndianWriter writer)
        {
            writer.WriteLong(userId);
            writer.WriteShort(0x1E);
            writer.WriteInt(summonerSkill1);
            writer.WriteInt(summonerSkill2);

            writer.WriteByte(isBot);
            writer.WriteInt(teamId);

            writer.Fill(0, 64); // name is no longer here
            writer.Fill(0, 64);
            foreach (var b in Encoding.UTF8.GetBytes(rank))
            {
                writer.WriteByte(b);
            }
            writer.Fill(0, 24 - rank.Length);

            writer.WriteInt(summonerIcon);
            writer.WriteShort(ribbon);
        }
Beispiel #7
0
        public void Serialize(LittleEndianWriter writer)
        {
            writer.WriteUInt(TargetNetId);
            writer.WriteUInt(NetAssignedNetId);
            writer.WriteUInt(CasterNetId);

            writer.WriteUInt(BindNetId);

            writer.WriteUInt(KeywordNetId);


            writer.WriteShort(PositionX);
            writer.WriteFloat(PositionY);
            writer.WriteShort(PositionZ);
            writer.WriteShort(TargetPositionX);
            writer.WriteFloat(TargetPositionY);
            writer.WriteShort(TargetPositionZ);
            writer.WriteShort(OwnerPositionX);
            writer.WriteFloat(OwnerPositionY);
            writer.WriteShort(OwnerPositionZ);

            OrientationVector.Serialize(writer);
            writer.WriteFloat(TimeSpent);
            writer.WriteFloat(ScriptScale);
        }
Beispiel #8
0
        private void Serialize2(LittleEndianWriter writer)
        {
            writer.WriteByte((byte)1); // number of particles
            writer.WriteUInt("Ezreal".HashString());
            writer.WriteUInt("ezreal_bow.troy".HashString());
            writer.WriteInt(0x00000020); // flags ?

            writer.WriteShort((short)0); // Unk
            writer.WriteUInt("L_HAND".HashString());

            writer.WriteByte((byte)1); // number of targets ?

            writer.WriteUInt(netId);
            writer.WriteUInt(39439); // Particle net id ?
            writer.WriteUInt(netId);

            writer.WriteUInt(netId);

            writer.WriteInt(0); // unk

            for (var i = 0; i < 3; ++i)
            {
                var ownerHeight    = 0;
                var particleHeight = 0;
                var higherValue    = Math.Max(ownerHeight, particleHeight);
                writer.WriteShort((short)1);
                writer.WriteInt(higherValue);
                writer.WriteShort((short)1);
            }

            writer.WriteUInt((uint)0); // unk
            writer.WriteUInt((uint)0); // unk
            writer.WriteUInt((uint)0); // unk
            writer.WriteUInt((uint)0); // unk
            writer.WriteFloat(1.0f);   // Particle size
        }
Beispiel #9
0
        public override void Pack(LittleEndianWriter writer)
        {
            if ((short)Cmd > byte.MaxValue) // oops, riot needs ids !
            {
                writer.WriteByte((byte)PacketCmd.PKT_S2C_Extended);
                writer.WriteUInt(netId);
                writer.WriteShort((short)Cmd);
            }
            else
            {
                writer.WriteByte((byte)Cmd);
                writer.WriteUInt(netId);
            }

            Serialize(writer);
        }
Beispiel #10
0
        public override void Serialize(LittleEndianWriter writer)
        {
            int count = movements.Count;

            if (count > 0x7FFF)
            {
                throw new IOException("Too many movementdata!");
            }
            writer.WriteInt(syncId);
            writer.WriteShort((short)count);

            foreach (var data in movements)
            {
                data.Write(writer);
            }
        }
Beispiel #11
0
 public override void Serialize(LittleEndianWriter writer)
 {
     writer.WriteShort(0);
     writer.WriteFloat(totalHealth);
     writer.WriteFloat(currentHealth);
 }
 public override void Serialize(LittleEndianWriter writer)
 {
     writer.WriteByte(slot);
     writer.WriteShort(remaining);
 }
Beispiel #13
0
 public override void Serialize(LittleEndianWriter writer)
 {
     writer.WriteByte(newLevel);
     writer.WriteShort(skillPoints);
 }