예제 #1
0
 public void ImportData()
 {
     BrakeParts.Import();
     BrakeControllerParts.Import();
     SteerParts.Import();
     ChassisParts.Import();
     LightweightParts.Import();
     RacingModifyParts.Import();
     EngineParts.Import();
     PortPolishParts.Import();
     EngineBalanceParts.Import();
     DisplacementParts.Import();
     ComputerParts.Import();
     NATuneParts.Import();
     TurbineKitParts.Import();
     DrivetrainParts.Import();
     FlywheelParts.Import();
     ClutchParts.Import();
     PropellerShaftParts.Import();
     GearParts.Import();
     SuspensionParts.Import();
     IntercoolerParts.Import();
     MufflerParts.Import();
     LSDParts.Import();
     TiresFrontParts.Import();
     TiresRearParts.Import();
     Unknown1.Import();
     Unknown2.Import();
     Unknown3.Import();
     Unknown4.Import();
     Unknown5.Import();
     Unknown6.Import();
     Unknown7.Import();
     Cars.Import();
 }
예제 #2
0
        public override int Serialize(byte[] codeplugContents, int address)
        {
            var contents = new byte[CONTENTS_LENGTH + (HasExtraByte ? 1 : 0)].AsSpan();

            Unknown1.CopyTo(contents.Slice(UNKNOWN1, 13));
            Unknown2.CopyTo(contents.Slice(UNKNOWN2, 9));
            contents[RSSI] = (byte)(RssiAlignment & 0b01111111);
            Unknown3.CopyTo(contents.Slice(UNKNOWN3, 2));
            contents[MIC_GAIN]  = (byte)((InternalMicPreAmpGain & 0b111) << 5);
            contents[MIC_GAIN] |= (byte)((ExternalMicPreAmpGain & 0b111) << 2);
            contents[MIC_GAIN] |= (byte)(UnknownMicBits & 0b11);
            Unknown4.CopyTo(contents.Slice(UNKNOWN4, 9));
            Unknown5.CopyTo(contents.Slice(UNKNOWN5, 4));
            if (HasExtraByte)
            {
                contents[UNKNOWNEXTRABYTE] = UnknownExtraByte;
            }

            var nextAddress = address + contents.Length + BlockSizeAdjustment;

            nextAddress = SerializeChild(Block06, BLOCK_06_VECTOR, codeplugContents, nextAddress, contents);
            nextAddress = SerializeChild(Block03, BLOCK_03_VECTOR, codeplugContents, nextAddress, contents);
            nextAddress = SerializeChild(Block0C, BLOCK_0C_VECTOR, codeplugContents, nextAddress, contents);
            nextAddress = SerializeChild(Block0F, BLOCK_0F_VECTOR, codeplugContents, nextAddress, contents);
            nextAddress = SerializeChild(Block11, BLOCK_11_VECTOR, codeplugContents, nextAddress, contents);
            Serializer(codeplugContents, address, contents);
            return(nextAddress);
        }
