accept matches

TODO: make it a button
This commit is contained in:
2026-04-29 01:20:37 +02:00
parent 1f258ef61c
commit 076c0a9a8d
3 changed files with 19 additions and 5 deletions
+2
View File
@@ -10,6 +10,7 @@
Height="480" Height="480"
Width="700" Width="700"
Background="#0a1a2a" Background="#0a1a2a"
Topmost="True"
> >
<Window.DataContext> <Window.DataContext>
<vm:MainViewModel /> <vm:MainViewModel />
@@ -60,6 +61,7 @@
<MenuItem Header="Start Queueing" Command="{Binding StartQueueingCommand}" /> <MenuItem Header="Start Queueing" Command="{Binding StartQueueingCommand}" />
<Separator /> <Separator />
<MenuItem Header="Topmost" IsCheckable="True" IsChecked="{Binding Topmost, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:MainWindow}}}" /> <MenuItem Header="Topmost" IsCheckable="True" IsChecked="{Binding Topmost, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:MainWindow}}}" />
<MenuItem Header="Auto Accept" IsCheckable="True" IsChecked="{Binding AutoAccept}" />
<Separator /> <Separator />
<MenuItem Header="Reload ARAM Balance" Command="{Binding ReloadARAMBalanceCommand}" /> <MenuItem Header="Reload ARAM Balance" Command="{Binding ReloadARAMBalanceCommand}" />
<Separator /> <Separator />
+16 -4
View File
@@ -39,8 +39,9 @@ public partial class MainViewModel : ObservableObject, IDisposable
[ObservableProperty] [ObservableProperty]
public partial string ConnectionStatus { get; private set; } = "Not connected."; public partial string ConnectionStatus { get; private set; } = "Not connected.";
[ObservableProperty]
public partial bool AutoAccept { get; set; } = true;
private Dictionary<int, ChampionData> _allChampions = []; private Dictionary<int, ChampionData> _allChampions = [];
private List<int> _needChampionIds = []; private List<int> _needChampionIds = [];
private readonly APIClient _client = new(); private readonly APIClient _client = new();
@@ -93,9 +94,20 @@ public partial class MainViewModel : ObservableObject, IDisposable
{ {
case "/lol-matchmaking/v1/ready-check": case "/lol-matchmaking/v1/ready-check":
LolMatchmakingMatchmakingReadyCheckResource? readyCheck = apiEvent.Data.Deserialize<LolMatchmakingMatchmakingReadyCheckResource>(); LolMatchmakingMatchmakingReadyCheckResource? readyCheck = apiEvent.Data.Deserialize<LolMatchmakingMatchmakingReadyCheckResource>();
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; break;
case "/lol-champ-select/v1/session": case "/lol-champ-select/v1/session":
+1 -1
View File
@@ -49,7 +49,7 @@ public class LcuWebsocket : IDisposable
{ {
ProcessInfo = ProcessFinder.GetProcessInfo(); ProcessInfo = ProcessFinder.GetProcessInfo();
} }
catch (Exception ex) catch
{ {
return; return;
} }