Beispiel #1
0
        //TODO : Need add BotManager to manage all feature related to multibot,
        public bool ReInitSessionWithNextBot(Account bot = null, double lat = 0, double lng = 0, double att = 0)
        {
            CatchBlockTime = DateTime.Now; //remove any block
            MSniperServiceTask.BlockSnipe();
            VisibleForts.Clear();
            Forts.Clear();

            var manager = TinyIoCContainer.Current.Resolve <MultiAccountManager>();
            var session = TinyIoCContainer.Current.Resolve <ISession>();

            var nextBot = manager.GetSwitchableAccount(bot);

            if (nextBot != null)
            {
                manager.SwitchAccounts(nextBot);
            }

            Settings.DefaultAltitude  = att == 0 ? Client.CurrentAltitude : att;
            Settings.DefaultLatitude  = lat == 0 ? Client.CurrentLatitude : lat;
            Settings.DefaultLongitude = lng == 0 ? Client.CurrentLongitude : lng;
            Stats = new SessionStats(this);
            Reset(Settings, LogicSettings);
            //CancellationTokenSource.Cancel();
            CancellationTokenSource = new CancellationTokenSource();

            EventDispatcher.Send(new BotSwitchedEvent(nextBot)
            {
            });

            if (LogicSettings.MultipleBotConfig.DisplayList)
            {
                manager.DumpAccountList();
            }
            return(true);
        }
Beispiel #2
0
        public void AddForts(List <FortData> data)
        {
            data.RemoveAll(x => LocationUtils.CalculateDistanceInMeters(x.Latitude, x.Longitude, Settings.DefaultLatitude, Settings.DefaultLongitude) > 10000);

            Forts.RemoveAll(p => data.Any(x => x.Id == p.Id && x.Type == FortType.Checkpoint));
            Forts.AddRange(data.Where(x => x.Type == FortType.Checkpoint));
            foreach (var item in data.Where(p => p.Type == FortType.Gym))
            {
                var exist = Forts.FirstOrDefault(x => x.Id == item.Id);
                if (exist != null && exist.CooldownCompleteTimestampMs > DateTime.UtcNow.ToUnixTime())
                {
                    continue;
                }
                else
                {
                    Forts.RemoveAll(x => x.Id == item.Id);
                    Forts.Add(item);
                }
            }
        }
Beispiel #3
0
        //TODO : Need add BotManager to manage all feature related to multibot,
        public bool ReInitSessionWithNextBot(Account bot = null, double lat = 0, double lng = 0, double att = 0)
        {
            CatchBlockTime = DateTime.Now; //remove any block
            MSniperServiceTask.BlockSnipe();
            VisibleForts.Clear();
            Forts.Clear();

            var manager = TinyIoCContainer.Current.Resolve <MultiAccountManager>();
            var session = TinyIoCContainer.Current.Resolve <ISession>();
            var nextBot = manager.GetSwitchableAccount(bot);
            var Account = !string.IsNullOrEmpty(nextBot.Nickname) ? nextBot.Nickname : nextBot.Username;
            var TotXP   = 0;

            for (int i = 0; i < nextBot.Level + 1; i++)
            {
                TotXP = TotXP + Statistics.GetXpDiff(i);
            }

            long?XP = nextBot.CurrentXp;

            if (XP == null)
            {
                XP = 0;
            }
            long?SD = nextBot.Stardust;

            if (SD == null)
            {
                SD = 0;
            }
            long?Lvl = nextBot.Level;

            if (Lvl == null)
            {
                Lvl = 0;
            }
            var NLevelXP = nextBot.NextLevelXp;

            if (nextBot.NextLevelXp == null)
            {
                NLevelXP = 0;
            }

            Logger.Write($"Account changed to {Account}", LogLevel.BotStats);

            if (session.LogicSettings.NotificationConfig.EnablePushBulletNotification)
            {
                PushNotificationClient.SendNotification(session, $"Account changed to", $"{Account}\n" +
                                                        $"Lvl: {Lvl}\n" +
                                                        $"XP : {XP:#,##0}({(double)XP / ((double)NLevelXP) * 100:#0.00}%)\n" +
                                                        $"SD : {SD:#,##0}", true).ConfigureAwait(false);
            }

            if (nextBot != null)
            {
                manager.SwitchAccounts(nextBot);
            }

            Settings.DefaultAltitude  = att == 0 ? Client.CurrentAltitude : att;
            Settings.DefaultLatitude  = lat == 0 ? Client.CurrentLatitude : lat;
            Settings.DefaultLongitude = lng == 0 ? Client.CurrentLongitude : lng;
            Stats = new SessionStats(this);
            Reset(Settings, LogicSettings);
            //CancellationTokenSource.Cancel();
            CancellationTokenSource = new CancellationTokenSource();

            EventDispatcher.Send(new BotSwitchedEvent(nextBot)
            {
            });

            if (LogicSettings.MultipleBotConfig.DisplayList)
            {
                manager.DumpAccountList();
            }
            return(true);
        }