예제 #1
0
        public string GenerateHtmlNecropolis(string dir, bool showEnemies)
        {
            Console.WriteLine("Generating Website: Necropolis");
            var sb = new StringBuilder();

            AddHeader(sb, Version, "Necropolis of Nostalgia");
            sb.AppendLine("<body>");
            AddMenuBar(sb, Version, VersionPostfix, Locale, Language, IconsWithItems, InGameIdDict);

            foreach (var floor in NecropolisFloors.FloorList)
            {
                int    floorNumberLong      = Int32.Parse(floor.RefString1.Split('_').Last());
                int    floorNumber          = (floorNumberLong - 1) % 10 + 1;
                int    floorStratumAsNumber = (floorNumberLong - 1) / 10 + 1;
                string floorStratum         = ((char)(floorStratumAsNumber + 64)).ToString();
                string html = NecropolisMaps[floor.RefString2].GetDataAsHtml(floorStratum, floorNumber, showEnemies ? Enemies : null, showEnemies ? EnemyGroups : null, showEnemies ? EncounterGroups : null, Version, VersionPostfix, Locale, Language, NecropolisTreasures, Items, InGameIdDict);
                sb.Append(html);
                sb.Append("<hr>");

                StringBuilder sb2 = new StringBuilder();
                AddHeader(sb2, Version, floorStratum + "-" + floorNumber + " - Necropolis of Nostalgia");
                sb2.Append("<body>");
                sb2.Append(html);
                AddFooter(sb2);
                sb2.Append("</body></html>");
                System.IO.File.WriteAllText(Path.Combine(dir, WebsiteGenerator.GetUrl(showEnemies ? WebsiteSection.NecropolisEnemy : WebsiteSection.NecropolisMap, Version, VersionPostfix, Locale, Language, false, extra: floorStratum + floorNumber)), sb2.ToString(), Encoding.UTF8);
            }

            /*
             * foreach ( var treasureLayout in NecropolisTreasures.TreasureInfoList ) {
             *      sb.Append( "<hr>" );
             *      sb.Append( treasureLayout.GetDataAsHtml( Items, InGameIdDict ) );
             * }
             * //*/

            AddFooter(sb);
            sb.AppendLine("</body></html>");
            return(sb.ToString());
        }
        public static void AddMenuBar(StringBuilder sb, GameVersion Version, string versionPostfix, GameLocale locale, WebsiteLanguage websiteLanguage, IEnumerable <uint> IconsWithItems, Dictionary <uint, TSS.TSSEntry> InGameIdDict)
        {
            sb.AppendLine("<div id=\"header-name\">");
            sb.AppendLine("<a href=\"index.html\">Tales of Vesperia - Data &amp; Translation Guide</a>");
            sb.AppendLine("</div>");

            sb.AppendLine("<div id=\"topmenu\">");
            sb.AppendLine("<a href=\"" + WebsiteGenerator.GetUrl(WebsiteSection.Arte, Version, versionPostfix, locale, websiteLanguage, false) + "\"><img src=\"menu-icons/main-01.png\" title=\"Artes\"></a>");
            //sb.AppendLine( "<a href=\"" + WebsiteGenerator.GetUrl( WebsiteSection.Equipment, Version, versionPostfix, locale, websiteLanguage, false ) + "\"><img src=\"menu-icons/main-02.png\" title=\"Equipment\"></a>" );
            //sb.AppendLine( "<a href=\"" + WebsiteGenerator.GetUrl( WebsiteSection.Item, Version, versionPostfix, locale, websiteLanguage, false ) + "\"><img src=\"menu-icons/main-03.png\" title=\"Items\"></a>" );
            sb.AppendLine("<a href=\"" + WebsiteGenerator.GetUrl(WebsiteSection.Skill, Version, versionPostfix, locale, websiteLanguage, false) + "\"><img src=\"menu-icons/main-04.png\" title=\"Skills\"></a>");
            sb.AppendLine("<a href=\"" + WebsiteGenerator.GetUrl(WebsiteSection.Strategy, Version, versionPostfix, locale, websiteLanguage, false) + "\"><img src=\"menu-icons/main-05.png\" title=\"Strategy\"></a>");
            sb.AppendLine("<a href=\"" + WebsiteGenerator.GetUrl(WebsiteSection.Recipe, Version, versionPostfix, locale, websiteLanguage, false) + "\"><img src=\"menu-icons/main-06.png\" title=\"Recipes\"></a>");
            sb.AppendLine("<a href=\"" + WebsiteGenerator.GetUrl(WebsiteSection.Shop, Version, versionPostfix, locale, websiteLanguage, false) + "\"><img src=\"menu-icons/main-02.png\" title=\"Shops\"></a>");
            sb.AppendLine("<a href=\"" + WebsiteGenerator.GetUrl(WebsiteSection.Title, Version, versionPostfix, locale, websiteLanguage, false) + "\"><img src=\"menu-icons/main-07.png\" title=\"Titles\"></a>");
            //sb.AppendLine( "<img src=\"menu-icons/main-08.png\" title=\"Library\">" );
            sb.AppendLine("<a href=\"" + WebsiteGenerator.GetUrl(WebsiteSection.Synopsis, Version, versionPostfix, locale, websiteLanguage, false) + "\"><img src=\"menu-icons/sub-09.png\" title=\"Synopsis\"></a>");
            sb.AppendLine("<a href=\"" + WebsiteGenerator.GetUrl(WebsiteSection.BattleBook, Version, versionPostfix, locale, websiteLanguage, false) + "\"><img src=\"menu-icons/sub-14.png\" title=\"Battle Book\"></a>");
            //sb.AppendLine( "<a href=\"" + WebsiteGenerator.GetUrl( WebsiteSection.Enemy, Version, versionPostfix, locale, websiteLanguage, false ) + "\"><img src=\"menu-icons/sub-13.png\" title=\"Monster Book\"></a>" );
            //sb.AppendLine( "<a href=\"" + WebsiteGenerator.GetUrl( WebsiteSection.Item, Version, versionPostfix, locale, websiteLanguage, false ) + "\"><img src=\"menu-icons/sub-11.png\" title=\"Collector's Book\"></a>" );
            sb.AppendLine("<a href=\"" + WebsiteGenerator.GetUrl(WebsiteSection.Location, Version, versionPostfix, locale, websiteLanguage, false) + "\"><img src=\"menu-icons/sub-10.png\" title=\"World Map\"></a>");
            sb.AppendLine("<a href=\"" + WebsiteGenerator.GetUrl(WebsiteSection.SearchPoint, Version, versionPostfix, locale, websiteLanguage, false) + "\"><img src=\"etc/U_ITEM_IRIKIAGRASS-64px.png\" title=\"Search Points\"></a>");
            sb.AppendLine("<a href=\"" + WebsiteGenerator.GetUrl(WebsiteSection.Record, Version, versionPostfix, locale, websiteLanguage, false) + "\"><img src=\"menu-icons/sub-08.png\" title=\"Records\"></a>");
            //sb.AppendLine( "<img src=\"menu-icons/main-09.png\" title=\"Save & Load\">" );
            //sb.AppendLine( "<img src=\"menu-icons/sub-06.png\" title=\"Save\">" );
            //sb.AppendLine( "<img src=\"menu-icons/sub-05.png\" title=\"Load\">" );
            sb.AppendLine("<a href=\"" + WebsiteGenerator.GetUrl(WebsiteSection.Settings, Version, versionPostfix, locale, websiteLanguage, false) + "\"><img src=\"menu-icons/sub-07.png\" title=\"Settings\"></a>");
            sb.AppendLine("<a href=\"" + WebsiteGenerator.GetUrl(WebsiteSection.GradeShop, Version, versionPostfix, locale, websiteLanguage, false) + "\"><img src=\"item-categories/cat-01.png\" title=\"Grade Shop\"></a>");
            if (Version.HasPS3Content())
            {
                sb.AppendLine("<a href=\"" + WebsiteGenerator.GetUrl(WebsiteSection.NecropolisMap, Version, versionPostfix, locale, websiteLanguage, false) + "\"><img src=\"menu-icons/weather-4-64px.png\" title=\"Necropolis of Nostalgia Maps\"></a>");
            }
            if (Version == GameVersion.PS3)
            {
                sb.AppendLine("<a href=\"" + WebsiteGenerator.GetUrl(WebsiteSection.Trophy, Version, versionPostfix, locale, websiteLanguage, false) + "\"><img src=\"trophies/gold.png\" title=\"Trophies\"></a>");
            }
            sb.AppendLine("<br>");
            for (uint i = 2; i < 12; ++i)
            {
                sb.Append("<a href=\"" + WebsiteGenerator.GetUrl(WebsiteSection.Item, Version, versionPostfix, locale, websiteLanguage, false, category: (int)i) + "\">");
                sb.Append("<img src=\"item-categories/cat-" + i.ToString("D2") + ".png\" title=\"" + InGameIdDict[33912572u + i].StringEngOrJpnHtml(Version, InGameIdDict, websiteLanguage) + "\" height=\"32\">");
                sb.Append("</a>");
            }
            sb.AppendLine();
            for (uint i = 0; i < 9; ++i)
            {
                sb.Append("<a href=\"" + WebsiteGenerator.GetUrl(WebsiteSection.Enemy, Version, versionPostfix, locale, websiteLanguage, false, category: (int)i) + "\">");
                sb.Append("<img src=\"monster-categories/cat-" + i + ".png\" title=\"" + InGameIdDict[33912323u + i].StringEngOrJpnHtml(Version, InGameIdDict, websiteLanguage) + "\" height=\"32\">");
                sb.Append("</a>");
            }
            sb.AppendLine("<br>");
            foreach (uint i in IconsWithItems)
            {
                sb.Append("<a href=\"" + WebsiteGenerator.GetUrl(WebsiteSection.Item, Version, versionPostfix, locale, websiteLanguage, false, icon: (int)i) + "\">");
                sb.Append("<img src=\"item-icons/ICON" + i + ".png\" height=\"16\" width=\"16\">");
                sb.Append("</a>");
            }
            sb.AppendLine("<br>");
            sb.Append("<a href=\"" + WebsiteGenerator.GetUrl(WebsiteSection.ScenarioStoryIndex, Version, versionPostfix, locale, websiteLanguage, false) + "\">Story</a> / ");
            sb.Append("<a href=\"" + WebsiteGenerator.GetUrl(WebsiteSection.ScenarioSidequestIndex, Version, versionPostfix, locale, websiteLanguage, false) + "\">Sidequests</a> / ");
            sb.Append("<a href=\"" + WebsiteGenerator.GetUrl(WebsiteSection.SkitIndex, Version, versionPostfix, locale, websiteLanguage, false) + "\">Skits</a>");
            sb.AppendLine();
            sb.AppendLine("</div>");
            sb.AppendLine("<hr>");
            sb.AppendLine("<div id=\"content\">");
        }
