示例#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 void ImportMapFromImage(string path, int moveX = 0, int moveY = 0)
        {
            var heightMeta = RawImage.LoadRawMetadataFromJson(path);
            var heightData = RawImage.LoadGrayscale16(path, heightMeta);

            int cellNumberX = heightData.GetLength(1) / MW_CELL;
            int cellNumberY = heightData.GetLength(0) / MW_CELL;

            var landList = new List <Record>();

            for (int y = 0; y < cellNumberY; y++)
            {
                for (int x = 0; x < cellNumberX; x++)
                {
                    var landRecord = new LAND();
                    landRecord.INTV = new INTV
                    {
                        CellX = x + moveX,
                        CellY = y + moveY,
                    };
                    landRecord.DATA = new DATA();
                    landRecord.VHGT = CreateHeightMapSubrecord(x * 64, y * 64, heightData);

                    var cellRecord = new CELL
                    {
                        NAME = new TES3Lib.Subrecords.Shared.NAME
                        {
                            EditorId = ""
                        },
                        DATA = new TES3Lib.Subrecords.CELL.DATA
                        {
                            Flags = new HashSet <TES3Lib.Enums.Flags.CellFlag>(),
                            GridX = landRecord.INTV.CellX,
                            GridY = landRecord.INTV.CellY,
                        },
                    };

                    landList.Add(cellRecord);
                    landList.Add(landRecord);
                }
            }

            var example = new TES3();

            example.Records.Add(createTES3HEader());
            example.Records.AddRange(landList);
            example.TES3Save($"{path}.esp");
        }
示例#3
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);
        }
示例#4
0
 public TES3HeightMap(TES3 plugin)
 {
     PluginRef = plugin;
 }