Skip to content

Commit

Permalink
Merge pull request #169 from Nyankoo/master
Browse files Browse the repository at this point in the history
Recycle items at random threshold
  • Loading branch information
NecronomiconCoding authored Jul 23, 2016
2 parents 3c78658 + 1590b4d commit 652a1fd
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions PokemonGo.RocketAPI.Logic/Logic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -428,15 +428,22 @@ public async Task PostLoginExecute()

private async Task RecycleItems()
{
var items = await _inventory.GetItemsToRecycle(_clientSettings);
var allItems = await _inventory.GetItems();
Random rnd = new Random();
int recycleThreshold = rnd.Next(200, 251);

foreach (var item in items)
if (allItems.Count() >= recycleThreshold)
{
var transfer = await _client.RecycleItem((ItemId) item.Item_, item.Count);
Logger.Write($"{item.Count}x {(ItemId)item.Item_}", LogLevel.Recycling);
_stats.AddItemsRemoved(item.Count);
_stats.UpdateConsoleTitle(_inventory);
await Task.Delay(500);
var items = await _inventory.GetItemsToRecycle(_clientSettings);

foreach (var item in items)
{
var transfer = await _client.RecycleItem((ItemId)item.Item_, item.Count);
Logger.Write($"{item.Count}x {(ItemId)item.Item_}", LogLevel.Recycling);
_stats.AddItemsRemoved(item.Count);
_stats.UpdateConsoleTitle(_inventory);
await Task.Delay(500);
}
}
}

Expand Down

0 comments on commit 652a1fd

Please sign in to comment.