2022-11-25 01:42:17 +00:00
|
|
|
namespace PKHeX.Core;
|
|
|
|
|
2023-03-31 20:00:34 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Lumped image type.
|
|
|
|
/// </summary>
|
2022-11-25 01:42:17 +00:00
|
|
|
public enum HeldItemLumpImage
|
|
|
|
{
|
2023-03-31 20:00:34 +00:00
|
|
|
/// <summary>
|
2023-07-14 05:18:34 +00:00
|
|
|
/// Held Item sprite is a specific held item.
|
2023-03-31 20:00:34 +00:00
|
|
|
/// </summary>
|
|
|
|
NotLump = 0,
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Held Item sprite should show the Technical Machine (TM) icon.
|
|
|
|
/// </summary>
|
2022-11-25 01:42:17 +00:00
|
|
|
TechnicalMachine,
|
2023-03-31 20:00:34 +00:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Held Item sprite should show the Technical Record (TR) icon.
|
|
|
|
/// </summary>
|
2022-11-25 01:42:17 +00:00
|
|
|
TechnicalRecord,
|
|
|
|
}
|
|
|
|
|
2023-03-31 20:00:34 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Logic to check if a held item should how a lumped image sprite.
|
|
|
|
/// </summary>
|
2022-11-25 01:42:17 +00:00
|
|
|
public static class HeldItemLumpUtil
|
|
|
|
{
|
2023-03-31 20:00:34 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Checks if the <see cref="image"/> is a lumped sprite.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="image">Evaluated type</param>
|
|
|
|
/// <returns>True if the <see cref="image"/> is a lumped sprite.</returns>
|
2022-11-25 01:42:17 +00:00
|
|
|
public static bool IsLump(this HeldItemLumpImage image) => image != HeldItemLumpImage.NotLump;
|
|
|
|
|
2023-03-31 20:00:34 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Checks if the <see cref="item"/> should show a lumped sprite.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="item">Held Item index</param>
|
|
|
|
/// <param name="context">Generation context</param>
|
|
|
|
/// <returns>Evaluation result.</returns>
|
2022-12-18 08:16:29 +00:00
|
|
|
public static HeldItemLumpImage GetIsLump(int item, EntityContext context) => context.Generation() switch
|
2022-11-25 01:42:17 +00:00
|
|
|
{
|
|
|
|
<= 4 when item is (>= 0328 and <= 0419) => HeldItemLumpImage.TechnicalMachine, // gen2/3/4 TM
|
|
|
|
8 when item is (>= 0328 and <= 0427) => HeldItemLumpImage.TechnicalMachine, // BDSP TMs
|
|
|
|
8 when item is (>= 1130 and <= 1229) => HeldItemLumpImage.TechnicalRecord, // Gen8 TR
|
|
|
|
9 when item is (>= 0328 and <= 0419) // TM01-TM92
|
|
|
|
or (>= 0618 and <= 0620) // TM93-TM95
|
|
|
|
or (>= 0690 and <= 0693) // TM96-TM99
|
|
|
|
or (>= 2160 and <= 2231) /* TM100-TM171 */ => HeldItemLumpImage.TechnicalMachine,
|
|
|
|
_ => HeldItemLumpImage.NotLump,
|
|
|
|
};
|
|
|
|
}
|