diff --git a/PKHeX.Core/Legality/Tables/Tables8.cs b/PKHeX.Core/Legality/Tables/Tables8.cs index 668893dc0..dc75072b9 100644 --- a/PKHeX.Core/Legality/Tables/Tables8.cs +++ b/PKHeX.Core/Legality/Tables/Tables8.cs @@ -181,7 +181,7 @@ public static partial class Legal 1105, 1106, 1107, 1108, }; - internal static readonly ushort[] HeldItems_SWSH = new ushort[1].Concat(Pouch_Items_SWSH).Concat(Pouch_Berries_SWSH).Concat(Pouch_Medicine_SWSH).Concat(TR_SWSH).ToArray(); + internal static readonly ushort[] HeldItems_SWSH = ArrayUtil.ConcatAll(new ushort[1], Pouch_Items_SWSH, Pouch_Berries_SWSH, Pouch_Medicine_SWSH, TR_SWSH, Pouch_Treasure_SWSH); internal static readonly HashSet WildPokeballs8 = new HashSet { (int)Ball.Poke, diff --git a/PKHeX.Core/Util/ArrayUtil.cs b/PKHeX.Core/Util/ArrayUtil.cs index 0d1c3df6d..89ce5c54f 100644 --- a/PKHeX.Core/Util/ArrayUtil.cs +++ b/PKHeX.Core/Util/ArrayUtil.cs @@ -160,5 +160,23 @@ public static int CopyTo(this IEnumerable list, IList dest, int start = } return ctr - start; } + + internal static T[] ConcatAll(params T[][] arr) + { + int len = 0; + foreach (var a in arr) + len += a.Length; + + var result = new T[len]; + + int ctr = 0; + for (int i = 0; i < arr.Length; i++) + { + arr[i].CopyTo(result, ctr); + ctr += arr[i].Length; + } + + return result; + } } } \ No newline at end of file