예제 #3
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());
        }
예제 #4
0
        public static void ExportToWebsite(WebsiteGenerator site, WebsiteLanguage lang, string dir, WebsiteGenerator siteComparison = null)
        {
            Directory.CreateDirectory(dir);
            System.IO.File.WriteAllText(Path.Combine(dir, WebsiteGenerator.GetUrl(WebsiteSection.Item, site.Version, site.VersionPostfix, site.Locale, lang, false)), site.GenerateHtmlItems(), Encoding.UTF8);
            foreach (uint i in site.IconsWithItems)
            {
                System.IO.File.WriteAllText(Path.Combine(dir, WebsiteGenerator.GetUrl(WebsiteSection.Item, site.Version, site.VersionPostfix, site.Locale, lang, false, icon: (int)i)), site.GenerateHtmlItems(icon: i), Encoding.UTF8);
            }
            for (uint i = 2; i < 12; ++i)
            {
                System.IO.File.WriteAllText(Path.Combine(dir, WebsiteGenerator.GetUrl(WebsiteSection.Item, site.Version, site.VersionPostfix, site.Locale, lang, false, category: (int)i)), site.GenerateHtmlItems(category: i), Encoding.UTF8);
            }
            System.IO.File.WriteAllText(Path.Combine(dir, WebsiteGenerator.GetUrl(WebsiteSection.Enemy, site.Version, site.VersionPostfix, site.Locale, lang, false)), site.GenerateHtmlEnemies(), Encoding.UTF8);
            for (int i = 0; i < 9; ++i)
            {
                System.IO.File.WriteAllText(Path.Combine(dir, WebsiteGenerator.GetUrl(WebsiteSection.Enemy, site.Version, site.VersionPostfix, site.Locale, lang, false, category: (int)i)), site.GenerateHtmlEnemies(category: i), Encoding.UTF8);
            }
            System.IO.File.WriteAllText(Path.Combine(dir, WebsiteGenerator.GetUrl(WebsiteSection.EnemyGroup, site.Version, site.VersionPostfix, site.Locale, lang, false)), site.GenerateHtmlEnemyGroups(), Encoding.UTF8);
            System.IO.File.WriteAllText(Path.Combine(dir, WebsiteGenerator.GetUrl(WebsiteSection.EncounterGroup, site.Version, site.VersionPostfix, site.Locale, lang, false)), site.GenerateHtmlEncounterGroups(), Encoding.UTF8);
            System.IO.File.WriteAllText(Path.Combine(dir, WebsiteGenerator.GetUrl(WebsiteSection.Skill, site.Version, site.VersionPostfix, site.Locale, lang, false)), site.GenerateHtmlSkills(), Encoding.UTF8);
            System.IO.File.WriteAllText(Path.Combine(dir, WebsiteGenerator.GetUrl(WebsiteSection.Arte, site.Version, site.VersionPostfix, site.Locale, lang, false)), site.GenerateHtmlArtes(), Encoding.UTF8);
            System.IO.File.WriteAllText(Path.Combine(dir, WebsiteGenerator.GetUrl(WebsiteSection.Synopsis, site.Version, site.VersionPostfix, site.Locale, lang, false)), site.GenerateHtmlSynopsis(), Encoding.UTF8);
            System.IO.File.WriteAllText(Path.Combine(dir, WebsiteGenerator.GetUrl(WebsiteSection.Recipe, site.Version, site.VersionPostfix, site.Locale, lang, false)), site.GenerateHtmlRecipes(), Encoding.UTF8);
            System.IO.File.WriteAllText(Path.Combine(dir, WebsiteGenerator.GetUrl(WebsiteSection.Location, site.Version, site.VersionPostfix, site.Locale, lang, false)), site.GenerateHtmlLocations(), Encoding.UTF8);
            System.IO.File.WriteAllText(Path.Combine(dir, WebsiteGenerator.GetUrl(WebsiteSection.Strategy, site.Version, site.VersionPostfix, site.Locale, lang, false)), site.GenerateHtmlStrategy(), Encoding.UTF8);
            System.IO.File.WriteAllText(Path.Combine(dir, WebsiteGenerator.GetUrl(WebsiteSection.Shop, site.Version, site.VersionPostfix, site.Locale, lang, false)), site.GenerateHtmlShops(), Encoding.UTF8);
            System.IO.File.WriteAllText(Path.Combine(dir, WebsiteGenerator.GetUrl(WebsiteSection.Title, site.Version, site.VersionPostfix, site.Locale, lang, false)), site.GenerateHtmlTitles(), Encoding.UTF8);
            System.IO.File.WriteAllText(Path.Combine(dir, WebsiteGenerator.GetUrl(WebsiteSection.BattleBook, site.Version, site.VersionPostfix, site.Locale, lang, false)), site.GenerateHtmlBattleBook(), Encoding.UTF8);
            System.IO.File.WriteAllText(Path.Combine(dir, WebsiteGenerator.GetUrl(WebsiteSection.Record, site.Version, site.VersionPostfix, site.Locale, lang, false)), site.GenerateHtmlRecords(), Encoding.UTF8);
            System.IO.File.WriteAllText(Path.Combine(dir, WebsiteGenerator.GetUrl(WebsiteSection.Settings, site.Version, site.VersionPostfix, site.Locale, lang, false)), site.GenerateHtmlSettings(), Encoding.UTF8);
            System.IO.File.WriteAllText(Path.Combine(dir, WebsiteGenerator.GetUrl(WebsiteSection.GradeShop, site.Version, site.VersionPostfix, site.Locale, lang, false)), site.GenerateHtmlGradeShop(), Encoding.UTF8);
            if (site.BattleVoicesEnd != null)
            {
                System.IO.File.WriteAllText(Path.Combine(dir, WebsiteGenerator.GetUrl(WebsiteSection.PostBattleVoices, site.Version, site.VersionPostfix, site.Locale, lang, false)), site.GenerateHtmlBattleVoicesEnd(), Encoding.UTF8);
            }
            if (site.TrophyEn != null && site.TrophyJp != null)
            {
                System.IO.File.WriteAllText(Path.Combine(dir, WebsiteGenerator.GetUrl(WebsiteSection.Trophy, site.Version, site.VersionPostfix, site.Locale, lang, false)), site.GenerateHtmlTrophies(), Encoding.UTF8);
            }
            System.IO.File.WriteAllText(Path.Combine(dir, WebsiteGenerator.GetUrl(WebsiteSection.SkitInfo, site.Version, site.VersionPostfix, site.Locale, lang, false)), site.GenerateHtmlSkitInfo(), Encoding.UTF8);
            System.IO.File.WriteAllText(Path.Combine(dir, WebsiteGenerator.GetUrl(WebsiteSection.SkitIndex, site.Version, site.VersionPostfix, site.Locale, lang, false)), site.GenerateHtmlSkitIndex(), Encoding.UTF8);
            if (site.SearchPoints != null)
            {
                System.IO.File.WriteAllText(Path.Combine(dir, WebsiteGenerator.GetUrl(WebsiteSection.SearchPoint, site.Version, site.VersionPostfix, site.Locale, lang, false)), site.GenerateHtmlSearchPoints(), Encoding.UTF8);
                site.SearchPoints.GenerateMap(site.WorldMapImage).Save(dir + site.Version + @"-SearchPoint.png");
            }
            if (site.NecropolisFloors != null && site.NecropolisTreasures != null && site.NecropolisMaps != null)
            {
                System.IO.File.WriteAllText(Path.Combine(dir, WebsiteGenerator.GetUrl(WebsiteSection.NecropolisMap, site.Version, site.VersionPostfix, site.Locale, lang, false)), site.GenerateHtmlNecropolis(dir, false), Encoding.UTF8);
                System.IO.File.WriteAllText(Path.Combine(dir, WebsiteGenerator.GetUrl(WebsiteSection.NecropolisEnemy, site.Version, site.VersionPostfix, site.Locale, lang, false)), site.GenerateHtmlNecropolis(dir, true), Encoding.UTF8);
            }
            if (site.NpcDefs != null)
            {
                System.IO.File.WriteAllText(Path.Combine(dir, WebsiteGenerator.GetUrl(WebsiteSection.StringDic, site.Version, site.VersionPostfix, site.Locale, lang, false)), site.GenerateHtmlNpc(), Encoding.UTF8);
            }

            string databasePath = Path.Combine(dir, "_db-" + site.Version + ".sqlite");

            System.IO.File.Delete(databasePath);
            new GenerateDatabase(site, new System.Data.SQLite.SQLiteConnection("Data Source=" + databasePath), siteComparison).ExportAll();

            System.IO.File.WriteAllText(Path.Combine(dir, WebsiteGenerator.GetUrl(WebsiteSection.ScenarioStoryIndex, site.Version, site.VersionPostfix, site.Locale, lang, false)), WebsiteGenerator.ScenarioProcessGroupsToHtml(site.ScenarioGroupsStory, ScenarioType.Story, site.Version, site.VersionPostfix, site.Locale, lang, site.InGameIdDict, site.IconsWithItems), Encoding.UTF8);
            System.IO.File.WriteAllText(Path.Combine(dir, WebsiteGenerator.GetUrl(WebsiteSection.ScenarioSidequestIndex, site.Version, site.VersionPostfix, site.Locale, lang, false)), WebsiteGenerator.ScenarioProcessGroupsToHtml(site.ScenarioGroupsSidequests, ScenarioType.Sidequests, site.Version, site.VersionPostfix, site.Locale, lang, site.InGameIdDict, site.IconsWithItems), Encoding.UTF8);
            System.IO.File.WriteAllText(Path.Combine(dir, WebsiteGenerator.GetUrl(WebsiteSection.ScenarioMapIndex, site.Version, site.VersionPostfix, site.Locale, lang, false)), WebsiteGenerator.ScenarioProcessGroupsToHtml(site.ScenarioGroupsMaps, ScenarioType.Maps, site.Version, site.VersionPostfix, site.Locale, lang, site.InGameIdDict, site.IconsWithItems), Encoding.UTF8);
        }
