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

Websocket - Add correct delay #1924

Merged
merged 1 commit into from
Aug 1, 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
4 changes: 4 additions & 0 deletions PoGo.NecroBot.Logic/Tasks/EggsListTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using PoGo.NecroBot.Logic.Event;
using PoGo.NecroBot.Logic.State;
using POGOProtos.Inventory.Item;
using PoGo.NecroBot.Logic.Utils;

#endregion

Expand All @@ -14,6 +15,7 @@ public class EggsListTask
{
public static async Task Execute(ISession session)
{
// Refresh inventory so that the player stats are fresh
await session.Inventory.RefreshCachedInventory();

var playerStats = (await session.Inventory.GetPlayerStats()).FirstOrDefault();
Expand All @@ -39,6 +41,8 @@ public static async Task Execute(ISession session)
Incubators = incubators,
UnusedEggs = unusedEggs
});

DelayingUtils.Delay(session.LogicSettings.DelayBetweenPlayerActions, 0);
}
}
}
6 changes: 6 additions & 0 deletions PoGo.NecroBot.Logic/Tasks/InventoryListTask.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using PoGo.NecroBot.Logic.Event;
using PoGo.NecroBot.Logic.State;
using PoGo.NecroBot.Logic.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
Expand All @@ -12,13 +13,18 @@ public class InventoryListTask
{
public static async Task Execute(ISession session)
{
// Refresh inventory so that the player stats are fresh
await session.Inventory.RefreshCachedInventory();

var inventory = await session.Inventory.GetItems();

session.EventDispatcher.Send(
new InventoryListEvent
{
Items = inventory.ToList()
});

DelayingUtils.Delay(session.LogicSettings.DelayBetweenPlayerActions, 0);
}
}
}
7 changes: 6 additions & 1 deletion PoGo.NecroBot.Logic/Tasks/PokemonListTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using PoGo.NecroBot.Logic.Event;
using PoGo.NecroBot.Logic.PoGoUtils;
using PoGo.NecroBot.Logic.State;
using PoGo.NecroBot.Logic.Utils;

#endregion

Expand All @@ -15,6 +16,9 @@ public class PokemonListTask
{
public static async Task Execute(ISession session)
{
// Refresh inventory so that the player stats are fresh
await session.Inventory.RefreshCachedInventory();

var myPokemonSettings = await session.Inventory.GetPokemonSettings();
var pokemonSettings = myPokemonSettings.ToList();

Expand All @@ -37,7 +41,8 @@ public static async Task Execute(ISession session)
{
PokemonList = pkmWithIv.ToList()
});
await Task.Delay(500);

DelayingUtils.Delay(session.LogicSettings.DelayBetweenPlayerActions, 0);
}
}
}