Skip to content
This repository was archived by the owner on Oct 7, 2021. It is now read-only.
Open
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
20 changes: 14 additions & 6 deletions PokemonGo.RocketBot.Logic/Navigation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using PokemonGo.RocketBot.Logic.State;
using PokemonGo.RocketBot.Logic.Utils;
using POGOProtos.Networking.Responses;
using PokemonGo.RocketAPI.Helpers;

#endregion

Expand Down Expand Up @@ -105,7 +106,6 @@ private double MinorWalkingSpeedVariant(ISession session)
});
}
}

return _currentWalkingSpeed / 3.6;
}

Expand Down Expand Up @@ -231,6 +231,8 @@ public async Task<PlayerUpdateResponse> Move(GeoCoordinate targetLocation,
await
_client.Player.UpdatePlayerLocation(waypoint.Latitude, waypoint.Longitude,
waypoint.Altitude);
// Logging.Logger.Write("You are at alt " + _client.CurrentAltitude); for making sure alt is right
// Logging.Logger.Write("waypoint is at alt " + waypoint.Altitude);

UpdatePositionEvent?.Invoke(waypoint.Latitude, waypoint.Longitude);

Expand All @@ -257,6 +259,7 @@ public async Task<PlayerUpdateResponse> Move(GeoCoordinate targetLocation,

if (session.LogicSettings.UseWalkingSpeedVariant)
speedInMetersPerSecond = MinorWalkingSpeedVariant(session);
RequestBuilder.currentSpeed = speedInMetersPerSecond;

nextWaypointDistance = Math.Min(currentDistanceToTarget,
millisecondsUntilGetUpdatePlayerLocationResponse / 1000 * speedInMetersPerSecond);
Expand Down Expand Up @@ -296,19 +299,21 @@ public async Task<PlayerUpdateResponse> Move(GeoCoordinate targetLocation,

//Initial walking
var requestSendDateTime = DateTime.Now;

var result =
await
_client.Player.UpdatePlayerLocation(waypoint.Latitude, waypoint.Longitude,
waypoint.Altitude);

// Logging.Logger.Write("You are at alt " + _client.CurrentAltitude);
// Logging.Logger.Write("waypoint is at alt " + waypoint.Altitude);
UpdatePositionEvent?.Invoke(waypoint.Latitude, waypoint.Longitude);

do
{
var speedInMetersPerSecond = session.LogicSettings.UseWalkingSpeedVariant
? MajorWalkingSpeedVariant(session)
: session.LogicSettings.WalkingSpeedInKilometerPerHour / 3.6;
cancellationToken.ThrowIfCancellationRequested();
cancellationToken.ThrowIfCancellationRequested();

var millisecondsUntilGetUpdatePlayerLocationResponse =
(DateTime.Now - requestSendDateTime).TotalMilliseconds;
Expand Down Expand Up @@ -337,7 +342,8 @@ public async Task<PlayerUpdateResponse> Move(GeoCoordinate targetLocation,
await
_client.Player.UpdatePlayerLocation(waypoint.Latitude, waypoint.Longitude,
waypoint.Altitude);

// Logging.Logger.Write("You are at alt " + _client.CurrentAltitude);
// Logging.Logger.Write("waypoint is at alt " + waypoint.Altitude);
UpdatePositionEvent?.Invoke(waypoint.Latitude, waypoint.Longitude);


Expand Down Expand Up @@ -368,7 +374,7 @@ public async Task<PlayerUpdateResponse> HumanPathWalking(GpxReader.Trkpt trk,
var nextWaypointBearing = LocationUtils.DegreeBearing(sourceLocation, targetLocation);
var nextWaypointDistance = speedInMetersPerSecond;
var waypoint = LocationUtils.CreateWaypoint(sourceLocation, nextWaypointDistance, nextWaypointBearing,
Convert.ToDouble(trk.Ele, CultureInfo.InvariantCulture));
(Convert.ToDouble(trk.Ele, CultureInfo.InvariantCulture))- 30);
var requestSendDateTime = DateTime.Now;
var result =
await
Expand Down Expand Up @@ -397,6 +403,7 @@ public async Task<PlayerUpdateResponse> HumanPathWalking(GpxReader.Trkpt trk,

if (session.LogicSettings.UseWalkingSpeedVariant)
speedInMetersPerSecond = MinorWalkingSpeedVariant(session);
RequestBuilder.currentSpeed = speedInMetersPerSecond;

nextWaypointDistance = Math.Min(currentDistanceToTarget,
millisecondsUntilGetUpdatePlayerLocationResponse / 1000 * speedInMetersPerSecond);
Expand All @@ -408,7 +415,8 @@ public async Task<PlayerUpdateResponse> HumanPathWalking(GpxReader.Trkpt trk,
await
_client.Player.UpdatePlayerLocation(waypoint.Latitude, waypoint.Longitude,
waypoint.Altitude);

// Logging.Logger.Write("You are at alt " + _client.CurrentAltitude);
// Logging.Logger.Write("waypoint is at alt " + waypoint.Altitude);
UpdatePositionEvent?.Invoke(waypoint.Latitude, waypoint.Longitude);

if (functionExecutedWhileWalking != null)
Expand Down
20 changes: 14 additions & 6 deletions PokemonGo.RocketBot.Logic/PokemonGo.RocketBot.Logic.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,6 @@
<HintPath>..\packages\Google.Protobuf.3.0.0\lib\net45\Google.Protobuf.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="POGOProtos, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\POGOProtos.1.7.0\lib\net45\POGOProtos.dll</HintPath>
</Reference>
<Reference Include="S2Geometry, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\S2Geometry.1.0.3\lib\portable-net45+wp8+win8\S2Geometry.dll</HintPath>
<Private>True</Private>
Expand All @@ -85,6 +81,10 @@
<HintPath>..\packages\SocketIoClientDotNet.0.9.13\lib\net45\SocketIoClientDotNet.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="SuperSocket.ClientEngine, Version=0.8.0.6, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SuperSocket.ClientEngine.Core.0.8.0.6\lib\net45\SuperSocket.ClientEngine.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Core" />
Expand Down Expand Up @@ -113,6 +113,10 @@
<HintPath>..\packages\Telegram.Bot.10.3.1\lib\net45\Telegram.Bot.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="WebSocket4Net, Version=0.15.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\WebSocket4Net.0.15.0-beta5\lib\net45\WebSocket4Net.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Common\ApiFailureStrategy.cs" />
Expand Down Expand Up @@ -149,8 +153,9 @@
<Compile Include="Event\EggIncubatorStatusEvent.cs" />
<Compile Include="Inventory.cs" />
<Compile Include="Localization\Localizer.cs" />
<Compile Include="Logging\Logger.cs" />
<Compile Include="ILogicSettings.cs" />
<Compile Include="Logging\ILogger.cs" />
<Compile Include="Logging\Logger.cs" />
<Compile Include="Navigation.cs" />
<Compile Include="PoGoUtils\PokemonInfo.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
Expand Down Expand Up @@ -210,7 +215,6 @@
<Compile Include="Utils\EggWalker.cs" />
<Compile Include="Utils\ErrorHandler.cs" />
<Compile Include="Utils\GPXReader.cs" />
<Compile Include="Logging\ILogger.cs" />
<Compile Include="Utils\JitterUtils.cs" />
<Compile Include="Utils\LocationUtils.cs" />
<Compile Include="Utils\NecroWebClient.cs">
Expand All @@ -227,6 +231,10 @@
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\POGOProtos\POGOProtos.csproj">
<Project>{a03a7bb2-4f0b-467b-84b2-9a76e6aae6fb}</Project>
<Name>POGOProtos</Name>
</ProjectReference>
<ProjectReference Include="..\PokemonGo.RocketAPI\PokemonGo.RocketAPI.csproj">
<Project>{05d2da44-1b8e-4cf7-94ed-4d52451cd095}</Project>
<Name>PokemonGo.RocketAPI</Name>
Expand Down
3 changes: 3 additions & 0 deletions PokemonGo.RocketBot.Logic/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
using PokemonGo.RocketBot.Logic.Utils;
using POGOProtos.Enums;
using POGOProtos.Inventory.Item;
using Google.Protobuf;

#endregion

Expand Down Expand Up @@ -1184,6 +1185,8 @@ public string GoogleRefreshToken
set { GoogleRefreshToken = null; }
}

public ByteString SessionHash { get; set; }

AuthType ISettings.AuthType
{
get { return _settings.Auth.AuthType; }
Expand Down
4 changes: 2 additions & 2 deletions PokemonGo.RocketBot.Logic/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>

<packages>
<package id="C5" version="2.4.5947.17249" targetFramework="net452" />
<package id="CloudFlareUtilities" version="0.2.1-alpha" targetFramework="net452" />
Expand All @@ -13,6 +12,7 @@
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net45" />
<package id="S2Geometry" version="1.0.3" targetFramework="net452" />
<package id="SocketIoClientDotNet" version="0.9.13" targetFramework="net452" />
<package id="SuperSocket.ClientEngine.Core" version="0.8.0.6" targetFramework="net452" />
<package id="System.Collections" version="4.0.11" targetFramework="net452" />
<package id="System.Collections.Concurrent" version="4.0.12" targetFramework="net452" />
<package id="System.Diagnostics.Debug" version="4.0.11" targetFramework="net452" />
Expand Down Expand Up @@ -44,5 +44,5 @@
<package id="System.Xml.ReaderWriter" version="4.0.11" targetFramework="net452" />
<package id="System.Xml.XDocument" version="4.0.11" targetFramework="net452" />
<package id="Telegram.Bot" version="10.3.1" targetFramework="net452" />
<package id="WebSocket4Net" version="0.14.1" targetFramework="net452" />
<package id="WebSocket4Net" version="0.15.0-beta5" targetFramework="net452" />
</packages>
14 changes: 4 additions & 10 deletions PokemonGo.RocketBot.Window/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,9 @@

<configuration>
<configSections>
<sectionGroup name="userSettings"
type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="PokemonGo.RocketBot.Window.UserSettings"
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="PokemonGo.RocketBot.Window.Settings"
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="PokemonGo.RocketBot.Window.UserSettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="PokemonGo.RocketBot.Window.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<startup>
Expand All @@ -32,7 +27,6 @@
</assemblyBinding>
</runtime>
<connectionStrings>
<add name="Pogo"
connectionString="DatasetId = YOUR_DATASET_ID; CertificateFilePath = C:\Path\To\Your\Certificate\File-privatekey.p12; ServiceAccountId = your-service-account-email@developer.gserviceaccount.com; CertificatePassword = notasecret" />
<add name="Pogo" connectionString="DatasetId = YOUR_DATASET_ID; CertificateFilePath = C:\Path\To\Your\Certificate\File-privatekey.p12; ServiceAccountId = your-service-account-email@developer.gserviceaccount.com; CertificatePassword = notasecret" />
</connectionStrings>
</configuration>
3 changes: 1 addition & 2 deletions PokemonGo.RocketBot.Window/FodyWeavers.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Weavers>
<Costura/>

<Costura />
</Weavers>
9 changes: 4 additions & 5 deletions PokemonGo.RocketBot.Window/Forms/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public MainForm()

private void MainForm_Load(object sender, EventArgs e)
{
Text = @"RocketBot v" + Assembly.GetExecutingAssembly().GetName().Version;
Text = @"RocketBot v" + Application.ProductVersion;

//User activity tracking, help us get more information to make RocketBot better
//Everything is anonymous
Expand Down Expand Up @@ -339,7 +339,7 @@ public void CheckVersion()
match.Groups[3],
match.Groups[4]));
// makes sense to display your version and say what the current one is on github
Logger.Write("Your version is " + Assembly.GetExecutingAssembly().GetName().Version);
Logger.Write("Your version is " + Application.ProductVersion);
Logger.Write("Github version is " + gitVersion);
Logger.Write("You can find it at www.GitHub.com/TheUnnameOrganization/RocketBot/releases");
}
Expand All @@ -354,7 +354,7 @@ private static string DownloadServerVersion()
using (var wC = new WebClient())
return
wC.DownloadString(
"https://raw.githubusercontent.com/TheUnnameOrganization/RocketBot/Beta-Build/src/RocketBotGUI/Properties/AssemblyInfo.cs");
"https://raw.githubusercontent.com/TheUnnameOrganization/RocketBot/master/PokemonGo.RocketBot.Window/Properties/AssemblyInfo.cs");
}

private void showMoreCheckBox_CheckedChanged(object sender, EventArgs e)
Expand Down Expand Up @@ -556,7 +556,6 @@ private async void btnRefresh_Click(object sender, EventArgs e)
private void startStopBotToolStripMenuItem_Click(object sender, EventArgs e)
{
startStopBotToolStripMenuItem.Enabled = false;
settingToolStripMenuItem.Enabled = false;
Task.Run(StartBot);
}

Expand Down Expand Up @@ -874,7 +873,7 @@ private async Task ReloadPokemonList()
var appliedItems =
inventoryAppliedItems.Where(aItems => aItems?.Item != null)
.SelectMany(aItems => aItems.Item)
.ToDictionary(item => item.ItemId, item => TimeHelper.FromUnixTimeUtc(item.ExpireMs));
.ToDictionary(item => item.ItemId, item => Utils.FromUnixTimeUtc(item.ExpireMs));

PokemonObject.Initilize(itemTemplates);

Expand Down
20 changes: 11 additions & 9 deletions PokemonGo.RocketBot.Window/PokemonGo.RocketBot.Window.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -128,28 +128,25 @@
<Private>True</Private>
</Reference>
<Reference Include="MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a, processorArchitecture=MSIL">
<HintPath>..\packages\MetroModernUI.1.4.0.0\lib\net\MetroFramework.dll</HintPath>
<HintPath>..\packages\Winform.Metroframework.1.4.0\lib\net20\MetroFramework.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="MetroFramework.Design, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a, processorArchitecture=MSIL">
<HintPath>..\packages\MetroModernUI.1.4.0.0\lib\net\MetroFramework.Design.dll</HintPath>
<HintPath>..\packages\Winform.Metroframework.Design.1.4.0\lib\net20\MetroFramework.Design.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="MetroFramework.Fonts, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a, processorArchitecture=MSIL">
<HintPath>..\packages\MetroModernUI.1.4.0.0\lib\net\MetroFramework.Fonts.dll</HintPath>
<HintPath>..\packages\Winform.Metroframework.Fonts.1.4.0\lib\net20\MetroFramework.Fonts.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="ObjectListView, Version=2.9.1.1072, Culture=neutral, PublicKeyToken=b1c5bf581481bcd4, processorArchitecture=MSIL">
<HintPath>..\packages\ObjectListView.Official.2.9.1\lib\net20\ObjectListView.dll</HintPath>
<Reference Include="ObjectListView, Version=2.9.1.25410, Culture=neutral, PublicKeyToken=b1c5bf581481bcd4, processorArchitecture=MSIL">
<HintPath>..\packages\ObjectListView.Official.2.9.2-alpha2\lib\net20\ObjectListView.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="POGOProtos">
<HintPath>..\packages\POGOProtos.1.7.0\lib\net45\POGOProtos.dll</HintPath>
</Reference>
<Reference Include="S2Geometry, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\S2Geometry.1.0.3\lib\portable-net45+wp8+win8\S2Geometry.dll</HintPath>
<Private>True</Private>
Expand Down Expand Up @@ -204,7 +201,6 @@
<Compile Include="Helpers\MachineIdHelper.cs" />
<Compile Include="Helpers\ResourceHelper.cs" />
<Compile Include="Helpers\S2GMapDrawer.cs" />
<Compile Include="Helpers\TimeHelper.cs" />
<Compile Include="Models\GMapMarkerPokestops.cs" />
<Compile Include="Models\GMapMarkerTrainer.cs" />
<Compile Include="Models\LoggingStrings.cs" />
Expand Down Expand Up @@ -565,6 +561,10 @@
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\POGOProtos\POGOProtos.csproj">
<Project>{a03a7bb2-4f0b-467b-84b2-9a76e6aae6fb}</Project>
<Name>POGOProtos</Name>
</ProjectReference>
<ProjectReference Include="..\PokemonGo.RocketAPI\PokemonGo.RocketAPI.csproj">
<Project>{05d2da44-1b8e-4cf7-94ed-4d52451cd095}</Project>
<Name>PokemonGo.RocketAPI</Name>
Expand Down Expand Up @@ -621,6 +621,8 @@ foreach (var item in filesToCleanup)
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\packages\Fody.1.29.4\build\dotnet\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\packages\Fody.1.29.4\build\dotnet\Fody.targets'))" />
<Error Condition="!Exists('..\packages\Costura.Fody.2.0.0-beta0018\build\Costura.Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Costura.Fody.2.0.0-beta0018\build\Costura.Fody.targets'))" />
<Error Condition="!Exists('..\packages\Fody.1.29.4\build\dotnet\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.1.29.4\build\dotnet\Fody.targets'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down
4 changes: 2 additions & 2 deletions PokemonGo.RocketBot.Window/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]

[assembly: AssemblyVersion("2.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("2.0.1")]
[assembly: AssemblyFileVersion("2.0.1.0")]
Loading