public PogoInstance(InstanceConfiguration configuration) { this.Configuration = configuration; this.Database = new PogoDB(this.Configuration.Name); this.Walker = new Walker(this.Configuration.Name, this.Configuration.WalkingPoints); this.GymHandler = new GymHandler(this); this.PokemonHandler = new PokemonHandler(this); }
private void Map_Update(object sender, EventArgs e) { var map = sender as Map; if (map == null) { return; } var wildPokemons = map.Cells.SelectMany(c => c.WildPokemons).Select(p => new SpawnedPokemon(p, Configuration.Name)); foreach (var pokemon in wildPokemons) { PokemonHandler.HandleSpawnedPokemon(pokemon); } var catchablePokemons = map.Cells.SelectMany(c => c.CatchablePokemons).Select(p => new SpawnedPokemon(p, Configuration.Name)); foreach (var pokemon in catchablePokemons) { PokemonHandler.HandleSpawnedPokemon(pokemon); } if (Configuration.ProcessNearbyPokemon) { var nearbyPokemons = map.Cells.SelectMany(c => c.NearbyPokemons).ToList(); foreach (var pokemon in nearbyPokemons) { PokemonHandler.HandleNearbyPokemon(pokemon); } } if (Configuration.ProcessGyms) { var gyms = map.Cells.SelectMany(x => x.Forts).Where(x => x.Type == FortType.Gym).ToList(); foreach (var gym in gyms) { GymHandler.Handle(gym); } } var nextPosition = Walker.GetNextPosition(); Session.Player.SetCoordinates(nextPosition.Latitude, nextPosition.Longitude); }