mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-04-20 05:58:47 -05:00
29 lines
1.0 KiB
C#
29 lines
1.0 KiB
C#
using System;
|
|
|
|
namespace PKHeX.Core;
|
|
|
|
/// <summary>
|
|
/// Item storage for <see cref="GameVersion.D"/> and <see cref="GameVersion.P"/>
|
|
/// </summary>
|
|
public sealed class ItemStorage4DP : ItemStorage4, IItemStorage
|
|
{
|
|
public static readonly ItemStorage4DP Instance = new();
|
|
|
|
public static ushort[] GetAllHeld() => [..GeneralDP, ..Mail, ..Medicine, ..Berry, ..BallsDPPt, ..Battle, ..Machine[..^8]];
|
|
|
|
public bool IsLegal(InventoryType type, int itemIndex, int itemCount) => !Unreleased.Contains((ushort)itemIndex);
|
|
|
|
public ReadOnlySpan<ushort> GetItems(InventoryType type) => type switch
|
|
{
|
|
InventoryType.Items => GeneralDP,
|
|
InventoryType.KeyItems => Key,
|
|
InventoryType.TMHMs => Machine,
|
|
InventoryType.MailItems => Mail,
|
|
InventoryType.Medicine => Medicine,
|
|
InventoryType.Berries => Berry,
|
|
InventoryType.Balls => BallsDPPt,
|
|
InventoryType.BattleItems => Battle,
|
|
_ => throw new ArgumentOutOfRangeException(nameof(type), type, null),
|
|
};
|
|
}
|