예제 #3
0
        public void ReadData(string filename)
        {
            using (FileStream file = new FileStream(filename, FileMode.Open, FileAccess.Read))
            {
                var blocks = new List <DataBlock>();

                for (int i = 1; i <= 34; i++)
                {
                    file.Position = 8 * i;
                    uint blockStart = file.ReadUInt();
                    uint blockSize  = file.ReadUInt();
                    blocks.Add(new DataBlock {
                        BlockStart = blockStart, BlockSize = blockSize
                    });
                }

                BrakeParts.Read(file, blocks[0].BlockStart, blocks[0].BlockSize);
                BrakeControllerParts.Read(file, blocks[1].BlockStart, blocks[1].BlockSize);
                SteerParts.Read(file, blocks[2].BlockStart, blocks[2].BlockSize);
                ChassisParts.Read(file, blocks[3].BlockStart, blocks[3].BlockSize);
                LightweightParts.Read(file, blocks[4].BlockStart, blocks[4].BlockSize);
                RacingModifyParts.Read(file, blocks[5].BlockStart, blocks[5].BlockSize);
                EngineParts.Read(file, blocks[6].BlockStart, blocks[6].BlockSize);
                PortPolishParts.Read(file, blocks[7].BlockStart, blocks[7].BlockSize);
                EngineBalanceParts.Read(file, blocks[8].BlockStart, blocks[8].BlockSize);
                DisplacementParts.Read(file, blocks[9].BlockStart, blocks[9].BlockSize);
                ComputerParts.Read(file, blocks[10].BlockStart, blocks[10].BlockSize);
                NATuneParts.Read(file, blocks[11].BlockStart, blocks[11].BlockSize);
                TurbineKitParts.Read(file, blocks[12].BlockStart, blocks[12].BlockSize);
                DrivetrainParts.Read(file, blocks[13].BlockStart, blocks[13].BlockSize);
                FlywheelParts.Read(file, blocks[14].BlockStart, blocks[14].BlockSize);
                ClutchParts.Read(file, blocks[15].BlockStart, blocks[15].BlockSize);
                PropellerShaftParts.Read(file, blocks[16].BlockStart, blocks[16].BlockSize);
                GearParts.Read(file, blocks[17].BlockStart, blocks[17].BlockSize);
                SuspensionParts.Read(file, blocks[18].BlockStart, blocks[18].BlockSize);
                IntercoolerParts.Read(file, blocks[19].BlockStart, blocks[19].BlockSize);
                MufflerParts.Read(file, blocks[20].BlockStart, blocks[20].BlockSize);
                LSDParts.Read(file, blocks[21].BlockStart, blocks[21].BlockSize);
                TiresFrontParts.Read(file, blocks[22].BlockStart, blocks[22].BlockSize);
                TiresRearParts.Read(file, blocks[23].BlockStart, blocks[23].BlockSize);
                Unknown1.Read(file, blocks[24].BlockStart, blocks[24].BlockSize);
                Unknown2.Read(file, blocks[25].BlockStart, blocks[25].BlockSize);
                Unknown3.Read(file, blocks[26].BlockStart, blocks[26].BlockSize);
                Unknown4.Read(file, blocks[27].BlockStart, blocks[27].BlockSize);
                Unknown5.Read(file, blocks[28].BlockStart, blocks[28].BlockSize);
                Unknown6.Read(file, blocks[29].BlockStart, blocks[29].BlockSize);
                Events.Read(file, blocks[30].BlockStart, blocks[30].BlockSize);
                EnemyCars.Read(file, blocks[31].BlockStart, blocks[31].BlockSize);
                Cars.Read(file, blocks[32].BlockStart, blocks[32].BlockSize);
                CarsSports.Read(file, blocks[33].BlockStart, blocks[33].BlockSize);

                uint stringTableStart = blocks[33].BlockStart + blocks[33].BlockSize;
                RaceStringTable.Read(file, stringTableStart, (uint)file.Length - stringTableStart);
            }
        }
