Example #1
0
 void infoObservable_HandleNewPokemonLocation(MapPokemon mapPokemon)
 {
     Invoke(new MethodInvoker(() =>
     {
         if (!_pokemonMarks.ContainsKey(mapPokemon.SpawnPointId))
         {
             GMarkerGoogle pokemonMarker;
             Bitmap pokebitMap = PokeImgManager.GetPokemonMediumImage(mapPokemon.PokemonId);
             if (pokebitMap != null)
             {
                 var ImageSize = new System.Drawing.Size(pokebitMap.Width, pokebitMap.Height);
                 pokemonMarker = new GMarkerGoogle(new PointLatLng(mapPokemon.Latitude, mapPokemon.Longitude), pokebitMap)
                 {
                     Offset = new System.Drawing.Point(-ImageSize.Width / 2, -ImageSize.Height / 2)
                 };
             }
             else
             {
                 pokemonMarker = new GMarkerGoogle(new PointLatLng(mapPokemon.Latitude, mapPokemon.Longitude), GMarkerGoogleType.green_small);
             }
             var expriationTime = StringUtils.TimeMStoString(mapPokemon.ExpirationTimestampMs, "mm:ss");
             Logger.Debug("nExpires in: " + expriationTime);
             var address = LocationUtils.FindAddress(mapPokemon.Latitude, mapPokemon.Longitude);
             pokemonMarker.ToolTipText  = th.TS("{0}\nExpires in: {1}\n{2}\n{3},{4}", new object[] { mapPokemon.PokemonId, expriationTime, address, mapPokemon.Latitude, mapPokemon.Longitude });
             pokemonMarker.ToolTip.Font = new Font("Arial", 12, GraphicsUnit.Pixel);
             pokemonMarker.ToolTipMode  = MarkerTooltipMode.OnMouseOver;
             _pokemonMarks.Add(mapPokemon.SpawnPointId, pokemonMarker);
             _pokemonOverlay.Markers.Add(pokemonMarker);
         }
     }));
 }
Example #2
0
        void comboBox1_SelectedValueChanged(object sender, EventArgs e)
        {
            var pokeId = PokemonId.Missingno;

            Enum.TryParse <PokemonId>(comboBox1.SelectedValue.ToString(), out pokeId);
            var pokemonImage = PokeImgManager.GetPokemonLargeImage(pokeId);

            PokemonImage.Image = pokemonImage;
        }
        private void createImageList()
        {
            const int imageSize = 50;
            var       imageList = new ImageList {
                ImageSize = new Size(imageSize, imageSize)
            };

            foreach (PokemonId pokemon in Enum.GetValues(typeof(PokemonId)))
            {
                Bitmap pokemonImage = PokeImgManager.GetPokemonLargeImage(pokemon);
                if (pokemonImage != null)
                {
                    imageList.Images.Add(pokemon.ToString(), pokemonImage);
                }
            }
            PokemonListView.SmallImageList = imageList;
            PokemonListView.LargeImageList = imageList;
        }
Example #4
0
        /// <summary>
        /// Gets the image for buddy.
        /// </summary>
        /// <param name="buddyPokemon">The buddy pokemon.</param>
        /// <returns></returns>
        private Image getImageForBuddy(BuddyPokemon buddyPokemon)
        {
            if (pokemons == null)
            {
                return(null);
            }

            if (buddyPokemon == null || buddyPokemon.ToString() == "{ }")
            {
                return(null);
            }
            else
            {
                var buddyPoke = pokemons.FirstOrDefault(x => x.Id == buddyPokemon.Id);
                if (buddyPoke != null)
                {
                    return(PokeImgManager.GetPokemonImagefromResource(buddyPoke.PokemonId, "200"));
                }
                else
                {
                    return(null);
                }
            }
        }
