private WowProcess StartNewWowProcess(WowAccount account) { List <WowProcess> wowProcesses; do { wowProcesses = BotUtils.GetRunningWows(OffsetList) .Where(p => !p.LoginInProgress && p.CharacterName?.Length == 0).ToList(); // Start new Wow process if (wowProcesses?.Count == 0) { StartNewWow(account); } } while (wowProcesses?.Count == 0); return(wowProcesses.First()); }
private void ActiveWowTimer_Elapsed(object sender, ElapsedEventArgs e) { try { List <WowProcess> wowProcesses = BotUtils.GetRunningWows(OffsetList); Dispatcher.Invoke(() => AddUnusedWowProcessesToView(wowProcesses)); Dispatcher.Invoke(() => AddUsedWowProcessesToView()); Dispatcher.Invoke(() => RemoveDeadViews()); ManagedAmeisenBots.RemoveAll(b => b.WowProcess.Process.HasExited); if (FleetMode) { Dispatcher.Invoke(() => HandleFleet()); } } catch (TaskCanceledException) { // can be ignored, happens sometimes when you exit the bot // maybe i'll fix this, maybe not :^) } }
private void HandleFleet() { List <WowProcess> wowsAlreadyRunning = BotUtils.GetRunningWows(OffsetList); foreach (WowAccount account in new List <WowAccount>(WowAccounts.Keys)) { switch (WowAccounts[account]) { case BotStartState.None: WowProcess selectedProcess = wowsAlreadyRunning.FirstOrDefault(w => w.CharacterName == account.CharacterName); if (selectedProcess == null) { selectedProcess = StartNewWowProcess(account); } SetupNewAmeisenBot(account, selectedProcess); break; default: break; } } }