예제 #4
0
        public void WriteData(string filename)
        {
            using (FileStream file = new FileStream(filename, FileMode.Create, FileAccess.ReadWrite))
            {
                file.Write(new byte[] { 0x47, 0x54, 0x44, 0x54, 0x6C, 0x00, 0x3E, 0x00 }, 0, 8); // The 0x3E is the number of indices

                file.Position = (0x3E * 8) + 7;
                file.WriteByte(0x00); // Data starts at 0x1F8 so position EOF

                uint i = 1;
                BrakeParts.Write(file, 8 * i++);
                BrakeControllerParts.Write(file, 8 * i++);
                SteerParts.Write(file, 8 * i++);
                ChassisParts.Write(file, 8 * i++);
                LightweightParts.Write(file, 8 * i++);
                RacingModifyParts.Write(file, 8 * i++);
                EngineParts.Write(file, 8 * i++);
                PortPolishParts.Write(file, 8 * i++);
                EngineBalanceParts.Write(file, 8 * i++);
                DisplacementParts.Write(file, 8 * i++);
                ComputerParts.Write(file, 8 * i++);
                NATuneParts.Write(file, 8 * i++);
                TurbineKitParts.Write(file, 8 * i++);
                DrivetrainParts.Write(file, 8 * i++);
                FlywheelParts.Write(file, 8 * i++);
                ClutchParts.Write(file, 8 * i++);
                PropellerShaftParts.Write(file, 8 * i++);
                GearParts.Write(file, 8 * i++);
                SuspensionParts.Write(file, 8 * i++);
                IntercoolerParts.Write(file, 8 * i++);
                MufflerParts.Write(file, 8 * i++);
                LSDParts.Write(file, 8 * i++);
                TiresFrontParts.Write(file, 8 * i++);
                TiresRearParts.Write(file, 8 * i++);
                Unknown1.Write(file, 8 * i++);
                Unknown2.Write(file, 8 * i++);
                Unknown3.Write(file, 8 * i++);
                Unknown4.Write(file, 8 * i++);
                Unknown5.Write(file, 8 * i++);
                Unknown6.Write(file, 8 * i++);
                Unknown7.Write(file, 8 * i++);
                Cars.Write(file, 8 * i++);

                file.Position = 0;
                using (FileStream zipFile = new FileStream(filename + ".gz", FileMode.Create, FileAccess.Write))
                {
                    using (GZipStream zip = new GZipStream(zipFile, CompressionMode.Compress))
                    {
                        file.CopyTo(zip);
                    }
                }
            }
        }
예제 #5
0
        public xxSubmesh Clone()
        {
            xxSubmesh submesh = new xxSubmesh();

            submesh.Unknown1      = (byte[])Unknown1.Clone();
            submesh.MaterialIndex = MaterialIndex;
            submesh.FaceList      = new List <xxFace>(FaceList.Count);
            for (int i = 0; i < FaceList.Count; i++)
            {
                submesh.FaceList.Add(FaceList[i].Clone());
            }
            submesh.VertexList = new List <xxVertex>(VertexList.Count);
            for (int i = 0; i < VertexList.Count; i++)
            {
                submesh.VertexList.Add(VertexList[i].Clone());
            }

            submesh.Unknown2 = Unknown2.CloneIfNotNull();

            if (Vector2Lists != null)
            {
                submesh.Vector2Lists = new List <List <Vector2> >(Vector2Lists.Count);
                for (int i = 0; i < Vector2Lists.Count; i++)
                {
                    List <Vector2> vectorList = new List <Vector2>(Vector2Lists[i].Count);
                    submesh.Vector2Lists.Add(vectorList);
                    for (int j = 0; j < Vector2Lists[i].Count; j++)
                    {
                        vectorList.Add(Vector2Lists[i][j]);
                    }
                }
            }

            submesh.Unknown3 = Unknown3.CloneIfNotNull();
            submesh.Unknown4 = Unknown4.CloneIfNotNull();
            submesh.Unknown5 = Unknown5.CloneIfNotNull();
            submesh.Unknown6 = Unknown6.CloneIfNotNull();

            return(submesh);
        }
예제 #6
0
            public override ListViewItem GetListViewItem()
            {
                ListViewItem m = new ListViewItem("");

                m.SubItems.Add(Position.X.ToString("#####0.############"));
                m.SubItems.Add(Position.Y.ToString("#####0.############"));
                m.SubItems.Add(Position.Z.ToString("#####0.############"));

                m.SubItems.Add(LengthVector.X.ToString("#####0.############"));
                m.SubItems.Add(LengthVector.Y.ToString("#####0.############"));
                m.SubItems.Add(LengthVector.Z.ToString("#####0.############"));

                m.SubItems.Add(XVector.X.ToString("#####0.############"));
                m.SubItems.Add(XVector.Y.ToString("#####0.############"));
                m.SubItems.Add(XVector.Z.ToString("#####0.############"));

                m.SubItems.Add(YVector.X.ToString("#####0.############"));
                m.SubItems.Add(YVector.Y.ToString("#####0.############"));
                m.SubItems.Add(YVector.Z.ToString("#####0.############"));

                m.SubItems.Add(ZVector.X.ToString("#####0.############"));
                m.SubItems.Add(ZVector.Y.ToString("#####0.############"));
                m.SubItems.Add(ZVector.Z.ToString("#####0.############"));

                m.SubItems.Add(Unknown5.ToString());
                m.SubItems.Add(Unknown6.ToString());
                m.SubItems.Add(Unknown7.ToString());

                m.SubItems.Add(HexUtil.GetHexReverse(Unknown8));
                m.SubItems.Add(LinkedCame.ToString());
                m.SubItems.Add(HexUtil.GetHexReverse(AreaType));

                m.SubItems.Add(HexUtil.GetHexReverse(Unknown10));

                m.SubItems.Add(HexUtil.GetHexReverse(Unknown11));
                return(m);
            }