Example #5
0
        private void InfoObservable_HandlePokeGym(POGOProtos.Map.Fort.FortData[] forts)
        {
            Invoke(new MethodInvoker(() =>
            {
                try
                {
                    if (forts.Length > 0)
                    {
                        _pokeGymsOverlay.IsVisibile = false;
                        _pokeGymsOverlay.Markers.Clear();
                        _pokeGymsMarks.Clear();
                        int prevCount = forts.Length;
                        //< var filteredForts = forts;
                        var filteredForts = forts.Where(i => LocationUtils.CalculateDistanceInMeters(Logic.Logic.Instance.BotSettings.DefaultLatitude, Logic.Logic.Instance.BotSettings.DefaultLongitude, i.Latitude, i.Longitude) <= Logic.Logic.Instance.BotSettings.MaxWalkingRadiusInMeters).ToArray();
                        Logger.ColoredConsoleWrite(ConsoleColor.White, string.Format("Got new Gym Count: {0}, unfiltered: {1}", filteredForts.Length, forts.Length));

                        for (int i = filteredForts.Length - 1; i >= 0; i--)
                        {
                            var pokeGym = filteredForts[i];
                            if (pokeGym.Id != null)
                            {
                                var bitmap = Properties.MapData.pokegym;
                                var color  = Color.Black;
                                switch (pokeGym.OwnedByTeam)
                                {
                                case POGOProtos.Enums.TeamColor.Blue:
                                    bitmap = Properties.MapData.pokegym_blue;
                                    color  = Color.Blue;
                                    break;

                                case POGOProtos.Enums.TeamColor.Red:
                                    bitmap = Properties.MapData.pokegym_red;
                                    color  = Color.Red;
                                    break;

                                case POGOProtos.Enums.TeamColor.Yellow:
                                    bitmap = Properties.MapData.pokegym_yellow;
                                    color  = Color.Yellow;
                                    break;
                                }
                                ;

                                var str                   = string.Format("Level:{0} ({1})", GetLevel(pokeGym.GymPoints), pokeGym.GymPoints);
                                var pokeGymMaker          = new GMarkerGoogle(new PointLatLng(pokeGym.Latitude, pokeGym.Longitude), bitmap);
                                pokeGymMaker.ToolTipText  = string.Format("{0}\n{1}, {2}\n{3}", LocationUtils.FindAddress(pokeGym.Latitude, pokeGym.Longitude), pokeGym.Latitude, pokeGym.Longitude, str);
                                pokeGymMaker.ToolTip.Font = new System.Drawing.Font("Arial", 12, System.Drawing.GraphicsUnit.Pixel);
                                pokeGymMaker.ToolTipMode  = MarkerTooltipMode.OnMouseOver;
                                _pokeGymsMarks.Add(pokeGym.Id, pokeGymMaker);
                                _pokeGymsOverlay.Markers.Add(pokeGymMaker);
                                // Show Guard
                                GMarkerGoogle guardPokemonMarker;
                                Bitmap pokebitMap = PokeImgManager.GetPokemonMediumImage(pokeGym.GuardPokemonId);

                                var offsetY = 0;
                                if (pokebitMap != null)
                                {
                                    for (int idx = 0; idx < pokebitMap.Width; idx++)
                                    {
                                        pokebitMap.SetPixel(idx, 0, color);
                                        pokebitMap.SetPixel(idx, pokebitMap.Height - 1, color);
                                    }
                                    for (int idx = 0; idx < pokebitMap.Height; idx++)
                                    {
                                        pokebitMap.SetPixel(0, idx, color);
                                        pokebitMap.SetPixel(pokebitMap.Width - 1, idx, color);
                                    }
                                    var ImageSize      = new System.Drawing.Size(pokebitMap.Width, pokebitMap.Height);
                                    guardPokemonMarker = new GMarkerGoogle(new PointLatLng(pokeGym.Latitude, pokeGym.Longitude), pokebitMap);
                                    offsetY            = 5 - pokebitMap.Height / 2;
                                }
                                else
                                {
                                    guardPokemonMarker = new GMarkerGoogle(new PointLatLng(pokeGym.Latitude, pokeGym.Longitude), GMarkerGoogleType.green_small);
                                }
                                guardPokemonMarker.Offset = new Point(-bitmap.Width / 2 - 8, offsetY - bitmap.Height);
                                _pokeGymsMarks.Add(pokeGym.Id + "-" + pokeGym.GuardPokemonId, guardPokemonMarker);
                                _pokeGymsOverlay.Markers.Add(guardPokemonMarker);
                            }
                            else
                            {
                                Logger.ColoredConsoleWrite(ConsoleColor.DarkRed, string.Format("Ignore this: pokeGym.Id is null."));
                            }
                        }
                        if (!map.Overlays.Contains(_pokeGymsOverlay))
                        {
                            map.Overlays.Add(_pokeGymsOverlay);
                        }
                        _pokeGymsOverlay.IsVisibile = true;
                    }
                    else
                    {
                        Logger.ColoredConsoleWrite(ConsoleColor.DarkRed, string.Format("Ignore this: pokeGym length is 0."));
                    }
                }
                catch (Exception e)
                {
                    Logger.ColoredConsoleWrite(ConsoleColor.DarkRed, "Ignore this: sending exception information to log file.");
                    Logger.AddLog(string.Format("Error in HandlePokeStop: {0}", e.ToString()));
                }
            }));
        }
