Skip to content

Commit

Permalink
Recycle items at random threshold
Browse files Browse the repository at this point in the history
  • Loading branch information
Nyankoo committed Jul 23, 2016
1 parent ebc2caa commit 1590b4d
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions PokemonGo.RocketAPI.Logic/Logic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ private async Task CatchEncounter(EncounterResponse encounter, MapPokemon pokemo
{
CatchPokemonResponse caughtPokemonResponse;
do
{//test
{
var probability = encounter?.CaptureProbability?.CaptureProbability_?.FirstOrDefault();


Expand Down 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

2 comments on commit 1590b4d

@ScheKaa
Copy link

@ScheKaa ScheKaa commented on 1590b4d Jul 23, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did someone test this code?

Till fix here:
https://github.com/NecronomiconCoding/Pokemon-Go-Bot/issues/195

@ps4398
Copy link

@ps4398 ps4398 commented on 1590b4d Jul 23, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revert this commit plz

Please sign in to comment.