예제 #7
0
 public void AsText(StringBuilder b, int pad)
 {
     b.Append(' ', pad);
     b.AppendLine("SceneSpecification:");
     b.Append(' ', pad++);
     b.AppendLine("{");
     b.Append(' ', pad);
     b.AppendLine("CellZ: 0x" + CellZ.ToString("X8") + " (" + CellZ + ")");
     Cell.AsText(b, pad);
     b.Append(' ', pad);
     b.AppendLine("arSnoLevelAreas:");
     b.Append(' ', pad);
     b.AppendLine("{");
     for (int i = 0; i < SNOLevelAreas.Length;)
     {
         b.Append(' ', pad + 1);
         for (int j = 0; j < 8 && i < SNOLevelAreas.Length; j++, i++)
         {
             b.Append("0x" + SNOLevelAreas[i].ToString("X8") + ", ");
         }
         b.AppendLine();
     }
     b.Append(' ', pad);
     b.AppendLine("}");
     b.AppendLine();
     b.Append(' ', pad);
     b.AppendLine("snoPrevWorld: 0x" + SNOPrevWorld.ToString("X8"));
     b.Append(' ', pad);
     b.AppendLine("Unknown1: 0x" + Unknown1.ToString("X8") + " (" + Unknown1 + ")");
     b.Append(' ', pad);
     b.AppendLine("snoPrevLevelArea: 0x" + SNOPrevLevelArea.ToString("X8"));
     b.Append(' ', pad);
     b.AppendLine("snoNextWorld: 0x" + SNONextWorld.ToString("X8"));
     b.Append(' ', pad);
     b.AppendLine("Unknown2: 0x" + Unknown2.ToString("X8") + " (" + Unknown2 + ")");
     b.Append(' ', pad);
     b.AppendLine("snoNextLevelArea: 0x" + SNONextLevelArea.ToString("X8"));
     b.Append(' ', pad);
     b.AppendLine("snoMusic: 0x" + SNOMusic.ToString("X8"));
     b.Append(' ', pad);
     b.AppendLine("snoCombatMusic: 0x" + SNOCombatMusic.ToString("X8"));
     b.Append(' ', pad);
     b.AppendLine("snoAmbient: 0x" + SNOAmbient.ToString("X8"));
     b.Append(' ', pad);
     b.AppendLine("snoReverb: 0x" + SNOReverb.ToString("X8"));
     b.Append(' ', pad);
     b.AppendLine("snoWeather: 0x" + SNOWeather.ToString("X8"));
     b.Append(' ', pad);
     b.AppendLine("snoPresetWorld: 0x" + SNOPresetWorld.ToString("X8"));
     b.Append(' ', pad);
     b.AppendLine("Unknown3: 0x" + Unknown3.ToString("X8") + " (" + Unknown3 + ")");
     b.Append(' ', pad);
     b.AppendLine("Unknown4: 0x" + Unknown4.ToString("X8") + " (" + Unknown4 + ")");
     b.Append(' ', pad);
     b.AppendLine("Unknown5: 0x" + Unknown5.ToString("X8") + " (" + Unknown5 + ")");
     b.Append(' ', pad);
     b.AppendLine("ClusterId: 0x" + ClusterID.ToString("X8") + " (" + ClusterID + ")");
     SceneCachedValues.AsText(b, pad);
     b.Append(' ', --pad);
     b.AppendLine("}");
 }
