425 lines
27 KiB
XML
425 lines
27 KiB
XML
<Window xmlns="https://github.com/avaloniaui"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:vm="using:Poe2Trade.Ui.ViewModels"
|
|
x:Class="Poe2Trade.Ui.Views.MainWindow"
|
|
x:DataType="vm:MainWindowViewModel"
|
|
Title="Automata"
|
|
Width="960" Height="640"
|
|
Background="#0d1117">
|
|
|
|
<DockPanel Margin="8">
|
|
|
|
<!-- STATUS HEADER -->
|
|
<Border DockPanel.Dock="Top" Padding="8" Margin="0,0,0,6"
|
|
Background="#161b22" BorderBrush="#30363d"
|
|
BorderThickness="1" CornerRadius="8">
|
|
<Grid ColumnDefinitions="Auto,*,Auto">
|
|
<!-- Status dot + text -->
|
|
<StackPanel Grid.Column="0" Orientation="Horizontal" Spacing="8"
|
|
VerticalAlignment="Center">
|
|
<Ellipse Width="10" Height="10"
|
|
Fill="{Binding State, Converter={StaticResource StatusDotBrush}}" />
|
|
<TextBlock Text="{Binding State}" FontWeight="SemiBold"
|
|
Foreground="#e6edf3" VerticalAlignment="Center" />
|
|
</StackPanel>
|
|
|
|
<!-- Stats cards -->
|
|
<StackPanel Grid.Column="1" Orientation="Horizontal" Spacing="10"
|
|
HorizontalAlignment="Center">
|
|
<Border Background="#21262d" CornerRadius="6" Padding="10,4">
|
|
<StackPanel HorizontalAlignment="Center">
|
|
<TextBlock Text="{Binding ActiveLinksCount}"
|
|
FontSize="16" FontWeight="Bold" Foreground="#58a6ff"
|
|
HorizontalAlignment="Center" />
|
|
<TextBlock Text="ACTIVE LINKS" FontSize="10" Foreground="#8b949e"
|
|
HorizontalAlignment="Center" />
|
|
</StackPanel>
|
|
</Border>
|
|
<Border Background="#21262d" CornerRadius="6" Padding="10,4">
|
|
<StackPanel HorizontalAlignment="Center">
|
|
<TextBlock Text="{Binding TradesCompleted}"
|
|
FontSize="16" FontWeight="Bold" Foreground="#3fb950"
|
|
HorizontalAlignment="Center" />
|
|
<TextBlock Text="TRADES DONE" FontSize="10" Foreground="#8b949e"
|
|
HorizontalAlignment="Center" />
|
|
</StackPanel>
|
|
</Border>
|
|
<Border Background="#21262d" CornerRadius="6" Padding="10,4">
|
|
<StackPanel HorizontalAlignment="Center">
|
|
<TextBlock Text="{Binding TradesFailed}"
|
|
FontSize="16" FontWeight="Bold" Foreground="#f85149"
|
|
HorizontalAlignment="Center" />
|
|
<TextBlock Text="FAILED" FontSize="10" Foreground="#8b949e"
|
|
HorizontalAlignment="Center" />
|
|
</StackPanel>
|
|
</Border>
|
|
</StackPanel>
|
|
|
|
<!-- Controls -->
|
|
<StackPanel Grid.Column="2" Orientation="Horizontal" Spacing="8"
|
|
VerticalAlignment="Center">
|
|
<ComboBox ItemsSource="{x:Static vm:MainWindowViewModel.BotModes}"
|
|
SelectedItem="{Binding BotMode}" Width="110" />
|
|
<Button Content="Start" Command="{Binding StartCommand}" />
|
|
<Button Content="{Binding PauseButtonText}" Command="{Binding PauseCommand}" />
|
|
</StackPanel>
|
|
</Grid>
|
|
</Border>
|
|
|
|
<!-- TABBED CONTENT -->
|
|
<TabControl>
|
|
|
|
<!-- ========== STATE TAB ========== -->
|
|
<TabItem Header="State">
|
|
<Grid RowDefinitions="Auto,*" Margin="0,6,0,0">
|
|
|
|
<!-- Top row: Inventory + Minimap side by side (splitter-resizable) -->
|
|
<Grid Grid.Row="0" ColumnDefinitions="*,5,300" Margin="0,0,0,6">
|
|
|
|
<!-- Inventory Grid (12x5) -->
|
|
<Border Grid.Column="0" Background="#161b22" BorderBrush="#30363d"
|
|
BorderThickness="1" CornerRadius="8" Padding="8" MinWidth="200">
|
|
<DockPanel>
|
|
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal" Margin="0,0,0,4">
|
|
<TextBlock Text="INVENTORY" FontSize="11" FontWeight="SemiBold"
|
|
Foreground="#8b949e" />
|
|
<TextBlock Text="{Binding InventoryFreeCells, StringFormat='{}{0}/60 free'}"
|
|
FontSize="11" Foreground="#8b949e" Margin="12,0,0,0" />
|
|
</StackPanel>
|
|
<Grid MaxHeight="170">
|
|
<Image Source="{Binding InventoryImage}" Stretch="Uniform" />
|
|
<ItemsControl ItemsSource="{Binding InventoryCells}">
|
|
<ItemsControl.ItemsPanel>
|
|
<ItemsPanelTemplate>
|
|
<UniformGrid Columns="12" Rows="5" />
|
|
</ItemsPanelTemplate>
|
|
</ItemsControl.ItemsPanel>
|
|
<ItemsControl.ItemTemplate>
|
|
<DataTemplate x:DataType="vm:CellState">
|
|
<Border Margin="1" CornerRadius="2"
|
|
Background="{Binding IsOccupied, Converter={StaticResource OccupiedOverlayBrush}}"
|
|
BorderBrush="#3fb950"
|
|
BorderThickness="{Binding Converter={StaticResource CellBorderConverter}}" />
|
|
</DataTemplate>
|
|
</ItemsControl.ItemTemplate>
|
|
</ItemsControl>
|
|
</Grid>
|
|
</DockPanel>
|
|
</Border>
|
|
|
|
<GridSplitter Grid.Column="1" Background="Transparent" />
|
|
|
|
<!-- Minimap -->
|
|
<Border Grid.Column="2" Background="#161b22" BorderBrush="#30363d"
|
|
BorderThickness="1" CornerRadius="8" Padding="8" MinWidth="150">
|
|
<DockPanel>
|
|
<Grid DockPanel.Dock="Top" ColumnDefinitions="Auto,*,Auto" Margin="0,0,0,4">
|
|
<TextBlock Grid.Column="0" Text="MINIMAP" FontSize="11" FontWeight="SemiBold"
|
|
Foreground="#8b949e" VerticalAlignment="Center" />
|
|
<TextBlock Grid.Column="1" Text="{Binding NavigationStateText}"
|
|
FontSize="11" Foreground="#58a6ff" Margin="8,0,0,0"
|
|
VerticalAlignment="Center" />
|
|
<ComboBox Grid.Column="2"
|
|
ItemsSource="{x:Static vm:MainWindowViewModel.MinimapStages}"
|
|
SelectedItem="{Binding SelectedMinimapStage}"
|
|
FontSize="11" />
|
|
</Grid>
|
|
<Grid>
|
|
<Image Source="{Binding MinimapImage}" Stretch="Uniform"
|
|
RenderOptions.BitmapInterpolationMode="None" />
|
|
<TextBlock Text="Idle"
|
|
IsVisible="{Binding MinimapImage, Converter={x:Static ObjectConverters.IsNull}}"
|
|
HorizontalAlignment="Center" VerticalAlignment="Center"
|
|
FontSize="12" Foreground="#484f58" />
|
|
</Grid>
|
|
</DockPanel>
|
|
</Border>
|
|
</Grid>
|
|
|
|
<!-- Logs -->
|
|
<Border Grid.Row="1" Background="#0d1117" BorderBrush="#30363d"
|
|
BorderThickness="1" CornerRadius="8" Padding="8">
|
|
<DockPanel>
|
|
<TextBlock DockPanel.Dock="Top" Text="ACTIVITY LOG"
|
|
FontSize="11" FontWeight="SemiBold" Foreground="#8b949e"
|
|
Margin="0,0,0,4" />
|
|
<ScrollViewer x:Name="LogScroll">
|
|
<SelectableTextBlock x:Name="LogBlock"
|
|
FontSize="11" FontFamily="Consolas"
|
|
TextWrapping="Wrap" />
|
|
</ScrollViewer>
|
|
</DockPanel>
|
|
</Border>
|
|
</Grid>
|
|
</TabItem>
|
|
|
|
<!-- ========== TRADE TAB ========== -->
|
|
<TabItem Header="Trade">
|
|
<Border Background="#161b22" BorderBrush="#30363d"
|
|
BorderThickness="1" CornerRadius="8" Padding="8" Margin="0,6,0,0">
|
|
<DockPanel>
|
|
<TextBlock DockPanel.Dock="Top" Text="TRADE LINKS"
|
|
FontSize="11" FontWeight="SemiBold" Foreground="#8b949e"
|
|
Margin="0,0,0,4" />
|
|
|
|
<!-- Add link form -->
|
|
<StackPanel DockPanel.Dock="Top" Spacing="4" Margin="0,0,0,6">
|
|
<TextBox Text="{Binding NewLinkName}" Watermark="Name (optional)" />
|
|
<TextBox Text="{Binding NewUrl}" Watermark="Paste trade URL..." />
|
|
<StackPanel Orientation="Horizontal" Spacing="6">
|
|
<ComboBox ItemsSource="{x:Static vm:MainWindowViewModel.LinkModes}"
|
|
SelectedItem="{Binding NewLinkMode}" Width="100" />
|
|
<Button Content="Add" Command="{Binding AddLinkCommand}" />
|
|
</StackPanel>
|
|
</StackPanel>
|
|
|
|
<!-- Links list -->
|
|
<ScrollViewer>
|
|
<ItemsControl ItemsSource="{Binding Links}">
|
|
<ItemsControl.ItemTemplate>
|
|
<DataTemplate>
|
|
<Border Margin="0,2" Padding="6" Background="#21262d"
|
|
CornerRadius="4"
|
|
Opacity="{Binding Active, Converter={StaticResource ActiveOpacity}}">
|
|
<DockPanel>
|
|
<Button DockPanel.Dock="Right" Content="X" FontSize="10"
|
|
VerticalAlignment="Center"
|
|
Command="{Binding $parent[ItemsControl].((vm:MainWindowViewModel)DataContext).RemoveLinkCommand}"
|
|
CommandParameter="{Binding Id}" />
|
|
<CheckBox DockPanel.Dock="Left"
|
|
IsChecked="{Binding Active}"
|
|
Margin="0,0,8,0" VerticalAlignment="Center" />
|
|
<StackPanel>
|
|
<StackPanel Orientation="Horizontal" Spacing="6">
|
|
<Border Background="{Binding Mode, Converter={StaticResource ModeBrush}}"
|
|
CornerRadius="4" Padding="6,2">
|
|
<TextBlock Text="{Binding Mode}"
|
|
FontSize="10" FontWeight="Bold"
|
|
Foreground="White" />
|
|
</Border>
|
|
<TextBlock Text="{Binding Name}" FontSize="12"
|
|
FontWeight="SemiBold" Foreground="#e6edf3" />
|
|
</StackPanel>
|
|
<TextBlock Text="{Binding Label}" FontSize="10"
|
|
Foreground="#8b949e" TextTrimming="CharacterEllipsis" />
|
|
</StackPanel>
|
|
</DockPanel>
|
|
</Border>
|
|
</DataTemplate>
|
|
</ItemsControl.ItemTemplate>
|
|
</ItemsControl>
|
|
</ScrollViewer>
|
|
</DockPanel>
|
|
</Border>
|
|
</TabItem>
|
|
|
|
<!-- ========== MAPPING TAB ========== -->
|
|
<TabItem Header="Mapping">
|
|
<ScrollViewer DataContext="{Binding MappingVm}" Margin="0,6,0,0">
|
|
<StackPanel Spacing="8" Margin="0" x:DataType="vm:MappingViewModel">
|
|
|
|
<!-- Map Type -->
|
|
<Border Background="#161b22" BorderBrush="#30363d" BorderThickness="1"
|
|
CornerRadius="8" Padding="10">
|
|
<StackPanel Spacing="8">
|
|
<TextBlock Text="MAP TYPE" FontSize="11" FontWeight="SemiBold"
|
|
Foreground="#8b949e" />
|
|
<ComboBox ItemsSource="{x:Static vm:MappingViewModel.MapTypes}"
|
|
SelectedItem="{Binding SelectedMapType}" Width="200" />
|
|
<TextBlock Text="REQUIRED ITEMS" FontSize="11" FontWeight="SemiBold"
|
|
Foreground="#8b949e" Margin="0,8,0,0" />
|
|
<TextBlock Text="{Binding SelectedMapType, Converter={StaticResource MapRequirementsText}}"
|
|
FontSize="13" Foreground="#e6edf3" />
|
|
</StackPanel>
|
|
</Border>
|
|
|
|
<!-- Training Data -->
|
|
<Border Background="#161b22" BorderBrush="#30363d" BorderThickness="1"
|
|
CornerRadius="8" Padding="10">
|
|
<StackPanel Spacing="8">
|
|
<TextBlock Text="TRAINING DATA" FontSize="11" FontWeight="SemiBold"
|
|
Foreground="#8b949e" />
|
|
<ToggleSwitch IsChecked="{Binding IsFrameSaverEnabled}"
|
|
OnContent="Save Frames" OffContent="Save Frames" />
|
|
<TextBlock FontSize="12" Foreground="#8b949e">
|
|
<TextBlock.Text>
|
|
<MultiBinding StringFormat="{}{0} frames saved to training-data/raw/">
|
|
<Binding Path="FramesSaved" />
|
|
</MultiBinding>
|
|
</TextBlock.Text>
|
|
</TextBlock>
|
|
</StackPanel>
|
|
</Border>
|
|
|
|
<!-- Enemy Detection -->
|
|
<Border Background="#161b22" BorderBrush="#30363d" BorderThickness="1"
|
|
CornerRadius="8" Padding="10">
|
|
<StackPanel Spacing="8">
|
|
<TextBlock Text="ENEMY DETECTION" FontSize="11" FontWeight="SemiBold"
|
|
Foreground="#8b949e" />
|
|
<ToggleSwitch IsChecked="{Binding IsDetectionEnabled}"
|
|
IsEnabled="{Binding HasModel}"
|
|
OnContent="Detection On" OffContent="Detection Off" />
|
|
<StackPanel Orientation="Horizontal" Spacing="16"
|
|
IsVisible="{Binding HasModel}">
|
|
<TextBlock Text="{Binding EnemiesDetected, StringFormat='{}{0} enemies'}"
|
|
FontSize="12" Foreground="#e6edf3" />
|
|
<TextBlock Text="{Binding InferenceMs, StringFormat='{}{0:F1}ms inference'}"
|
|
FontSize="12" Foreground="#8b949e" />
|
|
</StackPanel>
|
|
<TextBlock Text="No model found. Train one first."
|
|
FontSize="12" Foreground="#484f58"
|
|
IsVisible="{Binding !HasModel}" />
|
|
</StackPanel>
|
|
</Border>
|
|
|
|
</StackPanel>
|
|
</ScrollViewer>
|
|
</TabItem>
|
|
|
|
<!-- ========== DEBUG TAB ========== -->
|
|
<TabItem Header="Debug">
|
|
<ScrollViewer DataContext="{Binding DebugVm}" Margin="0,6,0,0">
|
|
<StackPanel Spacing="8" Margin="6" x:DataType="vm:DebugViewModel">
|
|
|
|
<!-- Row 1: Quick actions -->
|
|
<Border Background="#161b22" BorderBrush="#30363d" BorderThickness="1"
|
|
CornerRadius="8" Padding="8">
|
|
<StackPanel Spacing="6">
|
|
<TextBlock Text="QUICK ACTIONS" FontSize="11" FontWeight="SemiBold"
|
|
Foreground="#8b949e" />
|
|
<StackPanel Orientation="Horizontal" Spacing="8">
|
|
<Button Content="Screenshot" Command="{Binding TakeScreenshotCommand}" />
|
|
<Button Content="OCR Screen" Command="{Binding RunOcrCommand}" />
|
|
<Button Content="Go Hideout" Command="{Binding GoHideoutCommand}" />
|
|
<Button Content="Minimap Debug" Command="{Binding SaveMinimapDebugCommand}" />
|
|
</StackPanel>
|
|
<StackPanel Orientation="Horizontal" Spacing="8">
|
|
<Button Content="ANGE" Command="{Binding ClickAngeCommand}" />
|
|
<Button Content="STASH" Command="{Binding ClickStashCommand}" />
|
|
<Button Content="SALVAGE" Command="{Binding ClickSalvageCommand}" />
|
|
</StackPanel>
|
|
</StackPanel>
|
|
</Border>
|
|
|
|
<!-- Row 2: Find text -->
|
|
<Border Background="#161b22" BorderBrush="#30363d" BorderThickness="1"
|
|
CornerRadius="8" Padding="8">
|
|
<StackPanel Spacing="6">
|
|
<TextBlock Text="FIND TEXT" FontSize="11" FontWeight="SemiBold"
|
|
Foreground="#8b949e" />
|
|
<StackPanel Orientation="Horizontal" Spacing="8">
|
|
<TextBox Text="{Binding FindText}" Watermark="Text to find..."
|
|
Width="300" />
|
|
<Button Content="Find" Command="{Binding FindTextOnScreenCommand}" />
|
|
<Button Content="Find & Click" Command="{Binding FindAndClickCommand}" />
|
|
</StackPanel>
|
|
</StackPanel>
|
|
</Border>
|
|
|
|
<!-- Row 3: Grid scan -->
|
|
<Border Background="#161b22" BorderBrush="#30363d" BorderThickness="1"
|
|
CornerRadius="8" Padding="8">
|
|
<StackPanel Spacing="6">
|
|
<TextBlock Text="GRID SCAN" FontSize="11" FontWeight="SemiBold"
|
|
Foreground="#8b949e" />
|
|
<StackPanel Orientation="Horizontal" Spacing="8">
|
|
<ComboBox ItemsSource="{Binding GridLayoutNames}"
|
|
SelectedItem="{Binding SelectedGridLayout}" Width="160" />
|
|
<Button Content="Scan" Command="{Binding ScanGridCommand}" />
|
|
</StackPanel>
|
|
</StackPanel>
|
|
</Border>
|
|
|
|
<!-- Row 4: Click At -->
|
|
<Border Background="#161b22" BorderBrush="#30363d" BorderThickness="1"
|
|
CornerRadius="8" Padding="8">
|
|
<StackPanel Spacing="6">
|
|
<TextBlock Text="CLICK AT POSITION" FontSize="11" FontWeight="SemiBold"
|
|
Foreground="#8b949e" />
|
|
<StackPanel Orientation="Horizontal" Spacing="8">
|
|
<NumericUpDown Value="{Binding ClickX}" Watermark="X"
|
|
Width="100" Minimum="0" Maximum="2560" />
|
|
<NumericUpDown Value="{Binding ClickY}" Watermark="Y"
|
|
Width="100" Minimum="0" Maximum="1440" />
|
|
<Button Content="Click" Command="{Binding ClickAtCommand}" />
|
|
</StackPanel>
|
|
</StackPanel>
|
|
</Border>
|
|
|
|
<!-- Debug result output -->
|
|
<Border Background="#161b22" BorderBrush="#30363d" BorderThickness="1"
|
|
CornerRadius="8" Padding="8">
|
|
<StackPanel>
|
|
<TextBlock Text="OUTPUT" FontSize="11" FontWeight="SemiBold"
|
|
Foreground="#8b949e" Margin="0,0,0,4" />
|
|
<TextBlock Text="{Binding DebugResult}" FontFamily="Consolas"
|
|
FontSize="11" Foreground="#e6edf3" TextWrapping="Wrap" />
|
|
</StackPanel>
|
|
</Border>
|
|
</StackPanel>
|
|
</ScrollViewer>
|
|
</TabItem>
|
|
|
|
<!-- ========== SETTINGS TAB ========== -->
|
|
<TabItem Header="Settings">
|
|
<ScrollViewer DataContext="{Binding SettingsVm}" Margin="0,6,0,0">
|
|
<StackPanel Spacing="8" Margin="6" MaxWidth="600"
|
|
x:DataType="vm:SettingsViewModel">
|
|
|
|
<Border Background="#161b22" BorderBrush="#30363d" BorderThickness="1"
|
|
CornerRadius="8" Padding="10">
|
|
<StackPanel Spacing="8">
|
|
<TextBlock Text="GENERAL SETTINGS" FontSize="11" FontWeight="SemiBold"
|
|
Foreground="#8b949e" />
|
|
|
|
<StackPanel Spacing="4">
|
|
<TextBlock Text="POE2 Client.txt Path" FontSize="11" Foreground="#8b949e" />
|
|
<TextBox Text="{Binding Poe2LogPath}" />
|
|
</StackPanel>
|
|
|
|
<StackPanel Spacing="4">
|
|
<TextBlock Text="Window Title" FontSize="11" Foreground="#8b949e" />
|
|
<TextBox Text="{Binding WindowTitle}" />
|
|
</StackPanel>
|
|
|
|
<Grid ColumnDefinitions="*,*" RowDefinitions="Auto,Auto">
|
|
<StackPanel Grid.Row="0" Grid.Column="0" Spacing="4" Margin="0,0,4,6">
|
|
<TextBlock Text="Travel Timeout (ms)" FontSize="11" Foreground="#8b949e" />
|
|
<NumericUpDown Value="{Binding TravelTimeoutMs}" Minimum="1000"
|
|
Maximum="60000" Increment="1000" />
|
|
</StackPanel>
|
|
<StackPanel Grid.Row="0" Grid.Column="1" Spacing="4" Margin="4,0,0,6">
|
|
<TextBlock Text="Stash Scan Timeout (ms)" FontSize="11" Foreground="#8b949e" />
|
|
<NumericUpDown Value="{Binding StashScanTimeoutMs}" Minimum="1000"
|
|
Maximum="60000" Increment="1000" />
|
|
</StackPanel>
|
|
<StackPanel Grid.Row="1" Grid.Column="0" Spacing="4" Margin="0,0,4,0">
|
|
<TextBlock Text="Wait for More Items (ms)" FontSize="11" Foreground="#8b949e" />
|
|
<NumericUpDown Value="{Binding WaitForMoreItemsMs}" Minimum="1000"
|
|
Maximum="120000" Increment="1000" />
|
|
</StackPanel>
|
|
<StackPanel Grid.Row="1" Grid.Column="1" Spacing="4" Margin="4,0,0,0">
|
|
<TextBlock Text="Delay Between Trades (ms)" FontSize="11" Foreground="#8b949e" />
|
|
<NumericUpDown Value="{Binding BetweenTradesDelayMs}" Minimum="0"
|
|
Maximum="60000" Increment="1000" />
|
|
</StackPanel>
|
|
</Grid>
|
|
|
|
<CheckBox IsChecked="{Binding Headless}" Content="Headless browser"
|
|
Foreground="#e6edf3" Margin="0,4,0,0" />
|
|
|
|
<StackPanel Orientation="Horizontal" Spacing="8" Margin="0,2,0,0">
|
|
<Button Content="Save Settings" Command="{Binding SaveSettingsCommand}" />
|
|
<TextBlock Text="Saved!" Foreground="#3fb950" VerticalAlignment="Center"
|
|
IsVisible="{Binding IsSaved}" FontWeight="SemiBold" />
|
|
</StackPanel>
|
|
</StackPanel>
|
|
</Border>
|
|
</StackPanel>
|
|
</ScrollViewer>
|
|
</TabItem>
|
|
|
|
</TabControl>
|
|
</DockPanel>
|
|
</Window>
|