Skip to content

Commit

Permalink
Merge pull request #432 from skupfer/evolveimprovement
Browse files Browse the repository at this point in the history
EvolveAllPkm Management - Evolve all above certain IV value
  • Loading branch information
NecronomiconCoding authored Jul 24, 2016
2 parents 44f8089 + 9c5e36c commit eab7d63
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 4 deletions.
6 changes: 6 additions & 0 deletions PokemonGo.RocketAPI.Console/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@
<setting name="useLuckyEggsWhileEvolving" serializeAs="String">
<value>False</value>
</setting>
<setting name="EvolveAllPokemonAboveIV" serializeAs="String">
<value>False</value>
</setting>
<setting name="EvolveAboveIVValue" serializeAs="String">
<value>95</value>
</setting>
</PokemonGo.RocketAPI.Console.UserSettings>
</userSettings>
</configuration>
2 changes: 2 additions & 0 deletions PokemonGo.RocketAPI.Console/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ public class Settings : ISettings
public string GPXFile => UserSettings.Default.GPXFile;
public bool UseGPXPathing => UserSettings.Default.UseGPXPathing;
public bool useLuckyEggsWhileEvolving => UserSettings.Default.useLuckyEggsWhileEvolving;
public bool EvolveAllPokemonAboveIV => UserSettings.Default.EvolveAllPokemonAboveIV;
public float EvolveAboveIVValue => UserSettings.Default.EvolveAboveIVValue;

//Type and amount to keep
public ICollection<KeyValuePair<ItemId, int>> ItemRecycleFilter => new[]
Expand Down
24 changes: 24 additions & 0 deletions PokemonGo.RocketAPI.Console/UserSettings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions PokemonGo.RocketAPI.Console/UserSettings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,11 @@
<Setting Name="useLuckyEggsWhileEvolving" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="EvolveAllPokemonAboveIV" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="EvolveAboveIVValue" Type="System.Int32" Scope="User">
<Value Profile="(Default)">95</Value>
</Setting>
</Settings>
</SettingsFile>
15 changes: 13 additions & 2 deletions PokemonGo.RocketAPI.Logic/Inventory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,19 @@ public async Task<IEnumerable<PokemonData>> GetPokemonToEvolve(IEnumerable<Pokem
pokemonToEvolve.Count(
p => pokemonSettings.Single(x => x.PokemonId == p.PokemonId).FamilyId == settings.FamilyId) *
settings.CandyToEvolve;
if (familyCandy.Candy - pokemonCandyNeededAlready > settings.CandyToEvolve)
pokemonToEvolve.Add(pokemon);

if (_client.Settings.EvolveAllPokemonAboveIV)
if (PokemonInfo.CalculatePokemonPerfection(pokemon) >= _client.Settings.EvolveAboveIVValue && familyCandy.Candy - pokemonCandyNeededAlready > settings.CandyToEvolve)
{
pokemonToEvolve.Add(pokemon);
} else { continue; }
else
{
if (familyCandy.Candy - pokemonCandyNeededAlready > settings.CandyToEvolve)
{
pokemonToEvolve.Add(pokemon);
} else { continue; }
}
}

return pokemonToEvolve;
Expand Down
4 changes: 2 additions & 2 deletions PokemonGo.RocketAPI.Logic/Logic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ private async Task ExecuteFarmingPokestopsAndPokemons()
{
stopsHit = 0;
await RecycleItems();
if (_clientSettings.EvolveAllPokemonWithEnoughCandy) await EvolveAllPokemonWithEnoughCandy(_clientSettings.PokemonsToEvolve);
if (_clientSettings.EvolveAllPokemonWithEnoughCandy || _clientSettings.EvolveAllPokemonAboveIV) await EvolveAllPokemonWithEnoughCandy(_clientSettings.PokemonsToEvolve);
if (_clientSettings.TransferDuplicatePokemon) await TransferDuplicatePokemon();
}
}
Expand Down Expand Up @@ -518,7 +518,7 @@ public async Task PostLoginExecute()
{
_playerProfile = await _client.GetProfile();
_stats.SetUsername(_playerProfile);
if (_clientSettings.EvolveAllPokemonWithEnoughCandy)
if (_clientSettings.EvolveAllPokemonWithEnoughCandy || _clientSettings.EvolveAllPokemonAboveIV)
await EvolveAllPokemonWithEnoughCandy(_clientSettings.PokemonsToEvolve);
if (_clientSettings.TransferDuplicatePokemon) await TransferDuplicatePokemon();
await DisplayHighests();
Expand Down
3 changes: 3 additions & 0 deletions PokemonGo.RocketAPI/ISettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ public interface ISettings
bool UseGPXPathing { get; }
string GPXFile { get; }
bool useLuckyEggsWhileEvolving { get; }
bool EvolveAllPokemonAboveIV { get; }
float EvolveAboveIVValue { get; }

ICollection<KeyValuePair<ItemId, int>> ItemRecycleFilter { get; }

ICollection<PokemonId> PokemonsToEvolve { get; }
Expand Down

0 comments on commit eab7d63

Please sign in to comment.