Пример #1
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));
        }
        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);
        }
Пример #3
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);
        }
Пример #4
0
 public void Serialize(LittleEndianWriter writer)
 {
     writer.WriteUInt(TargetNetId);
     writer.WriteSByte((sbyte)(ExtraTime + 128));
     writer.WriteUInt(MissileNextId);
     writer.WriteByte((byte)AttackSlot); // attackSlot
     TargetPosition.Serialize(writer);
 }
Пример #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 override void Serialize(LittleEndianWriter writer)
        {
            writer.WriteFloat(position.X);
            writer.WriteFloat(position.Y);

            writer.WriteUInt(targetNetId);
            writer.WriteUInt(sourceNetId);
            writer.WriteByte((byte)pingType);
            writer.WriteByte(0xFB);
        }
Пример #7
0
 public override void Serialize(LittleEndianWriter writer)
 {
     writer.WriteByte(buffSlot);
     writer.WriteByte((byte)buffType);
     writer.WriteByte(count);
     writer.WriteBool(isHidden);
     writer.WriteUInt(buffNameHash);
     writer.WriteUInt(packageHash);
     writer.WriteFloat(runningTime);
     writer.WriteFloat(duration);
     writer.WriteUInt(casterNetId);
 }
Пример #8
0
        /// <summary>
        /// Writes this <see cref="MOBFile"/> into a <see cref="Stream"/>
        /// </summary>
        /// <param name="stream">The <see cref="Stream"/> to write to</param>
        public void Write(Stream stream)
        {
            using (LittleEndianWriter bw = new LittleEndianWriter(stream))
            {
                bw.WriteBytes(Encoding.ASCII.GetBytes("OPAM"));
                bw.WriteUInt((uint)2);
                bw.WriteInt(this.Objects.Count);
                bw.WriteUInt((uint)0);

                foreach (MOBObject mobObject in this.Objects)
                {
                    mobObject.Write(bw);
                }
            }
        }
Пример #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);
        }
Пример #10
0
        public override void Serialize(LittleEndianWriter writer)
        {
            int waypointsSize = Waypoints.Length;

            if (waypointsSize > 0x7F)
            {
                throw new Exception("Too many paths > 0x7F!");
            }
            byte bitfield = 0;

            if (Waypoints != null)
            {
                bitfield |= (byte)(waypointsSize << 1);
            }
            if (HasTeleportID)
            {
                bitfield |= 1;
            }
            writer.WriteByte(4);//bitfield);
            if (Waypoints != null)
            {
                writer.WriteUInt(TeleportNetID);
                if (HasTeleportID)
                {
                    writer.WriteByte(TeleportID);
                }
                writer.WriteWaypointSpeedParams(SpeedParams);
                writer.WriteCompressedWaypoints(Waypoints);
            }
        }
Пример #11
0
 public override void Serialize(LittleEndianWriter writer)
 {
     writer.WriteUInt(TargetNetId);
     writer.WriteInt((int)floatingTextType);
     writer.WriteInt(param);
     writer.WriteFixedStringLast(message, 128);
 }
Пример #12
0
 public override void Pack(LittleEndianWriter writer)
 {
     writer.WriteByte((byte)Cmd);
     writer.WriteUInt(netId);
     writer.WriteInt(syncId);
     Serialize(writer);
 }
Пример #13
0
 public void Serialize(LittleEndianWriter writer)
 {
     writer.WriteUInt(ItemId);
     writer.WriteByte(Slot);
     writer.WriteByte(ItemsInSlot);
     writer.WriteByte(SpellCharges);
 }
Пример #14
0
 public override void Serialize(LittleEndianWriter writer)
 {
     writer.WriteUInt(100); // animation flags, unknown
     writer.WriteFloat(scaleTime);
     writer.WriteFloat(startProgress);
     writer.WriteFloat(speedRatio);
     writer.WriteFixedStringLast(animationName, 64);
 }
Пример #15
0
 public override void Serialize(LittleEndianWriter writer)
 {
     writer.WriteInt((int)0);
     writer.WriteByte((byte)0);
     writer.WriteUInt(sourceNetId);
     writer.WriteByte((byte)0); // unk
     writer.WriteByte((byte)7); // unk
     writer.WriteInt((int)0);   // Flags?
 }
Пример #16
0
        public void Serialize(LittleEndianWriter writer)
        {
            writer.WriteUInt(PackageHash);        // Ezreal
            writer.WriteUInt(EffectNameHash);     // Particle.Name
            writer.WriteUShort(Flags);            // 0x00000020
            writer.WriteUInt(TargetBoneNameHash); // not sended
            writer.WriteUInt(BoneNameHash);       // particle.BonesName
            int count = FXCreateData.Count;

            if (count > 0xFF)
            {
                throw new IOException("FXCreateData list too big > 255!");
            }
            writer.WriteByte((byte)count);
            foreach (var fx in FXCreateData)
            {
                fx.Serialize(writer);
            }
        }
