Skip to content

Commit

Permalink
Merge pull request #3836 from KOTR2003/patch-1
Browse files Browse the repository at this point in the history
[FIX] No Delay on Recycle
  • Loading branch information
GrimmGringo committed Aug 9, 2016
2 parents 47e9d5f + 48aea85 commit a371425
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions PoGo.NecroBot.Logic/ILogicSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ public interface ILogicSettings
bool SnipePokemonNotInPokedex { get; }
bool RandomizeRecycle { get; }
int RandomRecycleValue { get; }
bool DelayBetweenRecycleActions { 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 @@ -412,6 +412,8 @@ public class GlobalSettings
public bool RandomizeRecycle;
[DefaultValue(5)]
public int RandomRecycleValue;
[DefaultValue(false)]
public bool DelayBetweenRecycleActions;
[DefaultValue(120)]
public int TotalAmountOfPokeballsToKeep;
[DefaultValue(80)]
Expand Down Expand Up @@ -1321,6 +1323,7 @@ public LogicSettings(GlobalSettings settings)
public bool SnipePokemonNotInPokedex => _settings.SnipePokemonNotInPokedex;
public bool RandomizeRecycle => _settings.RandomizeRecycle;
public int RandomRecycleValue => _settings.RandomRecycleValue;
public bool DelayBetweenRecycleActions => _settings.DelayBetweenRecycleActions;
public int TotalAmountOfPokeballsToKeep => _settings.TotalAmountOfPokeballsToKeep;
public int TotalAmountOfPotionsToKeep => _settings.TotalAmountOfPotionsToKeep;
public int TotalAmountOfRevivesToKeep => _settings.TotalAmountOfRevivesToKeep;
Expand Down
4 changes: 4 additions & 0 deletions PoGo.NecroBot.Logic/Tasks/RecycleItemsTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ public static async Task Execute(ISession session, CancellationToken cancellatio

if (session.LogicSettings.VerboseRecycling)
session.EventDispatcher.Send(new ItemRecycledEvent { Id = item.ItemId, Count = item.Count });
if (session.LogicSettings.DelayBetweenRecycleActions)
DelayingUtils.Delay(session.LogicSettings.DelayBetweenPlayerActions, 500);
}

await session.Inventory.RefreshCachedInventory();
Expand All @@ -122,6 +124,8 @@ private static async Task RecycleItems(ISession session, CancellationToken cance
await session.Client.Inventory.RecycleItem(item, itemsToRecycle);
if (session.LogicSettings.VerboseRecycling)
session.EventDispatcher.Send(new ItemRecycledEvent { Id = item, Count = itemsToRecycle });
if (session.LogicSettings.DelayBetweenRecycleActions)
DelayingUtils.Delay(session.LogicSettings.DelayBetweenPlayerActions, 500);
}
}

Expand Down

0 comments on commit a371425

Please sign in to comment.