PKHeX/PKHeX.Core/Game/GameStrings/LocationSet/LocationSet6.cs
Kurt 03182ebd3d Update 22.11.24
Adds support for Scarlet & Violet.

Co-Authored-By: SciresM <8676005+SciresM@users.noreply.github.com>
Co-Authored-By: Matt <17801814+sora10pls@users.noreply.github.com>
Co-Authored-By: Lusamine <30205550+Lusamine@users.noreply.github.com>
2022-11-24 17:42:17 -08:00

40 lines
1.0 KiB
C#

using System;
using System.Collections.Generic;
namespace PKHeX.Core;
public sealed record LocationSet6(string[] Met0, string[] Met3, string[] Met4, string[] Met6) : ILocationSet
{
public ReadOnlySpan<string> GetLocationNames(int bankID) => bankID switch
{
0 => Met0,
3 => Met3,
4 => Met4,
6 => Met6,
_ => Array.Empty<string>(),
};
public string GetLocationName(int locationID) => locationID switch
{
>= 60000 => Get(Met6, locationID - 60000),
>= 40000 => Get(Met4, locationID - 40000),
>= 30000 => Get(Met3, locationID - 30000),
_ => Get(Met0, locationID),
};
private static string Get(string[] names, int index)
{
if ((uint)index >= names.Length)
return string.Empty;
return names[index];
}
public IEnumerable<(int Bank, string[] Names)> GetAll()
{
yield return (0, Met0);
yield return (3, Met3);
yield return (4, Met4);
yield return (6, Met6);
}
}