Skip to content
This repository has been archived by the owner on Oct 7, 2021. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/Beta-Build'
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian committed Aug 9, 2016
2 parents bb69ac5 + c7e0385 commit 3e27588
Show file tree
Hide file tree
Showing 23 changed files with 695 additions and 6,172 deletions.
12 changes: 4 additions & 8 deletions PokemonGo/RocketAPI/Window/ApiFailureStrategy.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
using PokemonGo.RocketAPI.Extensions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading.Tasks;
using PokemonGo.RocketAPI.Extensions;
using POGOProtos.Networking.Envelopes;

namespace PokemonGo.RocketAPI.Window
{
class ApiFailureStrategy : IApiFailureStrategy
internal class ApiFailureStrategy : IApiFailureStrategy
{
public async Task<ApiOperation> HandleApiFailure(RequestEnvelope request, ResponseEnvelope response)
{
Expand All @@ -19,4 +15,4 @@ public void HandleApiSuccess(RequestEnvelope request, ResponseEnvelope response)
{
}
}
}
}
13 changes: 9 additions & 4 deletions PokemonGo/RocketAPI/Window/App.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>

<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
Expand Down Expand Up @@ -53,7 +54,7 @@
<!--transfer pokemon with CP less than this value if cp transfer type is selected. Whitelist in Program.cs-->
<add key="TransferIVThreshold" value="0" />
<!--transfer pokemon with IV less than this value if iv transfer type is selected. Whitelist in Program.cs-->
<add key="TravelSpeed" value="60" />
<add key="TravelSpeed" value="20" />
<!--The speed to travel in km/h-->
<add key="ImageSize" value="50" />
<!--PokeUi image size-->
Expand All @@ -75,12 +76,16 @@
<system.web>
<membership defaultProvider="ClientAuthenticationMembershipProvider">
<providers>
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
<add name="ClientAuthenticationMembershipProvider"
type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
serviceUri="" />
</providers>
</membership>
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
<providers>
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
<add name="ClientRoleProvider"
type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
serviceUri="" cacheTimeout="86400" />
</providers>
</roleManager>
</system.web>
Expand Down
17 changes: 17 additions & 0 deletions PokemonGo/RocketAPI/Window/Extensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using POGOProtos.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PokemonGo.RocketAPI.Window
{
public static class Extensions
{
public static float GetIV(this PokemonData poke)
{
return (poke.IndividualAttack + poke.IndividualDefense + poke.IndividualStamina) / 45.0f;
}
}
}
25 changes: 10 additions & 15 deletions PokemonGo/RocketAPI/Window/LocationManager.cs
Original file line number Diff line number Diff line change
@@ -1,36 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using PokemonGo.RocketAPI;
using PokemonGo.RocketAPI.Extensions;

namespace PokemonGo.RocketAPI.Window
{
public class LocationManager
{
private Client client;
private double metersPerMillisecond;
private readonly Client _client;
private readonly double _metersPerMillisecond;

public LocationManager(Client client, double speed)
{
this.client = client;
this.metersPerMillisecond = speed / 3600;
this._client = client;
_metersPerMillisecond = speed/3600;
}

public double getDistance(double lat, double lng)
public double GetDistance(double lat, double lng)
{
LatLong currentLoc = new LatLong(client.CurrentLatitude, client.CurrentLongitude);
var currentLoc = new LatLong(_client.CurrentLatitude, _client.CurrentLongitude);
return currentLoc.distanceFrom(new LatLong(lat, lng));
}

public async Task update(double lat, double lng)
public async Task Update(double lat, double lng)
{
double waitTime = getDistance(lat, lng) / this.metersPerMillisecond;
await Task.Delay((int)Math.Ceiling(waitTime));
await client.Player.UpdatePlayerLocation(lat, lng);
var waitTime = GetDistance(lat, lng)/_metersPerMillisecond;
await Task.Delay((int) Math.Ceiling(waitTime));
await _client.Player.UpdatePlayerLocation(lat, lng);
}
}

}
Loading

0 comments on commit 3e27588

Please sign in to comment.