//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); }
//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); }