예제 #8
0
 public override string ToString()
 {
     return($"{{{nameof(Offset)}={Offset.ToString("X")}, {nameof(Unknown0)}={Unknown0.ToString("X")}, {nameof(Unknown1)}={Unknown1.ToString("X")}, {nameof(Unknown2)}={Unknown2.ToString("X")}, {nameof(Unknown3)}={Unknown3.ToString("X")}, {nameof(Unknown4)}={Unknown4.ToString("X")}, {nameof(Unknown5)}={Unknown5.ToString("X")}, {nameof(Unknown6)}={Unknown6.ToString("X")}, {nameof(Unknown7)}={Unknown7.ToString("X")}}}");
 }
        protected override void WriteDataXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            ele.TryPathTo("AnimationType", true, out subEle);
            subEle.Value = AnimationType.ToString();

            ele.TryPathTo("AnimationMultiplier", true, out subEle);
            subEle.Value = AnimationMultiplier.ToString("G15");

            ele.TryPathTo("Reach", true, out subEle);
            subEle.Value = Reach.ToString("G15");

            ele.TryPathTo("Flags1", true, out subEle);
            subEle.Value = Flags1.ToString();

            ele.TryPathTo("GripAnimation", true, out subEle);
            subEle.Value = GripAnimation.ToString();

            ele.TryPathTo("AmmoUse", true, out subEle);
            subEle.Value = AmmoUse.ToString();

            ele.TryPathTo("ReloadAnimation", true, out subEle);
            subEle.Value = ReloadAnimation.ToString();

            ele.TryPathTo("MinSpread", true, out subEle);
            subEle.Value = MinSpread.ToString("G15");

            ele.TryPathTo("Spread", true, out subEle);
            subEle.Value = Spread.ToString("G15");

            ele.TryPathTo("Unknown", true, out subEle);
            subEle.Value = Unknown.ToHex();

            ele.TryPathTo("SightFOV", true, out subEle);
            subEle.Value = SightFOV.ToString("G15");

            ele.TryPathTo("Unknown2", true, out subEle);
            subEle.Value = Unknown2.ToString("G15");

            ele.TryPathTo("Projectile", true, out subEle);
            Projectile.WriteXML(subEle, master);

            ele.TryPathTo("BaseVATSToHitChance", true, out subEle);
            subEle.Value = BaseVATSToHitChance.ToString();

            ele.TryPathTo("AttackAnimation", true, out subEle);
            subEle.Value = AttackAnimation.ToString();

            ele.TryPathTo("ProjectileCount", true, out subEle);
            subEle.Value = ProjectileCount.ToString();

            ele.TryPathTo("EmbeddedWeaponActorValue", true, out subEle);
            subEle.Value = EmbeddedWeaponActorValue.ToString();

            ele.TryPathTo("Range/Min", true, out subEle);
            subEle.Value = MinRange.ToString("G15");

            ele.TryPathTo("Range/Max", true, out subEle);
            subEle.Value = MaxRange.ToString("G15");

            ele.TryPathTo("LimbKillBehavior", true, out subEle);
            subEle.Value = LimbKillBehavior.ToString();

            ele.TryPathTo("Flags2", true, out subEle);
            subEle.Value = Flags2.ToString();

            ele.TryPathTo("AttackAnimationMultiplier", true, out subEle);
            subEle.Value = AttackAnimationMultiplier.ToString("G15");

            ele.TryPathTo("FireRate", true, out subEle);
            subEle.Value = FireRate.ToString("G15");

            ele.TryPathTo("ActionPointCost", true, out subEle);
            subEle.Value = ActionPointCost.ToString("G15");

            ele.TryPathTo("Rumble/LeftMotorStrength", true, out subEle);
            subEle.Value = RumbleLeftMotorStrength.ToString("G15");

            ele.TryPathTo("Rumble/RightMotorStrength", true, out subEle);
            subEle.Value = RumbleRightMotorStrength.ToString("G15");

            ele.TryPathTo("Rumble/Duration", true, out subEle);
            subEle.Value = RumbleDuration.ToString("G15");

            ele.TryPathTo("DamageToWeaponMult", true, out subEle);
            subEle.Value = DamageToWeaponMult.ToString("G15");

            ele.TryPathTo("AttackShotsPerSecond", true, out subEle);
            subEle.Value = AttackShotsPerSecond.ToString("G15");

            ele.TryPathTo("ReloadTime", true, out subEle);
            subEle.Value = ReloadTime.ToString("G15");

            ele.TryPathTo("JamTime", true, out subEle);
            subEle.Value = JamTime.ToString("G15");

            ele.TryPathTo("AimArc", true, out subEle);
            subEle.Value = AimArc.ToString("G15");

            ele.TryPathTo("Skill", true, out subEle);
            subEle.Value = Skill.ToString();

            ele.TryPathTo("Rumble/Pattern", true, out subEle);
            subEle.Value = RumblePattern.ToString();

            ele.TryPathTo("Rumble/Wavelength", true, out subEle);
            subEle.Value = RumbleWavelength.ToString("G15");

            ele.TryPathTo("LimbDamageMult", true, out subEle);
            subEle.Value = LimbDamageMult.ToString("G15");

            ele.TryPathTo("ResistanceType", true, out subEle);
            subEle.Value = ResistanceType.ToString();

            ele.TryPathTo("SightUsage", true, out subEle);
            subEle.Value = SightUsage.ToString("G15");

            ele.TryPathTo("SemiAutomaticFireDelay/Min", true, out subEle);
            subEle.Value = SemiAutomaticFireDelayMin.ToString("G15");

            ele.TryPathTo("SemiAutomaticFireDelay/Max", true, out subEle);
            subEle.Value = SemiAutomaticFireDelayMax.ToString("G15");

            ele.TryPathTo("Unknown3", true, out subEle);
            subEle.Value = Unknown3.ToString("G15");

            ele.TryPathTo("Mods/Mod1/Effect", true, out subEle);
            subEle.Value = Mod1Effect.ToString();

            ele.TryPathTo("Mods/Mod2/Effect", true, out subEle);
            subEle.Value = Mod2Effect.ToString();

            ele.TryPathTo("Mods/Mod3/Effect", true, out subEle);
            subEle.Value = Mod3Effect.ToString();

            ele.TryPathTo("Mods/Mod1/ValueA", true, out subEle);
            subEle.Value = Mod1ValueA.ToString("G15");

            ele.TryPathTo("Mods/Mod2/ValueA", true, out subEle);
            subEle.Value = Mod2ValueA.ToString("G15");

            ele.TryPathTo("Mods/Mod3/ValueA", true, out subEle);
            subEle.Value = Mod3ValueA.ToString("G15");

            ele.TryPathTo("PowerAttackAnimation", true, out subEle);
            subEle.Value = PowerAttackAnimation.ToString();

            ele.TryPathTo("StrengthRequirement", true, out subEle);
            subEle.Value = StrengthRequirement.ToString();

            ele.TryPathTo("Unknown4", true, out subEle);
            subEle.Value = Unknown4.ToString();

            ele.TryPathTo("Mods/Mod1/ReloadAnimation", true, out subEle);
            subEle.Value = Mod1ReloadAnimation.ToString();

            ele.TryPathTo("Unknown5", true, out subEle);
            subEle.Value = Unknown5.ToHex();

            ele.TryPathTo("AmmoRegenRate", true, out subEle);
            subEle.Value = AmmoRegenRate.ToString("G15");

            ele.TryPathTo("KillImpulse", true, out subEle);
            subEle.Value = KillImpulse.ToString("G15");

            ele.TryPathTo("Mods/Mod1/ValueB", true, out subEle);
            subEle.Value = Mod1ValueB.ToString("G15");

            ele.TryPathTo("Mods/Mod2/ValueB", true, out subEle);
            subEle.Value = Mod2ValueB.ToString("G15");

            ele.TryPathTo("Mods/Mod3/ValueB", true, out subEle);
            subEle.Value = Mod3ValueB.ToString("G15");

            ele.TryPathTo("ImpulseDistance", true, out subEle);
            subEle.Value = ImpulseDistance.ToString("G15");

            ele.TryPathTo("SkillRequirement", true, out subEle);
            subEle.Value = SkillRequirement.ToString();
        }
        public bool Equals(WeaponExtraData other)
        {
            if (System.Object.ReferenceEquals(this, other))
            {
                return(true);
            }

            if (((object)this == null) || ((object)other == null))
            {
                return(false);
            }

            return(AnimationType == other.AnimationType &&
                   AnimationMultiplier == other.AnimationMultiplier &&
                   Reach == other.Reach &&
                   Flags1 == other.Flags1 &&
                   GripAnimation == other.GripAnimation &&
                   AmmoUse == other.AmmoUse &&
                   ReloadAnimation == other.ReloadAnimation &&
                   MinSpread == other.MinSpread &&
                   Spread == other.Spread &&
                   Unknown.SequenceEqual(other.Unknown) &&
                   SightFOV == other.SightFOV &&
                   Unknown2 == other.Unknown2 &&
                   Projectile == other.Projectile &&
                   BaseVATSToHitChance == other.BaseVATSToHitChance &&
                   AttackAnimation == other.AttackAnimation &&
                   ProjectileCount == other.ProjectileCount &&
                   EmbeddedWeaponActorValue == other.EmbeddedWeaponActorValue &&
                   MinRange == other.MinRange &&
                   MaxRange == other.MaxRange &&
                   LimbKillBehavior == other.LimbKillBehavior &&
                   Flags2 == other.Flags2 &&
                   AttackAnimationMultiplier == other.AttackAnimationMultiplier &&
                   FireRate == other.FireRate &&
                   ActionPointCost == other.ActionPointCost &&
                   RumbleLeftMotorStrength == other.RumbleLeftMotorStrength &&
                   RumbleRightMotorStrength == other.RumbleRightMotorStrength &&
                   RumbleDuration == other.RumbleDuration &&
                   DamageToWeaponMult == other.DamageToWeaponMult &&
                   AttackShotsPerSecond == other.AttackShotsPerSecond &&
                   ReloadTime == other.ReloadTime &&
                   JamTime == other.JamTime &&
                   AimArc == other.AimArc &&
                   Skill == other.Skill &&
                   RumblePattern == other.RumblePattern &&
                   RumbleWavelength == other.RumbleWavelength &&
                   LimbDamageMult == other.LimbDamageMult &&
                   ResistanceType == other.ResistanceType &&
                   SightUsage == other.SightUsage &&
                   SemiAutomaticFireDelayMin == other.SemiAutomaticFireDelayMin &&
                   SemiAutomaticFireDelayMax == other.SemiAutomaticFireDelayMax &&
                   Unknown3 == other.Unknown3 &&
                   Mod1Effect == other.Mod1Effect &&
                   Mod2Effect == other.Mod2Effect &&
                   Mod3Effect == other.Mod3Effect &&
                   Mod1ValueA == other.Mod1ValueA &&
                   Mod2ValueA == other.Mod2ValueA &&
                   Mod3ValueA == other.Mod3ValueA &&
                   PowerAttackAnimation == other.PowerAttackAnimation &&
                   StrengthRequirement == other.StrengthRequirement &&
                   Unknown4 == other.Unknown4 &&
                   Mod1ReloadAnimation == other.Mod1ReloadAnimation &&
                   Unknown5.SequenceEqual(other.Unknown5) &&
                   AmmoRegenRate == other.AmmoRegenRate &&
                   KillImpulse == other.KillImpulse &&
                   Mod1ValueB == other.Mod1ValueB &&
                   Mod2ValueB == other.Mod2ValueB &&
                   Mod3ValueB == other.Mod3ValueB &&
                   ImpulseDistance == other.ImpulseDistance &&
                   SkillRequirement == other.SkillRequirement);
        }
