mirror of
https://github.com/kwsch/PKHeX
synced 2025-01-06 01:28:48 +00:00
3c232505e5
In this pull request I've changed a ton of method signatures to reflect the more-narrow types of Species, Move# and Form; additionally, I've narrowed other large collections that stored lists of species / permitted values, and reworked them to be more performant with the latest API spaghetti that PKHeX provides. Roamer met locations, usually in a range of [max-min]<64, can be quickly checked using a bitflag operation on a UInt64. Other collections (like "Is this from Colosseum or XD") were eliminated -- shadow state is not transferred COLO<->XD, so having a Shadow ID or matching the met location from a gift/wild encounter is a sufficient check for "originated in XD".
67 lines
2.6 KiB
C#
67 lines
2.6 KiB
C#
namespace PKHeX.Core;
|
|
|
|
/// <summary>
|
|
/// Exposes info about all <see cref="IPersonalInfo"/> contained in the object.
|
|
/// </summary>
|
|
public interface IPersonalTable
|
|
{
|
|
/// <summary>
|
|
/// Max Species ID (National Dex) that is stored in the table.
|
|
/// </summary>
|
|
int MaxSpeciesID { get; }
|
|
|
|
/// <summary>
|
|
/// Gets an index from the inner array.
|
|
/// </summary>
|
|
/// <remarks>Has built in length checks; returns empty (0) entry if out of range.</remarks>
|
|
/// <param name="index">Index to retrieve</param>
|
|
/// <returns>Requested index entry</returns>
|
|
PersonalInfo this[int index] { get; }
|
|
|
|
/// <summary>
|
|
/// Alternate way of fetching <see cref="GetFormEntry"/>.
|
|
/// </summary>
|
|
PersonalInfo this[ushort species, int form] { get; }
|
|
|
|
/// <summary>
|
|
/// Gets the <see cref="PersonalInfo"/> entry index for a given <see cref="PKM.Species"/> and <see cref="PKM.Form"/>.
|
|
/// </summary>
|
|
/// <param name="species"><see cref="PKM.Species"/></param>
|
|
/// <param name="form"><see cref="PKM.Form"/></param>
|
|
/// <returns>Entry index for the input criteria</returns>
|
|
int GetFormIndex(ushort species, int form);
|
|
|
|
/// <summary>
|
|
/// Gets the <see cref="PersonalInfo"/> entry for a given <see cref="PKM.Species"/> and <see cref="PKM.Form"/>.
|
|
/// </summary>
|
|
/// <param name="species"><see cref="PKM.Species"/></param>
|
|
/// <param name="form"><see cref="PKM.Form"/></param>
|
|
/// <returns>Entry for the input criteria</returns>
|
|
PersonalInfo GetFormEntry(ushort species, int form);
|
|
|
|
/// <summary>
|
|
/// Checks if the <see cref="PKM.Species"/> is within the bounds of the table.
|
|
/// </summary>
|
|
/// <param name="species"><see cref="PKM.Species"/></param>
|
|
/// <returns>True if present in game</returns>
|
|
bool IsSpeciesInGame(ushort species);
|
|
|
|
/// <summary>
|
|
/// Checks if the <see cref="PKM.Species"/> and <see cref="PKM.Form"/> is within the bounds of the table.
|
|
/// </summary>
|
|
/// <param name="species"><see cref="PKM.Species"/></param>
|
|
/// <param name="form"><see cref="PKM.Form"/></param>
|
|
/// <returns>True if present in game</returns>
|
|
bool IsPresentInGame(ushort species, int form);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Generic interface for exposing specific <see cref="IPersonalInfo"/> retrieval methods.
|
|
/// </summary>
|
|
/// <typeparam name="T">Specific type of <see cref="IPersonalInfo"/> the table contains.</typeparam>
|
|
public interface IPersonalTable<out T> where T : IPersonalInfo
|
|
{
|
|
T this[int index] { get; }
|
|
T this[ushort species, int form] { get; }
|
|
T GetFormEntry(ushort species, int form);
|
|
}
|