Example #1
0
        /// <summary>
        /// Fetches a Met Location list for a <see cref="version"/> that has been transferred away from and overwritten.
        /// </summary>
        /// <param name="version">Origin version</param>
        /// <param name="currentGen">Current savefile generation</param>
        /// <param name="egg">True if an egg location list, false if a regular met location list</param>
        /// <returns>Met location list</returns>
        public IReadOnlyList <ComboItem> GetLocationList(GameVersion version, int currentGen, bool egg = false)
        {
            if (currentGen == 2)
            {
                return(MetGen2);
            }

            if (egg && version < GameVersion.W && currentGen >= 5)
            {
                return(MetGen4);
            }

            switch (version)
            {
            case GameVersion.CXD:
                if (currentGen == 3)
                {
                    return(MetGen3CXD);
                }
                break;

            case GameVersion.R:
            case GameVersion.S:
                if (currentGen == 3)
                {
                    return(MetGen3.OrderByDescending(loc => loc.Value <= 87).ToList());    // Ferry
                }
                break;

            case GameVersion.E:
                if (currentGen == 3)
                {
                    return(MetGen3.OrderByDescending(loc => loc.Value <= 87 || (loc.Value >= 196 && loc.Value <= 212)).ToList());    // Trainer Hill
                }
                break;

            case GameVersion.FR:
            case GameVersion.LG:
                if (currentGen == 3)
                {
                    return(MetGen3.OrderByDescending(loc => loc.Value > 87 && loc.Value < 197).ToList());    // Celadon Dept.
                }
                break;

            case GameVersion.D:
            case GameVersion.P:
                if (currentGen == 4 || (currentGen >= 5 && egg))
                {
                    return(MetGen4.Take(4).Concat(MetGen4.Skip(4).OrderByDescending(loc => loc.Value <= 111)).ToList());    // Battle Park
                }
                break;

            case GameVersion.Pt:
                if (currentGen == 4 || (currentGen >= 5 && egg))
                {
                    return(MetGen4.Take(4).Concat(MetGen4.Skip(4).OrderByDescending(loc => loc.Value <= 125)).ToList());    // Rock Peak Ruins
                }
                break;

            case GameVersion.HG:
            case GameVersion.SS:
                if (currentGen == 4 || (currentGen >= 5 && egg))
                {
                    return(MetGen4.Take(4).Concat(MetGen4.Skip(4).OrderByDescending(loc => loc.Value > 125 && loc.Value < 234)).ToList());    // Celadon Dept.
                }
                break;

            case GameVersion.B:
            case GameVersion.W:
                return(MetGen5);

            case GameVersion.B2:
            case GameVersion.W2:
                return(MetGen5.Take(3).Concat(MetGen5.Skip(3).OrderByDescending(loc => loc.Value <= 116)).ToList());    // Abyssal Ruins

            case GameVersion.X:
            case GameVersion.Y:
                return(MetGen6.Take(3).Concat(MetGen6.Skip(3).OrderByDescending(loc => loc.Value <= 168)).ToList());    // Unknown Dungeon

            case GameVersion.OR:
            case GameVersion.AS:
                return(MetGen6.Take(3).Concat(MetGen6.Skip(3).OrderByDescending(loc => loc.Value > 168 && loc.Value <= 354)).ToList());    // Secret Base

            case GameVersion.SN:
            case GameVersion.MN:
                return(MetGen7.Take(3).Concat(MetGen7.Skip(3).OrderByDescending(loc => loc.Value < 200)).ToList());    // Outer Cape

            case GameVersion.US:
            case GameVersion.UM:

            case GameVersion.RD:
            case GameVersion.BU:
            case GameVersion.GN:
            case GameVersion.YW:

            case GameVersion.GD:
            case GameVersion.SV:
            case GameVersion.C:
                return(MetGen7.Take(3).Concat(MetGen7.Skip(3).OrderByDescending(loc => loc.Value < 234)).ToList());    // Dividing Peak Tunnel

            case GameVersion.GP:
            case GameVersion.GE:
            case GameVersion.GO:
                return(MetGen7GG.Take(3).Concat(MetGen7GG.Skip(3).OrderByDescending(loc => loc.Value <= 54)).ToList());    // Pokémon League
            }

            return(GetLocationListModified(version, currentGen));
        }
