private async void SnipePokemon(ItemId pokebolaId, ItemId berryId) { if (!FieldErrorCheck("snipePokemon")) { return; } PokemonId pokemon; Enum.TryParse(Convert.ToString(gridPokemons.CurrentRow.Cells[cName.DisplayIndex].FormattedValue), true, out pokemon); var cLatitudes = Convert.ToDouble(gridPokemons.CurrentRow.Cells[cLatitude.DisplayIndex].FormattedValue); var cLongitudes = Convert.ToDouble(gridPokemons.CurrentRow.Cells[cLongitude.DisplayIndex].FormattedValue); SayLog.Info($"Capturando {pokemon} na localização {cLatitudes},{cLongitudes}. Aguarde!"); try { if (await PogoCatchPokemon.CatchPokemon(pokemon, cLatitudes, cLongitudes, pokebolaId, berryId)) { UpdateLastPokemonCaught(false); } } catch (Exception e) { SayLog.Error(e.Message + e.StackTrace); } }
private async void btnLogin_Click_1(object sender, EventArgs e) { if (!FieldErrorCheck("login")) { return; } try { SayLog.Info("Processo de login iniciado! Isso pode levar alguns segundos, aguarde..."); //Check if account its PTC / Google. if (rbGoogle.Checked) { PogoGlobalSettings.PogoClient = await PogoClient.GetClient(txtPogoUsername.Text, txtPogoPassword.Text, AuthType.Google); } else if (rbPTC.Checked) { PogoGlobalSettings.PogoClient = await PogoClient.GetClient(txtPogoUsername.Text, txtPogoPassword.Text, AuthType.Ptc); } } catch (Exception) { SayLog.Error("Falha no login..."); return; } if (PogoGlobalSettings.PogoClient.Player.PlayerData == null) { SayLog.Fatal( "Infelizmente a conta informada aparenta estar temporariamente suspensa. Tente outra conta."); return; } SayLog.Debug("Logado com sucesso!"); PogoGlobalSettings.PogoClient.Inventory.OnInventoryUpdated += Inventory_OnInventoryUpdated; btnLogout.Enabled = true; btnLogin.Enabled = false; UpdatePlayerStatistic(); timerAtualizaStatus.Enabled = true; //Save settings updated to file UserGlobalConfiguration.Username = txtPogoUsername.Text; UserGlobalConfiguration.Password = txtPogoPassword.Text; if (rbGoogle.Checked) { UserGlobalConfiguration.TypeAcc = AuthType.Google; } else { UserGlobalConfiguration.TypeAcc = AuthType.Ptc; } UserGlobalConfiguration.SaveSettingsFromUser(); }
// DESLOGAR DO JOGO private async void btnDeslogar_Click(object sender, EventArgs e) { if (!PogoGlobalSettings.PogoClient.AccessToken.IsExpired) { //TODO: CANCEL THE HTTP CLIENT SayLog.Info("Deslogando..."); await Task.Delay(3000); //TODO: VERY IF WE LOGOUT WITH SUCESS SayLog.Debug("Deslogado com sucesso!"); btnLogout.Enabled = false; btnLogin.Enabled = true; lblNomeValue.Text = "0"; lblMochilaValue.Text = "0"; lblTimeValue.Text = "0"; lblPokebolasValue.Text = "0"; } }