private void button1_Click(object sender, EventArgs e) { GlobalVars.latitude = map.Position.Lat; GlobalVars.longitude = map.Position.Lng; GlobalVars.altitude = LocationUtils.GetAltitude(map.Position.Lat, map.Position.Lng); GlobalVars.radius = (int)nudRadius.Value; close = false; }
public void Execute(PokemonId pokeid, GeoCoordinate remoteCoords) { var returnCoords = new GeoCoordinate(); returnCoords.Latitude = _client.CurrentLatitude; returnCoords.Longitude = _client.CurrentLongitude; returnCoords.Altitude = _client.CurrentAltitude; var distanceToTarget = LocationUtils.CalculateDistanceInMeters(returnCoords, remoteCoords); if (distanceToTarget > 100000) { Logger.Warning("Distance greater than 100 kms. Skipping Snipe."); return; } //LocationUtils.updatePlayerLocation(_client, returnCoords.Latitude, returnCoords.Longitude, returnCoords.Altitude); if (_botSettings == null && _client == null) { SendToLog($" client or settings are not set"); return; } try { remoteCoords.Altitude = LocationUtils.GetAltitude(remoteCoords.Latitude, remoteCoords.Longitude); SendToLog($"Trying to capture {pokeid} at { remoteCoords.Latitude } / {remoteCoords.Longitude}"); SendToLog(LocationUtils.FindAddress(remoteCoords.Latitude, remoteCoords.Longitude)); LocationUtils.updatePlayerLocation(_client, remoteCoords.Latitude, remoteCoords.Longitude, remoteCoords.Altitude, false); var gmp = _client.Map.GetMapObjects(true).Result; SendToLog($"We are at sniping location..."); SendToLog($"Waiting {GlobalVars.SnipeOpts.WaitSecond} seconds for Pokemon to appear..."); RandomHelper.RandomSleep(GlobalVars.SnipeOpts.WaitSecond * 1000); var catchedID = 0UL; if (pokeid == PokemonId.Missingno) { catchedID = TrySnipeGym(remoteCoords, returnCoords); } else { RandomHelper.RandomSleep(1000); catchedID = TrySnipePokemons(pokeid, remoteCoords, returnCoords); } LocationUtils.updatePlayerLocation(_client, returnCoords.Latitude, returnCoords.Longitude, returnCoords.Altitude); gmp = _client.Map.GetMapObjects(true).Result; SendToLog($"Location after Snipe : {_client.CurrentLatitude} / {_client.CurrentLongitude} / {_client.CurrentAltitude}"); SendToLog(LocationUtils.FindAddress(_client.CurrentLatitude, _client.CurrentLongitude)); if ((catchedID > 0) && GlobalVars.SnipeOpts.TransferIt && pokeid != PokemonId.Missingno) { var trResult = Logic.objClient.Inventory.ReleasePokemon(catchedID); if (trResult.Result == ReleasePokemonResponse.Types.Result.Success) { SendToLog("Pokemon was transfered."); SendToLog("Candies awarded: " + trResult.CandyAwarded); } } RandomHelper.RandomSleep(20000, 22000); // Avoid cache after snipe } catch (Exception ex) { Logger.ExceptionInfo(ex.ToString()); SendToLog($"Go to {returnCoords.Latitude} / {returnCoords.Longitude} / {returnCoords.Altitude}."); LocationUtils.updatePlayerLocation(_client, returnCoords.Latitude, returnCoords.Longitude, returnCoords.Altitude); var gmp = _client.Map.GetMapObjects(true).Result; } GlobalVars.SnipeOpts.Enabled = false; GlobalVars.SnipeOpts.ID = PokemonId.Missingno; GlobalVars.SnipeOpts.Location = null; GlobalVars.SnipeOpts.WaitSecond = 6; GlobalVars.SnipeOpts.NumTries = 3; }