diff --git a/ARAMUtility/View/MainWindow.xaml b/ARAMUtility/View/MainWindow.xaml index cbbc14f..2b2bfb5 100644 --- a/ARAMUtility/View/MainWindow.xaml +++ b/ARAMUtility/View/MainWindow.xaml @@ -10,6 +10,7 @@ Height="480" Width="700" Background="#0a1a2a" + Topmost="True" > @@ -60,6 +61,7 @@ + diff --git a/ARAMUtility/ViewModel/MainViewModel.cs b/ARAMUtility/ViewModel/MainViewModel.cs index 63599b6..de7c27d 100644 --- a/ARAMUtility/ViewModel/MainViewModel.cs +++ b/ARAMUtility/ViewModel/MainViewModel.cs @@ -39,8 +39,9 @@ public partial class MainViewModel : ObservableObject, IDisposable [ObservableProperty] public partial string ConnectionStatus { get; private set; } = "Not connected."; - - + [ObservableProperty] + public partial bool AutoAccept { get; set; } = true; + private Dictionary _allChampions = []; private List _needChampionIds = []; private readonly APIClient _client = new(); @@ -93,9 +94,20 @@ public partial class MainViewModel : ObservableObject, IDisposable { case "/lol-matchmaking/v1/ready-check": LolMatchmakingMatchmakingReadyCheckResource? readyCheck = apiEvent.Data.Deserialize(); - if (readyCheck is not null && readyCheck.PlayerResponse == LolMatchmakingMatchmakingReadyCheckResponse.Accepted) + if (readyCheck is not null) { - await UpdateNeedChampionIdsAsync(); + if (readyCheck.PlayerResponse != LolMatchmakingMatchmakingReadyCheckResponse.Accepted) + { + if (AutoAccept) + { + await Task.Delay(TimeSpan.FromMilliseconds(Random.Shared.Next(100, 1500))); + await _client.MatchmakingAcceptAsync(); + } + } + else + { + await UpdateNeedChampionIdsAsync(); + } } break; case "/lol-champ-select/v1/session": diff --git a/LeagueAPI/LcuWebsocket.cs b/LeagueAPI/LcuWebsocket.cs index 46a7168..5e443d8 100644 --- a/LeagueAPI/LcuWebsocket.cs +++ b/LeagueAPI/LcuWebsocket.cs @@ -49,7 +49,7 @@ public class LcuWebsocket : IDisposable { ProcessInfo = ProcessFinder.GetProcessInfo(); } - catch (Exception ex) + catch { return; }