예제 #5
0
        public static WebsiteGenerator LoadWebsiteGenerator(string gameDataPath, GameVersion version, string versionPostfix, GameLocale locale, WebsiteLanguage websiteLanguage, Util.Endianness endian, Util.GameTextEncoding encoding, Util.Bitness bits)
        {
            WebsiteGenerator site = new WebsiteGenerator();

            site.Locale         = locale;
            site.Version        = version;
            site.VersionPostfix = versionPostfix;
            site.Language       = websiteLanguage;

            site.Items           = new ItemDat.ItemDat(TryGetItemDat(gameDataPath, site.Locale, site.Version), Util.Endianness.BigEndian);
            site.StringDic       = new TSS.TSSFile(TryGetStringDic(gameDataPath, site.Locale, site.Version), encoding, endian);
            site.Artes           = new T8BTMA.T8BTMA(TryGetArtes(gameDataPath, site.Locale, site.Version), endian, bits);
            site.Skills          = new T8BTSK.T8BTSK(TryGetSkills(gameDataPath, site.Locale, site.Version), endian, bits);
            site.Enemies         = new T8BTEMST.T8BTEMST(TryGetEnemies(gameDataPath, site.Locale, site.Version), endian, bits);
            site.EnemyGroups     = new T8BTEMGP.T8BTEMGP(TryGetEnemyGroups(gameDataPath, site.Locale, site.Version), endian, bits);
            site.EncounterGroups = new T8BTEMEG.T8BTEMEG(TryGetEncounterGroups(gameDataPath, site.Locale, site.Version), endian, bits);
            site.Recipes         = new COOKDAT.COOKDAT(TryGetRecipes(gameDataPath, site.Locale, site.Version), endian);
            site.Locations       = new WRLDDAT.WRLDDAT(TryGetLocations(gameDataPath, site.Locale, site.Version), endian);
            site.Synopsis        = new SYNPDAT.SYNPDAT(TryGetSynopsis(gameDataPath, site.Locale, site.Version), endian);
            site.Titles          = new FAMEDAT.FAMEDAT(TryGetTitles(gameDataPath, site.Locale, site.Version), endian);
            site.GradeShop       = new T8BTGR.T8BTGR(TryGetGradeShop(gameDataPath, site.Locale, site.Version), endian, bits);
            site.BattleBook      = new BTLBDAT.BTLBDAT(TryGetBattleBook(gameDataPath, site.Locale, site.Version), endian);
            site.Strategy        = new T8BTTA.T8BTTA(TryGetStrategy(gameDataPath, site.Locale, site.Version), endian, bits);
            if (site.Version != GameVersion.PC)                 // TODO
            {
                site.BattleVoicesEnd = new T8BTVA.T8BTVA(TryGetBattleVoicesEnd(gameDataPath, site.Locale, site.Version), endian);
            }
            if (!site.Version.Is360())                 // 360 version stores search points differently, haven't decoded that
            //var txm = new Texture.TXM( gameDataPath + "UI.svo.ext/WORLDNAVI.TXM" );
            //var txv = new Texture.TXV( txm, gameDataPath + "UI.svo.ext/WORLDNAVI.TXV" );
            //var tex = txv.textures.Where( x => x.TXM.Name == "U_WORLDNAVI00" ).First();
            //site.WorldMapImage = tex.GetBitmaps().First();
            {
                site.WorldMapImage = IntegerScaled(new Bitmap(gameDataPath + "UI.svo.ext/WORLDNAVI.TXM.ext/U_WORLDNAVI00.png"), 5, 4);
                site.SearchPoints  = new TOVSEAF.TOVSEAF(TryGetSearchPoints(gameDataPath, site.Locale, site.Version), endian);
            }
            site.Skits    = new TO8CHLI.TO8CHLI(TryGetSkitMetadata(gameDataPath, site.Locale, site.Version), endian, bits);
            site.SkitText = new Dictionary <string, TO8CHTX.ChatFile>();
            ISet <string> forceShiftJisSkits = version == GameVersion.X360_EU && (locale == GameLocale.UK || locale == GameLocale.US) ?
                                               new HashSet <string> {
                "VC051", "VC052", "VC053", "VC054", "VC055", "VC056", "VC057", "VC084", "VC719", "VC954"
            } : new HashSet <string>();

            for (int i = 0; i < site.Skits.SkitInfoList.Count; ++i)
            {
                string name   = site.Skits.SkitInfoList[i].RefString;
                Stream stream = TryGetSkitText(gameDataPath, name, site.Locale, site.Version);
                if (stream != null)
                {
                    bool             forceShiftJis = forceShiftJisSkits.Contains(name);
                    TO8CHTX.ChatFile chatFile      = new TO8CHTX.ChatFile(stream, endian, forceShiftJis ? Util.GameTextEncoding.ShiftJIS : encoding, bits, version == GameVersion.PC ? 11 : 2);
                    site.SkitText.Add(name, chatFile);
                }
                else
                {
                    Console.WriteLine("Couldn't find chat file " + name + "! (" + version + ", " + locale + ")");
                }
            }

            site.Records  = WebsiteGenerator.GenerateRecordsStringDicList(site.Version);
            site.Settings = WebsiteGenerator.GenerateSettingsStringDicList(site.Version);

            site.ScenarioFiles = new Dictionary <string, ScenarioFile.ScenarioFile>();

            switch (version)
            {
            case GameVersion.X360_US:
                site.Shops = new ShopData.ShopData(TryGetScenarioFile(gameDataPath, 0, site.Locale, site.Version), 0x1A718, 0x420 / 32, 0x8F8, 0x13780 / 56, endian, bits);
                break;

            case GameVersion.X360_EU:
                site.Shops = new ShopData.ShopData(TryGetScenarioFile(gameDataPath, 0, site.Locale, site.Version), 0x1A780, 0x420 / 32, 0x8F8, 0x13780 / 56, endian, bits);
                break;

            case GameVersion.PS3:
            case GameVersion.PC:
                site.Shops = new ShopData.ShopData(TryGetScenarioFile(gameDataPath, 0, site.Locale, site.Version), 0x1C9BC, 0x460 / 32, 0x980, 0x14CB8 / 56, endian, bits);
                break;

            default:
                throw new Exception("Don't know shop data location for version " + version);
            }

            if (version.HasPS3Content())
            {
                site.IconsWithItems = new uint[] { 35, 36, 37, 60, 38, 1, 4, 12, 6, 5, 13, 14, 15, 7, 52, 51, 53, 9, 16, 18, 2, 17, 19, 10, 54, 20, 21, 22, 23, 24, 25, 26, 27, 56, 30, 28, 32, 31, 33, 29, 34, 41, 42, 43, 44, 45, 57, 61, 63, 39, 3, 40 };
            }
            else
            {
                site.IconsWithItems = new uint[] { 35, 36, 37, 60, 38, 1, 4, 12, 6, 5, 13, 14, 15, 7, 52, 51, 9, 16, 18, 2, 17, 19, 10, 20, 21, 22, 23, 24, 25, 26, 27, 56, 30, 28, 32, 31, 33, 29, 34, 41, 42, 43, 44, 45, 57, 61, 63, 39, 3, 40 };
            }

            site.BattleTextFiles = WebsiteGenerator.LoadBattleText(gameDataPath, site.Locale, site.Version, endian, encoding, bits);

            if (version.HasPS3Content())
            {
                site.NecropolisFloors    = new T8BTXTM.T8BTXTMA(TryGetNecropolisFloors(gameDataPath, site.Locale, site.Version), endian, bits);
                site.NecropolisTreasures = new T8BTXTM.T8BTXTMT(TryGetNecropolisTreasures(gameDataPath, site.Locale, site.Version), endian, bits);
                site.NecropolisMaps      = new SortedDictionary <string, T8BTXTM.T8BTXTMM>();
                foreach (T8BTXTM.FloorInfo floor in site.NecropolisFloors.FloorList)
                {
                    if (!site.NecropolisMaps.ContainsKey(floor.RefString2))
                    {
                        site.NecropolisMaps.Add(floor.RefString2, new T8BTXTM.T8BTXTMM(TryGetNecropolisMap(gameDataPath, floor.RefString2, site.Locale, site.Version), endian));
                    }
                }
            }

            if (version == GameVersion.PS3)
            {
                site.TrophyJp = HyoutaTools.Trophy.TrophyConfNode.ReadTropSfmWithTropConf(gameDataPath + @"TROPHY.TRP.ext\TROP.SFM", gameDataPath + @"TROPHY.TRP.ext\TROPCONF.SFM");
            }

            if (version.HasPS3Content())
            {
                site.NpcList = new TOVNPC.TOVNPCL(gameDataPath + @"npc.svo.ext\NPC.DAT.dec.ext\0000.dec", endian, bits);
                site.NpcDefs = new Dictionary <string, TOVNPC.TOVNPCT>();
                foreach (var f in site.NpcList.NpcFileList)
                {
                    string filename = gameDataPath + @"npc.svo.ext\" + f.Filename + @".dec.ext\0001.dec";
                    if (File.Exists(filename))
                    {
                        var d = new TOVNPC.TOVNPCT(filename, endian, bits);
                        site.NpcDefs.Add(f.Map, d);
                    }
                }
            }

            var maplist = new MapList.MapList(TryGetMaplist(gameDataPath, site.Locale, site.Version), endian, bits);

            site.ScenarioGroupsStory      = site.CreateScenarioIndexGroups(ScenarioType.Story, maplist, gameDataPath, encoding, endian, bits);
            site.ScenarioGroupsSidequests = site.CreateScenarioIndexGroups(ScenarioType.Sidequests, maplist, gameDataPath, encoding, endian, bits);
            site.ScenarioGroupsMaps       = site.CreateScenarioIndexGroups(ScenarioType.Maps, maplist, gameDataPath, encoding, endian, bits);
            site.ScenarioAddSkits(site.ScenarioGroupsStory);

            return(site);
        }
