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

Add KeepMinDuplicatePokemon to UserSettings and Inventory Logic #90

Merged
merged 3 commits into from
Jul 22, 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
3 changes: 3 additions & 0 deletions PokemonGo.RocketAPI.Console/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@
<setting name="UsePokemonToNotCatchFilter" serializeAs="String">
<value>False</value>
</setting>
<setting name="KeepMinDuplicatePokemon" serializeAs="String">
<value>1</value>
</setting>
</PokemonGo.RocketAPI.Console.UserSettings>
</userSettings>
</configuration>
1 change: 1 addition & 0 deletions PokemonGo.RocketAPI.Console/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public class Settings : ISettings
public bool TransferDuplicatePokemon => UserSettings.Default.TransferDuplicatePokemon;
public int DelayBetweenMove => UserSettings.Default.DelayBetweenMove;
public bool UsePokemonToNotCatchFilter => UserSettings.Default.UsePokemonToNotCatchFilter;
public int KeepMinDuplicatePokemon => UserSettings.Default.KeepMinDuplicatePokemon;

private ICollection<PokemonId> _pokemonsToEvolve;
private ICollection<PokemonId> _pokemonsNotToTransfer;
Expand Down
12 changes: 12 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.

3 changes: 3 additions & 0 deletions PokemonGo.RocketAPI.Console/UserSettings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,8 @@
<Setting Name="UsePokemonToNotCatchFilter" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="KeepMinDuplicatePokemon" Type="System.Int32" Scope="User">
<Value Profile="(Default)">1</Value>
</Setting>
</Settings>
</SettingsFile>
9 changes: 8 additions & 1 deletion PokemonGo.RocketAPI.Logic/Inventory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ public class Inventory
{
private readonly Client _client;

private readonly ISettings _clientSettings;

public Inventory(ISettings clientSettings)
{
_clientSettings = clientSettings;
}

public Inventory(Client client)
{
_client = client;
Expand Down Expand Up @@ -68,7 +75,7 @@ public async Task<IEnumerable<PokemonData>> GetDuplicatePokemonToTransfer(
p.Where(x => x.Favorite == 0)
.OrderByDescending(x => x.Cp)
.ThenBy(n => n.StaminaMax)
.Skip(1)
.Skip(_clientSettings.KeepMinDuplicatePokemon)
.ToList());
}

Expand Down
1 change: 1 addition & 0 deletions PokemonGo.RocketAPI/ISettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public interface ISettings
bool TransferDuplicatePokemon { get; }
int DelayBetweenMove { get; }
bool UsePokemonToNotCatchFilter { get; }
int KeepMinDuplicatePokemon { get; }
ICollection<KeyValuePair<ItemId, int>> ItemRecycleFilter { get; }

ICollection<PokemonId> PokemonsToEvolve { get; }
Expand Down