From b62ff10eb2b971ea4503689808780fb4dc593337 Mon Sep 17 00:00:00 2001 From: asilevani Date: Sun, 31 Jul 2016 19:58:04 +0200 Subject: [PATCH 01/21] Improved dump format & added pokemon favorite/nickname/max cp --- .../Tasks/DisplayPokemonStatsTask.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/PoGo.NecroBot.Logic/Tasks/DisplayPokemonStatsTask.cs b/PoGo.NecroBot.Logic/Tasks/DisplayPokemonStatsTask.cs index f523fea4d..e289fd2f9 100644 --- a/PoGo.NecroBot.Logic/Tasks/DisplayPokemonStatsTask.cs +++ b/PoGo.NecroBot.Logic/Tasks/DisplayPokemonStatsTask.cs @@ -104,8 +104,19 @@ public static async Task Execute(ISession session) Dumper.ClearDumpFile(session, dumpFileName); foreach (var pokemon in allPokemonInBag) { + string pokeName = ""; + if (pokemon.Favorite == 1) + { + pokeName += "*"; + } + pokeName += pokemon.PokemonId.ToString(); + if (!string.IsNullOrEmpty(pokemon.Nickname.ToString())) + { + pokeName += " (" + pokemon.Nickname.ToString() + ")"; + } + Dumper.Dump(session, - $"NAME: {pokemon.PokemonId.ToString().PadRight(16, ' ')}Lvl: {PokemonInfo.GetLevel(pokemon).ToString("00")}\t\tCP: {pokemon.Cp.ToString().PadRight(8, ' ')}\t\t IV: {PokemonInfo.CalculatePokemonPerfection(pokemon).ToString("0.00")}%\t\t\tMOVE1: {pokemon.Move1}\t\t\tMOVE2: {pokemon.Move2}", + 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}"), dumpFileName); } } From ab236b61c719d4583aae9223fb564629cdf1beb7 Mon Sep 17 00:00:00 2001 From: asilevani Date: Sun, 31 Jul 2016 20:06:22 +0200 Subject: [PATCH 02/21] Revert "Improved dump format & added pokemon favorite/nickname/max cp" This reverts commit b62ff10eb2b971ea4503689808780fb4dc593337. --- .../Tasks/DisplayPokemonStatsTask.cs | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/PoGo.NecroBot.Logic/Tasks/DisplayPokemonStatsTask.cs b/PoGo.NecroBot.Logic/Tasks/DisplayPokemonStatsTask.cs index e289fd2f9..f523fea4d 100644 --- a/PoGo.NecroBot.Logic/Tasks/DisplayPokemonStatsTask.cs +++ b/PoGo.NecroBot.Logic/Tasks/DisplayPokemonStatsTask.cs @@ -104,19 +104,8 @@ public static async Task Execute(ISession session) Dumper.ClearDumpFile(session, dumpFileName); foreach (var pokemon in allPokemonInBag) { - 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}"), + $"NAME: {pokemon.PokemonId.ToString().PadRight(16, ' ')}Lvl: {PokemonInfo.GetLevel(pokemon).ToString("00")}\t\tCP: {pokemon.Cp.ToString().PadRight(8, ' ')}\t\t IV: {PokemonInfo.CalculatePokemonPerfection(pokemon).ToString("0.00")}%\t\t\tMOVE1: {pokemon.Move1}\t\t\tMOVE2: {pokemon.Move2}", dumpFileName); } } From 7552996a407f078706e8caac383171f957cfb116 Mon Sep 17 00:00:00 2001 From: asilevani Date: Sun, 31 Jul 2016 20:15:23 +0200 Subject: [PATCH 03/21] Improved dump format & added pokemon favorite/nickname/max cp --- .../Tasks/DisplayPokemonStatsTask.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/PoGo.NecroBot.Logic/Tasks/DisplayPokemonStatsTask.cs b/PoGo.NecroBot.Logic/Tasks/DisplayPokemonStatsTask.cs index 0e5e31096..df90a539c 100644 --- a/PoGo.NecroBot.Logic/Tasks/DisplayPokemonStatsTask.cs +++ b/PoGo.NecroBot.Logic/Tasks/DisplayPokemonStatsTask.cs @@ -110,8 +110,19 @@ public static async Task Execute(ISession session) 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, - $"NAME: {pokemon.PokemonId.ToString().PadRight(16, ' ')}Lvl: {PokemonInfo.GetLevel(pokemon).ToString("00")}\t\tCP: {pokemon.Cp.ToString().PadRight(8, ' ')}\t\t IV: {PokemonInfo.CalculatePokemonPerfection(pokemon).ToString("0.00")}%\t\t\tMOVE1: {pokemon.Move1}\t\t\tMOVE2: {pokemon.Move2} \t\tCandy: {candy}", + 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); } } From b093be51545dcaa3f45546a73d7d76c4dc8aaca3 Mon Sep 17 00:00:00 2001 From: NecronomiconCoding Date: Sun, 31 Jul 2016 20:29:31 +0200 Subject: [PATCH 04/21] update sorting --- PoGo.NecroBot.Logic/Settings.cs | 156 +++++++++++++++++--------------- 1 file changed, 82 insertions(+), 74 deletions(-) diff --git a/PoGo.NecroBot.Logic/Settings.cs b/PoGo.NecroBot.Logic/Settings.cs index a0d1747d7..ab267cc01 100644 --- a/PoGo.NecroBot.Logic/Settings.cs +++ b/PoGo.NecroBot.Logic/Settings.cs @@ -92,36 +92,105 @@ public void Save() } } } - + public class GlobalSettings { - public int AmountOfPokemonToDisplayOnStart = 10; - + [JsonIgnore] internal AuthSettings Auth = new AuthSettings(); + [JsonIgnore] public string GeneralConfigPath; + [JsonIgnore] public string ProfileConfigPath; + [JsonIgnore] public string ProfilePath; + public string TranslationLanguageCode = "en"; + //autoupdate + public bool AutoUpdate = true; + public bool TransferConfigAndAuthOnUpdate = true; + //pressakeyshit + public bool StartupWelcomeDelay = true; + //console options + public int AmountOfPokemonToDisplayOnStart = 10; + public bool ShowPokeballCountsBeforeRecycle = true; + //powerup public bool AutomaticallyLevelUpPokemon = false; public int AmountOfTimesToUpgradeLoop = 5; public int GetMinStarDustForLevelUp = 5000; - - public bool AutoUpdate = true; + public string LevelUpByCPorIv = "iv"; + public float UpgradePokemonCpMinimum = 1000; + public float UpgradePokemonIvMinimum = 95; + //position + public bool DisableHumanWalking = false; public double DefaultAltitude = 10; public double DefaultLatitude = 40.785091; public double DefaultLongitude = -73.968285; + public double WalkingSpeedInKilometerPerHour = 15.0; + public int MaxSpawnLocationOffset = 10; + //delays public int DelayBetweenPlayerActions = 5000; public int DelayBetweenPokemonCatch = 2000; - public bool DisableHumanWalking = false; + //dump stats public bool DumpPokemonStats = false; + //evolve public float EvolveAboveIvValue = 95; public bool EvolveAllPokemonAboveIv = false; public bool EvolveAllPokemonWithEnoughCandy = true; - - [JsonIgnore] public string GeneralConfigPath; - + public bool KeepPokemonsThatCanEvolve = false; + //gpx + public bool UseGpxPathing = false; public string GpxFile = "GPXPath.GPX"; - - public bool ShowPokeballCountsBeforeRecycle = true; + //recycle public bool VerboseRecycling = true; public double RecycleInventoryAtUsagePercentage = 0.90; + //keeping + public int KeepMinCp = 1250; + public int KeepMinDuplicatePokemon = 1; + public float KeepMinIvPercentage = 90; + public bool PrioritizeIvOverCp = false; + //luckyandincense + public bool UseEggIncubators = true; + public bool UseLuckyEggConstantly = true; + public int UseLuckyEggsMinPokemonAmount = 30; + public bool UseLuckyEggsWhileEvolving = false; + public bool UseIncenseConstantly = true; + //snipe + public bool UseSnipeOnlineLocationServer = true; + public bool UseSnipeLocationServer = false; + public string SnipeLocationServer = "localhost"; + public int SnipeLocationServerPort = 16969; + public int MinPokeballsToSnipe = 20; + public int MinPokeballsWhileSnipe = 0; + public int MinDelayBetweenSnipes = 60000; + public double SnipingScanOffset = 0.003; + public bool SnipeAtPokestops = false; + public bool SnipeIgnoreUnknownIv = false; + public bool UseTransferIvForSnipe = false; + //rename + public bool RenamePokemon = false; + public bool RenameOnlyAboveIv = true; + public string RenameTemplate = "{1}_{0}"; + //amounts + public int MaxPokeballsPerPokemon = 6; + public int MaxTravelDistanceInMeters = 1000; + public int TotalAmountOfPokebalsToKeep = 120; + public int TotalAmountOfPotionsToKeep = 80; + public int TotalAmountOfRevivesToKeep = 60; + //balls + public int UseGreatBallAboveCp = 750; + public int UseUltraBallAboveCp = 1000; + public int UseMasterBallAboveCp = 1500; + public int UseGreatBallAboveIv = 80; + public int UseUltraBallAboveIv = 90; + public double UseGreatBallBelowCatchProbability = 0.5; + public double UseUltraBallBelowCatchProbability = 0.4; + public double UseMasterBallBelowCatchProbability = 0.05; + //transfer + public bool TransferDuplicatePokemon = true; + //favorite + public float FavoriteMinIvPercentage = 95; + public bool AutoFavoritePokemon = false; + //notcatch + public bool UsePokemonToNotCatchFilter = false; + public int WebSocketPort = 14251; + public List> ItemRecycleFilter = new List> { new KeyValuePair(ItemId.ItemUnknown, 0), @@ -146,21 +215,6 @@ public class GlobalSettings new KeyValuePair(ItemId.ItemItemStorageUpgrade, 100) }; - public int KeepMinCp = 1250; - public int KeepMinDuplicatePokemon = 1; - public float KeepMinIvPercentage = 90; - public bool KeepPokemonsThatCanEvolve = false; - public string LevelUpByCPorIv = "iv"; - public bool UseLuckyEggConstantly = true; - public bool UseIncenseConstantly = true; - public int MaxPokeballsPerPokemon = 6; - public int MaxSpawnLocationOffset = 10; - public int MaxTravelDistanceInMeters = 1000; - public int MinDelayBetweenSnipes = 60000; - public double SnipingScanOffset = 0.003; - public int MinPokeballsToSnipe = 20; - public int MinPokeballsWhileSnipe = 0; - public List PokemonsNotToTransfer = new List { //criteria: from SS Tier to A Tier + Regional Exclusive @@ -359,48 +413,7 @@ public class GlobalSettings PokemonId.Mewtwo }; - public bool PrioritizeIvOverCp = true; - - [JsonIgnore] public string ProfileConfigPath; - - [JsonIgnore] public string ProfilePath; - - public bool RenameOnlyAboveIv = true; - public bool RenamePokemon = false; - public float FavoriteMinIvPercentage = 95; - public bool AutoFavoritePokemon = false; - public string RenameTemplate = "{1}_{0}"; - public bool SnipeAtPokestops = false; - public bool SnipeIgnoreUnknownIv = false; - public string SnipeLocationServer = "localhost"; - public int SnipeLocationServerPort = 16969; - public bool StartupWelcomeDelay = true; - public int TotalAmountOfPokebalsToKeep = 120; - public int TotalAmountOfPotionsToKeep = 80; - public int TotalAmountOfRevivesToKeep = 60; - public bool TransferConfigAndAuthOnUpdate = true; - public bool TransferDuplicatePokemon = true; - public string TranslationLanguageCode = "en"; - public float UpgradePokemonCpMinimum = 1000; - public float UpgradePokemonIvMinimum = 95; - public bool UseEggIncubators = true; - public bool UseGpxPathing = false; - public int UseLuckyEggsMinPokemonAmount = 30; - public bool UseLuckyEggsWhileEvolving = false; - public int UseGreatBallAboveCp = 750; - public int UseUltraBallAboveCp = 1000; - public int UseMasterBallAboveCp = 1500; - public int UseGreatBallAboveIv = 80; - public int UseUltraBallAboveIv = 90; - public double UseGreatBallBelowCatchProbability = 0.5; - public double UseUltraBallBelowCatchProbability = 0.4; - public double UseMasterBallBelowCatchProbability = 0.05; - public bool UsePokemonToNotCatchFilter = false; - public bool UseSnipeLocationServer = false; - public bool UseTransferIvForSnipe = false; - public double WalkingSpeedInKilometerPerHour = 15.0; - public int WebSocketPort = 14251; - public bool UseSnipeOnlineLocationServer = true; + public static GlobalSettings Default => new GlobalSettings(); @@ -465,12 +478,7 @@ public static GlobalSettings Load(string path) settings.Save(configFile); settings.Auth.Load(Path.Combine(profileConfigPath, "auth.json")); - if (firstRun) - { - return null; - } - - return settings; + return firstRun ? null : settings; } public void Save(string fullPath) From 89b7966291c5b4c4090fd376311089f2a5338fe5 Mon Sep 17 00:00:00 2001 From: NecronomiconCoding Date: Sun, 31 Jul 2016 20:30:54 +0200 Subject: [PATCH 05/21] fix candy count --- PoGo.NecroBot.Logic/Inventory.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PoGo.NecroBot.Logic/Inventory.cs b/PoGo.NecroBot.Logic/Inventory.cs index aa19ca492..ce64c3c9d 100644 --- a/PoGo.NecroBot.Logic/Inventory.cs +++ b/PoGo.NecroBot.Logic/Inventory.cs @@ -111,7 +111,7 @@ public async Task> GetDuplicatePokemonToTransfer( if (settings.CandyToEvolve > 0) { - var amountPossible = familyCandy.Candy_ / (settings.CandyToEvolve - 2); + var amountPossible = (familyCandy.Candy_ - 1) / (settings.CandyToEvolve - 1); if (amountPossible > amountToSkip) amountToSkip = amountPossible; } From 19a38624c536549cd762bf9ac656170df3a9da53 Mon Sep 17 00:00:00 2001 From: TheTravelingTrainer Date: Sun, 31 Jul 2016 19:35:04 +0100 Subject: [PATCH 06/21] added request id to help with JS callbacks --- PoGo.NecroBot.CLI/PoGo.NecroBot.CLI.csproj | 7 +++++++ .../BasicGetCommands/Events/EggListResponce.cs | 5 ++++- .../BasicGetCommands/Events/ItemListResponce.cs | 4 +++- .../BasicGetCommands/Events/PokemonListResponce.cs | 4 +++- .../WebSocketHandler/BasicGetCommands/GetEggListHandler.cs | 2 +- .../BasicGetCommands/GetItemsListHandler.cs | 2 +- .../BasicGetCommands/GetPokemonListHandler.cs | 2 +- .../BasicGetCommands/Tasks/GetEggListTask.cs | 4 ++-- .../BasicGetCommands/Tasks/GetItemListTask.cs | 4 ++-- .../BasicGetCommands/Tasks/GetPokemonListTask.cs | 4 ++-- PoGo.NecroBot.CLI/WebSocketHandler/IWebSocketResponce.cs | 1 + 11 files changed, 27 insertions(+), 12 deletions(-) diff --git a/PoGo.NecroBot.CLI/PoGo.NecroBot.CLI.csproj b/PoGo.NecroBot.CLI/PoGo.NecroBot.CLI.csproj index cf260544b..539d29949 100644 --- a/PoGo.NecroBot.CLI/PoGo.NecroBot.CLI.csproj +++ b/PoGo.NecroBot.CLI/PoGo.NecroBot.CLI.csproj @@ -109,6 +109,13 @@ + + + + + + + diff --git a/PoGo.NecroBot.CLI/WebSocketHandler/BasicGetCommands/Events/EggListResponce.cs b/PoGo.NecroBot.CLI/WebSocketHandler/BasicGetCommands/Events/EggListResponce.cs index 849594117..73d120f7d 100644 --- a/PoGo.NecroBot.CLI/WebSocketHandler/BasicGetCommands/Events/EggListResponce.cs +++ b/PoGo.NecroBot.CLI/WebSocketHandler/BasicGetCommands/Events/EggListResponce.cs @@ -8,12 +8,15 @@ namespace PoGo.NecroBot.CLI.WebSocketHandler.BasicGetCommands.Events { public class EggListResponce : IWebSocketResponce { - public EggListResponce(dynamic data) + public EggListResponce(dynamic data, string requestID) { Command = "EggListWeb"; Data = data; + RequestID = requestID; } + public string RequestID { get; private set; } public string Command { get; private set; } public dynamic Data { get; private set; } + } } diff --git a/PoGo.NecroBot.CLI/WebSocketHandler/BasicGetCommands/Events/ItemListResponce.cs b/PoGo.NecroBot.CLI/WebSocketHandler/BasicGetCommands/Events/ItemListResponce.cs index 1f4f14895..84b20afa1 100644 --- a/PoGo.NecroBot.CLI/WebSocketHandler/BasicGetCommands/Events/ItemListResponce.cs +++ b/PoGo.NecroBot.CLI/WebSocketHandler/BasicGetCommands/Events/ItemListResponce.cs @@ -8,11 +8,13 @@ namespace PoGo.NecroBot.CLI.WebSocketHandler.BasicGetCommands.Events { class ItemListResponce : IWebSocketResponce { - public ItemListResponce(dynamic data) + public ItemListResponce(dynamic data,string requestID) { Command = "ItemListWeb"; Data = data; + RequestID = requestID; } + public string RequestID { get; private set; } public string Command { get; private set; } public dynamic Data { get; private set; } } diff --git a/PoGo.NecroBot.CLI/WebSocketHandler/BasicGetCommands/Events/PokemonListResponce.cs b/PoGo.NecroBot.CLI/WebSocketHandler/BasicGetCommands/Events/PokemonListResponce.cs index e16ffaf8a..c355be7b9 100644 --- a/PoGo.NecroBot.CLI/WebSocketHandler/BasicGetCommands/Events/PokemonListResponce.cs +++ b/PoGo.NecroBot.CLI/WebSocketHandler/BasicGetCommands/Events/PokemonListResponce.cs @@ -9,11 +9,13 @@ namespace PoGo.NecroBot.CLI.WebSocketHandler.BasicGetCommands.Events { public class PokemonListResponce : IWebSocketResponce, IEvent { - public PokemonListResponce(dynamic data) + public PokemonListResponce(dynamic data, string requestID) { Command = "PokemonListWeb"; Data = data; + RequestID = requestID; } + public string RequestID { get; private set; } public string Command { get; private set; } public dynamic Data { get; private set; } } diff --git a/PoGo.NecroBot.CLI/WebSocketHandler/BasicGetCommands/GetEggListHandler.cs b/PoGo.NecroBot.CLI/WebSocketHandler/BasicGetCommands/GetEggListHandler.cs index 65f45cb9b..3b0be9c75 100644 --- a/PoGo.NecroBot.CLI/WebSocketHandler/BasicGetCommands/GetEggListHandler.cs +++ b/PoGo.NecroBot.CLI/WebSocketHandler/BasicGetCommands/GetEggListHandler.cs @@ -20,7 +20,7 @@ public GetEggListHandler() public async Task Handle(ISession session, WebSocketSession webSocketSession, dynamic message) { - await GetEggListTask.Execute(session, webSocketSession); + await GetEggListTask.Execute(session, webSocketSession, (string)message.RequestID); } } } diff --git a/PoGo.NecroBot.CLI/WebSocketHandler/BasicGetCommands/GetItemsListHandler.cs b/PoGo.NecroBot.CLI/WebSocketHandler/BasicGetCommands/GetItemsListHandler.cs index 1e454ebec..ead924079 100644 --- a/PoGo.NecroBot.CLI/WebSocketHandler/BasicGetCommands/GetItemsListHandler.cs +++ b/PoGo.NecroBot.CLI/WebSocketHandler/BasicGetCommands/GetItemsListHandler.cs @@ -20,7 +20,7 @@ public GetItemsListHandler() public async Task Handle(ISession session, WebSocketSession webSocketSession, dynamic message) { - await GetItemListTask.Execute(session, webSocketSession); + await GetItemListTask.Execute(session, webSocketSession, message.requestID); } } diff --git a/PoGo.NecroBot.CLI/WebSocketHandler/BasicGetCommands/GetPokemonListHandler.cs b/PoGo.NecroBot.CLI/WebSocketHandler/BasicGetCommands/GetPokemonListHandler.cs index 7591f5bcd..f5bd8c2a2 100644 --- a/PoGo.NecroBot.CLI/WebSocketHandler/BasicGetCommands/GetPokemonListHandler.cs +++ b/PoGo.NecroBot.CLI/WebSocketHandler/BasicGetCommands/GetPokemonListHandler.cs @@ -20,7 +20,7 @@ public GetPokemonListHandler() public async Task Handle(ISession session, WebSocketSession webSocketSession, dynamic message) { - await GetPokemonListTask.Execute(session, webSocketSession); + await GetPokemonListTask.Execute(session, webSocketSession, (string)message.RequestID); } } } diff --git a/PoGo.NecroBot.CLI/WebSocketHandler/BasicGetCommands/Tasks/GetEggListTask.cs b/PoGo.NecroBot.CLI/WebSocketHandler/BasicGetCommands/Tasks/GetEggListTask.cs index 9d4f76347..029bce84c 100644 --- a/PoGo.NecroBot.CLI/WebSocketHandler/BasicGetCommands/Tasks/GetEggListTask.cs +++ b/PoGo.NecroBot.CLI/WebSocketHandler/BasicGetCommands/Tasks/GetEggListTask.cs @@ -14,7 +14,7 @@ namespace PoGo.NecroBot.CLI.WebSocketHandler.BasicGetCommands.Tasks class GetEggListTask { - public static async Task Execute(ISession session, WebSocketSession webSocketSession) + public static async Task Execute(ISession session, WebSocketSession webSocketSession, string requestID) { var incubators = (await session.Inventory.GetEggIncubators()) .Where(x => x.UsesRemaining > 0 || x.ItemId == ItemId.ItemIncubatorBasicUnlimited) @@ -32,7 +32,7 @@ public static async Task Execute(ISession session, WebSocketSession webSocketSes Incubators = incubators, UnusedEggs = unusedEggs }; - webSocketSession.Send(EncodingHelper.Serialize(new EggListResponce(list))); + webSocketSession.Send(EncodingHelper.Serialize(new EggListResponce(list,requestID))); await Task.Delay(500); } diff --git a/PoGo.NecroBot.CLI/WebSocketHandler/BasicGetCommands/Tasks/GetItemListTask.cs b/PoGo.NecroBot.CLI/WebSocketHandler/BasicGetCommands/Tasks/GetItemListTask.cs index c49a2df21..e3302d561 100644 --- a/PoGo.NecroBot.CLI/WebSocketHandler/BasicGetCommands/Tasks/GetItemListTask.cs +++ b/PoGo.NecroBot.CLI/WebSocketHandler/BasicGetCommands/Tasks/GetItemListTask.cs @@ -11,10 +11,10 @@ namespace PoGo.NecroBot.CLI.WebSocketHandler.BasicGetCommands.Tasks { class GetItemListTask { - public static async Task Execute(ISession session, WebSocketSession webSocketSession) + public static async Task Execute(ISession session, WebSocketSession webSocketSession, string requestID) { var allItems = await session.Inventory.GetItems(); - webSocketSession.Send(EncodingHelper.Serialize(new ItemListResponce(allItems))); + webSocketSession.Send(EncodingHelper.Serialize(new ItemListResponce(allItems, requestID))); await Task.Delay(500); } } diff --git a/PoGo.NecroBot.CLI/WebSocketHandler/BasicGetCommands/Tasks/GetPokemonListTask.cs b/PoGo.NecroBot.CLI/WebSocketHandler/BasicGetCommands/Tasks/GetPokemonListTask.cs index d01f9d013..05d2c2bec 100644 --- a/PoGo.NecroBot.CLI/WebSocketHandler/BasicGetCommands/Tasks/GetPokemonListTask.cs +++ b/PoGo.NecroBot.CLI/WebSocketHandler/BasicGetCommands/Tasks/GetPokemonListTask.cs @@ -12,12 +12,12 @@ namespace PoGo.NecroBot.CLI.WebSocketHandler.BasicGetCommands.Tasks class GetPokemonListTask { - public static async Task Execute(ISession session, WebSocketSession webSocketSession) + public static async Task Execute(ISession session, WebSocketSession webSocketSession, string requestID) { var allPokemonInBag = await session.Inventory.GetHighestsCp(1000); var list = new List(); allPokemonInBag.ToList().ForEach(o => list.Add(new PokemonListWeb(o))); - webSocketSession.Send(EncodingHelper.Serialize(new PokemonListResponce(list))); + webSocketSession.Send(EncodingHelper.Serialize(new PokemonListResponce(list,requestID))); await Task.Delay(500); } diff --git a/PoGo.NecroBot.CLI/WebSocketHandler/IWebSocketResponce.cs b/PoGo.NecroBot.CLI/WebSocketHandler/IWebSocketResponce.cs index e9cbedc8b..8d197ebe2 100644 --- a/PoGo.NecroBot.CLI/WebSocketHandler/IWebSocketResponce.cs +++ b/PoGo.NecroBot.CLI/WebSocketHandler/IWebSocketResponce.cs @@ -8,6 +8,7 @@ namespace PoGo.NecroBot.CLI.WebSocketHandler { interface IWebSocketResponce { + string RequestID { get; } string Command { get; } dynamic Data { get; } } From 664ad8108844dfe656bd3151b669349c6c0f6775 Mon Sep 17 00:00:00 2001 From: Nicolas Schmitt Date: Sun, 31 Jul 2016 20:41:09 +0200 Subject: [PATCH 07/21] Events: Add info to eggslist event to display accurate data --- PoGo.NecroBot.Logic/Event/EggsListEvent.cs | 1 + PoGo.NecroBot.Logic/Tasks/EggsListTask.cs | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/PoGo.NecroBot.Logic/Event/EggsListEvent.cs b/PoGo.NecroBot.Logic/Event/EggsListEvent.cs index b53bae8e9..ef5a5b90b 100644 --- a/PoGo.NecroBot.Logic/Event/EggsListEvent.cs +++ b/PoGo.NecroBot.Logic/Event/EggsListEvent.cs @@ -9,6 +9,7 @@ namespace PoGo.NecroBot.Logic.Event { public class EggsListEvent : IEvent { + public float PlayerKmWalked { get; set; } public List Incubators { get; set; } public object UnusedEggs { get; set; } } diff --git a/PoGo.NecroBot.Logic/Tasks/EggsListTask.cs b/PoGo.NecroBot.Logic/Tasks/EggsListTask.cs index f58d68559..2d078a6ab 100644 --- a/PoGo.NecroBot.Logic/Tasks/EggsListTask.cs +++ b/PoGo.NecroBot.Logic/Tasks/EggsListTask.cs @@ -14,6 +14,14 @@ public class EggsListTask { public static async Task Execute(ISession session) { + await session.Inventory.RefreshCachedInventory(); + + var playerStats = (await session.Inventory.GetPlayerStats()).FirstOrDefault(); + if (playerStats == null) + return; + + var kmWalked = playerStats.KmWalked; + var incubators = (await session.Inventory.GetEggIncubators()) .Where(x => x.UsesRemaining > 0 || x.ItemId == ItemId.ItemIncubatorBasicUnlimited) .OrderByDescending(x => x.ItemId == ItemId.ItemIncubatorBasicUnlimited) @@ -27,6 +35,7 @@ public static async Task Execute(ISession session) session.EventDispatcher.Send( new EggsListEvent { + PlayerKmWalked = kmWalked, Incubators = incubators, UnusedEggs = unusedEggs }); From bde246615b5c0f018d7bc34a57e05cda645e3f38 Mon Sep 17 00:00:00 2001 From: Oolaruu Date: Sun, 31 Jul 2016 21:16:24 +0200 Subject: [PATCH 08/21] Update translation.fr.json Fixed few minor typos For next translation, http://pastebin.com/ygM7eux9 Added "DisplayHighestCandy" To discuss: "farmPokestopsOutsideRadius" ? Next to be added, but I have no "Key" - No Eggs Available - Lucky Egg Already Active - No Incense Available - Incense Already Active - Amount of Pokemon Seen: {}:151, Amount of Pokemon Caught:{}:151 - Potential Evolves: {} - Pokemon Upgrade Failed Not Enough Resources - JSON Exception: You need to properly configure your PtcUsername using quotations. - JSON Exception: You need to properly configure your PtcPassword using quotations. --- .../Config/Translations/translation.fr.json | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/PoGo.NecroBot.CLI/Config/Translations/translation.fr.json b/PoGo.NecroBot.CLI/Config/Translations/translation.fr.json index 11890820e..150dd8cae 100644 --- a/PoGo.NecroBot.CLI/Config/Translations/translation.fr.json +++ b/PoGo.NecroBot.CLI/Config/Translations/translation.fr.json @@ -2,7 +2,7 @@ "TranslationStrings": [ { "Key": "pokeball", - "Value": "PokeBall" + "Value": "PokéBall" }, { "Key": "greatPokeball", @@ -30,7 +30,7 @@ }, { "Key": "eventFortUsed", - "Value": "Nom : {0} | {1}XP, Gems : {2}, Objets : {3}" + "Value": "{0} | {1}XP, Objets: {3} | {2}" }, { "Key": "eventFortFailed", @@ -38,7 +38,7 @@ }, { "Key": "eventFortTargeted", - "Value": "Arrivée au Pokestop : {0} dans ({1}m)" + "Value": "{0} dans {1}m" }, { "Key": "eventProfileLogin", @@ -46,7 +46,7 @@ }, { "Key": "eventUsedLuckyEgg", - "Value": "Utilisation d'un Oeuf Chance, temps restant : {0}" + "Value": "Bonus Oeuf Chance : {0}min restant" }, { "Key": "eventPokemonEvolvedSuccess", @@ -58,7 +58,7 @@ }, { "Key": "eventPokemonTransferred", - "Value": "{0}\t- PC: {1} - IV: {2}% [Maximum PC:{3} IV: {4}%] ({5} Bonbons)" + "Value": "{0}\t- {1} / {2}% [Maximum {3} / {4}%] ({5} Bonbons)" }, { "Key": "eventItemRecycled", @@ -66,7 +66,7 @@ }, { "Key": "eventPokemonCapture", - "Value": "({0}) | ({1}) {2} Lv {3} {6} ({4}/{5}) | {7}% Chance sur {8}m | {10} {9} restant, {11}" + "Value": "({0}) |{1}-{2} Lv {3} {6}% {4}/{5} | {7}% Chance sur {8}m | {10} {9} restant, {11}" }, { "Key": "eventNoPokeballs", @@ -82,7 +82,7 @@ }, { "Key": "candies", - "Value": "{0}Bonbons" + "Value": "{0} Bonbons" }, { "Key": "unhandledGPXData", @@ -254,7 +254,7 @@ }, { "Key": "pokemonSkipped", - "Value": "{0} ignoré" + "Value": "{0} est ignoré" }, { "Key": "zeroPokeballInv", @@ -262,11 +262,11 @@ }, { "Key": "currentPokeballInv", - "Value": "[Inventaire] Pokeballs: {0} | Superballs: {1} | Hyperballs: {2} | Masterballs: {3}" + "Value": "[Inventaire] Pokéballs: {0} | Superballs: {1} | Hyperballs: {2} | Masterballs: {3}" }, { "Key": "checkingForBallsToRecycle", - "Value": "Recherche de PokeBalls à supprimer. En garder {0}" + "Value": "Recherche de PokéBalls à supprimer. En garder {0}" }, { "Key": "checkingForPotionsToRecycle", @@ -410,11 +410,15 @@ }, { "Key": "displayHighestMove1Header", - "Value": "ATTAQUE1" + "Value": "Attaque 1" }, { "Key": "displayHighestMove2Header", - "Value": "ATTAQUE2" + "Value": "Attaque 2" + } + { + "Key": "DisplayHighestCandy", + "Value": "Bonbons" } ] } From 77d2c8dd6302ce767638916b4e57f8a704f43690 Mon Sep 17 00:00:00 2001 From: NecronomiconCoding Date: Sun, 31 Jul 2016 21:16:39 +0200 Subject: [PATCH 09/21] fix typo --- PoGo.NecroBot.CLI/Config/Translations/translation.de.json | 2 +- PoGo.NecroBot.CLI/Config/Translations/translation.es.json | 4 ++-- PoGo.NecroBot.CLI/Config/Translations/translation.fr.json | 4 ++-- PoGo.NecroBot.Logic/Common/Translations.cs | 2 +- PoGo.NecroBot.Logic/ILogicSettings.cs | 2 +- PoGo.NecroBot.Logic/Inventory.cs | 4 ++-- PoGo.NecroBot.Logic/Settings.cs | 2 +- PoGo.NecroBot.Logic/Tasks/RecycleItemsTask.cs | 6 +++--- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/PoGo.NecroBot.CLI/Config/Translations/translation.de.json b/PoGo.NecroBot.CLI/Config/Translations/translation.de.json index daf33197d..4965388d2 100644 --- a/PoGo.NecroBot.CLI/Config/Translations/translation.de.json +++ b/PoGo.NecroBot.CLI/Config/Translations/translation.de.json @@ -312,7 +312,7 @@ }, { "Key": "PokeballsToKeepIncorrect", - "Value": "TotalAmountOfPokebalsToKeep ist falsch konfiguriert. Die Zahl ist kleiner als 1." + "Value": "TotalAmountOfPokeballsToKeep ist falsch konfiguriert. Die Zahl ist kleiner als 1." }, { "Key": "PotionsToKeepIncorrect", diff --git a/PoGo.NecroBot.CLI/Config/Translations/translation.es.json b/PoGo.NecroBot.CLI/Config/Translations/translation.es.json index c626e0b7f..4b1040f3e 100644 --- a/PoGo.NecroBot.CLI/Config/Translations/translation.es.json +++ b/PoGo.NecroBot.CLI/Config/Translations/translation.es.json @@ -1,4 +1,4 @@ -{ +{ "TranslationStrings": [ { "Key": "pokeball", @@ -290,7 +290,7 @@ }, { "Key": "pokeballsToKeepIncorrect", - "Value": "TotalAmountOfPokebalsToKeep está configurado incorrectamente. El número es más pequeño que 1." + "Value": "TotalAmountOfPokeballsToKeep está configurado incorrectamente. El número es más pequeño que 1." }, { "Key": "potionsToKeepIncorrect", diff --git a/PoGo.NecroBot.CLI/Config/Translations/translation.fr.json b/PoGo.NecroBot.CLI/Config/Translations/translation.fr.json index 11890820e..cba428760 100644 --- a/PoGo.NecroBot.CLI/Config/Translations/translation.fr.json +++ b/PoGo.NecroBot.CLI/Config/Translations/translation.fr.json @@ -1,4 +1,4 @@ -{ +{ "TranslationStrings": [ { "Key": "pokeball", @@ -278,7 +278,7 @@ }, { "Key": "pokeballsToKeepIncorrect", - "Value": "TotalAmountOfPokebalsToKeep est mal configuré. Le nombre est inférieur à 1." + "Value": "TotalAmountOfPokeballsToKeep est mal configuré. Le nombre est inférieur à 1." }, { "Key": "potionsToKeepIncorrect", diff --git a/PoGo.NecroBot.Logic/Common/Translations.cs b/PoGo.NecroBot.Logic/Common/Translations.cs index cbea43ec3..fdca76831 100644 --- a/PoGo.NecroBot.Logic/Common/Translations.cs +++ b/PoGo.NecroBot.Logic/Common/Translations.cs @@ -261,7 +261,7 @@ public class Translation : ITranslation new KeyValuePair(TranslationString.CheckingForRevivesToRecycle, "Checking for revives to recycle, keeping {0}"), new KeyValuePair(TranslationString.PokeballsToKeepIncorrect, - "TotalAmountOfPokebalsToKeep is configured incorrectly. The number is smaller than 1."), + "TotalAmountOfPokeballsToKeep is configured incorrectly. The number is smaller than 1."), new KeyValuePair(TranslationString.PotionsToKeepIncorrect, "TotalAmountOfPotionsToKeep is configured incorrectly. The number is smaller than 1."), new KeyValuePair(TranslationString.RevivesToKeepIncorrect, diff --git a/PoGo.NecroBot.Logic/ILogicSettings.cs b/PoGo.NecroBot.Logic/ILogicSettings.cs index fd26849e8..4bd5eed4a 100644 --- a/PoGo.NecroBot.Logic/ILogicSettings.cs +++ b/PoGo.NecroBot.Logic/ILogicSettings.cs @@ -122,7 +122,7 @@ public interface ILogicSettings bool SnipeIgnoreUnknownIv { get; } int MinDelayBetweenSnipes { get; } double SnipingScanOffset { get; } - int TotalAmountOfPokebalsToKeep { get; } + int TotalAmountOfPokeballsToKeep { get; } int TotalAmountOfPotionsToKeep { get; } int TotalAmountOfRevivesToKeep { get; } diff --git a/PoGo.NecroBot.Logic/Inventory.cs b/PoGo.NecroBot.Logic/Inventory.cs index ce64c3c9d..f2564abd5 100644 --- a/PoGo.NecroBot.Logic/Inventory.cs +++ b/PoGo.NecroBot.Logic/Inventory.cs @@ -245,7 +245,7 @@ public async Task> GetItemsToRecycle(ISession session) var itemsToRecylce = new List(); var myItems = (await GetItems()).ToList(); - var amountOfPokeballsToKeep = _logicSettings.TotalAmountOfPokebalsToKeep; + var amountOfPokeballsToKeep = _logicSettings.TotalAmountOfPokeballsToKeep; var amountOfPotionsToKeep = _logicSettings.TotalAmountOfPotionsToKeep; var amountOfRevivesToKeep = _logicSettings.TotalAmountOfRevivesToKeep; @@ -315,7 +315,7 @@ public async Task> GetPlayerStats() private List GetPokeballsToRecycle(ISession session, IReadOnlyList myItems) { - var amountOfPokeballsToKeep = _logicSettings.TotalAmountOfPokebalsToKeep; + var amountOfPokeballsToKeep = _logicSettings.TotalAmountOfPokeballsToKeep; if (amountOfPokeballsToKeep < 1) { Logger.Write(session.Translation.GetTranslation(TranslationString.PokeballsToKeepIncorrect), diff --git a/PoGo.NecroBot.Logic/Settings.cs b/PoGo.NecroBot.Logic/Settings.cs index ab267cc01..578093850 100644 --- a/PoGo.NecroBot.Logic/Settings.cs +++ b/PoGo.NecroBot.Logic/Settings.cs @@ -664,7 +664,7 @@ public LogicSettings(GlobalSettings settings) public bool SnipeIgnoreUnknownIv => _settings.SnipeIgnoreUnknownIv; public int MinDelayBetweenSnipes => _settings.MinDelayBetweenSnipes; public double SnipingScanOffset => _settings.SnipingScanOffset; - public int TotalAmountOfPokebalsToKeep => _settings.TotalAmountOfPokebalsToKeep; + public int TotalAmountOfPokeballsToKeep => _settings.TotalAmountOfPokebalsToKeep; public int TotalAmountOfPotionsToKeep => _settings.TotalAmountOfPotionsToKeep; public int TotalAmountOfRevivesToKeep => _settings.TotalAmountOfRevivesToKeep; } diff --git a/PoGo.NecroBot.Logic/Tasks/RecycleItemsTask.cs b/PoGo.NecroBot.Logic/Tasks/RecycleItemsTask.cs index 1fc17a97f..fa5e0d311 100644 --- a/PoGo.NecroBot.Logic/Tasks/RecycleItemsTask.cs +++ b/PoGo.NecroBot.Logic/Tasks/RecycleItemsTask.cs @@ -40,7 +40,7 @@ public static async Task Execute(ISession session, CancellationToken cancellatio DelayingUtils.Delay(session.LogicSettings.DelayBetweenPlayerActions, 500); } - if (session.LogicSettings.TotalAmountOfPokebalsToKeep != 0) + if (session.LogicSettings.TotalAmountOfPokeballsToKeep != 0) { await OptimizedRecycleBalls(session, cancellationToken); } @@ -71,9 +71,9 @@ private static async Task OptimizedRecycleBalls(ISession session, CancellationTo */ int totalBallsCount = pokeBallsCount + greatBallsCount + ultraBallsCount + masterBallsCount; - if (totalBallsCount > session.LogicSettings.TotalAmountOfPokebalsToKeep) + if (totalBallsCount > session.LogicSettings.TotalAmountOfPokeballsToKeep) { - int diff = totalBallsCount - session.LogicSettings.TotalAmountOfPokebalsToKeep; + int diff = totalBallsCount - session.LogicSettings.TotalAmountOfPokeballsToKeep; if (diff > 0) { int pokeBallsToKeep = pokeBallsCount - diff; From bc0a654ea171986ff84ae3220425990b7384cbc2 Mon Sep 17 00:00:00 2001 From: NecronomiconCoding Date: Sun, 31 Jul 2016 21:18:12 +0200 Subject: [PATCH 10/21] improve rounding --- PoGo.NecroBot.Logic/Tasks/CatchPokemonTask.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PoGo.NecroBot.Logic/Tasks/CatchPokemonTask.cs b/PoGo.NecroBot.Logic/Tasks/CatchPokemonTask.cs index 995a0e257..11321b0c1 100644 --- a/PoGo.NecroBot.Logic/Tasks/CatchPokemonTask.cs +++ b/PoGo.NecroBot.Logic/Tasks/CatchPokemonTask.cs @@ -182,7 +182,7 @@ private static async Task GetBestBall(ISession session, dynamic encounte Math.Round( PokemonInfo.CalculatePokemonPerfection(encounter is EncounterResponse ? encounter.WildPokemon?.PokemonData - : encounter?.PokemonData)); + : encounter?.PokemonData), 2); var pokeBallsCount = await session.Inventory.GetItemAmountByType(ItemId.ItemPokeBall); var greatBallsCount = await session.Inventory.GetItemAmountByType(ItemId.ItemGreatBall); From c30762b0ae5d2454a2e24c5dbe27fa75d52503f2 Mon Sep 17 00:00:00 2001 From: simplyphp Date: Sun, 31 Jul 2016 15:14:42 -0500 Subject: [PATCH 11/21] Resolved issue with default value of zero for snipingscanoffset --- PoGo.NecroBot.Logic/Settings.cs | 56 +++++++++++++++++++ PoGo.NecroBot.Logic/Tasks/SnipePokemonTask.cs | 3 +- 2 files changed, 58 insertions(+), 1 deletion(-) diff --git a/PoGo.NecroBot.Logic/Settings.cs b/PoGo.NecroBot.Logic/Settings.cs index 123d183ae..6c4c40237 100644 --- a/PoGo.NecroBot.Logic/Settings.cs +++ b/PoGo.NecroBot.Logic/Settings.cs @@ -10,6 +10,9 @@ using PokemonGo.RocketAPI.Enums; using POGOProtos.Enums; using POGOProtos.Inventory.Item; +using System.ComponentModel; +using System.Reflection; +using System.Collections; #endregion @@ -95,6 +98,8 @@ public void Save() public class GlobalSettings { + + public int AmountOfPokemonToDisplayOnStart = 10; [JsonIgnore] internal AuthSettings Auth = new AuthSettings(); @@ -422,6 +427,27 @@ public static GlobalSettings Load(string path) jsonSettings.DefaultValueHandling = DefaultValueHandling.Populate; settings = JsonConvert.DeserializeObject(input, jsonSettings); + + // One day we might be able to better do this so its automatic + /* + FieldInfo[] fi = typeof(GlobalSettings).GetFields(BindingFlags.Public | BindingFlags.Instance); + foreach (FieldInfo info in fi) + { + if (info.GetValue(Default) is int || info.GetValue(Default) is bool || + info.GetValue(Default) is float) + { + + } + if (info.GetValue(Default) is double) + { + Logger.Write($"{info.Name}={info.GetValue(Default)}", LogLevel.Error); + + Type type = settings.GetType(); + PropertyInfo propertyInfo = type.GetProperty(info.Name, BindingFlags.Instance | BindingFlags.Public); + propertyInfo.SetValue(settings, info.GetValue(Default)); + } + } + */ } catch (JsonReaderException exception) { @@ -434,6 +460,21 @@ public static GlobalSettings Load(string path) settings = new GlobalSettings(); } + if (settings.DefaultAltitude <= 0) + { + settings.DefaultAltitude = Default.DefaultAltitude; + } + + if (settings.DefaultLatitude <= 0) + { + settings.DefaultLatitude = Default.DefaultLatitude; + } + + if (settings.DefaultLongitude <= 0) + { + settings.DefaultLongitude = Default.DefaultLongitude; + } + if (settings.WebSocketPort == 0) { settings.WebSocketPort = 14251; @@ -454,6 +495,21 @@ public static GlobalSettings Load(string path) settings.SnipeLocationServer = Default.SnipeLocationServer; } + if (settings.SnipingScanOffset <= 0) + { + settings.SnipingScanOffset = Default.SnipingScanOffset; + } + + if (settings.RecycleInventoryAtUsagePercentage <= 0) + { + settings.RecycleInventoryAtUsagePercentage = Default.RecycleInventoryAtUsagePercentage; + } + + if (settings.WalkingSpeedInKilometerPerHour <= 0) + { + settings.WalkingSpeedInKilometerPerHour = Default.WalkingSpeedInKilometerPerHour; + } + settings.ProfilePath = profilePath; settings.ProfileConfigPath = profileConfigPath; settings.GeneralConfigPath = Path.Combine(Directory.GetCurrentDirectory(), "config"); diff --git a/PoGo.NecroBot.Logic/Tasks/SnipePokemonTask.cs b/PoGo.NecroBot.Logic/Tasks/SnipePokemonTask.cs index 4c2bf653e..e1bee21bd 100644 --- a/PoGo.NecroBot.Logic/Tasks/SnipePokemonTask.cs +++ b/PoGo.NecroBot.Logic/Tasks/SnipePokemonTask.cs @@ -308,7 +308,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.06) offset=0.003; + if (offset<0.001) offset=0.003; + if (offset>0.06) offset = 0.06; var bound_lower_left_lat = location.Latitude - offset; var bound_lower_left_lng = location.Longitude - offset; From 508ab4f2d950d06bf450e06b47a48e02468d7e23 Mon Sep 17 00:00:00 2001 From: Dawid Date: Sun, 31 Jul 2016 22:29:04 +0200 Subject: [PATCH 12/21] Update translation.pl.json --- .../Config/Translations/translation.pl.json | 104 +++++++++++++----- 1 file changed, 78 insertions(+), 26 deletions(-) diff --git a/PoGo.NecroBot.CLI/Config/Translations/translation.pl.json b/PoGo.NecroBot.CLI/Config/Translations/translation.pl.json index c78d4e457..b5b03aa90 100644 --- a/PoGo.NecroBot.CLI/Config/Translations/translation.pl.json +++ b/PoGo.NecroBot.CLI/Config/Translations/translation.pl.json @@ -1,4 +1,4 @@ -{ +{ "TranslationStrings": [ { "Key": "pokeball", @@ -18,15 +18,15 @@ }, { "Key": "wrongAuthType", - "Value": "Nieznany tryb logowania w config.json" + "Value": "Nieznany AuthType w \"config.json\" wpisz Google lub Ptc" }, { "Key": "farmPokestopsOutsideRadius", - "Value": "Znajdujesz się poza swoim zdefiniowanym zasięgiem! Przemieszczam się na start odległy o ({0}m) za 5 sekund. Czy twój plik Coords.ini jest poprawny?" + "Value": "Znajdujesz się poza swoim zdefiniowanym zasięgiem! Przemieszczam Cię na start odległy o ({0}m) za 5 sekund. Sprawdź, czy Twój plik \"Coords.ini\" jest poprawny!" }, { "Key": "farmPokestopsNoUsableFound", - "Value": "Nie znaleziono PokeStopów w twojej okolicy. Czy twój maksymalny zasięg jest za mały?" + "Value": "Nie znaleziono PokeStopów w Twojej okolicy. Twój maksymalny zasięg jest za mały!" }, { "Key": "eventFortUsed", @@ -38,7 +38,7 @@ }, { "Key": "eventFortTargeted", - "Value": "Dotarcie do PokeStopu: {0} za ({1}m)" + "Value": "Dotrzesz do PokeStopu: {0} za ({1}m)" }, { "Key": "eventProfileLogin", @@ -50,7 +50,7 @@ }, { "Key": "eventPokemonEvolvedSuccess", - "Value": "{0} z powodzeniem za {1}xp" + "Value": "{0}. Otrzymujesz {1}xp" }, { "Key": "eventPokemonEvolvedFailed", @@ -130,7 +130,7 @@ }, { "Key": "incubatorEggHatched", - "Value": "Wykluło się jajko z inkubatora: {0}" + "Value": "Jajko wykluło się! Otrzymujesz {0} | Poziom: {1} CP: ({2}/{3}) IV: {4}%" }, { "Key": "logEntryError", @@ -154,19 +154,19 @@ }, { "Key": "logEntryRecycling", - "Value": "USUWANIE" + "Value": "USUNIĘTO" }, { - "Key": "logEntryPKMN", + "Key": "logEntryPkmn", "Value": "POKEMON" }, { "Key": "logEntryTransfered", - "Value": "PRZESŁANO" + "Value": "ODESŁANO" }, { "Key": "logEntryEvolved", - "Value": "WYEWOLUOWAL" + "Value": "WYEWOLUOWAŁ" }, { "Key": "logEntryBerry", @@ -186,11 +186,11 @@ }, { "Key": "loggingIn", - "Value": "Logowanie się przy użyciu konta {0}" + "Value": "Logujesz się przy użyciu konta {0}" }, { "Key": "ptcOffline", - "Value": "Serwery PTC najprawdopodobniej nie działają albo twoje dane są błędne. Spróbuj konta Google." + "Value": "Serwery PTC najprawdopodobniej nie działają albo Twoje dane są błędne. Spróbuj użyć konta Google." }, { "Key": "tryingAgainIn", @@ -198,7 +198,7 @@ }, { "Key": "accountNotVerified", - "Value": "Konto niezweryfikowane, zamykam program..." + "Value": "Konto niezweryfikowane! Zamykam program..." }, { "Key": "openingGoogleDevicePage", @@ -218,11 +218,11 @@ }, { "Key": "notRealisticTravel", - "Value": "Nie realistyczne podróżowanie na {0}, używam ostatnich ustawień z Coords.ini" + "Value": "Nie realistyczne podróżowanie na {0}, używam ostatnich ustawień z \"Coords.ini\"" }, { "Key": "coordinatesAreInvalid", - "Value": "Współrzędne w pliku \"Coords.ini\" są niepoprawne, używam współrzędnych domyślnych " + "Value": "Współrzędne w pliku \"Coords.ini\" są niepoprawne, używam domyślnych współrzędnych" }, { "Key": "gotUpToDateVersion", @@ -244,6 +244,10 @@ "Key": "finishedUnpackingFiles", "Value": "Zakończono wypakowywanie plików..." }, + { + "Key": "finishedTransferringConfig", + "Value": "Zakończono przenoszenie Twoich ustawień do nowej wersji programu..." + }, { "Key": "updateFinished", "Value": "Aktualizacja zakończona, możesz teraz zamknąć okno." @@ -264,6 +268,38 @@ "Key": "pokemonSkipped", "Value": "Pominięto {0}" }, + { + "Key": "zeroPokeballInv", + "Value": "Brak Pokeballi w Twoim ekwipunku, nie możesz złapać więcej Pokemonów!" + }, + { + "Key": "currentPokeballInv", + "Value": "[Aktualny Inwentarz] Pokeballe: {0} | Greatballe: {1} | Ultraballe: {2} | Masterballe: {3}" + }, + { + "Key": "checkingForBallsToRecycle", + "Value": "Sprawdzanie ilości Pokeballi, zostawiając {0}" + }, + { + "Key": "checkingForPotionsToRecycle", + "Value": "Sprawdzanie ilości Eliksirów, zostawiając {0}" + }, + { + "Key": "checkingForRevivesToRecycle", + "Value": "Sprawdzanie ilości Uzdrowień, zostawiając {0}" + }, + { + "Key": "pokeballsToKeepIncorrect", + "Value": "Wartość TotalAmountOfPokebalsToKeep nie może być mniejsza niż 1. Zmień ją!" + }, + { + "Key": "potionsToKeepIncorrect", + "Value": "Wartość TotalAmountOfPotionsToKeep nie może być mniejsza niż 1. Zmień ją!" + }, + { + "Key": "revivesToKeepIncorrect", + "Value": "Wartość TotalAmountOfRevivesToKeep nie może być mniejsza niż 1. Zmień ją!" + }, { "Key": "invFullTransferring", "Value": "Inwentarz jest pełny. Przesyłam Pokemony..." @@ -290,7 +326,7 @@ }, { "Key": "pokemonRename", - "Value": "Zmieniono nazwę Pokemona {0} z {2} na {3}." + "Value": "Nazwa Pokemona {0} ({1}) została zmieniona z {2} na {3}." }, { "Key": "pokemonIgnoreFilter", @@ -302,7 +338,7 @@ }, { "Key": "catchStatusError", - "Value": "Błąd Złapania" + "Value": "Błąd Łapania" }, { "Key": "catchStatusEscape", @@ -318,7 +354,7 @@ }, { "Key": "catchStatusSuccess", - "Value": "Łapanie" + "Value": "Złapano" }, { "Key": "catchTypeNormal", @@ -334,7 +370,7 @@ }, { "Key": "webSocketFailStart", - "Value": "Niepowodzenie uruchomienia WebSocketServer na porcie : {0}" + "Value": "Uruchamianie WebSocketServer na porcie: {0} zakończone niepowodzeniem" }, { "Key": "statsTemplateString", @@ -342,19 +378,19 @@ }, { "Key": "statsXpTemplateString", - "Value": "{0} (następny poziom za {1}h {2}m) | {3}/{4} XP)" + "Value": "{0} (Następny poziom za {1}h {2}m) | {3}/{4} XP)" }, { "Key": "requireInputText", - "Value": "Wznowienie programu po naciśnieciu klawisza..." + "Value": "Wznowienie programu nastąpi po naciśnieciu dowolnego klawisza..." }, { "Key": "googleTwoFactorAuth", - "Value": "Na twoim koncie Google aktywna jest weryfikacja dwuetapowa, będziesz musial wstawić hasło do aplikacji w \"auth.json\" " + "Value": "Na twoim koncie Google aktywna jest weryfikacja dwuetapowa, będziesz musial wpisać nowe hasło do aplikacji w \"auth.json\"" }, { "Key": "googleTwoFactorAuthExplanation", - "Value": "Otwieram hasła aplikacji Google. Proszę utworzyć nowe hasło aplikacji (inne niż hasło urządzenia)" + "Value": "Otwieram hasła aplikacji Google. Proszę utworzyć nowe hasło aplikacji (Wybierz aplikację: Inna)" }, { "Key": "googleError", @@ -362,19 +398,35 @@ }, { "Key": "missingCredentialsGoogle", - "Value": "Proszę wypełnić GoogleUsername oraz GooglePassword w \"auth.json\" " + "Value": "Proszę wypełnić GoogleUsername oraz GooglePassword w \"auth.json\"" }, { "Key": "missingCredentialsPtc", - "Value": "Proszę wypełnić PtcUsername oraz PtcPassword w \"auth.json\" " + "Value": "Proszę wypełnić PtcUsername oraz PtcPassword w \"auth.json\"" }, { "Key": "snipeScan", "Value": "[Snajper] Skanuję w poszukiwaniu Pokemona w {0}..." }, + { + "Key": "snipeScanEx", + "Value": "[Snajper] Mam na celowniku {0} z {1} i {2} IV..." + }, { "Key": "noPokemonToSnipe", "Value": "[Snajper] Nie znaleziono żadnego Pokemona!" + }, + { + "Key": "notEnoughPokeballsToSnipe", + "Value": "[Snajper] Zbyt mało Pokeballi! ({0}/{1})" + }, + { + "Key": "displayHighestMove1Header", + "Value": "RUCH1" + }, + { + "Key": "displayHighestMove2Header", + "Value": "RUCH2" } ] } From b016e76add239bfd9fa2fb4e8b7271b076c89791 Mon Sep 17 00:00:00 2001 From: Stephan Date: Sun, 31 Jul 2016 22:46:55 +0200 Subject: [PATCH 13/21] Fixed the berry event handlig in the CLI and added the berry type --- .../Config/Translations/translation.de.json | 8 ++++++++ PoGo.NecroBot.CLI/ConsoleEventListener.cs | 13 ++++++++++++- PoGo.NecroBot.Logic/Common/Translations.cs | 4 ++++ PoGo.NecroBot.Logic/Event/UseBerryEvent.cs | 5 ++++- PoGo.NecroBot.Logic/Tasks/CatchPokemonTask.cs | 2 +- 5 files changed, 29 insertions(+), 3 deletions(-) diff --git a/PoGo.NecroBot.CLI/Config/Translations/translation.de.json b/PoGo.NecroBot.CLI/Config/Translations/translation.de.json index 4965388d2..f1cd90af7 100644 --- a/PoGo.NecroBot.CLI/Config/Translations/translation.de.json +++ b/PoGo.NecroBot.CLI/Config/Translations/translation.de.json @@ -106,6 +106,14 @@ "Key": "eventNoPokeballs", "Value": "Keine Pokébälle mehr! - Wir haben ein {0} mit {1} WP verpasst!" }, + { + "Key": "eventUseBerry", + "Value": "{0} benutzt, {1} verbleibend" + }, + { + "Key": "itemRazzBerry", + "Value": "Himmihbeere" + }, { "Key": "catchStatusAttempt", "Value": "{0} Versuch #{1}" diff --git a/PoGo.NecroBot.CLI/ConsoleEventListener.cs b/PoGo.NecroBot.CLI/ConsoleEventListener.cs index c72d6df83..e338ff6c9 100644 --- a/PoGo.NecroBot.CLI/ConsoleEventListener.cs +++ b/PoGo.NecroBot.CLI/ConsoleEventListener.cs @@ -180,7 +180,18 @@ public void HandleEvent(NoPokeballEvent evt, ISession session) public void HandleEvent(UseBerryEvent evt, ISession session) { - Logger.Write(session.Translation.GetTranslation(TranslationString.EventNoPokeballs, evt.Count), + string strBerry; + switch (evt.BerryType) + { + case ItemId.ItemRazzBerry: + strBerry = session.Translation.GetTranslation(TranslationString.ItemRazzBerry); + break; + default: + strBerry = evt.BerryType.ToString(); + break; + } + + Logger.Write(session.Translation.GetTranslation(TranslationString.EventUseBerry, strBerry, evt.Count), LogLevel.Berry); } diff --git a/PoGo.NecroBot.Logic/Common/Translations.cs b/PoGo.NecroBot.Logic/Common/Translations.cs index fdca76831..ba34a6e63 100644 --- a/PoGo.NecroBot.Logic/Common/Translations.cs +++ b/PoGo.NecroBot.Logic/Common/Translations.cs @@ -39,6 +39,8 @@ public enum TranslationString EventItemRecycled, EventPokemonCapture, EventNoPokeballs, + EventUseBerry, + ItemRazzBerry, CatchStatusAttempt, CatchStatus, Candies, @@ -174,6 +176,8 @@ public class Translation : ITranslation "({0}) | ({1}) {2} Lvl: {3} CP: ({4}/{5}) IV: {6}% | Chance: {7}% | {8}m dist | with a {9} ({10} left). | {11}"), new KeyValuePair(TranslationString.EventNoPokeballs, "No Pokeballs - We missed a {0} with CP {1}"), + new KeyValuePair(TranslationString.EventUseBerry, "Used {0} | {1} remaining"), + new KeyValuePair(TranslationString.ItemRazzBerry, "Razz Berry"), new KeyValuePair(TranslationString.CatchStatusAttempt, "{0} Attempt #{1}"), new KeyValuePair(TranslationString.CatchStatus, "{0}"), new KeyValuePair(TranslationString.Candies, "Candies: {0}"), diff --git a/PoGo.NecroBot.Logic/Event/UseBerryEvent.cs b/PoGo.NecroBot.Logic/Event/UseBerryEvent.cs index 0e96bc050..df12aea9c 100644 --- a/PoGo.NecroBot.Logic/Event/UseBerryEvent.cs +++ b/PoGo.NecroBot.Logic/Event/UseBerryEvent.cs @@ -1,7 +1,10 @@ -namespace PoGo.NecroBot.Logic.Event +using POGOProtos.Inventory.Item; + +namespace PoGo.NecroBot.Logic.Event { public class UseBerryEvent : IEvent { + public ItemId BerryType; public int Count; } } \ No newline at end of file diff --git a/PoGo.NecroBot.Logic/Tasks/CatchPokemonTask.cs b/PoGo.NecroBot.Logic/Tasks/CatchPokemonTask.cs index 11321b0c1..a1965f94e 100644 --- a/PoGo.NecroBot.Logic/Tasks/CatchPokemonTask.cs +++ b/PoGo.NecroBot.Logic/Tasks/CatchPokemonTask.cs @@ -231,7 +231,7 @@ private static async Task UseBerry(ISession session, ulong encounterId, string s await session.Client.Encounter.UseCaptureItem(encounterId, ItemId.ItemRazzBerry, spawnPointId); berry.Count -= 1; - session.EventDispatcher.Send(new UseBerryEvent {Count = berry.Count}); + session.EventDispatcher.Send(new UseBerryEvent {BerryType = ItemId.ItemRazzBerry, Count = berry.Count}); } } } \ No newline at end of file From 812c475fbbd3745a294c3417c05d89372d628b07 Mon Sep 17 00:00:00 2001 From: Dawid Date: Sun, 31 Jul 2016 22:48:18 +0200 Subject: [PATCH 14/21] Update translation.pl.json --- PoGo.NecroBot.CLI/Config/Translations/translation.pl.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PoGo.NecroBot.CLI/Config/Translations/translation.pl.json b/PoGo.NecroBot.CLI/Config/Translations/translation.pl.json index b5b03aa90..8dccddcc5 100644 --- a/PoGo.NecroBot.CLI/Config/Translations/translation.pl.json +++ b/PoGo.NecroBot.CLI/Config/Translations/translation.pl.json @@ -422,11 +422,11 @@ }, { "Key": "displayHighestMove1Header", - "Value": "RUCH1" + "Value": "ATAK1" }, { "Key": "displayHighestMove2Header", - "Value": "RUCH2" + "Value": "ATAK2" } ] } From 74080c0976cfce680a9bd8046d5a6a7249ff357a Mon Sep 17 00:00:00 2001 From: NecronomiconCoding Date: Sun, 31 Jul 2016 22:51:30 +0200 Subject: [PATCH 15/21] catch ip ban --- PoGo.NecroBot.Logic/Common/Translations.cs | 6 ++++-- PoGo.NecroBot.Logic/State/LoginState.cs | 10 ++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/PoGo.NecroBot.Logic/Common/Translations.cs b/PoGo.NecroBot.Logic/Common/Translations.cs index fdca76831..02123d884 100644 --- a/PoGo.NecroBot.Logic/Common/Translations.cs +++ b/PoGo.NecroBot.Logic/Common/Translations.cs @@ -130,7 +130,8 @@ public enum TranslationString NotEnoughPokeballsToSnipe, DisplayHighestMove1Header, DisplayHighestMove2Header, - DisplayHighestCandy + DisplayHighestCandy, + IPBannedError } public class Translation : ITranslation @@ -320,7 +321,8 @@ public class Translation : ITranslation "Not enough Pokeballs to start sniping! ({0}/{1})"), new KeyValuePair(TranslationString.DisplayHighestMove1Header, "MOVE1"), new KeyValuePair(TranslationString.DisplayHighestMove2Header, "MOVE2"), - new KeyValuePair(TranslationString.DisplayHighestCandy, "Candy") + new KeyValuePair(TranslationString.DisplayHighestCandy, "Candy"), + new KeyValuePair(TranslationString.IPBannedError, "Connection refused. Your IP might have been Blacklisted by Niantic. Exiting..") }; public string GetTranslation(TranslationString translationString, params object[] data) diff --git a/PoGo.NecroBot.Logic/State/LoginState.cs b/PoGo.NecroBot.Logic/State/LoginState.cs index 22ad81923..a127b744c 100644 --- a/PoGo.NecroBot.Logic/State/LoginState.cs +++ b/PoGo.NecroBot.Logic/State/LoginState.cs @@ -4,6 +4,7 @@ using System.Diagnostics; using System.Threading; using System.Threading.Tasks; +using Google.Protobuf; using PoGo.NecroBot.Logic.Common; using PoGo.NecroBot.Logic.Event; using PokemonGo.RocketAPI.Enums; @@ -110,6 +111,15 @@ public async Task Execute(ISession session, CancellationToken cancellati await Task.Delay(2000, cancellationToken); Environment.Exit(0); } + catch (InvalidProtocolBufferException ex) when (ex.Message.Contains("SkipLastField")) + { + session.EventDispatcher.Send(new ErrorEvent + { + Message = session.Translation.GetTranslation(TranslationString.IPBannedError) + }); + await Task.Delay(2000, cancellationToken); + Environment.Exit(0); + } catch (Exception) { await Task.Delay(20000, cancellationToken); From 321758b0f701dc09dc3dacb8c9acd7a35655cc1e Mon Sep 17 00:00:00 2001 From: NecronomiconCoding Date: Sun, 31 Jul 2016 22:51:39 +0200 Subject: [PATCH 16/21] corrected naming rules --- PoGo.NecroBot.Logic/Tasks/SnipePokemonTask.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/PoGo.NecroBot.Logic/Tasks/SnipePokemonTask.cs b/PoGo.NecroBot.Logic/Tasks/SnipePokemonTask.cs index e1bee21bd..776924c78 100644 --- a/PoGo.NecroBot.Logic/Tasks/SnipePokemonTask.cs +++ b/PoGo.NecroBot.Logic/Tasks/SnipePokemonTask.cs @@ -311,13 +311,13 @@ private static ScanResult SnipeScanForPokemon(ISession session, Location locatio if (offset<0.001) offset=0.003; if (offset>0.06) offset = 0.06; - var bound_lower_left_lat = location.Latitude - offset; - var bound_lower_left_lng = location.Longitude - offset; - var bound_upper_right_lat = location.Latitude + offset; - var bound_upper_right_lng = location.Longitude + offset; + var boundLowerLeftLat = location.Latitude - offset; + var boundLowerLeftLng = location.Longitude - offset; + var boundUpperRightLat = location.Latitude + offset; + var boundUpperRightLng = location.Longitude + offset; var uri = - $"http://skiplagged.com/api/pokemon.php?bounds={bound_lower_left_lat.ToString(formatter)},{bound_lower_left_lng.ToString(formatter)},{bound_upper_right_lat.ToString(formatter)},{bound_upper_right_lng.ToString(formatter)}"; + $"http://skiplagged.com/api/pokemon.php?bounds={boundLowerLeftLat.ToString(formatter)},{boundLowerLeftLng.ToString(formatter)},{boundUpperRightLat.ToString(formatter)},{boundUpperRightLng.ToString(formatter)}"; /*var uri = $"http://skiplagged.com/api/pokemon.php?address={location.Latitude.ToString(formatter)},{location.Longitude.ToString(formatter)}"; */ From ac1e95595ebf5ef6f8ad3d4034b564654ae74adb Mon Sep 17 00:00:00 2001 From: Dawid Date: Sun, 31 Jul 2016 23:06:28 +0200 Subject: [PATCH 17/21] Update translation.pl.json --- .../Config/Translations/translation.pl.json | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/PoGo.NecroBot.CLI/Config/Translations/translation.pl.json b/PoGo.NecroBot.CLI/Config/Translations/translation.pl.json index 8dccddcc5..c4e29a1ef 100644 --- a/PoGo.NecroBot.CLI/Config/Translations/translation.pl.json +++ b/PoGo.NecroBot.CLI/Config/Translations/translation.pl.json @@ -30,7 +30,7 @@ }, { "Key": "eventFortUsed", - "Value": "Nazwa: {0} XP: {1}, Kamienie: {2}, Przedmioty: {3}" + "Value": "Nazwa: {0} | XP: {1}, Kamienie: {2}, Przedmioty: {3}" }, { "Key": "eventFortFailed", @@ -58,7 +58,7 @@ }, { "Key": "eventPokemonTransferred", - "Value": "{0}\t- CP: {1} IV: {2}% [Najlepsze CP: {3} IV: {4}%] (Cukierki: {5})" + "Value": "{0}\t- CP: {1} IV: {2}% [Najlepsze CP: {3}, IV: {4}%] (Cukierki: {5})" }, { "Key": "eventItemRecycled", @@ -94,7 +94,7 @@ }, { "Key": "commonWordPerfect", - "Value": "Doskonały" + "Value": "IV" }, { "Key": "commonWordName", @@ -226,7 +226,7 @@ }, { "Key": "gotUpToDateVersion", - "Value": "Wspaniale! Posiadasz najnowszą wersję programu {0}" + "Value": "Wspaniale! Posiadasz najnowszą wersję programu NecroBot v{0}" }, { "Key": "autoUpdaterDisabled", @@ -278,15 +278,15 @@ }, { "Key": "checkingForBallsToRecycle", - "Value": "Sprawdzanie ilości Pokeballi, zostawiając {0}" + "Value": "Sprawdzanie ilości Pokeballi, pozostawiając {0}" }, { "Key": "checkingForPotionsToRecycle", - "Value": "Sprawdzanie ilości Eliksirów, zostawiając {0}" + "Value": "Sprawdzanie ilości Eliksirów, pozostawiając {0}" }, { "Key": "checkingForRevivesToRecycle", - "Value": "Sprawdzanie ilości Uzdrowień, zostawiając {0}" + "Value": "Sprawdzanie ilości Uzdrowień, pozostawiając {0}" }, { "Key": "pokeballsToKeepIncorrect", @@ -342,19 +342,19 @@ }, { "Key": "catchStatusEscape", - "Value": "Ucieczka" + "Value": "Uciekł" }, { "Key": "catchStatusFlee", - "Value": "Ucieczka" + "Value": "Uciekł" }, { "Key": "catchStatusMissed", - "Value": "Chybiono" + "Value": "Chybiony" }, { "Key": "catchStatusSuccess", - "Value": "Złapano" + "Value": "Złapany" }, { "Key": "catchTypeNormal", From 7f6fac69587ec647c0ef762fd509606a1d125c78 Mon Sep 17 00:00:00 2001 From: asilevani Date: Sun, 31 Jul 2016 23:12:58 +0200 Subject: [PATCH 18/21] fix/snipe-event Added sniper loglevel to NoPokemonToSnipe & NotEnoughPokeballsToSnipe. --- PoGo.NecroBot.CLI/ConsoleEventListener.cs | 5 +++++ PoGo.NecroBot.Logic/Event/SnipeEvent.cs | 12 ++++++++++++ PoGo.NecroBot.Logic/PoGo.NecroBot.Logic.csproj | 3 ++- PoGo.NecroBot.Logic/Tasks/SnipePokemonTask.cs | 4 ++-- 4 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 PoGo.NecroBot.Logic/Event/SnipeEvent.cs diff --git a/PoGo.NecroBot.CLI/ConsoleEventListener.cs b/PoGo.NecroBot.CLI/ConsoleEventListener.cs index c72d6df83..212025322 100644 --- a/PoGo.NecroBot.CLI/ConsoleEventListener.cs +++ b/PoGo.NecroBot.CLI/ConsoleEventListener.cs @@ -184,6 +184,11 @@ public void HandleEvent(UseBerryEvent evt, ISession session) LogLevel.Berry); } + public void HandleEvent(SnipeEvent evt, ISession session) + { + Logger.Write(evt.ToString(), LogLevel.Sniper); + } + public void HandleEvent(SnipeScanEvent evt, ISession session) { Logger.Write(evt.PokemonId == PokemonId.Missingno diff --git a/PoGo.NecroBot.Logic/Event/SnipeEvent.cs b/PoGo.NecroBot.Logic/Event/SnipeEvent.cs new file mode 100644 index 000000000..80ac05826 --- /dev/null +++ b/PoGo.NecroBot.Logic/Event/SnipeEvent.cs @@ -0,0 +1,12 @@ +namespace PoGo.NecroBot.Logic.Event +{ + public class SnipeEvent : IEvent + { + public string Message = ""; + + public override string ToString() + { + return Message; + } + } +} \ No newline at end of file diff --git a/PoGo.NecroBot.Logic/PoGo.NecroBot.Logic.csproj b/PoGo.NecroBot.Logic/PoGo.NecroBot.Logic.csproj index eb26f7c96..6c9347407 100644 --- a/PoGo.NecroBot.Logic/PoGo.NecroBot.Logic.csproj +++ b/PoGo.NecroBot.Logic/PoGo.NecroBot.Logic.csproj @@ -71,6 +71,7 @@ + @@ -158,4 +159,4 @@ --> - + \ No newline at end of file diff --git a/PoGo.NecroBot.Logic/Tasks/SnipePokemonTask.cs b/PoGo.NecroBot.Logic/Tasks/SnipePokemonTask.cs index 776924c78..d7b173c26 100644 --- a/PoGo.NecroBot.Logic/Tasks/SnipePokemonTask.cs +++ b/PoGo.NecroBot.Logic/Tasks/SnipePokemonTask.cs @@ -102,7 +102,7 @@ public static async Task CheckPokeballsToSnipe(int minPokeballs, ISession if (pokeBallsCount < minPokeballs) { - session.EventDispatcher.Send(new NoticeEvent + session.EventDispatcher.Send(new SnipeEvent { Message = session.Translation.GetTranslation(TranslationString.NotEnoughPokeballsToSnipe, pokeBallsCount, @@ -208,7 +208,7 @@ public static async Task Execute(ISession session, CancellationToken cancellatio } else { - session.EventDispatcher.Send(new NoticeEvent + session.EventDispatcher.Send(new SnipeEvent { Message = session.Translation.GetTranslation(TranslationString.NoPokemonToSnipe) }); From bb5d53e8f69c1f4514caa1c0e76667163a6b2d07 Mon Sep 17 00:00:00 2001 From: Dawid Date: Sun, 31 Jul 2016 23:13:28 +0200 Subject: [PATCH 19/21] Update translation.pl.json --- .../Config/Translations/translation.pl.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/PoGo.NecroBot.CLI/Config/Translations/translation.pl.json b/PoGo.NecroBot.CLI/Config/Translations/translation.pl.json index c4e29a1ef..c003caad0 100644 --- a/PoGo.NecroBot.CLI/Config/Translations/translation.pl.json +++ b/PoGo.NecroBot.CLI/Config/Translations/translation.pl.json @@ -58,7 +58,7 @@ }, { "Key": "eventPokemonTransferred", - "Value": "{0}\t- CP: {1} IV: {2}% [Najlepsze CP: {3}, IV: {4}%] (Cukierki: {5})" + "Value": "{0}\t- CP: {1} IV: {2}% [Najlepsze CP: {3}, IV: {4}%] (Posiadane Cukierki: {5})" }, { "Key": "eventItemRecycled", @@ -110,7 +110,7 @@ }, { "Key": "displayHighestsPerfectHeader", - "Value": "Najwyższy Poziom Doskonałości" + "Value": "Najwyższy Poziom IV" }, { "Key": "displayHighestsLevelHeader", @@ -122,11 +122,11 @@ }, { "Key": "incubatorPuttingEgg", - "Value": "Wkładam jajko do inkubatora: pozostało {0:0.00}km" + "Value": "Wkładam jajko do inkubatora: Pozostało {0:0.00}km" }, { "Key": "incubatorStatusUpdate", - "Value": "Aktualizacja inkubatora: pozostało {0:0.00}km" + "Value": "[Aktualizacja inkubatora] Pozostało {0:0.00}km" }, { "Key": "incubatorEggHatched", @@ -278,7 +278,7 @@ }, { "Key": "checkingForBallsToRecycle", - "Value": "Sprawdzanie ilości Pokeballi, pozostawiając {0}" + "Value": "Sprawdzanie sumy Pokeballi, pozostawiając {0}" }, { "Key": "checkingForPotionsToRecycle", From 083d617a493933480ad274ec7d9e46ecc2d46b9b Mon Sep 17 00:00:00 2001 From: NecronomiconCoding Date: Sun, 31 Jul 2016 23:19:00 +0200 Subject: [PATCH 20/21] fix 24hr + bug --- PoGo.NecroBot.Logic/Utils/Statistics.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/PoGo.NecroBot.Logic/Utils/Statistics.cs b/PoGo.NecroBot.Logic/Utils/Statistics.cs index ae1101349..16c820c41 100644 --- a/PoGo.NecroBot.Logic/Utils/Statistics.cs +++ b/PoGo.NecroBot.Logic/Utils/Statistics.cs @@ -55,9 +55,8 @@ public StatsExport GetCurrentInfo(Inventory inventory) var minutes = 0.00; if (double.IsInfinity(time) == false && time > 0) { - time = Convert.ToDouble(TimeSpan.FromHours(time).ToString("h\\.mm"), CultureInfo.InvariantCulture); - hours = Math.Truncate(time); - minutes = Math.Round((time - hours)*100); + hours = Math.Truncate(TimeSpan.FromHours(time).TotalHours); + minutes = TimeSpan.FromHours(time).Minutes; } output = new StatsExport From d148a2ecd80e0f0a7283dca97d4c9253fd0d266d Mon Sep 17 00:00:00 2001 From: simplyphp Date: Sun, 31 Jul 2016 16:43:06 -0500 Subject: [PATCH 21/21] Fixed recycling to not loop through items twice, and first run bug which threw an exception. --- PoGo.NecroBot.CLI/Program.cs | 1 + PoGo.NecroBot.Logic/Inventory.cs | 38 --------------- PoGo.NecroBot.Logic/Settings.cs | 12 ++--- PoGo.NecroBot.Logic/Tasks/RecycleItemsTask.cs | 47 ++++++++++++------- 4 files changed, 38 insertions(+), 60 deletions(-) diff --git a/PoGo.NecroBot.CLI/Program.cs b/PoGo.NecroBot.CLI/Program.cs index 2f968b3fa..a885bda79 100644 --- a/PoGo.NecroBot.CLI/Program.cs +++ b/PoGo.NecroBot.CLI/Program.cs @@ -38,6 +38,7 @@ private static void Main(string[] args) Logger.Write("Press a Key to continue...", LogLevel.Warning); Console.ReadKey(); + return; } var session = new Session(new ClientSettings(settings), new LogicSettings(settings)); session.Client.ApiFailure = new ApiFailureStrategy(session); diff --git a/PoGo.NecroBot.Logic/Inventory.cs b/PoGo.NecroBot.Logic/Inventory.cs index f2564abd5..61b80f85a 100644 --- a/PoGo.NecroBot.Logic/Inventory.cs +++ b/PoGo.NecroBot.Logic/Inventory.cs @@ -245,44 +245,6 @@ public async Task> GetItemsToRecycle(ISession session) var itemsToRecylce = new List(); var myItems = (await GetItems()).ToList(); - var amountOfPokeballsToKeep = _logicSettings.TotalAmountOfPokeballsToKeep; - var amountOfPotionsToKeep = _logicSettings.TotalAmountOfPotionsToKeep; - var amountOfRevivesToKeep = _logicSettings.TotalAmountOfRevivesToKeep; - - var currentAmountOfPokeballs = await GetItemAmountByType(ItemId.ItemPokeBall); - var currentAmountOfGreatballs = await GetItemAmountByType(ItemId.ItemGreatBall); - var currentAmountOfUltraballs = await GetItemAmountByType(ItemId.ItemUltraBall); - var currentAmountOfMasterballs = await GetItemAmountByType(ItemId.ItemMasterBall); - - if (session.LogicSettings.ShowPokeballCountsBeforeRecycle) - Logger.Write(session.Translation.GetTranslation(TranslationString.CurrentPokeballInv, - currentAmountOfPokeballs, currentAmountOfGreatballs, currentAmountOfUltraballs, - currentAmountOfMasterballs)); - - if (!_logicSettings.ItemRecycleFilter.Any(s => _pokeballs.Contains(s.Key))) - { - if (session.LogicSettings.VerboseRecycling) - Logger.Write(session.Translation.GetTranslation(TranslationString.CheckingForBallsToRecycle, amountOfPokeballsToKeep), LogLevel.Recycling); - var pokeballsToRecycle = GetPokeballsToRecycle(session, myItems); - itemsToRecylce.AddRange(pokeballsToRecycle); - } - - if (!_logicSettings.ItemRecycleFilter.Any(s => _potions.Contains(s.Key))) - { - if (session.LogicSettings.VerboseRecycling) - Logger.Write(session.Translation.GetTranslation(TranslationString.CheckingForPotionsToRecycle, amountOfPotionsToKeep), LogLevel.Recycling); - var potionsToRecycle = GetPotionsToRecycle(session, myItems); - itemsToRecylce.AddRange(potionsToRecycle); - } - - if (!_logicSettings.ItemRecycleFilter.Any(s => _revives.Contains(s.Key))) - { - if (session.LogicSettings.VerboseRecycling) - Logger.Write(session.Translation.GetTranslation(TranslationString.CheckingForRevivesToRecycle, amountOfRevivesToKeep), LogLevel.Recycling); - var revivesToRecycle = GetRevivesToRecycle(session, myItems); - itemsToRecylce.AddRange(revivesToRecycle); - } - var otherItemsToRecylce = myItems .Where(x => _logicSettings.ItemRecycleFilter.Any(f => f.Key == x.ItemId && x.Count > f.Value)) .Select( diff --git a/PoGo.NecroBot.Logic/Settings.cs b/PoGo.NecroBot.Logic/Settings.cs index 37f195f51..fc3ebe036 100644 --- a/PoGo.NecroBot.Logic/Settings.cs +++ b/PoGo.NecroBot.Logic/Settings.cs @@ -243,18 +243,18 @@ public class GlobalSettings //PokemonId.Kangaskhan, //PokemonId.MrMime, //PokemonId.Tauros, - //PokemonId.Gyarados, + PokemonId.Gyarados, //PokemonId.Lapras, PokemonId.Ditto, //PokemonId.Vaporeon, //PokemonId.Jolteon, //PokemonId.Flareon, //PokemonId.Porygon, - //PokemonId.Snorlax, + PokemonId.Snorlax, PokemonId.Articuno, PokemonId.Zapdos, PokemonId.Moltres, - //PokemonId.Dragonite, + PokemonId.Dragonite, PokemonId.Mewtwo, PokemonId.Mew }; @@ -473,17 +473,17 @@ public static GlobalSettings Load(string path) settings = new GlobalSettings(); } - if (settings.DefaultAltitude <= 0) + if (settings.DefaultAltitude == 0) { settings.DefaultAltitude = Default.DefaultAltitude; } - if (settings.DefaultLatitude <= 0) + if (settings.DefaultLatitude == 0) { settings.DefaultLatitude = Default.DefaultLatitude; } - if (settings.DefaultLongitude <= 0) + if (settings.DefaultLongitude == 0) { settings.DefaultLongitude = Default.DefaultLongitude; } diff --git a/PoGo.NecroBot.Logic/Tasks/RecycleItemsTask.cs b/PoGo.NecroBot.Logic/Tasks/RecycleItemsTask.cs index fa5e0d311..5e9b55cc2 100644 --- a/PoGo.NecroBot.Logic/Tasks/RecycleItemsTask.cs +++ b/PoGo.NecroBot.Logic/Tasks/RecycleItemsTask.cs @@ -26,33 +26,50 @@ public static async Task Execute(ISession session, CancellationToken cancellatio if (!session.LogicSettings.VerboseRecycling) Logger.Write(session.Translation.GetTranslation(TranslationString.RecyclingQuietly), LogLevel.Recycling); - var items = await session.Inventory.GetItemsToRecycle(session); - - foreach (var item in items) + if (session.LogicSettings.TotalAmountOfPokeballsToKeep != 0) { - cancellationToken.ThrowIfCancellationRequested(); + var currentAmountOfPokeballs = await session.Inventory.GetItemAmountByType(ItemId.ItemPokeBall); + var currentAmountOfGreatballs = await session.Inventory.GetItemAmountByType(ItemId.ItemGreatBall); + var currentAmountOfUltraballs = await session.Inventory.GetItemAmountByType(ItemId.ItemUltraBall); + var currentAmountOfMasterballs = await session.Inventory.GetItemAmountByType(ItemId.ItemMasterBall); - await session.Client.Inventory.RecycleItem(item.ItemId, item.Count); + if (session.LogicSettings.ShowPokeballCountsBeforeRecycle) + Logger.Write(session.Translation.GetTranslation(TranslationString.CurrentPokeballInv, + currentAmountOfPokeballs, currentAmountOfGreatballs, currentAmountOfUltraballs, + currentAmountOfMasterballs)); - if (session.LogicSettings.VerboseRecycling) - session.EventDispatcher.Send(new ItemRecycledEvent {Id = item.ItemId, Count = item.Count}); + await OptimizedRecycleBalls(session, cancellationToken); + } - DelayingUtils.Delay(session.LogicSettings.DelayBetweenPlayerActions, 500); + if (session.LogicSettings.TotalAmountOfPotionsToKeep>=0) + { + await OptimizedRecyclePotions(session, cancellationToken); } - if (session.LogicSettings.TotalAmountOfPokeballsToKeep != 0) + if (session.LogicSettings.TotalAmountOfRevivesToKeep>=0) { - await OptimizedRecycleBalls(session, cancellationToken); + await OptimizedRecycleRevives(session, cancellationToken); } - if (session.LogicSettings.TotalAmountOfPotionsToKeep != 0) + currentTotalItems = await session.Inventory.GetTotalItemCount(); + if ((session.Profile.PlayerData.MaxItemStorage * session.LogicSettings.RecycleInventoryAtUsagePercentage) > currentTotalItems) { - await OptimizedRecyclePotions(session, cancellationToken); + await session.Inventory.RefreshCachedInventory(); + return; } - if (session.LogicSettings.TotalAmountOfRevivesToKeep != 0) + var items = await session.Inventory.GetItemsToRecycle(session); + + foreach (var item in items) { - await OptimizedRecycleRevives(session, cancellationToken); + cancellationToken.ThrowIfCancellationRequested(); + + await session.Client.Inventory.RecycleItem(item.ItemId, item.Count); + + if (session.LogicSettings.VerboseRecycling) + session.EventDispatcher.Send(new ItemRecycledEvent { Id = item.ItemId, Count = item.Count }); + + DelayingUtils.Delay(session.LogicSettings.DelayBetweenPlayerActions, 500); } await session.Inventory.RefreshCachedInventory(); @@ -67,8 +84,6 @@ private static async Task OptimizedRecycleBalls(ISession session, CancellationTo int pokeBallsToRecycle = 0; int greatBallsToRecycle = 0; - /* - */ int totalBallsCount = pokeBallsCount + greatBallsCount + ultraBallsCount + masterBallsCount; if (totalBallsCount > session.LogicSettings.TotalAmountOfPokeballsToKeep)