Example #1
0
        public static void Write()
        {
            TES4Collection           collection    = TES4CollectionFactory.CreateForQUSTReferenceAliasExporting(DataDirectory.GetESMDirectoryPath(), DataDirectory.TES4GameFileName);
            BuildTarget              qfBuildTarget = BuildTargetFactory.Construct(BuildTargetFactory.QFName, new Build(DataDirectory.GetBuildPath()));
            string                   sourcePath    = qfBuildTarget.GetSourcePath();
            IEnumerable <TES4Record> qustRecords   = collection.GetGrupRecords(TES4RecordType.QUST);

            foreach (TES4Record qust in qustRecords)
            {
                Write(sourcePath, qust);
            }
        }
        public static void Write()
        {
            BuildTarget              qfBuildTarget = BuildTargetFactory.Construct(BuildTargetFactory.QFName, new Build(DataDirectory.GetBuildPath()));
            string                   sourcePath    = qfBuildTarget.GetSourcePath();
            TES4Collection           collection    = TES4CollectionFactory.CreateForQUSTStageMapExportingFromESM(DataDirectory.GetESMDirectoryPath(), DataDirectory.TES4GameFileName);
            IEnumerable <TES4Record> qusts         = collection.GetGrupRecords(TES4RecordType.QUST);

            foreach (TES4Record qust in qusts)
            {
                string fileNameNoExt  = BuildTargetsWriter.GetFileNameNoExt(TES5ReferenceFactory.qf_Prefix, qust, true, null);
                string fileName       = fileNameNoExt + ".map";
                string mapFilePath    = sourcePath + Path.DirectorySeparatorChar + fileName;
                string contentsString = StageMapFromESMBuilder.BuildString(qust);
                FileWriter.WriteAllTextOrThrowIfExists(mapFilePath, contentsString);
            }
        }
        public void write(BuildTarget target, BuildTracker buildTracker, ProgressWriter progressWriter)
        {
            Dictionary <string, TES5Target> scripts   = buildTracker.GetBuiltScripts(target.GetTargetName());
            List <TES5Target> connectedQuestFragments = new List <TES5Target>();
            Dictionary <string, List <QuestStageScript> > jointScripts = new Dictionary <string, List <QuestStageScript> >();

            /*
             * Scan manually for .map files in the QF scripts folder
             * Reason is that in case we"ve got a quest with no fragments to anything whatsoever, we"ll have to go
             * through it too ( just with empty subfragments trees ), to generate the objective handlings
             */
            string sourcePath = target.GetSourcePath();

            foreach (var mapFilePath in Directory.EnumerateFiles(sourcePath, "*.map"))
            {
                string mapFileName = Path.GetFileNameWithoutExtension(mapFilePath);
                jointScripts.AddNewListIfNotContainsKey(mapFileName);
            }

            /*
             * Group the fragments together
             */
            foreach (var script in scripts.Values)
            {
                string[] parts = script.Script.ScriptHeader.OriginalScriptName.Split('_');
                if (parts.Length < 3)
                {
                    //Not able to categorize, probably wrong name of the fragment.
                    continue;
                }

                string baseName = parts[0] + "_" + parts[1] + "_" + parts[2];
                jointScripts.AddNewListIfNotContainsKeyAndAddValueToList(baseName, new QuestStageScript(script, int.Parse(parts[3]), int.Parse(parts[4])));
            }

            foreach (var kvp in jointScripts)
            {
                var resultingFragmentName = kvp.Key;
                var subfragmentsTrees     = kvp.Value;
                connectedQuestFragments.Add(this.QFFragmentFactory.JoinQFFragments(target, resultingFragmentName, subfragmentsTrees));
            }

            Write(connectedQuestFragments, progressWriter);
        }
        public static void Write()
        {
            BuildTarget qfBuildTarget  = BuildTargetFactory.Construct(BuildTargetFactory.QFName, new Build(DataDirectory.GetBuildPath()));
            string      transpiledPath = qfBuildTarget.GetTranspiledPath();
            string      sourcePath     = qfBuildTarget.GetSourcePath();

            foreach (string pscPath in Directory.EnumerateFiles(transpiledPath, "*.psc"))
            {
                Write(sourcePath, pscPath);
            }
            TES4Collection           collection  = TES4CollectionFactory.CreateForQUSTStageMapExportingFromPSCFiles(DataDirectory.GetESMDirectoryPath(), DataDirectory.TES4GameFileName);
            IEnumerable <TES4Record> qustRecords = collection.GetGrupRecords(TES4RecordType.QUST);

            foreach (TES4Record qust in qustRecords)
            {
                string path = sourcePath + BuildTargetsWriter.GetFileNameNoExt(TES5ReferenceFactory.qf_Prefix, qust, true, null) + ".map2";
                FileWriter.WriteAllTextIfNotExists(path, "");
            }
        }