Skip to content

Commit

Permalink
Merge pull request NecronomiconCoding#33 from NecronomiconCoding/master
Browse files Browse the repository at this point in the history
Merging in
  • Loading branch information
BornSupercharged authored Aug 1, 2016
2 parents 71d4e52 + 3403a25 commit 76a3483
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 35 deletions.
1 change: 1 addition & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[submodule "FeroxRev"]
path = FeroxRev
url = https://github.com/NecronomiconCoding/NecroBot-Rocket-API
branch = master
32 changes: 32 additions & 0 deletions PoGo.NecroBot.CLI/Config/Translations/translation.es.json
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,10 @@
"Key": "currentPokeballInv",
"Value": "[Inventario actual] Poké Balls: {0} | Super Balls: {1} | Ultra Balls: {2} | Master Balls: {3}"
},
{
"Key": "maxItemsCombinedOverMaxItemStorage",
"Value": "[Configuración Inválida] El Máximo de items combinados (balls+potions+revives={0}) está por encima del almacenamiento máximo ({1})"
},
{
"Key": "recyclingQuietly",
"Value": "Reciclando Tranquilamente..."
Expand Down Expand Up @@ -455,6 +459,34 @@
{
"Key": "ipBannedError",
"Value": "Conexión denegada. Su IP podría haber sido añadida a la Lista Negra de Niantic.. Saliendo.."
},
{
"Key": "noEggsAvailable",
"Value": "No hay huevos disponibles"
},
{
"Key": "useLuckyEggActive",
"Value": "Huevo suerte ya está activo"
},
{
"Key": "noIncenseAvailable",
"Value": "No hay Incienso disponible"
},
{
"Key": "useIncenseActive",
"Value": "Incienso ya está activo"
},
{
"Key": "amountPkmSeenCaught",
"Value": "Cantidad de Pokemons vistos:{}:151, Cantidad de Pokemons capturados:{}:151"
},
{
"Key": "pkmPotentialEvolveCount",
"Value": "[Evoluciona] Potencial Evolución: {}"
},
{
"Key": "pkmNotEnoughRessources",
"Value": "Pokemon actualización fallida: No hay suficientes recursos"
}
]
}
10 changes: 7 additions & 3 deletions PoGo.NecroBot.CLI/Config/Translations/translation.fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
},
{
"Key": "farmPokestopsOutsideRadius",
"Value": "Vous êtes en dehors de votre rayon défini! Début de la marche ({0}m de distance) dans 5 secondes."
"Value": "Vous dépassez votre rayon d'action! Début de la marche ({0}m de distance) dans 5 secondes. Vérifiez votre fichier LastPos.ini"
},
{
"Key": "farmPokestopsNoUsableFound",
Expand All @@ -46,7 +46,7 @@
},
{
"Key": "eventUsedLuckyEgg",
"Value": "Bonus Oeuf Chance : {0}min restant"
"Value": "Activation Bonus d'un oeuf Chance"
},
{
"Key": "eventPokemonEvolvedSuccess",
Expand Down Expand Up @@ -452,9 +452,13 @@
"Key": "UseIncenseActive",
"Value": "Encens déjà activé"
},
{
"Key": "UseIncenseNew",
"Value": "Encens utilisé"
},
{
"Key": "AmountPkmSeenCaught",
"Value": "Total de pokémon vu : {}/151, Total de pokémon capturé : {}/151"
"Value": "Deck Pokémon(151) : Rencontré {0} | Capturé {1}"
},
{
"Key": "PkmPotentialEvolveCount",
Expand Down
19 changes: 4 additions & 15 deletions PoGo.NecroBot.Logic/Tasks/DisplayPokemonStatsTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,24 +106,13 @@ public static async Task Execute(ISession session)
if (session.LogicSettings.DumpPokemonStats)
{
const string dumpFileName = "PokeBagStats";
Dumper.ClearDumpFile(session, dumpFileName, "csv");
Dumper.ClearDumpFile(session, dumpFileName);
Dumper.Dump(session, "pokemonid,pokemonlevel,cp,perfection,stamina,staminamax,move1,move2,candy,ownername,origin,heightm,weightkg,individualattack,individualdefense,individualstamina,cpmultiplier,battlesattacked,battlesdefended,creationtimems,numupgrades,additionalcpmultiplier,favorite,nickname", dumpFileName);
foreach (var pokemon in allPokemonInBag)
{
int candy = PokemonInfo.GetCandy(pokemon, myPokemonFamilies, myPokeSettings);
string pokeName = "";
if (pokemon.Favorite == 1)
{
pokeName += "*";
}
pokeName += pokemon.PokemonId.ToString();
if (!string.IsNullOrEmpty(pokemon.Nickname.ToString()))
{
pokeName += " (" + pokemon.Nickname.ToString() + ")";
}

Dumper.Dump(session,
string.Format($"NAME: {pokeName, -25} LVL: {PokemonInfo.GetLevel(pokemon).ToString("00"), -7} CP: {pokemon.Cp.ToString() + " / " + PokemonInfo.CalculateMaxCp(pokemon).ToString(), -15} IV: {PokemonInfo.CalculatePokemonPerfection(pokemon).ToString("0.00"), -10} MOVE1: {pokemon.Move1, -20} MOVE2: {pokemon.Move2, -20} Candies: {candy}"),
dumpFileName, "csv");
$"{pokemon.PokemonId},{PokemonInfo.GetLevel(pokemon)},{pokemon.Cp},{PokemonInfo.CalculatePokemonPerfection(pokemon)},{pokemon.Stamina},{pokemon.StaminaMax},{pokemon.Move1},{pokemon.Move2},{PokemonInfo.GetCandy(pokemon, myPokemonFamilies, myPokeSettings)},{pokemon.OwnerName},{pokemon.Origin},{pokemon.HeightM},{pokemon.WeightKg},{pokemon.IndividualAttack},{pokemon.IndividualDefense},{pokemon.IndividualStamina},{pokemon.CpMultiplier},{pokemon.BattlesAttacked},{pokemon.BattlesDefended},{pokemon.CreationTimeMs},{pokemon.NumUpgrades},{pokemon.AdditionalCpMultiplier},{pokemon.Favorite},{pokemon.Nickname}",
dumpFileName);
}
}
await Task.Delay(500);
Expand Down
9 changes: 6 additions & 3 deletions PoGo.NecroBot.Logic/Tasks/FarmPokestopsTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace PoGo.NecroBot.Logic.Tasks
public static class FarmPokestopsTask
{
public static int TimesZeroXPawarded;

private static int storeRI;
public static async Task Execute(ISession session, CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
Expand All @@ -48,6 +48,8 @@ await session.Navigation.Move(

var pokestopList = await GetPokeStops(session);
var stopsHit = 0;
var rc = new Random(); //initialize pokestop random cleanup counter first time
storeRI = rc.Next(3, 9);
var eggWalker = new EggWalker(1000, session);

if (pokestopList.Count <= 0)
Expand Down Expand Up @@ -156,8 +158,9 @@ await session.Navigation.Move(new GeoCoordinate(pokeStop.Latitude, pokeStop.Long

await eggWalker.ApplyDistance(distance, cancellationToken);

if (++stopsHit%5 == 0) //TODO: OR item/pokemon bag is full
if (++stopsHit >= storeRI) //TODO: OR item/pokemon bag is full //check stopsHit against storeRI random without dividing.
{
storeRI = rc.Next(2, 8); //set new storeRI for new random value
stopsHit = 0;
if (fortSearch.ItemsAwarded.Count > 0)
{
Expand Down Expand Up @@ -228,4 +231,4 @@ private static async Task<List<FortData>> GetPokeStops(ISession session)
return pokeStops.ToList();
}
}
}
}
36 changes: 24 additions & 12 deletions PoGo.NecroBot.Logic/Tasks/SnipePokemonTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,10 @@ public static async Task Execute(ISession session, CancellationToken cancellatio

var scanResult = SnipeScanForPokemon(session, location);

List<PokemonLocation> locationsToSnipe = new List<PokemonLocation>();
var locationsToSnipe = new List<PokemonLocation>();
if (scanResult.pokemons != null)
{
var filteredPokemon = scanResult.pokemons.Where(q => pokemonIds.Contains((PokemonId) q.pokemon_name));
var filteredPokemon = scanResult.pokemons.Where(q => pokemonIds.Contains(q.pokemon_name));
var notVisitedPokemon = filteredPokemon.Where(q => !LocsVisited.Contains(q));
var notExpiredPokemon = notVisitedPokemon.Where(q => q.expires < currentTimestamp);

Expand Down Expand Up @@ -266,7 +266,8 @@ await session.Client.Player.UpdatePlayerLocation(CurrentLatitude, CurrentLongitu
finally
{
await
session.Client.Player.UpdatePlayerLocation(CurrentLatitude, CurrentLongitude, session.Client.CurrentAltitude);
session.Client.Player.UpdatePlayerLocation(CurrentLatitude, CurrentLongitude,
session.Client.CurrentAltitude);
}

if (encounter.Status == EncounterResponse.Types.Status.EncounterSuccess)
Expand All @@ -281,12 +282,23 @@ await session.Client.Player.UpdatePlayerLocation(CurrentLatitude, CurrentLongitu
}
else if (encounter.Status == EncounterResponse.Types.Status.PokemonInventoryFull)
{
session.EventDispatcher.Send(new WarnEvent
if (session.LogicSettings.EvolveAllPokemonAboveIv ||
session.LogicSettings.EvolveAllPokemonWithEnoughCandy)
{
Message =
session.Translation.GetTranslation(
TranslationString.InvFullTransferManually)
});
await EvolvePokemonTask.Execute(session, cancellationToken);
}

if (session.LogicSettings.TransferDuplicatePokemon)
{
await TransferDuplicatePokemonTask.Execute(session, cancellationToken);
}
else
{
session.EventDispatcher.Send(new WarnEvent
{
Message = session.Translation.GetTranslation(TranslationString.InvFullTransferManually)
});
}
}
else
{
Expand Down Expand Up @@ -316,8 +328,8 @@ private static ScanResult SnipeScanForPokemon(ISession session, Location locatio

var offset = session.LogicSettings.SnipingScanOffset;
// 0.003 = half a mile; maximum 0.06 is 10 miles
if (offset<0.001) offset=0.003;
if (offset>0.06) offset = 0.06;
if (offset < 0.001) offset = 0.003;
if (offset > 0.06) offset = 0.06;

var boundLowerLeftLat = location.Latitude - offset;
var boundLowerLeftLng = location.Longitude - offset;
Expand All @@ -340,7 +352,7 @@ private static ScanResult SnipeScanForPokemon(ISession session, Location locatio
var request = WebRequest.CreateHttp(uri);
request.Accept = "application/json";
request.Method = "GET";
request.Timeout = 5000;
request.Timeout = 10000;
request.ReadWriteTimeout = 32000;

var resp = request.GetResponse();
Expand All @@ -352,7 +364,7 @@ private static ScanResult SnipeScanForPokemon(ISession session, Location locatio
catch (Exception ex)
{
// most likely System.IO.IOException
session.EventDispatcher.Send(new ErrorEvent { Message = ex.ToString() });
session.EventDispatcher.Send(new ErrorEvent {Message = ex.ToString()});
scanResult = new ScanResult
{
Status = "fail",
Expand Down
4 changes: 2 additions & 2 deletions PoGo.NecroBot.Logic/Utils/Statistics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public static int GetXpDiff(int level)
0, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000,
10000, 10000, 10000, 10000, 15000, 20000, 20000, 20000, 25000, 25000,
50000, 75000, 100000, 125000, 150000, 190000, 200000, 250000, 300000, 350000,
500000, 500000, 750000, 1000000, 1250000, 1500000, 2000000, 2500000, 1000000, 1000000
500000, 500000, 750000, 1000000, 1250000, 1500000, 2000000, 2500000, 3000000, 5000000
};
return xpTable[level - 1];
}
Expand All @@ -115,4 +115,4 @@ public class StatsExport
public long LevelupXp;
public double MinutesUntilLevel;
}
}
}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[![Stories in Ready](https://badge.waffle.io/NecronomiconCoding/NecroBot.png?label=ready&title=Ready)](https://waffle.io/NecronomiconCoding/NecroBot)
<!-- define warning icon -->
[1.1]: http://necrobot.io/img/mainlogo.png (NECROBOT_HEADER)
<!-- header -->
Expand Down

0 comments on commit 76a3483

Please sign in to comment.