예제 #11
0
        public void Serialize(Stream stream)
        {
            List <byte> part1Bytes = new List <byte>();

            part1Bytes.AddRange(BitConverter.GetBytes(VersionMajor));
            part1Bytes.AddRange(BitConverter.GetBytes(VersionMinor));
            part1Bytes.AddRange(Unknown5.Serialize());

            foreach (var property in Properties)
            {
                part1Bytes.AddRange(property.Serialize());
            }

            var bytes = part1Bytes.ToArray();

            stream.Write(BitConverter.GetBytes(part1Bytes.Count), 0, 4);
            var crc = Crc32.CalculateCrc(bytes, 0, bytes.Length, CRC_SEED);

            stream.Write(BitConverter.GetBytes(crc), 0, 4);
            stream.Write(bytes, 0, part1Bytes.Count);


            List <byte> part2Bytes = new List <byte>();

            part2Bytes.AddRange(BitConverter.GetBytes(Levels.Count));
            foreach (var level in Levels)
            {
                part2Bytes.AddRange(level.Serialize());
            }

            part2Bytes.AddRange(BitConverter.GetBytes(KeyFrames.Count));
            foreach (var keyFrame in KeyFrames)
            {
                part2Bytes.AddRange(keyFrame.Serialize());
            }

            var bw = new BitWriter(8 * 1024 * 1024); // 1MB is a decent starting point
            Dictionary <UInt32, ActorState> newActorsById = new Dictionary <uint, ActorState>();
            var maxChannels = MaxChannels();

            foreach (Frame f in Frames)
            {
                f.Serialize(maxChannels, ref newActorsById, VersionMajor, VersionMinor, bw);
            }
            var networkStreamBytes = bw.GetBytes();

            part2Bytes.AddRange(BitConverter.GetBytes(networkStreamBytes.Length));
            part2Bytes.AddRange(networkStreamBytes);


            part2Bytes.AddRange(BitConverter.GetBytes(DebugStrings.Count));
            foreach (var debugString in DebugStrings)
            {
                part2Bytes.AddRange(debugString.Serialize());
            }

            part2Bytes.AddRange(BitConverter.GetBytes(TickMarks.Count));
            foreach (var tickMark in TickMarks)
            {
                part2Bytes.AddRange(tickMark.Serialize());
            }

            part2Bytes.AddRange(BitConverter.GetBytes(Packages.Count));
            foreach (var packages in Packages)
            {
                part2Bytes.AddRange(packages.Serialize());
            }

            part2Bytes.AddRange(BitConverter.GetBytes(Objects.Length));
            foreach (var obj in Objects)
            {
                part2Bytes.AddRange(obj.Serialize());
            }

            part2Bytes.AddRange(BitConverter.GetBytes(Names.Length));
            foreach (var name in Names)
            {
                part2Bytes.AddRange(name.Serialize());
            }

            part2Bytes.AddRange(BitConverter.GetBytes(ClassIndexes.Count));
            foreach (var classIndex in ClassIndexes)
            {
                part2Bytes.AddRange(classIndex.Serialize());
            }

            part2Bytes.AddRange(BitConverter.GetBytes(ClassNetCaches.Length));
            foreach (var classNetCache in ClassNetCaches)
            {
                part2Bytes.AddRange(classNetCache.Serialize());
            }

            bytes = part2Bytes.ToArray();
            stream.Write(BitConverter.GetBytes(part2Bytes.Count), 0, 4);
            crc = Crc32.CalculateCrc(bytes, 0, bytes.Length, CRC_SEED);
            stream.Write(BitConverter.GetBytes(crc), 0, 4);
            stream.Write(bytes, 0, part2Bytes.Count);
        }