Пример #17
0
        public override void Serialize(LittleEndianWriter writer)
        {
            writer.WriteInt(goldFromKill); // Gold from kill?
            writer.WriteByte((byte)0);

            writer.WriteUInt(killerNetId);

            writer.WriteByte((byte)0);
            writer.WriteByte((byte)7);
            writer.WriteFloat(respawnTimerMs); // Respawn timer, float
        }
Пример #18
0
        public void Serialize(LittleEndianWriter writer)
        {
            writer.WriteSizedString(SkinName);
            writer.WriteUInt(SkinId);
            byte bitfield = 0;

            if (OverrideSpells)
            {
                bitfield |= 1;
            }
            if (ModelOnly)
            {
                bitfield |= 2;
            }
            if (ReplaceCharacterPackage)
            {
                bitfield |= 4;
            }
            writer.WriteByte(bitfield);
            writer.WriteUInt(Id);
        }
Пример #19
0
 public override void Serialize(LittleEndianWriter writer)
 {
     writer.WriteInt((int)teamId);
     writer.WriteByte((byte)0xFE);
     writer.WriteByte((byte)0xFF);
     writer.WriteByte((byte)0xFF);
     writer.WriteByte((byte)0xFF);
     writer.WriteInt((int)0);
     writer.WriteUInt((uint)unitNetId); // Fog Attached, when unit dies it disappears
     writer.WriteUInt((uint)fogNetId);  //Fog NetID
     writer.WriteInt((int)0);
     writer.WriteFloat(position.X);
     writer.WriteFloat(position.Y);
     writer.WriteFloat((float)2500);
     writer.WriteFloat((float)88.4f);
     writer.WriteFloat((float)130);
     writer.WriteFloat((float)1.0f);
     writer.WriteInt((int)0);
     writer.WriteByte((byte)199);
     writer.WriteFloat(visionRadius); // vision radius
 }
Пример #20
0
        public override void Serialize(LittleEndianWriter writer)
        {
            writer.WriteUInt(stackData.Id);
            byte bitfield = 0;

            if (stackData.OverrideSpells)
            {
                bitfield |= 1;
            }
            if (stackData.ModelOnly)
            {
                bitfield |= 2;
            }
            if (stackData.ReplaceCharacterPackage)
            {
                bitfield |= 4;
            }
            writer.WriteByte(bitfield);

            writer.WriteUInt(stackData.SkinId);
            writer.WriteFixedStringLast(stackData.SkinName, 64);
        }
Пример #21
0
 public override void Serialize(LittleEndianWriter writer)
 {
     writer.WriteUInt(netId);
     writer.WriteByte((byte)netNodeId);
     position.Serialize(writer);
     groupPosition.Serialize(writer);
     faceDirectionPosition.Serialize(writer);
     writer.WriteString(name, 64);
     writer.WriteString(skinName, 64);
     writer.WriteString(uniqueName, 64);
     writer.WriteString(spawnAnimationName, 64);
     writer.WriteUInt((uint)teamId);
     writer.WriteInt(damageBonus);
     writer.WriteInt(healthBonus);
     writer.WriteUInt((uint)roamState);
     writer.WriteInt(groupNumber);
     writer.WriteInt(buffSide);
     writer.WriteInt(revealEvent);
     writer.WriteInt(initialLevel);
     writer.WriteFloat(spawnDuration);
     writer.WriteFloat(spawnTime);
     writer.WriteByte(BehaviorTree);
     writer.WriteFixedStringLast(AIScript, 32);
 }
Пример #22
0
 public static void WriteWaypointSpeedParams(this LittleEndianWriter writer, SpeedParams data)
 {
     if (data == null)
     {
         data = new SpeedParams();
     }
     writer.WriteFloat(data.PathSpeedOverride);
     writer.WriteFloat(data.ParabolicGravity);
     data.ParabolicStartPoint.Serialize(writer);
     writer.WriteBool(data.Facing);
     writer.WriteUInt(data.FollowNetID);
     writer.WriteFloat(data.FollowDistance);
     writer.WriteFloat(data.FollowBackDistance);
     writer.WriteFloat(data.FollowTravelTime);
 }
Пример #23
0
        public override void Serialize(LittleEndianWriter writer)
        {
            writer.WriteUInt(turretNetId);
            writer.WriteByte((byte)0x40);
            foreach (var b in Encoding.UTF8.GetBytes(turretName))
            {
                writer.WriteByte((byte)b);
            }

            writer.Fill(0, 64 - turretName.Length);
            writer.WriteByte((byte)0x0C);
            writer.WriteByte((byte)0x00);
            writer.WriteByte((byte)0x00);
            writer.WriteByte((byte)0x80);
            writer.WriteByte((byte)0x01);
        }
