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

check if cords are out of bounds & add stardust to the console title #163

Merged
merged 1 commit into from
Jul 23, 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: 2 additions & 2 deletions PokemonGo.RocketAPI.Logic/Logic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ private async Task DisplayPlayerLevelInTitle(bool updateOnly = false)
{
var xpDifference = GetXPDiff(playerStat.Level);
var message =
$"{playerName} | Level {playerStat.Level}: {playerStat.Experience - playerStat.PrevLevelXp - xpDifference}/{playerStat.NextLevelXp - playerStat.PrevLevelXp - xpDifference}XP";
$"{playerName} | Level {playerStat.Level}: {playerStat.Experience - playerStat.PrevLevelXp - xpDifference}/{playerStat.NextLevelXp - playerStat.PrevLevelXp - xpDifference}XP Stardust: {_playerProfile.Profile.Currency.ToArray()[1].Amount}";
Console.Title = message;
if (updateOnly == false)
Logger.Write(message);
Expand Down Expand Up @@ -478,4 +478,4 @@ private async Task DisplayHighests()
}
}
}
}
}
18 changes: 15 additions & 3 deletions PokemonGo.RocketAPI/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,24 @@ public Client(ISettings settings)
{
try
{
SetCoordinates(Convert.ToDouble(latlng[0]), Convert.ToDouble(latlng[1]),
double temp_lat = Convert.ToDouble(latlng[0]);
double temp_long = Convert.ToDouble(latlng[1]);

if(temp_lat >= -90 && temp_lat <= 90 && temp_long >= -180 && temp_long <= 180)
{
SetCoordinates(Convert.ToDouble(latlng[0]), Convert.ToDouble(latlng[1]),
Settings.DefaultAltitude);
}
else
{
Logger.Write("Coordinates in \"Coords.txt\" file are invalid, using the default coordinates ",
LogLevel.Warning);
SetCoordinates(Settings.DefaultLatitude, Settings.DefaultLongitude, Settings.DefaultAltitude);
}
}
catch (FormatException)
{
Logger.Write("Coordinates in \"Coords.txt\" file is invalid, using the default coordinates ",
Logger.Write("Coordinates in \"Coords.txt\" file are invalid, using the default coordinates ",
LogLevel.Warning);
SetCoordinates(Settings.DefaultLatitude, Settings.DefaultLongitude, Settings.DefaultAltitude);
}
Expand Down Expand Up @@ -425,4 +437,4 @@ public async Task<UseItemCaptureRequest> UseCaptureItem(ulong encounterId, ItemI
useItemRequest);
}
}
}
}