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

[Feature] Sniping pokemon missing from the pokedex #2736

Merged
merged 6 commits into from Aug 7, 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
1 change: 1 addition & 0 deletions PoGo.NecroBot.Logic/ILogicSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ public interface ILogicSettings
bool SnipeIgnoreUnknownIv { get; }
int MinDelayBetweenSnipes { get; }
double SnipingScanOffset { get; }
bool SnipePokemonNotInPokedex { get; }
int TotalAmountOfPokeballsToKeep { get; }
int TotalAmountOfPotionsToKeep { get; }
int TotalAmountOfRevivesToKeep { get; }
Expand Down
3 changes: 3 additions & 0 deletions PoGo.NecroBot.Logic/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,8 @@ public class GlobalSettings
public bool SnipeIgnoreUnknownIv;
[DefaultValue(false)]
public bool UseTransferIvForSnipe;
[DefaultValue(false)]
public bool SnipePokemonNotInPokedex;
//rename
[DefaultValue(false)]
public bool RenamePokemon;
Expand Down Expand Up @@ -1089,6 +1091,7 @@ public LogicSettings( GlobalSettings settings )
public bool SnipeIgnoreUnknownIv => _settings.SnipeIgnoreUnknownIv;
public int MinDelayBetweenSnipes => _settings.MinDelayBetweenSnipes;
public double SnipingScanOffset => _settings.SnipingScanOffset;
public bool SnipePokemonNotInPokedex => _settings.SnipePokemonNotInPokedex;
public int TotalAmountOfPokeballsToKeep => _settings.TotalAmountOfPokeballsToKeep;
public int TotalAmountOfPotionsToKeep => _settings.TotalAmountOfPotionsToKeep;
public int TotalAmountOfRevivesToKeep => _settings.TotalAmountOfRevivesToKeep;
Expand Down
17 changes: 14 additions & 3 deletions PoGo.NecroBot.Logic/Tasks/SnipePokemonTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,19 @@ public static async Task Execute(ISession session, CancellationToken cancellatio
var st = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
var t = DateTime.Now.ToUniversalTime() - st;
var currentTimestamp = t.TotalMilliseconds;

var pokemonIds = session.LogicSettings.PokemonToSnipe.Pokemon;
List<PokemonId> pokemonIds = new List<PokemonId>();
if (session.LogicSettings.SnipePokemonNotInPokedex)
{
var PokeDex = await session.Inventory.GetPokeDexItems();
var pokemonOnlyList = session.LogicSettings.PokemonToSnipe.Pokemon;
var capturedPokemon = PokeDex.Where(i => i.InventoryItemData.PokedexEntry.TimesCaptured >= 1).Select(i => i.InventoryItemData.PokedexEntry.PokemonId);
var pokemonToCapture = Enum.GetValues(typeof(PokemonId)).Cast<PokemonId>().Except(capturedPokemon);
pokemonIds = pokemonOnlyList.Concat(pokemonToCapture).ToList();
}
else
{
pokemonIds = session.LogicSettings.PokemonToSnipe.Pokemon;
}

if (session.LogicSettings.UseSnipeLocationServer)
{
Expand Down Expand Up @@ -568,4 +579,4 @@ public static async Task Start(Session session, CancellationToken cancellationTo
}
}
}
}
}