Exemplo n.º 1
0
        /// <summary>
        /// Gets the Country string for a given Country ID
        /// </summary>
        /// <param name="country">Country ID</param>
        /// <param name="language">Language ID</param>
        /// <returns>Country ID string</returns>
        private static string getCountryString(int country, int language)
        {
            string c;

            // Get Country Text
            try
            {
                string[] inputCSV = Util.getStringList("countries");
                // Set up our Temporary Storage
                string[] unsortedList = new string[inputCSV.Length - 1];
                int[]    indexes      = new int[inputCSV.Length - 1];

                // Gather our data from the input file
                for (int i = 1; i < inputCSV.Length; i++)
                {
                    string[] countryData = inputCSV[i].Split(',');
                    if (countryData.Length <= 1)
                    {
                        continue;
                    }
                    indexes[i - 1]      = Convert.ToInt32(countryData[0]);
                    unsortedList[i - 1] = countryData[language + 1];
                }

                int countrynum = Array.IndexOf(indexes, country);
                c = unsortedList[countrynum];
            }
            catch { c = "Illegal"; }

            return(c);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets the Region string for a specified country ID.
        /// </summary>
        /// <param name="country">Country ID</param>
        /// <param name="region">Region ID</param>
        /// <param name="language">Language ID</param>
        /// <returns>Region ID string</returns>
        private static string getRegionString(int country, int region, int language)
        {
            // Get Region Text
            try
            {
                string[] inputCSV = Util.getStringList("sr_" + country.ToString("000"));
                // Set up our Temporary Storage
                string[] unsortedList = new string[inputCSV.Length - 1];
                int[]    indexes      = new int[inputCSV.Length - 1];

                // Gather our data from the input file
                for (int i = 1; i < inputCSV.Length; i++)
                {
                    string[] countryData = inputCSV[i].Split(',');
                    if (countryData.Length <= 1)
                    {
                        continue;
                    }
                    indexes[i - 1]      = Convert.ToInt32(countryData[0]);
                    unsortedList[i - 1] = countryData[language + 1];
                }

                int regionnum = Array.IndexOf(indexes, region);
                return(unsortedList[regionnum]);
            }
            catch { return("Illegal"); }
        }
Exemplo n.º 3
0
            private string[] get(string ident)
            {
                string[] data = Util.getStringList(ident, Language);
                if (data == null || data.Length == 0)
                {
                    data = Util.getStringList(ident, DefaultLanguage);
                }

                return(data);
            }
Exemplo n.º 4
0
            private string[] get(string ident)
            {
                string[] data = Util.getStringList(ident, Language);
                if (data == null || data.Length == 0)
                {
                    data = Util.getStringList(ident, DefaultLanguage);
                }

                // Use alternate (Fan Translated) species names since GameFreak decided to use non-Unicode characters which are now game-font dependent.
                // PKX still fetches nickname with the actual string
                if (ident == "species" && new[] { "zh", "zh2" }.Contains(Language))
                {
                    return(Util.getSpeciesList(Language + "_alt"));
                }

                return(data);
            }
Exemplo n.º 5
0
            public GameStrings(string l)
            {
                Language = l;
                // Past Generation strings
                g3items = get("ItemsG3");
                // XD and Colosseum
                {
                    g3coloitems = (string[])g3items.Clone();
                    string[] tmp = get("ItemsG3Colosseum");
                    Array.Resize(ref g3coloitems, 500 + tmp.Length);
                    for (int i = g3items.Length; i < g3coloitems.Length; i++)
                    {
                        g3coloitems[i] = $"UNUSED {i}";
                    }
                    Array.Copy(tmp, 0, g3coloitems, g3coloitems.Length - tmp.Length, tmp.Length);

                    g3xditems = (string[])g3items.Clone();
                    string[] tmp2 = get("ItemsG3XD");
                    Array.Resize(ref g3xditems, 500 + tmp2.Length);
                    for (int i = g3items.Length; i < g3xditems.Length; i++)
                    {
                        g3xditems[i] = $"UNUSED {i}";
                    }
                    Array.Copy(tmp2, 0, g3xditems, g3xditems.Length - tmp2.Length, tmp2.Length);
                }
                g2items          = get("ItemsG2");
                g1items          = get("ItemsG1");
                metRSEFRLG_00000 = get("rsefrlg_00000");
                metGSC_00000     = get("gsc_00000");

                metCXD_00000 = get("cxd_00000");
                // Sanitize a little
                var metSanitize = (string[])metCXD_00000.Clone();

                for (int i = 0; i < metSanitize.Length; i++)
                {
                    if (metCXD_00000.Count(r => r == metSanitize[i]) > 1)
                    {
                        metSanitize[i] += $" [{i:000}]";
                    }
                }
                metCXD_00000 = metSanitize;

                // Current Generation strings
                natures           = Util.getNaturesList(l);
                types             = get("types");
                abilitylist       = get("abilities");
                movelist          = get("moves");
                itemlist          = get("items");
                characteristics   = get("character");
                specieslist       = get("species");
                wallpapernames    = get("wallpaper");
                encountertypelist = get("encountertype");
                gamelist          = get("games");
                gamelanguages     = Util.getNulledStringArray(Util.getStringList("languages"));

                balllist = new string[Legal.Items_Ball.Length];
                for (int i = 0; i < balllist.Length; i++)
                {
                    balllist[i] = itemlist[Legal.Items_Ball[i]];
                }

                pokeblocks    = get("pokeblock");
                forms         = get("forms");
                memories      = get("memories");
                genloc        = get("genloc");
                trainingbags  = get("trainingbag");
                trainingstage = get("supertraining");
                puffs         = get("puff");

                eggname       = specieslist[0];
                metHGSS_00000 = get("hgss_00000");
                metHGSS_02000 = get("hgss_02000");
                metHGSS_03000 = get("hgss_03000");
                metBW2_00000  = get("bw2_00000");
                metBW2_30000  = get("bw2_30000");
                metBW2_40000  = get("bw2_40000");
                metBW2_60000  = get("bw2_60000");
                metXY_00000   = get("xy_00000");
                metXY_30000   = get("xy_30000");
                metXY_40000   = get("xy_40000");
                metXY_60000   = get("xy_60000");
                metSM_00000   = get("sm_00000");
                metSM_30000   = get("sm_30000");
                metSM_40000   = get("sm_40000");
                metSM_60000   = get("sm_60000");

                Sanitize();
            }