예제 #6
0
        public static void Generate(List <GenerateWebsiteInputOutputData> gens)
        {
            foreach (var g in gens)
            {
                WebsiteGenerator site = LoadWebsiteGenerator(g.GameDataPath, g.Version, g.VersionPostfix, g.Locale, g.Language, g.Endian, g.Encoding, g.Bits);

                if (g.GamePatchPath != null)
                {
                    // patch original PS3 data with fantranslation
                    {
                        // STRING_DIC
                        var stringDicTranslated = new TSS.TSSFile(TryGetStringDic(g.GamePatchPath, g.Locale, g.Version), g.Encoding, g.Endian);
                        Util.Assert(site.StringDic.Entries.Length == stringDicTranslated.Entries.Length);
                        for (int i = 0; i < site.StringDic.Entries.Length; ++i)
                        {
                            Util.Assert(site.StringDic.Entries[i].inGameStringId == stringDicTranslated.Entries[i].inGameStringId);
                            site.StringDic.Entries[i].StringEng = stringDicTranslated.Entries[i].StringJpn;
                        }
                    }
                    foreach (var kvp in site.ScenarioFiles)
                    {
                        // scenario.dat
                        if (kvp.Value.EntryList.Count > 0 && kvp.Value.Metadata.ScenarioDatIndex >= 0)
                        {
                            Stream streamMod = TryGetScenarioFile(g.GamePatchPath, kvp.Value.Metadata.ScenarioDatIndex, g.Locale, g.Version);
                            if (streamMod != null)
                            {
                                var scenarioMod = new ScenarioFile.ScenarioFile(streamMod, g.Encoding, g.Endian, g.Bits);
                                Util.Assert(kvp.Value.EntryList.Count == scenarioMod.EntryList.Count);
                                for (int i = 0; i < kvp.Value.EntryList.Count; ++i)
                                {
                                    kvp.Value.EntryList[i].EnName = scenarioMod.EntryList[i].JpName;
                                    kvp.Value.EntryList[i].EnText = scenarioMod.EntryList[i].JpText;
                                }
                            }
                        }
                    }
                    foreach (var kvp in site.BattleTextFiles)
                    {
                        // btl.svo/BATTLE_PACK
                        if (kvp.Value.EntryList.Count > 0)
                        {
                            var scenarioMod = WebsiteGenerator.LoadBattleTextFile(g.GamePatchPath, kvp.Key, g.Locale, g.Version, g.Endian, g.Encoding, g.Bits);
                            Util.Assert(kvp.Value.EntryList.Count == scenarioMod.EntryList.Count);
                            for (int i = 0; i < kvp.Value.EntryList.Count; ++i)
                            {
                                kvp.Value.EntryList[i].EnName = scenarioMod.EntryList[i].JpName;
                                kvp.Value.EntryList[i].EnText = scenarioMod.EntryList[i].JpText;
                            }
                        }
                    }
                    foreach (var kvp in site.SkitText)
                    {
                        // chat.svo
                        var    chatFile    = kvp.Value;
                        Stream streamMod   = TryGetSkitText(g.GamePatchPath, kvp.Key, g.Locale, g.Version);
                        var    chatFileMod = new TO8CHTX.ChatFile(streamMod, g.Endian, g.Encoding, g.Bits, 2);
                        Util.Assert(chatFile.Lines.Length == chatFileMod.Lines.Length);
                        for (int j = 0; j < chatFile.Lines.Length; ++j)
                        {
                            chatFile.Lines[j].SENG = chatFileMod.Lines[j].SJPN;
                            chatFile.Lines[j].SNameEnglishNotUsedByGame = chatFileMod.Lines[j].SName;
                        }
                    }
                    site.TrophyEn = HyoutaTools.Trophy.TrophyConfNode.ReadTropSfmWithTropConf(g.GamePatchPath + @"TROPHY.TRP.ext\TROP.SFM", g.GamePatchPath + @"TROPHY.TRP.ext\TROPCONF.SFM");
                }

                site.InGameIdDict = site.StringDic.GenerateInGameIdDictionary();

                if (g.ImportJpInGameDictLocale != null)
                {
                    // copy over Japanese stuff into StringDic from other locale
                    var StringDicUs = new TSS.TSSFile(TryGetStringDic(g.GameDataPath, g.ImportJpInGameDictLocale.Value, g.Version), g.Encoding, g.Endian);
                    var IdDictUs    = StringDicUs.GenerateInGameIdDictionary();
                    foreach (var kvp in IdDictUs)
                    {
                        site.InGameIdDict[kvp.Key].StringJpn = kvp.Value.StringJpn;
                    }
                }

                ExportToWebsite(site, WebsiteLanguage.BothWithEnLinks, g.WebsiteOutputPath, g.CompareSite?.Generator);

                g.Generator = site;
            }
        }