Skip to content

Commit

Permalink
Merge pull request #280 from skupfer/evolve_improvement
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 23, 2016
2 parents 781ab78 + fa32b98 commit e1d4d4a
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 3 deletions.
6 changes: 6 additions & 0 deletions PokemonGo.RocketAPI.Console/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@
<setting name="KeepMinDuplicatePokemon" serializeAs="String">
<value>1</value>
</setting>
<setting name="EvolveAllPokemonAboveIV" serializeAs="String">
<value>False</value>
</setting>
<setting name="EvolveAboveIVValue" serializeAs="String">
<value>90</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 @@ -30,6 +30,8 @@ public class Settings : ISettings
public int DelayBetweenPokemonCatch => UserSettings.Default.DelayBetweenPokemonCatch;
public bool UsePokemonToNotCatchFilter => UserSettings.Default.UsePokemonToNotCatchFilter;
public int KeepMinDuplicatePokemon => UserSettings.Default.KeepMinDuplicatePokemon;
public bool EvolveAllPokemonAboveIV => UserSettings.Default.EvolveAllPokemonAboveIV;
public float EvolveAboveIVValue => UserSettings.Default.EvolveAboveIVValue;
public bool PrioritizeIVOverCP => UserSettings.Default.PrioritizeIVOverCP;

//Type and amount to keep
Expand Down
20 changes: 20 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 @@ -44,6 +44,12 @@
<Setting Name="KeepMinDuplicatePokemon" Type="System.Int32" Scope="User">
<Value Profile="(Default)">1</Value>
</Setting>
<Setting Name="EvolveAllPokemonAboveIV" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="EvolveAboveIVValue" Type="System.Single" Scope="User">
<Value Profile="(Default)">90</Value>
</Setting>
<Setting Name="PrioritizeIVOverCP" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
Expand Down
15 changes: 13 additions & 2 deletions PokemonGo.RocketAPI.Logic/Inventory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,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
2 changes: 1 addition & 1 deletion PokemonGo.RocketAPI.Logic/Logic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,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
5 changes: 5 additions & 0 deletions PokemonGo.RocketAPI/ISettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ public interface ISettings
int DelayBetweenPokemonCatch { get; }
bool UsePokemonToNotCatchFilter { get; }
int KeepMinDuplicatePokemon { get; }
<<<<<<< HEAD
bool EvolveAllPokemonAboveIV { get; }
float EvolveAboveIVValue { get; }
=======
bool PrioritizeIVOverCP {get; }
>>>>>>> master
ICollection<KeyValuePair<ItemId, int>> ItemRecycleFilter { get; }

ICollection<PokemonId> PokemonsToEvolve { get; }
Expand Down

0 comments on commit e1d4d4a

Please sign in to comment.