List <PokemonData> DatabaseCompiler(string[] Database) { if (PokemonAmount == 0) { return(new List <PokemonData>()); } List <PokemonData> PokemonDatabase = new List <PokemonData>(); foreach (string PokemonData in Database) { PokemonData tempPokemon = new PokemonData(); string Pokemon = PokemonData.TrimStart('('); Pokemon = Pokemon.Replace("\r", ""); Pokemon = Pokemon.Replace("\n", ""); string[] pokemonArray = Pokemon.Split(','); int i = 0; foreach (string stat in pokemonArray) { pokemonArray[i] = stat.Replace("\n", ""); i++; } tempPokemon.PokedexID = pokemonArray[0]; tempPokemon.Name = QuoteRemove(pokemonArray[1]); tempPokemon.Type1 = ToTitleCase(TypeStripper(pokemonArray[2])); tempPokemon.Type2 = ToTitleCase(TypeStripper(pokemonArray[3])); tempPokemon.Ability1 = AbilityCheck(QuoteRemove(pokemonArray[4])); tempPokemon.Ability2 = AbilityCheck(QuoteRemove(pokemonArray[5])); tempPokemon.HiddenAbility = AbilityCheck(QuoteRemove(pokemonArray[6])); tempPokemon.MaleRatio = RemoveLetter(pokemonArray[7], "f"); tempPokemon.CatchRate = Convert.ToInt32(pokemonArray[8].Replace(" ", "")); tempPokemon.EggGroup1 = ToTitleCase(TypeStripper(pokemonArray[9])); tempPokemon.EggGroup2 = ToTitleCase(TypeStripper(pokemonArray[10])); tempPokemon.HatchTime = Convert.ToInt32(pokemonArray[11]); tempPokemon.Height = RemoveLetter(pokemonArray[12], "f"); tempPokemon.Weight = RemoveLetter(pokemonArray[13], "f"); tempPokemon.EvExp = Convert.ToInt32(pokemonArray[14]); tempPokemon.LevelingRate = LevelFixer(TypeStripper(pokemonArray[15])); tempPokemon.EvHP = Convert.ToInt32(pokemonArray[16]); tempPokemon.EvAttack = Convert.ToInt32(pokemonArray[17]); tempPokemon.EvDefense = Convert.ToInt32(pokemonArray[18]); tempPokemon.EvSpecialAttack = Convert.ToInt32(pokemonArray[19]); tempPokemon.EvSpecialDefense = Convert.ToInt32(pokemonArray[20]); tempPokemon.EvSpeed = Convert.ToInt32(pokemonArray[21]); tempPokemon.PokedexColor = ToTitleCase(TypeStripper(pokemonArray[22]).ToLower()); tempPokemon.BaseFriendship = pokemonArray[23].Replace(" ", ""); tempPokemon.Species = QuoteRemove(pokemonArray[24]); int arrayOffset = 0; for (int q = 25; q < int.MaxValue; q++) { try { Convert.ToInt32(pokemonArray[q]); break; } catch (Exception e) { tempPokemon.PokedexEntry += pokemonArray[q]; arrayOffset++; } /*if (!Char.IsDigit(pokemonArray[28].Replace(" ", "")[q])) * { * pokemonArray[26] = pokemonArray[26] + pokemonArray[27].Replace("\"", ""); * pokemonArray = pokemonArray.Where(w => w != pokemonArray[27]).ToArray(); * repeat = true; * break; * } * else if (q == pokemonArray[27].Replace(" ", "").Length - 1) * { * repeat = false; * break; * }*/ } tempPokemon.PokedexEntry = tempPokemon.PokedexEntry.Replace("\"", ""); while (tempPokemon.PokedexEntry[0] == ' ') { tempPokemon.PokedexEntry = tempPokemon.PokedexEntry.Remove(0, 1); } tempPokemon.BaseHP = Convert.ToInt32(pokemonArray[25 + arrayOffset]); tempPokemon.BaseAttack = Convert.ToInt32(pokemonArray[26 + arrayOffset]); tempPokemon.BaseDefense = Convert.ToInt32(pokemonArray[27 + arrayOffset]); tempPokemon.BaseSpecialAttack = Convert.ToInt32(pokemonArray[28 + arrayOffset]); tempPokemon.BaseSpecialDefense = Convert.ToInt32(pokemonArray[29 + arrayOffset]); tempPokemon.BaseSpeed = Convert.ToInt32(pokemonArray[30 + arrayOffset]); tempPokemon.Luminance = RemoveLetter(pokemonArray[31 + arrayOffset], "f"); tempPokemon.LightColor = ToTitleCase(pokemonArray[32 + arrayOffset].Replace("Color.", "")).Replace(" ", ""); pokemonArray[33 + arrayOffset] = pokemonArray[33 + arrayOffset].Replace("new", "").Replace(" ", "").Replace("int", "").Replace("[]", "").Replace("{", ""); int Index = 0; List <int> Levels = new List <int>(); for (int a = 33 + arrayOffset; a < pokemonArray.Length - 1; a++) { try { Levels.Add(Convert.ToInt32(pokemonArray[a].Replace(" ", "").Replace("}", ""))); } catch (FormatException) { Index = a; break; } } int SaveB = 0; pokemonArray[Index] = pokemonArray[Index].Replace("new", "").Replace(" ", "").Replace("string", "").Replace("[]", "").Replace("{", ""); List <string> Moves = new List <string>(); for (int b = Index; b < Index + Levels.Count; b++) { Moves.Add(SpaceBeforeCapital(pokemonArray[b].Replace("\"", "").Replace("}", "").Replace(" ", ""))); SaveB = b; } Index = SaveB + 1; int p = 0; foreach (int Level in Levels) { LevelMove Move = new LevelMove { Level = Level, Move = Moves[p] }; tempPokemon.LevelMoves.Add(Move); p++; } if (pokemonArray[Index].Replace(" ", "") == "}") { Index++; } List <string> HmMoves = new List <string>(); pokemonArray[Index] = pokemonArray[Index].Replace("new", "").Replace("string", "").Replace("[]", "").Replace("{", "").Replace(" ", ""); for (int o = Index; o < pokemonArray.Length - 1; o++) { if (pokemonArray[o].Replace(" ", "").StartsWith("newint[]")) { break; } else { tempPokemon.hmAndTM.Add(SpaceBeforeCapital(pokemonArray[o].Replace("\"", "").Replace(" ", "").Replace("}", "")).Replace("_", " ")); Index++; } } tempPokemon.EvolutionID = pokemonArray[Index].Replace("new", "").Replace(" ", "").Replace("int", "").Replace("[]", "").Replace("{", "").Replace("}", ""); Index++; if (tempPokemon.EvolutionID != "") { tempPokemon.EvolutionMethod = pokemonArray[Index].Replace("new", "").Replace(" ", "").Replace("{", "").Replace("string", "").Replace("[]", "").Replace("\"", ""); Index++; tempPokemon.EvolutionLevel = pokemonArray[Index].Replace("}", "").Replace("\"", "").Replace(")", ""); } else { tempPokemon.EvolutionMethod = ""; tempPokemon.EvolutionLevel = ""; } PokemonDatabase.Add(tempPokemon); Progress.Value++; } return(PokemonDatabase); }
public PokemonData FillPokemonData(int Index) { if (pokemons.Count == 0) { PokemonData NullPokemon = new PokemonData(); pokemons.Add(NullPokemon); } PokemonData Pokemon = pokemons[Index]; //Pokemon Info if (GIFName != "Unknown.png") { Pokemon.Sprite = pokemonIcon.Tag.ToString(); } Pokemon.Name = nameTextBox.Text; Pokemon.PokedexID = pokedexID.Value.ToString(); Pokemon.Type1 = pokemonType1.Text.ToString(); Pokemon.Type2 = pokemonType2.Text.ToString(); Pokemon.Ability1 = pokemonAbility1.Text.ToString(); Pokemon.Ability2 = pokemonAbility2.Text.ToString(); Pokemon.HiddenAbility = pokemonHiddenAbility.Text.ToString(); //Egg Group Pokemon.EggGroup1 = pokemonEggGroup1.Text.ToString(); Pokemon.EggGroup2 = pokemonEggGroup2.Text.ToString(); //Ratio's And Value's Pokemon.MaleRatio = (float)maleRatio.Value; Pokemon.CatchRate = (float)catchRate.Value; Pokemon.HatchTime = Convert.ToInt32(hatchTime.Value); Pokemon.LevelingRate = levelingRate.Text.ToString(); //Pokedex Info Pokemon.Height = (float)height.Value; Pokemon.Weight = (float)weight.Value; Pokemon.PokedexColor = pokedexColor.Text.ToString(); Pokemon.Species = speciesTextBox.Text; Pokemon.BaseFriendship = baseFriendship.Value.ToString(); Pokemon.PokedexEntry = pokedexEntry.Text; if (evolutionID.Value != 0) { Pokemon.EvolutionID = evolutionID.Value.ToString(); } if (evolutionLevel.Value != 0) { Pokemon.EvolutionLevel = evolutionLevel.Value.ToString(); } //Pokemon Unity Extra's Pokemon.Luminance = (float)luminance.Value; if (lightColor.Text == "Transparent") { Pokemon.LightColor = "Clear"; } else { Pokemon.LightColor = lightColor.Text.ToString(); } //Base Stats Pokemon.BaseHP = (int)statsBaseHP.Value; Pokemon.BaseAttack = (int)statsBaseAttack.Value; Pokemon.BaseDefense = (int)statsBaseDefense.Value; Pokemon.BaseSpecialAttack = (int)statsBaseSpecialAttack.Value; Pokemon.BaseSpecialDefense = (int)statsBaseSpecialDefense.Value; Pokemon.BaseSpeed = (int)statsBaseSpeed.Value; //EV Stats Pokemon.EvHP = (int)statsYieldHP.Value; Pokemon.EvAttack = (int)statsYieldAttack.Value; Pokemon.EvDefense = (int)statsYieldDefense.Value; Pokemon.EvSpecialAttack = (int)statsYieldSpecialAttack.Value; Pokemon.EvSpecialDefense = (int)statsYieldSpecialDefense.Value; Pokemon.EvSpeed = (int)statsYieldSpeed.Value; Pokemon.EvExp = (int)statsYieldExp.Value; //Level Moves Pokemon.LevelMoves.Clear(); int i = 0; foreach (DataGridViewRow Row in levelMovesGrid.Rows) { if (levelMovesGrid.Rows[i].Cells["Move"].Value != null && levelMovesGrid.Rows[i].Cells["Level"].Value != null) { if (levelMovesGrid.Rows[i].Cells["Move"].Value == null && levelMovesGrid.Rows[i].Cells["Level"].Value != null) { LevelMove tempLevelMove = new LevelMove { Move = "???", Level = (int)levelMovesGrid.Rows[i].Cells["Level"].Value }; Pokemon.LevelMoves.Add(tempLevelMove); } else if (levelMovesGrid.Rows[i].Cells["Move"].Value != null && levelMovesGrid.Rows[i].Cells["Level"].Value == null) { LevelMove tempLevelMove = new LevelMove { Move = levelMovesGrid.Rows[i].Cells["Move"].Value.ToString(), Level = 999 }; Pokemon.LevelMoves.Add(tempLevelMove); } else { LevelMove tempLevelMove = new LevelMove { Move = levelMovesGrid.Rows[i].Cells["Move"].Value.ToString(), Level = Convert.ToInt32(levelMovesGrid.Rows[i].Cells["Level"].Value) }; Pokemon.LevelMoves.Add(tempLevelMove); } i++; } } Pokemon.hmAndTM.Clear(); int j = 0; foreach (DataGridViewRow Row in tmAndHMGrid.Rows) { if (tmAndHMGrid.Rows[j].Cells[0].Value != null) { Pokemon.hmAndTM.Add(tmAndHMGrid.Rows[j].Cells[0].Value.ToString()); } j++; } return(Pokemon); }