diff --git a/PKHeX.Core/PKM/PKMSorting.cs b/PKHeX.Core/PKM/PKMSorting.cs index ce95f87b8..711fc873f 100644 --- a/PKHeX.Core/PKM/PKMSorting.cs +++ b/PKHeX.Core/PKM/PKMSorting.cs @@ -109,10 +109,7 @@ public static IEnumerable OrderByOwnership(this IEnumerable list, ITra { return list.InitialSortBy() .ThenByDescending(trainer.IsOriginalHandler) // true first - .ThenBy(p => p.OT_Name) - .ThenBy(p => p.OT_Gender) - .ThenBy(p => p.TID) - .ThenBy(p => p.SID) + .OrderByTrainer() .ThenBy(p => p.Species) .FinalSortBy(); } @@ -154,6 +151,18 @@ private static IOrderedEnumerable FinalSortBy(this IOrderedEnumerable return postSorted; } + /// + /// Common mid-filtering grouping of PKM data according to the Original Trainer details. + /// + /// Output list of data. + private static IOrderedEnumerable OrderByTrainer(this IOrderedEnumerable list) + { + return list.ThenBy(p => p.OT_Name) + .ThenBy(p => p.OT_Gender) + .ThenBy(p => p.TID) + .ThenBy(p => p.SID); + } + /// /// Gets if the current handler is the original trainer. ///