コード例 #1
0
        public static TES3Lib.TES3 ConvertExteriors(TES4Lib.TES4 tes4)
        {
            ConvertedRecords.Add("CELL", new List <ConvertedRecordData>());

            ConvertExteriorCells(tes4);

            Console.WriteLine($"EXTERIOR CELL AND REFERENCED RECORDS CONVERSION DONE \n BUILDING TES3 PLUGIN/MASTER INSTANCE");

            var tes3 = new TES3Lib.TES3();

            TES3Lib.Records.TES3 header = createTES3HEader();
            tes3.Records.Add(header);

            foreach (var record in Enum.GetNames(typeof(TES3Lib.RecordTypes)))
            {
                if (!ConvertedRecords.ContainsKey(record))
                {
                    continue;
                }
                tes3.Records.InsertRange(tes3.Records.Count, ConvertedRecords[record].Select(x => x.Record));
            }

            //dispose helper structures
            ConvertedRecords = new Dictionary <string, List <ConvertedRecordData> >();
            CellReferences   = new List <ConvertedCellReference>();
            DoorReferences   = new List <TES3Lib.Records.REFR>();

            return(tes3);
        }
コード例 #2
0
        public static TES3Lib.TES3 ConvertInteriorsAndExteriors(TES4Lib.TES4 tes4)
        {
            ConvertRecords(tes4, "SE");

            ConvertedRecords.Add("CELL", new List <ConvertedRecordData>());
            ConvertedRecords.Add("PGRD", new List <ConvertedRecordData>());

            ConvertInteriorCells(tes4);
            ConvertExteriorCells(tes4);

            UpdateDoorReferences();

            //SI
            PostProcessing();

            var tes3 = new TES3Lib.TES3();

            TES3Lib.Records.TES3 header = createTES3HEader();
            tes3.Records.Add(header);

            EquipementSplitter.SELL0NPCOrderKnightArmor100();

            foreach (var record in Enum.GetNames(typeof(TES3Lib.RecordTypes)))
            {
                //SI
                if (record.Equals("BODY"))
                {
                    tes3.Records.AddRange(GetListOfBodyParts());
                }

                if (!ConvertedRecords.ContainsKey(record))
                {
                    continue;
                }
                tes3.Records.AddRange(ConvertedRecords[record].Select(x => x.Record));
            }

            //dispose helper structures
            ConvertedRecords = new Dictionary <string, List <ConvertedRecordData> >();
            CellReferences   = new List <ConvertedCellReference>();
            DoorReferences   = new List <TES3Lib.Records.REFR>();

            var dupex = tes3.Records.Find(x => x.GetEditorId() == "SEOrderKnightArmor1Iron\0");

            return(tes3);
        }
コード例 #3
0
        /// <summary>
        /// Convert all non hierarchical records from loaded TES4 file
        /// </summary>
        /// <param name="tes4">TES4 ESM/ESP with records</param>
        /// <param name="prefix">optional prefix for records editorId to convert</param>
        private static void ConvertRecords(TES4Lib.TES4 tes4, string prefix = null)
        {
            foreach (TES4Lib.Base.Group group in tes4.Groups)
            {
                if (group.Label.Equals("CELL") || group.Label.Equals("DIAL") || group.Label.Equals("WRLD"))
                {
                    continue;
                }

                foreach (TES4Lib.Base.Record record in group.Records)
                {
                    string editorId = record.GetEditorId();
                    if (string.IsNullOrEmpty(editorId) || editorId.Equals("SE14GSEscortList\0"))
                    {
                        continue;
                    }

                    if (!string.IsNullOrEmpty(prefix))
                    {
                        if (editorId.StartsWith(prefix) || editorId.StartsWith("XP"))
                        {
                            ConvertedRecordData mwRecord = ConvertRecord(record);
                            if (IsNull(mwRecord))
                            {
                                continue;
                            }
                            if (!ConvertedRecords.ContainsKey(mwRecord.Type))
                            {
                                ConvertedRecords.Add(mwRecord.Type, new List <ConvertedRecordData>());
                            }
                            ConvertedRecords[mwRecord.Type].Add(mwRecord);
                        }
                    }
                    else
                    {
                        ConvertedRecordData mwRecord = ConvertRecord(record);
                        if (!ConvertedRecords.ContainsKey(mwRecord.Type))
                        {
                            ConvertedRecords.Add(mwRecord.Type, new List <ConvertedRecordData>());
                        }
                        ConvertedRecords[mwRecord.Type].Add(mwRecord);
                    }
                }
            }
        }