mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-23 04:23:12 +00:00
Clamp picnic table accessory counts
This commit is contained in:
parent
af660dd299
commit
b2cbcd5139
2 changed files with 13 additions and 0 deletions
|
@ -264,6 +264,8 @@ public abstract class InventoryPouch
|
|||
return InventoryPouch8.GetSuggestedCount(Type, item, requestVal);
|
||||
if (sav is not SAV8BS && ItemConverter.IsItemHM((ushort)item, sav.Generation))
|
||||
return 1;
|
||||
if (sav is SAV9SV)
|
||||
return InventoryPouch9.GetSuggestedCount(Type, item, requestVal);
|
||||
return Math.Min(MaxCount, requestVal);
|
||||
}
|
||||
|
||||
|
|
|
@ -88,4 +88,15 @@ public sealed class InventoryPouch9 : InventoryPouch
|
|||
public static int GetItemOffset(ushort index) => (InventoryItem9.SIZE * index);
|
||||
|
||||
public void ClearItem(Span<byte> data, ushort index) => InventoryItem9.Clear(data, GetItemOffset(index));
|
||||
|
||||
public static int GetSuggestedCount(InventoryType t, int item, int requestVal)
|
||||
{
|
||||
bool pick = item is >= 2334 and <= 2342 || item is >= 2385 and <= 2394;
|
||||
return t switch
|
||||
{
|
||||
// Picnic table accessories are clamped to 1, let actual ingredients and sandwich picks be whatever
|
||||
InventoryType.Ingredients => !pick && item is >= 2311 and <= 2400 ? 1 : requestVal,
|
||||
_ => requestVal,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue