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 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 unsafe SummaryGUI(object pkmn, Mode mode, Action onClosed, PBEMove learningMove = PBEMove.None) { _mode = mode; if (mode == Mode.LearnMove) { SetSelectionVar(-1); _page = Page.Moves; _selectingMove = 0; _learningMove = learningMove; } else { _page = Page.Info; } _pageImage = new Image((int)(Program.RenderWidth * PageImageWidth), (int)(Program.RenderHeight * PageImageHeight)); if (pkmn is PartyPokemon pPkmn) { _pPkmn = pPkmn; } else if (pkmn is BoxPokemon pcPkmn) { _pcPkmn = pcPkmn; } else { _bPkmn = (SpritedBattlePokemon)pkmn; } LoadPkmnImage(); UpdatePageImage(); _onClosed = onClosed; _fadeTransition = new FadeFromColorTransition(500, 0); Game.Instance.SetCallback(CB_FadeInSummary); Game.Instance.SetRCallback(RCB_Fading); }
public PokemonStorage(byte[] data, PokemonFormatTypes formatType, IPokeContainer container) { int formatSize = 0; this.formatType = formatType; if (formatType == PokemonFormatTypes.Gen3GBA) { formatSize = 80; if (data.Length % formatSize != 0) { throw new Exception("Pokemon Storage data size for GBA games should be divisible by 80"); } this.size = (uint)(data.Length / formatSize); for (int i = 0; i < size; i++) { GBAPokemon pkm = new GBAPokemon(ByteHelper.SubByteArray(i * formatSize, data, formatSize)); if (pkm.DexID != 0 && pkm.Checksum != 0 && pkm.Experience != 0) { if (pkm.IsValid) { Add(pkm); } else { Add(GBAPokemon.CreateInvalidPokemon(pkm)); } this[Count - 1].PokeContainer = container; } else { Add(null); } } } else if (formatType == PokemonFormatTypes.Gen3PokemonBox) { formatSize = 84; if (data.Length % formatSize != 0) { throw new Exception("Pokemon Storage data size for Pokemon Box games should be divisible by 84"); } this.size = (uint)(data.Length / formatSize); for (int i = 0; i < size; i++) { BoxPokemon pkm = new BoxPokemon(ByteHelper.SubByteArray(i * formatSize, data, formatSize)); if (pkm.DexID != 0 && pkm.Checksum != 0 && pkm.Experience != 0) { if (pkm.IsValid) { Add(pkm); } else { Add(BoxPokemon.CreateInvalidPokemon(pkm)); } this[Count - 1].PokeContainer = container; } else { Add(null); } } } else if (formatType == PokemonFormatTypes.Gen3Colosseum) { formatSize = 312; if (data.Length % formatSize != 0) { throw new Exception("Pokemon Storage data size for Colosseum should be divisible by 312"); } this.size = (uint)(data.Length / formatSize); for (int i = 0; i < size; i++) { ColosseumPokemon colopkm = new ColosseumPokemon(ByteHelper.SubByteArray(i * formatSize, data, formatSize)); if (colopkm.DexID != 0 && colopkm.Experience != 0) { if (colopkm.IsValid) { Add(colopkm); } else { Add(ColosseumPokemon.CreateInvalidPokemon(colopkm)); } this[Count - 1].PokeContainer = container; } else { Add(null); } } } else if (formatType == PokemonFormatTypes.Gen3XD) { formatSize = 196; if (data.Length % formatSize != 0) { throw new Exception("Pokemon Storage data size for XD should be divisible by 196"); } this.size = (uint)(data.Length / formatSize); for (int i = 0; i < size; i++) { XDPokemon xdpkm = new XDPokemon(ByteHelper.SubByteArray(i * formatSize, data, formatSize)); if (xdpkm.DexID != 0 && xdpkm.Experience != 0) { if (xdpkm.IsValid) { Add(xdpkm); } else { Add(XDPokemon.CreateInvalidPokemon(xdpkm)); } this[Count - 1].PokeContainer = container; } else { Add(null); } } } }
public BoxPokemon CreateBoxPokemon(bool passFinder = true) { BoxPokemon pkm = new BoxPokemon(); if (passFinder) pkm.PokemonFinder = PokemonFinder; pkm.GameType = GameTypes.PokemonBox; pkm.DeoxysForm = DeoxysForm; pkm.Language = Language; if (pokeContainer != null) { pkm.SendingTrainerID = pokeContainer.GameSave.TrainerID; pkm.SendingSecretID = pokeContainer.GameSave.SecretID; } // Pokemon Info pkm.Personality = Personality; pkm.SpeciesID = SpeciesID; pkm.IsSecondAbility2 = IsSecondAbility2; // Met Info pkm.TrainerName = TrainerName; pkm.TrainerGender = TrainerGender; pkm.TrainerID = TrainerID; pkm.SecretID = SecretID; pkm.BallCaughtID = BallCaughtID; pkm.LevelMet = LevelMet; pkm.MetLocationID = MetLocationID; pkm.IsFatefulEncounter = IsFatefulEncounter; pkm.GameOrigin = GameOrigin; // Personalization Info pkm.Nickname = Nickname; pkm.HeldItemID = HeldItemID; pkm.Markings = Markings; // Stats Info pkm.Experience = Experience; pkm.Friendship = Friendship; pkm.HPEV = HPEV; pkm.AttackEV = AttackEV; pkm.DefenseEV = DefenseEV; pkm.SpeedEV = SpeedEV; pkm.SpAttackEV = SpAttackEV; pkm.SpDefenseEV = SpDefenseEV; pkm.HPIV = HPIV; pkm.AttackIV = AttackIV; pkm.DefenseIV = DefenseIV; pkm.SpeedIV = SpeedIV; pkm.SpAttackIV = SpAttackIV; pkm.SpDefenseIV = SpDefenseIV; // Status Info pkm.StatusCondition = StatusConditionFlags.None; pkm.TurnsOfSleepRemaining = 0; pkm.TurnsOfBadPoison = 0; pkm.PokerusStrain = PokerusStrain; pkm.PokerusDaysRemaining = PokerusDaysRemaining; pkm.PokerusRemaining = PokerusRemaining; // Contest Info pkm.Coolness = Coolness; pkm.Beauty = Beauty; pkm.Cuteness = Cuteness; pkm.Smartness = Smartness; pkm.Toughness = Toughness; pkm.Feel = Feel; pkm.CoolRibbonCount = CoolRibbonCount; pkm.BeautyRibbonCount = BeautyRibbonCount; pkm.CuteRibbonCount = CuteRibbonCount; pkm.SmartRibbonCount = SmartRibbonCount; pkm.ToughRibbonCount = ToughRibbonCount; pkm.HasChampionRibbon = HasChampionRibbon; pkm.HasWinningRibbon = HasWinningRibbon; pkm.HasVictoryRibbon = HasVictoryRibbon; pkm.HasArtistRibbon = HasArtistRibbon; pkm.HasEffortRibbon = HasEffortRibbon; pkm.HasMarineRibbon = HasMarineRibbon; pkm.HasLandRibbon = HasLandRibbon; pkm.HasSkyRibbon = HasSkyRibbon; pkm.HasCountryRibbon = HasCountryRibbon; pkm.HasNationalRibbon = HasNationalRibbon; pkm.HasEarthRibbon = HasEarthRibbon; pkm.HasWorldRibbon = HasWorldRibbon; // Move Info pkm.SetMoveAt(0, GetMoveAt(0)); pkm.SetMoveAt(1, GetMoveAt(1)); pkm.SetMoveAt(2, GetMoveAt(2)); pkm.SetMoveAt(3, GetMoveAt(3)); pkm.Checksum = pkm.CalculateChecksum(); // Recalculate Stats to make sure they're accurate pkm.RecalculateStats(); return pkm; }