Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EvolveAllPkm Management - Evolve all above certain IV value #280

Merged
merged 2 commits into from
Jul 23, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions PokemonGo.RocketAPI.Console/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,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;

public string GoogleRefreshToken
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 @@ -47,6 +47,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 @@ -25,7 +25,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