コード例 #1
0
        private string GetText(GameStrings?strings = null)
        {
            if (Species <= 0 || Species > MAX_SPECIES)
            {
                return(string.Empty);
            }

            if (strings != null)
            {
                Strings = strings;
            }

            var result = GetSetLines();

            return(string.Join(Environment.NewLine, result));
        }
コード例 #2
0
        private static IEnumerable <string> GetHeader(PKM pkm, GameStrings s)
        {
            string filename = pkm.Nickname;

            if ((uint)pkm.Species < s.Species.Count)
            {
                var name = s.Species[pkm.Species];
                if (pkm.Nickname != name)
                {
                    filename += $" ({name})";
                }
            }
            yield return(filename);

            if (pkm.Format >= 3 && (uint)pkm.Ability < s.Ability.Count)
            {
                yield return($"[{s.Ability[pkm.Ability]}]");
            }

            var level = pkm.Stat_Level;

            if (level == 0)
            {
                level = pkm.CurrentLevel;
            }
            yield return($"lv{level}");

            if (pkm.HeldItem > 0)
            {
                var items = s.GetItemStrings(pkm.Format);
                if ((uint)pkm.HeldItem < items.Count)
                {
                    yield return($" @ {items[pkm.HeldItem]}");
                }
            }

            if (pkm.Format >= 3 && (uint)pkm.Nature < s.Natures.Count)
            {
                yield return(s.natures[pkm.Nature]);
            }
        }
コード例 #3
0
        public GameDataSource(GameStrings s)
        {
            Strings                 = s;
            BallDataSource          = Util.GetVariedCBListBall(s.itemlist, ball_nums, ball_vals);
            SpeciesDataSource       = Util.GetCBList(s.specieslist);
            NatureDataSource        = Util.GetCBList(s.natures);
            AbilityDataSource       = Util.GetCBList(s.abilitylist);
            EncounterTypeDataSource = Util.GetUnsortedCBList(s.encountertypelist, Gen4EncounterTypes);

            var moves = Util.GetCBList(s.movelist);

            HaXMoveDataSource = moves;
            var legal = new List <ComboItem>(moves);

            legal.RemoveAll(m => Legal.Z_Moves.Contains(m.Value));
            LegalMoveDataSource = legal;

            VersionDataSource = GetVersionList(s);

            Met = new MetDataSource(s);

            Empty = new ComboItem(s.Species[0], 0);
        }
コード例 #4
0
ファイル: GameInfo.cs プロジェクト: shimakiui/PKHeX
        public static GameStrings GetStrings(string lang)
        {
            int index = GetLanguageIndex(lang);

            return(Languages[index] ?? (Languages[index] = new GameStrings(lang_val[index])));
        }
コード例 #5
0
ファイル: GameInfo.cs プロジェクト: kang1806/PKHeX
 public static IReadOnlyList <ComboItem> LanguageDataSource(int gen) => GameStrings.LanguageDataSource(gen);
コード例 #6
0
ファイル: GameInfo.cs プロジェクト: kang1806/PKHeX
 public static GameStrings GetStrings(int index)
 {
     return(Languages[index] ?? (Languages[index] = new GameStrings(lang_val[index])));
 }
コード例 #7
0
ファイル: GameInfo.cs プロジェクト: pianistrevor/PKHeX
 public static void SetItemDataSource(bool HaX, int MaxItemID, IEnumerable <ushort> allowed, int generation, GameVersion game, GameStrings s)
 {
     string[] items = s.GetItemStrings(generation, game);
     ItemDataSource = Util.GetCBList(items, (allowed == null || HaX ? Enumerable.Range(0, MaxItemID) : allowed.Select(i => (int)i)).ToArray());
 }