Example #6
0
        private void InfoObservable_HandleUpdatePokeGym(FortData pokeGym)
        {
            Invoke(new MethodInvoker(() => {
                var bitmap = Properties.MapData.pokegym;
                var color  = Color.Black;
                switch (pokeGym.OwnedByTeam)
                {
                case POGOProtos.Enums.TeamColor.Blue:
                    bitmap = Properties.MapData.pokegym_blue;
                    color  = Color.Blue;
                    break;

                case POGOProtos.Enums.TeamColor.Red:
                    bitmap = Properties.MapData.pokegym_red;
                    color  = Color.Red;
                    break;

                case POGOProtos.Enums.TeamColor.Yellow:
                    bitmap = Properties.MapData.pokegym_yellow;
                    color  = Color.Yellow;
                    break;
                }

                var str                   = string.Format("Level:{0} ({1})", GetLevel(pokeGym.GymPoints), pokeGym.GymPoints);
                var pokeGymMaker          = new GMarkerGoogle(new PointLatLng(pokeGym.Latitude, pokeGym.Longitude), bitmap);
                pokeGymMaker.ToolTipText  = string.Format("{0}\n{1}, {2}\n{3}\nID: {4}", LocationUtils.FindAddress(pokeGym.Latitude, pokeGym.Longitude), pokeGym.Latitude, pokeGym.Longitude, str, pokeGym.Id);
                pokeGymMaker.ToolTip.Font = new System.Drawing.Font("Arial", 12, System.Drawing.GraphicsUnit.Pixel);
                pokeGymMaker.ToolTipMode  = MarkerTooltipMode.OnMouseOver;

                if (_pokeGymsMarks.ContainsKey(pokeGym.Id))
                {
                    var markerToDel = _pokeGymsMarks[pokeGym.Id];
                    if (_pokeGymsOverlay.Markers.Contains(markerToDel))
                    {
                        _pokeGymsOverlay.Markers.Remove(markerToDel);
                    }
                    _pokeGymsMarks.Remove(pokeGym.Id);
                }
                _pokeGymsMarks.Add(pokeGym.Id, pokeGymMaker);
                _pokeGymsOverlay.Markers.Add(pokeGymMaker);

                // Show Guard
                GMarkerGoogle guardPokemonMarker;
                Bitmap pokebitMap = PokeImgManager.GetPokemonMediumImage(pokeGym.GuardPokemonId);

                var offsetY = 0;
                if (pokebitMap != null)
                {
                    for (int idx = 0; idx < pokebitMap.Width; idx++)
                    {
                        pokebitMap.SetPixel(idx, 0, color);
                        pokebitMap.SetPixel(idx, pokebitMap.Height - 1, color);
                    }
                    for (int idx = 0; idx < pokebitMap.Height; idx++)
                    {
                        pokebitMap.SetPixel(0, idx, color);
                        pokebitMap.SetPixel(pokebitMap.Width - 1, idx, color);
                    }
                    var ImageSize      = new System.Drawing.Size(pokebitMap.Width, pokebitMap.Height);
                    guardPokemonMarker = new GMarkerGoogle(new PointLatLng(pokeGym.Latitude, pokeGym.Longitude), pokebitMap);
                    offsetY            = 5 - pokebitMap.Height / 2;
                }
                else
                {
                    guardPokemonMarker = new GMarkerGoogle(new PointLatLng(pokeGym.Latitude, pokeGym.Longitude), GMarkerGoogleType.green_small);
                }
                guardPokemonMarker.Offset = new Point(-bitmap.Width / 2 - 8, offsetY - bitmap.Height);

                if (_pokeGymsMarks.ContainsKey(pokeGym.Id + "-" + pokeGym.GuardPokemonId))
                {
                    var markerToDel = _pokeGymsMarks[pokeGym.Id + "-" + pokeGym.GuardPokemonId];
                    if (_pokeGymsOverlay.Markers.Contains(markerToDel))
                    {
                        _pokeGymsOverlay.Markers.Remove(markerToDel);
                    }
                    _pokeGymsMarks.Remove(pokeGym.Id + "-" + pokeGym.GuardPokemonId);
                }
                _pokeGymsMarks.Add(pokeGym.Id + "-" + pokeGym.GuardPokemonId, guardPokemonMarker);
                _pokeGymsOverlay.Markers.Add(guardPokemonMarker);
            }));
        }
