Example #1
0
        public static void CreateSpoilerLog(RandomizedResult randomized, SettingsObject settings)
        {
            var itemList = randomized.ItemList
                           .Where(io => !io.Item.IsFake())
                           .Select(u => new SpoilerItem(u));
            var settingsString = settings.ToString();

            var directory = Path.GetDirectoryName(settings.OutputROMFilename);
            var filename  = $"{Path.GetFileNameWithoutExtension(settings.OutputROMFilename)}";

            var     plainTextRegex = new Regex("[^a-zA-Z0-9' .\\-]+");
            Spoiler spoiler        = new Spoiler()
            {
                Version                      = MainForm.AssemblyVersion.Substring(26),
                SettingsString               = settingsString,
                Seed                         = settings.Seed,
                RandomizeDungeonEntrances    = settings.RandomizeDungeonEntrances,
                ItemList                     = itemList.Where(u => !u.Item.IsFake()).ToList(),
                NewDestinationIndices        = randomized.NewDestinationIndices,
                Logic                        = randomized.Logic,
                CustomItemListString         = settings.UseCustomItemList ? settings.CustomItemListString : null,
                CustomStartingItemListString = settings.CustomStartingItemList.Any() ? settings.CustomStartingItemListString : null,
                GossipHints                  = randomized.GossipQuotes?.ToDictionary(me => (GossipQuote)me.Id, (me) =>
                {
                    var message     = me.Message.Substring(1);
                    var soundEffect = message.Substring(0, 2);
                    message         = message.Substring(2);
                    if (soundEffect == "\x69\x0C")
                    {
                        // real
                    }
                    else if (soundEffect == "\x69\x0A")
                    {
                        // fake
                        message = "FAKE - " + message;
                    }
                    else
                    {
                        // junk
                        message = "JUNK - " + message;
                    }
                    return(plainTextRegex.Replace(message.Replace("\x11", " "), ""));
                }),
            };

            if (settings.GenerateHTMLLog)
            {
                filename += "_SpoilerLog.html";
                using (StreamWriter newlog = new StreamWriter(Path.Combine(directory, filename)))
                {
                    Templates.HtmlSpoiler htmlspoiler = new Templates.HtmlSpoiler(spoiler);
                    newlog.Write(htmlspoiler.TransformText());
                }
            }
            else
            {
                filename += "_SpoilerLog.txt";
                CreateTextSpoilerLog(spoiler, Path.Combine(directory, filename));
            }
        }
Example #2
0
        private void WriteStartupStrings()
        {
            if (_settings.LogicMode == LogicMode.Vanilla)
            {
                //ResourceUtils.ApplyHack(ModsDir + "postman-testing");
                return;
            }
            Version v = Assembly.GetExecutingAssembly().GetName().Version;

            RomUtils.SetStrings(Values.ModsDirectory + "logo-text", $"v{v}", _settings.ToString());
        }
Example #3
0
        public static void CreateSpoilerLog(RandomizedResult randomized, SettingsObject settings)
        {
            var itemList = randomized.ItemList
                           .Where(u => u.ReplacesAnotherItem)
                           .Select(u => new SpoilerItem(u))
                           .ToList();
            var settingsString = settings.ToString();

            var directory = Path.GetDirectoryName(settings.OutputROMFilename);
            var filename  = $"{Path.GetFileNameWithoutExtension(settings.OutputROMFilename)}";

            Spoiler spoiler = new Spoiler()
            {
                Version                   = MainForm.AssemblyVersion.Substring(26),
                SettingsString            = settingsString,
                Seed                      = settings.Seed,
                RandomizeDungeonEntrances = settings.RandomizeDungeonEntrances,
                ItemList                  = itemList,
                NewDestinationIndices     = randomized.NewDestinationIndices,
                Logic                     = randomized.Logic,
                CustomItemListString      = settings.UseCustomItemList ? settings.CustomItemListString : null,
            };

            if (settings.GenerateHTMLLog)
            {
                filename += "_SpoilerLog.html";
                using (StreamWriter newlog = new StreamWriter(Path.Combine(directory, filename)))
                {
                    Templates.HtmlSpoiler htmlspoiler = new Templates.HtmlSpoiler(spoiler);
                    newlog.Write(htmlspoiler.TransformText());
                }
            }
            else
            {
                filename += "_SpoilerLog.txt";
                CreateTextSpoilerLog(spoiler, Path.Combine(directory, filename));
            }
        }