public BoxPokeBox(IPokePC pokePC, uint boxNumber, byte[] rawName, bool boxA, PokeBoxWallpapers wallpaper, byte[] storage) { this.pokePC = pokePC; this.boxNumber = boxNumber; this.rawName = rawName; this.boxA = boxA; this.wallpaper = wallpaper; this.pokemonList = new IPokemon[30]; for (int i = 0; i < 30; i++) { int boxIndex = (i % 6) + (i / 6) * 12 + (!boxA ? 6 : 0); BoxPokemon pkm = new BoxPokemon(ByteHelper.SubByteArray(boxIndex * 84, storage, 84)); if (pkm.Experience != 0 && pkm.SpeciesID != 0 && pkm.Checksum != 0) { if (pkm.IsValid) { pokemonList[i] = pkm; } else { pokemonList[i] = BoxPokemon.CreateInvalidPokemon(pkm); } pokemonList[i].PokeContainer = this; } } }
public GBAPokeParty(IPokePC pokePC, byte[] data) { this.pokePC = pokePC; this.raw = data; this.party = new List <IPokemon>(); uint teamSize = LittleEndian.ToUInt32(data, 0); for (int i = 0; i < teamSize && i < 6; i++) { GBAPokemon pkm = new GBAPokemon(ByteHelper.SubByteArray(4 + 100 * i, data, 100)); if (pkm.DexID != 0 && pkm.Checksum != 0 && pkm.Experience != 0) { if (pkm.IsValid) { party.Add(pkm); } else { party.Add(GBAPokemon.CreateInvalidPokemon(pkm)); } party[party.Count - 1].PokeContainer = this; } else { break; } } }
public XDPokeParty(IPokePC pokePC, byte[] data) { this.pokePC = pokePC; this.raw = data; this.party = new List <IPokemon>(); for (int i = 0; i < 6; i++) { XDPokemon xdpkm = new XDPokemon(ByteHelper.SubByteArray(i * 196, data, 196)); if (xdpkm.DexID != 0 && xdpkm.Experience != 0) { if (xdpkm.IsValid) { party.Add(xdpkm); } else { party.Add(XDPokemon.CreateInvalidPokemon(xdpkm)); } party[party.Count - 1].PokeContainer = this; } else { break; } } }
public GCSaveData(GCGameSave gameSave, byte[] data) { this.raw = data; this.gameSave = gameSave; this.inventory = new Inventory(gameSave); if (gameSave.GameType == GameTypes.Colosseum) { this.pokePC = new ColosseumPokePC(gameSave); DecryptColosseum(this.raw, ByteHelper.SubByteArray(0x1DFEC, raw, 20)); LoadColosseum(); } else { this.pokePC = new XDPokePC(gameSave); this.encryptionKeys = new ushort[4]; BigEndian.LoadArray(encryptionKeys, data, 8); DecryptXD(this.raw, encryptionKeys); LoadXD(); } }
public ColosseumPokeParty(IPokePC pokePC, byte[] data) { this.pokePC = pokePC; this.raw = data; this.party = new List <IPokemon>(); for (int i = 0; i < 6; i++) { ColosseumPokemon colopkm = new ColosseumPokemon(ByteHelper.SubByteArray(312 * i, data, 312)); if (colopkm.DexID != 0 && colopkm.Experience != 0) { if (colopkm.IsValid) { party.Add(colopkm); } else { party.Add(ColosseumPokemon.CreateInvalidPokemon(colopkm)); } party[party.Count - 1].PokeContainer = this; } else { break; } } }
public GBAPokeBox(IPokePC pokePC, uint boxNumber, byte[] rawName, PokeBoxWallpapers wallpaper) { this.pokePC = pokePC; this.boxNumber = boxNumber; this.rawName = rawName; this.wallpaper = wallpaper; this.pokemonStorage = new PokemonStorage(new byte[2400], PokemonFormatTypes.Gen3GBA, this); }
public XDPokeBox(IPokePC pokePC, byte boxNumber, byte[] data) { this.pokePC = pokePC; this.raw = data; this.boxNumber = boxNumber; this.wallpaper = (PokeBoxWallpapers)boxNumber; this.pokemonStorage = new PokemonStorage(ByteHelper.SubByteArray(20, data, 196 * 30), PokemonFormatTypes.Gen3XD, this); }
public void UnloadPC() { pokePC = null; pokeBoxControlMaster.UnloadBox(); foreach (PokeBoxControl slave in slaves) { slave.UnloadBox(); } }
public ManagerPokeBox(IPokePC pokePC, uint version, uint boxNumber, string name, bool usingCustom, string wallpaperName, byte[] storage) { this.pokePC = pokePC; this.boxNumber = boxNumber; this.name = name; this.usingCustomWallpaper = usingCustom; this.wallpaperName = wallpaperName; this.pokemonList = new GBAPokemon[30]; if (version <= 1) { for (int i = 0; i < 30; i++) { GBAPokemon pkm = new GBAPokemon(ByteHelper.SubByteArray(i * 80, storage, 80)); if (!ByteHelper.CompareBytes(0, pkm.Raw)) { if (pkm.IsValid) { pokemonList[i] = pkm; } else { pokemonList[i] = GBAPokemon.CreateInvalidPokemon(pkm); } pokemonList[i].PokeContainer = this; } else { pokemonList[i] = null; } } } else if (version == 2) { for (int i = 0; i < 30; i++) { GBAPokemon pkm = new GBAPokemon(ByteHelper.SubByteArray(i * 100, storage, 80)); if (!ByteHelper.CompareBytes(0, pkm.Raw)) { if (pkm.IsValid) { pokemonList[i] = pkm; pkm.DeoxysForm = storage[i * 100 + 80]; } else { pokemonList[i] = GBAPokemon.CreateInvalidPokemon(pkm); } pokemonList[i].PokeContainer = this; } else { pokemonList[i] = null; } } } }
public ManagerPokeBox(IPokePC pokePC, uint boxNumber, string name, PokeBoxWallpapers wallpaper) { this.pokePC = pokePC; this.boxNumber = boxNumber; this.name = name; this.wallpaper = wallpaper; this.usingCustomWallpaper = false; this.wallpaperName = ((ManagerPokeBoxWallpapers)wallpaper).ToString(); this.pokemonList = new GBAPokemon[30]; }
public XDDaycare(IPokePC pokePC, byte[] data) { this.pokePC = pokePC; this.raw = data; if (DaycareStatus > 0) { depositedPokemon = new XDPokemon(ByteHelper.SubByteArray(0x8, data, 196)); depositedPokemon.PokeContainer = this; } }
public ColosseumDaycare(IPokePC pokePC, byte[] data) { this.pokePC = pokePC; this.raw = data; if (DaycareStatus > 0) { depositedPokemon = new ColosseumPokemon(ByteHelper.SubByteArray(0x8, data, 312)); depositedPokemon.PokeContainer = this; } }
private void OnRowSelectionChanged(object sender, SelectionChangedEventArgs e) { if (comboBoxRows.SelectedIndex != -1) { rowIndex = comboBoxRows.SelectedIndex; pokePC = PokeManager.ManagerGameSave.GetPokePCRow(rowIndex); boxIndex = pokePC.CurrentBox; pokeBoxControl.LoadBox(pokePC[boxIndex], gameIndex); } }
public GBAPokeBox(IPokePC pokePC, uint boxNumber, byte[] rawName, PokeBoxWallpapers wallpaper, byte[] storage) { if (storage.Length != 2400) { throw new Exception("GBA Storage size should be 2400 bytes"); } this.pokePC = pokePC; this.boxNumber = boxNumber; this.rawName = rawName; this.wallpaper = wallpaper; this.pokemonStorage = new PokemonStorage(storage, PokemonFormatTypes.Gen3GBA, this); }
public void LoadPC(IPokePC pokePC, int boxIndex, PokemonViewer pokemonViewer, GameTypes gameType) { if (pokePC == null) { this.pokeBoxControl.UnloadBox(); return; } this.gameType = gameType; this.pokePC = pokePC; this.boxIndex = boxIndex; this.pokemonViewer = pokemonViewer; this.pokeBoxControl.PokemonViewer = pokemonViewer; this.pokeBoxControl.LoadBox(PokeBox); }
public void RefreshUI() { if (pokePC != null) { if (GameSave is ManagerGameSave) { this.pokePC = (GameSave as ManagerGameSave).GetPokePCRow(rowIndex); loaded = false; comboBoxRows.SelectedIndex = rowIndex; loaded = true; comboBoxRows.Visibility = Visibility.Visible; buttonParty.Visibility = Visibility.Hidden; } else { this.pokePC = GameSave.PokePC; comboBoxRows.Visibility = Visibility.Hidden; buttonParty.Visibility = Visibility.Visible; } if (boxIndex >= pokePC.NumBoxes) { int mod = (boxIndex % (int)pokePC.NumBoxes); boxIndex = (mod < 0 ? (mod + (int)pokePC.NumBoxes) : mod); } UpdateSlaves(ActualWidth); pokeBoxControlMaster.LoadBox(GetWrappedBox(boxIndex + BoxOffset), gameIndex); for (int i = 0; i < slaves.Count; i++) { slaves[i].LoadBox(GetWrappedBox(boxIndex + i + 1 + BoxOffset), gameIndex); } if (containerMode == ContainerTypes.Party) { pokeBoxControlParty.LoadBox(pokePC.Party, gameIndex); } else if (containerMode == ContainerTypes.Daycare) { pokeBoxControlParty.LoadBox(pokePC.Daycare, gameIndex); } else if (containerMode == ContainerTypes.Purifier) { pokeBoxControlParty.LoadBox(((XDPokePC)pokePC).GetChamber(0), gameIndex); } } }
private void GameChanged(object sender, SelectionChangedEventArgs e) { if (!loaded) { return; } gameIndex = comboBoxGame.SelectedGameIndex; rowIndex = 0; if (gameIndex == -2) { pokeBoxControl.UnloadBox(); } else { if (comboBoxGame.SelectedGameSave is ManagerGameSave) { buttonParty.Visibility = Visibility.Hidden; comboBoxRows.Visibility = Visibility.Visible; } else { buttonParty.Visibility = Visibility.Visible; comboBoxRows.Visibility = Visibility.Hidden; } pokePC = PokeManager.GetGameSaveAt(this.gameIndex).PokePC; boxIndex = pokePC.CurrentBox; if (pokePC.Party == null) { partyMode = false; buttonParty.Content = "Show Party"; buttonParty.IsEnabled = false; pokeBoxControlParty.Visibility = Visibility.Hidden; } else { buttonParty.IsEnabled = true; } pokeBoxControl.LoadBox(pokePC[boxIndex], gameIndex); if (partyMode) { pokeBoxControlParty.LoadBox(pokePC.Party, gameIndex); } } }
public ColosseumPokeParty(IPokePC pokePC, byte[] data) { this.pokePC = pokePC; this.raw = data; this.party = new List<IPokemon>(); for (int i = 0; i < 6; i++) { ColosseumPokemon colopkm = new ColosseumPokemon(ByteHelper.SubByteArray(312 * i, data, 312)); if (colopkm.DexID != 0 && colopkm.Experience != 0) { if (colopkm.IsValid) party.Add(colopkm); else party.Add(ColosseumPokemon.CreateInvalidPokemon(colopkm)); party[party.Count - 1].PokeContainer = this; } else { break; } } }
public XDPokeParty(IPokePC pokePC, byte[] data) { this.pokePC = pokePC; this.raw = data; this.party = new List<IPokemon>(); for (int i = 0; i < 6; i++) { XDPokemon xdpkm = new XDPokemon(ByteHelper.SubByteArray(i * 196, data, 196)); if (xdpkm.DexID != 0 && xdpkm.Experience != 0) { if (xdpkm.IsValid) party.Add(xdpkm); else party.Add(XDPokemon.CreateInvalidPokemon(xdpkm)); party[party.Count - 1].PokeContainer = this; } else { break; } } }
public BoxPokeBox(IPokePC pokePC, uint boxNumber, byte[] rawName, bool boxA, PokeBoxWallpapers wallpaper, byte[] storage) { this.pokePC = pokePC; this.boxNumber = boxNumber; this.rawName = rawName; this.boxA = boxA; this.wallpaper = wallpaper; this.pokemonList = new IPokemon[30]; for (int i = 0; i < 30; i++) { int boxIndex = (i % 6) + (i / 6) * 12 + (!boxA ? 6 : 0); BoxPokemon pkm = new BoxPokemon(ByteHelper.SubByteArray(boxIndex * 84, storage, 84)); if (pkm.Experience != 0 && pkm.SpeciesID != 0 && pkm.Checksum != 0) { if (pkm.IsValid) pokemonList[i] = pkm; else pokemonList[i] = BoxPokemon.CreateInvalidPokemon(pkm); pokemonList[i].PokeContainer = this; } } }
public XDPurificationChamber(IPokePC pokePC, byte chamberNumber, byte[] data) { this.pokePC = pokePC; this.raw = data; this.chamberNumber = chamberNumber; this.normalPokemon = new List <XDPokemon>(); for (int i = 0; i < 4; i++) { XDPokemon nPkm = new XDPokemon(ByteHelper.SubByteArray(i * 196, data, 196)); if (nPkm.DexID != 0 && nPkm.Experience != 0) { if (nPkm.IsInvalid) { nPkm = XDPokemon.CreateInvalidPokemon(nPkm); } normalPokemon.Add(nPkm); nPkm.PokeContainer = this; } else { break; } } XDPokemon sPkm = new XDPokemon(ByteHelper.SubByteArray(4 * 196, data, 196)); if (sPkm.DexID != 0 && sPkm.Experience != 0) { if (sPkm.IsInvalid) { sPkm = XDPokemon.CreateInvalidPokemon(sPkm); } shadowPokemon = sPkm; sPkm.PokeContainer = this; } }
private void GameChanged(object sender, SelectionChangedEventArgs e) { if (!loaded) return; gameIndex = comboBoxGame.SelectedGameIndex; rowIndex = 0; if (gameIndex == -2) { pokeBoxControl.UnloadBox(); } else { if (comboBoxGame.SelectedGameSave is ManagerGameSave) { buttonParty.Visibility = Visibility.Hidden; comboBoxRows.Visibility = Visibility.Visible; } else { buttonParty.Visibility = Visibility.Visible; comboBoxRows.Visibility = Visibility.Hidden; } pokePC = PokeManager.GetGameSaveAt(this.gameIndex).PokePC; boxIndex = pokePC.CurrentBox; if (pokePC.Party == null) { partyMode = false; buttonParty.Content = "Show Party"; buttonParty.IsEnabled = false; pokeBoxControlParty.Visibility = Visibility.Hidden; } else { buttonParty.IsEnabled = true; } pokeBoxControl.LoadBox(pokePC[boxIndex], gameIndex); if (partyMode) pokeBoxControlParty.LoadBox(pokePC.Party, gameIndex); } }
public SendPokemonToWindow(SendPokemonModes mode, int gameIndex, IPokemon pokemon, IPokeContainer container, int containerIndex, Item giveItem, bool noEggs = false) { InitializeComponent(); loaded2 = false; loaded = false; this.pokemon = pokemon; this.pokeBoxControl.MouseMoveTarget = this; this.pokeBoxControlParty.MouseMoveTarget = this; this.pokeBoxControl.AddSlave(this.pokeBoxControlParty); this.pokeBoxControlParty.Visibility = Visibility.Hidden; this.mode = mode; this.giveItem = giveItem; this.gameIndex = -2; this.noEggs = noEggs; this.pokeBoxControl.PokemonViewer = pokemonViewer; this.pokeBoxControlParty.PokemonViewer = pokemonViewer; this.pokeBoxControl.PokemonSelected += OnPokemonSelected; this.pokeBoxControlParty.PokemonSelected += OnPokemonSelected; if (mode == SendPokemonModes.SendFrom) { this.container = container; this.containerIndex = containerIndex; } else if (mode == SendPokemonModes.GiveItem) { this.Title = "Give Item"; } for (int i = -1; i < PokeManager.NumGameSaves; i++) { IGameSave game = PokeManager.GetGameSaveAt(i); if (i == gameIndex && (!(game is ManagerGameSave) || (game as ManagerGameSave).NumPokePCRows == 1)) { comboBoxGame.SetGameSaveVisible(i, false); continue; } if (pokemon != null && (mode != SendPokemonModes.GiveItem && (pokemon.IsEgg && (game.GameType == GameTypes.Colosseum || game.GameType == GameTypes.XD)))) { comboBoxGame.SetGameSaveVisible(i, false); continue; } else if (mode == SendPokemonModes.SendMulti && PokeManager.SelectionHasEgg && (game.GameType == GameTypes.Colosseum || game.GameType == GameTypes.XD)) { comboBoxGame.SetGameSaveVisible(i, false); continue; } } this.gameIndex = PokeManager.LastGameInDialogIndex; if (this.gameIndex == -2 || !comboBoxGame.IsGameSaveVisible(this.gameIndex)) { comboBoxGame.SelectedIndex = 0; this.gameIndex = comboBoxGame.SelectedGameIndex; } else { comboBoxGame.SelectedGameIndex = this.gameIndex; } loaded = true; if (this.gameIndex != -2) { boxIndex = comboBoxGame.SelectedGameSave.PokePC.CurrentBox; pokePC = PokeManager.GetGameSaveAt(this.gameIndex).PokePC; if (pokePC.Party == null) { partyMode = false; buttonParty.Content = "Show Party"; buttonParty.IsEnabled = false; pokeBoxControlParty.Visibility = Visibility.Hidden; } else { buttonParty.IsEnabled = true; } pokeBoxControl.LoadBox(pokePC[boxIndex], gameIndex); } GameChanged(null, null); }
public void UnloadPC() { pokePC = null; pokeBoxControlMaster.UnloadBox(); foreach (PokeBoxControl slave in slaves) slave.UnloadBox(); }
public void LoadUI(int newGameIndex = -2, int newRowIndex = -1) { if (gameIndex != -2 || rowIndex != -1) { loaded = false; if (newGameIndex != -2) this.gameIndex = newGameIndex; if (newRowIndex != -1) this.rowIndex = newRowIndex; this.comboBoxGame.SelectedGameIndex = this.gameIndex; this.comboBoxRows.SelectedIndex = this.rowIndex; loaded = true; gotoPokemon = null; pokeBoxControlMaster.UnhighlightPokemon(); } if (GameSave is ManagerGameSave) { this.pokePC = (GameSave as ManagerGameSave).GetPokePCRow(rowIndex); comboBoxRows.Visibility = Visibility.Visible; buttonParty.Visibility = Visibility.Hidden; } else { this.pokePC = GameSave.PokePC; comboBoxRows.Visibility = Visibility.Hidden; buttonParty.Visibility = Visibility.Visible; } if (pokePC == null) { this.pokeBoxControlMaster.UnloadBox(); foreach (PokeBoxControl slave in slaves) slave.UnloadBox(); return; } this.boxIndex = pokePC.CurrentBox; this.pokeBoxControlMaster.PokemonViewer = pokemonViewer; this.pokeBoxControlParty.PokemonViewer = pokemonViewer; if (this.pokePC.Party == null) { containerMode = ContainerTypes.Box; buttonParty.Content = "Show Party"; buttonParty.IsEnabled = false; pokeBoxControlParty.Visibility = Visibility.Hidden; } else { buttonParty.IsEnabled = true; if (containerMode == ContainerTypes.Purifier && pokePC.GameType != GameTypes.XD) { containerMode = ContainerTypes.Box; buttonParty.Content = "Show Party"; pokeBoxControlParty.Visibility = Visibility.Hidden; } else if (containerMode == ContainerTypes.Daycare && pokePC.GameType == GameTypes.XD) { buttonParty.Content = "Show Purifier"; } } RefreshUI(); }
public void LoadUI(int newGameIndex = -2, int newRowIndex = -1) { if (gameIndex != -2 || rowIndex != -1) { loaded = false; if (newGameIndex != -2) { this.gameIndex = newGameIndex; } if (newRowIndex != -1) { this.rowIndex = newRowIndex; } this.comboBoxGame.SelectedGameIndex = this.gameIndex; this.comboBoxRows.SelectedIndex = this.rowIndex; loaded = true; gotoPokemon = null; pokeBoxControlMaster.UnhighlightPokemon(); } if (GameSave is ManagerGameSave) { this.pokePC = (GameSave as ManagerGameSave).GetPokePCRow(rowIndex); comboBoxRows.Visibility = Visibility.Visible; buttonParty.Visibility = Visibility.Hidden; } else { this.pokePC = GameSave.PokePC; comboBoxRows.Visibility = Visibility.Hidden; buttonParty.Visibility = Visibility.Visible; } if (pokePC == null) { this.pokeBoxControlMaster.UnloadBox(); foreach (PokeBoxControl slave in slaves) { slave.UnloadBox(); } return; } this.boxIndex = pokePC.CurrentBox; this.pokeBoxControlMaster.PokemonViewer = pokemonViewer; this.pokeBoxControlParty.PokemonViewer = pokemonViewer; if (this.pokePC.Party == null) { containerMode = ContainerTypes.Box; buttonParty.Content = "Show Party"; buttonParty.IsEnabled = false; pokeBoxControlParty.Visibility = Visibility.Hidden; } else { buttonParty.IsEnabled = true; if (containerMode == ContainerTypes.Purifier && pokePC.GameType != GameTypes.XD) { containerMode = ContainerTypes.Box; buttonParty.Content = "Show Party"; pokeBoxControlParty.Visibility = Visibility.Hidden; } else if (containerMode == ContainerTypes.Daycare && pokePC.GameType == GameTypes.XD) { buttonParty.Content = "Show Purifier"; } } RefreshUI(); }
public void UnloadPC() { pokePC = null; pokeBoxControl.UnloadBox(); }
public GBADaycare(IPokePC pokePC, byte[] data, GameCodes gameCode) { this.gameCode = gameCode; this.pokePC = pokePC; this.raw = data; if (gameCode == GameCodes.FireRedLeafGreen) { originalPokemon = new GBAPokemon[3]; finalPokemon = new GBAPokemon[3]; GBAPokemon pkm = new GBAPokemon(ByteHelper.SubByteArray(0, raw, 80)); if (pkm.DexID != 0 && pkm.Checksum != 0 && pkm.Experience != 0) { if (pkm.IsValid) originalPokemon[0] = pkm; else originalPokemon[0] = GBAPokemon.CreateInvalidPokemon(pkm); SetFinalPokemon(0); } pkm = new GBAPokemon(ByteHelper.SubByteArray(140, raw, 80)); if (pkm.DexID != 0 && pkm.Checksum != 0 && pkm.Experience != 0) { if (pkm.IsValid) originalPokemon[1] = pkm; else originalPokemon[1] = GBAPokemon.CreateInvalidPokemon(pkm); SetFinalPokemon(1); } pkm = new GBAPokemon(ByteHelper.SubByteArray(3352, raw, 80)); if (pkm.DexID != 0 && pkm.Checksum != 0 && pkm.Experience != 0) { if (pkm.IsValid) originalPokemon[2] = pkm; else originalPokemon[2] = GBAPokemon.CreateInvalidPokemon(pkm); SetFinalPokemon(2); } } else if (gameCode == GameCodes.Emerald) { originalPokemon = new GBAPokemon[2]; finalPokemon = new GBAPokemon[2]; GBAPokemon pkm = new GBAPokemon(ByteHelper.SubByteArray(0, raw, 80)); if (pkm.DexID != 0 && pkm.Checksum != 0 && pkm.Experience != 0) { if (pkm.IsValid) originalPokemon[0] = pkm; else originalPokemon[0] = GBAPokemon.CreateInvalidPokemon(pkm); SetFinalPokemon(0); } pkm = new GBAPokemon(ByteHelper.SubByteArray(140, raw, 80)); if (pkm.DexID != 0 && pkm.Checksum != 0 && pkm.Experience != 0) { if (pkm.IsValid) originalPokemon[1] = pkm; else originalPokemon[1] = GBAPokemon.CreateInvalidPokemon(pkm); SetFinalPokemon(1); } } else if (gameCode == GameCodes.RubySapphire) { originalPokemon = new GBAPokemon[2]; finalPokemon = new GBAPokemon[2]; GBAPokemon pkm = new GBAPokemon(ByteHelper.SubByteArray(0, raw, 80)); if (pkm.DexID != 0 && pkm.Checksum != 0 && pkm.Experience != 0) { if (pkm.IsValid) originalPokemon[0] = pkm; else originalPokemon[0] = GBAPokemon.CreateInvalidPokemon(pkm); SetFinalPokemon(0); } pkm = new GBAPokemon(ByteHelper.SubByteArray(80, raw, 80)); if (pkm.DexID != 0 && pkm.Checksum != 0 && pkm.Experience != 0) { if (pkm.IsValid) originalPokemon[1] = pkm; else originalPokemon[1] = GBAPokemon.CreateInvalidPokemon(pkm); SetFinalPokemon(1); } } }
public void RefreshUI() { if (pokePC != null) { if (GameSave is ManagerGameSave) { this.pokePC = (GameSave as ManagerGameSave).GetPokePCRow(rowIndex); loaded = false; comboBoxRows.SelectedIndex = rowIndex; loaded = true; comboBoxRows.Visibility = Visibility.Visible; buttonParty.Visibility = Visibility.Hidden; } else { this.pokePC = GameSave.PokePC; comboBoxRows.Visibility = Visibility.Hidden; buttonParty.Visibility = Visibility.Visible; } if (boxIndex >= pokePC.NumBoxes) { int mod = (boxIndex % (int)pokePC.NumBoxes); boxIndex = (mod < 0 ? (mod + (int)pokePC.NumBoxes) : mod); } UpdateSlaves(ActualWidth); pokeBoxControlMaster.LoadBox(GetWrappedBox(boxIndex + BoxOffset), gameIndex); for (int i = 0; i < slaves.Count; i++) slaves[i].LoadBox(GetWrappedBox(boxIndex + i + 1 + BoxOffset), gameIndex); if (containerMode == ContainerTypes.Party) pokeBoxControlParty.LoadBox(pokePC.Party, gameIndex); else if (containerMode == ContainerTypes.Daycare) pokeBoxControlParty.LoadBox(pokePC.Daycare, gameIndex); else if (containerMode == ContainerTypes.Purifier) pokeBoxControlParty.LoadBox(((XDPokePC)pokePC).GetChamber(0), gameIndex); } }
public PokePCEnumerator(IPokePC pokePC) { this.pokePC = pokePC; this.boxIndex = -3; this.pokeIndex = -1; }
public GBADaycare(IPokePC pokePC, byte[] data, GameCodes gameCode) { this.gameCode = gameCode; this.pokePC = pokePC; this.raw = data; if (gameCode == GameCodes.FireRedLeafGreen) { originalPokemon = new GBAPokemon[3]; finalPokemon = new GBAPokemon[3]; GBAPokemon pkm = new GBAPokemon(ByteHelper.SubByteArray(0, raw, 80)); if (pkm.DexID != 0 && pkm.Checksum != 0 && pkm.Experience != 0) { if (pkm.IsValid) { originalPokemon[0] = pkm; } else { originalPokemon[0] = GBAPokemon.CreateInvalidPokemon(pkm); } SetFinalPokemon(0); } pkm = new GBAPokemon(ByteHelper.SubByteArray(140, raw, 80)); if (pkm.DexID != 0 && pkm.Checksum != 0 && pkm.Experience != 0) { if (pkm.IsValid) { originalPokemon[1] = pkm; } else { originalPokemon[1] = GBAPokemon.CreateInvalidPokemon(pkm); } SetFinalPokemon(1); } pkm = new GBAPokemon(ByteHelper.SubByteArray(3352, raw, 80)); if (pkm.DexID != 0 && pkm.Checksum != 0 && pkm.Experience != 0) { if (pkm.IsValid) { originalPokemon[2] = pkm; } else { originalPokemon[2] = GBAPokemon.CreateInvalidPokemon(pkm); } SetFinalPokemon(2); } } else if (gameCode == GameCodes.Emerald) { originalPokemon = new GBAPokemon[2]; finalPokemon = new GBAPokemon[2]; GBAPokemon pkm = new GBAPokemon(ByteHelper.SubByteArray(0, raw, 80)); if (pkm.DexID != 0 && pkm.Checksum != 0 && pkm.Experience != 0) { if (pkm.IsValid) { originalPokemon[0] = pkm; } else { originalPokemon[0] = GBAPokemon.CreateInvalidPokemon(pkm); } SetFinalPokemon(0); } pkm = new GBAPokemon(ByteHelper.SubByteArray(140, raw, 80)); if (pkm.DexID != 0 && pkm.Checksum != 0 && pkm.Experience != 0) { if (pkm.IsValid) { originalPokemon[1] = pkm; } else { originalPokemon[1] = GBAPokemon.CreateInvalidPokemon(pkm); } SetFinalPokemon(1); } } else if (gameCode == GameCodes.RubySapphire) { originalPokemon = new GBAPokemon[2]; finalPokemon = new GBAPokemon[2]; GBAPokemon pkm = new GBAPokemon(ByteHelper.SubByteArray(0, raw, 80)); if (pkm.DexID != 0 && pkm.Checksum != 0 && pkm.Experience != 0) { if (pkm.IsValid) { originalPokemon[0] = pkm; } else { originalPokemon[0] = GBAPokemon.CreateInvalidPokemon(pkm); } SetFinalPokemon(0); } pkm = new GBAPokemon(ByteHelper.SubByteArray(80, raw, 80)); if (pkm.DexID != 0 && pkm.Checksum != 0 && pkm.Experience != 0) { if (pkm.IsValid) { originalPokemon[1] = pkm; } else { originalPokemon[1] = GBAPokemon.CreateInvalidPokemon(pkm); } SetFinalPokemon(1); } } }