mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-26 22:10:21 +00:00
fa9a809751
* Extract/encapsulate inventory legal arrays to interface+class Hiding them behind methods allows these to be left as ReadOnlySpan<ushort> and thus never allocate on the heap. Also refactors out some logic for checking if an item is legal. End result feels more maintainable and is less bloaty (no more passing in a nullable func) Batch editing * Add HasType filter ``` =HasType=11 .HeldItem=Meadow Plate ``` slaps a meadow plate on any pkm with grass type Use `=PersonalType1=11` for only primary grass types; only-secondary-type grass will not match it.
26 lines
912 B
C#
26 lines
912 B
C#
using System;
|
|
|
|
namespace PKHeX.Core;
|
|
|
|
public sealed class ItemStorage5B2W2 : ItemStorage5, IItemStorage
|
|
{
|
|
public static readonly ItemStorage5B2W2 Instance = new();
|
|
private static ReadOnlySpan<ushort> Pouch_Key_B2W2 => new ushort[]
|
|
{
|
|
437, 442, 447, 450, 453, 458, 465, 466, 471,
|
|
504, 578,
|
|
616, 617, 621, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638,
|
|
};
|
|
|
|
public bool IsLegal(InventoryType type, int itemIndex, int itemCount) => true;
|
|
|
|
public ReadOnlySpan<ushort> GetItems(InventoryType type) => type switch
|
|
{
|
|
InventoryType.Items => Pouch_Items_BW,
|
|
InventoryType.KeyItems => Pouch_Key_B2W2,
|
|
InventoryType.TMHMs => Pouch_TMHM_BW,
|
|
InventoryType.Medicine => Pouch_Medicine_BW,
|
|
InventoryType.Berries => Pouch_Berries_BW,
|
|
_ => throw new ArgumentOutOfRangeException(nameof(type), type, null),
|
|
};
|
|
}
|