Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/NECROBOTIO/NecroBot
Browse files Browse the repository at this point in the history
  • Loading branch information
iBorna committed Aug 9, 2016
2 parents 6423146 + fa31790 commit 41fe223
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 36 deletions.
2 changes: 1 addition & 1 deletion PoGo.NecroBot.CLI/ConsoleEventListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ private static void HandleEvent(FortFailedEvent fortFailedEvent, ISession sessio

private static void HandleEvent(FortTargetEvent fortTargetEvent, ISession session)
{
int intTimeForArrival = (int) ( fortTargetEvent.Distance / ( session.LogicSettings.WalkingSpeedInKilometerPerHour * 0.2 ) );
int intTimeForArrival = (int) ( fortTargetEvent.Distance / ( session.LogicSettings.WalkingSpeedInKilometerPerHour * 0.8 ) );

Logger.Write(
session.Translation.GetTranslation(TranslationString.EventFortTargeted, fortTargetEvent.Name,
Expand Down
2 changes: 1 addition & 1 deletion PoGo.NecroBot.CLI/ConsoleLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public void Write(string message, LogLevel level = LogLevel.Info, ConsoleColor c
Console.WriteLine($"[{DateTime.Now.ToString("HH:mm:ss")}] ({LoggingStrings.Transferred}) {message}");
break;
case LogLevel.Evolve:
Console.ForegroundColor = color == ConsoleColor.Black ? ConsoleColor.Yellow : color;
Console.ForegroundColor = color == ConsoleColor.Black ? ConsoleColor.DarkGreen : color;
Console.WriteLine($"[{DateTime.Now.ToString("HH:mm:ss")}] ({LoggingStrings.Evolved}) {message}");
break;
case LogLevel.Berry:
Expand Down
25 changes: 17 additions & 8 deletions PoGo.NecroBot.CLI/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ internal class Program
private static void Main(string[] args)
{
string strCulture = Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName;
var culture = CultureInfo.CreateSpecificCulture( "en-US" );
var culture = CultureInfo.CreateSpecificCulture(strCulture);

CultureInfo.DefaultThreadCurrentCulture = culture;
Thread.CurrentThread.CurrentCulture = culture;
Expand Down Expand Up @@ -91,17 +91,26 @@ private static void Main(string[] args)


var session = new Session(new ClientSettings(settings), new LogicSettings(settings));
if( boolNeedsSetup )

if (boolNeedsSetup)
{
if( GlobalSettings.PromptForSetup( session.Translation ) && !settings.isGui )
session = GlobalSettings.SetupSettings( session, settings, configFile );
if (GlobalSettings.PromptForSetup(session.Translation) && !settings.isGui)
{
session = GlobalSettings.SetupSettings(session, settings, configFile);

if (!settings.isGui)
{
var fileName = Assembly.GetExecutingAssembly().Location;
System.Diagnostics.Process.Start(fileName);
Environment.Exit(0);
}
}
else
{
GlobalSettings.Load( subPath );
GlobalSettings.Load(subPath);

Logger.Write( "Press a Key to continue...",
LogLevel.Warning );
Logger.Write("Press a Key to continue...",
LogLevel.Warning);
Console.ReadKey();
return;
}
Expand Down
2 changes: 1 addition & 1 deletion PoGo.NecroBot.CLI/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("0.8.0")]
[assembly: AssemblyVersion("0.8.1")]
[assembly: AssemblyFileVersion("1.0.0.0")]
2 changes: 1 addition & 1 deletion PoGo.NecroBot.Logic/Common/Translations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ public class Translation : ITranslation
new KeyValuePair<TranslationString, string>(TranslationString.AmountPkmSeenCaught,
"Amount of Pokemon Seen: {0}/151, Amount of Pokemon Caught: {1}/151"),
new KeyValuePair<TranslationString, string>(TranslationString.PkmPotentialEvolveCount,
"[Evolves] Potential Evolves: {0}"),
"Potential Evolutions: {0}"),
new KeyValuePair<TranslationString, string>(TranslationString.PkmNotEnoughRessources,
"Pokemon Upgrade Failed Not Enough Resources"),
new KeyValuePair<TranslationString, string>(TranslationString.SnipeServerOffline, "Sniping server is offline. Skipping..."),
Expand Down
13 changes: 9 additions & 4 deletions PoGo.NecroBot.Logic/Inventory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ public class Inventory
private readonly ILogicSettings _logicSettings;
private GetPlayerResponse _player = null;
private int _level = 0;
private DownloadItemTemplatesResponse _templates;
private IEnumerable<PokemonSettings> _pokemonSettings;

private readonly List<ItemId> _revives = new List<ItemId> { ItemId.ItemRevive, ItemId.ItemMaxRevive };
private GetInventoryResponse _cachedInventory;
Expand Down Expand Up @@ -380,10 +382,13 @@ public async Task<IEnumerable<PokemonData>> GetPokemons()

public async Task<IEnumerable<PokemonSettings>> GetPokemonSettings()
{
var templates = await _client.Download.GetItemTemplates();
return
templates.ItemTemplates.Select(i => i.PokemonSettings)
.Where(p => p != null && p.FamilyId != PokemonFamilyId.FamilyUnset);
if (_templates == null || _pokemonSettings == null)
{
_templates = await _client.Download.GetItemTemplates();
_pokemonSettings = _templates.ItemTemplates.Select(i => i.PokemonSettings).Where(p => p != null && p.FamilyId != PokemonFamilyId.FamilyUnset);
}

return _pokemonSettings;
}

public async Task<IEnumerable<PokemonData>> GetPokemonToEvolve(IEnumerable<PokemonId> filter = null)
Expand Down
2 changes: 1 addition & 1 deletion PoGo.NecroBot.Logic/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("0.8.0")]
[assembly: AssemblyVersion("0.8.1")]
[assembly: AssemblyFileVersion("1.0.0.0")]
19 changes: 1 addition & 18 deletions PoGo.NecroBot.Logic/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ public class GlobalSettings
public double DefaultLatitude;
[DefaultValue(-73.962277)]
public double DefaultLongitude;
[DefaultValue(31.0)]
[DefaultValue(19.0)]
public double WalkingSpeedInKilometerPerHour;
[DefaultValue(10)]
public int MaxSpawnLocationOffset;
Expand Down Expand Up @@ -774,7 +774,6 @@ public static GlobalSettings Load(string path, bool boolSkipSave = false)
settings.ProfileConfigPath = profileConfigPath;
settings.GeneralConfigPath = Path.Combine(Directory.GetCurrentDirectory(), "config");
settings.isGui = isGui;
settings.migratePercentages();

if (!boolSkipSave || !settings.AutoUpdate)
{
Expand Down Expand Up @@ -974,22 +973,6 @@ private static void SaveFiles(GlobalSettings settings, String configFile)
settings.Auth.Load(Path.Combine(settings.ProfileConfigPath, "auth.json"));
}


/// <summary>
/// Method for issue #1966
/// </summary>
private void migratePercentages()
{
if (EvolveKeptPokemonsAtStorageUsagePercentage <= 1.0)
{
EvolveKeptPokemonsAtStorageUsagePercentage *= 100.0f;
}
if (RecycleInventoryAtUsagePercentage <= 1.0)
{
RecycleInventoryAtUsagePercentage *= 100.0f;
}
}

public void Save(string fullPath)
{
var jsonSerializeSettings = new JsonSerializerSettings
Expand Down
2 changes: 1 addition & 1 deletion PoGo.NecroBot.Logic/Tasks/LevelUpPokemonTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public static async Task Execute(ISession session, CancellationToken cancellatio

foreach (var pokemon in upgradablePokemon)
{
if (session.LogicSettings.UseLevelUpList)
if (session.LogicSettings.UseLevelUpList && PokemonToLevel!=null)
{
for (int i = 0; i < PokemonToLevel.Count - 1; i++)
{
Expand Down

0 comments on commit 41fe223

Please sign in to comment.