namespace PKHeX.Core { /// /// Utility class for logic. /// public static class GameUtil { /// Determines the Version Grouping of an input Version ID /// Version of which to determine the group /// Version Group Identifier or Invalid if type cannot be determined. public static GameVersion GetMetLocationVersionGroup(GameVersion Version) { switch (Version) { case GameVersion.CXD: return GameVersion.CXD; case GameVersion.GO: return GameVersion.GO; case GameVersion.RBY: case GameVersion.RD: case GameVersion.BU: case GameVersion.YW: case GameVersion.GN: return GameVersion.RBY; case GameVersion.GS: case GameVersion.GD: case GameVersion.SV: case GameVersion.C: return GameVersion.GSC; case GameVersion.R: case GameVersion.S: return GameVersion.RS; case GameVersion.E: return GameVersion.E; case GameVersion.FR: case GameVersion.LG: return GameVersion.FR; case GameVersion.D: case GameVersion.P: return GameVersion.DP; case GameVersion.Pt: return GameVersion.Pt; case GameVersion.HG: case GameVersion.SS: return GameVersion.HGSS; case GameVersion.B: case GameVersion.W: return GameVersion.BW; case GameVersion.B2: case GameVersion.W2: return GameVersion.B2W2; case GameVersion.X: case GameVersion.Y: return GameVersion.XY; case GameVersion.OR: case GameVersion.AS: return GameVersion.ORAS; case GameVersion.SN: case GameVersion.MN: return GameVersion.SM; case GameVersion.US: case GameVersion.UM: return GameVersion.USUM; default: return GameVersion.Invalid; } } /// /// Gets a Version ID from the end of that Generation /// /// Generation ID /// Version ID from requested generation. If none, return Unknown. public static GameVersion GetVersion(int generation) { switch (generation) { case 1: return GameVersion.RBY; case 2: return GameVersion.C; case 3: return GameVersion.E; case 4: return GameVersion.SS; case 5: return GameVersion.W2; case 6: return GameVersion.AS; case 7: return GameVersion.UM; default: return GameVersion.Unknown; } } public static int GetGeneration(GameVersion game) { game = GetMetLocationVersionGroup(game); // get group switch (game) { default: return -1; case GameVersion.RBY: return 1; case GameVersion.GSC: return 2; case GameVersion.CXD: case GameVersion.RS: case GameVersion.E: case GameVersion.FR: case GameVersion.LG: return 3; case GameVersion.DP: case GameVersion.Pt: case GameVersion.HGSS: return 4; case GameVersion.BW: case GameVersion.B2W2: return 5; case GameVersion.XY: case GameVersion.ORAS: return 6; case GameVersion.SM: case GameVersion.USUM: return 7; } } } }