2022-06-18 18:04:24 +00:00
|
|
|
|
namespace PKHeX.Core;
|
|
|
|
|
|
|
|
|
|
public interface IGymTeamInfo
|
|
|
|
|
{
|
|
|
|
|
ushort GetBadgeVictorySpecies(uint badge, uint slot);
|
|
|
|
|
void SetBadgeVictorySpecies(uint badge, uint slot, ushort species);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static class GymTeamInfoExtensions
|
2019-12-29 06:32:45 +00:00
|
|
|
|
{
|
2022-06-18 18:04:24 +00:00
|
|
|
|
public static ushort[][] GetGymTeams(this IGymTeamInfo info)
|
2019-12-29 06:32:45 +00:00
|
|
|
|
{
|
2022-06-18 18:04:24 +00:00
|
|
|
|
ushort[][] teams = new ushort[8][];
|
|
|
|
|
for (uint badge = 0; badge < teams.Length; badge++)
|
|
|
|
|
teams[badge] = GetGymTeam(info, badge);
|
|
|
|
|
return teams;
|
2019-12-29 06:32:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
|
private static ushort[] GetGymTeam(IGymTeamInfo info, uint badge)
|
2019-12-29 06:32:45 +00:00
|
|
|
|
{
|
2022-06-18 18:04:24 +00:00
|
|
|
|
var team = new ushort[6];
|
|
|
|
|
for (uint slot = 0; slot < team.Length; slot++)
|
|
|
|
|
team[slot] = info.GetBadgeVictorySpecies(badge, slot);
|
|
|
|
|
return team;
|
|
|
|
|
}
|
2019-12-29 06:32:45 +00:00
|
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
|
public static void SetGymTeams(this IGymTeamInfo info, ushort[][] teams)
|
|
|
|
|
{
|
|
|
|
|
for (uint badge = 0; badge < teams.Length; badge++)
|
|
|
|
|
info.SetGymTeam(badge, teams[badge]);
|
|
|
|
|
}
|
2019-12-29 06:32:45 +00:00
|
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
|
public static void SetGymTeam(this IGymTeamInfo info, uint badge, ushort[] team)
|
|
|
|
|
{
|
|
|
|
|
for (uint slot = 0; slot < team.Length; slot++)
|
|
|
|
|
info.SetBadgeVictorySpecies(badge, slot, team[slot]);
|
2019-12-29 06:32:45 +00:00
|
|
|
|
}
|
2022-06-18 18:04:24 +00:00
|
|
|
|
}
|