mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-09-09 20:08:43 -05:00
Relocate method to extension logic class
GetLocationString is now right below GetPotentialString PKX no longer has extension methods aside from the two CopyTo sugar
This commit is contained in:
@@ -683,5 +683,21 @@ public static string GetPotentialString(this PKM pk, bool unicode = true)
|
||||
var arr = unicode ? PotentialUnicode : PotentialNoUnicode;
|
||||
return arr[pk.PotentialRating];
|
||||
}
|
||||
|
||||
// Extensions
|
||||
/// <summary>
|
||||
/// Gets the Location Name for the <see cref="PKM"/>
|
||||
/// </summary>
|
||||
/// <param name="pk">PKM to fetch data for</param>
|
||||
/// <param name="eggmet">Location requested is the egg obtained location, not met location.</param>
|
||||
/// <returns>Location string</returns>
|
||||
public static string GetLocationString(this PKM pk, bool eggmet)
|
||||
{
|
||||
if (pk.Format < 2)
|
||||
return string.Empty;
|
||||
|
||||
int locval = eggmet ? pk.Egg_Location : pk.Met_Location;
|
||||
return GameInfo.GetLocationName(eggmet, locval, pk.Format, pk.GenNumber, (GameVersion)pk.Version);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -820,22 +820,6 @@ public static int GetPKMFormatFromExtension(char last, int prefer)
|
||||
return last == 'x' ? 6 : prefer;
|
||||
}
|
||||
|
||||
// Extensions
|
||||
/// <summary>
|
||||
/// Gets the Location Name for the <see cref="PKM"/>
|
||||
/// </summary>
|
||||
/// <param name="pk">PKM to fetch data for</param>
|
||||
/// <param name="eggmet">Location requested is the egg obtained location, not met location.</param>
|
||||
/// <returns>Location string</returns>
|
||||
public static string GetLocationString(this PKM pk, bool eggmet)
|
||||
{
|
||||
if (pk.Format < 2)
|
||||
return string.Empty;
|
||||
|
||||
int locval = eggmet ? pk.Egg_Location : pk.Met_Location;
|
||||
return GameInfo.GetLocationName(eggmet, locval, pk.Format, pk.GenNumber, (GameVersion)pk.Version);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Copies a <see cref="PKM"/> list to the destination list, with an option to copy to a starting point.
|
||||
/// </summary>
|
||||
@@ -887,7 +871,7 @@ public static int CopyTo<T>(this IEnumerable<T> list, IList<T> dest, int start =
|
||||
int ctr = start;
|
||||
foreach (var z in list)
|
||||
{
|
||||
if (dest.Count <= ctr)
|
||||
if (ctr >= dest.Count)
|
||||
break;
|
||||
dest[ctr++] = z;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user