mirror of
https://github.com/kwsch/PKHeX
synced 2025-02-18 14:28:33 +00:00
Handle all deviating met location string versions
This commit is contained in:
parent
6a62075c47
commit
f358c0e4cf
3 changed files with 21 additions and 18 deletions
|
@ -78,13 +78,15 @@ namespace PKHeX.Core
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="gen">Generation to get location names for.</param>
|
/// <param name="gen">Generation to get location names for.</param>
|
||||||
/// <param name="bankID">BankID used to choose the text bank.</param>
|
/// <param name="bankID">BankID used to choose the text bank.</param>
|
||||||
|
/// <param name="version">Version of origin</param>
|
||||||
/// <returns>List of location names.</returns>
|
/// <returns>List of location names.</returns>
|
||||||
private static IReadOnlyList<string> GetLocationNames(int gen, int bankID)
|
private static IReadOnlyList<string> GetLocationNames(int gen, int bankID, GameVersion version)
|
||||||
{
|
{
|
||||||
switch (gen)
|
switch (gen)
|
||||||
{
|
{
|
||||||
case 2: return Strings.metGSC_00000;
|
case 2: return Strings.metGSC_00000;
|
||||||
case 3: return Strings.metRSEFRLG_00000;
|
case 3:
|
||||||
|
return version == GameVersion.CXD ? Strings.metCXD_00000 : Strings.metRSEFRLG_00000;
|
||||||
case 4:
|
case 4:
|
||||||
switch (bankID)
|
switch (bankID)
|
||||||
{
|
{
|
||||||
|
@ -112,6 +114,17 @@ namespace PKHeX.Core
|
||||||
default: return null;
|
default: return null;
|
||||||
}
|
}
|
||||||
case 7:
|
case 7:
|
||||||
|
if (GameVersion.GG.Contains(version))
|
||||||
|
{
|
||||||
|
switch (bankID)
|
||||||
|
{
|
||||||
|
case 0: return Strings.metGG_00000;
|
||||||
|
case 3: return Strings.metGG_30000;
|
||||||
|
case 4: return Strings.metGG_40000;
|
||||||
|
case 6: return Strings.metGG_60000;
|
||||||
|
default: return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
switch (bankID)
|
switch (bankID)
|
||||||
{
|
{
|
||||||
case 0: return Strings.metSM_00000;
|
case 0: return Strings.metSM_00000;
|
||||||
|
@ -132,8 +145,9 @@ namespace PKHeX.Core
|
||||||
/// <param name="locval">Location value</param>
|
/// <param name="locval">Location value</param>
|
||||||
/// <param name="format">Current <see cref="PKM.Format"/></param>
|
/// <param name="format">Current <see cref="PKM.Format"/></param>
|
||||||
/// <param name="generation"><see cref="PKM.GenNumber"/> of origin</param>
|
/// <param name="generation"><see cref="PKM.GenNumber"/> of origin</param>
|
||||||
|
/// <param name="version">Current GameVersion (only applicable for <see cref="GameVersion.GG"/> differentiation)</param>
|
||||||
/// <returns>Location name</returns>
|
/// <returns>Location name</returns>
|
||||||
public static string GetLocationName(bool eggmet, int locval, int format, int generation)
|
public static string GetLocationName(bool eggmet, int locval, int format, int generation, GameVersion version)
|
||||||
{
|
{
|
||||||
int gen = -1;
|
int gen = -1;
|
||||||
int bankID = 0;
|
int bankID = 0;
|
||||||
|
@ -169,7 +183,7 @@ namespace PKHeX.Core
|
||||||
locval--;
|
locval--;
|
||||||
}
|
}
|
||||||
|
|
||||||
var bank = GetLocationNames(gen, bankID);
|
var bank = GetLocationNames(gen, bankID, version);
|
||||||
if (bank == null || bank.Count <= locval)
|
if (bank == null || bank.Count <= locval)
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
return bank[locval];
|
return bank[locval];
|
||||||
|
|
|
@ -23,19 +23,8 @@
|
||||||
if (loc < 0)
|
if (loc < 0)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
if (version == (int)GameVersion.CXD) // handle C/XD locations
|
bool egg = loc != Encounter.Location;
|
||||||
{
|
return GameInfo.GetLocationName(egg, loc, gen, gen, (GameVersion)version);
|
||||||
var locs = GameInfo.Strings.metCXD_00000;
|
|
||||||
return loc >= locs.Length ? null : locs[loc];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GameVersion.GG.Contains(version) && Encounter.Location < 100)
|
|
||||||
{
|
|
||||||
var locs = GameInfo.Strings.metGG_00000;
|
|
||||||
return loc >= locs.Length ? null : locs[loc];
|
|
||||||
}
|
|
||||||
|
|
||||||
return GameInfo.GetLocationName(loc != Encounter.Location, loc, gen, gen);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -778,7 +778,7 @@ namespace PKHeX.Core
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
|
|
||||||
int locval = eggmet ? pk.Egg_Location : pk.Met_Location;
|
int locval = eggmet ? pk.Egg_Location : pk.Met_Location;
|
||||||
return GameInfo.GetLocationName(eggmet, locval, pk.Format, pk.GenNumber);
|
return GameInfo.GetLocationName(eggmet, locval, pk.Format, pk.GenNumber, (GameVersion)pk.Version);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
Loading…
Add table
Reference in a new issue