Пример #24
0
        public override void Serialize(LittleEndianWriter writer)
        {
            int itemCount = Items.Length;

            if (itemCount > 0xFF)
            {
                throw new IOException("More than 255 items!");
            }

            writer.WriteByte((byte)itemCount);
            foreach (var item in Items)
            {
                item.Serialize(writer);
            }

            if (ShieldValues != null)
            {
                writer.WriteBool(true);
                ShieldValues.Serialize(writer);
            }
            else
            {
                writer.WriteBool(false);
            }

            writer.WriteInt(CharacterDataStack.Length);

            foreach (var data in CharacterDataStack)
            {
                data.Serialize(writer);
            }

            writer.WriteUInt(LookAtNetId);
            writer.WriteByte((byte)LookAtType);
            LookAtPosition.Serialize(writer);

            writer.WriteInt(BuffCount.Count);

            foreach (var kvp in BuffCount)
            {
                writer.WriteByte(kvp.Key);
                writer.WriteInt(kvp.Value);
            }

            writer.WriteBool(UnknownIsHero);
        }
        public override void Serialize(LittleEndianWriter writer)
        {
            writer.WriteByte(spellSlot);


            byte bitfield = 0;

            if (isSummonerSpell)
            {
                bitfield |= 0x01;
            }
            writer.WriteByte(bitfield);

            writer.WriteUInt((uint)changeSpellData.ChangeSlotSpellDataType);

            ChangeSpellDataExtension.WriteChangeSpellData(writer, changeSpellData);
            changeSpellData.Serialize(writer);
        }
Пример #26
0
        public override void Serialize(LittleEndianWriter writer)
        {
            writer.WriteByte((byte)announceEnum);

            if (sourceNetId != 0)
            {
                writer.WriteLong((long)sourceNetId);
                writer.WriteInt(assitsNetIds.Length);
                foreach (var a in assitsNetIds)
                {
                    writer.WriteUInt((uint)a);
                }
                for (int i = 0; i < 12 - assitsNetIds.Length; i++)
                {
                    writer.WriteInt((int)0);
                }
            }
        }
Пример #27
0
        public override void Serialize(LittleEndianWriter writer)
        {
            writer.WriteUInt(netId);
            writer.WriteInt(playerId);
            writer.WriteByte(40); // net node id?
            writer.WriteByte(0);  // botskilllevel

            if (team == TeamId.BLUE)
            {
                writer.WriteByte(1);
            }
            else
            {
                writer.WriteByte(0);
            }

            writer.WriteByte(0); // is bot
            writer.WriteByte(0); // spawn pos index
            writer.WriteInt(skinId);



            foreach (var b in Encoding.Default.GetBytes(name))
            {
                writer.WriteByte((byte)b);
            }

            writer.Fill(0, 128 - name.Length);


            foreach (var b in Encoding.Default.GetBytes(championType))
            {
                writer.WriteByte((byte)b);
            }

            writer.Fill(0, 40 - championType.Length);


            writer.WriteFloat(0.0f);
            writer.WriteFloat(0.0f);
            writer.WriteInt(0);
            writer.WriteByte(0);
        }
Пример #28
0
        }                                          //42-46


        public void Serialize(LittleEndianWriter writer2)
        {
            byte[] buffer;

            using (var stream = new MemoryStream())
            {
                using (var writer = new LittleEndianWriter(stream))
                {
                    writer.WriteUInt(SpellHash);
                    writer.WriteUInt(SpellNetID);
                    writer.WriteByte(SpellLevel);
                    writer.WriteFloat(AttackSpeedModifier);
                    writer.WriteUInt(CasterNetID);
                    writer.WriteUInt(SpellChainOwnerNetID);
                    writer.WriteUInt(PackageHash);
                    writer.WriteUInt(MissileNetID);
                    TargetPosition.Serialize(writer);
                    TargetPositionEnd.Serialize(writer);

                    int targetCount = Targets.Count;
                    if (targetCount > 32)
                    {
                        throw new IOException("CastInfo targets > 32!!!");
                    }

                    writer.WriteByte((byte)targetCount);
                    foreach (var target in Targets)
                    {
                        writer.WriteUInt(target.Item1);
                        writer.WriteByte((byte)target.Item2);
                    }

                    writer.WriteFloat(DesignerCastTime);
                    writer.WriteFloat(ExtraCastTime);
                    writer.WriteFloat(DesignerTotalTime);
                    writer.WriteFloat(Cooldown);
                    writer.WriteFloat(StartCastTime);

                    byte bitfield = 0;
                    if (IsAutoAttack)
                    {
                        bitfield |= 1;
                    }
                    if (IsSecondAutoAttack)
                    {
                        bitfield |= 2;
                    }
                    if (IsForceCastingOrChannel)
                    {
                        bitfield |= 4;
                    }
                    if (IsOverrideCastPosition)
                    {
                        bitfield |= 8;
                    }
                    if (IsClickCasted)
                    {
                        bitfield |= 16;
                    }
                    writer.WriteByte(bitfield);

                    writer.WriteByte(SpellSlot);
                    writer.WriteFloat(ManaCost);
                    SpellCastLaunchPosition.Serialize(writer);
                    writer.WriteInt(AmmoUsed);
                    writer.WriteFloat(AmmoRechargeTime);
                }
                buffer = new byte[stream.Length];
                var data = stream.GetBuffer();
                Buffer.BlockCopy(data, 0, buffer, 0, buffer.Length);
            }
            writer2.WriteUShort((ushort)(buffer.Length + 2));
            writer2.WriteBytes(buffer);
        }
Пример #29
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
        }
Пример #30
0
 public override void Serialize(LittleEndianWriter writer)
 {
     writer.WriteUInt(targetId);
 }