public void ScenarioAddSkits(List <List <ScenarioData> > groups)
        {
            List <TO8CHLI.SkitInfo> skitsToProcess = new List <TO8CHLI.SkitInfo>();

            foreach (var skit in Skits.SkitInfoList)
            {
                if (skit.Category == 0)
                {
                    skitsToProcess.Add(skit);
                }
            }
            skitsToProcess.Sort();

            for (int i = 0; i < groups.Count; ++i)
            {
                var group = groups[i];
                for (int j = 0; j < group.Count; ++j)
                {
                    var scene = group[j];

                    ScenarioData nextScene = null;
                    if (j != group.Count - 1)
                    {
                        nextScene = group[j + 1];
                    }
                    else
                    {
                        if (i != groups.Count - 1)
                        {
                            nextScene = groups[i + 1][0];
                        }
                    }

                    uint nextScenarioId = 1000000u;
                    if (nextScene != null)
                    {
                        string scenarioIdStr = nextScene.EpisodeId.Substring(3, 7).Replace("_", "");
                        nextScenarioId = UInt32.Parse(scenarioIdStr.TrimStart('0'));
                    }

                    List <TO8CHLI.SkitInfo> skitsToRemove = new List <TO8CHLI.SkitInfo>();
                    foreach (var skit in skitsToProcess)
                    {
                        uint skitTrigger = skit.FlagTrigger % 1000000u;
                        if (skitTrigger < nextScenarioId)
                        {
                            skitsToRemove.Add(skit);

                            if (!scene.Skits.Contains(skit))
                            {
                                scene.Skits.Add(skit);
                            }
                        }
                    }
                    foreach (var skit in skitsToRemove)
                    {
                        skitsToProcess.Remove(skit);
                    }
                }
            }
        }
Exemple #2
0
        public static string ScenarioProcessGroupsToHtml(List <List <ScenarioData> > groups, ScenarioType type, GameVersion version, string versionPostfix, GameLocale locale, WebsiteLanguage websiteLanguage, Dictionary <uint, TSS.TSSEntry> inGameIdDict, uint[] iconsWithItems, bool phpLinks = false)
        {
            var sb = new StringBuilder();

            AddHeader(sb, version, "Scenario Index (" + type.ToString() + ")");
            sb.AppendLine("<body>");
            AddMenuBar(sb, version, versionPostfix, locale, websiteLanguage, iconsWithItems, inGameIdDict);
            sb.Append("<div class=\"scenario-index\">");

            sb.Append("<ul>");
            for (int i = 0; i < groups.Count; ++i)
            {
                var group = groups[i];

                string commonBegin = ScenarioData.FindMostCommonStart(group);
                sb.Append("<li>");
                if (type == ScenarioType.Maps)
                {
                    sb.Append(commonBegin.Split(new char[] { '_', '0' })[0]);
                }
                else
                {
                    if (commonBegin != "")
                    {
                        sb.Append(commonBegin);
                    }
                    else
                    {
                        sb.Append("Intro");
                    }
                }

                sb.Append("<ul>");
                for (int j = 0; j < group.Count; ++j)
                {
                    var scene = group[j];

                    sb.Append("<li>");
                    sb.Append("<a href=\"");
                    sb.Append(WebsiteGenerator.GetUrl(WebsiteSection.Scenario, version, versionPostfix, locale, websiteLanguage, phpLinks, extra: scene.EpisodeId));
                    sb.Append("\">");
                    sb.Append(scene.HumanReadableNameWithoutPrefix(commonBegin));
                    sb.Append("</a>");

                    foreach (var skit in scene.Skits)
                    {
                        sb.Append("<ul>");
                        sb.Append("<li>");
                        sb.Append("<a href=\"");
                        sb.Append(WebsiteGenerator.GetUrl(WebsiteSection.Skit, version, versionPostfix, locale, websiteLanguage, phpLinks, extra: skit.RefString));
                        sb.Append("\">");
                        if (websiteLanguage.WantsJp())
                        {
                            sb.Append(inGameIdDict[skit.StringDicIdName].GetStringHtml(0, version, inGameIdDict));
                        }
                        if (websiteLanguage.WantsBoth())
                        {
                            sb.Append(" (");
                        }
                        if (websiteLanguage.WantsEn())
                        {
                            sb.Append(inGameIdDict[skit.StringDicIdName].GetStringHtml(1, version, inGameIdDict));
                        }
                        if (websiteLanguage.WantsBoth())
                        {
                            sb.Append(")");
                        }
                        sb.Append("</a>");
                        sb.Append("</li>");
                        sb.Append("</ul>");
                    }

                    sb.Append("</li>");
                }
                sb.Append("</ul>");

                sb.Append("</li>");
            }
            sb.Append("</ul>");
            sb.Append("</div>");

            AddFooter(sb);
            sb.AppendLine("</body></html>");

            return(sb.ToString());
        }