From b5e0442bf6d709581a2ab677fdeced92b91b1455 Mon Sep 17 00:00:00 2001 From: Brian Date: Sun, 21 Aug 2016 02:20:36 -0700 Subject: [PATCH] Clean up code --- POGOProtos | 2 +- .../Common/ApiFailureStrategy.cs | 81 +- .../Common/Translations.cs | 857 +++++++++--------- .../Event/EvolveCountEvent.cs | 10 +- .../Event/FortFailedEvent.cs | 2 +- .../Event/HumanWalkingEvent.cs | 5 +- .../Event/InventoryListEvent.cs | 10 +- .../Event/LootPokestopEvent.cs | 9 +- .../Event/OptimizeRouteEvent.cs | 9 +- .../Event/PokemonCaptureEvent.cs | 4 +- .../Event/PokemonEvolveEvent.cs | 2 + .../Event/PokemonsEncounterEvent.cs | 9 +- PokemonGo.RocketBot.Logic/ILogicSettings.cs | 7 +- PokemonGo.RocketBot.Logic/Logging/ILogger.cs | 1 + PokemonGo.RocketBot.Logic/Logging/Logger.cs | 5 +- .../PoGoUtils/PokemonInfo.cs | 9 +- .../Service/TelegramService.cs | 123 ++- PokemonGo.RocketBot.Logic/Settings.cs | 441 ++++----- PokemonGo.RocketBot.Logic/State/FarmState.cs | 6 +- PokemonGo.RocketBot.Logic/State/InfoState.cs | 2 +- PokemonGo.RocketBot.Logic/State/LoginState.cs | 33 +- PokemonGo.RocketBot.Logic/State/Session.cs | 6 +- .../State/StateMachine.cs | 13 +- .../State/VersionCheckState.cs | 14 - .../Tasks/CatchIncensePokemonsTask.cs | 16 +- .../Tasks/CatchLurePokemonsTask.cs | 13 +- .../Tasks/CatchNearbyPokemonsTask.cs | 14 +- .../Tasks/CatchPokemonTask.cs | 92 +- .../Tasks/DisplayPokemonStatsTask.cs | 9 +- .../Tasks/EggsListTask.cs | 2 +- .../Tasks/EvolvePokemonTask.cs | 74 +- .../Tasks/EvolveSpecificPokemonTask.cs | 4 - PokemonGo.RocketBot.Logic/Tasks/Farm.cs | 2 +- .../Tasks/FarmPokestopsGPXTask.cs | 6 +- .../Tasks/FarmPokestopsTask.cs | 29 +- .../Tasks/FavoritePokemonTask.cs | 6 +- .../Tasks/GetPokeDexCount.cs | 25 +- .../Tasks/InventoryListTask.cs | 8 +- .../Tasks/LevelUpPokemonTask.cs | 30 +- PokemonGo.RocketBot.Logic/Tasks/Login.cs | 6 +- .../Tasks/PokemonListTask.cs | 5 +- .../Tasks/RecycleItemsTask.cs | 83 +- .../Tasks/RenamePokemonTask.cs | 3 +- .../Tasks/SnipePokemonTask.cs | 281 +++--- .../Tasks/TransferDuplicatePokemonTask.cs | 5 +- .../Tasks/TransferPokemonTask.cs | 8 +- .../Tasks/TransferWeakPokemonTask.cs | 13 +- .../Tasks/UseIncenseConstantlyTask.cs | 16 +- .../Tasks/UseIncubatorsTask.cs | 2 +- .../Tasks/UseLuckyEggConstantlyTask.cs | 18 +- .../Tasks/UseNearbyPokestopsTask.cs | 2 +- .../Utils/DeviceInfoHelper.cs | 827 +++++++++-------- .../Utils/ErrorHandler.cs | 35 +- .../Utils/LocationUtils.cs | 12 +- .../Utils/NecroWebClient.cs | 4 +- .../Utils/RouteOptimizeUtil.cs | 14 +- PokemonGo.RocketBot.Logic/Utils/Statistics.cs | 40 +- .../Utils/StringUtils.cs | 13 +- .../Utils/WebClientExtensions.cs | 12 +- PokemonGo.RocketBot.Logic/Utils/WebUtils.cs | 4 +- PokemonGo.RocketBot.Logic/Utils/dijkstras.cs | 25 +- 61 files changed, 1767 insertions(+), 1651 deletions(-) diff --git a/POGOProtos b/POGOProtos index 016c57b02..edd0d9b75 160000 --- a/POGOProtos +++ b/POGOProtos @@ -1 +1 @@ -Subproject commit 016c57b028a0a4995891aa9a41eb62efa5285664 +Subproject commit edd0d9b75906db892c11a003f801874c7f1e2ac4 diff --git a/PokemonGo.RocketBot.Logic/Common/ApiFailureStrategy.cs b/PokemonGo.RocketBot.Logic/Common/ApiFailureStrategy.cs index 4f2bdb10f..a032dd3b3 100644 --- a/PokemonGo.RocketBot.Logic/Common/ApiFailureStrategy.cs +++ b/PokemonGo.RocketBot.Logic/Common/ApiFailureStrategy.cs @@ -2,11 +2,11 @@ using System; using System.Threading.Tasks; -using PokemonGo.RocketBot.Logic.Event; -using PokemonGo.RocketBot.Logic.State; using PokemonGo.RocketAPI.Enums; using PokemonGo.RocketAPI.Exceptions; using PokemonGo.RocketAPI.Extensions; +using PokemonGo.RocketBot.Logic.Event; +using PokemonGo.RocketBot.Logic.State; using POGOProtos.Networking.Envelopes; #endregion @@ -23,6 +23,42 @@ public ApiFailureStrategy(ISession session) _session = session; } + public void HandleApiSuccess(RequestEnvelope request, ResponseEnvelope response) + { + _retryCount = 0; + } + + public async Task HandleApiFailure(RequestEnvelope request, ResponseEnvelope response) + { + if (_retryCount == 11) + return ApiOperation.Abort; + + await Task.Delay(500); + _retryCount++; + + if (_retryCount%5 == 0) + { + try + { + DoLogin(); + } + catch (PtcOfflineException) + { + await Task.Delay(20000); + } + catch (AccessTokenExpiredException) + { + await Task.Delay(2000); + } + catch (Exception ex) when (ex is InvalidResponseException || ex is TaskCanceledException) + { + await Task.Delay(1000); + } + } + + return ApiOperation.Retry; + } + public async Task HandleApiFailure() { if (_retryCount == 11) @@ -31,7 +67,7 @@ public async Task HandleApiFailure() await Task.Delay(500); _retryCount++; - if (_retryCount % 5 == 0) + if (_retryCount%5 == 0) { DoLogin(); } @@ -120,7 +156,7 @@ private async void DoLogin() } catch (InvalidResponseException) { - _session.EventDispatcher.Send(new ErrorEvent() + _session.EventDispatcher.Send(new ErrorEvent { Message = _session.Translation.GetTranslation(TranslationString.InvalidResponse) }); @@ -139,40 +175,5 @@ private async void DoLogin() }); } } - public void HandleApiSuccess(RequestEnvelope request, ResponseEnvelope response) - { - _retryCount = 0; - } - - public async Task HandleApiFailure(RequestEnvelope request, ResponseEnvelope response) - { - if (_retryCount == 11) - return ApiOperation.Abort; - - await Task.Delay(500); - _retryCount++; - - if (_retryCount % 5 == 0) - { - try - { - DoLogin(); - } - catch (PtcOfflineException) - { - await Task.Delay(20000); - } - catch (AccessTokenExpiredException) - { - await Task.Delay(2000); - } - catch (Exception ex) when (ex is InvalidResponseException || ex is TaskCanceledException) - { - await Task.Delay(1000); - } - } - - return ApiOperation.Retry; - } } -} +} \ No newline at end of file diff --git a/PokemonGo.RocketBot.Logic/Common/Translations.cs b/PokemonGo.RocketBot.Logic/Common/Translations.cs index a21f457d4..d4d1fc897 100644 --- a/PokemonGo.RocketBot.Logic/Common/Translations.cs +++ b/PokemonGo.RocketBot.Logic/Common/Translations.cs @@ -1,13 +1,14 @@ #region using directives -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using PokemonGo.RocketBot.Logic.Logging; -using PokemonGo.RocketBot.Logic.Utils; using System; using System.Collections.Generic; using System.IO; using System.Linq; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using PokemonGo.RocketBot.Logic.Logging; +using PokemonGo.RocketBot.Logic.Utils; +using POGOProtos.Enums; #endregion @@ -19,9 +20,9 @@ public interface ITranslation string GetTranslation(TranslationString translationString); - string GetPokemonTranslation( POGOProtos.Enums.PokemonId id ); + string GetPokemonTranslation(PokemonId id); - string GetPokemonMovesetTranslation( POGOProtos.Enums.PokemonMove move ); + string GetPokemonMovesetTranslation(PokemonMove move); } public enum TranslationString @@ -200,6 +201,356 @@ public enum TranslationString public class Translation : ITranslation { + [JsonProperty("PokemonMovesetStrings", + ItemTypeNameHandling = TypeNameHandling.Arrays, + ItemConverterType = typeof(KeyValuePairConverter), + ObjectCreationHandling = ObjectCreationHandling.Replace, + DefaultValueHandling = DefaultValueHandling.Populate)] private readonly + List> _pokemonMovesetTranslationStrings = + new List> + { + new KeyValuePair(PokemonMove.MoveUnset, "MoveUnset"), + new KeyValuePair(PokemonMove.ThunderShock, "ThunderShock"), + new KeyValuePair(PokemonMove.QuickAttack, "QuickAttack"), + new KeyValuePair(PokemonMove.Scratch, "Scratch"), + new KeyValuePair(PokemonMove.Ember, "Ember"), + new KeyValuePair(PokemonMove.VineWhip, "VineWhip"), + new KeyValuePair(PokemonMove.Tackle, "Tackle"), + new KeyValuePair(PokemonMove.RazorLeaf, "RazorLeaf"), + new KeyValuePair(PokemonMove.TakeDown, "TakeDown"), + new KeyValuePair(PokemonMove.WaterGun, "WaterGun"), + new KeyValuePair(PokemonMove.Bite, "Bite"), + new KeyValuePair(PokemonMove.Pound, "Pound"), + new KeyValuePair(PokemonMove.DoubleSlap, "DoubleSlap"), + new KeyValuePair(PokemonMove.Wrap, "Wrap"), + new KeyValuePair(PokemonMove.HyperBeam, "HyperBeam"), + new KeyValuePair(PokemonMove.Lick, "Lick"), + new KeyValuePair(PokemonMove.DarkPulse, "DarkPulse"), + new KeyValuePair(PokemonMove.Smog, "Smog"), + new KeyValuePair(PokemonMove.Sludge, "Sludge"), + new KeyValuePair(PokemonMove.MetalClaw, "MetalClaw"), + new KeyValuePair(PokemonMove.ViceGrip, "ViceGrip"), + new KeyValuePair(PokemonMove.FlameWheel, "FlameWheel"), + new KeyValuePair(PokemonMove.Megahorn, "Megahorn"), + new KeyValuePair(PokemonMove.WingAttack, "WingAttack"), + new KeyValuePair(PokemonMove.Flamethrower, "Flamethrower"), + new KeyValuePair(PokemonMove.SuckerPunch, "SuckerPunch"), + new KeyValuePair(PokemonMove.Dig, "Dig"), + new KeyValuePair(PokemonMove.LowKick, "LowKick"), + new KeyValuePair(PokemonMove.CrossChop, "CrossChop"), + new KeyValuePair(PokemonMove.PsychoCut, "PsychoCut"), + new KeyValuePair(PokemonMove.Psybeam, "Psybeam"), + new KeyValuePair(PokemonMove.Earthquake, "Earthquake"), + new KeyValuePair(PokemonMove.StoneEdge, "StoneEdge"), + new KeyValuePair(PokemonMove.IcePunch, "IcePunch"), + new KeyValuePair(PokemonMove.HeartStamp, "HeartStamp"), + new KeyValuePair(PokemonMove.Discharge, "Discharge"), + new KeyValuePair(PokemonMove.FlashCannon, "FlashCannon"), + new KeyValuePair(PokemonMove.Peck, "Peck"), + new KeyValuePair(PokemonMove.DrillPeck, "DrillPeck"), + new KeyValuePair(PokemonMove.IceBeam, "IceBeam"), + new KeyValuePair(PokemonMove.Blizzard, "Blizzard"), + new KeyValuePair(PokemonMove.AirSlash, "AirSlash"), + new KeyValuePair(PokemonMove.HeatWave, "HeatWave"), + new KeyValuePair(PokemonMove.Twineedle, "Twineedle"), + new KeyValuePair(PokemonMove.PoisonJab, "PoisonJab"), + new KeyValuePair(PokemonMove.AerialAce, "AerialAce"), + new KeyValuePair(PokemonMove.DrillRun, "DrillRun"), + new KeyValuePair(PokemonMove.PetalBlizzard, "PetalBlizzard"), + new KeyValuePair(PokemonMove.MegaDrain, "MegaDrain"), + new KeyValuePair(PokemonMove.BugBuzz, "BugBuzz"), + new KeyValuePair(PokemonMove.PoisonFang, "PoisonFang"), + new KeyValuePair(PokemonMove.NightSlash, "NightSlash"), + new KeyValuePair(PokemonMove.Slash, "Slash"), + new KeyValuePair(PokemonMove.BubbleBeam, "BubbleBeam"), + new KeyValuePair(PokemonMove.Submission, "Submission"), + new KeyValuePair(PokemonMove.KarateChop, "KarateChop"), + new KeyValuePair(PokemonMove.LowSweep, "LowSweep"), + new KeyValuePair(PokemonMove.AquaJet, "AquaJet"), + new KeyValuePair(PokemonMove.AquaTail, "AquaTail"), + new KeyValuePair(PokemonMove.SeedBomb, "SeedBomb"), + new KeyValuePair(PokemonMove.Psyshock, "Psyshock"), + new KeyValuePair(PokemonMove.RockThrow, "RockThrow"), + new KeyValuePair(PokemonMove.AncientPower, "AncientPower"), + new KeyValuePair(PokemonMove.RockTomb, "RockTomb"), + new KeyValuePair(PokemonMove.RockSlide, "RockSlide"), + new KeyValuePair(PokemonMove.PowerGem, "PowerGem"), + new KeyValuePair(PokemonMove.ShadowSneak, "ShadowSneak"), + new KeyValuePair(PokemonMove.ShadowPunch, "ShadowPunch"), + new KeyValuePair(PokemonMove.ShadowClaw, "ShadowClaw"), + new KeyValuePair(PokemonMove.OminousWind, "OminousWind"), + new KeyValuePair(PokemonMove.ShadowBall, "ShadowBall"), + new KeyValuePair(PokemonMove.BulletPunch, "BulletPunch"), + new KeyValuePair(PokemonMove.MagnetBomb, "MagnetBomb"), + new KeyValuePair(PokemonMove.SteelWing, "SteelWing"), + new KeyValuePair(PokemonMove.IronHead, "IronHead"), + new KeyValuePair(PokemonMove.ParabolicCharge, "ParabolicCharge"), + new KeyValuePair(PokemonMove.Spark, "Spark"), + new KeyValuePair(PokemonMove.ThunderPunch, "ThunderPunch"), + new KeyValuePair(PokemonMove.Thunder, "Thunder"), + new KeyValuePair(PokemonMove.Thunderbolt, "Thunderbolt"), + new KeyValuePair(PokemonMove.Twister, "Twister"), + new KeyValuePair(PokemonMove.DragonBreath, "DragonBreath"), + new KeyValuePair(PokemonMove.DragonPulse, "DragonPulse"), + new KeyValuePair(PokemonMove.DragonClaw, "DragonClaw"), + new KeyValuePair(PokemonMove.DisarmingVoice, "DisarmingVoice"), + new KeyValuePair(PokemonMove.DrainingKiss, "DrainingKiss"), + new KeyValuePair(PokemonMove.DazzlingGleam, "DazzlingGleam"), + new KeyValuePair(PokemonMove.Moonblast, "Moonblast"), + new KeyValuePair(PokemonMove.PlayRough, "PlayRough"), + new KeyValuePair(PokemonMove.CrossPoison, "CrossPoison"), + new KeyValuePair(PokemonMove.SludgeBomb, "SludgeBomb"), + new KeyValuePair(PokemonMove.SludgeWave, "SludgeWave"), + new KeyValuePair(PokemonMove.GunkShot, "GunkShot"), + new KeyValuePair(PokemonMove.MudShot, "MudShot"), + new KeyValuePair(PokemonMove.BoneClub, "BoneClub"), + new KeyValuePair(PokemonMove.Bulldoze, "Bulldoze"), + new KeyValuePair(PokemonMove.MudBomb, "MudBomb"), + new KeyValuePair(PokemonMove.FuryCutter, "FuryCutter"), + new KeyValuePair(PokemonMove.BugBite, "BugBite"), + new KeyValuePair(PokemonMove.SignalBeam, "SignalBeam"), + new KeyValuePair(PokemonMove.XScissor, "XScissor"), + new KeyValuePair(PokemonMove.FlameCharge, "FlameCharge"), + new KeyValuePair(PokemonMove.FlameBurst, "FlameBurst"), + new KeyValuePair(PokemonMove.FireBlast, "FireBlast"), + new KeyValuePair(PokemonMove.Brine, "Brine"), + new KeyValuePair(PokemonMove.WaterPulse, "WaterPulse"), + new KeyValuePair(PokemonMove.Scald, "Scald"), + new KeyValuePair(PokemonMove.HydroPump, "HydroPump"), + new KeyValuePair(PokemonMove.Psychic, "Psychic"), + new KeyValuePair(PokemonMove.Psystrike, "Psystrike"), + new KeyValuePair(PokemonMove.IceShard, "IceShard"), + new KeyValuePair(PokemonMove.IcyWind, "IcyWind"), + new KeyValuePair(PokemonMove.FrostBreath, "FrostBreath"), + new KeyValuePair(PokemonMove.Absorb, "Absorb"), + new KeyValuePair(PokemonMove.GigaDrain, "GigaDrain"), + new KeyValuePair(PokemonMove.FirePunch, "FirePunch"), + new KeyValuePair(PokemonMove.SolarBeam, "SolarBeam"), + new KeyValuePair(PokemonMove.LeafBlade, "LeafBlade"), + new KeyValuePair(PokemonMove.PowerWhip, "PowerWhip"), + new KeyValuePair(PokemonMove.Splash, "Splash"), + new KeyValuePair(PokemonMove.Acid, "Acid"), + new KeyValuePair(PokemonMove.AirCutter, "AirCutter"), + new KeyValuePair(PokemonMove.Hurricane, "Hurricane"), + new KeyValuePair(PokemonMove.BrickBreak, "BrickBreak"), + new KeyValuePair(PokemonMove.Cut, "Cut"), + new KeyValuePair(PokemonMove.Swift, "Swift"), + new KeyValuePair(PokemonMove.HornAttack, "HornAttack"), + new KeyValuePair(PokemonMove.Stomp, "Stomp"), + new KeyValuePair(PokemonMove.Headbutt, "Headbutt"), + new KeyValuePair(PokemonMove.HyperFang, "HyperFang"), + new KeyValuePair(PokemonMove.Slam, "Slam"), + new KeyValuePair(PokemonMove.BodySlam, "BodySlam"), + new KeyValuePair(PokemonMove.Rest, "Rest"), + new KeyValuePair(PokemonMove.Struggle, "Struggle"), + new KeyValuePair(PokemonMove.ScaldBlastoise, "ScaldBlastoise"), + new KeyValuePair(PokemonMove.HydroPumpBlastoise, "HydroPumpBlastoise"), + new KeyValuePair(PokemonMove.WrapGreen, "WrapGreen"), + new KeyValuePair(PokemonMove.WrapPink, "WrapPink"), + new KeyValuePair(PokemonMove.FuryCutterFast, "FuryCutterFast"), + new KeyValuePair(PokemonMove.BugBiteFast, "BugBiteFast"), + new KeyValuePair(PokemonMove.BiteFast, "BiteFast"), + new KeyValuePair(PokemonMove.SuckerPunchFast, "SuckerPunchFast"), + new KeyValuePair(PokemonMove.DragonBreathFast, "DragonBreathFast"), + new KeyValuePair(PokemonMove.ThunderShockFast, "ThunderShockFast"), + new KeyValuePair(PokemonMove.SparkFast, "SparkFast"), + new KeyValuePair(PokemonMove.LowKickFast, "LowKickFast"), + new KeyValuePair(PokemonMove.KarateChopFast, "KarateChopFast"), + new KeyValuePair(PokemonMove.EmberFast, "EmberFast"), + new KeyValuePair(PokemonMove.WingAttackFast, "WingAttackFast"), + new KeyValuePair(PokemonMove.PeckFast, "PeckFast"), + new KeyValuePair(PokemonMove.LickFast, "LickFast"), + new KeyValuePair(PokemonMove.ShadowClawFast, "ShadowClawFast"), + new KeyValuePair(PokemonMove.VineWhipFast, "VineWhipFast"), + new KeyValuePair(PokemonMove.RazorLeafFast, "RazorLeafFast"), + new KeyValuePair(PokemonMove.MudShotFast, "MudShotFast"), + new KeyValuePair(PokemonMove.IceShardFast, "IceShardFast"), + new KeyValuePair(PokemonMove.FrostBreathFast, "FrostBreathFast"), + new KeyValuePair(PokemonMove.QuickAttackFast, "QuickAttackFast"), + new KeyValuePair(PokemonMove.ScratchFast, "ScratchFast"), + new KeyValuePair(PokemonMove.TackleFast, "TackleFast"), + new KeyValuePair(PokemonMove.PoundFast, "PoundFast"), + new KeyValuePair(PokemonMove.CutFast, "CutFast"), + new KeyValuePair(PokemonMove.PoisonJabFast, "PoisonJabFast"), + new KeyValuePair(PokemonMove.AcidFast, "AcidFast"), + new KeyValuePair(PokemonMove.PsychoCutFast, "PsychoCutFast"), + new KeyValuePair(PokemonMove.RockThrowFast, "RockThrowFast"), + new KeyValuePair(PokemonMove.MetalClawFast, "MetalClawFast"), + new KeyValuePair(PokemonMove.BulletPunchFast, "BulletPunchFast"), + new KeyValuePair(PokemonMove.WaterGunFast, "WaterGunFast"), + new KeyValuePair(PokemonMove.SplashFast, "SplashFast"), + new KeyValuePair(PokemonMove.WaterGunFastBlastoise, "WaterGunFastBlastoise"), + new KeyValuePair(PokemonMove.MudSlapFast, "MudSlapFast"), + new KeyValuePair(PokemonMove.ZenHeadbuttFast, "ZenHeadbuttFast"), + new KeyValuePair(PokemonMove.ConfusionFast, "ConfusionFast"), + new KeyValuePair(PokemonMove.PoisonStingFast, "PoisonStingFast"), + new KeyValuePair(PokemonMove.BubbleFast, "BubbleFast"), + new KeyValuePair(PokemonMove.FeintAttackFast, "FeintAttackFast"), + new KeyValuePair(PokemonMove.SteelWingFast, "SteelWingFast"), + new KeyValuePair(PokemonMove.FireFangFast, "FireFangFast"), + new KeyValuePair(PokemonMove.RockSmashFast, "RockSmashFast") + }; + + [JsonProperty("PokemonStrings", + ItemTypeNameHandling = TypeNameHandling.Arrays, + ItemConverterType = typeof(KeyValuePairConverter), + ObjectCreationHandling = ObjectCreationHandling.Replace, + DefaultValueHandling = DefaultValueHandling.Populate)] private readonly + List> _pokemonTranslationStrings = new List> + { + new KeyValuePair((PokemonId) 001, "Bulbasaur"), + new KeyValuePair((PokemonId) 002, "Ivysaur"), + new KeyValuePair((PokemonId) 003, "Venusaur"), + new KeyValuePair((PokemonId) 004, "Charmander"), + new KeyValuePair((PokemonId) 005, "Charmeleon"), + new KeyValuePair((PokemonId) 006, "Charizard"), + new KeyValuePair((PokemonId) 007, "Squirtle"), + new KeyValuePair((PokemonId) 008, "Wartortle"), + new KeyValuePair((PokemonId) 009, "Blastoise"), + new KeyValuePair((PokemonId) 010, "Caterpie"), + new KeyValuePair((PokemonId) 011, "Metapod"), + new KeyValuePair((PokemonId) 012, "Butterfree"), + new KeyValuePair((PokemonId) 013, "Weedle"), + new KeyValuePair((PokemonId) 014, "Kakuna"), + new KeyValuePair((PokemonId) 015, "Beedrill"), + new KeyValuePair((PokemonId) 016, "Pidgey"), + new KeyValuePair((PokemonId) 017, "Pidgeotto"), + new KeyValuePair((PokemonId) 018, "Pidgeot"), + new KeyValuePair((PokemonId) 019, "Rattata"), + new KeyValuePair((PokemonId) 020, "Raticate"), + new KeyValuePair((PokemonId) 021, "Spearow"), + new KeyValuePair((PokemonId) 022, "Fearow"), + new KeyValuePair((PokemonId) 023, "Ekans"), + new KeyValuePair((PokemonId) 024, "Arbok"), + new KeyValuePair((PokemonId) 025, "Pikachu"), + new KeyValuePair((PokemonId) 026, "Raichu"), + new KeyValuePair((PokemonId) 027, "Sandshrew"), + new KeyValuePair((PokemonId) 028, "Sandslash"), + new KeyValuePair((PokemonId) 029, "NidoranFemale"), + new KeyValuePair((PokemonId) 030, "Nidorina"), + new KeyValuePair((PokemonId) 031, "Nidoqueen"), + new KeyValuePair((PokemonId) 032, "NidoranMale"), + new KeyValuePair((PokemonId) 033, "Nidorino"), + new KeyValuePair((PokemonId) 034, "Nidoking"), + new KeyValuePair((PokemonId) 035, "Clefairy"), + new KeyValuePair((PokemonId) 036, "Clefable"), + new KeyValuePair((PokemonId) 037, "Vulpix"), + new KeyValuePair((PokemonId) 038, "Ninetales"), + new KeyValuePair((PokemonId) 039, "Jigglypuff"), + new KeyValuePair((PokemonId) 040, "Wigglytuff"), + new KeyValuePair((PokemonId) 041, "Zubat"), + new KeyValuePair((PokemonId) 042, "Golbat"), + new KeyValuePair((PokemonId) 043, "Oddish"), + new KeyValuePair((PokemonId) 044, "Gloom"), + new KeyValuePair((PokemonId) 045, "Vileplume"), + new KeyValuePair((PokemonId) 046, "Paras"), + new KeyValuePair((PokemonId) 047, "Parasect"), + new KeyValuePair((PokemonId) 048, "Venonat"), + new KeyValuePair((PokemonId) 049, "Venomoth"), + new KeyValuePair((PokemonId) 050, "Diglett"), + new KeyValuePair((PokemonId) 051, "Dugtrio"), + new KeyValuePair((PokemonId) 052, "Meowth"), + new KeyValuePair((PokemonId) 053, "Persian"), + new KeyValuePair((PokemonId) 054, "Psyduck"), + new KeyValuePair((PokemonId) 055, "Golduck"), + new KeyValuePair((PokemonId) 056, "Mankey"), + new KeyValuePair((PokemonId) 057, "Primeape"), + new KeyValuePair((PokemonId) 058, "Growlithe"), + new KeyValuePair((PokemonId) 059, "Arcanine"), + new KeyValuePair((PokemonId) 060, "Poliwag"), + new KeyValuePair((PokemonId) 061, "Poliwhirl"), + new KeyValuePair((PokemonId) 062, "Poliwrath"), + new KeyValuePair((PokemonId) 063, "Abra"), + new KeyValuePair((PokemonId) 064, "Kadabra"), + new KeyValuePair((PokemonId) 065, "Alakazam"), + new KeyValuePair((PokemonId) 066, "Machop"), + new KeyValuePair((PokemonId) 067, "Machoke"), + new KeyValuePair((PokemonId) 068, "Machamp"), + new KeyValuePair((PokemonId) 069, "Bellsprout"), + new KeyValuePair((PokemonId) 070, "Weepinbell"), + new KeyValuePair((PokemonId) 071, "Victreebel"), + new KeyValuePair((PokemonId) 072, "Tentacool"), + new KeyValuePair((PokemonId) 073, "Tentacruel"), + new KeyValuePair((PokemonId) 074, "Geodude"), + new KeyValuePair((PokemonId) 075, "Graveler"), + new KeyValuePair((PokemonId) 076, "Golem"), + new KeyValuePair((PokemonId) 077, "Ponyta"), + new KeyValuePair((PokemonId) 078, "Rapidash"), + new KeyValuePair((PokemonId) 079, "Slowpoke"), + new KeyValuePair((PokemonId) 080, "Slowbro"), + new KeyValuePair((PokemonId) 081, "Magnemite"), + new KeyValuePair((PokemonId) 082, "Magneton"), + new KeyValuePair((PokemonId) 083, "Farfetchd"), + new KeyValuePair((PokemonId) 084, "Doduo"), + new KeyValuePair((PokemonId) 085, "Dodrio"), + new KeyValuePair((PokemonId) 086, "Seel"), + new KeyValuePair((PokemonId) 087, "Dewgong"), + new KeyValuePair((PokemonId) 088, "Grimer"), + new KeyValuePair((PokemonId) 089, "Muk"), + new KeyValuePair((PokemonId) 090, "Shellder"), + new KeyValuePair((PokemonId) 091, "Cloyster"), + new KeyValuePair((PokemonId) 092, "Gastly"), + new KeyValuePair((PokemonId) 093, "Haunter"), + new KeyValuePair((PokemonId) 094, "Gengar"), + new KeyValuePair((PokemonId) 095, "Onix"), + new KeyValuePair((PokemonId) 096, "Drowzee"), + new KeyValuePair((PokemonId) 097, "Hypno"), + new KeyValuePair((PokemonId) 098, "Krabby"), + new KeyValuePair((PokemonId) 099, "Kingler"), + new KeyValuePair((PokemonId) 100, "Voltorb"), + new KeyValuePair((PokemonId) 101, "Electrode"), + new KeyValuePair((PokemonId) 102, "Exeggcute"), + new KeyValuePair((PokemonId) 103, "Exeggutor"), + new KeyValuePair((PokemonId) 104, "Cubone"), + new KeyValuePair((PokemonId) 105, "Marowak"), + new KeyValuePair((PokemonId) 106, "Hitmonlee"), + new KeyValuePair((PokemonId) 107, "Hitmonchan"), + new KeyValuePair((PokemonId) 108, "Lickitung"), + new KeyValuePair((PokemonId) 109, "Koffing"), + new KeyValuePair((PokemonId) 110, "Weezing"), + new KeyValuePair((PokemonId) 111, "Rhyhorn"), + new KeyValuePair((PokemonId) 112, "Rhydon"), + new KeyValuePair((PokemonId) 113, "Chansey"), + new KeyValuePair((PokemonId) 114, "Tangela"), + new KeyValuePair((PokemonId) 115, "Kangaskhan"), + new KeyValuePair((PokemonId) 116, "Horsea"), + new KeyValuePair((PokemonId) 117, "Seadra"), + new KeyValuePair((PokemonId) 118, "Goldeen"), + new KeyValuePair((PokemonId) 119, "Seaking"), + new KeyValuePair((PokemonId) 120, "Staryu"), + new KeyValuePair((PokemonId) 121, "Starmie"), + new KeyValuePair((PokemonId) 122, "Mr. Mime"), + new KeyValuePair((PokemonId) 123, "Scyther"), + new KeyValuePair((PokemonId) 124, "Jynx"), + new KeyValuePair((PokemonId) 125, "Electabuzz"), + new KeyValuePair((PokemonId) 126, "Magmar"), + new KeyValuePair((PokemonId) 127, "Pinsir"), + new KeyValuePair((PokemonId) 128, "Tauros"), + new KeyValuePair((PokemonId) 129, "Magikarp"), + new KeyValuePair((PokemonId) 130, "Gyarados"), + new KeyValuePair((PokemonId) 131, "Lapras"), + new KeyValuePair((PokemonId) 132, "Ditto"), + new KeyValuePair((PokemonId) 133, "Eevee"), + new KeyValuePair((PokemonId) 134, "Vaporeon"), + new KeyValuePair((PokemonId) 135, "Jolteon"), + new KeyValuePair((PokemonId) 136, "Flareon"), + new KeyValuePair((PokemonId) 137, "Porygon"), + new KeyValuePair((PokemonId) 138, "Omanyte"), + new KeyValuePair((PokemonId) 139, "Omastar"), + new KeyValuePair((PokemonId) 140, "Kabuto"), + new KeyValuePair((PokemonId) 141, "Kabutops"), + new KeyValuePair((PokemonId) 142, "Aerodactyl"), + new KeyValuePair((PokemonId) 143, "Snorlax"), + new KeyValuePair((PokemonId) 144, "Articuno"), + new KeyValuePair((PokemonId) 145, "Zapdos"), + new KeyValuePair((PokemonId) 146, "Moltres"), + new KeyValuePair((PokemonId) 147, "Dratini"), + new KeyValuePair((PokemonId) 148, "Dragonair"), + new KeyValuePair((PokemonId) 149, "Dragonite"), + new KeyValuePair((PokemonId) 150, "Mewtwo"), + new KeyValuePair((PokemonId) 151, "Mew") + }; + [JsonProperty("TranslationStrings", ItemTypeNameHandling = TypeNameHandling.Arrays, ItemConverterType = typeof(KeyValuePairConverter), @@ -209,14 +560,16 @@ public class Translation : ITranslation private readonly List> _translationStrings = new List > { - new KeyValuePair(TranslationString.HumanWalkingVariant, "Walking Speed: Has been changed, {0:n2} Km/h to {1:n2} Km/h"), + new KeyValuePair(TranslationString.HumanWalkingVariant, + "Walking Speed: Has been changed, {0:n2} Km/h to {1:n2} Km/h"), new KeyValuePair(TranslationString.Pokeball, "PokeBall"), new KeyValuePair(TranslationString.GreatPokeball, "GreatBall"), new KeyValuePair(TranslationString.UltraPokeball, "UltraBall"), new KeyValuePair(TranslationString.MasterPokeball, "MasterBall"), new KeyValuePair(TranslationString.WrongAuthType, "Unknown AuthType in config.json"), - new KeyValuePair(TranslationString.LoginInvalid, "User credentials are invalid and login failed."), + new KeyValuePair(TranslationString.LoginInvalid, + "User credentials are invalid and login failed."), new KeyValuePair(TranslationString.FarmPokestopsOutsideRadius, "You're outside of your defined radius! Walking to start ({0}m away) in 5 seconds. Is your LastPos.ini file correct?"), new KeyValuePair(TranslationString.FarmPokestopsNoUsableFound, @@ -245,8 +598,6 @@ 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} EXP earned | {12} | lat: {13} long: {14}"), new KeyValuePair(TranslationString.EventPokemonCaptureFailed, "({0}) | ({1}) {2} Lvl: {3} CP: ({4}/{5}) IV: {6}% | Chance: {7}% | {8}m dist | with a {9} ({10} left). | lat: {11} long: {12}"), - - new KeyValuePair(TranslationString.EventNoPokeballs, "No Pokeballs - We missed a {0} with CP {1}"), new KeyValuePair(TranslationString.WaitingForMorePokemonToEvolve, @@ -419,7 +770,8 @@ public class Translation : ITranslation new KeyValuePair(TranslationString.NoEggsAvailable, "No Eggs Available"), new KeyValuePair(TranslationString.UseLuckyEggActive, "Lucky Egg Already Active"), new KeyValuePair(TranslationString.UsedLuckyEgg, "Used Lucky Egg"), - new KeyValuePair(TranslationString.UseLuckyEggAmount, "Lucky Eggs in Inventory: {0}"), + new KeyValuePair(TranslationString.UseLuckyEggAmount, + "Lucky Eggs in Inventory: {0}"), new KeyValuePair(TranslationString.NoIncenseAvailable, "No Incense Available"), new KeyValuePair(TranslationString.UseIncenseActive, "Incense Already Active"), new KeyValuePair(TranslationString.UseIncenseAmount, "Incense in Inventory: {0}"), @@ -430,387 +782,66 @@ public class Translation : ITranslation "Potential Evolutions: {0}"), new KeyValuePair(TranslationString.PkmNotEnoughRessources, "Pokemon Upgrade Failed Not Enough Resources"), - new KeyValuePair(TranslationString.SnipeServerOffline, "Sniping server is offline. Skipping..."), - new KeyValuePair(TranslationString.FirstStartPrompt, "This is your first start, would you like to begin setup? {0}/{1}"), - new KeyValuePair(TranslationString.FirstStartLanguagePrompt, "Would you like to change the default language? {0}/{1}"), - new KeyValuePair(TranslationString.FirstStartLanguageCodePrompt, "Please enter a new language code"), - new KeyValuePair(TranslationString.FirstStartLanguageConfirm, "Language Code Applied: {0}"), - new KeyValuePair(TranslationString.PromptError, "[INPUT ERROR] Error with input, please enter '{0}' or '{1}"), - new KeyValuePair(TranslationString.FirstStartAutoGenSettings, "Config/Auth file automatically generated and must be completed before continuing"), - new KeyValuePair(TranslationString.FirstStartSetupAccount, "### Setting up new USER ACCOUNT ###"), - new KeyValuePair(TranslationString.FirstStartSetupTypePrompt, "Please choose an account type: {0}/{1}"), - new KeyValuePair(TranslationString.FirstStartSetupTypeConfirm, "Chosen Account Type: {0}"), - new KeyValuePair(TranslationString.FirstStartSetupTypePromptError, "[ERROR] submitted an incorrect account type, please choose '{0}' or '{1}'"), - new KeyValuePair(TranslationString.FirstStartSetupUsernamePrompt, "Please enter a Username"), - new KeyValuePair(TranslationString.FirstStartSetupUsernameConfirm, "Accepted username: {0}"), - new KeyValuePair(TranslationString.FirstStartSetupPasswordPrompt, "Please enter a Password"), - new KeyValuePair(TranslationString.FirstStartSetupPasswordConfirm, "Accepted password: {0}"), - new KeyValuePair(TranslationString.FirstStartAccountCompleted, "### User Account Completed ###"), - new KeyValuePair(TranslationString.FirstStartDefaultLocationPrompt, "Would you like to setup a new Default Location? {0}/{1}"), - new KeyValuePair(TranslationString.FirstStartDefaultLocationSet, "Default Location Applied"), - new KeyValuePair(TranslationString.FirstStartDefaultLocation, "### Setting Default Position ###"), - new KeyValuePair(TranslationString.FirstStartSetupDefaultLocationError, "[ERROR] Please input only a VALUE for example: {0}"), - new KeyValuePair(TranslationString.FirstStartSetupDefaultLatPrompt, "Please enter a Latitude (Right click to paste)"), - new KeyValuePair(TranslationString.FirstStartSetupDefaultLatConfirm, "Lattitude accepted: {0}"), - new KeyValuePair(TranslationString.FirstStartSetupDefaultLongPrompt, "Please enter a Longitude (Right click to paste)"), - new KeyValuePair(TranslationString.FirstStartSetupDefaultLongConfirm, "Longitude accepted: {0}"), + new KeyValuePair(TranslationString.SnipeServerOffline, + "Sniping server is offline. Skipping..."), + new KeyValuePair(TranslationString.FirstStartPrompt, + "This is your first start, would you like to begin setup? {0}/{1}"), + new KeyValuePair(TranslationString.FirstStartLanguagePrompt, + "Would you like to change the default language? {0}/{1}"), + new KeyValuePair(TranslationString.FirstStartLanguageCodePrompt, + "Please enter a new language code"), + new KeyValuePair(TranslationString.FirstStartLanguageConfirm, + "Language Code Applied: {0}"), + new KeyValuePair(TranslationString.PromptError, + "[INPUT ERROR] Error with input, please enter '{0}' or '{1}"), + new KeyValuePair(TranslationString.FirstStartAutoGenSettings, + "Config/Auth file automatically generated and must be completed before continuing"), + new KeyValuePair(TranslationString.FirstStartSetupAccount, + "### Setting up new USER ACCOUNT ###"), + new KeyValuePair(TranslationString.FirstStartSetupTypePrompt, + "Please choose an account type: {0}/{1}"), + new KeyValuePair(TranslationString.FirstStartSetupTypeConfirm, + "Chosen Account Type: {0}"), + new KeyValuePair(TranslationString.FirstStartSetupTypePromptError, + "[ERROR] submitted an incorrect account type, please choose '{0}' or '{1}'"), + new KeyValuePair(TranslationString.FirstStartSetupUsernamePrompt, + "Please enter a Username"), + new KeyValuePair(TranslationString.FirstStartSetupUsernameConfirm, + "Accepted username: {0}"), + new KeyValuePair(TranslationString.FirstStartSetupPasswordPrompt, + "Please enter a Password"), + new KeyValuePair(TranslationString.FirstStartSetupPasswordConfirm, + "Accepted password: {0}"), + new KeyValuePair(TranslationString.FirstStartAccountCompleted, + "### User Account Completed ###"), + new KeyValuePair(TranslationString.FirstStartDefaultLocationPrompt, + "Would you like to setup a new Default Location? {0}/{1}"), + new KeyValuePair(TranslationString.FirstStartDefaultLocationSet, + "Default Location Applied"), + new KeyValuePair(TranslationString.FirstStartDefaultLocation, + "### Setting Default Position ###"), + new KeyValuePair(TranslationString.FirstStartSetupDefaultLocationError, + "[ERROR] Please input only a VALUE for example: {0}"), + new KeyValuePair(TranslationString.FirstStartSetupDefaultLatPrompt, + "Please enter a Latitude (Right click to paste)"), + new KeyValuePair(TranslationString.FirstStartSetupDefaultLatConfirm, + "Lattitude accepted: {0}"), + new KeyValuePair(TranslationString.FirstStartSetupDefaultLongPrompt, + "Please enter a Longitude (Right click to paste)"), + new KeyValuePair(TranslationString.FirstStartSetupDefaultLongConfirm, + "Longitude accepted: {0}"), new KeyValuePair(TranslationString.SoftBanBypassed, "Successfully bypassed!"), - new KeyValuePair(TranslationString.FirstStartSetupCompleted, "### COMPLETED CONFIG SETUP ###"), - new KeyValuePair(TranslationString.PokedexCatchedTelegram, "--- Pokedex catched --- \n"), - new KeyValuePair(TranslationString.PokedexPokemonCatchedTelegram, "#{0} Name: {1} | Catched: {2} | Encountered: {3} \n"), - new KeyValuePair(TranslationString.PokedexNeededTelegram, "--- Pokedex needed --- \n"), - new KeyValuePair(TranslationString.PokedexPokemonNeededTelegram, "#{0}# Name: {1} \n"), - }; - - [JsonProperty("PokemonStrings", - ItemTypeNameHandling = TypeNameHandling.Arrays, - ItemConverterType = typeof(KeyValuePairConverter), - ObjectCreationHandling = ObjectCreationHandling.Replace, - DefaultValueHandling = DefaultValueHandling.Populate)] - private readonly List> _pokemonTranslationStrings = new List>() - { - new KeyValuePair((POGOProtos.Enums.PokemonId)001,"Bulbasaur"), - new KeyValuePair((POGOProtos.Enums.PokemonId)002,"Ivysaur"), - new KeyValuePair((POGOProtos.Enums.PokemonId)003,"Venusaur"), - new KeyValuePair((POGOProtos.Enums.PokemonId)004,"Charmander"), - new KeyValuePair((POGOProtos.Enums.PokemonId)005,"Charmeleon"), - new KeyValuePair((POGOProtos.Enums.PokemonId)006,"Charizard"), - new KeyValuePair((POGOProtos.Enums.PokemonId)007,"Squirtle"), - new KeyValuePair((POGOProtos.Enums.PokemonId)008,"Wartortle"), - new KeyValuePair((POGOProtos.Enums.PokemonId)009,"Blastoise"), - new KeyValuePair((POGOProtos.Enums.PokemonId)010,"Caterpie"), - new KeyValuePair((POGOProtos.Enums.PokemonId)011,"Metapod"), - new KeyValuePair((POGOProtos.Enums.PokemonId)012,"Butterfree"), - new KeyValuePair((POGOProtos.Enums.PokemonId)013,"Weedle"), - new KeyValuePair((POGOProtos.Enums.PokemonId)014,"Kakuna"), - new KeyValuePair((POGOProtos.Enums.PokemonId)015,"Beedrill"), - new KeyValuePair((POGOProtos.Enums.PokemonId)016,"Pidgey"), - new KeyValuePair((POGOProtos.Enums.PokemonId)017,"Pidgeotto"), - new KeyValuePair((POGOProtos.Enums.PokemonId)018,"Pidgeot"), - new KeyValuePair((POGOProtos.Enums.PokemonId)019,"Rattata"), - new KeyValuePair((POGOProtos.Enums.PokemonId)020,"Raticate"), - new KeyValuePair((POGOProtos.Enums.PokemonId)021,"Spearow"), - new KeyValuePair((POGOProtos.Enums.PokemonId)022,"Fearow"), - new KeyValuePair((POGOProtos.Enums.PokemonId)023,"Ekans"), - new KeyValuePair((POGOProtos.Enums.PokemonId)024,"Arbok"), - new KeyValuePair((POGOProtos.Enums.PokemonId)025,"Pikachu"), - new KeyValuePair((POGOProtos.Enums.PokemonId)026,"Raichu"), - new KeyValuePair((POGOProtos.Enums.PokemonId)027,"Sandshrew"), - new KeyValuePair((POGOProtos.Enums.PokemonId)028,"Sandslash"), - new KeyValuePair((POGOProtos.Enums.PokemonId)029,"NidoranFemale"), - new KeyValuePair((POGOProtos.Enums.PokemonId)030,"Nidorina"), - new KeyValuePair((POGOProtos.Enums.PokemonId)031,"Nidoqueen"), - new KeyValuePair((POGOProtos.Enums.PokemonId)032,"NidoranMale"), - new KeyValuePair((POGOProtos.Enums.PokemonId)033,"Nidorino"), - new KeyValuePair((POGOProtos.Enums.PokemonId)034,"Nidoking"), - new KeyValuePair((POGOProtos.Enums.PokemonId)035,"Clefairy"), - new KeyValuePair((POGOProtos.Enums.PokemonId)036,"Clefable"), - new KeyValuePair((POGOProtos.Enums.PokemonId)037,"Vulpix"), - new KeyValuePair((POGOProtos.Enums.PokemonId)038,"Ninetales"), - new KeyValuePair((POGOProtos.Enums.PokemonId)039,"Jigglypuff"), - new KeyValuePair((POGOProtos.Enums.PokemonId)040,"Wigglytuff"), - new KeyValuePair((POGOProtos.Enums.PokemonId)041,"Zubat"), - new KeyValuePair((POGOProtos.Enums.PokemonId)042,"Golbat"), - new KeyValuePair((POGOProtos.Enums.PokemonId)043,"Oddish"), - new KeyValuePair((POGOProtos.Enums.PokemonId)044,"Gloom"), - new KeyValuePair((POGOProtos.Enums.PokemonId)045,"Vileplume"), - new KeyValuePair((POGOProtos.Enums.PokemonId)046,"Paras"), - new KeyValuePair((POGOProtos.Enums.PokemonId)047,"Parasect"), - new KeyValuePair((POGOProtos.Enums.PokemonId)048,"Venonat"), - new KeyValuePair((POGOProtos.Enums.PokemonId)049,"Venomoth"), - new KeyValuePair((POGOProtos.Enums.PokemonId)050,"Diglett"), - new KeyValuePair((POGOProtos.Enums.PokemonId)051,"Dugtrio"), - new KeyValuePair((POGOProtos.Enums.PokemonId)052,"Meowth"), - new KeyValuePair((POGOProtos.Enums.PokemonId)053,"Persian"), - new KeyValuePair((POGOProtos.Enums.PokemonId)054,"Psyduck"), - new KeyValuePair((POGOProtos.Enums.PokemonId)055,"Golduck"), - new KeyValuePair((POGOProtos.Enums.PokemonId)056,"Mankey"), - new KeyValuePair((POGOProtos.Enums.PokemonId)057,"Primeape"), - new KeyValuePair((POGOProtos.Enums.PokemonId)058,"Growlithe"), - new KeyValuePair((POGOProtos.Enums.PokemonId)059,"Arcanine"), - new KeyValuePair((POGOProtos.Enums.PokemonId)060,"Poliwag"), - new KeyValuePair((POGOProtos.Enums.PokemonId)061,"Poliwhirl"), - new KeyValuePair((POGOProtos.Enums.PokemonId)062,"Poliwrath"), - new KeyValuePair((POGOProtos.Enums.PokemonId)063,"Abra"), - new KeyValuePair((POGOProtos.Enums.PokemonId)064,"Kadabra"), - new KeyValuePair((POGOProtos.Enums.PokemonId)065,"Alakazam"), - new KeyValuePair((POGOProtos.Enums.PokemonId)066,"Machop"), - new KeyValuePair((POGOProtos.Enums.PokemonId)067,"Machoke"), - new KeyValuePair((POGOProtos.Enums.PokemonId)068,"Machamp"), - new KeyValuePair((POGOProtos.Enums.PokemonId)069,"Bellsprout"), - new KeyValuePair((POGOProtos.Enums.PokemonId)070,"Weepinbell"), - new KeyValuePair((POGOProtos.Enums.PokemonId)071,"Victreebel"), - new KeyValuePair((POGOProtos.Enums.PokemonId)072,"Tentacool"), - new KeyValuePair((POGOProtos.Enums.PokemonId)073,"Tentacruel"), - new KeyValuePair((POGOProtos.Enums.PokemonId)074,"Geodude"), - new KeyValuePair((POGOProtos.Enums.PokemonId)075,"Graveler"), - new KeyValuePair((POGOProtos.Enums.PokemonId)076,"Golem"), - new KeyValuePair((POGOProtos.Enums.PokemonId)077,"Ponyta"), - new KeyValuePair((POGOProtos.Enums.PokemonId)078,"Rapidash"), - new KeyValuePair((POGOProtos.Enums.PokemonId)079,"Slowpoke"), - new KeyValuePair((POGOProtos.Enums.PokemonId)080,"Slowbro"), - new KeyValuePair((POGOProtos.Enums.PokemonId)081,"Magnemite"), - new KeyValuePair((POGOProtos.Enums.PokemonId)082,"Magneton"), - new KeyValuePair((POGOProtos.Enums.PokemonId)083,"Farfetchd"), - new KeyValuePair((POGOProtos.Enums.PokemonId)084,"Doduo"), - new KeyValuePair((POGOProtos.Enums.PokemonId)085,"Dodrio"), - new KeyValuePair((POGOProtos.Enums.PokemonId)086,"Seel"), - new KeyValuePair((POGOProtos.Enums.PokemonId)087,"Dewgong"), - new KeyValuePair((POGOProtos.Enums.PokemonId)088,"Grimer"), - new KeyValuePair((POGOProtos.Enums.PokemonId)089,"Muk"), - new KeyValuePair((POGOProtos.Enums.PokemonId)090,"Shellder"), - new KeyValuePair((POGOProtos.Enums.PokemonId)091,"Cloyster"), - new KeyValuePair((POGOProtos.Enums.PokemonId)092,"Gastly"), - new KeyValuePair((POGOProtos.Enums.PokemonId)093,"Haunter"), - new KeyValuePair((POGOProtos.Enums.PokemonId)094,"Gengar"), - new KeyValuePair((POGOProtos.Enums.PokemonId)095,"Onix"), - new KeyValuePair((POGOProtos.Enums.PokemonId)096,"Drowzee"), - new KeyValuePair((POGOProtos.Enums.PokemonId)097,"Hypno"), - new KeyValuePair((POGOProtos.Enums.PokemonId)098,"Krabby"), - new KeyValuePair((POGOProtos.Enums.PokemonId)099,"Kingler"), - new KeyValuePair((POGOProtos.Enums.PokemonId)100,"Voltorb"), - new KeyValuePair((POGOProtos.Enums.PokemonId)101,"Electrode"), - new KeyValuePair((POGOProtos.Enums.PokemonId)102,"Exeggcute"), - new KeyValuePair((POGOProtos.Enums.PokemonId)103,"Exeggutor"), - new KeyValuePair((POGOProtos.Enums.PokemonId)104,"Cubone"), - new KeyValuePair((POGOProtos.Enums.PokemonId)105,"Marowak"), - new KeyValuePair((POGOProtos.Enums.PokemonId)106,"Hitmonlee"), - new KeyValuePair((POGOProtos.Enums.PokemonId)107,"Hitmonchan"), - new KeyValuePair((POGOProtos.Enums.PokemonId)108,"Lickitung"), - new KeyValuePair((POGOProtos.Enums.PokemonId)109,"Koffing"), - new KeyValuePair((POGOProtos.Enums.PokemonId)110,"Weezing"), - new KeyValuePair((POGOProtos.Enums.PokemonId)111,"Rhyhorn"), - new KeyValuePair((POGOProtos.Enums.PokemonId)112,"Rhydon"), - new KeyValuePair((POGOProtos.Enums.PokemonId)113,"Chansey"), - new KeyValuePair((POGOProtos.Enums.PokemonId)114,"Tangela"), - new KeyValuePair((POGOProtos.Enums.PokemonId)115,"Kangaskhan"), - new KeyValuePair((POGOProtos.Enums.PokemonId)116,"Horsea"), - new KeyValuePair((POGOProtos.Enums.PokemonId)117,"Seadra"), - new KeyValuePair((POGOProtos.Enums.PokemonId)118,"Goldeen"), - new KeyValuePair((POGOProtos.Enums.PokemonId)119,"Seaking"), - new KeyValuePair((POGOProtos.Enums.PokemonId)120,"Staryu"), - new KeyValuePair((POGOProtos.Enums.PokemonId)121,"Starmie"), - new KeyValuePair((POGOProtos.Enums.PokemonId)122,"Mr. Mime"), - new KeyValuePair((POGOProtos.Enums.PokemonId)123,"Scyther"), - new KeyValuePair((POGOProtos.Enums.PokemonId)124,"Jynx"), - new KeyValuePair((POGOProtos.Enums.PokemonId)125,"Electabuzz"), - new KeyValuePair((POGOProtos.Enums.PokemonId)126,"Magmar"), - new KeyValuePair((POGOProtos.Enums.PokemonId)127,"Pinsir"), - new KeyValuePair((POGOProtos.Enums.PokemonId)128,"Tauros"), - new KeyValuePair((POGOProtos.Enums.PokemonId)129,"Magikarp"), - new KeyValuePair((POGOProtos.Enums.PokemonId)130,"Gyarados"), - new KeyValuePair((POGOProtos.Enums.PokemonId)131,"Lapras"), - new KeyValuePair((POGOProtos.Enums.PokemonId)132,"Ditto"), - new KeyValuePair((POGOProtos.Enums.PokemonId)133,"Eevee"), - new KeyValuePair((POGOProtos.Enums.PokemonId)134,"Vaporeon"), - new KeyValuePair((POGOProtos.Enums.PokemonId)135,"Jolteon"), - new KeyValuePair((POGOProtos.Enums.PokemonId)136,"Flareon"), - new KeyValuePair((POGOProtos.Enums.PokemonId)137,"Porygon"), - new KeyValuePair((POGOProtos.Enums.PokemonId)138,"Omanyte"), - new KeyValuePair((POGOProtos.Enums.PokemonId)139,"Omastar"), - new KeyValuePair((POGOProtos.Enums.PokemonId)140,"Kabuto"), - new KeyValuePair((POGOProtos.Enums.PokemonId)141,"Kabutops"), - new KeyValuePair((POGOProtos.Enums.PokemonId)142,"Aerodactyl"), - new KeyValuePair((POGOProtos.Enums.PokemonId)143,"Snorlax"), - new KeyValuePair((POGOProtos.Enums.PokemonId)144,"Articuno"), - new KeyValuePair((POGOProtos.Enums.PokemonId)145,"Zapdos"), - new KeyValuePair((POGOProtos.Enums.PokemonId)146,"Moltres"), - new KeyValuePair((POGOProtos.Enums.PokemonId)147,"Dratini"), - new KeyValuePair((POGOProtos.Enums.PokemonId)148,"Dragonair"), - new KeyValuePair((POGOProtos.Enums.PokemonId)149,"Dragonite"), - new KeyValuePair((POGOProtos.Enums.PokemonId)150,"Mewtwo"), - new KeyValuePair((POGOProtos.Enums.PokemonId)151,"Mew"), - }; - - [JsonProperty("PokemonMovesetStrings", - ItemTypeNameHandling = TypeNameHandling.Arrays, - ItemConverterType = typeof(KeyValuePairConverter), - ObjectCreationHandling = ObjectCreationHandling.Replace, - DefaultValueHandling = DefaultValueHandling.Populate)] - private readonly List> _pokemonMovesetTranslationStrings = - new List>() - { - new KeyValuePair ( POGOProtos.Enums.PokemonMove.MoveUnset, "MoveUnset" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.ThunderShock, "ThunderShock" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.QuickAttack, "QuickAttack" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.Scratch, "Scratch" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.Ember, "Ember" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.VineWhip, "VineWhip" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.Tackle, "Tackle" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.RazorLeaf, "RazorLeaf" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.TakeDown, "TakeDown" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.WaterGun, "WaterGun" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.Bite, "Bite" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.Pound, "Pound" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.DoubleSlap, "DoubleSlap" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.Wrap, "Wrap" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.HyperBeam, "HyperBeam" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.Lick, "Lick" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.DarkPulse, "DarkPulse" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.Smog, "Smog" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.Sludge, "Sludge" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.MetalClaw, "MetalClaw" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.ViceGrip, "ViceGrip" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.FlameWheel, "FlameWheel" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.Megahorn, "Megahorn" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.WingAttack, "WingAttack" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.Flamethrower, "Flamethrower" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.SuckerPunch, "SuckerPunch" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.Dig, "Dig" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.LowKick, "LowKick" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.CrossChop, "CrossChop" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.PsychoCut, "PsychoCut" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.Psybeam, "Psybeam" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.Earthquake, "Earthquake" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.StoneEdge, "StoneEdge" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.IcePunch, "IcePunch" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.HeartStamp, "HeartStamp" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.Discharge, "Discharge" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.FlashCannon, "FlashCannon" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.Peck, "Peck" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.DrillPeck, "DrillPeck" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.IceBeam, "IceBeam" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.Blizzard, "Blizzard" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.AirSlash, "AirSlash" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.HeatWave, "HeatWave" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.Twineedle, "Twineedle" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.PoisonJab, "PoisonJab" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.AerialAce, "AerialAce" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.DrillRun, "DrillRun" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.PetalBlizzard, "PetalBlizzard" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.MegaDrain, "MegaDrain" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.BugBuzz, "BugBuzz" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.PoisonFang, "PoisonFang" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.NightSlash, "NightSlash" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.Slash, "Slash" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.BubbleBeam, "BubbleBeam" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.Submission, "Submission" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.KarateChop, "KarateChop" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.LowSweep, "LowSweep" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.AquaJet, "AquaJet" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.AquaTail, "AquaTail" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.SeedBomb, "SeedBomb" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.Psyshock, "Psyshock" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.RockThrow, "RockThrow" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.AncientPower, "AncientPower" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.RockTomb, "RockTomb" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.RockSlide, "RockSlide" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.PowerGem, "PowerGem" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.ShadowSneak, "ShadowSneak" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.ShadowPunch, "ShadowPunch" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.ShadowClaw, "ShadowClaw" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.OminousWind, "OminousWind" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.ShadowBall, "ShadowBall" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.BulletPunch, "BulletPunch" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.MagnetBomb, "MagnetBomb" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.SteelWing, "SteelWing" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.IronHead, "IronHead" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.ParabolicCharge, "ParabolicCharge" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.Spark, "Spark" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.ThunderPunch, "ThunderPunch" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.Thunder, "Thunder" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.Thunderbolt, "Thunderbolt" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.Twister, "Twister" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.DragonBreath, "DragonBreath" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.DragonPulse, "DragonPulse" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.DragonClaw, "DragonClaw" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.DisarmingVoice, "DisarmingVoice" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.DrainingKiss, "DrainingKiss" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.DazzlingGleam, "DazzlingGleam" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.Moonblast, "Moonblast" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.PlayRough, "PlayRough" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.CrossPoison, "CrossPoison" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.SludgeBomb, "SludgeBomb" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.SludgeWave, "SludgeWave" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.GunkShot, "GunkShot" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.MudShot, "MudShot" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.BoneClub, "BoneClub" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.Bulldoze, "Bulldoze" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.MudBomb, "MudBomb" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.FuryCutter, "FuryCutter" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.BugBite, "BugBite" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.SignalBeam, "SignalBeam" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.XScissor, "XScissor" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.FlameCharge, "FlameCharge" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.FlameBurst, "FlameBurst" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.FireBlast, "FireBlast" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.Brine, "Brine" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.WaterPulse, "WaterPulse" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.Scald, "Scald" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.HydroPump, "HydroPump" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.Psychic, "Psychic" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.Psystrike, "Psystrike" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.IceShard, "IceShard" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.IcyWind, "IcyWind" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.FrostBreath, "FrostBreath" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.Absorb, "Absorb" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.GigaDrain, "GigaDrain" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.FirePunch, "FirePunch" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.SolarBeam, "SolarBeam" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.LeafBlade, "LeafBlade" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.PowerWhip, "PowerWhip" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.Splash, "Splash" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.Acid, "Acid" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.AirCutter, "AirCutter" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.Hurricane, "Hurricane" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.BrickBreak, "BrickBreak" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.Cut, "Cut" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.Swift, "Swift" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.HornAttack, "HornAttack" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.Stomp, "Stomp" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.Headbutt, "Headbutt" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.HyperFang, "HyperFang" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.Slam, "Slam" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.BodySlam, "BodySlam" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.Rest, "Rest" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.Struggle, "Struggle" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.ScaldBlastoise, "ScaldBlastoise" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.HydroPumpBlastoise, "HydroPumpBlastoise" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.WrapGreen, "WrapGreen" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.WrapPink, "WrapPink" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.FuryCutterFast, "FuryCutterFast" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.BugBiteFast, "BugBiteFast" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.BiteFast, "BiteFast" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.SuckerPunchFast, "SuckerPunchFast" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.DragonBreathFast, "DragonBreathFast" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.ThunderShockFast, "ThunderShockFast" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.SparkFast, "SparkFast" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.LowKickFast, "LowKickFast" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.KarateChopFast, "KarateChopFast" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.EmberFast, "EmberFast" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.WingAttackFast, "WingAttackFast" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.PeckFast, "PeckFast" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.LickFast, "LickFast" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.ShadowClawFast, "ShadowClawFast" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.VineWhipFast, "VineWhipFast" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.RazorLeafFast, "RazorLeafFast" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.MudShotFast, "MudShotFast" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.IceShardFast, "IceShardFast" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.FrostBreathFast, "FrostBreathFast" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.QuickAttackFast, "QuickAttackFast" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.ScratchFast, "ScratchFast" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.TackleFast, "TackleFast" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.PoundFast, "PoundFast" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.CutFast, "CutFast" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.PoisonJabFast, "PoisonJabFast" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.AcidFast, "AcidFast" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.PsychoCutFast, "PsychoCutFast" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.RockThrowFast, "RockThrowFast" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.MetalClawFast, "MetalClawFast" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.BulletPunchFast, "BulletPunchFast" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.WaterGunFast, "WaterGunFast" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.SplashFast, "SplashFast" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.WaterGunFastBlastoise, "WaterGunFastBlastoise" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.MudSlapFast, "MudSlapFast" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.ZenHeadbuttFast, "ZenHeadbuttFast" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.ConfusionFast, "ConfusionFast" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.PoisonStingFast, "PoisonStingFast" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.BubbleFast, "BubbleFast" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.FeintAttackFast, "FeintAttackFast" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.SteelWingFast, "SteelWingFast" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.FireFangFast, "FireFangFast" ), - new KeyValuePair ( POGOProtos.Enums.PokemonMove.RockSmashFast, "RockSmashFast" ) + new KeyValuePair(TranslationString.FirstStartSetupCompleted, + "### COMPLETED CONFIG SETUP ###"), + new KeyValuePair(TranslationString.PokedexCatchedTelegram, + "--- Pokedex catched --- \n"), + new KeyValuePair(TranslationString.PokedexPokemonCatchedTelegram, + "#{0} Name: {1} | Catched: {2} | Encountered: {3} \n"), + new KeyValuePair(TranslationString.PokedexNeededTelegram, + "--- Pokedex needed --- \n"), + new KeyValuePair(TranslationString.PokedexPokemonNeededTelegram, + "#{0}# Name: {1} \n") }; public string GetTranslation(TranslationString translationString, params object[] data) @@ -827,24 +858,24 @@ public string GetTranslation(TranslationString translationString) return translation != default(string) ? translation : $"Translation for {translationString} is missing"; } - public string GetPokemonTranslation(POGOProtos.Enums.PokemonId id) + public string GetPokemonTranslation(PokemonId id) { var translation = _pokemonTranslationStrings.FirstOrDefault(t => t.Key.Equals(id)).Value; return translation != default(string) ? translation : $"Translation for pokemon {id} is missing"; } - public string GetPokemonMovesetTranslation( POGOProtos.Enums.PokemonMove move ) + public string GetPokemonMovesetTranslation(PokemonMove move) { - var translation = _pokemonMovesetTranslationStrings.FirstOrDefault( t => t.Key.Equals( move ) ).Value; - return translation != default( string ) ? translation : $"Translation for move {move} is missing"; + var translation = _pokemonMovesetTranslationStrings.FirstOrDefault(t => t.Key.Equals(move)).Value; + return translation != default(string) ? translation : $"Translation for move {move} is missing"; } - public static Translation Load( ILogicSettings logicSettings ) + public static Translation Load(ILogicSettings logicSettings) { - return Load( logicSettings, new Translation() ); + return Load(logicSettings, new Translation()); } - public static Translation Load(ILogicSettings logicSettings, Translation translations ) + public static Translation Load(ILogicSettings logicSettings, Translation translations) { var translationsLanguageCode = logicSettings.TranslationLanguageCode; var translationPath = Path.Combine(logicSettings.GeneralConfigPath, "translations"); @@ -855,41 +886,41 @@ public static Translation Load(ILogicSettings logicSettings, Translation transla var input = File.ReadAllText(fullPath); var jsonSettings = new JsonSerializerSettings(); - jsonSettings.Converters.Add(new StringEnumConverter { CamelCaseText = true }); + jsonSettings.Converters.Add(new StringEnumConverter {CamelCaseText = true}); jsonSettings.ObjectCreationHandling = ObjectCreationHandling.Replace; jsonSettings.DefaultValueHandling = DefaultValueHandling.Populate; try { - translations = JsonConvert.DeserializeObject( input, jsonSettings ); + translations = JsonConvert.DeserializeObject(input, jsonSettings); //TODO make json to fill default values as it won't do it now new Translation()._translationStrings.Where( - item => translations._translationStrings.All( a => a.Key != item.Key ) ) + item => translations._translationStrings.All(a => a.Key != item.Key)) .ToList() - .ForEach( translations._translationStrings.Add ); + .ForEach(translations._translationStrings.Add); new Translation()._pokemonTranslationStrings.Where( - item => translations._pokemonTranslationStrings.All( a => a.Key != item.Key ) ) + item => translations._pokemonTranslationStrings.All(a => a.Key != item.Key)) .ToList() - .ForEach( translations._pokemonTranslationStrings.Add ); + .ForEach(translations._pokemonTranslationStrings.Add); } - catch( JsonException ex ) + catch (JsonException ex) { - Logger.Write( $"[ERROR] Issue loading translations: {ex.ToString()}", LogLevel.Warning ); - Logger.Write( "[Request] Rebuild the translations folder? Y/N" ); + Logger.Write($"[ERROR] Issue loading translations: {ex}", LogLevel.Warning); + Logger.Write("[Request] Rebuild the translations folder? Y/N"); - string strInput = Console.ReadLine().ToLower(); + var strInput = Console.ReadLine().ToLower(); - if( strInput.Equals( "y" ) ) + if (strInput.Equals("y")) { // Currently this section can only rebuild the EN translations file \\ // This is because default values cannot be supplied from other languages \\ - Logger.Write( "Loading fresh translations and continuing" ); + Logger.Write("Loading fresh translations and continuing"); translations = new Translation(); - translations.Save( Path.Combine( translationPath, "translation.en.json" ) ); + translations.Save(Path.Combine(translationPath, "translation.en.json")); } else { - ErrorHandler.ThrowFatalError( "[ERROR] Fatal Error", 3, LogLevel.Error ); + ErrorHandler.ThrowFatalError("[ERROR] Fatal Error", 3, LogLevel.Error); return null; } } @@ -906,7 +937,7 @@ public static Translation Load(ILogicSettings logicSettings, Translation transla public void Save(string fullPath) { var output = JsonConvert.SerializeObject(this, Formatting.Indented, - new StringEnumConverter { CamelCaseText = true }); + new StringEnumConverter {CamelCaseText = true}); var folder = Path.GetDirectoryName(fullPath); if (folder != null && !Directory.Exists(folder)) @@ -917,4 +948,4 @@ public void Save(string fullPath) File.WriteAllText(fullPath, output); } } -} +} \ No newline at end of file diff --git a/PokemonGo.RocketBot.Logic/Event/EvolveCountEvent.cs b/PokemonGo.RocketBot.Logic/Event/EvolveCountEvent.cs index 6871b8f41..62b2c9170 100644 --- a/PokemonGo.RocketBot.Logic/Event/EvolveCountEvent.cs +++ b/PokemonGo.RocketBot.Logic/Event/EvolveCountEvent.cs @@ -1,13 +1,7 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace PokemonGo.RocketBot.Logic.Event +namespace PokemonGo.RocketBot.Logic.Event { public class EvolveCountEvent : IEvent { public int Evolves; } -} +} \ No newline at end of file diff --git a/PokemonGo.RocketBot.Logic/Event/FortFailedEvent.cs b/PokemonGo.RocketBot.Logic/Event/FortFailedEvent.cs index aa67cc5b1..4969f03e0 100644 --- a/PokemonGo.RocketBot.Logic/Event/FortFailedEvent.cs +++ b/PokemonGo.RocketBot.Logic/Event/FortFailedEvent.cs @@ -2,9 +2,9 @@ { public class FortFailedEvent : IEvent { + public bool Looted; public int Max; public string Name; public int Try; - public bool Looted; } } \ No newline at end of file diff --git a/PokemonGo.RocketBot.Logic/Event/HumanWalkingEvent.cs b/PokemonGo.RocketBot.Logic/Event/HumanWalkingEvent.cs index 3a9e013c8..12e99a867 100644 --- a/PokemonGo.RocketBot.Logic/Event/HumanWalkingEvent.cs +++ b/PokemonGo.RocketBot.Logic/Event/HumanWalkingEvent.cs @@ -2,8 +2,7 @@ { public class HumanWalkingEvent : IEvent { - public double OldWalkingSpeed; public double CurrentWalkingSpeed; + public double OldWalkingSpeed; } -} - +} \ No newline at end of file diff --git a/PokemonGo.RocketBot.Logic/Event/InventoryListEvent.cs b/PokemonGo.RocketBot.Logic/Event/InventoryListEvent.cs index 2627fb416..4331027bf 100644 --- a/PokemonGo.RocketBot.Logic/Event/InventoryListEvent.cs +++ b/PokemonGo.RocketBot.Logic/Event/InventoryListEvent.cs @@ -1,9 +1,5 @@ -using POGOProtos.Inventory.Item; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Collections.Generic; +using POGOProtos.Inventory.Item; namespace PokemonGo.RocketBot.Logic.Event { @@ -11,4 +7,4 @@ public class InventoryListEvent : IEvent { public List Items; } -} +} \ No newline at end of file diff --git a/PokemonGo.RocketBot.Logic/Event/LootPokestopEvent.cs b/PokemonGo.RocketBot.Logic/Event/LootPokestopEvent.cs index 05bf08328..1f9ff0f6f 100644 --- a/PokemonGo.RocketBot.Logic/Event/LootPokestopEvent.cs +++ b/PokemonGo.RocketBot.Logic/Event/LootPokestopEvent.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using POGOProtos.Map.Fort; +using POGOProtos.Map.Fort; namespace PokemonGo.RocketBot.Logic.Event { @@ -11,4 +6,4 @@ public class LootPokestopEvent : IEvent { public FortData Pokestop; } -} +} \ No newline at end of file diff --git a/PokemonGo.RocketBot.Logic/Event/OptimizeRouteEvent.cs b/PokemonGo.RocketBot.Logic/Event/OptimizeRouteEvent.cs index 4541918d9..3495fb2e8 100644 --- a/PokemonGo.RocketBot.Logic/Event/OptimizeRouteEvent.cs +++ b/PokemonGo.RocketBot.Logic/Event/OptimizeRouteEvent.cs @@ -1,10 +1,5 @@ -using GMap.NET.WindowsForms; +using System.Collections.Generic; using POGOProtos.Map.Fort; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace PokemonGo.RocketBot.Logic.Event { @@ -12,4 +7,4 @@ public class OptimizeRouteEvent : IEvent { public List OptimizedRoute { get; set; } } -} +} \ No newline at end of file diff --git a/PokemonGo.RocketBot.Logic/Event/PokemonCaptureEvent.cs b/PokemonGo.RocketBot.Logic/Event/PokemonCaptureEvent.cs index 27d69b098..15ea70500 100644 --- a/PokemonGo.RocketBot.Logic/Event/PokemonCaptureEvent.cs +++ b/PokemonGo.RocketBot.Logic/Event/PokemonCaptureEvent.cs @@ -18,14 +18,14 @@ public class PokemonCaptureEvent : IEvent public int Exp; public int FamilyCandies; public PokemonId Id; + public double Latitude; public double Level; + public double Longitude; public int MaxCp; public double Perfection; public ItemId Pokeball; public double Probability; public int Stardust; public CatchPokemonResponse.Types.CatchStatus Status; - public double Latitude; - public double Longitude; } } \ No newline at end of file diff --git a/PokemonGo.RocketBot.Logic/Event/PokemonEvolveEvent.cs b/PokemonGo.RocketBot.Logic/Event/PokemonEvolveEvent.cs index 1e753966a..c123d7e6b 100644 --- a/PokemonGo.RocketBot.Logic/Event/PokemonEvolveEvent.cs +++ b/PokemonGo.RocketBot.Logic/Event/PokemonEvolveEvent.cs @@ -1,6 +1,8 @@ #region using directives + using POGOProtos.Enums; using POGOProtos.Networking.Responses; + #endregion namespace PokemonGo.RocketBot.Logic.Event diff --git a/PokemonGo.RocketBot.Logic/Event/PokemonsEncounterEvent.cs b/PokemonGo.RocketBot.Logic/Event/PokemonsEncounterEvent.cs index 6af0c6cf9..d46507b86 100644 --- a/PokemonGo.RocketBot.Logic/Event/PokemonsEncounterEvent.cs +++ b/PokemonGo.RocketBot.Logic/Event/PokemonsEncounterEvent.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using POGOProtos.Data; +using System.Collections.Generic; using POGOProtos.Map.Pokemon; namespace PokemonGo.RocketBot.Logic.Event @@ -12,4 +7,4 @@ public class PokemonsEncounterEvent : IEvent { public List EncounterPokemons; } -} +} \ No newline at end of file diff --git a/PokemonGo.RocketBot.Logic/ILogicSettings.cs b/PokemonGo.RocketBot.Logic/ILogicSettings.cs index c979758dc..2e0b2c4b6 100644 --- a/PokemonGo.RocketBot.Logic/ILogicSettings.cs +++ b/PokemonGo.RocketBot.Logic/ILogicSettings.cs @@ -1,8 +1,8 @@ #region using directives +using System.Collections.Generic; using POGOProtos.Enums; using POGOProtos.Inventory.Item; -using System.Collections.Generic; #endregion @@ -46,7 +46,8 @@ public TransferFilter() { } - public TransferFilter(int keepMinCp, int keepMinLvl, bool useKeepMinLvl, float keepMinIvPercentage, string keepMinOperator, int keepMinDuplicatePokemon, + public TransferFilter(int keepMinCp, int keepMinLvl, bool useKeepMinLvl, float keepMinIvPercentage, + string keepMinOperator, int keepMinDuplicatePokemon, List moves = null, string movesOperator = "or") { KeepMinCp = keepMinCp; @@ -200,4 +201,4 @@ public interface ILogicSettings bool StartupWelcomeDelay { get; } } -} +} \ No newline at end of file diff --git a/PokemonGo.RocketBot.Logic/Logging/ILogger.cs b/PokemonGo.RocketBot.Logic/Logging/ILogger.cs index c4649d5d9..7a95e4015 100644 --- a/PokemonGo.RocketBot.Logic/Logging/ILogger.cs +++ b/PokemonGo.RocketBot.Logic/Logging/ILogger.cs @@ -22,6 +22,7 @@ public interface ILogger /// Optional. Default . /// Optional. Default automatic color. void Write(string message, LogLevel level = LogLevel.Info, ConsoleColor color = ConsoleColor.Black); + void lineSelect(int lineChar = 0, int linesUp = 1); } } \ No newline at end of file diff --git a/PokemonGo.RocketBot.Logic/Logging/Logger.cs b/PokemonGo.RocketBot.Logic/Logging/Logger.cs index 1806d249d..bd2169bbf 100644 --- a/PokemonGo.RocketBot.Logic/Logging/Logger.cs +++ b/PokemonGo.RocketBot.Logic/Logging/Logger.cs @@ -77,7 +77,8 @@ public static void SetLoggerContext(ISession session) /// The message to log. /// Optional level to log. Default . /// Optional. Default is automatic color. - public static void Write(string message, LogLevel level = LogLevel.Info, ConsoleColor color = ConsoleColor.Black, bool force = false) + public static void Write(string message, LogLevel level = LogLevel.Info, ConsoleColor color = ConsoleColor.Black, + bool force = false) { if (_logger == null || _lastLogMessage == message) return; @@ -114,6 +115,6 @@ public enum LogLevel New = 15, SoftBan = 16, LevelUp = 17, - Debug = 18, + Debug = 18 } } \ No newline at end of file diff --git a/PokemonGo.RocketBot.Logic/PoGoUtils/PokemonInfo.cs b/PokemonGo.RocketBot.Logic/PoGoUtils/PokemonInfo.cs index 78fe88c28..b9908dd9f 100644 --- a/PokemonGo.RocketBot.Logic/PoGoUtils/PokemonInfo.cs +++ b/PokemonGo.RocketBot.Logic/PoGoUtils/PokemonInfo.cs @@ -1,12 +1,12 @@ #region using directives using System; +using System.Collections.Generic; +using System.Linq; using POGOProtos.Data; using POGOProtos.Enums; using POGOProtos.Inventory; -using System.Collections.Generic; using POGOProtos.Settings.Master; -using System.Linq; #endregion @@ -583,7 +583,8 @@ public static PokemonMove GetPokemonMove2(PokemonData poke) return move2; } - public static int GetCandy(PokemonData pokemon, List PokemonFamilies, IEnumerable PokemonSettings) + public static int GetCandy(PokemonData pokemon, List PokemonFamilies, + IEnumerable PokemonSettings) { var setting = PokemonSettings.FirstOrDefault(q => pokemon != null && q.PokemonId.Equals(pokemon.PokemonId)); var family = PokemonFamilies.FirstOrDefault(q => setting != null && q.FamilyId.Equals(setting.FamilyId)); @@ -596,4 +597,4 @@ public static int GetPowerUpLevel(PokemonData poke) return (int) (GetLevel(poke)*2.0); } } -} +} \ No newline at end of file diff --git a/PokemonGo.RocketBot.Logic/Service/TelegramService.cs b/PokemonGo.RocketBot.Logic/Service/TelegramService.cs index 8696f6fee..f1f739999 100644 --- a/PokemonGo.RocketBot.Logic/Service/TelegramService.cs +++ b/PokemonGo.RocketBot.Logic/Service/TelegramService.cs @@ -1,16 +1,12 @@ -using PokemonGo.RocketBot.Logic.Logging; -using PokemonGo.RocketBot.Logic.State; -using System; +using System; using System.Collections.Generic; -using System.ComponentModel; using System.Diagnostics; using System.Linq; using System.Reflection; -using System.Text; -using System.Threading.Tasks; using PokemonGo.RocketBot.Logic.Common; using PokemonGo.RocketBot.Logic.Event; using PokemonGo.RocketBot.Logic.PoGoUtils; +using PokemonGo.RocketBot.Logic.State; using POGOProtos.Data; using POGOProtos.Enums; using POGOProtos.Inventory.Item; @@ -23,12 +19,12 @@ namespace PokemonGo.RocketBot.Logic.Service { public class TelegramService { - private TelegramBotClient bot; - private ISession session; + private readonly TelegramBotClient bot; + private readonly ISession session; public TelegramService(string apiKey, ISession session) { - this.bot = new TelegramBotClient(apiKey); + bot = new TelegramBotClient(apiKey); this.session = session; var me = bot.GetMeAsync().Result; @@ -81,14 +77,15 @@ private async void OnTelegramMessageReceived(object sender, MessageEventArgs mes foreach (var pokemon in topPokemons) { - answerTextmessage += session.Translation.GetTranslation(TranslationString.ShowPokeTemplate, new object[] { pokemon.Cp, PokemonInfo.CalculatePokemonPerfection(pokemon).ToString("0.00"), session.Translation.GetPokemonTranslation(pokemon.PokemonId) }); + answerTextmessage += session.Translation.GetTranslation(TranslationString.ShowPokeTemplate, + pokemon.Cp, PokemonInfo.CalculatePokemonPerfection(pokemon).ToString("0.00"), + session.Translation.GetPokemonTranslation(pokemon.PokemonId)); if (answerTextmessage.Length > 3800) { SendMessage(message.Chat.Id, answerTextmessage); answerTextmessage = ""; } - } SendMessage(message.Chat.Id, answerTextmessage); break; @@ -96,7 +93,8 @@ private async void OnTelegramMessageReceived(object sender, MessageEventArgs mes var myPokemons = await session.Inventory.GetPokemons(); var allMyPokemons = myPokemons.ToList(); - IEnumerable allPokemons = await session.Inventory.GetHighestsCp(allMyPokemons.Count); ; + var allPokemons = await session.Inventory.GetHighestsCp(allMyPokemons.Count); + ; if (messagetext.Length == 2) { if (messagetext[1] == "iv") @@ -107,7 +105,9 @@ private async void OnTelegramMessageReceived(object sender, MessageEventArgs mes foreach (var pokemon in allPokemons) { - answerTextmessage += session.Translation.GetTranslation(TranslationString.ShowPokeTemplate, new object[] { pokemon.Cp, PokemonInfo.CalculatePokemonPerfection(pokemon).ToString("0.00"), session.Translation.GetPokemonTranslation(pokemon.PokemonId) }); + answerTextmessage += session.Translation.GetTranslation(TranslationString.ShowPokeTemplate, + pokemon.Cp, PokemonInfo.CalculatePokemonPerfection(pokemon).ToString("0.00"), + session.Translation.GetPokemonTranslation(pokemon.PokemonId)); if (answerTextmessage.Length > 3800) { @@ -122,22 +122,11 @@ private async void OnTelegramMessageReceived(object sender, MessageEventArgs mes var stat = stats.FirstOrDefault(); var myPokemons2 = await session.Inventory.GetPokemons(); - answerTextmessage += session.Translation.GetTranslation(TranslationString.ProfileStatsTemplateString, - new object[] - { - stat.Level, - session.Profile.PlayerData.Username, - stat.Experience, stat.NextLevelXp, - stat.PokemonsCaptured, - stat.PokemonDeployed, - stat.PokeStopVisits, - stat.EggsHatched, - stat.Evolutions, - stat.UniquePokedexEntries, - stat.KmWalked, - myPokemons2.ToList().Count, - session.Profile.PlayerData.MaxPokemonStorage - }); + answerTextmessage += session.Translation.GetTranslation( + TranslationString.ProfileStatsTemplateString, stat.Level, session.Profile.PlayerData.Username, + stat.Experience, stat.NextLevelXp, stat.PokemonsCaptured, stat.PokemonDeployed, + stat.PokeStopVisits, stat.EggsHatched, stat.Evolutions, stat.UniquePokedexEntries, stat.KmWalked, + myPokemons2.ToList().Count, session.Profile.PlayerData.MaxPokemonStorage); SendMessage(message.Chat.Id, answerTextmessage); break; case "/pokedex": @@ -147,7 +136,13 @@ private async void OnTelegramMessageReceived(object sender, MessageEventArgs mes answerTextmessage += session.Translation.GetTranslation(TranslationString.PokedexCatchedTelegram); foreach (var pokedexItem in pokedexSort) { - answerTextmessage += session.Translation.GetTranslation(TranslationString.PokedexPokemonCatchedTelegram, Convert.ToInt32(pokedexItem.InventoryItemData.PokedexEntry.PokemonId), session.Translation.GetPokemonTranslation(pokedexItem.InventoryItemData.PokedexEntry.PokemonId), pokedexItem.InventoryItemData.PokedexEntry.TimesCaptured, pokedexItem.InventoryItemData.PokedexEntry.TimesEncountered); + answerTextmessage += + session.Translation.GetTranslation(TranslationString.PokedexPokemonCatchedTelegram, + Convert.ToInt32(pokedexItem.InventoryItemData.PokedexEntry.PokemonId), + session.Translation.GetPokemonTranslation( + pokedexItem.InventoryItemData.PokedexEntry.PokemonId), + pokedexItem.InventoryItemData.PokedexEntry.TimesCaptured, + pokedexItem.InventoryItemData.PokedexEntry.TimesEncountered); if (answerTextmessage.Length > 3800) { @@ -156,16 +151,21 @@ private async void OnTelegramMessageReceived(object sender, MessageEventArgs mes } } - var pokemonsToCapture = Enum.GetValues(typeof(PokemonId)).Cast().Except(pokedex.Select(x => x.InventoryItemData.PokedexEntry.PokemonId)); + var pokemonsToCapture = + Enum.GetValues(typeof(PokemonId)) + .Cast() + .Except(pokedex.Select(x => x.InventoryItemData.PokedexEntry.PokemonId)); SendMessage(message.Chat.Id, answerTextmessage); - answerTextmessage = ""; + answerTextmessage = ""; answerTextmessage += session.Translation.GetTranslation(TranslationString.PokedexNeededTelegram); foreach (var pokedexItem in pokemonsToCapture) { - answerTextmessage += session.Translation.GetTranslation(TranslationString.PokedexPokemonNeededTelegram, Convert.ToInt32(pokedexItem), session.Translation.GetPokemonTranslation(pokedexItem)); + answerTextmessage += + session.Translation.GetTranslation(TranslationString.PokedexPokemonNeededTelegram, + Convert.ToInt32(pokedexItem), session.Translation.GetPokemonTranslation(pokedexItem)); if (answerTextmessage.Length > 3800) { @@ -182,45 +182,33 @@ private async void OnTelegramMessageReceived(object sender, MessageEventArgs mes case "/items": var inventory = session.Inventory; answerTextmessage += session.Translation.GetTranslation(TranslationString.CurrentPokeballInv, - new object[] - { - await inventory.GetItemAmountByType(ItemId.ItemPokeBall), - await inventory.GetItemAmountByType(ItemId.ItemGreatBall), - await inventory.GetItemAmountByType(ItemId.ItemUltraBall), - await inventory.GetItemAmountByType(ItemId.ItemMasterBall) - }); + await inventory.GetItemAmountByType(ItemId.ItemPokeBall), + await inventory.GetItemAmountByType(ItemId.ItemGreatBall), + await inventory.GetItemAmountByType(ItemId.ItemUltraBall), + await inventory.GetItemAmountByType(ItemId.ItemMasterBall)); answerTextmessage += "\n"; answerTextmessage += session.Translation.GetTranslation(TranslationString.CurrentPotionInv, - new object[] - { - await inventory.GetItemAmountByType(ItemId.ItemPotion), - await inventory.GetItemAmountByType(ItemId.ItemSuperPotion), - await inventory.GetItemAmountByType(ItemId.ItemHyperPotion), - await inventory.GetItemAmountByType(ItemId.ItemMaxPotion) - }); + await inventory.GetItemAmountByType(ItemId.ItemPotion), + await inventory.GetItemAmountByType(ItemId.ItemSuperPotion), + await inventory.GetItemAmountByType(ItemId.ItemHyperPotion), + await inventory.GetItemAmountByType(ItemId.ItemMaxPotion)); answerTextmessage += "\n"; answerTextmessage += session.Translation.GetTranslation(TranslationString.CurrentReviveInv, - new object[] - { - await inventory.GetItemAmountByType(ItemId.ItemRevive), - await inventory.GetItemAmountByType(ItemId.ItemMaxRevive), - }); + await inventory.GetItemAmountByType(ItemId.ItemRevive), + await inventory.GetItemAmountByType(ItemId.ItemMaxRevive)); answerTextmessage += "\n"; answerTextmessage += session.Translation.GetTranslation(TranslationString.CurrentMiscItemInv, - new object[] - { - await session.Inventory.GetItemAmountByType(ItemId.ItemRazzBerry) + - await session.Inventory.GetItemAmountByType(ItemId.ItemBlukBerry) + - await session.Inventory.GetItemAmountByType(ItemId.ItemNanabBerry) + - await session.Inventory.GetItemAmountByType(ItemId.ItemWeparBerry) + - await session.Inventory.GetItemAmountByType(ItemId.ItemPinapBerry), - await session.Inventory.GetItemAmountByType(ItemId.ItemIncenseOrdinary) + - await session.Inventory.GetItemAmountByType(ItemId.ItemIncenseSpicy) + - await session.Inventory.GetItemAmountByType(ItemId.ItemIncenseCool) + - await session.Inventory.GetItemAmountByType(ItemId.ItemIncenseFloral), - await session.Inventory.GetItemAmountByType(ItemId.ItemLuckyEgg), - await session.Inventory.GetItemAmountByType(ItemId.ItemTroyDisk) - }); + await session.Inventory.GetItemAmountByType(ItemId.ItemRazzBerry) + + await session.Inventory.GetItemAmountByType(ItemId.ItemBlukBerry) + + await session.Inventory.GetItemAmountByType(ItemId.ItemNanabBerry) + + await session.Inventory.GetItemAmountByType(ItemId.ItemWeparBerry) + + await session.Inventory.GetItemAmountByType(ItemId.ItemPinapBerry), + await session.Inventory.GetItemAmountByType(ItemId.ItemIncenseOrdinary) + + await session.Inventory.GetItemAmountByType(ItemId.ItemIncenseSpicy) + + await session.Inventory.GetItemAmountByType(ItemId.ItemIncenseCool) + + await session.Inventory.GetItemAmountByType(ItemId.ItemIncenseFloral), + await session.Inventory.GetItemAmountByType(ItemId.ItemLuckyEgg), + await session.Inventory.GetItemAmountByType(ItemId.ItemTroyDisk)); SendMessage(message.Chat.Id, answerTextmessage); break; case "/status": @@ -240,12 +228,11 @@ await session.Inventory.GetItemAmountByType(ItemId.ItemTroyDisk) private async void SendLocation(long chatID, double currentLatitude, double currentLongitude) { - await bot.SendLocationAsync(chatID, (float)currentLatitude, (float)currentLongitude); + await bot.SendLocationAsync(chatID, (float) currentLatitude, (float) currentLongitude); } private async void SendMessage(long chatID, string message) { - await bot.SendTextMessageAsync(chatID, message, replyMarkup: new ReplyKeyboardHide()); } } diff --git a/PokemonGo.RocketBot.Logic/Settings.cs b/PokemonGo.RocketBot.Logic/Settings.cs index d29b185ac..f03727a88 100644 --- a/PokemonGo.RocketBot.Logic/Settings.cs +++ b/PokemonGo.RocketBot.Logic/Settings.cs @@ -27,37 +27,38 @@ namespace PokemonGo.RocketBot.Logic public class AuthSettings { [JsonIgnore] private string _filePath; - - public AuthType AuthType; - public string GoogleUsername; - public string GooglePassword; - public string PtcUsername; - public string PtcPassword; - public string GoogleApiKey; - public bool UseProxy; - public string UseProxyHost; - public string UseProxyPort; - public bool UseProxyAuthentication; - public string UseProxyUsername; - public string UseProxyPassword; - // device data - [DefaultValue("random")] public string DevicePackageName; - [DefaultValue("8525f5d8201f78b5")] public string DeviceId; [DefaultValue("msm8996")] public string AndroidBoardName; [DefaultValue("1.0.0.0000")] public string AndroidBootloader; + + public AuthType AuthType; [DefaultValue("HTC")] public string DeviceBrand; + [DefaultValue("8525f5d8201f78b5")] public string DeviceId; [DefaultValue("HTC 10")] public string DeviceModel; - [DefaultValue("pmewl_00531")] public string DeviceModelIdentifier; [DefaultValue("qcom")] public string DeviceModelBoot; - [DefaultValue("HTC")] public string HardwareManufacturer; - [DefaultValue("HTC 10")] public string HardwareModel; + [DefaultValue("pmewl_00531")] public string DeviceModelIdentifier; + // device data + [DefaultValue("random")] public string DevicePackageName; [DefaultValue("pmewl_00531")] public string FirmwareBrand; - [DefaultValue("release-keys")] public string FirmwareTags; - [DefaultValue("user")] public string FirmwareType; [DefaultValue("htc/pmewl_00531/htc_pmewl:6.0.1/MMB29M/770927.1:user/release-keys")] public string FirmwareFingerprint; + [DefaultValue("release-keys")] public string FirmwareTags; + [DefaultValue("user")] public string FirmwareType; + public string GoogleApiKey; + public string GooglePassword; + public string GoogleUsername; + [DefaultValue("HTC")] public string HardwareManufacturer; + [DefaultValue("HTC 10")] public string HardwareModel; + public string PtcPassword; + public string PtcUsername; + public bool UseProxy; + public bool UseProxyAuthentication; + public string UseProxyHost; + public string UseProxyPassword; + public string UseProxyPort; + public string UseProxyUsername; + public AuthSettings() { InitializePropertyDefaultValues(this); @@ -65,9 +66,9 @@ public AuthSettings() public void InitializePropertyDefaultValues(object obj) { - FieldInfo[] fields = obj.GetType().GetFields(); + var fields = obj.GetType().GetFields(); - foreach (FieldInfo field in fields) + foreach (var field in fields) { var d = field.GetCustomAttribute(); @@ -96,21 +97,21 @@ public void Load(string path) !DevicePackageName.Equals("custom", StringComparison.InvariantCultureIgnoreCase)) { // User requested a specific device package, check to see if it exists and if so, set it up - otherwise fall-back to random package - string keepDevId = DeviceId; + var keepDevId = DeviceId; SetDevInfoByKey(); DeviceId = keepDevId; } if (DevicePackageName.Equals("random", StringComparison.InvariantCultureIgnoreCase)) { // Random is set, so pick a random device package and set it up - it will get saved to disk below and re-used in subsequent sessions - Random rnd = new Random(); - int rndIdx = rnd.Next(0, DeviceInfoHelper.DeviceInfoSets.Keys.Count - 1); + var rnd = new Random(); + var rndIdx = rnd.Next(0, DeviceInfoHelper.DeviceInfoSets.Keys.Count - 1); DevicePackageName = DeviceInfoHelper.DeviceInfoSets.Keys.ToArray()[rndIdx]; SetDevInfoByKey(); } if (string.IsNullOrEmpty(DeviceId) || DeviceId == "8525f5d8201f78b5") DeviceId = RandomString(16, "0123456789abcdef"); - // changed to random hex as full alphabet letters could have been flagged + // changed to random hex as full alphabet letters could have been flagged // Jurann: Note that some device IDs I saw when adding devices had smaller numbers, only 12 or 14 chars instead of 16 - probably not important but noted here anyway @@ -172,17 +173,17 @@ public void CheckProxy() { using (var tempWebClient = new NecroWebClient()) { - string unproxiedIp = WebClientExtensions.DownloadString(tempWebClient, + var unproxiedIp = WebClientExtensions.DownloadString(tempWebClient, new Uri("https://api.ipify.org/?format=text")); if (UseProxy) { tempWebClient.Proxy = InitProxy(); - string proxiedIPres = WebClientExtensions.DownloadString(tempWebClient, + var proxiedIPres = WebClientExtensions.DownloadString(tempWebClient, new Uri("https://api.ipify.org/?format=text")); - string proxiedIp = proxiedIPres == null ? "INVALID PROXY" : proxiedIPres; + var proxiedIp = proxiedIPres == null ? "INVALID PROXY" : proxiedIPres; Logger.Write( $"Your IP is: {unproxiedIp} / Proxy IP is: {proxiedIp}", - LogLevel.Info, (unproxiedIp == proxiedIp) ? ConsoleColor.Red : ConsoleColor.Green); + LogLevel.Info, unproxiedIp == proxiedIp ? ConsoleColor.Red : ConsoleColor.Green); if (unproxiedIp == proxiedIp || proxiedIPres == null) { @@ -203,11 +204,11 @@ public void CheckProxy() private string RandomString(int length, string alphabet = "abcdefghijklmnopqrstuvwxyz0123456789") { - var outOfRange = Byte.MaxValue + 1 - (Byte.MaxValue + 1)%alphabet.Length; + var outOfRange = byte.MaxValue + 1 - (byte.MaxValue + 1)%alphabet.Length; return string.Concat( Enumerable - .Repeat(0, Int32.MaxValue) + .Repeat(0, int.MaxValue) .Select(e => RandomByte()) .Where(randomByte => randomByte < outOfRange) .Take(length) @@ -257,7 +258,7 @@ private WebProxy InitProxy() { if (!UseProxy) return null; - WebProxy prox = new WebProxy(new Uri($"http://{UseProxyHost}:{UseProxyPort}"), false, null); + var prox = new WebProxy(new Uri($"http://{UseProxyHost}:{UseProxyPort}"), false, null); if (UseProxyAuthentication) prox.Credentials = new NetworkCredential(UseProxyUsername, UseProxyPassword); @@ -268,153 +269,55 @@ private WebProxy InitProxy() public class GlobalSettings { + //console options + [DefaultValue(10)] public int AmountOfPokemonToDisplayOnStart; + [DefaultValue(5)] public int AmountOfTimesToUpgradeLoop; [JsonIgnore] public AuthSettings Auth = new AuthSettings(); - [JsonIgnore] public string GeneralConfigPath; - [JsonIgnore] public string ProfileConfigPath; - [JsonIgnore] public string ProfilePath; - - [JsonIgnore] public bool IsGui; - - [DefaultValue("en")] public string TranslationLanguageCode; + [DefaultValue(false)] public bool AutoFavoritePokemon; + //powerup + [DefaultValue(false)] public bool AutomaticallyLevelUpPokemon; //autoupdate [DefaultValue(true)] public bool AutoUpdate; - [DefaultValue(true)] public bool TransferConfigAndAuthOnUpdate; - //websockets - [DefaultValue(false)] public bool UseWebsocket; - [DefaultValue(14251)] public int WebSocketPort; - //pressakeyshit - [DefaultValue(false)] public bool StartupWelcomeDelay; - //Telegram - [DefaultValue(false)] public bool UseTelegramApi; - [DefaultValue(null)] public string TelegramApiKey; - - //console options - [DefaultValue(10)] public int AmountOfPokemonToDisplayOnStart; - [DefaultValue(true)] public bool DetailedCountsBeforeRecycling; - - [DefaultValue(3)] public int MaxBerriesToUsePerPokemon; //pokemon [DefaultValue(true)] public bool CatchPokemon; - //powerup - [DefaultValue(false)] public bool AutomaticallyLevelUpPokemon; - [DefaultValue(true)] public bool OnlyUpgradeFavorites; - - [DefaultValue((true))] public bool UseLevelUpList; - [DefaultValue(5)] public int AmountOfTimesToUpgradeLoop; - [DefaultValue(5000)] public int GetMinStarDustForLevelUp; - [DefaultValue("iv")] public string LevelUpByCPorIv; - [DefaultValue(1000)] public float UpgradePokemonCpMinimum; - [DefaultValue(95)] public float UpgradePokemonIvMinimum; - [DefaultValue("and")] public string UpgradePokemonMinimumStatsOperator; - //position - [DefaultValue(false)] public bool DisableHumanWalking; + [DefaultValue(90)] public int CurveThrowChance; [DefaultValue(40.785091)] public double DefaultLatitude; [DefaultValue(-73.968285)] public double DefaultLongitude; - [DefaultValue(19.0)] public double WalkingSpeedInKilometerPerHour; - [DefaultValue(2)] public double WalkingSpeedOffSetInKilometerPerHour; - [DefaultValue(true)] public bool UseWalkingSpeedVariant; - [DefaultValue(1.2)] public double WalkingSpeedVariant; - [DefaultValue(true)] public bool ShowVariantWalking; - - - public int MaxSpawnLocationOffset; - //softban related - [DefaultValue(false)] public bool FastSoftBanBypass; //delays [DefaultValue(500)] public int DelayBetweenPlayerActions; [DefaultValue(100)] public int DelayBetweenPokemonCatch; + [DefaultValue(false)] public bool DelayBetweenRecycleActions; + [DefaultValue(true)] public bool DetailedCountsBeforeRecycling; + //position + [DefaultValue(false)] public bool DisableHumanWalking; //dump stats [DefaultValue(false)] public bool DumpPokemonStats; + //customizable catch + [DefaultValue(false)] public bool EnableHumanizedThrows; //evolve [DefaultValue(95)] public float EvolveAboveIvValue; [DefaultValue(false)] public bool EvolveAllPokemonAboveIv; [DefaultValue(true)] public bool EvolveAllPokemonWithEnoughCandy; [DefaultValue(90.0)] public double EvolveKeptPokemonsAtStorageUsagePercentage; - [DefaultValue(false)] public bool KeepPokemonsThatCanEvolve; - //keeping - [DefaultValue(1250)] public int KeepMinCp; - [DefaultValue(90)] public float KeepMinIvPercentage; - [DefaultValue(6)] public int KeepMinLvl; - [DefaultValue("or")] public string KeepMinOperator; - [DefaultValue(false)] public bool UseKeepMinLvl; - [DefaultValue(false)] public bool PrioritizeIvOverCp; - [DefaultValue(0)] public int KeepMinDuplicatePokemon; - //gpx - [DefaultValue(false)] public bool UseGpxPathing; - [DefaultValue("GPXPath.GPX")] public string GpxFile; - //recycle - [DefaultValue(true)] public bool VerboseRecycling; - [DefaultValue(90.0)] public double RecycleInventoryAtUsagePercentage; - [DefaultValue(false)] public bool RandomizeRecycle; - [DefaultValue(5)] public int RandomRecycleValue; - [DefaultValue(false)] public bool DelayBetweenRecycleActions; - //lucky, incense and berries - [DefaultValue(true)] public bool UseEggIncubators; - [DefaultValue(false)] public bool UseLuckyEggConstantly; - [DefaultValue(30)] public int UseLuckyEggsMinPokemonAmount; - [DefaultValue(false)] public bool UseLuckyEggsWhileEvolving; - [DefaultValue(false)] public bool UseIncenseConstantly; - [DefaultValue(1000)] public int UseBerriesMinCp; - [DefaultValue(90)] public float UseBerriesMinIv; - [DefaultValue(0.20)] public double UseBerriesBelowCatchProbability; - [DefaultValue("or")] public string UseBerriesOperator; - //snipe - [DefaultValue(false)] public bool UseSnipeLocationServer; - [DefaultValue("localhost")] public string SnipeLocationServer; - [DefaultValue(16969)] public int SnipeLocationServerPort; - [DefaultValue(true)] public bool GetSniperInfoFromPokezz; + [DefaultValue(10)] public int ExcellentThrowChance; + //softban related + [DefaultValue(false)] public bool FastSoftBanBypass; + //favorite + [DefaultValue(95)] public float FavoriteMinIvPercentage; + [DefaultValue(1500)] public int ForceExcellentThrowOverCp; + [DefaultValue(95.00)] public double ForceExcellentThrowOverIv; + [DefaultValue(1000)] public int ForceGreatThrowOverCp; + [DefaultValue(90.00)] public double ForceGreatThrowOverIv; + [JsonIgnore] public string GeneralConfigPath; + [DefaultValue(5000)] public int GetMinStarDustForLevelUp; [DefaultValue(true)] public bool GetOnlyVerifiedSniperInfoFromPokezz; [DefaultValue(true)] public bool GetSniperInfoFromPokeSnipers; [DefaultValue(true)] public bool GetSniperInfoFromPokeWatchers; - [DefaultValue(true)] public bool SnipeWithSkiplagged; - [DefaultValue(20)] public int MinPokeballsToSnipe; - [DefaultValue(0)] public int MinPokeballsWhileSnipe; - [DefaultValue(60000)] public int MinDelayBetweenSnipes; - [DefaultValue(0.005)] public double SnipingScanOffset; - [DefaultValue(false)] public bool SnipeAtPokestops; - [DefaultValue(false)] public bool SnipeIgnoreUnknownIv; - [DefaultValue(false)] public bool UseTransferIvForSnipe; - [DefaultValue(false)] public bool SnipePokemonNotInPokedex; - //rename - [DefaultValue(false)] public bool RenamePokemon; - [DefaultValue(true)] public bool RenameOnlyAboveIv; - [DefaultValue("{1}_{0}")] public string RenameTemplate; - //amounts - [DefaultValue(6)] public int MaxPokeballsPerPokemon; - [DefaultValue(1000)] public int MaxTravelDistanceInMeters; - [DefaultValue(120)] public int TotalAmountOfPokeballsToKeep; - [DefaultValue(80)] public int TotalAmountOfPotionsToKeep; - [DefaultValue(60)] public int TotalAmountOfRevivesToKeep; - [DefaultValue(50)] public int TotalAmountOfBerriesToKeep; - //balls - [DefaultValue(1000)] public int UseGreatBallAboveCp; - [DefaultValue(1250)] public int UseUltraBallAboveCp; - [DefaultValue(1500)] public int UseMasterBallAboveCp; - [DefaultValue(85.0)] public double UseGreatBallAboveIv; - [DefaultValue(95.0)] public double UseUltraBallAboveIv; - [DefaultValue(0.2)] public double UseGreatBallBelowCatchProbability; - [DefaultValue(0.1)] public double UseUltraBallBelowCatchProbability; - [DefaultValue(0.05)] public double UseMasterBallBelowCatchProbability; - //customizable catch - [DefaultValue(false)] public bool EnableHumanizedThrows; - [DefaultValue(40)] public int NiceThrowChance; + [DefaultValue(true)] public bool GetSniperInfoFromPokezz; + [DefaultValue("GPXPath.GPX")] public string GpxFile; [DefaultValue(30)] public int GreatThrowChance; - [DefaultValue(10)] public int ExcellentThrowChance; - [DefaultValue(90)] public int CurveThrowChance; - [DefaultValue(90.00)] public double ForceGreatThrowOverIv; - [DefaultValue(95.00)] public double ForceExcellentThrowOverIv; - [DefaultValue(1000)] public int ForceGreatThrowOverCp; - [DefaultValue(1500)] public int ForceExcellentThrowOverCp; - //transfer - [DefaultValue(false)] public bool TransferWeakPokemon; - [DefaultValue(true)] public bool TransferDuplicatePokemon; - [DefaultValue(true)] public bool TransferDuplicatePokemonOnCapture; - //favorite - [DefaultValue(95)] public float FavoriteMinIvPercentage; - [DefaultValue(false)] public bool AutoFavoritePokemon; - //notcatch - [DefaultValue(false)] public bool UsePokemonToNotCatchFilter; - [DefaultValue(false)] public bool UsePokemonSniperFilterOnly; + + [JsonIgnore] public bool IsGui; public List> ItemRecycleFilter = new List> { @@ -435,6 +338,28 @@ public class GlobalSettings new KeyValuePair(ItemId.ItemItemStorageUpgrade, 100) }; + //keeping + [DefaultValue(1250)] public int KeepMinCp; + [DefaultValue(0)] public int KeepMinDuplicatePokemon; + [DefaultValue(90)] public float KeepMinIvPercentage; + [DefaultValue(6)] public int KeepMinLvl; + [DefaultValue("or")] public string KeepMinOperator; + [DefaultValue(false)] public bool KeepPokemonsThatCanEvolve; + [DefaultValue("iv")] public string LevelUpByCPorIv; + + [DefaultValue(3)] public int MaxBerriesToUsePerPokemon; + //amounts + [DefaultValue(6)] public int MaxPokeballsPerPokemon; + + + public int MaxSpawnLocationOffset; + [DefaultValue(1000)] public int MaxTravelDistanceInMeters; + [DefaultValue(60000)] public int MinDelayBetweenSnipes; + [DefaultValue(20)] public int MinPokeballsToSnipe; + [DefaultValue(0)] public int MinPokeballsWhileSnipe; + [DefaultValue(40)] public int NiceThrowChance; + [DefaultValue(true)] public bool OnlyUpgradeFavorites; + public List PokemonsNotToTransfer = new List { @@ -516,7 +441,7 @@ public class GlobalSettings //PokemonId.Staryu }; - public List PokemonsToLevelUp = new List + public List PokemonsToIgnore = new List { //criteria: most common PokemonId.Caterpie, @@ -528,7 +453,7 @@ public class GlobalSettings PokemonId.Doduo }; - public List PokemonsToIgnore = new List + public List PokemonsToLevelUp = new List { //criteria: most common PokemonId.Caterpie, @@ -645,16 +570,95 @@ public class GlobalSettings PokemonId.Mewtwo }; + [DefaultValue(false)] public bool PrioritizeIvOverCp; + [JsonIgnore] public string ProfileConfigPath; + [JsonIgnore] public string ProfilePath; + [DefaultValue(false)] public bool RandomizeRecycle; + [DefaultValue(5)] public int RandomRecycleValue; + [DefaultValue(90.0)] public double RecycleInventoryAtUsagePercentage; + [DefaultValue(true)] public bool RenameOnlyAboveIv; + //rename + [DefaultValue(false)] public bool RenamePokemon; + [DefaultValue("{1}_{0}")] public string RenameTemplate; + [DefaultValue(true)] public bool ShowVariantWalking; + [DefaultValue(false)] public bool SnipeAtPokestops; + [DefaultValue(false)] public bool SnipeIgnoreUnknownIv; + [DefaultValue("localhost")] public string SnipeLocationServer; + [DefaultValue(16969)] public int SnipeLocationServerPort; + [DefaultValue(false)] public bool SnipePokemonNotInPokedex; + [DefaultValue(true)] public bool SnipeWithSkiplagged; + [DefaultValue(0.005)] public double SnipingScanOffset; + //pressakeyshit + [DefaultValue(false)] public bool StartupWelcomeDelay; + [DefaultValue(null)] public string TelegramApiKey; + [DefaultValue(50)] public int TotalAmountOfBerriesToKeep; + [DefaultValue(120)] public int TotalAmountOfPokeballsToKeep; + [DefaultValue(80)] public int TotalAmountOfPotionsToKeep; + [DefaultValue(60)] public int TotalAmountOfRevivesToKeep; + [DefaultValue(true)] public bool TransferConfigAndAuthOnUpdate; + [DefaultValue(true)] public bool TransferDuplicatePokemon; + [DefaultValue(true)] public bool TransferDuplicatePokemonOnCapture; + //transfer + [DefaultValue(false)] public bool TransferWeakPokemon; + + [DefaultValue("en")] public string TranslationLanguageCode; + [DefaultValue(1000)] public float UpgradePokemonCpMinimum; + [DefaultValue(95)] public float UpgradePokemonIvMinimum; + [DefaultValue("and")] public string UpgradePokemonMinimumStatsOperator; + [DefaultValue(0.20)] public double UseBerriesBelowCatchProbability; + [DefaultValue(1000)] public int UseBerriesMinCp; + [DefaultValue(90)] public float UseBerriesMinIv; + [DefaultValue("or")] public string UseBerriesOperator; + //lucky, incense and berries + [DefaultValue(true)] public bool UseEggIncubators; + //gpx + [DefaultValue(false)] public bool UseGpxPathing; + //balls + [DefaultValue(1000)] public int UseGreatBallAboveCp; + [DefaultValue(85.0)] public double UseGreatBallAboveIv; + [DefaultValue(0.2)] public double UseGreatBallBelowCatchProbability; + [DefaultValue(false)] public bool UseIncenseConstantly; + [DefaultValue(false)] public bool UseKeepMinLvl; + + [DefaultValue(true)] public bool UseLevelUpList; + [DefaultValue(false)] public bool UseLuckyEggConstantly; + [DefaultValue(30)] public int UseLuckyEggsMinPokemonAmount; + [DefaultValue(false)] public bool UseLuckyEggsWhileEvolving; + [DefaultValue(1500)] public int UseMasterBallAboveCp; + [DefaultValue(0.05)] public double UseMasterBallBelowCatchProbability; + [DefaultValue(false)] public bool UsePokemonSniperFilterOnly; + //notcatch + [DefaultValue(false)] public bool UsePokemonToNotCatchFilter; + //snipe + [DefaultValue(false)] public bool UseSnipeLocationServer; + //Telegram + [DefaultValue(false)] public bool UseTelegramApi; + [DefaultValue(false)] public bool UseTransferIvForSnipe; + [DefaultValue(1250)] public int UseUltraBallAboveCp; + [DefaultValue(95.0)] public double UseUltraBallAboveIv; + [DefaultValue(0.1)] public double UseUltraBallBelowCatchProbability; + [DefaultValue(true)] public bool UseWalkingSpeedVariant; + //websockets + [DefaultValue(false)] public bool UseWebsocket; + //recycle + [DefaultValue(true)] public bool VerboseRecycling; + [DefaultValue(19.0)] public double WalkingSpeedInKilometerPerHour; + [DefaultValue(2)] public double WalkingSpeedOffSetInKilometerPerHour; + [DefaultValue(1.2)] public double WalkingSpeedVariant; + [DefaultValue(14251)] public int WebSocketPort; + public GlobalSettings() { InitializePropertyDefaultValues(this); } + public static GlobalSettings Default => new GlobalSettings(); + public void InitializePropertyDefaultValues(object obj) { - FieldInfo[] fields = obj.GetType().GetFields(); + var fields = obj.GetType().GetFields(); - foreach (FieldInfo field in fields) + foreach (var field in fields) { var d = field.GetCustomAttribute(); @@ -663,14 +667,12 @@ public void InitializePropertyDefaultValues(object obj) } } - public static GlobalSettings Default => new GlobalSettings(); - public static GlobalSettings Load(string path, bool boolSkipSave = false) { GlobalSettings settings; - bool isGui = - (AppDomain.CurrentDomain.GetAssemblies().SingleOrDefault(a => a.FullName.Contains("PoGo.NecroBot.GUI")) != - null); + var isGui = + AppDomain.CurrentDomain.GetAssemblies().SingleOrDefault(a => a.FullName.Contains("PoGo.NecroBot.GUI")) != + null; var profilePath = Path.Combine(Directory.GetCurrentDirectory(), path); var profileConfigPath = Path.Combine(profilePath, "config"); var configFile = Path.Combine(profileConfigPath, "config.json"); @@ -682,7 +684,7 @@ public static GlobalSettings Load(string path, bool boolSkipSave = false) { //if the file exists, load the settings string input; - int count = 0; + var count = 0; while (true) { try @@ -764,7 +766,7 @@ public static bool PromptForSetup(ITranslation translator) var readLine = Console.ReadLine(); if (readLine != null) { - string strInput = readLine.ToLower(); + var strInput = readLine.ToLower(); switch (strInput) { @@ -774,16 +776,17 @@ public static bool PromptForSetup(ITranslation translator) Logger.Write(translator.GetTranslation(TranslationString.FirstStartAutoGenSettings)); return false; default: - Logger.Write(translator.GetTranslation(TranslationString.PromptError, "Y", "N"), LogLevel.Error); + Logger.Write(translator.GetTranslation(TranslationString.PromptError, "Y", "N"), + LogLevel.Error); continue; } } } } - public static Session SetupSettings(Session session, GlobalSettings settings, String configPath) + public static Session SetupSettings(Session session, GlobalSettings settings, string configPath) { - Session newSession = SetupTranslationCode(session, session.Translation, settings); + var newSession = SetupTranslationCode(session, session.Translation, settings); SetupAccountType(newSession.Translation, settings); SetupUserAccount(newSession.Translation, settings); @@ -800,7 +803,7 @@ private static Session SetupTranslationCode(Session session, ITranslation transl Logger.Write(translator.GetTranslation(TranslationString.FirstStartLanguagePrompt, "Y", "N"), LogLevel.None); string strInput; - bool boolBreak = false; + var boolBreak = false; while (!boolBreak) { // ReSharper disable once PossibleNullReferenceException @@ -865,7 +868,7 @@ private static void SetupUserAccount(ITranslation translator, GlobalSettings set { Console.WriteLine(""); Logger.Write(translator.GetTranslation(TranslationString.FirstStartSetupUsernamePrompt), LogLevel.None); - string strInput = Console.ReadLine(); + var strInput = Console.ReadLine(); if (settings.Auth.AuthType == AuthType.Google) settings.Auth.GoogleUsername = strInput; @@ -891,11 +894,11 @@ private static void SetupConfig(ITranslation translator, GlobalSettings settings Logger.Write(translator.GetTranslation(TranslationString.FirstStartDefaultLocationPrompt, "Y", "N"), LogLevel.None); - bool boolBreak = false; + var boolBreak = false; while (!boolBreak) { // ReSharper disable once PossibleNullReferenceException - string strInput = Console.ReadLine().ToLower(); + var strInput = Console.ReadLine().ToLower(); switch (strInput) { @@ -919,7 +922,7 @@ private static void SetupConfig(ITranslation translator, GlobalSettings settings try { // ReSharper disable once AssignNullToNotNullAttribute - double dblInput = double.Parse(Console.ReadLine()); + var dblInput = double.Parse(Console.ReadLine()); settings.DefaultLatitude = dblInput; Logger.Write(translator.GetTranslation(TranslationString.FirstStartSetupDefaultLatConfirm, dblInput)); break; @@ -937,7 +940,7 @@ private static void SetupConfig(ITranslation translator, GlobalSettings settings try { // ReSharper disable once AssignNullToNotNullAttribute - double dblInput = double.Parse(Console.ReadLine()); + var dblInput = double.Parse(Console.ReadLine()); settings.DefaultLongitude = dblInput; Logger.Write(translator.GetTranslation(TranslationString.FirstStartSetupDefaultLongConfirm, dblInput)); break; @@ -950,7 +953,7 @@ private static void SetupConfig(ITranslation translator, GlobalSettings settings } } - private static void SaveFiles(GlobalSettings settings, String configFile) + private static void SaveFiles(GlobalSettings settings, string configFile) { settings.Save(configFile); settings.Auth.Load(Path.Combine(settings.ProfileConfigPath, "auth.json")); @@ -992,6 +995,43 @@ public ClientSettings(GlobalSettings settings) public string GoogleUsername => _settings.Auth.GoogleUsername; public string GooglePassword => _settings.Auth.GooglePassword; + double ISettings.DefaultLatitude + { + get + { + return _settings.DefaultLatitude + _rand.NextDouble()*((double) _settings.MaxSpawnLocationOffset/111111); + } + + set { _settings.DefaultLatitude = value; } + } + + double ISettings.DefaultLongitude + { + get + { + return _settings.DefaultLongitude + + _rand.NextDouble()* + ((double) _settings.MaxSpawnLocationOffset/111111/Math.Cos(_settings.DefaultLatitude)); + } + + set { _settings.DefaultLongitude = value; } + } + + double ISettings.DefaultAltitude + { + get + { + return + LocationUtils.getElevation(_settings.DefaultLatitude, _settings.DefaultLongitude) + + _rand.NextDouble()* + (5/ + Math.Cos(LocationUtils.getElevation(_settings.DefaultLatitude, _settings.DefaultLongitude))); + } + + + set { } + } + #region Auth Config Values public bool UseProxy @@ -1079,7 +1119,7 @@ string ISettings.PtcPassword #region Device Config Values - string DevicePackageName + private string DevicePackageName { get { return _settings.Auth.DevicePackageName; } set { _settings.Auth.DevicePackageName = value; } @@ -1164,43 +1204,6 @@ string ISettings.FirmwareFingerprint } #endregion Device Config Values - - double ISettings.DefaultLatitude - { - get - { - return _settings.DefaultLatitude + _rand.NextDouble()*((double) _settings.MaxSpawnLocationOffset/111111); - } - - set { _settings.DefaultLatitude = value; } - } - - double ISettings.DefaultLongitude - { - get - { - return _settings.DefaultLongitude + - _rand.NextDouble()* - ((double) _settings.MaxSpawnLocationOffset/111111/Math.Cos(_settings.DefaultLatitude)); - } - - set { _settings.DefaultLongitude = value; } - } - - double ISettings.DefaultAltitude - { - get - { - return - LocationUtils.getElevation(_settings.DefaultLatitude, _settings.DefaultLongitude) + - _rand.NextDouble()* - (5/ - Math.Cos(LocationUtils.getElevation(_settings.DefaultLatitude, _settings.DefaultLongitude))); - } - - - set { } - } } public class LogicSettings : ILogicSettings diff --git a/PokemonGo.RocketBot.Logic/State/FarmState.cs b/PokemonGo.RocketBot.Logic/State/FarmState.cs index 46a04089a..61f4686cf 100644 --- a/PokemonGo.RocketBot.Logic/State/FarmState.cs +++ b/PokemonGo.RocketBot.Logic/State/FarmState.cs @@ -12,8 +12,8 @@ public class FarmState : IState { public async Task Execute(ISession session, CancellationToken cancellationToken) { - if (session.LogicSettings.EvolveAllPokemonAboveIv || session.LogicSettings.EvolveAllPokemonWithEnoughCandy - || session.LogicSettings.UseLuckyEggsWhileEvolving || session.LogicSettings.KeepPokemonsThatCanEvolve) + if (session.LogicSettings.EvolveAllPokemonAboveIv || session.LogicSettings.EvolveAllPokemonWithEnoughCandy + || session.LogicSettings.UseLuckyEggsWhileEvolving || session.LogicSettings.KeepPokemonsThatCanEvolve) { await EvolvePokemonTask.Execute(session, cancellationToken); } @@ -69,4 +69,4 @@ public async Task Execute(ISession session, CancellationToken cancellati return this; } } -} +} \ No newline at end of file diff --git a/PokemonGo.RocketBot.Logic/State/InfoState.cs b/PokemonGo.RocketBot.Logic/State/InfoState.cs index b1fda883a..dcd12ce5f 100644 --- a/PokemonGo.RocketBot.Logic/State/InfoState.cs +++ b/PokemonGo.RocketBot.Logic/State/InfoState.cs @@ -17,4 +17,4 @@ public async Task Execute(ISession session, CancellationToken cancellati return new FarmState(); } } -} +} \ No newline at end of file diff --git a/PokemonGo.RocketBot.Logic/State/LoginState.cs b/PokemonGo.RocketBot.Logic/State/LoginState.cs index bbbdcfaa5..8feb75502 100644 --- a/PokemonGo.RocketBot.Logic/State/LoginState.cs +++ b/PokemonGo.RocketBot.Logic/State/LoginState.cs @@ -5,10 +5,10 @@ using System.Threading; using System.Threading.Tasks; using Google.Protobuf; -using PokemonGo.RocketBot.Logic.Common; -using PokemonGo.RocketBot.Logic.Event; using PokemonGo.RocketAPI.Enums; using PokemonGo.RocketAPI.Exceptions; +using PokemonGo.RocketBot.Logic.Common; +using PokemonGo.RocketBot.Logic.Event; using PokemonGo.RocketBot.Logic.Logging; #endregion @@ -128,21 +128,26 @@ public async Task Execute(ISession session, CancellationToken cancellati if (session.Profile == null) { await Task.Delay(20000, cancellationToken); - Logger.Write("Due to login failure your player profile could not be retrieved. Press any key to re-try login.", LogLevel.Warning); + Logger.Write( + "Due to login failure your player profile could not be retrieved. Press any key to re-try login.", + LogLevel.Warning); Console.ReadKey(); } - int maxTheoreticalItems = session.LogicSettings.TotalAmountOfPokeballsToKeep + - session.LogicSettings.TotalAmountOfPotionsToKeep + - session.LogicSettings.TotalAmountOfRevivesToKeep + - session.LogicSettings.TotalAmountOfBerriesToKeep; + var maxTheoreticalItems = session.LogicSettings.TotalAmountOfPokeballsToKeep + + session.LogicSettings.TotalAmountOfPotionsToKeep + + session.LogicSettings.TotalAmountOfRevivesToKeep + + session.LogicSettings.TotalAmountOfBerriesToKeep; if (maxTheoreticalItems > session.Profile.PlayerData.MaxItemStorage) { - Logger.Write(session.Translation.GetTranslation(TranslationString.MaxItemsCombinedOverMaxItemStorage, maxTheoreticalItems, session.Profile.PlayerData.MaxItemStorage), LogLevel.Error); - Logger.Write("Press any key to exit, then fix your configuration and run the bot again.", LogLevel.Warning); + Logger.Write( + session.Translation.GetTranslation(TranslationString.MaxItemsCombinedOverMaxItemStorage, + maxTheoreticalItems, session.Profile.PlayerData.MaxItemStorage), LogLevel.Error); + Logger.Write("Press any key to exit, then fix your configuration and run the bot again.", + LogLevel.Warning); Console.ReadKey(); - System.Environment.Exit(1); + Environment.Exit(1); } return new PositionCheckState(); @@ -179,15 +184,15 @@ public async Task DownloadProfile(ISession session) try { session.Profile = await session.Client.Player.GetPlayer(); - session.EventDispatcher.Send(new ProfileEvent { Profile = session.Profile }); + session.EventDispatcher.Send(new ProfileEvent {Profile = session.Profile}); } - catch (System.UriFormatException e) + catch (UriFormatException e) { - session.EventDispatcher.Send(new ErrorEvent { Message = e.ToString() }); + session.EventDispatcher.Send(new ErrorEvent {Message = e.ToString()}); } catch (Exception ex) { - session.EventDispatcher.Send(new ErrorEvent { Message = ex.ToString() }); + session.EventDispatcher.Send(new ErrorEvent {Message = ex.ToString()}); } } } diff --git a/PokemonGo.RocketBot.Logic/State/Session.cs b/PokemonGo.RocketBot.Logic/State/Session.cs index 7c94f13d6..1cca82b45 100644 --- a/PokemonGo.RocketBot.Logic/State/Session.cs +++ b/PokemonGo.RocketBot.Logic/State/Session.cs @@ -1,10 +1,10 @@ #region using directives +using PokemonGo.RocketAPI; using PokemonGo.RocketBot.Logic.Common; using PokemonGo.RocketBot.Logic.Event; -using PokemonGo.RocketAPI; -using POGOProtos.Networking.Responses; using PokemonGo.RocketBot.Logic.Service; +using POGOProtos.Networking.Responses; #endregion @@ -54,7 +54,7 @@ public Session(ISettings settings, ILogicSettings logicSettings) public void Reset(ISettings settings, ILogicSettings logicSettings) { - ApiFailureStrategy _apiStrategy = new ApiFailureStrategy(this); + var _apiStrategy = new ApiFailureStrategy(this); Client = new Client(Settings, _apiStrategy); // ferox wants us to set this manually Inventory = new Inventory(Client, logicSettings); diff --git a/PokemonGo.RocketBot.Logic/State/StateMachine.cs b/PokemonGo.RocketBot.Logic/State/StateMachine.cs index 98eecec6b..848cf99a9 100644 --- a/PokemonGo.RocketBot.Logic/State/StateMachine.cs +++ b/PokemonGo.RocketBot.Logic/State/StateMachine.cs @@ -1,11 +1,11 @@ #region using directives using System; +using System.IO; using System.Threading; using System.Threading.Tasks; -using PokemonGo.RocketBot.Logic.Event; using PokemonGo.RocketAPI.Exceptions; -using System.IO; +using PokemonGo.RocketBot.Logic.Event; using PokemonGo.RocketBot.Logic.Logging; #endregion @@ -34,7 +34,7 @@ public async Task Start(IState initialState, Session session, var profilePath = Path.Combine(Directory.GetCurrentDirectory(), ""); var profileConfigPath = Path.Combine(profilePath, "config"); - FileSystemWatcher configWatcher = new FileSystemWatcher(); + var configWatcher = new FileSystemWatcher(); configWatcher.Path = profileConfigPath; configWatcher.Filter = "config.json"; configWatcher.NotifyFilter = NotifyFilters.LastWrite; @@ -69,9 +69,12 @@ public async Task Start(IState initialState, Session session, } catch (Exception ex) { - session.EventDispatcher.Send(new ErrorEvent {Message = "Pokemon Servers might be offline / unstable. Trying again..."}); + session.EventDispatcher.Send(new ErrorEvent + { + Message = "Pokemon Servers might be offline / unstable. Trying again..." + }); Thread.Sleep(1000); - session.EventDispatcher.Send(new ErrorEvent { Message = "Error: " + ex }); + session.EventDispatcher.Send(new ErrorEvent {Message = "Error: " + ex}); state = _initialState; } } while (state != null); diff --git a/PokemonGo.RocketBot.Logic/State/VersionCheckState.cs b/PokemonGo.RocketBot.Logic/State/VersionCheckState.cs index 9d678c7f0..f443347d2 100644 --- a/PokemonGo.RocketBot.Logic/State/VersionCheckState.cs +++ b/PokemonGo.RocketBot.Logic/State/VersionCheckState.cs @@ -1,20 +1,7 @@ #region using directives -using System; -using System.Diagnostics; -using System.IO; -using System.IO.Compression; -using System.Net; -using System.Reflection; -using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; -using Newtonsoft.Json.Linq; -using PokemonGo.RocketBot.Logic.Common; -using PokemonGo.RocketBot.Logic.Event; -using PokemonGo.RocketBot.Logic.Logging; -using System.Collections.Generic; -using PokemonGo.RocketBot.Logic.Utils; #endregion @@ -27,6 +14,5 @@ public async Task Execute(ISession session, CancellationToken cancellati { return new LoginState(); } - } } \ No newline at end of file diff --git a/PokemonGo.RocketBot.Logic/Tasks/CatchIncensePokemonsTask.cs b/PokemonGo.RocketBot.Logic/Tasks/CatchIncensePokemonsTask.cs index a8ab0153c..e0a6114db 100644 --- a/PokemonGo.RocketBot.Logic/Tasks/CatchIncensePokemonsTask.cs +++ b/PokemonGo.RocketBot.Logic/Tasks/CatchIncensePokemonsTask.cs @@ -1,5 +1,6 @@ #region using directives +using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using PokemonGo.RocketBot.Logic.Common; @@ -9,7 +10,6 @@ using PokemonGo.RocketBot.Logic.Utils; using POGOProtos.Map.Pokemon; using POGOProtos.Networking.Responses; -using System.Collections.Generic; #endregion @@ -39,9 +39,11 @@ public static async Task Execute(ISession session, CancellationToken cancellatio SpawnPointId = incensePokemon.EncounterLocation }; - OnPokemonEncounterEvent(new List { pokemon }); - if ((session.LogicSettings.UsePokemonSniperFilterOnly && !session.LogicSettings.PokemonToSnipe.Pokemon.Contains(pokemon.PokemonId)) || - (session.LogicSettings.UsePokemonToNotCatchFilter && session.LogicSettings.PokemonsNotToCatch.Contains(pokemon.PokemonId))) + OnPokemonEncounterEvent(new List {pokemon}); + if ((session.LogicSettings.UsePokemonSniperFilterOnly && + !session.LogicSettings.PokemonToSnipe.Pokemon.Contains(pokemon.PokemonId)) || + (session.LogicSettings.UsePokemonToNotCatchFilter && + session.LogicSettings.PokemonsNotToCatch.Contains(pokemon.PokemonId))) { Logger.Write(session.Translation.GetTranslation(TranslationString.PokemonIgnoreFilter, session.Translation.GetPokemonTranslation(pokemon.PokemonId))); @@ -54,10 +56,11 @@ public static async Task Execute(ISession session, CancellationToken cancellatio var encounter = await - session.Client.Encounter.EncounterIncensePokemon((ulong)pokemon.EncounterId, + session.Client.Encounter.EncounterIncensePokemon(pokemon.EncounterId, pokemon.SpawnPointId); - if (encounter.Result == IncenseEncounterResponse.Types.Result.IncenseEncounterSuccess && session.LogicSettings.CatchPokemon) + if (encounter.Result == IncenseEncounterResponse.Types.Result.IncenseEncounterSuccess && + session.LogicSettings.CatchPokemon) { await CatchPokemonTask.Execute(session, cancellationToken, encounter, pokemon); } @@ -96,5 +99,4 @@ private static void OnPokemonEncounterEvent(List pokemons) PokemonEncounterEvent?.Invoke(pokemons); } } - } \ No newline at end of file diff --git a/PokemonGo.RocketBot.Logic/Tasks/CatchLurePokemonsTask.cs b/PokemonGo.RocketBot.Logic/Tasks/CatchLurePokemonsTask.cs index a25880389..8928b5903 100644 --- a/PokemonGo.RocketBot.Logic/Tasks/CatchLurePokemonsTask.cs +++ b/PokemonGo.RocketBot.Logic/Tasks/CatchLurePokemonsTask.cs @@ -8,7 +8,6 @@ using PokemonGo.RocketBot.Logic.State; using POGOProtos.Map.Fort; using POGOProtos.Networking.Responses; -using POGOProtos.Map.Pokemon; #endregion @@ -26,9 +25,11 @@ public static async Task Execute(ISession session, FortData currentFortData, Can var fortId = currentFortData.Id; var pokemonId = currentFortData.LureInfo.ActivePokemonId; - - if ( ( session.LogicSettings.UsePokemonSniperFilterOnly && !session.LogicSettings.PokemonToSnipe.Pokemon.Contains( pokemonId ) ) || - ( session.LogicSettings.UsePokemonToNotCatchFilter && session.LogicSettings.PokemonsNotToCatch.Contains( pokemonId ) ) ) + + if ((session.LogicSettings.UsePokemonSniperFilterOnly && + !session.LogicSettings.PokemonToSnipe.Pokemon.Contains(pokemonId)) || + (session.LogicSettings.UsePokemonToNotCatchFilter && + session.LogicSettings.PokemonsNotToCatch.Contains(pokemonId))) { session.EventDispatcher.Send(new NoticeEvent { @@ -42,7 +43,9 @@ public static async Task Execute(ISession session, FortData currentFortData, Can if (encounter.Result == DiskEncounterResponse.Types.Result.Success && session.LogicSettings.CatchPokemon) { - await CatchPokemonTask.Execute(session, cancellationToken, encounter, null, currentFortData, encounterId); + await + CatchPokemonTask.Execute(session, cancellationToken, encounter, null, currentFortData, + encounterId); } else if (encounter.Result == DiskEncounterResponse.Types.Result.PokemonInventoryFull) { diff --git a/PokemonGo.RocketBot.Logic/Tasks/CatchNearbyPokemonsTask.cs b/PokemonGo.RocketBot.Logic/Tasks/CatchNearbyPokemonsTask.cs index eda5c2fff..758854090 100644 --- a/PokemonGo.RocketBot.Logic/Tasks/CatchNearbyPokemonsTask.cs +++ b/PokemonGo.RocketBot.Logic/Tasks/CatchNearbyPokemonsTask.cs @@ -1,5 +1,6 @@ #region using directives +using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -11,7 +12,6 @@ using POGOProtos.Inventory.Item; using POGOProtos.Map.Pokemon; using POGOProtos.Networking.Responses; -using System.Collections.Generic; #endregion @@ -53,10 +53,13 @@ public static async Task Execute(ISession session, CancellationToken cancellatio return; } - if ((session.LogicSettings.UsePokemonSniperFilterOnly && !session.LogicSettings.PokemonToSnipe.Pokemon.Contains(pokemon.PokemonId)) || - (session.LogicSettings.UsePokemonToNotCatchFilter && session.LogicSettings.PokemonsNotToCatch.Contains(pokemon.PokemonId))) + if ((session.LogicSettings.UsePokemonSniperFilterOnly && + !session.LogicSettings.PokemonToSnipe.Pokemon.Contains(pokemon.PokemonId)) || + (session.LogicSettings.UsePokemonToNotCatchFilter && + session.LogicSettings.PokemonsNotToCatch.Contains(pokemon.PokemonId))) { - Logger.Write(session.Translation.GetTranslation(TranslationString.PokemonSkipped, session.Translation.GetPokemonTranslation(pokemon.PokemonId))); + Logger.Write(session.Translation.GetTranslation(TranslationString.PokemonSkipped, + session.Translation.GetPokemonTranslation(pokemon.PokemonId))); continue; } @@ -67,7 +70,8 @@ public static async Task Execute(ISession session, CancellationToken cancellatio var encounter = await session.Client.Encounter.EncounterPokemon(pokemon.EncounterId, pokemon.SpawnPointId); - if (encounter.Status == EncounterResponse.Types.Status.EncounterSuccess && session.LogicSettings.CatchPokemon) + if (encounter.Status == EncounterResponse.Types.Status.EncounterSuccess && + session.LogicSettings.CatchPokemon) { await CatchPokemonTask.Execute(session, cancellationToken, encounter, pokemon); } diff --git a/PokemonGo.RocketBot.Logic/Tasks/CatchPokemonTask.cs b/PokemonGo.RocketBot.Logic/Tasks/CatchPokemonTask.cs index f29047ab8..f12e74107 100644 --- a/PokemonGo.RocketBot.Logic/Tasks/CatchPokemonTask.cs +++ b/PokemonGo.RocketBot.Logic/Tasks/CatchPokemonTask.cs @@ -2,9 +2,11 @@ using System; using System.Linq; +using System.Threading; using System.Threading.Tasks; using PokemonGo.RocketBot.Logic.Common; using PokemonGo.RocketBot.Logic.Event; +using PokemonGo.RocketBot.Logic.Logging; using PokemonGo.RocketBot.Logic.PoGoUtils; using PokemonGo.RocketBot.Logic.State; using PokemonGo.RocketBot.Logic.Utils; @@ -12,8 +14,6 @@ using POGOProtos.Map.Fort; using POGOProtos.Map.Pokemon; using POGOProtos.Networking.Responses; -using System.Threading; -using PokemonGo.RocketBot.Logic.Logging; #endregion @@ -22,9 +22,10 @@ namespace PokemonGo.RocketBot.Logic.Tasks public static class CatchPokemonTask { public static int AmountOfBerries; - private static Random Random => new Random((int)DateTime.Now.Ticks); + private static Random Random => new Random((int) DateTime.Now.Ticks); - public static async Task Execute(ISession session, CancellationToken cancellationToken, dynamic encounter, MapPokemon pokemon, + public static async Task Execute(ISession session, CancellationToken cancellationToken, dynamic encounter, + MapPokemon pokemon, FortData currentFortData = null, ulong encounterId = 0) { AmountOfBerries = 0; @@ -40,12 +41,12 @@ public static async Task Execute(ISession session, CancellationToken cancellatio if (pokeball == ItemId.ItemUnknown) return; //Calculate CP and IV - var pokemonCp = (encounter is EncounterResponse - ? encounter.WildPokemon?.PokemonData?.Cp - : encounter.PokemonData?.Cp); + var pokemonCp = encounter is EncounterResponse + ? encounter.WildPokemon?.PokemonData?.Cp + : encounter.PokemonData?.Cp; var pokemonIv = PokemonInfo.CalculatePokemonPerfection(encounter is EncounterResponse - ? encounter.WildPokemon?.PokemonData - : encounter?.PokemonData); + ? encounter.WildPokemon?.PokemonData + : encounter?.PokemonData); // Calculate distance away var distance = LocationUtils.CalculateDistanceInMeters(session.Client.CurrentLatitude, @@ -61,8 +62,8 @@ encounter is EncounterResponse || encounter is IncenseEncounterResponse var attemptCounter = 1; do { - if ((session.LogicSettings.MaxPokeballsPerPokemon > 0 && - attemptCounter > session.LogicSettings.MaxPokeballsPerPokemon)) + if (session.LogicSettings.MaxPokeballsPerPokemon > 0 && + attemptCounter > session.LogicSettings.MaxPokeballsPerPokemon) break; pokeball = await GetBestBall(session, encounter, probability); @@ -81,28 +82,26 @@ encounter is EncounterResponse || encounter is IncenseEncounterResponse // Determine whether to use berries or not if ((session.LogicSettings.UseBerriesOperator.ToLower().Equals("and") && - pokemonIv >= session.LogicSettings.UseBerriesMinIv && - pokemonCp >= session.LogicSettings.UseBerriesMinCp && - probability < session.LogicSettings.UseBerriesBelowCatchProbability) || + pokemonIv >= session.LogicSettings.UseBerriesMinIv && + pokemonCp >= session.LogicSettings.UseBerriesMinCp && + probability < session.LogicSettings.UseBerriesBelowCatchProbability) || (session.LogicSettings.UseBerriesOperator.ToLower().Equals("or") && ( pokemonIv >= session.LogicSettings.UseBerriesMinIv || pokemonCp >= session.LogicSettings.UseBerriesMinCp || probability < session.LogicSettings.UseBerriesBelowCatchProbability))) { - AmountOfBerries++; if (AmountOfBerries <= session.LogicSettings.MaxBerriesToUsePerPokemon) { await - UseBerry(session, - encounter is EncounterResponse || encounter is IncenseEncounterResponse - ? pokemon.EncounterId - : encounterId, - encounter is EncounterResponse || encounter is IncenseEncounterResponse - ? pokemon.SpawnPointId - : currentFortData?.Id); + UseBerry(session, + encounter is EncounterResponse || encounter is IncenseEncounterResponse + ? pokemon.EncounterId + : encounterId, + encounter is EncounterResponse || encounter is IncenseEncounterResponse + ? pokemon.SpawnPointId + : currentFortData?.Id); } - } //default to excellent throw @@ -119,12 +118,12 @@ encounter is EncounterResponse || encounter is IncenseEncounterResponse if (pokemonCp > session.LogicSettings.ForceExcellentThrowOverCp || pokemonIv > session.LogicSettings.ForceExcellentThrowOverIv) { - normalizedRecticleSize = Random.NextDouble() * (1.95 - 1.7) + 1.7; + normalizedRecticleSize = Random.NextDouble()*(1.95 - 1.7) + 1.7; } else if (pokemonCp >= session.LogicSettings.ForceGreatThrowOverCp || pokemonIv >= session.LogicSettings.ForceGreatThrowOverIv) { - normalizedRecticleSize = Random.NextDouble() * (1.95 - 1.3) + 1.3; + normalizedRecticleSize = Random.NextDouble()*(1.95 - 1.3) + 1.3; hitTxt = "Great"; } else @@ -136,23 +135,23 @@ encounter is EncounterResponse || encounter is IncenseEncounterResponse if (rnd <= regularThrow) { - normalizedRecticleSize = Random.NextDouble() * (1 - 0.1) + 0.1; + normalizedRecticleSize = Random.NextDouble()*(1 - 0.1) + 0.1; hitTxt = "Ordinary"; } else if (rnd <= regularThrow + session.LogicSettings.NiceThrowChance) { - normalizedRecticleSize = Random.NextDouble() * (1.3 - 1) + 1; + normalizedRecticleSize = Random.NextDouble()*(1.3 - 1) + 1; hitTxt = "Nice"; } else if (rnd <= regularThrow + session.LogicSettings.NiceThrowChance + session.LogicSettings.GreatThrowChance) { - normalizedRecticleSize = Random.NextDouble() * (1.7 - 1.3) + 1.3; + normalizedRecticleSize = Random.NextDouble()*(1.7 - 1.3) + 1.3; hitTxt = "Great"; } - if (Random.NextDouble() * 100 > session.LogicSettings.CurveThrowChance) + if (Random.NextDouble()*100 > session.LogicSettings.CurveThrowChance) { spinModifier = 0.0; spinTxt = "Straight"; @@ -175,10 +174,12 @@ encounter is EncounterResponse || encounter is IncenseEncounterResponse : currentFortData.Id, pokeball, normalizedRecticleSize, spinModifier); var lat = encounter is EncounterResponse || encounter is IncenseEncounterResponse - ? pokemon.Latitude : currentFortData.Latitude; + ? pokemon.Latitude + : currentFortData.Latitude; var lng = encounter is EncounterResponse || encounter is IncenseEncounterResponse - ? pokemon.Longitude : currentFortData.Longitude; - var evt = new PokemonCaptureEvent() + ? pokemon.Longitude + : currentFortData.Longitude; + var evt = new PokemonCaptureEvent { Status = caughtPokemonResponse.Status, Latitude = lat, @@ -216,7 +217,8 @@ encounter is EncounterResponse || encounter is IncenseEncounterResponse evt.FamilyCandies = caughtPokemonResponse.CaptureAward.Candy.Sum(); } - if (session.LogicSettings.TransferDuplicatePokemonOnCapture && session.LogicSettings.TransferDuplicatePokemon) + if (session.LogicSettings.TransferDuplicatePokemonOnCapture && + session.LogicSettings.TransferDuplicatePokemon) await TransferDuplicatePokemonTask.Execute(session, cancellationToken); } @@ -243,7 +245,7 @@ encounter is EncounterResponse || encounter is IncenseEncounterResponse ? encounter.WildPokemon?.PokemonData : encounter?.PokemonData)); evt.Probability = - Math.Round(probability * 100, 2); + Math.Round(probability*100, 2); evt.Distance = distance; evt.Pokeball = pokeball; evt.Attempt = attemptCounter; @@ -279,22 +281,22 @@ private static async Task GetBestBall(ISession session, dynamic encounte var masterBallsCount = await session.Inventory.GetItemAmountByType(ItemId.ItemMasterBall); if (masterBallsCount > 0 && ( - (!session.LogicSettings.PokemonToUseMasterball.Any() && ( - pokemonCp >= session.LogicSettings.UseMasterBallAboveCp || - probability < session.LogicSettings.UseMasterBallBelowCatchProbability)) || - session.LogicSettings.PokemonToUseMasterball.Contains(pokemonId))) + (!session.LogicSettings.PokemonToUseMasterball.Any() && ( + pokemonCp >= session.LogicSettings.UseMasterBallAboveCp || + probability < session.LogicSettings.UseMasterBallBelowCatchProbability)) || + session.LogicSettings.PokemonToUseMasterball.Contains(pokemonId))) return ItemId.ItemMasterBall; if (ultraBallsCount > 0 && ( - pokemonCp >= session.LogicSettings.UseUltraBallAboveCp || - iV >= session.LogicSettings.UseUltraBallAboveIv || - probability < session.LogicSettings.UseUltraBallBelowCatchProbability)) + pokemonCp >= session.LogicSettings.UseUltraBallAboveCp || + iV >= session.LogicSettings.UseUltraBallAboveIv || + probability < session.LogicSettings.UseUltraBallBelowCatchProbability)) return ItemId.ItemUltraBall; if (greatBallsCount > 0 && ( - pokemonCp >= session.LogicSettings.UseGreatBallAboveCp || - iV >= session.LogicSettings.UseGreatBallAboveIv || - probability < session.LogicSettings.UseGreatBallBelowCatchProbability)) + pokemonCp >= session.LogicSettings.UseGreatBallAboveCp || + iV >= session.LogicSettings.UseGreatBallAboveIv || + probability < session.LogicSettings.UseGreatBallBelowCatchProbability)) return ItemId.ItemGreatBall; if (pokeBallsCount > 0) @@ -320,7 +322,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 { BerryType = ItemId.ItemRazzBerry, Count = berry.Count }); + session.EventDispatcher.Send(new UseBerryEvent {BerryType = ItemId.ItemRazzBerry, Count = berry.Count}); } } } \ No newline at end of file diff --git a/PokemonGo.RocketBot.Logic/Tasks/DisplayPokemonStatsTask.cs b/PokemonGo.RocketBot.Logic/Tasks/DisplayPokemonStatsTask.cs index cb5fbd3a8..5c077f623 100644 --- a/PokemonGo.RocketBot.Logic/Tasks/DisplayPokemonStatsTask.cs +++ b/PokemonGo.RocketBot.Logic/Tasks/DisplayPokemonStatsTask.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Threading.Tasks; using PokemonGo.RocketBot.Logic.DataDumper; @@ -69,7 +70,9 @@ public static async Task Execute(ISession session) try { 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); + 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) { Dumper.Dump(session, @@ -77,9 +80,9 @@ public static async Task Execute(ISession session) dumpFileName); } } - catch (System.IO.IOException) + catch (IOException) { - session.EventDispatcher.Send(new ErrorEvent { Message = $"Could not write {dumpFileName} dump file." }); + session.EventDispatcher.Send(new ErrorEvent {Message = $"Could not write {dumpFileName} dump file."}); } } } diff --git a/PokemonGo.RocketBot.Logic/Tasks/EggsListTask.cs b/PokemonGo.RocketBot.Logic/Tasks/EggsListTask.cs index 9e3e9afad..e9ea6101c 100644 --- a/PokemonGo.RocketBot.Logic/Tasks/EggsListTask.cs +++ b/PokemonGo.RocketBot.Logic/Tasks/EggsListTask.cs @@ -4,8 +4,8 @@ using System.Threading.Tasks; using PokemonGo.RocketBot.Logic.Event; using PokemonGo.RocketBot.Logic.State; -using POGOProtos.Inventory.Item; using PokemonGo.RocketBot.Logic.Utils; +using POGOProtos.Inventory.Item; #endregion diff --git a/PokemonGo.RocketBot.Logic/Tasks/EvolvePokemonTask.cs b/PokemonGo.RocketBot.Logic/Tasks/EvolvePokemonTask.cs index d3480e0a1..7f36ca8c9 100644 --- a/PokemonGo.RocketBot.Logic/Tasks/EvolvePokemonTask.cs +++ b/PokemonGo.RocketBot.Logic/Tasks/EvolvePokemonTask.cs @@ -1,16 +1,16 @@ #region using directives using System; +using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; +using PokemonGo.RocketBot.Logic.Common; using PokemonGo.RocketBot.Logic.Event; using PokemonGo.RocketBot.Logic.State; using PokemonGo.RocketBot.Logic.Utils; -using POGOProtos.Inventory.Item; -using PokemonGo.RocketBot.Logic.Common; -using System.Collections.Generic; using POGOProtos.Data; +using POGOProtos.Inventory.Item; #endregion @@ -42,7 +42,9 @@ public static async Task Execute(ISession session, CancellationToken cancellatio var totalPokemon = await session.Inventory.GetPokemons(); var totalEggs = await session.Inventory.GetEggs(); - var pokemonNeededInInventory = (maxStorage - totalEggs.Count()) * session.LogicSettings.EvolveKeptPokemonsAtStorageUsagePercentage / 100.0f; + var pokemonNeededInInventory = (maxStorage - totalEggs.Count())* + session.LogicSettings.EvolveKeptPokemonsAtStorageUsagePercentage/ + 100.0f; var needPokemonToStartEvolve = Math.Round( Math.Max(0, Math.Min(pokemonNeededInInventory, session.Profile.PlayerData.MaxPokemonStorage))); @@ -54,8 +56,10 @@ public static async Task Execute(ISession session, CancellationToken cancellatio { session.EventDispatcher.Send(new WarnEvent { - Message = session.Translation.GetTranslation(TranslationString.UseLuckyEggsMinPokemonAmountTooHigh, - luckyEggMin, maxStorage) + Message = + session.Translation.GetTranslation( + TranslationString.UseLuckyEggsMinPokemonAmountTooHigh, + luckyEggMin, maxStorage) }); return; } @@ -63,12 +67,13 @@ public static async Task Execute(ISession session, CancellationToken cancellatio if (deltaCount > 0) { - session.EventDispatcher.Send(new UpdateEvent() + session.EventDispatcher.Send(new UpdateEvent { - Message = session.Translation.GetTranslation(TranslationString.WaitingForMorePokemonToEvolve, - pokemonToEvolve.Count, deltaCount, totalPokemon.Count(), needPokemonToStartEvolve, session.LogicSettings.EvolveKeptPokemonsAtStorageUsagePercentage) + Message = + session.Translation.GetTranslation(TranslationString.WaitingForMorePokemonToEvolve, + pokemonToEvolve.Count, deltaCount, totalPokemon.Count(), needPokemonToStartEvolve, + session.LogicSettings.EvolveKeptPokemonsAtStorageUsagePercentage) }); - return; } else { @@ -79,7 +84,8 @@ public static async Task Execute(ISession session, CancellationToken cancellatio await evolve(session, pokemonToEvolve); } } - else if (session.LogicSettings.EvolveAllPokemonWithEnoughCandy || session.LogicSettings.EvolveAllPokemonAboveIv) + else if (session.LogicSettings.EvolveAllPokemonWithEnoughCandy || + session.LogicSettings.EvolveAllPokemonAboveIv) { if (await shouldUseLuckyEgg(session, pokemonToEvolve)) { @@ -103,7 +109,7 @@ public static async Task UseLuckyEgg(ISession session) _lastLuckyEggTime = DateTime.Now; await session.Client.Inventory.UseItemXpBoost(); await session.Inventory.RefreshCachedInventory(); - if (luckyEgg != null) session.EventDispatcher.Send(new UseLuckyEggEvent { Count = luckyEgg.Count }); + if (luckyEgg != null) session.EventDispatcher.Send(new UseLuckyEggEvent {Count = luckyEgg.Count}); DelayingUtils.Delay(session.LogicSettings.DelayBetweenPlayerActions, 0); } @@ -127,7 +133,7 @@ private static async Task evolve(ISession session, List pokemonToEv } } - private static async Task shouldUseLuckyEgg(ISession session, List pokemonToEvolve) + private static async Task shouldUseLuckyEgg(ISession session, List pokemonToEvolve) { var inventoryContent = await session.Inventory.GetItems(); @@ -140,36 +146,34 @@ private static async Task shouldUseLuckyEgg(ISession session, List availableSpace) - { - var possibleLimitInThisIteration = pokemonToEvolve.Count + availableSpace; + if (deltaPokemonToUseLuckyEgg > availableSpace) + { + var possibleLimitInThisIteration = pokemonToEvolve.Count + availableSpace; - session.EventDispatcher.Send(new NoticeEvent() - { - Message = session.Translation.GetTranslation(TranslationString.UseLuckyEggsMinPokemonAmountTooHigh, + session.EventDispatcher.Send(new NoticeEvent + { + Message = + session.Translation.GetTranslation(TranslationString.UseLuckyEggsMinPokemonAmountTooHigh, session.LogicSettings.UseLuckyEggsMinPokemonAmount, possibleLimitInThisIteration) - }); - } - else + }); + } + else + { + session.EventDispatcher.Send(new NoticeEvent { - session.EventDispatcher.Send(new NoticeEvent() - { - Message = session.Translation.GetTranslation(TranslationString.CatchMorePokemonToUseLuckyEgg, - deltaPokemonToUseLuckyEgg) - }); - } + Message = session.Translation.GetTranslation(TranslationString.CatchMorePokemonToUseLuckyEgg, + deltaPokemonToUseLuckyEgg) + }); } } return false; } } -} +} \ No newline at end of file diff --git a/PokemonGo.RocketBot.Logic/Tasks/EvolveSpecificPokemonTask.cs b/PokemonGo.RocketBot.Logic/Tasks/EvolveSpecificPokemonTask.cs index 03d5c8b1e..e101684a9 100644 --- a/PokemonGo.RocketBot.Logic/Tasks/EvolveSpecificPokemonTask.cs +++ b/PokemonGo.RocketBot.Logic/Tasks/EvolveSpecificPokemonTask.cs @@ -1,14 +1,10 @@ #region using directives using System.Linq; -using System.Threading; using System.Threading.Tasks; using PokemonGo.RocketBot.Logic.Event; -using PokemonGo.RocketBot.Logic.PoGoUtils; using PokemonGo.RocketBot.Logic.State; using PokemonGo.RocketBot.Logic.Utils; -using PokemonGo.RocketBot.Logic.Logging; -using PokemonGo.RocketBot.Logic.Common; #endregion diff --git a/PokemonGo.RocketBot.Logic/Tasks/Farm.cs b/PokemonGo.RocketBot.Logic/Tasks/Farm.cs index 3af5302bc..d04d25702 100644 --- a/PokemonGo.RocketBot.Logic/Tasks/Farm.cs +++ b/PokemonGo.RocketBot.Logic/Tasks/Farm.cs @@ -23,7 +23,7 @@ public Farm(ISession session) public void Run(CancellationToken cancellationToken) { - if (_session.LogicSettings.EvolveAllPokemonAboveIv || _session.LogicSettings.EvolveAllPokemonWithEnoughCandy + if (_session.LogicSettings.EvolveAllPokemonAboveIv || _session.LogicSettings.EvolveAllPokemonWithEnoughCandy || _session.LogicSettings.UseLuckyEggsWhileEvolving || _session.LogicSettings.KeepPokemonsThatCanEvolve) { EvolvePokemonTask.Execute(_session, cancellationToken).Wait(cancellationToken); diff --git a/PokemonGo.RocketBot.Logic/Tasks/FarmPokestopsGPXTask.cs b/PokemonGo.RocketBot.Logic/Tasks/FarmPokestopsGPXTask.cs index 98aa27031..74b1580c7 100644 --- a/PokemonGo.RocketBot.Logic/Tasks/FarmPokestopsGPXTask.cs +++ b/PokemonGo.RocketBot.Logic/Tasks/FarmPokestopsGPXTask.cs @@ -7,11 +7,11 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; +using PokemonGo.RocketAPI.Extensions; using PokemonGo.RocketBot.Logic.Common; using PokemonGo.RocketBot.Logic.Event; using PokemonGo.RocketBot.Logic.State; using PokemonGo.RocketBot.Logic.Utils; -using PokemonGo.RocketAPI.Extensions; using POGOProtos.Map.Fort; #endregion @@ -120,7 +120,7 @@ public static async Task Execute(ISession session, CancellationToken cancellatio await RecycleItemsTask.Execute(session, cancellationToken); if (session.LogicSettings.EvolveAllPokemonWithEnoughCandy || - session.LogicSettings.EvolveAllPokemonAboveIv || + session.LogicSettings.EvolveAllPokemonAboveIv || session.LogicSettings.UseLuckyEggsWhileEvolving || session.LogicSettings.KeepPokemonsThatCanEvolve) { @@ -196,7 +196,7 @@ await session.Navigation.HumanPathWalking( //so do not make it more than 40 because it will never get close to those stops. private static async Task> GetPokeStops(ISession session) { - var mapObjects = await session.Client.Map.GetMapObjects(); + var mapObjects = await session.Client.Map.GetMapObjects(); // Wasn't sure how to make this pretty. Edit as needed. var pokeStops = mapObjects.Item1.MapCells.SelectMany(i => i.Forts) diff --git a/PokemonGo.RocketBot.Logic/Tasks/FarmPokestopsTask.cs b/PokemonGo.RocketBot.Logic/Tasks/FarmPokestopsTask.cs index 1c1a83232..19ad55adb 100644 --- a/PokemonGo.RocketBot.Logic/Tasks/FarmPokestopsTask.cs +++ b/PokemonGo.RocketBot.Logic/Tasks/FarmPokestopsTask.cs @@ -6,12 +6,12 @@ using System.Threading; using System.Threading.Tasks; using GeoCoordinatePortable; +using PokemonGo.RocketAPI.Extensions; using PokemonGo.RocketBot.Logic.Common; using PokemonGo.RocketBot.Logic.Event; using PokemonGo.RocketBot.Logic.Logging; using PokemonGo.RocketBot.Logic.State; using PokemonGo.RocketBot.Logic.Utils; -using PokemonGo.RocketAPI.Extensions; using POGOProtos.Map.Fort; using POGOProtos.Networking.Responses; @@ -21,11 +21,11 @@ namespace PokemonGo.RocketBot.Logic.Tasks { public static class FarmPokestopsTask { + public delegate void LootPokestopDelegate(FortData pokestop); + public static int TimesZeroXPawarded; private static int _storeRi; - public delegate void LootPokestopDelegate(FortData pokestop); - public static async Task Execute(ISession session, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); @@ -46,7 +46,7 @@ await session.Navigation.Move(new GeoCoordinate( session.Settings.DefaultLatitude, session.Settings.DefaultLongitude, LocationUtils.getElevation(session.Settings.DefaultLatitude, - session.Settings.DefaultLongitude)), + session.Settings.DefaultLongitude)), null, session, cancellationToken); @@ -55,7 +55,8 @@ await session.Navigation.Move(new GeoCoordinate( var pokestopList = await GetPokeStops(session); //get optimized route - var pokeStops = RouteOptimizeUtil.Optimize(pokestopList.ToArray(), session.Client.CurrentLatitude, session.Client.CurrentLongitude); + var pokeStops = RouteOptimizeUtil.Optimize(pokestopList.ToArray(), session.Client.CurrentLatitude, + session.Client.CurrentLongitude); var stopsHit = 0; var rc = new Random(); //initialize pokestop random cleanup counter first time @@ -70,7 +71,7 @@ await session.Navigation.Move(new GeoCoordinate( }); } - session.EventDispatcher.Send(new PokeStopListEvent { Forts = pokestopList }); + session.EventDispatcher.Send(new PokeStopListEvent {Forts = pokestopList}); foreach (var pokeStop in pokeStops) { @@ -80,10 +81,10 @@ await session.Navigation.Move(new GeoCoordinate( session.Client.CurrentLongitude, pokeStop.Latitude, pokeStop.Longitude); var fortInfo = await session.Client.Fort.GetFort(pokeStop.Id, pokeStop.Latitude, pokeStop.Longitude); - session.EventDispatcher.Send(new FortTargetEvent { Name = fortInfo.Name, Distance = distance }); + session.EventDispatcher.Send(new FortTargetEvent {Name = fortInfo.Name, Distance = distance}); await session.Navigation.Move(new GeoCoordinate(pokeStop.Latitude, pokeStop.Longitude, - LocationUtils.getElevation(pokeStop.Latitude, pokeStop.Longitude)), + LocationUtils.getElevation(pokeStop.Latitude, pokeStop.Longitude)), async () => { // Catch normal map Pokemon @@ -119,9 +120,10 @@ await session.Navigation.Move(new GeoCoordinate(pokeStop.Latitude, pokeStop.Long if (timesZeroXPawarded > zeroCheck) { - if ((int)fortSearch.CooldownCompleteTimestampMs != 0) + if ((int) fortSearch.CooldownCompleteTimestampMs != 0) { - break; // Check if successfully looted, if so program can continue as this was "false alarm". + break; + // Check if successfully looted, if so program can continue as this was "false alarm". } fortTry += 1; @@ -176,7 +178,8 @@ await session.Navigation.Move(new GeoCoordinate(pokeStop.Latitude, pokeStop.Long await eggWalker.ApplyDistance(distance, cancellationToken); - if (++stopsHit >= _storeRi) //TODO: OR item/pokemon bag is full //check stopsHit against storeRI random without dividing. + if (++stopsHit >= _storeRi) + //TODO: OR item/pokemon bag is full //check stopsHit against storeRI random without dividing. { _storeRi = rc.Next(6, 12); //set new storeRI for new random value stopsHit = 0; @@ -237,7 +240,7 @@ private static async Task> GetPokeStops(ISession session) LocationUtils.CalculateDistanceInMeters( session.Settings.DefaultLatitude, session.Settings.DefaultLongitude, i.Latitude, i.Longitude) < session.LogicSettings.MaxTravelDistanceInMeters || - session.LogicSettings.MaxTravelDistanceInMeters == 0) + session.LogicSettings.MaxTravelDistanceInMeters == 0) ); return pokeStops.ToList(); @@ -250,4 +253,4 @@ private static void OnLootPokestopEvent(FortData pokestop) public static event LootPokestopDelegate LootPokestopEvent; } -} +} \ No newline at end of file diff --git a/PokemonGo.RocketBot.Logic/Tasks/FavoritePokemonTask.cs b/PokemonGo.RocketBot.Logic/Tasks/FavoritePokemonTask.cs index 68f63cced..ea0172b41 100644 --- a/PokemonGo.RocketBot.Logic/Tasks/FavoritePokemonTask.cs +++ b/PokemonGo.RocketBot.Logic/Tasks/FavoritePokemonTask.cs @@ -26,14 +26,16 @@ public static async Task Execute(ISession session, CancellationToken cancellatio var perfection = Math.Round(PokemonInfo.CalculatePokemonPerfection(pokemon)); - if (session.LogicSettings.AutoFavoritePokemon && perfection >= session.LogicSettings.FavoriteMinIvPercentage && pokemon.Favorite!=1) + if (session.LogicSettings.AutoFavoritePokemon && + perfection >= session.LogicSettings.FavoriteMinIvPercentage && pokemon.Favorite != 1) { await session.Client.Inventory.SetFavoritePokemon(pokemon.Id, true); session.EventDispatcher.Send(new NoticeEvent { Message = - session.Translation.GetTranslation(TranslationString.PokemonFavorite, perfection, session.Translation.GetPokemonTranslation(pokemon.PokemonId), pokemon.Cp) + session.Translation.GetTranslation(TranslationString.PokemonFavorite, perfection, + session.Translation.GetPokemonTranslation(pokemon.PokemonId), pokemon.Cp) }); } } diff --git a/PokemonGo.RocketBot.Logic/Tasks/GetPokeDexCount.cs b/PokemonGo.RocketBot.Logic/Tasks/GetPokeDexCount.cs index 651f118a9..d30930187 100644 --- a/PokemonGo.RocketBot.Logic/Tasks/GetPokeDexCount.cs +++ b/PokemonGo.RocketBot.Logic/Tasks/GetPokeDexCount.cs @@ -1,25 +1,30 @@ -using PokemonGo.RocketBot.Logic.State; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +using System.Linq; using System.Threading; using System.Threading.Tasks; -using PokemonGo.RocketBot.Logic.Logging; using PokemonGo.RocketBot.Logic.Common; +using PokemonGo.RocketBot.Logic.Logging; +using PokemonGo.RocketBot.Logic.State; namespace PokemonGo.RocketBot.Logic.Tasks { - class GetPokeDexCount + internal class GetPokeDexCount { public static async Task Execute(ISession session, CancellationToken cancellationToken) { var PokeDex = await session.Inventory.GetPokeDexItems(); - var _totalUniqueEncounters = PokeDex.Select(i => new { Pokemon = i.InventoryItemData.PokedexEntry.PokemonId, Captures = i.InventoryItemData.PokedexEntry.TimesCaptured }); + var _totalUniqueEncounters = + PokeDex.Select( + i => + new + { + Pokemon = i.InventoryItemData.PokedexEntry.PokemonId, + Captures = i.InventoryItemData.PokedexEntry.TimesCaptured + }); var _totalCaptures = _totalUniqueEncounters.Count(i => i.Captures > 0); var _totalData = PokeDex.Count(); - - Logger.Write(session.Translation.GetTranslation(TranslationString.AmountPkmSeenCaught, _totalData, _totalCaptures)); + + Logger.Write(session.Translation.GetTranslation(TranslationString.AmountPkmSeenCaught, _totalData, + _totalCaptures)); } } } \ No newline at end of file diff --git a/PokemonGo.RocketBot.Logic/Tasks/InventoryListTask.cs b/PokemonGo.RocketBot.Logic/Tasks/InventoryListTask.cs index 91c2534bd..8b93bcc8c 100644 --- a/PokemonGo.RocketBot.Logic/Tasks/InventoryListTask.cs +++ b/PokemonGo.RocketBot.Logic/Tasks/InventoryListTask.cs @@ -1,8 +1,8 @@ -using PokemonGo.RocketBot.Logic.Event; +using System.Linq; +using System.Threading.Tasks; +using PokemonGo.RocketBot.Logic.Event; using PokemonGo.RocketBot.Logic.State; using PokemonGo.RocketBot.Logic.Utils; -using System.Linq; -using System.Threading.Tasks; namespace PokemonGo.RocketBot.Logic.Tasks { @@ -24,4 +24,4 @@ public static async Task Execute(ISession session) DelayingUtils.Delay(session.LogicSettings.DelayBetweenPlayerActions, 0); } } -} +} \ No newline at end of file diff --git a/PokemonGo.RocketBot.Logic/Tasks/LevelUpPokemonTask.cs b/PokemonGo.RocketBot.Logic/Tasks/LevelUpPokemonTask.cs index 908934709..3c57c81e6 100644 --- a/PokemonGo.RocketBot.Logic/Tasks/LevelUpPokemonTask.cs +++ b/PokemonGo.RocketBot.Logic/Tasks/LevelUpPokemonTask.cs @@ -1,12 +1,12 @@ #region using directives using System.Collections.Generic; +using System.Linq; using System.Threading; using System.Threading.Tasks; using PokemonGo.RocketBot.Logic.Logging; -using PokemonGo.RocketBot.Logic.State; using PokemonGo.RocketBot.Logic.PoGoUtils; -using System.Linq; +using PokemonGo.RocketBot.Logic.State; using POGOProtos.Data; #endregion @@ -20,8 +20,6 @@ internal class LevelUpPokemonTask public static async Task Execute(ISession session, CancellationToken cancellationToken) { - - if (session.Inventory.GetStarDust() <= session.LogicSettings.GetMinStarDustForLevelUp) return; upgradablePokemon = await session.Inventory.GetPokemonToUpgrade(); @@ -30,8 +28,8 @@ public static async Task Execute(ISession session, CancellationToken cancellatio var fave = upgradablePokemon.Where(i => i.Favorite == 1); upgradablePokemon = fave; } - - + + if (upgradablePokemon.Count() == 0) return; @@ -46,9 +44,9 @@ public static async Task Execute(ISession session, CancellationToken cancellatio foreach (var pokemon in upgradablePokemon) { - if (session.LogicSettings.UseLevelUpList && PokemonToLevel!=null) + if (session.LogicSettings.UseLevelUpList && PokemonToLevel != null) { - for (int i = 0; i < PokemonToLevel.Count; i++) + for (var i = 0; i < PokemonToLevel.Count; i++) { if (PokemonToLevel.Contains(pokemon.PokemonId)) { @@ -66,7 +64,7 @@ public static async Task Execute(ISession session, CancellationToken cancellatio Logger.Write("Pokemon Upgraded:" + session.Translation.GetPokemonTranslation( upgradeResult.UpgradedPokemon.PokemonId) + ":" + - upgradeResult.UpgradedPokemon.Cp,LogLevel.LevelUp); + upgradeResult.UpgradedPokemon.Cp, LogLevel.LevelUp); upgradedNumber++; } @@ -78,11 +76,11 @@ public static async Task Execute(ISession session, CancellationToken cancellatio break; } } - } else { - if (PokemonInfo.GetLevel(pokemon) >= session.Inventory.GetPlayerStats().Result.FirstOrDefault().Level + 1) break; + if (PokemonInfo.GetLevel(pokemon) >= + session.Inventory.GetPlayerStats().Result.FirstOrDefault().Level + 1) break; var settings = pokemonSettings.Single(x => x.PokemonId == pokemon.PokemonId); var familyCandy = pokemonFamilies.Single(x => settings.FamilyId == x.FamilyId); @@ -92,17 +90,17 @@ public static async Task Execute(ISession session, CancellationToken cancellatio var upgradeResult = await session.Inventory.UpgradePokemon(pokemon.Id); if (upgradeResult.Result.ToString().ToLower().Contains("success")) { - Logger.Write("Pokemon Upgraded:" + session.Translation.GetPokemonTranslation(upgradeResult.UpgradedPokemon.PokemonId) + ":" + - upgradeResult.UpgradedPokemon.Cp, LogLevel.LevelUp); + Logger.Write( + "Pokemon Upgraded:" + + session.Translation.GetPokemonTranslation(upgradeResult.UpgradedPokemon.PokemonId) + ":" + + upgradeResult.UpgradedPokemon.Cp, LogLevel.LevelUp); upgradedNumber++; } if (upgradedNumber >= session.LogicSettings.AmountOfTimesToUpgradeLoop) break; } - - } } } -} +} \ No newline at end of file diff --git a/PokemonGo.RocketBot.Logic/Tasks/Login.cs b/PokemonGo.RocketBot.Logic/Tasks/Login.cs index 3fe0593b9..5106b772d 100644 --- a/PokemonGo.RocketBot.Logic/Tasks/Login.cs +++ b/PokemonGo.RocketBot.Logic/Tasks/Login.cs @@ -1,11 +1,11 @@ #region using directives using System; +using PokemonGo.RocketAPI.Enums; +using PokemonGo.RocketAPI.Exceptions; using PokemonGo.RocketBot.Logic.Common; using PokemonGo.RocketBot.Logic.Event; using PokemonGo.RocketBot.Logic.State; -using PokemonGo.RocketAPI.Enums; -using PokemonGo.RocketAPI.Exceptions; #endregion @@ -45,7 +45,7 @@ public async void DoLogin() { throw ae.Flatten().InnerException; } - catch(LoginFailedException) + catch (LoginFailedException) { _session.EventDispatcher.Send(new ErrorEvent { diff --git a/PokemonGo.RocketBot.Logic/Tasks/PokemonListTask.cs b/PokemonGo.RocketBot.Logic/Tasks/PokemonListTask.cs index 106f2021f..9eb23070c 100644 --- a/PokemonGo.RocketBot.Logic/Tasks/PokemonListTask.cs +++ b/PokemonGo.RocketBot.Logic/Tasks/PokemonListTask.cs @@ -27,13 +27,14 @@ public static async Task Execute(ISession session) var allPokemonInBag = await session.Inventory.GetHighestsCp(1000); - var pkmWithIv = allPokemonInBag.Select(p => { + var pkmWithIv = allPokemonInBag.Select(p => + { var settings = pokemonSettings.Single(x => x.PokemonId == p.PokemonId); return Tuple.Create( p, PokemonInfo.CalculatePokemonPerfection(p), pokemonFamilies.Single(x => settings.FamilyId == x.FamilyId).Candy_ - ); + ); }); session.EventDispatcher.Send( diff --git a/PokemonGo.RocketBot.Logic/Tasks/RecycleItemsTask.cs b/PokemonGo.RocketBot.Logic/Tasks/RecycleItemsTask.cs index c63c4699e..d851dda8c 100644 --- a/PokemonGo.RocketBot.Logic/Tasks/RecycleItemsTask.cs +++ b/PokemonGo.RocketBot.Logic/Tasks/RecycleItemsTask.cs @@ -1,14 +1,14 @@ #region using directives +using System; +using System.Threading; +using System.Threading.Tasks; using PokemonGo.RocketBot.Logic.Common; using PokemonGo.RocketBot.Logic.Event; using PokemonGo.RocketBot.Logic.Logging; using PokemonGo.RocketBot.Logic.State; using PokemonGo.RocketBot.Logic.Utils; using POGOProtos.Inventory.Item; -using System.Threading; -using System.Threading.Tasks; -using System; #endregion @@ -17,14 +17,15 @@ namespace PokemonGo.RocketBot.Logic.Tasks public class RecycleItemsTask { private static int _diff; - private static Random rnd = new Random(); + private static readonly Random rnd = new Random(); public static async Task Execute(ISession session, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); var currentTotalItems = await session.Inventory.GetTotalItemCount(); - if ((session.Profile.PlayerData.MaxItemStorage * session.LogicSettings.RecycleInventoryAtUsagePercentage / 100.0f) > currentTotalItems) + if (session.Profile.PlayerData.MaxItemStorage*session.LogicSettings.RecycleInventoryAtUsagePercentage/100.0f > + currentTotalItems) return; var currentAmountOfPokeballs = await session.Inventory.GetItemAmountByType(ItemId.ItemPokeBall); @@ -47,7 +48,7 @@ public static async Task Execute(ISession session, CancellationToken cancellatio if (session.LogicSettings.DetailedCountsBeforeRecycling) Logger.Write(session.Translation.GetTranslation(TranslationString.CurrentPotionInv, currentPotions, currentSuperPotions, currentHyperPotions, currentMaxPotions)); - + var currentRevives = await session.Inventory.GetItemAmountByType(ItemId.ItemRevive); var currentMaxRevives = await session.Inventory.GetItemAmountByType(ItemId.ItemMaxRevive); @@ -58,14 +59,14 @@ public static async Task Execute(ISession session, CancellationToken cancellatio currentRevives, currentMaxRevives)); var currentAmountOfBerries = await session.Inventory.GetItemAmountByType(ItemId.ItemRazzBerry) + - await session.Inventory.GetItemAmountByType(ItemId.ItemBlukBerry) + - await session.Inventory.GetItemAmountByType(ItemId.ItemNanabBerry) + - await session.Inventory.GetItemAmountByType(ItemId.ItemWeparBerry) + - await session.Inventory.GetItemAmountByType(ItemId.ItemPinapBerry); + await session.Inventory.GetItemAmountByType(ItemId.ItemBlukBerry) + + await session.Inventory.GetItemAmountByType(ItemId.ItemNanabBerry) + + await session.Inventory.GetItemAmountByType(ItemId.ItemWeparBerry) + + await session.Inventory.GetItemAmountByType(ItemId.ItemPinapBerry); var currentAmountOfIncense = await session.Inventory.GetItemAmountByType(ItemId.ItemIncenseOrdinary) + - await session.Inventory.GetItemAmountByType(ItemId.ItemIncenseSpicy) + - await session.Inventory.GetItemAmountByType(ItemId.ItemIncenseCool) + - await session.Inventory.GetItemAmountByType(ItemId.ItemIncenseFloral); + await session.Inventory.GetItemAmountByType(ItemId.ItemIncenseSpicy) + + await session.Inventory.GetItemAmountByType(ItemId.ItemIncenseCool) + + await session.Inventory.GetItemAmountByType(ItemId.ItemIncenseFloral); var currentAmountOfLuckyEggs = await session.Inventory.GetItemAmountByType(ItemId.ItemLuckyEgg); var currentAmountOfLures = await session.Inventory.GetItemAmountByType(ItemId.ItemTroyDisk); @@ -79,18 +80,19 @@ await session.Inventory.GetItemAmountByType(ItemId.ItemIncenseCool) + if (!session.LogicSettings.VerboseRecycling) Logger.Write(session.Translation.GetTranslation(TranslationString.RecyclingQuietly), LogLevel.Recycling); - if (session.LogicSettings.TotalAmountOfPotionsToKeep>=0) + if (session.LogicSettings.TotalAmountOfPotionsToKeep >= 0) await OptimizedRecyclePotions(session, cancellationToken); - if (session.LogicSettings.TotalAmountOfRevivesToKeep>=0) + if (session.LogicSettings.TotalAmountOfRevivesToKeep >= 0) await OptimizedRecycleRevives(session, cancellationToken); if (session.LogicSettings.TotalAmountOfBerriesToKeep >= 0) await OptimizedRecycleBerries(session, cancellationToken); - + await session.Inventory.RefreshCachedInventory(); currentTotalItems = await session.Inventory.GetTotalItemCount(); - if ((session.Profile.PlayerData.MaxItemStorage * session.LogicSettings.RecycleInventoryAtUsagePercentage / 100.0f) > currentTotalItems) + if (session.Profile.PlayerData.MaxItemStorage*session.LogicSettings.RecycleInventoryAtUsagePercentage/100.0f > + currentTotalItems) return; var items = await session.Inventory.GetItemsToRecycle(session); @@ -102,7 +104,7 @@ await session.Inventory.GetItemAmountByType(ItemId.ItemIncenseCool) + await session.Client.Inventory.RecycleItem(item.ItemId, item.Count); if (session.LogicSettings.VerboseRecycling) - session.EventDispatcher.Send(new ItemRecycledEvent { Id = item.ItemId, Count = item.Count }); + session.EventDispatcher.Send(new ItemRecycledEvent {Id = item.ItemId, Count = item.Count}); if (session.LogicSettings.DelayBetweenRecycleActions) DelayingUtils.Delay(session.LogicSettings.DelayBetweenPlayerActions, 500); } @@ -110,10 +112,11 @@ await session.Inventory.GetItemAmountByType(ItemId.ItemIncenseCool) + await session.Inventory.RefreshCachedInventory(); } - private static async Task RecycleItems(ISession session, CancellationToken cancellationToken, int itemCount, ItemId item) + private static async Task RecycleItems(ISession session, CancellationToken cancellationToken, int itemCount, + ItemId item) { - int itemsToRecycle = 0; - int itemsToKeep = itemCount - _diff; + var itemsToRecycle = 0; + var itemsToKeep = itemCount - _diff; if (itemsToKeep < 0) itemsToKeep = 0; itemsToRecycle = itemCount - itemsToKeep; @@ -123,7 +126,7 @@ private static async Task RecycleItems(ISession session, CancellationToken cance cancellationToken.ThrowIfCancellationRequested(); await session.Client.Inventory.RecycleItem(item, itemsToRecycle); if (session.LogicSettings.VerboseRecycling) - session.EventDispatcher.Send(new ItemRecycledEvent { Id = item, Count = itemsToRecycle }); + session.EventDispatcher.Send(new ItemRecycledEvent {Id = item, Count = itemsToRecycle}); if (session.LogicSettings.DelayBetweenRecycleActions) DelayingUtils.Delay(session.LogicSettings.DelayBetweenPlayerActions, 500); } @@ -136,25 +139,28 @@ private static async Task OptimizedRecycleBalls(ISession session, CancellationTo var ultraBallsCount = await session.Inventory.GetItemAmountByType(ItemId.ItemUltraBall); var masterBallsCount = await session.Inventory.GetItemAmountByType(ItemId.ItemMasterBall); - int totalBallsCount = pokeBallsCount + greatBallsCount + ultraBallsCount + masterBallsCount; - int random = rnd.Next(-1 * session.LogicSettings.RandomRecycleValue, session.LogicSettings.RandomRecycleValue + 1); + var totalBallsCount = pokeBallsCount + greatBallsCount + ultraBallsCount + masterBallsCount; + var random = rnd.Next(-1*session.LogicSettings.RandomRecycleValue, + session.LogicSettings.RandomRecycleValue + 1); if (totalBallsCount > session.LogicSettings.TotalAmountOfPokeballsToKeep) { if (session.LogicSettings.RandomizeRecycle) { _diff = totalBallsCount - session.LogicSettings.TotalAmountOfPokeballsToKeep + random; - } else { + } + else + { _diff = totalBallsCount - session.LogicSettings.TotalAmountOfPokeballsToKeep; } - + if (_diff > 0) { await RecycleItems(session, cancellationToken, pokeBallsCount, ItemId.ItemPokeBall); } if (_diff > 0) { - await RecycleItems(session, cancellationToken, greatBallsCount, ItemId.ItemGreatBall); + await RecycleItems(session, cancellationToken, greatBallsCount, ItemId.ItemGreatBall); } if (_diff > 0) { @@ -173,9 +179,10 @@ private static async Task OptimizedRecyclePotions(ISession session, Cancellation var superPotionCount = await session.Inventory.GetItemAmountByType(ItemId.ItemSuperPotion); var hyperPotionsCount = await session.Inventory.GetItemAmountByType(ItemId.ItemHyperPotion); var maxPotionCount = await session.Inventory.GetItemAmountByType(ItemId.ItemMaxPotion); - - int totalPotionsCount = potionCount + superPotionCount + hyperPotionsCount + maxPotionCount; - int random = rnd.Next(-1 * session.LogicSettings.RandomRecycleValue, session.LogicSettings.RandomRecycleValue + 1); + + var totalPotionsCount = potionCount + superPotionCount + hyperPotionsCount + maxPotionCount; + var random = rnd.Next(-1*session.LogicSettings.RandomRecycleValue, + session.LogicSettings.RandomRecycleValue + 1); if (totalPotionsCount > session.LogicSettings.TotalAmountOfPotionsToKeep) { if (session.LogicSettings.RandomizeRecycle) @@ -186,7 +193,7 @@ private static async Task OptimizedRecyclePotions(ISession session, Cancellation { _diff = totalPotionsCount - session.LogicSettings.TotalAmountOfPotionsToKeep; } - + if (_diff > 0) { await RecycleItems(session, cancellationToken, potionCount, ItemId.ItemPotion); @@ -214,8 +221,9 @@ private static async Task OptimizedRecycleRevives(ISession session, Cancellation var reviveCount = await session.Inventory.GetItemAmountByType(ItemId.ItemRevive); var maxReviveCount = await session.Inventory.GetItemAmountByType(ItemId.ItemMaxRevive); - int totalRevivesCount = reviveCount + maxReviveCount; - int random = rnd.Next(-1 * session.LogicSettings.RandomRecycleValue, session.LogicSettings.RandomRecycleValue + 1); + var totalRevivesCount = reviveCount + maxReviveCount; + var random = rnd.Next(-1*session.LogicSettings.RandomRecycleValue, + session.LogicSettings.RandomRecycleValue + 1); if (totalRevivesCount > session.LogicSettings.TotalAmountOfRevivesToKeep) { if (session.LogicSettings.RandomizeRecycle) @@ -246,8 +254,9 @@ private static async Task OptimizedRecycleBerries(ISession session, Cancellation var pinap = await session.Inventory.GetItemAmountByType(ItemId.ItemPinapBerry); var wepar = await session.Inventory.GetItemAmountByType(ItemId.ItemWeparBerry); - int totalBerryCount = razz + bluk + nanab + pinap + wepar; - int random = rnd.Next(-1 * session.LogicSettings.RandomRecycleValue, session.LogicSettings.RandomRecycleValue + 1); + var totalBerryCount = razz + bluk + nanab + pinap + wepar; + var random = rnd.Next(-1*session.LogicSettings.RandomRecycleValue, + session.LogicSettings.RandomRecycleValue + 1); if (totalBerryCount > session.LogicSettings.TotalAmountOfBerriesToKeep) { if (session.LogicSettings.RandomizeRecycle) @@ -258,7 +267,7 @@ private static async Task OptimizedRecycleBerries(ISession session, Cancellation { _diff = totalBerryCount - session.LogicSettings.TotalAmountOfBerriesToKeep; } - + if (_diff > 0) { await RecycleItems(session, cancellationToken, razz, ItemId.ItemRazzBerry); @@ -286,4 +295,4 @@ private static async Task OptimizedRecycleBerries(ISession session, Cancellation } } } -} +} \ No newline at end of file diff --git a/PokemonGo.RocketBot.Logic/Tasks/RenamePokemonTask.cs b/PokemonGo.RocketBot.Logic/Tasks/RenamePokemonTask.cs index 43d471c67..954ec93aa 100644 --- a/PokemonGo.RocketBot.Logic/Tasks/RenamePokemonTask.cs +++ b/PokemonGo.RocketBot.Logic/Tasks/RenamePokemonTask.cs @@ -48,7 +48,8 @@ public static async Task Execute(ISession session, CancellationToken cancellatio session.EventDispatcher.Send(new NoticeEvent { Message = - session.Translation.GetTranslation(TranslationString.PokemonRename, session.Translation.GetPokemonTranslation(pokemon.PokemonId), + session.Translation.GetTranslation(TranslationString.PokemonRename, + session.Translation.GetPokemonTranslation(pokemon.PokemonId), pokemon.Id, oldNickname, newNickname) }); } diff --git a/PokemonGo.RocketBot.Logic/Tasks/SnipePokemonTask.cs b/PokemonGo.RocketBot.Logic/Tasks/SnipePokemonTask.cs index 135f71c18..8dc14597c 100644 --- a/PokemonGo.RocketBot.Logic/Tasks/SnipePokemonTask.cs +++ b/PokemonGo.RocketBot.Logic/Tasks/SnipePokemonTask.cs @@ -1,6 +1,5 @@ #region using directives -using CloudFlareUtilities; using System; using System.Collections.Generic; using System.Globalization; @@ -11,7 +10,9 @@ using System.Net.Sockets; using System.Threading; using System.Threading.Tasks; +using CloudFlareUtilities; using Newtonsoft.Json; +using Newtonsoft.Json.Linq; using PokemonGo.RocketBot.Logic.Common; using PokemonGo.RocketBot.Logic.Event; using PokemonGo.RocketBot.Logic.PoGoUtils; @@ -20,8 +21,9 @@ using POGOProtos.Inventory.Item; using POGOProtos.Map.Pokemon; using POGOProtos.Networking.Responses; +using Quobject.Collections.Immutable; using Quobject.SocketIoClientDotNet.Client; -using Newtonsoft.Json.Linq; +using Socket = Quobject.SocketIoClientDotNet.Client.Socket; #endregion @@ -90,11 +92,11 @@ public override string ToString() public class PokemonLocation_pokezz { - public double time { get; set; } public double lat { get; set; } public double lng { get; set; } public string iv { get; set; } + public double _iv { get @@ -109,8 +111,9 @@ public double _iv } } } + public PokemonId name { get; set; } - public Boolean verified { get; set; } + public bool verified { get; set; } } public class PokemonLocation_pokesnipers @@ -139,6 +142,7 @@ public class ScanResult public class ScanResult_pokesnipers { public string Status { get; set; } + [JsonProperty("results")] public List pokemons { get; set; } } @@ -154,7 +158,7 @@ public static class SnipePokemonTask public static List LocsVisited = new List(); private static readonly List SnipeLocations = new List(); private static DateTime _lastSnipe = DateTime.MinValue; - + public static Task AsyncStart(Session session, CancellationToken cancellationToken = default(CancellationToken)) { return Task.Run(() => Start(session, cancellationToken), cancellationToken); @@ -194,13 +198,16 @@ public static async Task Execute(ISession session, CancellationToken cancellatio { if (session.LogicSettings.PokemonToSnipe != null) { - List pokemonIds = new List(); + var pokemonIds = new List(); if (session.LogicSettings.SnipePokemonNotInPokedex) { var PokeDex = await session.Inventory.GetPokeDexItems(); var pokemonOnlyList = session.LogicSettings.PokemonToSnipe.Pokemon; - var capturedPokemon = PokeDex.Where(i => i.InventoryItemData.PokedexEntry.TimesCaptured >= 1).Select(i => i.InventoryItemData.PokedexEntry.PokemonId); - var pokemonToCapture = Enum.GetValues(typeof(PokemonId)).Cast().Except(capturedPokemon); + var capturedPokemon = + PokeDex.Where(i => i.InventoryItemData.PokedexEntry.TimesCaptured >= 1) + .Select(i => i.InventoryItemData.PokedexEntry.PokemonId); + var pokemonToCapture = + Enum.GetValues(typeof(PokemonId)).Cast().Except(capturedPokemon); pokemonIds = pokemonOnlyList.Union(pokemonToCapture).ToList(); } else @@ -211,16 +218,16 @@ public static async Task Execute(ISession session, CancellationToken cancellatio if (session.LogicSettings.UseSnipeLocationServer) { var locationsToSnipe = SnipeLocations?.Where(q => - (!session.LogicSettings.UseTransferIvForSnipe || - (q.IV == 0 && !session.LogicSettings.SnipeIgnoreUnknownIv) || - (q.IV >= session.Inventory.GetPokemonTransferFilter(q.Id).KeepMinIvPercentage)) && - !LocsVisited.Contains(new PokemonLocation(q.Latitude, q.Longitude)) - && !(q.ExpirationTimestamp != default(DateTime) && - q.ExpirationTimestamp > new DateTime(2016) && - // make absolutely sure that the server sent a correct datetime - q.ExpirationTimestamp < DateTime.Now) && - (q.Id == PokemonId.Missingno || pokemonIds.Contains(q.Id))).ToList() ?? - new List(); + (!session.LogicSettings.UseTransferIvForSnipe || + (q.IV == 0 && !session.LogicSettings.SnipeIgnoreUnknownIv) || + (q.IV >= session.Inventory.GetPokemonTransferFilter(q.Id).KeepMinIvPercentage)) && + !LocsVisited.Contains(new PokemonLocation(q.Latitude, q.Longitude)) + && !(q.ExpirationTimestamp != default(DateTime) && + q.ExpirationTimestamp > new DateTime(2016) && + // make absolutely sure that the server sent a correct datetime + q.ExpirationTimestamp < DateTime.Now) && + (q.Id == PokemonId.Missingno || pokemonIds.Contains(q.Id))).ToList() ?? + new List(); var _locationsToSnipe = locationsToSnipe.OrderBy(q => q.ExpirationTimestamp).ToList(); @@ -228,7 +235,8 @@ public static async Task Execute(ISession session, CancellationToken cancellatio { foreach (var location in _locationsToSnipe) { - if ((location.ExpirationTimestamp > DateTime.Now.AddSeconds(10)) && (!LocsVisited.Contains(new PokemonLocation(location.Latitude, location.Longitude)))) + if ((location.ExpirationTimestamp > DateTime.Now.AddSeconds(10)) && + !LocsVisited.Contains(new PokemonLocation(location.Latitude, location.Longitude))) { session.EventDispatcher.Send(new SnipeScanEvent { @@ -238,10 +246,15 @@ public static async Task Execute(ISession session, CancellationToken cancellatio Iv = location.IV }); - if (!await CheckPokeballsToSnipe(session.LogicSettings.MinPokeballsWhileSnipe + 1, session, cancellationToken)) + if ( + !await + CheckPokeballsToSnipe(session.LogicSettings.MinPokeballsWhileSnipe + 1, + session, cancellationToken)) return; - await Snipe(session, pokemonIds, location.Latitude, location.Longitude, cancellationToken); + await + Snipe(session, pokemonIds, location.Latitude, location.Longitude, + cancellationToken); } } } @@ -254,7 +267,8 @@ public static async Task Execute(ISession session, CancellationToken cancellatio { foreach (var location in _locationsToSnipe) { - if ((location.ExpirationTimestamp > DateTime.Now.AddSeconds(10)) && (!LocsVisited.Contains(new PokemonLocation(location.Latitude, location.Longitude)))) + if ((location.ExpirationTimestamp > DateTime.Now.AddSeconds(10)) && + !LocsVisited.Contains(new PokemonLocation(location.Latitude, location.Longitude))) { session.EventDispatcher.Send(new SnipeScanEvent { @@ -264,10 +278,15 @@ public static async Task Execute(ISession session, CancellationToken cancellatio Iv = location.IV }); - if (!await CheckPokeballsToSnipe(session.LogicSettings.MinPokeballsWhileSnipe + 1, session, cancellationToken)) + if ( + !await + CheckPokeballsToSnipe(session.LogicSettings.MinPokeballsWhileSnipe + 1, + session, cancellationToken)) return; - - await Snipe(session, pokemonIds, location.Latitude, location.Longitude, cancellationToken); + + await + Snipe(session, pokemonIds, location.Latitude, location.Longitude, + cancellationToken); } } } @@ -280,7 +299,8 @@ public static async Task Execute(ISession session, CancellationToken cancellatio { foreach (var location in _locationsToSnipe) { - if ((location.ExpirationTimestamp > DateTime.Now.AddSeconds(10)) && (!LocsVisited.Contains(new PokemonLocation(location.Latitude, location.Longitude)))) + if ((location.ExpirationTimestamp > DateTime.Now.AddSeconds(10)) && + !LocsVisited.Contains(new PokemonLocation(location.Latitude, location.Longitude))) { session.EventDispatcher.Send(new SnipeScanEvent { @@ -290,10 +310,15 @@ public static async Task Execute(ISession session, CancellationToken cancellatio Iv = location.IV }); - if (!await CheckPokeballsToSnipe(session.LogicSettings.MinPokeballsWhileSnipe + 1, session, cancellationToken)) + if ( + !await + CheckPokeballsToSnipe(session.LogicSettings.MinPokeballsWhileSnipe + 1, + session, cancellationToken)) return; - - await Snipe(session, pokemonIds, location.Latitude, location.Longitude, cancellationToken); + + await + Snipe(session, pokemonIds, location.Latitude, location.Longitude, + cancellationToken); } } } @@ -306,7 +331,8 @@ public static async Task Execute(ISession session, CancellationToken cancellatio { foreach (var location in _locationsToSnipe) { - if ((location.ExpirationTimestamp > DateTime.Now.AddSeconds(10)) && (!LocsVisited.Contains(new PokemonLocation(location.Latitude, location.Longitude)))) + if ((location.ExpirationTimestamp > DateTime.Now.AddSeconds(10)) && + !LocsVisited.Contains(new PokemonLocation(location.Latitude, location.Longitude))) { session.EventDispatcher.Send(new SnipeScanEvent { @@ -316,10 +342,15 @@ public static async Task Execute(ISession session, CancellationToken cancellatio Iv = location.IV }); - if (!await CheckPokeballsToSnipe(session.LogicSettings.MinPokeballsWhileSnipe + 1, session, cancellationToken)) + if ( + !await + CheckPokeballsToSnipe(session.LogicSettings.MinPokeballsWhileSnipe + 1, + session, cancellationToken)) return; - await Snipe(session, pokemonIds, location.Latitude, location.Longitude, cancellationToken); + await + Snipe(session, pokemonIds, location.Latitude, location.Longitude, + cancellationToken); } } } @@ -343,7 +374,12 @@ public static async Task Execute(ISession session, CancellationToken cancellatio { 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 < (DateTime.Now.ToUniversalTime() - (new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc))).TotalMilliseconds); + var notExpiredPokemon = + notVisitedPokemon.Where( + q => + q.expires < + (DateTime.Now.ToUniversalTime() - + new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalMilliseconds); if (notExpiredPokemon.Any()) locationsToSnipe.AddRange(notExpiredPokemon); @@ -355,22 +391,38 @@ public static async Task Execute(ISession session, CancellationToken cancellatio { foreach (var pokemonLocation in _locationsToSnipe) { - if ((pokemonLocation.expires > (((DateTime.Now.ToUniversalTime() - (new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc))).TotalMilliseconds) + 10000)) && (!LocsVisited.Contains(new PokemonLocation(pokemonLocation.latitude, pokemonLocation.longitude)))) + if ((pokemonLocation.expires > + (DateTime.Now.ToUniversalTime() - + new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalMilliseconds + 10000) && + !LocsVisited.Contains(new PokemonLocation(pokemonLocation.latitude, + pokemonLocation.longitude))) { - if (!await CheckPokeballsToSnipe(session.LogicSettings.MinPokeballsWhileSnipe + 1, session, cancellationToken)) + if ( + !await + CheckPokeballsToSnipe(session.LogicSettings.MinPokeballsWhileSnipe + 1, + session, cancellationToken)) return; - - await Snipe(session, pokemonIds, location.Latitude, location.Longitude, cancellationToken); + + await + Snipe(session, pokemonIds, location.Latitude, location.Longitude, + cancellationToken); } } } - else if (session.LogicSettings.UseSnipeLocationServer && !string.IsNullOrEmpty(scanResult.Status) && scanResult.Status.Contains("fail")) - session.EventDispatcher.Send(new SnipeEvent{Message = session.Translation.GetTranslation(TranslationString.SnipeServerOffline)}); + else if (session.LogicSettings.UseSnipeLocationServer && + !string.IsNullOrEmpty(scanResult.Status) && scanResult.Status.Contains("fail")) + session.EventDispatcher.Send(new SnipeEvent + { + Message = + session.Translation.GetTranslation(TranslationString.SnipeServerOffline) + }); else - session.EventDispatcher.Send(new SnipeEvent{Message = session.Translation.GetTranslation(TranslationString.NoPokemonToSnipe)}); + session.EventDispatcher.Send(new SnipeEvent + { + Message = session.Translation.GetTranslation(TranslationString.NoPokemonToSnipe) + }); } } - } } } @@ -385,7 +437,7 @@ private static async Task Snipe(ISession session, IEnumerable pokemon var CurrentLongitude = session.Client.CurrentLongitude; var catchedPokemon = false; - session.EventDispatcher.Send(new SnipeModeEvent { Active = true }); + session.EventDispatcher.Send(new SnipeModeEvent {Active = true}); List catchablePokemon; try @@ -407,7 +459,9 @@ private static async Task Snipe(ISession session, IEnumerable pokemon } finally { - await session.Client.Player.UpdatePlayerLocation(CurrentLatitude, CurrentLongitude, session.Client.CurrentAltitude); + await + session.Client.Player.UpdatePlayerLocation(CurrentLatitude, CurrentLongitude, + session.Client.CurrentAltitude); } if (catchablePokemon.Count == 0) @@ -417,24 +471,27 @@ private static async Task Snipe(ISession session, IEnumerable pokemon if (!LocsVisited.Contains(new PokemonLocation(latitude, longitude))) LocsVisited.Add(new PokemonLocation(latitude, longitude)); } - + foreach (var pokemon in catchablePokemon) { EncounterResponse encounter; try { - await session.Client.Player.UpdatePlayerLocation(latitude, longitude, session.Client.CurrentAltitude); + await + session.Client.Player.UpdatePlayerLocation(latitude, longitude, session.Client.CurrentAltitude); - encounter = session.Client.Encounter.EncounterPokemon(pokemon.EncounterId, pokemon.SpawnPointId).Result; + encounter = + session.Client.Encounter.EncounterPokemon(pokemon.EncounterId, pokemon.SpawnPointId).Result; } finally { - await session.Client.Player.UpdatePlayerLocation(CurrentLatitude, CurrentLongitude, session.Client.CurrentAltitude); + await + session.Client.Player.UpdatePlayerLocation(CurrentLatitude, CurrentLongitude, + session.Client.CurrentAltitude); } if (encounter.Status == EncounterResponse.Types.Status.EncounterSuccess) { - if (!LocsVisited.Contains(new PokemonLocation(latitude, longitude))) LocsVisited.Add(new PokemonLocation(latitude, longitude)); //Also add exact pokemon location to LocsVisited, some times the server one differ a little. @@ -496,14 +553,13 @@ private static async Task Snipe(ISession session, IEnumerable pokemon _lastSnipe = DateTime.Now; - session.EventDispatcher.Send(new SnipeModeEvent { Active = false }); + session.EventDispatcher.Send(new SnipeModeEvent {Active = false}); await Task.Delay(session.LogicSettings.DelayBetweenPlayerActions, cancellationToken); - } private static ScanResult SnipeScanForPokemon(ISession session, Location location) { - var formatter = new NumberFormatInfo { NumberDecimalSeparator = "." }; + var formatter = new NumberFormatInfo {NumberDecimalSeparator = "."}; var offset = session.LogicSettings.SnipingScanOffset; // 0.003 = half a mile; maximum 0.06 is 10 miles @@ -531,14 +587,19 @@ private static ScanResult SnipeScanForPokemon(ISession session, Location locatio var resp = request.GetResponse(); var reader = new StreamReader(resp.GetResponseStream()); - var fullresp = reader.ReadToEnd().Replace(" M", "Male").Replace(" F", "Female").Replace("Farfetch'd", "Farfetchd").Replace("Mr.Maleime", "MrMime"); + var fullresp = + reader.ReadToEnd() + .Replace(" M", "Male") + .Replace(" F", "Female") + .Replace("Farfetch'd", "Farfetchd") + .Replace("Mr.Maleime", "MrMime"); scanResult = JsonConvert.DeserializeObject(fullresp); } catch (Exception ex) { // most likely System.IO.IOException - session.EventDispatcher.Send(new ErrorEvent { Message = ex.Message }); + session.EventDispatcher.Send(new ErrorEvent {Message = ex.Message}); scanResult = new ScanResult { Status = "fail", @@ -551,38 +612,43 @@ private static ScanResult SnipeScanForPokemon(ISession session, Location locatio private static List GetSniperInfoFrom_pokezz(ISession session, List pokemonIds) { var options = new IO.Options(); - options.Transports = Quobject.Collections.Immutable.ImmutableList.Create("websocket"); + options.Transports = ImmutableList.Create("websocket"); var socket = IO.Socket("http://pokezz.com", options); var hasError = false; - ManualResetEventSlim waitforbroadcast = new ManualResetEventSlim(false); + var waitforbroadcast = new ManualResetEventSlim(false); - List pokemons = new List(); + var pokemons = new List(); - socket.On("pokemons", (msg) => + socket.On("pokemons", msg => { socket.Close(); - JArray data = JArray.FromObject(msg); + var data = JArray.FromObject(msg); foreach (var pokeToken in data.Children()) { - var Token = pokeToken.ToString().Replace(" M", "Male").Replace(" F", "Female").Replace("Farfetch'd", "Farfetchd").Replace("Mr.Maleime", "MrMime"); + var Token = + pokeToken.ToString() + .Replace(" M", "Male") + .Replace(" F", "Female") + .Replace("Farfetch'd", "Farfetchd") + .Replace("Mr.Maleime", "MrMime"); pokemons.Add(JToken.Parse(Token).ToObject()); } waitforbroadcast.Set(); }); - socket.On(Quobject.SocketIoClientDotNet.Client.Socket.EVENT_ERROR, () => + socket.On(Socket.EVENT_ERROR, () => { socket.Close(); hasError = true; waitforbroadcast.Set(); }); - socket.On(Quobject.SocketIoClientDotNet.Client.Socket.EVENT_CONNECT_ERROR, () => + socket.On(Socket.EVENT_CONNECT_ERROR, () => { socket.Close(); hasError = true; @@ -599,7 +665,8 @@ private static List GetSniperInfoFrom_pokezz(ISession session, List< SnipInfo.Latitude = pokemon.lat; SnipInfo.Longitude = pokemon.lng; SnipInfo.TimeStampAdded = DateTime.Now; - SnipInfo.ExpirationTimestamp = new DateTime(1970, 1, 1, 0, 0, 0, 0).AddSeconds(Math.Round(pokemon.time / 1000d)).ToLocalTime(); + SnipInfo.ExpirationTimestamp = + new DateTime(1970, 1, 1, 0, 0, 0, 0).AddSeconds(Math.Round(pokemon.time/1000d)).ToLocalTime(); SnipInfo.IV = pokemon._iv; if (pokemon.verified || !session.LogicSettings.GetOnlyVerifiedSniperInfoFromPokezz) SnipeLocations.Add(SnipInfo); @@ -607,28 +674,24 @@ private static List GetSniperInfoFrom_pokezz(ISession session, List< var locationsToSnipe = SnipeLocations?.Where(q => (!session.LogicSettings.UseTransferIvForSnipe || - (q.IV == 0 && !session.LogicSettings.SnipeIgnoreUnknownIv) || - (q.IV >= session.Inventory.GetPokemonTransferFilter(q.Id).KeepMinIvPercentage)) && + (q.IV == 0 && !session.LogicSettings.SnipeIgnoreUnknownIv) || + (q.IV >= session.Inventory.GetPokemonTransferFilter(q.Id).KeepMinIvPercentage)) && !LocsVisited.Contains(new PokemonLocation(q.Latitude, q.Longitude)) && !(q.ExpirationTimestamp != default(DateTime) && - q.ExpirationTimestamp > new DateTime(2016) && - // make absolutely sure that the server sent a correct datetime - q.ExpirationTimestamp < DateTime.Now) && + q.ExpirationTimestamp > new DateTime(2016) && + // make absolutely sure that the server sent a correct datetime + q.ExpirationTimestamp < DateTime.Now) && (q.Id == PokemonId.Missingno || pokemonIds.Contains(q.Id))).ToList() ?? - new List(); + new List(); return locationsToSnipe.OrderBy(q => q.ExpirationTimestamp).ToList(); } - else - { - session.EventDispatcher.Send(new ErrorEvent {Message = "(Pokezz.com) Connection Error"}); - return new List(); - } + session.EventDispatcher.Send(new ErrorEvent {Message = "(Pokezz.com) Connection Error"}); + return new List(); } private static List GetSniperInfoFrom_pokesnipers(ISession session, List pokemonIds) { - var uri = $"http://pokesnipers.com/api/v1/pokemon.json"; ScanResult_pokesnipers scanResult_pokesnipers; @@ -640,7 +703,12 @@ private static List GetSniperInfoFrom_pokesnipers(ISession session, var client = new HttpClient(handler); // Use the HttpClient as usual. Any JS challenge will be solved automatically for you. - var fullresp = client.GetStringAsync(uri).Result.Replace(" M", "Male").Replace(" F", "Female").Replace("Farfetch'd", "Farfetchd").Replace("Mr.Maleime", "MrMime"); + var fullresp = + client.GetStringAsync(uri) + .Result.Replace(" M", "Male") + .Replace(" F", "Female") + .Replace("Farfetch'd", "Farfetchd") + .Replace("Mr.Maleime", "MrMime"); scanResult_pokesnipers = JsonConvert.DeserializeObject(fullresp); } @@ -658,7 +726,7 @@ private static List GetSniperInfoFrom_pokesnipers(ISession session, { var SnipInfo = new SniperInfo(); SnipInfo.Id = pokemon.name; - string[] coordsArray = pokemon.coords.Split(','); + var coordsArray = pokemon.coords.Split(','); SnipInfo.Latitude = Convert.ToDouble(coordsArray[0], CultureInfo.InvariantCulture); SnipInfo.Longitude = Convert.ToDouble(coordsArray[1], CultureInfo.InvariantCulture); SnipInfo.TimeStampAdded = DateTime.Now; @@ -673,25 +741,23 @@ private static List GetSniperInfoFrom_pokesnipers(ISession session, } var locationsToSnipe = SnipeLocations?.Where(q => (!session.LogicSettings.UseTransferIvForSnipe || - (q.IV == 0 && !session.LogicSettings.SnipeIgnoreUnknownIv) || - (q.IV >= session.Inventory.GetPokemonTransferFilter(q.Id).KeepMinIvPercentage)) && + (q.IV == 0 && !session.LogicSettings.SnipeIgnoreUnknownIv) || + (q.IV >= session.Inventory.GetPokemonTransferFilter(q.Id).KeepMinIvPercentage)) && !LocsVisited.Contains(new PokemonLocation(q.Latitude, q.Longitude)) && !(q.ExpirationTimestamp != default(DateTime) && - q.ExpirationTimestamp > new DateTime(2016) && - // make absolutely sure that the server sent a correct datetime - q.ExpirationTimestamp < DateTime.Now) && + q.ExpirationTimestamp > new DateTime(2016) && + // make absolutely sure that the server sent a correct datetime + q.ExpirationTimestamp < DateTime.Now) && (q.Id == PokemonId.Missingno || pokemonIds.Contains(q.Id))).ToList() ?? - new List(); + new List(); return locationsToSnipe.OrderBy(q => q.ExpirationTimestamp).ToList(); } - else - return new List(); + return new List(); } private static List GetSniperInfoFrom_pokewatchers(ISession session, List pokemonIds) { - var uri = $"http://pokewatchers.com/api.php?act=grab"; ScanResult_pokewatchers scanResult_pokewatchers; @@ -703,14 +769,19 @@ private static List GetSniperInfoFrom_pokewatchers(ISession session, var client = new HttpClient(handler); // Use the HttpClient as usual. Any JS challenge will be solved automatically for you. - var fullresp = "{ \"pokemons\":" + client.GetStringAsync(uri).Result.Replace(" M", "Male").Replace(" F", "Female").Replace("Farfetch'd", "Farfetchd").Replace("Mr.Maleime", "MrMime") +"}"; + var fullresp = "{ \"pokemons\":" + + client.GetStringAsync(uri) + .Result.Replace(" M", "Male") + .Replace(" F", "Female") + .Replace("Farfetch'd", "Farfetchd") + .Replace("Mr.Maleime", "MrMime") + "}"; scanResult_pokewatchers = JsonConvert.DeserializeObject(fullresp); } catch (Exception ex) { // most likely System.IO.IOException - session.EventDispatcher.Send(new ErrorEvent { Message = "(PokeWatchers.com) " + ex.Message }); + session.EventDispatcher.Send(new ErrorEvent {Message = "(PokeWatchers.com) " + ex.Message}); return new List(); } if (scanResult_pokewatchers.pokemons != null) @@ -721,11 +792,15 @@ private static List GetSniperInfoFrom_pokewatchers(ISession session, { var SnipInfo = new SniperInfo(); SnipInfo.Id = pokemon.pokemon; - string[] coordsArray = pokemon.cords.Split(','); + var coordsArray = pokemon.cords.Split(','); SnipInfo.Latitude = Convert.ToDouble(coordsArray[0], CultureInfo.InvariantCulture); SnipInfo.Longitude = Convert.ToDouble(coordsArray[1], CultureInfo.InvariantCulture); - SnipInfo.TimeStampAdded = new DateTime(1970, 1, 1, 0, 0, 0, 0).AddSeconds(Math.Round(pokemon.timeadded / 1000d)).ToLocalTime(); - SnipInfo.ExpirationTimestamp = new DateTime(1970, 1, 1, 0, 0, 0, 0).AddSeconds(Math.Round(pokemon.timeend / 1000d)).ToLocalTime(); + SnipInfo.TimeStampAdded = + new DateTime(1970, 1, 1, 0, 0, 0, 0).AddSeconds(Math.Round(pokemon.timeadded/1000d)) + .ToLocalTime(); + SnipInfo.ExpirationTimestamp = + new DateTime(1970, 1, 1, 0, 0, 0, 0).AddSeconds(Math.Round(pokemon.timeend/1000d)) + .ToLocalTime(); SnipeLocations.Add(SnipInfo); } catch @@ -734,20 +809,19 @@ private static List GetSniperInfoFrom_pokewatchers(ISession session, } var locationsToSnipe = SnipeLocations?.Where(q => (!session.LogicSettings.UseTransferIvForSnipe || - (q.IV == 0 && !session.LogicSettings.SnipeIgnoreUnknownIv) || - (q.IV >= session.Inventory.GetPokemonTransferFilter(q.Id).KeepMinIvPercentage)) && + (q.IV == 0 && !session.LogicSettings.SnipeIgnoreUnknownIv) || + (q.IV >= session.Inventory.GetPokemonTransferFilter(q.Id).KeepMinIvPercentage)) && !LocsVisited.Contains(new PokemonLocation(q.Latitude, q.Longitude)) && !(q.ExpirationTimestamp != default(DateTime) && - q.ExpirationTimestamp > new DateTime(2016) && - // make absolutely sure that the server sent a correct datetime - q.ExpirationTimestamp < DateTime.Now) && + q.ExpirationTimestamp > new DateTime(2016) && + // make absolutely sure that the server sent a correct datetime + q.ExpirationTimestamp < DateTime.Now) && (q.Id == PokemonId.Missingno || pokemonIds.Contains(q.Id))).ToList() ?? - new List(); + new List(); return locationsToSnipe.OrderBy(q => q.ExpirationTimestamp).ToList(); } - else - return new List(); + return new List(); } public static async Task Start(Session session, CancellationToken cancellationToken) @@ -784,9 +858,12 @@ public static async Task Start(Session session, CancellationToken cancellationTo SnipeLocations.RemoveAll(x => DateTime.Now > x.TimeStampAdded.AddMinutes(15)); SnipeLocations.Add(info); } - catch (System.IO.IOException) + catch (IOException) { - session.EventDispatcher.Send(new ErrorEvent {Message = "The connection to the sniping location server was lost."}); + session.EventDispatcher.Send(new ErrorEvent + { + Message = "The connection to the sniping location server was lost." + }); } } } @@ -797,10 +874,10 @@ public static async Task Start(Session session, CancellationToken cancellationTo catch (Exception ex) { // most likely System.IO.IOException - session.EventDispatcher.Send(new ErrorEvent { Message = ex.ToString() }); + session.EventDispatcher.Send(new ErrorEvent {Message = ex.ToString()}); } await Task.Delay(100, cancellationToken); } } } -} +} \ No newline at end of file diff --git a/PokemonGo.RocketBot.Logic/Tasks/TransferDuplicatePokemonTask.cs b/PokemonGo.RocketBot.Logic/Tasks/TransferDuplicatePokemonTask.cs index db228ff9d..996470c77 100644 --- a/PokemonGo.RocketBot.Logic/Tasks/TransferDuplicatePokemonTask.cs +++ b/PokemonGo.RocketBot.Logic/Tasks/TransferDuplicatePokemonTask.cs @@ -7,7 +7,6 @@ using PokemonGo.RocketBot.Logic.PoGoUtils; using PokemonGo.RocketBot.Logic.State; using PokemonGo.RocketBot.Logic.Utils; -using POGOProtos.Data; #endregion @@ -23,11 +22,11 @@ public static async Task Execute(ISession session, CancellationToken cancellatio await session.Inventory.GetDuplicatePokemonToTransfer( session.LogicSettings.PokemonsNotToTransfer, - session.LogicSettings.PokemonsToEvolve, + session.LogicSettings.PokemonsToEvolve, session.LogicSettings.KeepPokemonsThatCanEvolve, session.LogicSettings.PrioritizeIvOverCp); - var orderedPokemon = duplicatePokemons.OrderBy( poke => poke.Cp ); + var orderedPokemon = duplicatePokemons.OrderBy(poke => poke.Cp); var pokemonSettings = await session.Inventory.GetPokemonSettings(); var pokemonFamilies = await session.Inventory.GetPokemonFamilies(); diff --git a/PokemonGo.RocketBot.Logic/Tasks/TransferPokemonTask.cs b/PokemonGo.RocketBot.Logic/Tasks/TransferPokemonTask.cs index cfc4957a6..0a3e8b095 100644 --- a/PokemonGo.RocketBot.Logic/Tasks/TransferPokemonTask.cs +++ b/PokemonGo.RocketBot.Logic/Tasks/TransferPokemonTask.cs @@ -2,6 +2,8 @@ using System.Linq; using System.Threading.Tasks; +using PokemonGo.RocketBot.Logic.Event; +using PokemonGo.RocketBot.Logic.PoGoUtils; using PokemonGo.RocketBot.Logic.State; using PokemonGo.RocketBot.Logic.Utils; @@ -35,13 +37,13 @@ public static async Task Execute(ISession session, ulong pokemonId) family.Candy_++; // Broadcast event as everyone would benefit - session.EventDispatcher.Send(new Logic.Event.TransferPokemonEvent + session.EventDispatcher.Send(new TransferPokemonEvent { Id = pokemon.PokemonId, - Perfection = Logic.PoGoUtils.PokemonInfo.CalculatePokemonPerfection(pokemon), + Perfection = PokemonInfo.CalculatePokemonPerfection(pokemon), Cp = pokemon.Cp, BestCp = bestPokemonOfType.Cp, - BestPerfection = Logic.PoGoUtils.PokemonInfo.CalculatePokemonPerfection(bestPokemonOfType), + BestPerfection = PokemonInfo.CalculatePokemonPerfection(bestPokemonOfType), FamilyCandies = family.Candy_ }); diff --git a/PokemonGo.RocketBot.Logic/Tasks/TransferWeakPokemonTask.cs b/PokemonGo.RocketBot.Logic/Tasks/TransferWeakPokemonTask.cs index 99d901c66..9142885e6 100644 --- a/PokemonGo.RocketBot.Logic/Tasks/TransferWeakPokemonTask.cs +++ b/PokemonGo.RocketBot.Logic/Tasks/TransferWeakPokemonTask.cs @@ -7,8 +7,8 @@ using PokemonGo.RocketBot.Logic.Event; using PokemonGo.RocketBot.Logic.PoGoUtils; using PokemonGo.RocketBot.Logic.State; -using POGOProtos.Data; using PokemonGo.RocketBot.Logic.Utils; +using POGOProtos.Data; #endregion @@ -24,22 +24,23 @@ public static async Task Execute(ISession session, CancellationToken cancellatio var pokemonDatas = pokemons as IList ?? pokemons.ToList(); var pokemonsFiltered = pokemonDatas.Where(pokemon => !session.LogicSettings.PokemonsNotToTransfer.Contains(pokemon.PokemonId)) - .ToList().OrderBy( poke => poke.Cp ); + .ToList().OrderBy(poke => poke.Cp); if (session.LogicSettings.KeepPokemonsThatCanEvolve) pokemonsFiltered = pokemonDatas.Where(pokemon => !session.LogicSettings.PokemonsToEvolve.Contains(pokemon.PokemonId)) - .ToList().OrderBy( poke => poke.Cp ); + .ToList().OrderBy(poke => poke.Cp); - var orderedPokemon = pokemonsFiltered.OrderBy( poke => poke.Cp ); + var orderedPokemon = pokemonsFiltered.OrderBy(poke => poke.Cp); - foreach (var pokemon in orderedPokemon ) + foreach (var pokemon in orderedPokemon) { cancellationToken.ThrowIfCancellationRequested(); if ((pokemon.Cp >= session.LogicSettings.KeepMinCp) || (PokemonInfo.CalculatePokemonPerfection(pokemon) >= session.LogicSettings.KeepMinIvPercentage && session.LogicSettings.PrioritizeIvOverCp) || - (PokemonInfo.GetLevel(pokemon) >= session.LogicSettings.KeepMinLvl && session.LogicSettings.UseKeepMinLvl) || + (PokemonInfo.GetLevel(pokemon) >= session.LogicSettings.KeepMinLvl && + session.LogicSettings.UseKeepMinLvl) || pokemon.Favorite == 1) continue; diff --git a/PokemonGo.RocketBot.Logic/Tasks/UseIncenseConstantlyTask.cs b/PokemonGo.RocketBot.Logic/Tasks/UseIncenseConstantlyTask.cs index 64656ef04..1de760963 100644 --- a/PokemonGo.RocketBot.Logic/Tasks/UseIncenseConstantlyTask.cs +++ b/PokemonGo.RocketBot.Logic/Tasks/UseIncenseConstantlyTask.cs @@ -1,14 +1,14 @@ using System.Threading; using System.Threading.Tasks; -using POGOProtos.Inventory.Item; using PokemonGo.RocketBot.Logic.Common; using PokemonGo.RocketBot.Logic.Logging; -using POGOProtos.Networking.Responses; using PokemonGo.RocketBot.Logic.State; +using POGOProtos.Inventory.Item; +using POGOProtos.Networking.Responses; namespace PokemonGo.RocketBot.Logic.Tasks { - class UseIncenseConstantlyTask + internal class UseIncenseConstantlyTask { public static async Task Execute(ISession session, CancellationToken cancellationToken) { @@ -21,10 +21,7 @@ public static async Task Execute(ISession session, CancellationToken cancellatio Logger.Write(session.Translation.GetTranslation(TranslationString.NoIncenseAvailable)); return; } - else - { - Logger.Write(session.Translation.GetTranslation(TranslationString.UseIncenseAmount, currentAmountOfIncense)); - } + Logger.Write(session.Translation.GetTranslation(TranslationString.UseIncenseAmount, currentAmountOfIncense)); var UseIncense = await session.Inventory.UseIncenseConstantly(); @@ -36,10 +33,11 @@ public static async Task Execute(ISession session, CancellationToken cancellatio { Logger.Write(session.Translation.GetTranslation(TranslationString.NoIncenseAvailable)); } - else if (UseIncense.Result == UseIncenseResponse.Types.Result.IncenseAlreadyActive || (UseIncense.AppliedIncense == null)) + else if (UseIncense.Result == UseIncenseResponse.Types.Result.IncenseAlreadyActive || + (UseIncense.AppliedIncense == null)) { Logger.Write(session.Translation.GetTranslation(TranslationString.UseIncenseActive)); } } } -} +} \ No newline at end of file diff --git a/PokemonGo.RocketBot.Logic/Tasks/UseIncubatorsTask.cs b/PokemonGo.RocketBot.Logic/Tasks/UseIncubatorsTask.cs index 6cd6ec90d..8cb9021b2 100644 --- a/PokemonGo.RocketBot.Logic/Tasks/UseIncubatorsTask.cs +++ b/PokemonGo.RocketBot.Logic/Tasks/UseIncubatorsTask.cs @@ -74,7 +74,7 @@ public static async Task Execute(ISession session, CancellationToken cancellatio { // Unlimited incubators prefer short eggs, limited incubators prefer long eggs // Special case: If only one incubator is available at all, it will prefer long eggs - var egg = (incubator.ItemId == ItemId.ItemIncubatorBasicUnlimited && incubators.Count > 1) + var egg = incubator.ItemId == ItemId.ItemIncubatorBasicUnlimited && incubators.Count > 1 ? unusedEggs.FirstOrDefault() : unusedEggs.LastOrDefault(); diff --git a/PokemonGo.RocketBot.Logic/Tasks/UseLuckyEggConstantlyTask.cs b/PokemonGo.RocketBot.Logic/Tasks/UseLuckyEggConstantlyTask.cs index 12758ff4e..426f4bb42 100644 --- a/PokemonGo.RocketBot.Logic/Tasks/UseLuckyEggConstantlyTask.cs +++ b/PokemonGo.RocketBot.Logic/Tasks/UseLuckyEggConstantlyTask.cs @@ -1,14 +1,14 @@ using System.Threading; using System.Threading.Tasks; +using PokemonGo.RocketBot.Logic.Common; +using PokemonGo.RocketBot.Logic.Logging; using PokemonGo.RocketBot.Logic.State; using POGOProtos.Inventory.Item; -using PokemonGo.RocketBot.Logic.Logging; -using PokemonGo.RocketBot.Logic.Common; using POGOProtos.Networking.Responses; namespace PokemonGo.RocketBot.Logic.Tasks { - class UseLuckyEggConstantlyTask + internal class UseLuckyEggConstantlyTask { public static async Task Execute(ISession session, CancellationToken cancellationToken) { @@ -21,10 +21,8 @@ public static async Task Execute(ISession session, CancellationToken cancellatio Logger.Write(session.Translation.GetTranslation(TranslationString.NoEggsAvailable)); return; } - else - { - Logger.Write(session.Translation.GetTranslation(TranslationString.UseLuckyEggAmount, currentAmountOfLuckyEggs)); - } + Logger.Write(session.Translation.GetTranslation(TranslationString.UseLuckyEggAmount, + currentAmountOfLuckyEggs)); var UseEgg = await session.Inventory.UseLuckyEggConstantly(); @@ -36,11 +34,11 @@ public static async Task Execute(ISession session, CancellationToken cancellatio { Logger.Write(session.Translation.GetTranslation(TranslationString.NoEggsAvailable)); } - else if (UseEgg.Result == UseItemXpBoostResponse.Types.Result.ErrorXpBoostAlreadyActive || (UseEgg.AppliedItems == null)) + else if (UseEgg.Result == UseItemXpBoostResponse.Types.Result.ErrorXpBoostAlreadyActive || + (UseEgg.AppliedItems == null)) { Logger.Write(session.Translation.GetTranslation(TranslationString.UseLuckyEggActive)); } } - } -} +} \ No newline at end of file diff --git a/PokemonGo.RocketBot.Logic/Tasks/UseNearbyPokestopsTask.cs b/PokemonGo.RocketBot.Logic/Tasks/UseNearbyPokestopsTask.cs index 2019e8031..1c3a56335 100644 --- a/PokemonGo.RocketBot.Logic/Tasks/UseNearbyPokestopsTask.cs +++ b/PokemonGo.RocketBot.Logic/Tasks/UseNearbyPokestopsTask.cs @@ -5,10 +5,10 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; +using PokemonGo.RocketAPI.Extensions; using PokemonGo.RocketBot.Logic.Event; using PokemonGo.RocketBot.Logic.State; using PokemonGo.RocketBot.Logic.Utils; -using PokemonGo.RocketAPI.Extensions; using POGOProtos.Map.Fort; #endregion diff --git a/PokemonGo.RocketBot.Logic/Utils/DeviceInfoHelper.cs b/PokemonGo.RocketBot.Logic/Utils/DeviceInfoHelper.cs index 019bbf3fe..17a374c03 100644 --- a/PokemonGo.RocketBot.Logic/Utils/DeviceInfoHelper.cs +++ b/PokemonGo.RocketBot.Logic/Utils/DeviceInfoHelper.cs @@ -1,483 +1,512 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Collections.Generic; namespace PokemonGo.RocketBot.Logic.Utils { public static class DeviceInfoHelper { - public static Dictionary> DeviceInfoSets = new Dictionary>() { - { "lg-optimus-g", - new Dictionary() + public static Dictionary> DeviceInfoSets = new Dictionary + > + { + { + "lg-optimus-g", + new Dictionary { - { "AndroidBoardName", "geehrc" }, - { "AndroidBootloader", "MAKOZ10f" }, - { "DeviceBrand", "LGE" }, - { "DeviceId", "8525f5d8201f78b5" }, - { "DeviceModel", "LG-LS970" }, - { "DeviceModelBoot", "qcom" }, - { "DeviceModelIdentifier", "cm_ls970" }, - { "FirmwareBrand", "cm_ls970" }, - { "FirmwareFingerprint", "google/occam/mako:4.2.2/JDQ39/573038:user/release-keys" }, - { "FirmwareTags", "test-keys" }, - { "FirmwareType", "userdebug" }, - { "HardwareManufacturer", "LGE" }, - { "HardwareModel", "LG-LS970" } + {"AndroidBoardName", "geehrc"}, + {"AndroidBootloader", "MAKOZ10f"}, + {"DeviceBrand", "LGE"}, + {"DeviceId", "8525f5d8201f78b5"}, + {"DeviceModel", "LG-LS970"}, + {"DeviceModelBoot", "qcom"}, + {"DeviceModelIdentifier", "cm_ls970"}, + {"FirmwareBrand", "cm_ls970"}, + {"FirmwareFingerprint", "google/occam/mako:4.2.2/JDQ39/573038:user/release-keys"}, + {"FirmwareTags", "test-keys"}, + {"FirmwareType", "userdebug"}, + {"HardwareManufacturer", "LGE"}, + {"HardwareModel", "LG-LS970"} } }, - { "nexus7gen2", - new Dictionary() + { + "nexus7gen2", + new Dictionary { - { "AndroidBoardName", "flo" }, - { "AndroidBootloader", "FLO-04.07" }, - { "DeviceBrand", "google" }, - { "DeviceId", "8525f5d8201f78b5" }, - { "DeviceModel", "Nexus 7" }, - { "DeviceModelBoot", "qcom" }, - { "DeviceModelIdentifier", "razor" }, - { "FirmwareBrand", "razor" }, - { "FirmwareFingerprint", "google/razor/flo:6.0.1/MOB30P/2960889:user/release-keys" }, - { "FirmwareTags", "release-keys" }, - { "FirmwareType", "user" }, - { "HardwareManufacturer", "asus" }, - { "HardwareModel", "Nexus 7" } + {"AndroidBoardName", "flo"}, + {"AndroidBootloader", "FLO-04.07"}, + {"DeviceBrand", "google"}, + {"DeviceId", "8525f5d8201f78b5"}, + {"DeviceModel", "Nexus 7"}, + {"DeviceModelBoot", "qcom"}, + {"DeviceModelIdentifier", "razor"}, + {"FirmwareBrand", "razor"}, + {"FirmwareFingerprint", "google/razor/flo:6.0.1/MOB30P/2960889:user/release-keys"}, + {"FirmwareTags", "release-keys"}, + {"FirmwareType", "user"}, + {"HardwareManufacturer", "asus"}, + {"HardwareModel", "Nexus 7"} } }, - { "nexus7gen1", - new Dictionary() + { + "nexus7gen1", + new Dictionary { - { "AndroidBoardName", "grouper" }, - { "AndroidBootloader", "4.23" }, - { "DeviceBrand", "google" }, - { "DeviceId", "8525f5d8201f78b5" }, - { "DeviceModel", "Nexus 7" }, - { "DeviceModelBoot", "qcom" }, - { "DeviceModelIdentifier", "nakasi" }, - { "FirmwareBrand", "nakasi" }, - { "FirmwareFingerprint", "google/nakasi/grouper:5.1.1/LMY47V/1836172:user/release-keys" }, - { "FirmwareTags", "release-keys" }, - { "FirmwareType", "user" }, - { "HardwareManufacturer", "asus" }, - { "HardwareModel", "Nexus 7" } + {"AndroidBoardName", "grouper"}, + {"AndroidBootloader", "4.23"}, + {"DeviceBrand", "google"}, + {"DeviceId", "8525f5d8201f78b5"}, + {"DeviceModel", "Nexus 7"}, + {"DeviceModelBoot", "qcom"}, + {"DeviceModelIdentifier", "nakasi"}, + {"FirmwareBrand", "nakasi"}, + {"FirmwareFingerprint", "google/nakasi/grouper:5.1.1/LMY47V/1836172:user/release-keys"}, + {"FirmwareTags", "release-keys"}, + {"FirmwareType", "user"}, + {"HardwareManufacturer", "asus"}, + {"HardwareModel", "Nexus 7"} } }, - { "htc10", - new Dictionary() + { + "htc10", + new Dictionary { - { "AndroidBoardName", "msm8996" }, - { "AndroidBootloader", "1.0.0.0000" }, - { "DeviceBrand", "HTC" }, - { "DeviceId", "8525f5d8201f78b5" }, - { "DeviceModel", "HTC 10" }, - { "DeviceModelBoot", "qcom" }, - { "DeviceModelIdentifier", "pmewl_00531" }, - { "FirmwareBrand", "pmewl_00531" }, - { "FirmwareFingerprint", "htc/pmewl_00531/htc_pmewl:6.0.1/MMB29M/770927.1:user/release-keys" }, - { "FirmwareTags", "release-keys" }, - { "FirmwareType", "user" }, - { "HardwareManufacturer", "HTC" }, - { "HardwareModel", "HTC 10" } + {"AndroidBoardName", "msm8996"}, + {"AndroidBootloader", "1.0.0.0000"}, + {"DeviceBrand", "HTC"}, + {"DeviceId", "8525f5d8201f78b5"}, + {"DeviceModel", "HTC 10"}, + {"DeviceModelBoot", "qcom"}, + {"DeviceModelIdentifier", "pmewl_00531"}, + {"FirmwareBrand", "pmewl_00531"}, + {"FirmwareFingerprint", "htc/pmewl_00531/htc_pmewl:6.0.1/MMB29M/770927.1:user/release-keys"}, + {"FirmwareTags", "release-keys"}, + {"FirmwareType", "user"}, + {"HardwareManufacturer", "HTC"}, + {"HardwareModel", "HTC 10"} } }, - { "galaxy6", - new Dictionary() + { + "galaxy6", + new Dictionary { - { "AndroidBoardName", "universal7420" }, - { "AndroidBootloader", "G920FXXU3DPEK" }, - { "DeviceBrand", "samsung" }, - { "DeviceId", "8525f5d8201f78b5" }, - { "DeviceModel", "zeroflte" }, - { "DeviceModelBoot", "qcom" }, - { "DeviceModelIdentifier", "SM-G920F" }, - { "FirmwareBrand", "zerofltexx" }, - { "FirmwareFingerprint", "samsung/zerofltexx/zeroflte:6.0.1/MMB29K/G920FXXU3DPEK:user/release-keys" }, - { "FirmwareTags", "dev-keys" }, - { "FirmwareType", "user" }, - { "HardwareManufacturer", "samsung" }, - { "HardwareModel", "samsungexynos7420" } + {"AndroidBoardName", "universal7420"}, + {"AndroidBootloader", "G920FXXU3DPEK"}, + {"DeviceBrand", "samsung"}, + {"DeviceId", "8525f5d8201f78b5"}, + {"DeviceModel", "zeroflte"}, + {"DeviceModelBoot", "qcom"}, + {"DeviceModelIdentifier", "SM-G920F"}, + {"FirmwareBrand", "zerofltexx"}, + {"FirmwareFingerprint", "samsung/zerofltexx/zeroflte:6.0.1/MMB29K/G920FXXU3DPEK:user/release-keys"}, + {"FirmwareTags", "dev-keys"}, + {"FirmwareType", "user"}, + {"HardwareManufacturer", "samsung"}, + {"HardwareModel", "samsungexynos7420"} } }, - { "galaxy-s5-gold", - new Dictionary() + { + "galaxy-s5-gold", + new Dictionary { - { "AndroidBoardName", "MSM8974" }, - { "AndroidBootloader", "G900FXXU1CPEH" }, - { "DeviceBrand", "samsung" }, - { "DeviceId", "8525f5d8201f78b5" }, - { "DeviceModel", "SM-G900F" }, - { "DeviceModelBoot", "qcom" }, - { "DeviceModelIdentifier", "kltexx" }, - { "FirmwareBrand", "kltexx" }, - { "FirmwareFingerprint", "samsung/kltexx/klte:6.0.1/MMB29M/G900FXXU1CPEH:user/release-keys" }, - { "FirmwareTags", "release-keys" }, - { "FirmwareType", "user" }, - { "HardwareManufacturer", "samsung" }, - { "HardwareModel", "SM-G900F" } + {"AndroidBoardName", "MSM8974"}, + {"AndroidBootloader", "G900FXXU1CPEH"}, + {"DeviceBrand", "samsung"}, + {"DeviceId", "8525f5d8201f78b5"}, + {"DeviceModel", "SM-G900F"}, + {"DeviceModelBoot", "qcom"}, + {"DeviceModelIdentifier", "kltexx"}, + {"FirmwareBrand", "kltexx"}, + {"FirmwareFingerprint", "samsung/kltexx/klte:6.0.1/MMB29M/G900FXXU1CPEH:user/release-keys"}, + {"FirmwareTags", "release-keys"}, + {"FirmwareType", "user"}, + {"HardwareManufacturer", "samsung"}, + {"HardwareModel", "SM-G900F"} } }, - { "lg-optimus-f6", - new Dictionary() + { + "lg-optimus-f6", + new Dictionary { - { "AndroidBoardName", "f6t" }, - { "AndroidBootloader", "1.0.0.0000" }, - { "DeviceBrand", "lge" }, - { "DeviceId", "8525f5d8201f78b5" }, - { "DeviceModel", "LG-D500" }, - { "DeviceModelBoot", "qcom" }, - { "DeviceModelIdentifier", "f6_tmo_us" }, - { "FirmwareBrand", "f6_tmo_us" }, - { "FirmwareFingerprint", "lge/f6_tmo_us/f6:4.1.2/JZO54K/D50010h.1384764249:user/release-keys" }, - { "FirmwareTags", "release-keys" }, - { "FirmwareType", "user" }, - { "HardwareManufacturer", "LGE" }, - { "HardwareModel", "LG-D500" } + {"AndroidBoardName", "f6t"}, + {"AndroidBootloader", "1.0.0.0000"}, + {"DeviceBrand", "lge"}, + {"DeviceId", "8525f5d8201f78b5"}, + {"DeviceModel", "LG-D500"}, + {"DeviceModelBoot", "qcom"}, + {"DeviceModelIdentifier", "f6_tmo_us"}, + {"FirmwareBrand", "f6_tmo_us"}, + {"FirmwareFingerprint", "lge/f6_tmo_us/f6:4.1.2/JZO54K/D50010h.1384764249:user/release-keys"}, + {"FirmwareTags", "release-keys"}, + {"FirmwareType", "user"}, + {"HardwareManufacturer", "LGE"}, + {"HardwareModel", "LG-D500"} } }, - { "nexus-5x", - new Dictionary() + { + "nexus-5x", + new Dictionary { - { "AndroidBoardName", "bullhead" }, - { "AndroidBootloader", "BHZ10k" }, - { "DeviceBrand", "google" }, - { "DeviceId", "8525f5d8201f78b5" }, - { "DeviceModel", "Nexus 5X" }, - { "DeviceModelBoot", "qcom" }, - { "DeviceModelIdentifier", "bullhead" }, - { "FirmwareBrand", "bullhead" }, - { "FirmwareFingerprint", "google/bullhead/bullhead:6.0.1/MTC19T/2741993:user/release-keys" }, - { "FirmwareTags", "release-keys" }, - { "FirmwareType", "user" }, - { "HardwareManufacturer", "LGE" }, - { "HardwareModel", "Nexus 5X" } + {"AndroidBoardName", "bullhead"}, + {"AndroidBootloader", "BHZ10k"}, + {"DeviceBrand", "google"}, + {"DeviceId", "8525f5d8201f78b5"}, + {"DeviceModel", "Nexus 5X"}, + {"DeviceModelBoot", "qcom"}, + {"DeviceModelIdentifier", "bullhead"}, + {"FirmwareBrand", "bullhead"}, + {"FirmwareFingerprint", "google/bullhead/bullhead:6.0.1/MTC19T/2741993:user/release-keys"}, + {"FirmwareTags", "release-keys"}, + {"FirmwareType", "user"}, + {"HardwareManufacturer", "LGE"}, + {"HardwareModel", "Nexus 5X"} } }, - { "galaxy-s7-edge", - new Dictionary() + { + "galaxy-s7-edge", + new Dictionary { - { "AndroidBoardName", "msm8996" }, - { "AndroidBootloader", "G935TUVU3APG1" }, - { "DeviceBrand", "samsung" }, - { "DeviceId", "8525f5d8201f78b5" }, - { "DeviceModel", "SM-G935T" }, - { "DeviceModelBoot", "qcom" }, - { "DeviceModelIdentifier", "hero2qltetmo" }, - { "FirmwareBrand", "hero2qltetmo" }, - { "FirmwareFingerprint", "samsung/hero2qltetmo/hero2qltetmo:6.0.1/MMB29M/G935TUVU3APG1:user/release-keys" }, - { "FirmwareTags", "release-keys" }, - { "FirmwareType", "user" }, - { "HardwareManufacturer", "samsung" }, - { "HardwareModel", "SM-G935T" } + {"AndroidBoardName", "msm8996"}, + {"AndroidBootloader", "G935TUVU3APG1"}, + {"DeviceBrand", "samsung"}, + {"DeviceId", "8525f5d8201f78b5"}, + {"DeviceModel", "SM-G935T"}, + {"DeviceModelBoot", "qcom"}, + {"DeviceModelIdentifier", "hero2qltetmo"}, + {"FirmwareBrand", "hero2qltetmo"}, + { + "FirmwareFingerprint", + "samsung/hero2qltetmo/hero2qltetmo:6.0.1/MMB29M/G935TUVU3APG1:user/release-keys" + }, + {"FirmwareTags", "release-keys"}, + {"FirmwareType", "user"}, + {"HardwareManufacturer", "samsung"}, + {"HardwareModel", "SM-G935T"} } }, - { "asus-zenfone2", - new Dictionary() + { + "asus-zenfone2", + new Dictionary { - { "AndroidBoardName", "moorefield" }, - { "AndroidBootloader", "" }, - { "DeviceBrand", "asus" }, - { "DeviceId", "8525f5d8201f78b5" }, - { "DeviceModel", "ASUS_Z00AD" }, - { "DeviceModelBoot", "qcom" }, - { "DeviceModelIdentifier", "WW_Z00A" }, - { "FirmwareBrand", "WW_Z00A" }, - { "FirmwareFingerprint", "asus/WW_Z00A/Z00A_1:5.0/LRX21V/2.20.40.194_20160713_6971_user:user/release-keys" }, - { "FirmwareTags", "release-keys" }, - { "FirmwareType", "user" }, - { "HardwareManufacturer", "asus" }, - { "HardwareModel", "ASUS_Z00AD" } + {"AndroidBoardName", "moorefield"}, + {"AndroidBootloader", ""}, + {"DeviceBrand", "asus"}, + {"DeviceId", "8525f5d8201f78b5"}, + {"DeviceModel", "ASUS_Z00AD"}, + {"DeviceModelBoot", "qcom"}, + {"DeviceModelIdentifier", "WW_Z00A"}, + {"FirmwareBrand", "WW_Z00A"}, + { + "FirmwareFingerprint", + "asus/WW_Z00A/Z00A_1:5.0/LRX21V/2.20.40.194_20160713_6971_user:user/release-keys" + }, + {"FirmwareTags", "release-keys"}, + {"FirmwareType", "user"}, + {"HardwareManufacturer", "asus"}, + {"HardwareModel", "ASUS_Z00AD"} } }, - { "xperia-z5", - new Dictionary() + { + "xperia-z5", + new Dictionary { - { "AndroidBoardName", "msm8994" }, - { "AndroidBootloader", "s1" }, - { "DeviceBrand", "Sony" }, - { "DeviceId", "8525f5d8201f78b5" }, - { "DeviceModel", "E6653" }, - { "DeviceModelBoot", "qcom" }, - { "DeviceModelIdentifier", "E6653" }, - { "FirmwareBrand", "E6653" }, - { "FirmwareFingerprint", "Sony/E6653/E6653:6.0.1/32.2.A.0.224/456768306:user/release-keys" }, - { "FirmwareTags", "release-keys" }, - { "FirmwareType", "user" }, - { "HardwareManufacturer", "Sony" }, - { "HardwareModel", "E6653" } + {"AndroidBoardName", "msm8994"}, + {"AndroidBootloader", "s1"}, + {"DeviceBrand", "Sony"}, + {"DeviceId", "8525f5d8201f78b5"}, + {"DeviceModel", "E6653"}, + {"DeviceModelBoot", "qcom"}, + {"DeviceModelIdentifier", "E6653"}, + {"FirmwareBrand", "E6653"}, + {"FirmwareFingerprint", "Sony/E6653/E6653:6.0.1/32.2.A.0.224/456768306:user/release-keys"}, + {"FirmwareTags", "release-keys"}, + {"FirmwareType", "user"}, + {"HardwareManufacturer", "Sony"}, + {"HardwareModel", "E6653"} } }, - { "galaxy-s4", - new Dictionary() + { + "galaxy-s4", + new Dictionary { - { "AndroidBoardName", "MSM8960" }, - { "AndroidBootloader", "I337MVLUGOH1" }, - { "DeviceBrand", "samsung" }, - { "DeviceId", "8525f5d8201f78b5" }, - { "DeviceModel", "SGH-I337M" }, - { "DeviceModelBoot", "qcom" }, - { "DeviceModelIdentifier", "jfltevl" }, - { "FirmwareBrand", "jfltevl" }, - { "FirmwareFingerprint", "samsung/jfltevl/jfltecan:5.0.1/LRX22C/I337MVLUGOH1:user/release-keys" }, - { "FirmwareTags", "release-keys" }, - { "FirmwareType", "user" }, - { "HardwareManufacturer", "samsung" }, - { "HardwareModel", "SGH-I337M" } + {"AndroidBoardName", "MSM8960"}, + {"AndroidBootloader", "I337MVLUGOH1"}, + {"DeviceBrand", "samsung"}, + {"DeviceId", "8525f5d8201f78b5"}, + {"DeviceModel", "SGH-I337M"}, + {"DeviceModelBoot", "qcom"}, + {"DeviceModelIdentifier", "jfltevl"}, + {"FirmwareBrand", "jfltevl"}, + {"FirmwareFingerprint", "samsung/jfltevl/jfltecan:5.0.1/LRX22C/I337MVLUGOH1:user/release-keys"}, + {"FirmwareTags", "release-keys"}, + {"FirmwareType", "user"}, + {"HardwareManufacturer", "samsung"}, + {"HardwareModel", "SGH-I337M"} } }, - { "nexus-6p", - new Dictionary() + { + "nexus-6p", + new Dictionary { - { "AndroidBoardName", "angler" }, - { "AndroidBootloader", "angler-03.52" }, - { "DeviceBrand", "google" }, - { "DeviceId", "8525f5d8201f78b5" }, - { "DeviceModel", "Nexus 6P" }, - { "DeviceModelBoot", "qcom" }, - { "DeviceModelIdentifier", "angler" }, - { "FirmwareBrand", "angler" }, - { "FirmwareFingerprint", "google/angler/angler:6.0.1/MTC19X/2960136:user/release-keys" }, - { "FirmwareTags", "release-keys" }, - { "FirmwareType", "user" }, - { "HardwareManufacturer", "Huawei" }, - { "HardwareModel", "Nexus 6P" } + {"AndroidBoardName", "angler"}, + {"AndroidBootloader", "angler-03.52"}, + {"DeviceBrand", "google"}, + {"DeviceId", "8525f5d8201f78b5"}, + {"DeviceModel", "Nexus 6P"}, + {"DeviceModelBoot", "qcom"}, + {"DeviceModelIdentifier", "angler"}, + {"FirmwareBrand", "angler"}, + {"FirmwareFingerprint", "google/angler/angler:6.0.1/MTC19X/2960136:user/release-keys"}, + {"FirmwareTags", "release-keys"}, + {"FirmwareType", "user"}, + {"HardwareManufacturer", "Huawei"}, + {"HardwareModel", "Nexus 6P"} } }, - { "sony-z3-compact", - new Dictionary() + { + "sony-z3-compact", + new Dictionary { - { "AndroidBoardName", "MSM8974" }, - { "AndroidBootloader", "s1" }, - { "DeviceBrand", "docomo" }, - { "DeviceId", "8525f5d8201f78b5" }, - { "DeviceModel", "SO-02G" }, - { "DeviceModelBoot", "qcom" }, - { "DeviceModelIdentifier", "SO-02G" }, - { "FirmwareBrand", "SO-02G" }, - { "FirmwareFingerprint", "docomo/SO-02G/SO-02G:5.0.2/23.1.B.1.317/2161656255:user/release-keys" }, - { "FirmwareTags", "release-keys" }, - { "FirmwareType", "user" }, - { "HardwareManufacturer", "Sony" }, - { "HardwareModel", "SO-02G" } + {"AndroidBoardName", "MSM8974"}, + {"AndroidBootloader", "s1"}, + {"DeviceBrand", "docomo"}, + {"DeviceId", "8525f5d8201f78b5"}, + {"DeviceModel", "SO-02G"}, + {"DeviceModelBoot", "qcom"}, + {"DeviceModelIdentifier", "SO-02G"}, + {"FirmwareBrand", "SO-02G"}, + {"FirmwareFingerprint", "docomo/SO-02G/SO-02G:5.0.2/23.1.B.1.317/2161656255:user/release-keys"}, + {"FirmwareTags", "release-keys"}, + {"FirmwareType", "user"}, + {"HardwareManufacturer", "Sony"}, + {"HardwareModel", "SO-02G"} } }, - { "lg-v10", - new Dictionary() + { + "lg-v10", + new Dictionary { - { "AndroidBoardName", "MSM8992" }, - { "AndroidBootloader", "" }, - { "DeviceBrand", "LG" }, - { "DeviceId", "8525f5d8201f78b5" }, - { "DeviceModel", "V10" }, - { "DeviceModelBoot", "qcom" }, - { "DeviceModelIdentifier", "pplus" }, - { "FirmwareBrand", "pplus" }, - { "FirmwareFingerprint", "LG/pplus/pplus:5.1.1/LYZ28J/kasp3rd02071120:eng/test-keys" }, - { "FirmwareTags", "test-keys" }, - { "FirmwareType", "eng" }, - { "HardwareManufacturer", "LG" }, - { "HardwareModel", "V10" } + {"AndroidBoardName", "MSM8992"}, + {"AndroidBootloader", ""}, + {"DeviceBrand", "LG"}, + {"DeviceId", "8525f5d8201f78b5"}, + {"DeviceModel", "V10"}, + {"DeviceModelBoot", "qcom"}, + {"DeviceModelIdentifier", "pplus"}, + {"FirmwareBrand", "pplus"}, + {"FirmwareFingerprint", "LG/pplus/pplus:5.1.1/LYZ28J/kasp3rd02071120:eng/test-keys"}, + {"FirmwareTags", "test-keys"}, + {"FirmwareType", "eng"}, + {"HardwareManufacturer", "LG"}, + {"HardwareModel", "V10"} } }, - { "galaxy-tab3", - new Dictionary() + { + "galaxy-tab3", + new Dictionary { - { "AndroidBoardName", "smdk4x12" }, - { "AndroidBootloader", "T310UEUCOI1" }, - { "DeviceBrand", "samsung" }, - { "DeviceId", "8525f5d8201f78b5" }, - { "DeviceModel", "SM-T310" }, - { "DeviceModelBoot", "qcom" }, - { "DeviceModelIdentifier", "lt01wifiue" }, - { "FirmwareBrand", "lt01wifiue" }, - { "FirmwareFingerprint", "samsung/lt01wifiue/lt01wifi:4.4.2/KOT49H/T310UEUCOI1:user/release-keys" }, - { "FirmwareTags", "release-keys" }, - { "FirmwareType", "user" }, - { "HardwareManufacturer", "samsung" }, - { "HardwareModel", "SM-T310" } + {"AndroidBoardName", "smdk4x12"}, + {"AndroidBootloader", "T310UEUCOI1"}, + {"DeviceBrand", "samsung"}, + {"DeviceId", "8525f5d8201f78b5"}, + {"DeviceModel", "SM-T310"}, + {"DeviceModelBoot", "qcom"}, + {"DeviceModelIdentifier", "lt01wifiue"}, + {"FirmwareBrand", "lt01wifiue"}, + {"FirmwareFingerprint", "samsung/lt01wifiue/lt01wifi:4.4.2/KOT49H/T310UEUCOI1:user/release-keys"}, + {"FirmwareTags", "release-keys"}, + {"FirmwareType", "user"}, + {"HardwareManufacturer", "samsung"}, + {"HardwareModel", "SM-T310"} } }, - { "lg-g4", - new Dictionary() + { + "lg-g4", + new Dictionary { - { "AndroidBoardName", "msm8992" }, - { "AndroidBootloader", "" }, - { "DeviceBrand", "lge" }, - { "DeviceId", "8525f5d8201f78b5" }, - { "DeviceModel", "VS986" }, - { "DeviceModelBoot", "qcom" }, - { "DeviceModelIdentifier", "p1_vzw" }, - { "FirmwareBrand", "p1_vzw" }, - { "FirmwareFingerprint", "lge/p1_vzw/p1:5.1/LMY47D/151541507ff1b:user/release-keys" }, - { "FirmwareTags", "release-keys" }, - { "FirmwareType", "user" }, - { "HardwareManufacturer", "LGE" }, - { "HardwareModel", "VS986" } + {"AndroidBoardName", "msm8992"}, + {"AndroidBootloader", ""}, + {"DeviceBrand", "lge"}, + {"DeviceId", "8525f5d8201f78b5"}, + {"DeviceModel", "VS986"}, + {"DeviceModelBoot", "qcom"}, + {"DeviceModelIdentifier", "p1_vzw"}, + {"FirmwareBrand", "p1_vzw"}, + {"FirmwareFingerprint", "lge/p1_vzw/p1:5.1/LMY47D/151541507ff1b:user/release-keys"}, + {"FirmwareTags", "release-keys"}, + {"FirmwareType", "user"}, + {"HardwareManufacturer", "LGE"}, + {"HardwareModel", "VS986"} } }, - { "nexus5", - new Dictionary() + { + "nexus5", + new Dictionary { - { "AndroidBoardName", "hammerhead" }, - { "AndroidBootloader", "HHZ20b" }, - { "DeviceBrand", "google" }, - { "DeviceId", "8525f5d8201f78b5" }, - { "DeviceModel", "Nexus 5" }, - { "DeviceModelBoot", "qcom" }, - { "DeviceModelIdentifier", "hammerhead" }, - { "FirmwareBrand", "hammerhead" }, - { "FirmwareFingerprint", "google/hammerhead/hammerhead:6.0.1/MOB30M/2862625:user/release-keys" }, - { "FirmwareTags", "release-keys" }, - { "FirmwareType", "user" }, - { "HardwareManufacturer", "LGE" }, - { "HardwareModel", "Nexus 5" } + {"AndroidBoardName", "hammerhead"}, + {"AndroidBootloader", "HHZ20b"}, + {"DeviceBrand", "google"}, + {"DeviceId", "8525f5d8201f78b5"}, + {"DeviceModel", "Nexus 5"}, + {"DeviceModelBoot", "qcom"}, + {"DeviceModelIdentifier", "hammerhead"}, + {"FirmwareBrand", "hammerhead"}, + {"FirmwareFingerprint", "google/hammerhead/hammerhead:6.0.1/MOB30M/2862625:user/release-keys"}, + {"FirmwareTags", "release-keys"}, + {"FirmwareType", "user"}, + {"HardwareManufacturer", "LGE"}, + {"HardwareModel", "Nexus 5"} } }, - { "xoom", - new Dictionary() + { + "xoom", + new Dictionary { - { "AndroidBoardName", "" }, - { "AndroidBootloader", "1050" }, - { "DeviceBrand", "motorola" }, - { "DeviceId", "8525f5d8201f78b5" }, - { "DeviceModel", "Xoom" }, - { "DeviceModelBoot", "qcom" }, - { "DeviceModelIdentifier", "tervigon" }, - { "FirmwareBrand", "tervigon" }, - { "FirmwareFingerprint", "motorola/tervigon/wingray:4.1.2/JZO54K/485486:user/release-keys" }, - { "FirmwareTags", "test-keys" }, - { "FirmwareType", "userdebug" }, - { "HardwareManufacturer", "Motorola" }, - { "HardwareModel", "Xoom" } + {"AndroidBoardName", ""}, + {"AndroidBootloader", "1050"}, + {"DeviceBrand", "motorola"}, + {"DeviceId", "8525f5d8201f78b5"}, + {"DeviceModel", "Xoom"}, + {"DeviceModelBoot", "qcom"}, + {"DeviceModelIdentifier", "tervigon"}, + {"FirmwareBrand", "tervigon"}, + {"FirmwareFingerprint", "motorola/tervigon/wingray:4.1.2/JZO54K/485486:user/release-keys"}, + {"FirmwareTags", "test-keys"}, + {"FirmwareType", "userdebug"}, + {"HardwareManufacturer", "Motorola"}, + {"HardwareModel", "Xoom"} } }, - { "galaxy-note-edge", - new Dictionary() + { + "galaxy-note-edge", + new Dictionary { - { "AndroidBoardName", "APQ8084" }, - { "AndroidBootloader", "N915W8VLU1CPE2" }, - { "DeviceBrand", "samsung" }, - { "DeviceId", "8525f5d8201f78b5" }, - { "DeviceModel", "SM-N915W8" }, - { "DeviceModelBoot", "qcom" }, - { "DeviceModelIdentifier", "tbltecan" }, - { "FirmwareBrand", "tbltecan" }, - { "FirmwareFingerprint", "samsung/tbltecan/tbltecan:6.0.1/MMB29M/N915W8VLU1CPE2:user/release-keys" }, - { "FirmwareTags", "release-keys" }, - { "FirmwareType", "user" }, - { "HardwareManufacturer", "samsung" }, - { "HardwareModel", "SM-N915W8" } + {"AndroidBoardName", "APQ8084"}, + {"AndroidBootloader", "N915W8VLU1CPE2"}, + {"DeviceBrand", "samsung"}, + {"DeviceId", "8525f5d8201f78b5"}, + {"DeviceModel", "SM-N915W8"}, + {"DeviceModelBoot", "qcom"}, + {"DeviceModelIdentifier", "tbltecan"}, + {"FirmwareBrand", "tbltecan"}, + {"FirmwareFingerprint", "samsung/tbltecan/tbltecan:6.0.1/MMB29M/N915W8VLU1CPE2:user/release-keys"}, + {"FirmwareTags", "release-keys"}, + {"FirmwareType", "user"}, + {"HardwareManufacturer", "samsung"}, + {"HardwareModel", "SM-N915W8"} } }, - { "amazon-fire-cm12", - new Dictionary() + { + "amazon-fire-cm12", + new Dictionary { - { "AndroidBoardName", "ford" }, - { "AndroidBootloader", "" }, - { "DeviceBrand", "google" }, - { "DeviceId", "8525f5d8201f78b5" }, - { "DeviceModel", "KFFOWI" }, - { "DeviceModelBoot", "qcom" }, - { "DeviceModelIdentifier", "cm_ford" }, - { "FirmwareBrand", "cm_ford" }, - { "FirmwareFingerprint", "google/cm_ford/ford:5.1.1/LMY48Y/ba503d5e70:userdebug/test-keys" }, - { "FirmwareTags", "test-keys" }, - { "FirmwareType", "userdebug" }, - { "HardwareManufacturer", "amzn" }, - { "HardwareModel", "KFFOWI" } + {"AndroidBoardName", "ford"}, + {"AndroidBootloader", ""}, + {"DeviceBrand", "google"}, + {"DeviceId", "8525f5d8201f78b5"}, + {"DeviceModel", "KFFOWI"}, + {"DeviceModelBoot", "qcom"}, + {"DeviceModelIdentifier", "cm_ford"}, + {"FirmwareBrand", "cm_ford"}, + {"FirmwareFingerprint", "google/cm_ford/ford:5.1.1/LMY48Y/ba503d5e70:userdebug/test-keys"}, + {"FirmwareTags", "test-keys"}, + {"FirmwareType", "userdebug"}, + {"HardwareManufacturer", "amzn"}, + {"HardwareModel", "KFFOWI"} } }, - { "nexus4-chroma", - new Dictionary() + { + "nexus4-chroma", + new Dictionary { - { "AndroidBoardName", "MAKO" }, - { "AndroidBootloader", "MAKOZ30f" }, - { "DeviceBrand", "google" }, - { "DeviceId", "8525f5d8201f78b5" }, - { "DeviceModel", "Nexus 4" }, - { "DeviceModelBoot", "qcom" }, - { "DeviceModelIdentifier", "occam" }, - { "FirmwareBrand", "occam" }, - { "FirmwareFingerprint", "google/occam/mako:6.0.1/MOB30Y/3067468:user/release-keys" }, - { "FirmwareTags", "test-keys" }, - { "FirmwareType", "userdebug" }, - { "HardwareManufacturer", "LGE" }, - { "HardwareModel", "Nexus 4" } + {"AndroidBoardName", "MAKO"}, + {"AndroidBootloader", "MAKOZ30f"}, + {"DeviceBrand", "google"}, + {"DeviceId", "8525f5d8201f78b5"}, + {"DeviceModel", "Nexus 4"}, + {"DeviceModelBoot", "qcom"}, + {"DeviceModelIdentifier", "occam"}, + {"FirmwareBrand", "occam"}, + {"FirmwareFingerprint", "google/occam/mako:6.0.1/MOB30Y/3067468:user/release-keys"}, + {"FirmwareTags", "test-keys"}, + {"FirmwareType", "userdebug"}, + {"HardwareManufacturer", "LGE"}, + {"HardwareModel", "Nexus 4"} } }, - { "melrose-s9", - new Dictionary() + { + "melrose-s9", + new Dictionary { - { "AndroidBoardName", "g15" }, - { "AndroidBootloader", "" }, - { "DeviceBrand", "alps" }, - { "DeviceId", "8525f5d8201f78b5" }, - { "DeviceModel", "MELROSE S9" }, - { "DeviceModelBoot", "mtk" }, - { "DeviceModelIdentifier", "g15" }, - { "FirmwareBrand", "g15" }, - { "FirmwareFingerprint", "alps/g15/g15:4.4.2/KOT49H/:user/release-keys" }, - { "FirmwareTags", "release-keys" }, - { "FirmwareType", "user" }, - { "HardwareManufacturer", "alps" }, - { "HardwareModel", "MELROSE S9" } + {"AndroidBoardName", "g15"}, + {"AndroidBootloader", ""}, + {"DeviceBrand", "alps"}, + {"DeviceId", "8525f5d8201f78b5"}, + {"DeviceModel", "MELROSE S9"}, + {"DeviceModelBoot", "mtk"}, + {"DeviceModelIdentifier", "g15"}, + {"FirmwareBrand", "g15"}, + {"FirmwareFingerprint", "alps/g15/g15:4.4.2/KOT49H/:user/release-keys"}, + {"FirmwareTags", "release-keys"}, + {"FirmwareType", "user"}, + {"HardwareManufacturer", "alps"}, + {"HardwareModel", "MELROSE S9"} } }, - { "yureka", - new Dictionary() + { + "yureka", + new Dictionary { - { "AndroidBoardName", "MSM8916" }, - { "AndroidBootloader", "tomato-12-gf7e8024" }, - { "DeviceBrand", "YU" }, - { "DeviceId", "8525f5d8201f78b5" }, - { "DeviceModel", "AO5510" }, - { "DeviceModelBoot", "qcom" }, - { "DeviceModelIdentifier", "YUREKA" }, - { "FirmwareBrand", "YUREKA" }, - { "FirmwareFingerprint", "YU/YUREKA/YUREKA:5.0.2/LRX22G/YNG1TAS1K0:user/release-keys" }, - { "FirmwareTags", "test-keys" }, - { "FirmwareType", "userdebug" }, - { "HardwareManufacturer", "YU" }, - { "HardwareModel", "AO5510" } + {"AndroidBoardName", "MSM8916"}, + {"AndroidBootloader", "tomato-12-gf7e8024"}, + {"DeviceBrand", "YU"}, + {"DeviceId", "8525f5d8201f78b5"}, + {"DeviceModel", "AO5510"}, + {"DeviceModelBoot", "qcom"}, + {"DeviceModelIdentifier", "YUREKA"}, + {"FirmwareBrand", "YUREKA"}, + {"FirmwareFingerprint", "YU/YUREKA/YUREKA:5.0.2/LRX22G/YNG1TAS1K0:user/release-keys"}, + {"FirmwareTags", "test-keys"}, + {"FirmwareType", "userdebug"}, + {"HardwareManufacturer", "YU"}, + {"HardwareModel", "AO5510"} } }, - { "note3", - new Dictionary() + { + "note3", + new Dictionary { - { "AndroidBoardName", "MSM8974" }, - { "AndroidBootloader", "N900PVPUEOK2" }, - { "DeviceBrand", "samsung" }, - { "DeviceId", "8525f5d8201f78b5" }, - { "DeviceModel", "SM-N900P" }, - { "DeviceModelBoot", "qcom" }, - { "DeviceModelIdentifier", "cm_hltespr" }, - { "FirmwareBrand", "cm_hltespr" }, - { "FirmwareFingerprint", "samsung/hltespr/hltespr:5.0/LRX21V/N900PVPUEOH1:user/release-keys" }, - { "FirmwareTags", "test-keys" }, - { "FirmwareType", "user" }, - { "HardwareManufacturer", "samsung" }, - { "HardwareModel", "SM-N900P" } + {"AndroidBoardName", "MSM8974"}, + {"AndroidBootloader", "N900PVPUEOK2"}, + {"DeviceBrand", "samsung"}, + {"DeviceId", "8525f5d8201f78b5"}, + {"DeviceModel", "SM-N900P"}, + {"DeviceModelBoot", "qcom"}, + {"DeviceModelIdentifier", "cm_hltespr"}, + {"FirmwareBrand", "cm_hltespr"}, + {"FirmwareFingerprint", "samsung/hltespr/hltespr:5.0/LRX21V/N900PVPUEOH1:user/release-keys"}, + {"FirmwareTags", "test-keys"}, + {"FirmwareType", "user"}, + {"HardwareManufacturer", "samsung"}, + {"HardwareModel", "SM-N900P"} } }, - { "galaxy-tab-s84", - new Dictionary() + { + "galaxy-tab-s84", + new Dictionary { - { "AndroidBoardName", "universal5420" }, - { "AndroidBootloader", "T705XXU1BOL2" }, - { "DeviceBrand", "samsung" }, - { "DeviceId", "8525f5d8201f78b5" }, - { "DeviceModel", "Samsung Galaxy Tab S 8.4 LTE" }, - { "DeviceModelBoot", "universal5420" }, - { "DeviceModelIdentifier", "LRX22G.T705XXU1BOL2" }, - { "FirmwareBrand", "Samsung Galaxy Tab S 8.4 LTE" }, - { "FirmwareFingerprint", "samsung/klimtltexx/klimtlte:5.0.2/LRX22G/T705XXU1BOL2:user/release-keys" }, - { "FirmwareTags", "release-keys" }, - { "FirmwareType", "user" }, - { "HardwareManufacturer", "samsung" }, - { "HardwareModel", "SM-T705" } + {"AndroidBoardName", "universal5420"}, + {"AndroidBootloader", "T705XXU1BOL2"}, + {"DeviceBrand", "samsung"}, + {"DeviceId", "8525f5d8201f78b5"}, + {"DeviceModel", "Samsung Galaxy Tab S 8.4 LTE"}, + {"DeviceModelBoot", "universal5420"}, + {"DeviceModelIdentifier", "LRX22G.T705XXU1BOL2"}, + {"FirmwareBrand", "Samsung Galaxy Tab S 8.4 LTE"}, + {"FirmwareFingerprint", "samsung/klimtltexx/klimtlte:5.0.2/LRX22G/T705XXU1BOL2:user/release-keys"}, + {"FirmwareTags", "release-keys"}, + {"FirmwareType", "user"}, + {"HardwareManufacturer", "samsung"}, + {"HardwareModel", "SM-T705"} } - }, - + } }; } -} +} \ No newline at end of file diff --git a/PokemonGo.RocketBot.Logic/Utils/ErrorHandler.cs b/PokemonGo.RocketBot.Logic/Utils/ErrorHandler.cs index 315ae3d84..7ee197fca 100644 --- a/PokemonGo.RocketBot.Logic/Utils/ErrorHandler.cs +++ b/PokemonGo.RocketBot.Logic/Utils/ErrorHandler.cs @@ -1,38 +1,35 @@ -using PokemonGo.RocketBot.Logic.Logging; -using System; -using System.Collections.Generic; +using System; using System.Diagnostics; -using System.Linq; using System.Reflection; -using System.Text; -using System.Threading.Tasks; +using System.Threading; +using PokemonGo.RocketBot.Logic.Logging; namespace PokemonGo.RocketBot.Logic.Utils { - class ErrorHandler + internal class ErrorHandler { /// - /// Alerts that a fatal error has occurred, displaying a message and exiting the application + /// Alerts that a fatal error has occurred, displaying a message and exiting the application /// /// Optional message to display - Leave NULL to exclude message /// The total seconds the messag will display before shutting down - public static void ThrowFatalError( string strMessage, int timeout, LogLevel level, bool boolRestart = false ) + public static void ThrowFatalError(string strMessage, int timeout, LogLevel level, bool boolRestart = false) { - if( strMessage != null) - Logger.Write( strMessage, level ); + if (strMessage != null) + Logger.Write(strMessage, level); - Console.Write( "Ending Application... " ); + Console.Write("Ending Application... "); - for( int i = timeout; i > 0; i-- ) + for (var i = timeout; i > 0; i--) { - Console.Write( "\b" + i ); - System.Threading.Thread.Sleep( 1000 ); + Console.Write("\b" + i); + Thread.Sleep(1000); } - if( boolRestart ) - Process.Start( Assembly.GetEntryAssembly().Location ); + if (boolRestart) + Process.Start(Assembly.GetEntryAssembly().Location); - Environment.Exit( -1 ); + Environment.Exit(-1); } } -} +} \ No newline at end of file diff --git a/PokemonGo.RocketBot.Logic/Utils/LocationUtils.cs b/PokemonGo.RocketBot.Logic/Utils/LocationUtils.cs index 0e411105c..a13428089 100644 --- a/PokemonGo.RocketBot.Logic/Utils/LocationUtils.cs +++ b/PokemonGo.RocketBot.Logic/Utils/LocationUtils.cs @@ -2,9 +2,6 @@ using System; using GeoCoordinatePortable; -using System.Net; -using Newtonsoft.Json.Linq; -using System.IO; #endregion @@ -30,10 +27,10 @@ public static double CalculateDistanceInMeters(GeoCoordinate sourceLocation, Geo public static double getElevation(double lat, double lon) { - Random random = new Random(); + var random = new Random(); double maximum = 11.0f; double minimum = 8.6f; - double return1 = random.NextDouble() * (maximum - minimum) + minimum; + var return1 = random.NextDouble()*(maximum - minimum) + minimum; return return1; } @@ -63,7 +60,8 @@ public static GeoCoordinate CreateWaypoint(GeoCoordinate sourceLocation, double // adjust toLonRadians to be in the range -180 to +180... targetLongitudeRadians = (targetLongitudeRadians + 3*Math.PI)%(2*Math.PI) - Math.PI; - return new GeoCoordinate(ToDegrees(targetLatitudeRadians), ToDegrees(targetLongitudeRadians), getElevation(sourceLocation.Latitude, sourceLocation.Longitude)); + return new GeoCoordinate(ToDegrees(targetLatitudeRadians), ToDegrees(targetLongitudeRadians), + getElevation(sourceLocation.Latitude, sourceLocation.Longitude)); } public static GeoCoordinate CreateWaypoint(GeoCoordinate sourceLocation, double distanceInMeters, @@ -122,4 +120,4 @@ public static double ToRad(double degrees) return degrees*(Math.PI/180); } } -} +} \ No newline at end of file diff --git a/PokemonGo.RocketBot.Logic/Utils/NecroWebClient.cs b/PokemonGo.RocketBot.Logic/Utils/NecroWebClient.cs index 23f7ad65c..d74cef3a4 100644 --- a/PokemonGo.RocketBot.Logic/Utils/NecroWebClient.cs +++ b/PokemonGo.RocketBot.Logic/Utils/NecroWebClient.cs @@ -7,9 +7,9 @@ public class NecroWebClient : WebClient { protected override WebRequest GetWebRequest(Uri uri) { - WebRequest w = base.GetWebRequest(uri); + var w = base.GetWebRequest(uri); w.Timeout = 5000; return w; } } -} +} \ No newline at end of file diff --git a/PokemonGo.RocketBot.Logic/Utils/RouteOptimizeUtil.cs b/PokemonGo.RocketBot.Logic/Utils/RouteOptimizeUtil.cs index d9b044c18..e7d09177f 100644 --- a/PokemonGo.RocketBot.Logic/Utils/RouteOptimizeUtil.cs +++ b/PokemonGo.RocketBot.Logic/Utils/RouteOptimizeUtil.cs @@ -2,8 +2,6 @@ using System.Collections.Generic; using System.Linq; using POGOProtos.Map.Fort; -using GMap.NET.WindowsForms; -using PokemonGo.RocketBot.Logic.Logging; namespace PokemonGo.RocketBot.Logic.Utils { @@ -48,8 +46,8 @@ private static List Optimize2Opt(List pokeStops, out bool is { for (var ci = 0; ci < n; ci++) { - var bi = (ai + 1) % n; - var di = (ci + 1) % n; + var bi = (ai + 1)%n; + var di = (ci + 1)%n; var a = pokeStops[ai]; var b = pokeStops[bi]; @@ -79,7 +77,7 @@ private static List Optimize2Opt(List pokeStops, out bool is List optimizedRoute; if (bestI > bestJ) { - optimizedRoute = new List { pokeStops[0] }; + optimizedRoute = new List {pokeStops[0]}; optimizedRoute.AddRange(pokeStops.Skip(bestI)); optimizedRoute.Reverse(1, n - bestI); optimizedRoute.AddRange(pokeStops.GetRange(bestJ + 1, bestI - bestJ - 1)); @@ -117,12 +115,12 @@ private static float GetDistance(FortData a, FortData b) private static float GetDistance(double lat1, double lng1, double lat2, double lng2) { const double R = 6371e3; - Func toRad = x => (float)(x * (Math.PI / 180)); + Func toRad = x => (float) (x*(Math.PI/180)); lat1 = toRad(lat1); lat2 = toRad(lat2); var dLng = toRad(lng2 - lng1); - return (float)(Math.Acos(Math.Sin(lat1) * Math.Sin(lat2) + Math.Cos(lat1) * Math.Cos(lat2) * Math.Cos(dLng)) * R); + return (float) (Math.Acos(Math.Sin(lat1)*Math.Sin(lat2) + Math.Cos(lat1)*Math.Cos(lat2)*Math.Cos(dLng))*R); } private static void OnRouteOptimizeEvent(List optimizedroute) @@ -131,7 +129,5 @@ private static void OnRouteOptimizeEvent(List optimizedroute) } public static event RouteOptimizeDelegate RouteOptimizeEvent; - } - } \ No newline at end of file diff --git a/PokemonGo.RocketBot.Logic/Utils/Statistics.cs b/PokemonGo.RocketBot.Logic/Utils/Statistics.cs index 368ce9443..0280046da 100644 --- a/PokemonGo.RocketBot.Logic/Utils/Statistics.cs +++ b/PokemonGo.RocketBot.Logic/Utils/Statistics.cs @@ -4,12 +4,10 @@ using System; using System.Linq; -using POGOProtos.Networking.Responses; using System.Threading.Tasks; using PokemonGo.RocketBot.Logic.Logging; -using POGOProtos.Inventory.Item; -using Google.Protobuf.Collections; using PokemonGo.RocketBot.Logic.State; +using POGOProtos.Networking.Responses; #endregion @@ -24,15 +22,15 @@ namespace PokemonGo.RocketBot.Logic.Utils public class Statistics { private readonly DateTime _initSessionDateTime = DateTime.Now; - + private StatsExport _exportStats; private string _playerName; + public int LevelForRewards = -1; public int TotalExperience; public int TotalItemsRemoved; public int TotalPokemons; public int TotalPokemonTransferred; public int TotalStardust; - public int LevelForRewards = -1; public void Dirty(Inventory inventory) { @@ -63,26 +61,26 @@ public StatsExport GetCurrentInfo(Inventory inventory) hours = Math.Truncate(TimeSpan.FromHours(time).TotalHours); minutes = TimeSpan.FromHours(time).Minutes; } - - if( LevelForRewards == -1 || stat.Level >= LevelForRewards ) + + if (LevelForRewards == -1 || stat.Level >= LevelForRewards) { - LevelUpRewardsResponse Result = Execute( inventory ).Result; + var Result = Execute(inventory).Result; - if( Result.ToString().ToLower().Contains( "awarded_already" ) ) + if (Result.ToString().ToLower().Contains("awarded_already")) LevelForRewards = stat.Level + 1; - if( Result.ToString().ToLower().Contains( "success" ) ) + if (Result.ToString().ToLower().Contains("success")) { - Logger.Write( "Leveled up: " + stat.Level, LogLevel.Info ); + Logger.Write("Leveled up: " + stat.Level, LogLevel.Info); - RepeatedField items = Result.ItemsAwarded; + var items = Result.ItemsAwarded; - if( items.Any() ) + if (items.Any()) { - Logger.Write( "- Received Items -", LogLevel.Info ); - foreach( ItemAward item in items ) + Logger.Write("- Received Items -", LogLevel.Info); + foreach (var item in items) { - Logger.Write( $"[ITEM] {item.ItemId} x {item.ItemCount} ", LogLevel.Info ); + Logger.Write($"[ITEM] {item.ItemId} x {item.ItemCount} ", LogLevel.Info); } } } @@ -91,8 +89,8 @@ public StatsExport GetCurrentInfo(Inventory inventory) LevelForRewards = stat.Level; if (Result2.ToString().ToLower().Contains("success")) { - string[] tokens = Result2.Result.ToString().Split(new[] { "itemId" }, StringSplitOptions.None); - Logging.Logger.Write("Items Awarded:" + Result2.ItemsAwarded.ToString()); + var tokens = Result2.Result.ToString().Split(new[] {"itemId"}, StringSplitOptions.None); + Logger.Write("Items Awarded:" + Result2.ItemsAwarded); } output = new StatsExport { @@ -112,9 +110,9 @@ public async Task Execute(ISession ctx) return Result; } - public async Task Execute( Inventory inventory ) + public async Task Execute(Inventory inventory) { - var Result = await inventory.GetLevelUpRewards( inventory ); + var Result = await inventory.GetLevelUpRewards(inventory); return Result; } @@ -163,4 +161,4 @@ public class StatsExport public long LevelupXp; public double MinutesUntilLevel; } -} +} \ No newline at end of file diff --git a/PokemonGo.RocketBot.Logic/Utils/StringUtils.cs b/PokemonGo.RocketBot.Logic/Utils/StringUtils.cs index cd3d2cc16..94c380412 100644 --- a/PokemonGo.RocketBot.Logic/Utils/StringUtils.cs +++ b/PokemonGo.RocketBot.Logic/Utils/StringUtils.cs @@ -11,6 +11,12 @@ namespace PokemonGo.RocketBot.Logic.Utils { public static class StringUtils { + private static readonly Func AndFunc = (x, y) => x && y; + private static readonly Func OrFunc = (x, y) => x || y; + + private static readonly Func> GetBoolOperator = + myOperator => myOperator.ToLower().Equals("and") ? AndFunc : OrFunc; + public static string GetSummedFriendlyNameOfItemAwardList(IEnumerable items) { var enumerable = items as IList ?? items.ToList(); @@ -25,12 +31,6 @@ public static string GetSummedFriendlyNameOfItemAwardList(IEnumerable .Aggregate((a, b) => $"{a}, {b}"); } - - private static readonly Func AndFunc = (x, y) => x && y; - private static readonly Func OrFunc = (x, y) => x || y; - private static readonly Func> GetBoolOperator = - myOperator => myOperator.ToLower().Equals("and") ? AndFunc : OrFunc; - public static bool BoolFunc(this bool expr, bool expr2, string operatorStr) { return GetBoolOperator(operatorStr)(expr, expr2); @@ -50,6 +50,5 @@ public static bool InverseBool(this string operatorStr, bool expr) { return operatorStr.ToLower().Equals("and") ? !expr : expr; } - } } \ No newline at end of file diff --git a/PokemonGo.RocketBot.Logic/Utils/WebClientExtensions.cs b/PokemonGo.RocketBot.Logic/Utils/WebClientExtensions.cs index 030cc129e..6de0e46a7 100644 --- a/PokemonGo.RocketBot.Logic/Utils/WebClientExtensions.cs +++ b/PokemonGo.RocketBot.Logic/Utils/WebClientExtensions.cs @@ -1,12 +1,7 @@ using System; -using System.Collections.Generic; -using System.IO; -using System.IO.Compression; -using System.Linq; using System.Net; using System.Net.Sockets; using System.Text; -using System.Threading.Tasks; namespace PokemonGo.RocketBot.Logic.Utils { @@ -14,7 +9,8 @@ public static class WebClientExtensions { public static string DownloadString(this WebClient webClient, Uri uri) { - webClient.Headers[HttpRequestHeader.UserAgent] = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2"; + webClient.Headers[HttpRequestHeader.UserAgent] = + "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2"; webClient.Encoding = Encoding.UTF8; byte[] rawData = null; string error; @@ -40,11 +36,11 @@ public static string DownloadString(this WebClient webClient, Uri uri) error = null; } - if ( error == null || rawData == null ) + if (error == null || rawData == null) return null; var encoding = WebUtils.GetEncodingFrom(webClient.ResponseHeaders, Encoding.UTF8); return encoding.GetString(rawData); } } -} +} \ No newline at end of file diff --git a/PokemonGo.RocketBot.Logic/Utils/WebUtils.cs b/PokemonGo.RocketBot.Logic/Utils/WebUtils.cs index a0e2d240a..7c93bd8ee 100644 --- a/PokemonGo.RocketBot.Logic/Utils/WebUtils.cs +++ b/PokemonGo.RocketBot.Logic/Utils/WebUtils.cs @@ -1,9 +1,7 @@ using System; -using System.Collections.Generic; using System.Collections.Specialized; using System.Linq; using System.Text; -using System.Threading.Tasks; namespace PokemonGo.RocketBot.Logic.Utils { @@ -55,4 +53,4 @@ public static Encoding GetEncodingFrom( } } } -} +} \ No newline at end of file diff --git a/PokemonGo.RocketBot.Logic/Utils/dijkstras.cs b/PokemonGo.RocketBot.Logic/Utils/dijkstras.cs index aa93463f1..d0f16b04f 100644 --- a/PokemonGo.RocketBot.Logic/Utils/dijkstras.cs +++ b/PokemonGo.RocketBot.Logic/Utils/dijkstras.cs @@ -3,9 +3,10 @@ namespace PokemonGo.RocketBot.Logic.Utils { - class Graph + internal class Graph { - Dictionary> vertices = new Dictionary>(); + private readonly Dictionary> vertices = + new Dictionary>(); public void add_vertex(char name, Dictionary edges) { @@ -73,19 +74,19 @@ public List shortest_path(char start, char finish) } } - class MainClass + internal class MainClass { public static void Main(string[] args) { - Graph g = new Graph(); - g.add_vertex('A', new Dictionary() { { 'B', 7 }, { 'C', 8 } }); - g.add_vertex('B', new Dictionary() { { 'A', 7 }, { 'F', 2 } }); - g.add_vertex('C', new Dictionary() { { 'A', 8 }, { 'F', 6 }, { 'G', 4 } }); - g.add_vertex('D', new Dictionary() { { 'F', 8 } }); - g.add_vertex('E', new Dictionary() { { 'H', 1 } }); - g.add_vertex('F', new Dictionary() { { 'B', 2 }, { 'C', 6 }, { 'D', 8 }, { 'G', 9 }, { 'H', 3 } }); - g.add_vertex('G', new Dictionary() { { 'C', 4 }, { 'F', 9 } }); - g.add_vertex('H', new Dictionary() { { 'E', 1 }, { 'F', 3 } }); + var g = new Graph(); + g.add_vertex('A', new Dictionary {{'B', 7}, {'C', 8}}); + g.add_vertex('B', new Dictionary {{'A', 7}, {'F', 2}}); + g.add_vertex('C', new Dictionary {{'A', 8}, {'F', 6}, {'G', 4}}); + g.add_vertex('D', new Dictionary {{'F', 8}}); + g.add_vertex('E', new Dictionary {{'H', 1}}); + g.add_vertex('F', new Dictionary {{'B', 2}, {'C', 6}, {'D', 8}, {'G', 9}, {'H', 3}}); + g.add_vertex('G', new Dictionary {{'C', 4}, {'F', 9}}); + g.add_vertex('H', new Dictionary {{'E', 1}, {'F', 3}}); g.shortest_path('A', 'H').ForEach(x => Console.WriteLine(x)); }