Example #1
0
        public FilteredGameDataSource(SaveFile sav, GameDataSource source, bool HaX = false)
        {
            Source  = source;
            Species = GetFilteredSpecies(sav, source, HaX).ToList();
            Moves   = GetFilteredMoves(sav, source, HaX).ToList();
            if (sav.Generation > 1)
            {
                var items = Source.GetItemDataSource(sav.Version, sav.Generation, sav.HeldItems, HaX);
                items.RemoveAll(i => i.Value > sav.MaxItemID);
                Items = items;
            }
            else
            {
                Items = Array.Empty <ComboItem>();
            }

            var gamelist = GameUtil.GetVersionsWithinRange(sav, sav.Generation).ToList();

            Games = Source.VersionDataSource.Where(g => gamelist.Contains((GameVersion)g.Value)).ToList();

            Languages = GameDataSource.LanguageDataSource(sav.Generation);
            Balls     = Source.BallDataSource.Where(b => b.Value <= sav.MaxBallID).ToList();
            Abilities = Source.AbilityDataSource.Where(a => a.Value <= sav.MaxAbilityID).ToList();

            G4GroundTiles = Source.GroundTileDataSource;
            Natures       = Source.NatureDataSource;
        }
        public FilteredGameDataSource(SaveFile sav, GameDataSource source, bool HaX = false)
        {
            Source = source;
            if (sav.Generation > 1)
            {
                var items = Source.GetItemDataSource(sav.Version, sav.Generation, sav.MaxItemID, sav.HeldItems, HaX);
                Items = items.Where(i => i.Value <= sav.MaxItemID).ToList();
            }
            else
            {
                Items = Array.Empty <ComboItem>();
            }

            var gamelist = GameUtil.GetVersionsWithinRange(sav, sav.Generation).ToList();

            Games = Source.VersionDataSource.Where(g => gamelist.Contains((GameVersion)g.Value)).ToList();

            Languages = GameDataSource.LanguageDataSource(sav.Generation);
            Balls     = Source.BallDataSource.Where(b => b.Value <= sav.MaxBallID).ToList();
            Species   = Source.SpeciesDataSource.Where(s => s.Value <= sav.MaxSpeciesID).ToList();
            Abilities = Source.AbilityDataSource.Where(a => a.Value <= sav.MaxAbilityID).ToList();

            var moves = HaX ? Source.HaXMoveDataSource : Source.LegalMoveDataSource; // Filter Z-Moves if appropriate

            Moves            = moves.Where(m => m.Value <= sav.MaxMoveID).ToList();
            G4EncounterTypes = Source.EncounterTypeDataSource;
            Natures          = Source.NatureDataSource;
        }