public ExtractedGame(IGameExtractor extractor) { MoveList = extractor.ExtractMoves(); Abilities = extractor.ExtractAbilities(); PokemonList = extractor.ExtractPokemon(); GiftPokemonList = extractor.ExtractGiftPokemon(); ItemList = extractor.ExtractItems(); OverworldItemList = extractor.ExtractOverworldItems(); Pokemarts = extractor.ExtractPokemarts().OrderBy(m => m.FirstItemIndex).ToArray(); TrainerPools = extractor.ExtractPools(PokemonList, MoveList); ValidMoves = MoveList.Where(m => m.MoveIndex != 0 && m.MoveIndex != 355).ToArray(); ValidPokemon = PokemonList.Where(p => !RandomizerConstants.SpecialPokemon.Contains(p.Index)).ToArray(); ValidItems = ItemList.Where(i => !RandomizerConstants.InvalidItemList.Contains(i.Index)).ToArray(); NonKeyItems = ValidItems.Where(i => i.BagSlot != BagSlots.KeyItems && i.BagSlot != BagSlots.None).ToArray(); TMs = ItemList.Where(i => i is TM).Select(i => i as TM).ToArray(); if (extractor is XDExtractor xd) { isXD = true; TutorMoves = xd.ExtractTutorMoves(); } else { isXD = false; TutorMoves = Array.Empty <TutorMove>(); } }
public void PopulateData(byte[] InputData, int savindex) { SaveData = new byte[InputData.Length]; Array.Copy(InputData, SaveData, InputData.Length); PokemonList PL = new PokemonList(); SaveGames.SaveStruct SaveGame = new SaveGames.SaveStruct("XY"); if (savindex > 1) { savindex = 0; } for (int BoxNum = 0; BoxNum < 31; BoxNum++) { int boxoffset = 0x27A00 + 0x7F000 * savindex + BoxNum * (0xE8 * 30); for (int SlotNum = 0; SlotNum < 30; SlotNum++) { int offset = boxoffset + 0xE8 * SlotNum; byte[] slotdata = new Byte[0xE8]; Array.Copy(SaveData, offset, slotdata, 0, 0xE8); byte[] dslotdata = PKX.decryptArray(slotdata); PKX pkm = new PKX(dslotdata); if ((pkm.EC == "00000000") && (pkm.Species == "---")) { continue; } PL.Add(pkm); } } dgData.DataSource = PL; dgData.AutoGenerateColumns = true; }
public void DeletePokemon() { if (selectedPokemon >= 0 && selectedPokemon < PokemonList.Count) { PokemonList.RemoveAt(selectedPokemon); OnPropertyChanged("PokemonList"); } }
public Pokemon SearchScrollPokemon(string pokemon) { if (!string.IsNullOrWhiteSpace(pokemon)) { var results = Pokedex.Where(x => x.name.english.ToLower().Contains(pokemon.ToLower())); return(results.FirstOrDefault()); } return(PokemonList.First()); }
// Use this for initialization void Start() { pokemonList = new PokemonList(); chenipanSpell.transform.Find("WaterShower").gameObject.SetActive(false); ptitardSpell.transform.Find("WaterShower").gameObject.SetActive(false); fantominusSpell.gameObject.SetActive(false); voltorbeSpell.gameObject.SetActive(false); spellList = new List <GameObject> (); }
public void AddPokemon(Pokemon pokemon) { if (pokemon.IsEvent != IsEvent || !PokemonList.Contains(pokemon.PokemonId)) { // Pokemon is does not match isEvent for instance or Pokemon Id not in pokemon IV list return; } lock (_queueLock) { if (_pokemonQueue.Find(x => x.Id == pokemon.Id) != null) { // Queue already contains pokemon return; } } if (pokemon.ExpireTimestamp <= DateTime.UtcNow.ToTotalSeconds()) { // Pokemon already expired return; } // Check if Pokemon is within any of the instance area geofences if (!GeofenceService.InMultiPolygon(MultiPolygon, pokemon.Latitude, pokemon.Longitude)) { return; } lock (_queueLock) { var index = LastIndexOf(pokemon.PokemonId); if (_pokemonQueue.Count >= IVQueueLimit && index == null) { _logger.LogDebug($"[IVController] [{Name}] Queue is full!"); } else if (_pokemonQueue.Count >= IVQueueLimit) { if (index != null) { // Insert Pokemon at index _pokemonQueue.Insert(index ?? 0, pokemon); // Remove last pokemon from queue _pokemonQueue.Remove(_pokemonQueue.LastOrDefault()); } } else if (index != null) { _pokemonQueue.Insert(index ?? 0, pokemon); } else { _pokemonQueue.Add(pokemon); } } }
public void PopulateData(byte[] InputData, int savindex, int baseoffset) { SaveData = new byte[InputData.Length]; Array.Copy(InputData, SaveData, InputData.Length); PokemonList PL = new PokemonList(); PKX.Structures.SaveGame SaveGame = new PKX.Structures.SaveGame("XY"); if (savindex > 1) { savindex = 0; } BoxBar.Maximum = 930 + 100; BoxBar.Step = 1; for (int BoxNum = 0; BoxNum < 31; BoxNum++) { int boxoffset = baseoffset + 0x7F000 * savindex + BoxNum * (0xE8 * 30); for (int SlotNum = 0; SlotNum < 30; SlotNum++) { BoxBar.PerformStep(); int offset = boxoffset + 0xE8 * SlotNum; byte[] slotdata = new byte[0xE8]; Array.Copy(SaveData, offset, slotdata, 0, 0xE8); byte[] dslotdata = PKX.decryptArray(slotdata); if (BitConverter.ToUInt16(dslotdata, 0x8) == 0) { continue; } string Identifier = String.Format("B{0}:{1}", BoxNum.ToString("00"), SlotNum.ToString("00")); PKX pkm = new PKX(dslotdata, Identifier); if ((pkm.EC == "00000000") && (pkm.Species == "---")) { continue; } PL.Add(pkm); } } dgData.DataSource = PL; dgData.AutoGenerateColumns = true; BoxBar.Maximum = 930 + dgData.Columns.Count; for (int i = 0; i < dgData.Columns.Count; i++) { BoxBar.PerformStep(); if (dgData.Columns[i] is DataGridViewImageColumn) { continue; // Don't add sorting for Sprites } dgData.Columns[i].SortMode = DataGridViewColumnSortMode.Automatic; } BoxBar.Visible = false; }
public void AddPokemon() { try { PokemonList.Add(new Pokemon(PokemonName, PokemonType, new Statistics(Int32.Parse(PokemonHP), Int32.Parse(PokemonATK), Int32.Parse(PokemonDEF)), PokemonEvolutionList)); } catch (Exception e) { MessageBox.Show(e.ToString()); } this.CloseWindow(); }
public void PopulateData(byte[] InputData, int BoxDataOffset) { SaveData = (byte[])InputData.Clone(); PokemonList PL = new PokemonList(); BoxBar.Maximum = 930 + 100; BoxBar.Step = 1; for (int BoxNum = 0; BoxNum < 31; BoxNum++) { int boxoffset = BoxDataOffset + BoxNum * (0xE8 * 30); for (int SlotNum = 0; SlotNum < 30; SlotNum++) { BoxBar.PerformStep(); int offset = boxoffset + 0xE8 * SlotNum; byte[] slotdata = new byte[0xE8]; Array.Copy(SaveData, offset, slotdata, 0, 0xE8); byte[] dslotdata = PKX.decryptArray(slotdata); if (BitConverter.ToUInt16(dslotdata, 0x8) == 0) { continue; } string Identifier = String.Format("B{0}:{1}", (BoxNum + 1).ToString("00"), (SlotNum + 1).ToString("00")); PK6 pkm = new PK6(dslotdata, Identifier); if ((pkm.EncryptionConstant == 0) && (pkm.Species == 0)) { continue; } if (pkm.Checksum != pkm.CalculateChecksum()) { continue; } PL.Add(new Preview(pkm)); } } dgData.DataSource = PL; dgData.AutoGenerateColumns = true; BoxBar.Maximum = 930 + dgData.Columns.Count; for (int i = 0; i < dgData.Columns.Count; i++) { BoxBar.PerformStep(); if (dgData.Columns[i] is DataGridViewImageColumn) { continue; // Don't add sorting for Sprites } dgData.Columns[i].SortMode = DataGridViewColumnSortMode.Automatic; } BoxBar.Visible = false; }
public async Task <PokemonList> GetPokemons_List() { // Get list of Pokemon names var results = await _pokemonRepository.GetPokemons_List(); if (results == null || results.Count <= 0) { return(null); } PokemonList listObj = new PokemonList() { Names = results }; return(listObj); }
public async Task <PokemonList> GetPokemons_List_ByType(string typeName) { // Get list of Pokemon names, filter by type var results = await _pokemonRepository.GetPokemons_List_ByType(typeName); if (results == null || results.Count <= 0) { return(null); } PokemonList listObj = new PokemonList() { Names = results }; return(listObj); }
private int?LastIndexOf(uint pokemonId) { var targetPriority = PokemonList.IndexOf(pokemonId); lock (_queueLock) { for (var i = 0; i < _pokemonQueue.Count; i++) { var pokemon = _pokemonQueue[i]; var priority = PokemonList.IndexOf(pokemon.PokemonId); if (targetPriority < priority) { return(i); } } } return(null); }
public void PopulateData(PK6[] data) { BoxBar.Step = 1; PokemonList PL = new PokemonList(); foreach (PK6 p in data) { PL.Add(new Preview(p)); } dgData.DataSource = PL; dgData.AutoGenerateColumns = true; BoxBar.Maximum = data.Length + dgData.Columns.Count; for (int i = 0; i < dgData.Columns.Count; i++) { BoxBar.PerformStep(); if (dgData.Columns[i] is DataGridViewImageColumn) { continue; // Don't add sorting for Sprites } dgData.Columns[i].SortMode = DataGridViewColumnSortMode.Automatic; } BoxBar.Visible = false; }
async Task ItemClick(PokeType type) { var pokePage = new PokemonList(type); await Navigation.PushAsync(pokePage); }
public PokemonRegionViewModel(INavigationService navigationService, IAPIService apiService, IGruposRegionRepository gruposRegionRepository, IGrupoPokemonsRepository grupoPokemonsRepository) : base(navigationService) { _apiService = apiService; _navigationService = navigationService; _gruposRegionRepository = gruposRegionRepository; _grupoPokemonsRepository = grupoPokemonsRepository; #region Commands Logic CancelCreation = new Command(async() => { await _navigationService.GoBackAsync(); }); SaveGroup = new Command(async() => { try { UserDialogs.Instance.ShowLoading(null, MaskType.None); //validate pokemons number if (PokemonsCounter < 3 || PokemonsCounter > 6) { UserDialogs.Instance.HideLoading(); await App.Current.MainPage.DisplayAlert("Error", "You must add at min. 3 pokemons or max. 6 pokemons", "ok"); return; } var result1 = false; var result2 = false; if (CrossConnectivity.Current.IsConnected) { if (IsCreate) { //Create Group group first var group = new GruposRegion { GrupoId = await _gruposRegionRepository.GetLastID() + 1, GrupoName = GroupName, GrupoTipo = GroupType, PokedexDescription = PokedexDescription, Image = "", Region = PokedexInfo.FirstOrDefault().name, UserId = await SecureStorage.GetAsync("UserId"), Token = Convert.ToBase64String(Guid.NewGuid().ToByteArray()), GrupoIdFather = null }; result1 = await _gruposRegionRepository.SaveData(group); if (result1) { //then we add pokemons related var data = PokemonList.Where(x => x.IsSelected).Select(x => new GrupoPokemons { GroupId = group.GrupoId, Pokemon = x.name }); result2 = await _grupoPokemonsRepository.SaveDataRange(data); } if (result1 && result2) { await App.Current.MainPage.DisplayAlert("Success", "Your group was created successfully", "ok"); var navigationParams = new NavigationParameters(); navigationParams.Add("RegionName", group.Region); await navigationService.GoBackAsync(navigationParams); } else { UserDialogs.Instance.HideLoading(); ErrorAlert(); await navigationService.GoBackAsync(); } } else { GruposRegion.GrupoName = GroupName; GruposRegion.GrupoTipo = GroupType; GruposRegion.PokedexDescription = PokedexDescription; result1 = await _gruposRegionRepository.UpdateData(GruposRegion); if (result1) { //then we add pokemons related and delete pokemons non related var oldValues = (await _grupoPokemonsRepository.GetDataByGrupoId(GruposRegion.GrupoId)).ToList(); var data = PokemonList.Where(x => x.IsSelected).Select(x => new GrupoPokemons { GroupId = GruposRegion.GrupoId, Pokemon = x.name }); //if old data does not appear, it means it was no unselected foreach (var item in oldValues) { if (!data.Select(x => x.Pokemon).Contains(item.Pokemon)) { await _grupoPokemonsRepository.DeleteData(item.Id, string.Empty, string.Empty); } } //if new data does not appear, it means it must be added foreach (var item in data) { if (!oldValues.Select(x => x.Pokemon).Contains(item.Pokemon)) { item.Id = await _gruposRegionRepository.GetLastID() + 1; await _grupoPokemonsRepository.SaveData(item); } } result2 = true; } if (result1 && result2) { UserDialogs.Instance.HideLoading(); await App.Current.MainPage.DisplayAlert("Success", "Your group was modified successfully", "ok"); var navigationParams = new NavigationParameters(); navigationParams.Add("GrupoId", GruposRegion.GrupoId); await navigationService.GoBackAsync(navigationParams); } else { UserDialogs.Instance.HideLoading(); ErrorAlert(); await navigationService.GoBackAsync(); } } } else { NoInternetAlert(); } } catch (Exception ex) { ErrorAlert(); await navigationService.GoBackAsync(); } }); #endregion }
static void Main(string[] args) { Console.WriteLine($"Hewwo Fizztopia, FILES ARE AT {System.IO.Path.GetFullPath(PathToFiles)}"); var logPath = $@"{PathToFiles}\output\log.txt"; Console.WriteLine($@"Outputting log to {logPath}"); File.WriteAllText(logPath, string.Empty); FileStream logStream = new FileStream(logPath, FileMode.OpenOrCreate, FileAccess.Write); StreamWriter logWriter = new StreamWriter(logStream); Console.SetOut(logWriter); var pokemonList = new PokemonList(); var basePokemonList = BasePokemonList.ParseJson(File.ReadAllText($@"{PathToFiles}\helperData\BasePokemonList.json")); var alternateFormList = AlternateFormList.ParseJson(File.ReadAllText($@"{PathToFiles}\helperData\AlternateFormList.json")); var evolutionList = EvolutionList.ParseJson(File.ReadAllText($@"{PathToFiles}\helperData\EvolutionList.json")); var spellingFixes = SpellingFixes.ParseJson(File.ReadAllText($@"{PathToFiles}\helperData\SpellingFixes.json")); pokemonList.InitFromBaseList(basePokemonList); pokemonList.ParseAltFormData(alternateFormList); // Console.WriteLine(JsonConvert.SerializeObject(pokemonList, Formatting.Indented)); Console.WriteLine("Processing Veekun Files..."); foreach (var filePath in Directory.GetFiles($@"{PathToFiles}\rawData", "veekun*.json")) { Console.WriteLine(filePath); var veekunPokemon = VeekunPokemonList.ParseJson(File.ReadAllText(filePath)); Console.WriteLine("Processing Spelling Fixes"); foreach (var moveFix in spellingFixes.MoveFixes) { veekunPokemon.Pokemon.ForEach(p => { if (p.LevelUpMoves != null) { p.LevelUpMoves.FindAll( m => m.Name.Equals(moveFix.OldName, StringComparison.InvariantCultureIgnoreCase) ).ToList().ForEach(m => { Console.WriteLine($"{p.DexNum}: Fixing {m.Name} to {moveFix.NewName}"); m.Name = moveFix.NewName; }); } if (p.EggMoves != null) { p.EggMoves.FindAll( m => m.Name.Equals(moveFix.OldName, StringComparison.InvariantCultureIgnoreCase) ).ToList().ForEach(m => { Console.WriteLine($"{p.DexNum}: Fixing {m.Name} to {moveFix.NewName}"); m.Name = moveFix.NewName; }); } if (p.TutorMoves != null) { p.TutorMoves.FindAll( m => m.Name.Equals(moveFix.OldName, StringComparison.InvariantCultureIgnoreCase) ).ToList().ForEach(m => { Console.WriteLine($"{p.DexNum}: Fixing {m.Name} to {moveFix.NewName}"); m.Name = moveFix.NewName; }); } if (p.MachineMoves != null) { p.MachineMoves.FindAll( m => m.Name.Equals(moveFix.OldName, StringComparison.InvariantCultureIgnoreCase) ).ToList().ForEach(m => { Console.WriteLine($"{p.DexNum}: Fixing {m.Name} to {moveFix.NewName}"); m.Name = moveFix.NewName; }); } }); } pokemonList.ParseVeekunPokemonList(veekunPokemon, filePath); } Console.WriteLine("Processing Serebii Files..."); foreach (var filePath in Directory.GetFiles($@"{PathToFiles}\rawData", "serebii*.json")) { Console.WriteLine(filePath); Console.WriteLine("Processing Spelling Fixes"); var serebiiPokemon = SerebiiPokemonList.ParseJson(File.ReadAllText(filePath)); foreach (var moveFix in spellingFixes.MoveFixes) { serebiiPokemon.Pokemon.ForEach(p => { if (p.LevelUpMoves != null) { p.LevelUpMoves.FindAll( m => m.Name.Equals(moveFix.OldName, StringComparison.InvariantCultureIgnoreCase) ).ToList().ForEach(m => { Console.WriteLine($"{p.DexNum}: Fixing {m.Name} to {moveFix.NewName}"); m.Name = moveFix.NewName; }); } if (p.AlolanFormLevelUpMoves != null) { p.AlolanFormLevelUpMoves.FindAll( m => m.Name.Equals(moveFix.OldName, StringComparison.InvariantCultureIgnoreCase) ).ToList().ForEach(m => { Console.WriteLine($"{p.DexNum}: Fixing {m.Name} to {moveFix.NewName}"); m.Name = moveFix.NewName; }); } if (p.GalarianFormLevelUpMoves != null) { p.GalarianFormLevelUpMoves.FindAll( m => m.Name.Equals(moveFix.OldName, StringComparison.InvariantCultureIgnoreCase) ).ToList().ForEach(m => { Console.WriteLine($"{p.DexNum}: Fixing {m.Name} to {moveFix.NewName}"); m.Name = moveFix.NewName; }); } if (p.AltForms != null) { p.AltForms.ForEach(altForm => altForm.LevelUpMoves.FindAll( m => m.Name.Equals(moveFix.OldName, StringComparison.InvariantCultureIgnoreCase) ).ToList().ForEach(m => { Console.WriteLine($"{p.DexNum}: Fixing {m.Name} to {moveFix.NewName}"); m.Name = moveFix.NewName; })); } if (p.EggMoves != null) { p.EggMoves.FindAll( m => m.Name.Equals(moveFix.OldName, StringComparison.InvariantCultureIgnoreCase) ).ToList().ForEach(m => { Console.WriteLine($"{p.DexNum}: Fixing {m.Name} to {moveFix.NewName}"); m.Name = moveFix.NewName; }); } if (p.TutorMoves != null) { p.TutorMoves.FindAll( m => m.Name.Equals(moveFix.OldName, StringComparison.InvariantCultureIgnoreCase) ).ToList().ForEach(m => { Console.WriteLine($"{p.DexNum}: Fixing {m.Name} to {moveFix.NewName}"); m.Name = moveFix.NewName; }); } if (p.MachineMoves != null) { p.MachineMoves.FindAll( m => m.Name.Equals(moveFix.OldName, StringComparison.InvariantCultureIgnoreCase) ).ToList().ForEach(m => { Console.WriteLine($"{p.DexNum}: Fixing {m.Name} to {moveFix.NewName}"); m.Name = moveFix.NewName; }); } }); } var isSwSh = filePath.Contains("swsh"); pokemonList.ParseSerebiiPokemonList(serebiiPokemon, isSwSh, filePath); } Console.WriteLine("Processing Form Name Fixes"); { Dictionary <string, int> fixCount = new Dictionary <string, int>(); spellingFixes.FormFixes.ForEach(fix => fixCount[fix.NewName] = 0); pokemonList.Pokemon.ForEach(p => { var forms = new List <string> { p.DefaultForm }; forms.AddRange(p.AltForms); foreach (var fix in forms.Join(spellingFixes.FormFixes.Where(fix => fix.DexNum == 0 || fix.DexNum == p.DexNum), f => f, fix => fix.OldName, (f, fix) => fix)) { Console.WriteLine($"Fixing {fix.OldName} to {fix.NewName} in {p.Name}"); fixCount[fix.NewName]++; { var index = p.AltForms.FindIndex(f => f == fix.OldName); if (index != -1) { p.AltForms[index] = fix.NewName; } else { p.DefaultForm = fix.NewName; } } p.LevelUpMoveLists.Find(l => l.Form == fix.OldName).Form = fix.NewName; p.EggMoves.ForEach(m => { var index = m.Forms.FindIndex(f => f == fix.OldName); if (index != -1) { m.Forms[index] = fix.NewName; } }); p.TutorMoves.ForEach(m => { var index = m.Forms.FindIndex(f => f == fix.OldName); if (index != -1) { m.Forms[index] = fix.NewName; } }); p.MachineMoves.ForEach(m => { var index = m.Forms.FindIndex(f => f == fix.OldName); if (index != -1) { m.Forms[index] = fix.NewName; } }); } }); foreach (var(k, v) in fixCount) { Console.WriteLine($"Fixed {k} {v} time(s)"); } } Console.WriteLine("Processing Missing Evolution Moves"); pokemonList.ParseEvolutionMissingMoves(evolutionList); Console.WriteLine("Processing Missing Evolution Moves AGAIN (Should be no output)"); pokemonList.ParseEvolutionMissingMoves(evolutionList); Console.WriteLine("Processing Alt Forms with One Additional Move"); pokemonList.ParseAltFormsWithOneAdditionalMoveList(alternateFormList.AltFormsWithSingleAdditionalMove); Console.WriteLine($@"Placing output in {PathToFiles}\output\pokemonMoveList.json"); Directory.CreateDirectory($@"{PathToFiles}\output"); File.WriteAllText($@"{PathToFiles}\output\pokemonMoveList.json", JsonConvert.SerializeObject(pokemonList, Formatting.Indented)); Console.Out.Flush(); }
public void Prepare() { StaticSQL.SetConnectionString("Server=DESKTOP-6CLE20J\\SQLEXPRESS;Database=Pokemon;Trusted_Connection=true;"); PokemonList.Pokemons.Clear(); PokemonList.FillPokemonList(); }