mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-27 06:20:25 +00:00
Add party pointer sort
Pulls party members (and follower index if not already in party?) to the first slot(s) in the (current/all) box.
This commit is contained in:
parent
1d27f64235
commit
f27816e622
4 changed files with 12 additions and 0 deletions
|
@ -45,6 +45,7 @@ namespace PKHeX.Core
|
|||
new BoxManipSort(BoxManipType.SortDate, PKMSorting.OrderByDateObtained, s => s.Generation >= 4),
|
||||
new BoxManipSort(BoxManipType.SortName, list => list.OrderBySpeciesName(GameInfo.Strings.Species)),
|
||||
new BoxManipSort(BoxManipType.SortFavorite, list => list.OrderByCustom(pk => !(pk as PB7)?.Favorite), s => s is SAV7b),
|
||||
new BoxManipSort(BoxManipType.SortParty, (list, sav) => list.OrderByCustom(pk => ((SAV7b)sav).Storage.GetPartyIndex(pk.Box - 1, pk.Slot - 1)), s => s is SAV7b),
|
||||
new BoxManipSort(BoxManipType.SortShiny, list => list.OrderByCustom(pk => !pk.IsShiny)),
|
||||
new BoxManipSort(BoxManipType.SortRandom, list => list.OrderByCustom(_ => Util.Rand32())),
|
||||
};
|
||||
|
|
|
@ -17,6 +17,7 @@ namespace PKHeX.Core
|
|||
SortDate,
|
||||
SortName,
|
||||
SortFavorite,
|
||||
SortParty,
|
||||
SortShiny,
|
||||
SortRandom,
|
||||
|
||||
|
|
|
@ -114,6 +114,15 @@ namespace PKHeX.Core
|
|||
return SAV.GetBoxSlotOffset(position);
|
||||
}
|
||||
|
||||
public int GetPartyIndex(int box, int slot)
|
||||
{
|
||||
int slotIndex = slot + (SAV.BoxSlotCount * box);
|
||||
if ((uint)slotIndex >= MAX_SLOTS)
|
||||
return MAX_SLOTS;
|
||||
var index = Array.IndexOf(PokeListInfo, slotIndex);
|
||||
return index >= 0 ? index : MAX_SLOTS;
|
||||
}
|
||||
|
||||
public bool IsSlotInBattleTeam(int box, int slot)
|
||||
{
|
||||
if ((uint)slot >= SAV.SlotCount || (uint)box >= SAV.BoxCount)
|
||||
|
|
|
@ -57,6 +57,7 @@ namespace PKHeX.WinForms.Controls
|
|||
[BoxManipType.SortDate] = Resources.date,
|
||||
[BoxManipType.SortName] = Resources.alphaAZ,
|
||||
[BoxManipType.SortFavorite] = Resources.heart,
|
||||
[BoxManipType.SortParty] = Resources.users,
|
||||
[BoxManipType.SortShiny] = Resources.showdown,
|
||||
[BoxManipType.SortRandom] = Resources.wand,
|
||||
|
||||
|
|
Loading…
Reference in a new issue