Skip to content

Commit

Permalink
Merge pull request NecronomiconCoding#6 from NoxxDev/master
Browse files Browse the repository at this point in the history
Merge from NoxxDev
  • Loading branch information
AeyXD authored Aug 27, 2016
2 parents 9cfbd30 + d89130f commit cc31d67
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 30 deletions.
2 changes: 1 addition & 1 deletion PoGo.NecroBot.Logic/Strategies/Walk/BaseWalkStrategy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public async Task<PlayerUpdateResponse> DoWalk(List<GeoCoordinate> points, ISess
result = await LocationUtils.UpdatePlayerLocationWithAltitude(session, waypoint);

var realDistanceToTarget = LocationUtils.CalculateDistanceInMeters(currentLocation, targetLocation);
if (realDistanceToTarget < 10)
if (realDistanceToTarget < 30)
break;

do
Expand Down
7 changes: 6 additions & 1 deletion PoGo.NecroBot.Logic/Tasks/TransferDuplicatePokemonTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ public static async Task Execute(ISession session, CancellationToken cancellatio

family.Candy_++;

// Padding the TransferEvent with player-choosen delay before instead of after.
// This is to remedy too quick transfers, often happening within a second of the
// previous action otherwise

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

session.EventDispatcher.Send(new TransferPokemonEvent
{
Id = duplicatePokemon.PokemonId,
Expand All @@ -58,7 +64,6 @@ public static async Task Execute(ISession session, CancellationToken cancellatio
FamilyCandies = family.Candy_
});

DelayingUtils.Delay(session.LogicSettings.DelayBetweenPlayerActions, 0);
}
}
}
Expand Down
24 changes: 4 additions & 20 deletions PoGo.NecroBot.Logic/Tasks/UseIncubatorsTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@
using System.Threading.Tasks;
using Newtonsoft.Json;
using PoGo.NecroBot.Logic.Event;
using PoGo.NecroBot.Logic.Logging;
using PoGo.NecroBot.Logic.PoGoUtils;
using PoGo.NecroBot.Logic.State;
using POGOProtos.Inventory.Item;
using PoGo.NecroBot.Logic.Common;

#endregion

Expand Down Expand Up @@ -68,12 +66,7 @@ public static async Task Execute(ISession session, CancellationToken cancellatio

var newRememberedIncubators = new List<IncubatorUsage>();

// Find out if there are only 10km-eggs (special case)
var only10kmEggs = false;
var testIfOnly10kmEggs = unusedEggs.FirstOrDefault(x => x.EggKmWalkedTarget < 10);
if (testIfOnly10kmEggs == null) only10kmEggs = true;

foreach (var incubator in incubators)
foreach (var incubator in incubators)
{
cancellationToken.ThrowIfCancellationRequested();

Expand All @@ -88,23 +81,14 @@ public static async Task Execute(ISession session, CancellationToken cancellatio
if (egg == null)
continue;

// Avoid using 10 km egg until you are level 20 in order to get higher
// initial CP on the high IV 10 km Pokémons (unless you ONLY have 10km-eggs)
if (egg.EggKmWalkedTarget == 10 && playerStats.Level < 20 && !only10kmEggs)
{
Logger.Write(session.Translation.GetTranslation(TranslationString.Only10kmEggs), LogLevel.Egg);
continue;
}

// Avoid using 2/5 km eggs with limited incubator - IF setting is 10!
if (egg.EggKmWalkedTarget < session.LogicSettings.UseEggIncubatorMinKm
&& incubator.ItemId != ItemId.ItemIncubatorBasicUnlimited)
//avoid using 2/5 km eggs with limited incubator
if (egg.EggKmWalkedTarget < session.LogicSettings.UseEggIncubatorMinKm && incubator.ItemId != ItemId.ItemIncubatorBasicUnlimited)
continue;

var response = await session.Client.Inventory.UseItemEggIncubator(incubator.Id, egg.Id);
unusedEggs.Remove(egg);

newRememberedIncubators.Add(new IncubatorUsage {IncubatorId = incubator.Id, PokemonId = egg.Id});
newRememberedIncubators.Add(new IncubatorUsage { IncubatorId = incubator.Id, PokemonId = egg.Id });

session.EventDispatcher.Send(new EggIncubatorStatusEvent
{
Expand Down
13 changes: 5 additions & 8 deletions PoGo.NecroBot.Logic/Tasks/UseNearbyPokestopsTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,12 @@ public static async Task Execute(ISession session, CancellationToken cancellatio
session.Client.CurrentLongitude, i.Latitude, i.Longitude)).ToList();

// randomize next pokestop between first and second by distance
//var pokestopListNum = 0;
//if (pokestopList.Count > 1)
// pokestopListNum = rc.Next(0, 2);
var pokestopListNum = 0;
if (pokestopList.Count > 1)
pokestopListNum = rc.Next(0, 2);

//var pokeStop = pokestopList[pokestopListNum];
//pokestopList.RemoveAt(pokestopListNum);

var pokeStop = pokestopList[0];
pokestopList.RemoveAt(0);
var pokeStop = pokestopList[pokestopListNum];
pokestopList.RemoveAt(pokestopListNum);

// this logic should only be called when we reach a pokestop either via GPX path or normal walking
// as when walk-sniping, we want to get to the snipe ASAP rather than stop for lured pokemon upon
Expand Down

0 comments on commit cc31d67

Please sign in to comment.