diff --git a/PoGo.PokeMobBot.CLI/App.config b/PoGo.PokeMobBot.CLI/App.config
index dc3d3e6..1058d06 100644
--- a/PoGo.PokeMobBot.CLI/App.config
+++ b/PoGo.PokeMobBot.CLI/App.config
@@ -2,14 +2,9 @@
-
-
-
+
+
+
@@ -32,7 +27,6 @@
-
+
\ No newline at end of file
diff --git a/PoGo.PokeMobBot.CLI/PoGo.PokeMobBot.CLI.csproj b/PoGo.PokeMobBot.CLI/PoGo.PokeMobBot.CLI.csproj
index 321ce40..448f3f1 100644
--- a/PoGo.PokeMobBot.CLI/PoGo.PokeMobBot.CLI.csproj
+++ b/PoGo.PokeMobBot.CLI/PoGo.PokeMobBot.CLI.csproj
@@ -73,8 +73,8 @@
..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll
True
-
- ..\packages\POGOProtos.1.4.0\lib\net45\POGOProtos.dll
+
+ ..\packages\POGOProtos.1.5.0\lib\net45\POGOProtos.dll
True
@@ -130,7 +130,9 @@
-
+
+ Designer
+
diff --git a/PoGo.PokeMobBot.CLI/packages.config b/PoGo.PokeMobBot.CLI/packages.config
index d87d19a..a363967 100644
--- a/PoGo.PokeMobBot.CLI/packages.config
+++ b/PoGo.PokeMobBot.CLI/packages.config
@@ -1,12 +1,11 @@
-
-
+
diff --git a/PoGo.PokeMobBot.Logic/Common/ApiFailureStrategy.cs b/PoGo.PokeMobBot.Logic/Common/ApiFailureStrategy.cs
index a9ec550..8a621fc 100644
--- a/PoGo.PokeMobBot.Logic/Common/ApiFailureStrategy.cs
+++ b/PoGo.PokeMobBot.Logic/Common/ApiFailureStrategy.cs
@@ -4,10 +4,9 @@
using System.Threading.Tasks;
using PoGo.PokeMobBot.Logic.Event;
using PoGo.PokeMobBot.Logic.State;
-using PokemonGo.RocketAPI.Common;
-using PokemonGo.RocketAPI.Enums;
using PokemonGo.RocketAPI.Exceptions;
using PokemonGo.RocketAPI.Extensions;
+using POGOProtos.Networking.Envelopes;
#endregion
@@ -23,7 +22,23 @@ public ApiFailureStrategy(ISession session)
_session = session;
}
- public async Task HandleApiFailure()
+ private async void DoLogin()
+ {
+ try
+ {
+ await _session.Client.Login.DoLogin();
+ }
+ catch (AggregateException ae)
+ {
+ throw ae.Flatten().InnerException;
+ }
+ catch (Exception ex)
+ {
+ throw ex.InnerException;
+ }
+ }
+
+ public async Task HandleApiFailure(RequestEnvelope request, ResponseEnvelope response)
{
if (_retryCount == 11)
return ApiOperation.Abort;
@@ -74,43 +89,9 @@ public async Task HandleApiFailure()
return ApiOperation.Retry;
}
- public void HandleApiSuccess()
+ public void HandleApiSuccess(RequestEnvelope request, ResponseEnvelope response)
{
_retryCount = 0;
}
-
- private async void DoLogin()
- {
- switch (_session.Settings.AuthType)
- {
- case AuthType.Ptc:
- try
- {
- await
- _session.Client.Login.DoPtcLogin(_session.Settings.PtcUsername,
- _session.Settings.PtcPassword);
- }
- catch (AggregateException ae)
- {
- throw ae.Flatten().InnerException;
- }
- catch (Exception ex)
- {
- throw ex.InnerException;
- }
- break;
- case AuthType.Google:
- await
- _session.Client.Login.DoGoogleLogin(_session.Settings.GoogleUsername,
- _session.Settings.GooglePassword);
- break;
- default:
- _session.EventDispatcher.Send(new ErrorEvent
- {
- Message = _session.Translation.GetTranslation(TranslationString.WrongAuthType)
- });
- break;
- }
- }
}
}
diff --git a/PoGo.PokeMobBot.Logic/Common/Translations.cs b/PoGo.PokeMobBot.Logic/Common/Translations.cs
index a475137..71ea246 100644
--- a/PoGo.PokeMobBot.Logic/Common/Translations.cs
+++ b/PoGo.PokeMobBot.Logic/Common/Translations.cs
@@ -596,7 +596,7 @@ public static Translation Load(ILogicSettings logicSettings)
.ToList()
.ForEach(translations._pokemons.Add);
}
- catch (Exception e)
+ catch (Exception)
{
translations = new Translation();
translations.Save(Path.Combine(translationPath, "translation.en.json"));
diff --git a/PoGo.PokeMobBot.Logic/PoGo.PokeMobBot.Logic.csproj b/PoGo.PokeMobBot.Logic/PoGo.PokeMobBot.Logic.csproj
index 62c591f..9ddf83e 100644
--- a/PoGo.PokeMobBot.Logic/PoGo.PokeMobBot.Logic.csproj
+++ b/PoGo.PokeMobBot.Logic/PoGo.PokeMobBot.Logic.csproj
@@ -30,8 +30,8 @@
4
-
- ..\packages\POGOProtos.1.4.0\lib\net45\POGOProtos.dll
+
+ ..\packages\POGOProtos.1.5.0\lib\net45\POGOProtos.dll
True
diff --git a/PoGo.PokeMobBot.Logic/State/LoginState.cs b/PoGo.PokeMobBot.Logic/State/LoginState.cs
index 36d2765..036a124 100644
--- a/PoGo.PokeMobBot.Logic/State/LoginState.cs
+++ b/PoGo.PokeMobBot.Logic/State/LoginState.cs
@@ -28,32 +28,7 @@ public async Task Execute(ISession session, CancellationToken cancellati
try
{
- switch (session.Settings.AuthType)
- {
- case AuthType.Ptc:
- try
- {
- await
- session.Client.Login.DoPtcLogin(session.Settings.PtcUsername,
- session.Settings.PtcPassword);
- }
- catch (AggregateException ae)
- {
- throw ae.Flatten().InnerException;
- }
- break;
- case AuthType.Google:
- await
- session.Client.Login.DoGoogleLogin(session.Settings.GoogleUsername,
- session.Settings.GooglePassword);
- break;
- default:
- session.EventDispatcher.Send(new ErrorEvent
- {
- Message = session.Translation.GetTranslation(TranslationString.WrongAuthType)
- });
- return null;
- }
+ await session.Client.Login.DoLogin();
}
catch (PtcOfflineException)
{
diff --git a/PoGo.PokeMobBot.Logic/State/Session.cs b/PoGo.PokeMobBot.Logic/State/Session.cs
index ef5e597..1216e90 100644
--- a/PoGo.PokeMobBot.Logic/State/Session.cs
+++ b/PoGo.PokeMobBot.Logic/State/Session.cs
@@ -28,6 +28,7 @@ public Session(ISettings settings, ILogicSettings logicSettings)
{
Settings = settings;
LogicSettings = logicSettings;
+ ApiFailureStrategy = new ApiFailureStrategy(this);
EventDispatcher = new EventDispatcher();
Translation = Common.Translation.Load(logicSettings);
Reset(settings, LogicSettings);
@@ -48,9 +49,11 @@ public Session(ISettings settings, ILogicSettings logicSettings)
public IEventDispatcher EventDispatcher { get; }
+ public ApiFailureStrategy ApiFailureStrategy { get; set; }
+
public void Reset(ISettings settings, ILogicSettings logicSettings)
{
- Client = new Client(Settings) {AuthType = settings.AuthType};
+ Client = new Client(Settings, ApiFailureStrategy);
// ferox wants us to set this manually
Inventory = new Inventory(Client, logicSettings);
Navigation = new Navigation(Client);
diff --git a/PoGo.PokeMobBot.Logic/Tasks/CatchNearbyPokemonsTask.cs b/PoGo.PokeMobBot.Logic/Tasks/CatchNearbyPokemonsTask.cs
index b57064a..e3b620a 100644
--- a/PoGo.PokeMobBot.Logic/Tasks/CatchNearbyPokemonsTask.cs
+++ b/PoGo.PokeMobBot.Logic/Tasks/CatchNearbyPokemonsTask.cs
@@ -110,7 +110,7 @@ private static async Task> GetNearbyPokemons(ISes
{
var mapObjects = await session.Client.Map.GetMapObjects();
- var pokemons = mapObjects.MapCells.SelectMany(i => i.CatchablePokemons)
+ var pokemons = mapObjects.Item1.MapCells.SelectMany(i => i.CatchablePokemons)
.OrderBy(
i =>
LocationUtils.CalculateDistanceInMeters(session.Client.CurrentLatitude,
diff --git a/PoGo.PokeMobBot.Logic/Tasks/FarmPokestopsGPXTask.cs b/PoGo.PokeMobBot.Logic/Tasks/FarmPokestopsGPXTask.cs
index 651a2e1..448cba0 100644
--- a/PoGo.PokeMobBot.Logic/Tasks/FarmPokestopsGPXTask.cs
+++ b/PoGo.PokeMobBot.Logic/Tasks/FarmPokestopsGPXTask.cs
@@ -172,7 +172,7 @@ private static async Task> GetPokeStops(ISession session)
var mapObjects = await session.Client.Map.GetMapObjects();
// Wasn't sure how to make this pretty. Edit as needed.
- var pokeStops = mapObjects.MapCells.SelectMany(i => i.Forts)
+ var pokeStops = mapObjects.Item1.MapCells.SelectMany(i => i.Forts)
.Where(
i =>
i.Type == FortType.Checkpoint &&
diff --git a/PoGo.PokeMobBot.Logic/Tasks/FarmPokestopsTask.cs b/PoGo.PokeMobBot.Logic/Tasks/FarmPokestopsTask.cs
index 481e48c..2952fe7 100644
--- a/PoGo.PokeMobBot.Logic/Tasks/FarmPokestopsTask.cs
+++ b/PoGo.PokeMobBot.Logic/Tasks/FarmPokestopsTask.cs
@@ -434,7 +434,7 @@ private static async Task> GetPokeStops(ISession session)
{
var mapObjects = await session.Client.Map.GetMapObjects();
- var pokeStops = mapObjects.MapCells.SelectMany(i => i.Forts);
+ var pokeStops = mapObjects.Item1.MapCells.SelectMany(i => i.Forts);
session.EventDispatcher.Send(new PokeStopListEvent { Forts = pokeStops.ToList() });
diff --git a/PoGo.PokeMobBot.Logic/Tasks/Login.cs b/PoGo.PokeMobBot.Logic/Tasks/Login.cs
index df3ea8b..f92c6af 100644
--- a/PoGo.PokeMobBot.Logic/Tasks/Login.cs
+++ b/PoGo.PokeMobBot.Logic/Tasks/Login.cs
@@ -29,41 +29,11 @@ public void DoLogin()
{
try
{
- if (_session.Client.AuthType == AuthType.Ptc)
- {
- try
- {
- _session.Client.Login.DoPtcLogin(_session.Settings.PtcUsername, _session.Settings.PtcPassword)
- .Wait();
- }
- catch (AggregateException ae)
- {
- throw ae.Flatten().InnerException;
- }
- }
- else
- {
- _session.Client.Login.DoGoogleLogin(_session.Settings.GoogleUsername,
- _session.Settings.GooglePassword).Wait();
- }
+ _session.Client.Login.DoLogin().Wait();
}
- catch (PtcOfflineException)
+ catch (AggregateException ae)
{
- _session.EventDispatcher.Send(new ErrorEvent
- {
- Message = _session.Translation.GetTranslation(TranslationString.PtcOffline)
- });
- _session.EventDispatcher.Send(new NoticeEvent
- {
- Message = _session.Translation.GetTranslation(TranslationString.TryingAgainIn, 20)
- });
- }
- catch (AccountNotVerifiedException)
- {
- _session.EventDispatcher.Send(new ErrorEvent
- {
- Message = _session.Translation.GetTranslation(TranslationString.AccountNotVerified)
- });
+ throw ae.Flatten().InnerException;
}
}
}
diff --git a/PoGo.PokeMobBot.Logic/Tasks/SnipePokemonTask.cs b/PoGo.PokeMobBot.Logic/Tasks/SnipePokemonTask.cs
index de22dd8..9fa9118 100644
--- a/PoGo.PokeMobBot.Logic/Tasks/SnipePokemonTask.cs
+++ b/PoGo.PokeMobBot.Logic/Tasks/SnipePokemonTask.cs
@@ -285,7 +285,7 @@ private static async Task Snipe(ISession session, IEnumerable p
var mapObjects = session.Client.Map.GetMapObjects().Result;
var catchablePokemon =
- mapObjects.MapCells.SelectMany(q => q.CatchablePokemons)
+ mapObjects.Item1.MapCells.SelectMany(q => q.CatchablePokemons)
.Where(q => pokemonIds.Contains(q.PokemonId))
.ToList();
diff --git a/PoGo.PokeMobBot.Logic/Tasks/UseNearbyPokestopsTask.cs b/PoGo.PokeMobBot.Logic/Tasks/UseNearbyPokestopsTask.cs
index 256764e..9f64117 100644
--- a/PoGo.PokeMobBot.Logic/Tasks/UseNearbyPokestopsTask.cs
+++ b/PoGo.PokeMobBot.Logic/Tasks/UseNearbyPokestopsTask.cs
@@ -73,7 +73,7 @@ private static async Task> GetPokeStops(ISession session)
var mapObjects = await session.Client.Map.GetMapObjects();
// Wasn't sure how to make this pretty. Edit as needed.
- var pokeStops = mapObjects.MapCells.SelectMany(i => i.Forts)
+ var pokeStops = mapObjects.Item1.MapCells.SelectMany(i => i.Forts)
.Where(
i =>
i.Type == FortType.Checkpoint &&
diff --git a/PoGo.PokeMobBot.Logic/packages.config b/PoGo.PokeMobBot.Logic/packages.config
index 006ec34..a07383c 100644
--- a/PoGo.PokeMobBot.Logic/packages.config
+++ b/PoGo.PokeMobBot.Logic/packages.config
@@ -1,8 +1,7 @@
-
-
+
\ No newline at end of file
diff --git a/Pokemon-Go-Rocket-API b/Pokemon-Go-Rocket-API
index 1505165..3d93612 160000
--- a/Pokemon-Go-Rocket-API
+++ b/Pokemon-Go-Rocket-API
@@ -1 +1 @@
-Subproject commit 15051653138aa5a521f2523057ebb855e30701e3
+Subproject commit 3d936126fdde32aef4f600bcd81853dc6f1a4335