Example #2
0
        public IReadOnlyList <ComboItem> GetLocationList(GameVersion Version, int SaveFormat, bool egg)
        {
            if (SaveFormat == 2)
            {
                return(MetGen2);
            }

            if (egg && Version < GameVersion.W && SaveFormat >= 5)
            {
                return(MetGen4);
            }

            switch (Version)
            {
            case GameVersion.CXD:
                if (SaveFormat == 3)
                {
                    return(MetGen3CXD);
                }
                break;

            case GameVersion.R:
            case GameVersion.S:
                if (SaveFormat == 3)
                {
                    return(MetGen3.OrderByDescending(loc => loc.Value <= 87).ToList());    // Ferry
                }
                break;

            case GameVersion.E:
                if (SaveFormat == 3)
                {
                    return(MetGen3.OrderByDescending(loc => loc.Value <= 87 || (loc.Value >= 196 && loc.Value <= 212)).ToList());    // Trainer Hill
                }
                break;

            case GameVersion.FR:
            case GameVersion.LG:
                if (SaveFormat == 3)
                {
                    return(MetGen3.OrderByDescending(loc => loc.Value > 87 && loc.Value < 197).ToList());    // Celadon Dept.
                }
                break;

            case GameVersion.D:
            case GameVersion.P:
                if (SaveFormat == 4 || (SaveFormat >= 5 && egg))
                {
                    return(MetGen4.Take(4).Concat(MetGen4.Skip(4).OrderByDescending(loc => loc.Value <= 111)).ToList());    // Battle Park
                }
                break;

            case GameVersion.Pt:
                if (SaveFormat == 4 || (SaveFormat >= 5 && egg))
                {
                    return(MetGen4.Take(4).Concat(MetGen4.Skip(4).OrderByDescending(loc => loc.Value <= 125)).ToList());    // Rock Peak Ruins
                }
                break;

            case GameVersion.HG:
            case GameVersion.SS:
                if (SaveFormat == 4 || (SaveFormat >= 5 && egg))
                {
                    return(MetGen4.Take(4).Concat(MetGen4.Skip(4).OrderByDescending(loc => loc.Value > 125 && loc.Value < 234)).ToList());    // Celadon Dept.
                }
                break;

            case GameVersion.B:
            case GameVersion.W:
                return(MetGen5);

            case GameVersion.B2:
            case GameVersion.W2:
                return(MetGen5.Take(3).Concat(MetGen5.Skip(3).OrderByDescending(loc => loc.Value <= 116)).ToList());    // Abyssal Ruins

            case GameVersion.X:
            case GameVersion.Y:
                return(MetGen6.Take(3).Concat(MetGen6.Skip(3).OrderByDescending(loc => loc.Value <= 168)).ToList());    // Unknown Dungeon

            case GameVersion.OR:
            case GameVersion.AS:
                return(MetGen6.Take(3).Concat(MetGen6.Skip(3).OrderByDescending(loc => loc.Value > 168 && loc.Value <= 354)).ToList());    // Secret Base

            case GameVersion.SN:
            case GameVersion.MN:
                return(MetGen7.Take(3).Concat(MetGen7.Skip(3).OrderByDescending(loc => loc.Value < 200)).ToList());    // Outer Cape

            case GameVersion.US:
            case GameVersion.UM:

            case GameVersion.GO:
            case GameVersion.RD:
            case GameVersion.BU:
            case GameVersion.GN:
            case GameVersion.YW:

            case GameVersion.GD:
            case GameVersion.SV:
            case GameVersion.C:
                return(MetGen7.Take(3).Concat(MetGen7.Skip(3).OrderByDescending(loc => loc.Value < 234)).ToList());    // Dividing Peak Tunnel
            }

            // Currently on a future game, return corresponding list for generation
            if (Version <= GameVersion.CXD && SaveFormat == 4)
            {
                return(MetGen4.Where(loc => loc.Value == Legal.Transfer3) // Pal Park to front
                       .Concat(MetGen4.Take(4))
                       .Concat(MetGen4.Skip(4).Where(loc => loc.Value != Legal.Transfer3)).ToList());
            }

            if (Version < GameVersion.X && SaveFormat >= 5) // PokéTransfer to front
            {
                return(MetGen5.Where(loc => loc.Value == Legal.Transfer4)
                       .Concat(MetGen5.Take(3))
                       .Concat(MetGen5.Skip(3).Where(loc => loc.Value != Legal.Transfer4)).ToList());
            }

            return(MetGen6);
        }