コード例 #8
0
ファイル: GameInfo.cs プロジェクト: pianistrevor/PKHeX
        public static void InitializeDataSources(GameStrings s)
        {
            int[] ball_nums = { 007, 576, 013, 492, 497, 014, 495, 493, 496, 494, 011, 498, 008, 006, 012, 015, 009, 005, 499, 010, 001, 016, 851 };
            int[] ball_vals = { 007, 025, 013, 017, 022, 014, 020, 018, 021, 019, 011, 023, 008, 006, 012, 015, 009, 005, 024, 010, 001, 016, 026 };
            BallDataSource    = Util.GetVariedCBList(s.itemlist, ball_nums, ball_vals);
            SpeciesDataSource = Util.GetCBList(s.specieslist, null);
            NatureDataSource  = Util.GetCBList(s.natures, null);
            AbilityDataSource = Util.GetCBList(s.abilitylist, null);
            VersionDataSource = Util.GetCBList(s.gamelist, Legal.Games_7sm, Legal.Games_6oras, Legal.Games_6xy, Legal.Games_5, Legal.Games_4, Legal.Games_4e, Legal.Games_4r, Legal.Games_3, Legal.Games_3e, Legal.Games_3r, Legal.Games_3s);
            VersionDataSource.AddRange(Util.GetCBList(s.gamelist, Legal.Games_7vc1).OrderBy(g => g.Value)); // stuff to end unsorted
            VersionDataSource.AddRange(Util.GetCBList(s.gamelist, Legal.Games_7go).OrderBy(g => g.Value));  // stuff to end unsorted

            HaXMoveDataSource = Util.GetCBList(s.movelist, null);
            MoveDataSource    = LegalMoveDataSource = HaXMoveDataSource.Where(m => !Legal.Z_Moves.Contains(m.Value)).ToList();
            #region Met Locations
            // Gen 2
            {
                var met_list = Util.GetCBList(s.metGSC_00000, Enumerable.Range(0, 0x5F).ToArray());
                met_list = Util.GetOffsetCBList(met_list, s.metGSC_00000, 00000, new[] { 0x7E, 0x7F });
                MetGen2  = met_list;
            }
            // Gen 3
            {
                var met_list = Util.GetCBList(s.metRSEFRLG_00000, Enumerable.Range(0, 213).ToArray());
                met_list = Util.GetOffsetCBList(met_list, s.metRSEFRLG_00000, 00000, new[] { 253, 254, 255 });
                MetGen3  = met_list;

                var cxd_list = Util.GetCBList(s.metCXD_00000, Enumerable.Range(0, s.metCXD_00000.Length).ToArray()).Where(c => c.Text.Length > 0).ToList();
                MetGen3CXD = cxd_list;
            }
            // Gen 4
            {
                var met_list = Util.GetCBList(s.metHGSS_00000, new[] { 0 });
                met_list = Util.GetOffsetCBList(met_list, s.metHGSS_02000, 2000, new[] { 2000 });
                met_list = Util.GetOffsetCBList(met_list, s.metHGSS_02000, 2000, new[] { 2002 });
                met_list = Util.GetOffsetCBList(met_list, s.metHGSS_03000, 3000, new[] { 3001 });
                met_list = Util.GetOffsetCBList(met_list, s.metHGSS_00000, 0000, Legal.Met_HGSS_0);
                met_list = Util.GetOffsetCBList(met_list, s.metHGSS_02000, 2000, Legal.Met_HGSS_2);
                met_list = Util.GetOffsetCBList(met_list, s.metHGSS_03000, 3000, Legal.Met_HGSS_3);
                MetGen4  = met_list;
            }
            // Gen 5
            {
                var met_list = Util.GetCBList(s.metBW2_00000, new[] { 0 });
                met_list = Util.GetOffsetCBList(met_list, s.metBW2_60000, 60001, new[] { 60002 });
                met_list = Util.GetOffsetCBList(met_list, s.metBW2_30000, 30001, new[] { 30003 });
                met_list = Util.GetOffsetCBList(met_list, s.metBW2_00000, 00000, Legal.Met_BW2_0);
                met_list = Util.GetOffsetCBList(met_list, s.metBW2_30000, 30001, Legal.Met_BW2_3);
                met_list = Util.GetOffsetCBList(met_list, s.metBW2_40000, 40001, Legal.Met_BW2_4);
                met_list = Util.GetOffsetCBList(met_list, s.metBW2_60000, 60001, Legal.Met_BW2_6);
                MetGen5  = met_list;
            }
            // Gen 6
            {
                var met_list = Util.GetCBList(s.metXY_00000, new[] { 0 });
                met_list = Util.GetOffsetCBList(met_list, s.metXY_60000, 60001, new[] { 60002 });
                met_list = Util.GetOffsetCBList(met_list, s.metXY_30000, 30001, new[] { 30002 });
                met_list = Util.GetOffsetCBList(met_list, s.metXY_00000, 00000, Legal.Met_XY_0);
                met_list = Util.GetOffsetCBList(met_list, s.metXY_30000, 30001, Legal.Met_XY_3);
                met_list = Util.GetOffsetCBList(met_list, s.metXY_40000, 40001, Legal.Met_XY_4);
                met_list = Util.GetOffsetCBList(met_list, s.metXY_60000, 60001, Legal.Met_XY_6);
                MetGen6  = met_list;
            }
            // Gen 7
            {
                var met_list = Util.GetCBList(s.metSM_00000, new[] { 0 });
                met_list = Util.GetOffsetCBList(met_list, s.metSM_60000, 60001, new[] { 60002 });
                met_list = Util.GetOffsetCBList(met_list, s.metSM_30000, 30001, new[] { 30002 });
                met_list = Util.GetOffsetCBList(met_list, s.metSM_00000, 00000, Legal.Met_SM_0);
                met_list = Util.GetOffsetCBList(met_list, s.metSM_30000, 30001, Legal.Met_SM_3);
                met_list = Util.GetOffsetCBList(met_list, s.metSM_40000, 40001, Legal.Met_SM_4);
                met_list = Util.GetOffsetCBList(met_list, s.metSM_60000, 60001, Legal.Met_SM_6);
                MetGen7  = met_list;
            }
            #endregion
        }
コード例 #9
0
 private static List <ComboItem> CreateGen3CXD(GameStrings s)
 {
     return(Util.GetCBList(s.metCXD_00000, Enumerable.Range(0, s.metCXD_00000.Length).ToArray()).Where(c => c.Text.Length > 0).ToList());
 }
コード例 #10
0
 private static GameStrings getIndex(int index)
 {
     return(Languages[index] ?? (Languages[index] = new GameStrings(lang_val[index])));
 }
コード例 #11
0
 public static GameStrings GetStrings(int index)
 {
     return(Languages[index] ?? (Languages[index] = new GameStrings(GameLanguage.Language2Char(index))));
 }