Example #7
0
        void infoObservable_HandleNewPokemonLocations(List <DataCollector.PokemonMapData> mapData)
        {
            Invoke(new MethodInvoker(() =>
            {
                try
                {
                    //if (pokemonLock.WaitOne(5000))
                    //{
                    if (mapData.Count > 0)
                    {
                        //_pokemonOverlay = new GMapOverlay("Pokemon");
                        _pokemonMarks.Clear();
                        _pokemonOverlay.Markers.Clear();
                        _pokemonOverlay.IsVisibile = false;

                        int prevCount = mapData.Count;
                        //mapData.Where(x => x.Id == null && x.Coordinates.Latitude.HasValue && x.Coordinates.Longitude.HasValue).ToList().ForEach(x => x.Id = x.PokemonId.ToString() + x.Coordinates.Longitude.Value + +x.Coordinates.Latitude.Value);
                        mapData = mapData.Where(x => x.Id != null).ToList();

                        //Logger.ColoredConsoleWrite(ConsoleColor.White, string.Format("Got new Pokemon Count: {0}, unfiltered: {1}", mapData.Count, prevCount));

                        for (int i = mapData.Count - 1; i >= 0; i--)
                        {
                            var pokeData = mapData[i];
                            GMarkerGoogle pokemonMarker;
                            if (pokeData.Type == DataCollector.PokemonMapDataType.Nearby)
                            {
                                pokemonMarker = new GMarkerGoogle(new PointLatLng(pokeData.Coordinates.Latitude.Value, pokeData.Coordinates.Longitude.Value), GMarkerGoogleType.black_small);
                            }
                            else
                            {
                                Bitmap pokebitMap = PokeImgManager.GetPokemonMediumImage(pokeData.PokemonId);
                                if (pokebitMap != null)
                                {
                                    var ImageSize = new System.Drawing.Size(pokebitMap.Width, pokebitMap.Height);
                                    pokemonMarker = new GMarkerGoogle(new PointLatLng(pokeData.Coordinates.Latitude.Value, pokeData.Coordinates.Longitude.Value), pokebitMap)
                                    {
                                        Offset = new System.Drawing.Point(-ImageSize.Width / 2, -ImageSize.Height / 2)
                                    };
                                }
                                else
                                {
                                    pokemonMarker = new GMarkerGoogle(new PointLatLng(pokeData.Coordinates.Latitude.Value, pokeData.Coordinates.Longitude.Value), GMarkerGoogleType.green_small);
                                }
                            }
                            pokemonMarker.ToolTipText  = string.Format("{0}\nExpires at:{1}\n{2}\n{3},{4}", StringUtils.getPokemonNameByLanguage(null, pokeData.PokemonId), pokeData.ExpiresAt.ToString(), FindAddress(pokeData.Coordinates.Latitude.Value, pokeData.Coordinates.Longitude.Value), pokeData.Coordinates.Latitude.Value, pokeData.Coordinates.Longitude.Value);
                            pokemonMarker.ToolTip.Font = new System.Drawing.Font("Arial", 12, System.Drawing.GraphicsUnit.Pixel);
                            pokemonMarker.ToolTipMode  = MarkerTooltipMode.OnMouseOver;
                            _pokemonMarks.Add(pokeData.Id, pokemonMarker);
                            _pokemonOverlay.Markers.Add(pokemonMarker);
                        }
                    }
                    if (!map.Overlays.Contains(_pokemonOverlay))
                    {
                        map.Overlays.Add(_pokemonOverlay);
                    }
                    _pokemonOverlay.IsVisibile = true;    //cbShowPokemon.Checked;
                    //}
                }
                catch (Exception e)
                {
                    Logger.ColoredConsoleWrite(ConsoleColor.DarkRed, "Ignore this: sending exception information to log file.");
                    Logger.AddLog(string.Format("Error in HandleNewPokemonLocations: {0}", e.ToString()));
                }
            }));
        }
Example #8
0
        void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            var pokemonImage = PokeImgManager.GetPokemonVeryLargeImage((PokemonId)comboBox1.SelectedValue);

            PokemonImage.Image = pokemonImage;
        }