Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
MurkyYT committed May 24, 2024
2 parents c030a5b + 165014e commit 25ef3d8
Show file tree
Hide file tree
Showing 16 changed files with 401 additions and 79 deletions.
9 changes: 9 additions & 0 deletions src/CSAuto/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="CSAuto.Properties.DebugSettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="CSAuto.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
Expand All @@ -12,6 +13,11 @@
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
<userSettings>
<CSAuto.Properties.DebugSettings>
<setting name="pressAcceptButton" serializeAs="String">
<value>True</value>
</setting>
</CSAuto.Properties.DebugSettings>
<CSAuto.Properties.Settings>
<setting name="runAtStartUp" serializeAs="String">
<value>False</value>
Expand Down Expand Up @@ -115,6 +121,9 @@
<setting name="focusBackOnOriginalWindow" serializeAs="String">
<value>True</value>
</setting>
<setting name="autoBuyEnabled" serializeAs="String">
<value>True</value>
</setting>
</CSAuto.Properties.Settings>
</userSettings>
<applicationSettings>
Expand Down
6 changes: 3 additions & 3 deletions src/CSAuto/AutoBuyMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public enum NAMES {
{ NAMES.AUG,new object[] { "weapon_aug", 3300 } },
{ NAMES.AK47,new object[] { "weapon_ak47", 2700 } },
{ NAMES.M4A1S,new object[] { "weapon_m4a1_silencer", 2900 } },
{ NAMES.M4A4,new object[] { "weapon_m4a1", 3100 } },
{ NAMES.M4A4,new object[] { "weapon_m4a1", 3000 } },
{ NAMES.GalilAR,new object[] { "weapon_galilar", 1800 } },
{ NAMES.Famas,new object[] { "weapon_famas", 2050 } },
{ NAMES.SawedOff,new object[] { "weapon_sawedoff", 1100 } },
Expand Down Expand Up @@ -580,10 +580,10 @@ public List<BuyItem> GetItemsToBuy(GameState gameState,int armorAmountToRebuy)
hasMolotov = true;
grenadeCount++;
}
if (money >= 600 && !hasMolotov && gameState.Player.Team == Team.CT && grenadeCount < 4)
if (money >= 500 && !hasMolotov && gameState.Player.Team == Team.CT && grenadeCount < 4)
{
res.Add(item);
money -= 400;
money -= 500;
hasMolotov = true;
grenadeCount++;
}
Expand Down
22 changes: 21 additions & 1 deletion src/CSAuto/CSAuto.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@
<PropertyGroup>
<ApplicationIcon>Icons\main.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<ItemGroup>
<Reference Include="Steamworks.NET, Version=20.2.0.0, Culture=neutral, processorArchitecture=x86">
<SpecificVersion>False</SpecificVersion>
Expand Down Expand Up @@ -101,6 +104,9 @@
<DependentUpon>APIKeys.resx</DependentUpon>
</Compile>
<Compile Include="AutoBuyMenu.cs" />
<Compile Include="DebugSettings.xaml.cs">
<DependentUpon>DebugSettings.xaml</DependentUpon>
</Compile>
<Compile Include="DiscordRPCButtonSerializer.cs" />
<Compile Include="Exception\WriteException.cs" />
<Compile Include="Extentions.cs" />
Expand All @@ -116,6 +122,11 @@
<DesignTime>True</DesignTime>
<DependentUpon>Strings.ru.resx</DependentUpon>
</Compile>
<Compile Include="Properties\DebugSettings.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>DebugSettings.settings</DependentUpon>
</Compile>
<Compile Include="StreamString.cs" />
<Compile Include="Utils\CSGO\ConDump.cs" />
<Compile Include="Utils\DXGICapture.cs" />
Expand All @@ -137,6 +148,10 @@
<Compile Include="Utils\TypeConvertor.cs" />
<Compile Include="Utils\Steam.cs" />
<Compile Include="Utils\WinVersion.cs" />
<Page Include="DebugSettings.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="GUIWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand Down Expand Up @@ -200,6 +215,11 @@
<LastGenOutput>Strings.ru.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include=".editorconfig" />
<None Include="app.manifest" />
<None Include="Properties\DebugSettings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>DebugSettings.Designer.cs</LastGenOutput>
</None>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
Expand Down Expand Up @@ -237,7 +257,7 @@
<Version>2.4.10</Version>
</PackageReference>
<PackageReference Include="MdXaml">
<Version>1.25.0</Version>
<Version>1.27.0</Version>
</PackageReference>
<PackageReference Include="System.Buffers">
<Version>4.5.1</Version>
Expand Down
49 changes: 49 additions & 0 deletions src/CSAuto/DebugSettings.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<mahapps:MetroWindow x:Class="CSAuto.DebugSettings"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:CSAuto"
xmlns:properties="clr-namespace:CSAuto.Properties"
xmlns:mahapps="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
mc:Ignorable="d"
TitleCharacterCasing="Normal"
Title="Debug Settings" Height="450" Width="800">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Vertical" Grid.Row="0" Grid.Column="0">
<StackPanel Orientation="Horizontal">
<TextBlock x:Name="OriginalActive" Text="Original Color:" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Row="0" Grid.Column="0">
<TextBlock Text="Active Color:" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBox x:Name="ActiveColorRed" PreviewTextInput="NumberValidationTextBox" Margin="15,0,0,0" Width="50" MaxLength="3"/>
<TextBox x:Name="ActiveColorGreen" PreviewTextInput="NumberValidationTextBox" Margin="15,0,0,0" Width="50" MaxLength="3"/>
<TextBox x:Name="ActiveColorBlue" PreviewTextInput="NumberValidationTextBox" Margin="15,0,0,0" Width="50" MaxLength="3"/>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Vertical" Grid.Row="0" Grid.Column="1">
<StackPanel Orientation="Horizontal">
<TextBlock x:Name="OriginalRegular" Text="Original Color:" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Regular Color:" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBox x:Name="RegularColorRed" PreviewTextInput="NumberValidationTextBox" Margin="15,0,0,0" Width="50" MaxLength="3"/>
<TextBox x:Name="RegularColorGreen" PreviewTextInput="NumberValidationTextBox" Margin="15,0,0,0" Width="50" MaxLength="3"/>
<TextBox x:Name="RegularColorBlue" PreviewTextInput="NumberValidationTextBox" Margin="15,0,0,0" Width="50" MaxLength="3"/>
</StackPanel>
</StackPanel>

<CheckBox Content="Press Accept Button" Grid.Row="1" Grid.Column="0" IsChecked="{Binding Source={x:Static properties:DebugSettings.Default},Path=pressAcceptButton}"/>

<Button x:Name="ApplyButton" Content="Apply" Grid.RowSpan="100" Grid.ColumnSpan="100" HorizontalAlignment="Right" VerticalAlignment="Bottom" Click="ApplyButton_Click"/>
</Grid>
</mahapps:MetroWindow>
73 changes: 73 additions & 0 deletions src/CSAuto/DebugSettings.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
using MahApps.Metro.Controls;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace CSAuto
{
/// <summary>
/// Interaction logic for DebugSettings.xaml
/// </summary>
public partial class DebugSettings : MetroWindow
{
private MainApp main;

public DebugSettings(MainApp main)
{
this.main = main;

InitializeComponent();

if (main.current.IsWindows11)
{
IntPtr hWnd = new WindowInteropHelper(GetWindow(this)).EnsureHandle();
var attribute = NativeMethods.DWMWINDOWATTRIBUTE.DWMWA_WINDOW_CORNER_PREFERENCE;
var preference = NativeMethods.DWM_WINDOW_CORNER_PREFERENCE.DWMWCP_ROUND;
NativeMethods.DwmSetWindowAttribute(hWnd, attribute, ref preference, sizeof(uint));
}

Color regularColor = main.BUTTON_COLORS[0];
RegularColorRed.Text = regularColor.R.ToString();
RegularColorGreen.Text = regularColor.G.ToString();
RegularColorBlue.Text = regularColor.B.ToString();
OriginalRegular.Text = $"Original Color: {regularColor}";
Color activeColor = main.BUTTON_COLORS[1];
ActiveColorRed.Text = activeColor.R.ToString();
ActiveColorGreen.Text = activeColor.G.ToString();
ActiveColorBlue.Text = activeColor.B.ToString();
OriginalActive.Text = $"Original Color: {activeColor}";
}

private void NumberValidationTextBox(object sender, TextCompositionEventArgs e)
{
Regex regex = new Regex("[^0-9]+");
e.Handled = regex.IsMatch(e.Text);
}

private void ApplyButton_Click(object sender, RoutedEventArgs e)
{
main.BUTTON_COLORS[0] =
Color.FromArgb(int.Parse(RegularColorRed.Text),
int.Parse(RegularColorGreen.Text),
int.Parse(RegularColorBlue.Text));
main.BUTTON_COLORS[1] =
Color.FromArgb(int.Parse(ActiveColorRed.Text),
int.Parse(ActiveColorGreen.Text),
int.Parse(ActiveColorBlue.Text));
main.UpdateColors();
Properties.DebugSettings.Default.Save();
}
}
}
12 changes: 8 additions & 4 deletions src/CSAuto/GUIWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@
<MenuItem x:Name="OpenFile" Header="_Open" Click="OpenFile_Click"/>
<MenuItem x:Name="SaveFile" Header="_Save" Click="SaveFile_Click"/>
</MenuItem>
<MenuItem Header="_Debug settings" Click="DebugSettings_Click"/>
</Menu>
</DockPanel>
<TextBlock x:Name="IsPortableText" Text="Portable: {}" Grid.Row="1" Grid.Column="2" VerticalAlignment="Bottom" Margin="0,0,0,30"/>
Expand Down Expand Up @@ -299,10 +300,13 @@
</mahapps:MetroTabItem>
<mahapps:MetroTabItem Header="{x:Static p:Strings.menu_autobuy}">
<Grid>
<TabControl Panel.ZIndex="1" x:Name="AutoBuyTab" VerticalAlignment="Top" SelectionChanged="AutoBuyTab_SelectionChanged" mahapps:TabControlHelper.Underlined="SelectedTabItem" mahapps:TabControlHelper.UnderlinePlacement="Bottom" Height="48">
<mahapps:MetroTabItem Header="{x:Static p:Strings.team_ct}"/>
<mahapps:MetroTabItem Header="{x:Static p:Strings.team_t}"/>
</TabControl>
<CheckBox x:Name="AutoBuyEnabledCheckBox" Content="{x:Static p:Strings.text_enabled}" IsChecked="{Binding Source={x:Static properties:Settings.Default},Path=autoBuyEnabled}" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="0,15,0,0"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Top">
<TabControl Panel.ZIndex="1" x:Name="AutoBuyTab" VerticalAlignment="Top" SelectionChanged="AutoBuyTab_SelectionChanged" mahapps:TabControlHelper.Underlined="SelectedTabItem" mahapps:TabControlHelper.UnderlinePlacement="Bottom" Height="48">
<mahapps:MetroTabItem Header="{x:Static p:Strings.team_ct}"/>
<mahapps:MetroTabItem Header="{x:Static p:Strings.team_t}"/>
</TabControl>
</StackPanel>
<Image Panel.ZIndex="0" x:Name="AutoBuyImage" MouseDown="AutoBuyImage_MouseDown" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,48,0,0"/>
<Grid x:Name="BuyItemProperties" Visibility="Hidden">
<StackPanel>
Expand Down
9 changes: 8 additions & 1 deletion src/CSAuto/GUIWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,6 @@ private void GUIWindow_Loaded(object sender, RoutedEventArgs e)
$"CS:GO Path: \"{Steam.GetGameDir("Counter-Strike Global Offensive")}\"\n" +
$"CS:GO LaunchOptions: \"{launchOpt}\"";
GenerateLanguages();
DebugButtonColor.Text = $"Regular: {main.BUTTON_COLORS[0]}, Active: {main.BUTTON_COLORS[1]}";
string finalPath = Log.Path + DateTime.Now.Day.ToString() + "." + DateTime.Now.Month.ToString() + "." + DateTime.Now.Year.ToString() + "_Log.txt";
if (File.Exists(finalPath))
debugBox.Text = File.ReadAllText(finalPath);
Expand Down Expand Up @@ -436,6 +435,7 @@ private void CategoriesTabControl_SelectionChanged(object sender, SelectionChang
else if (CategoriesTabControl.SelectedItem != null && CategoriesTabControl.SelectedIndex == 2)
{
OldCaptureText.Text = Properties.Settings.Default.oldScreenCaptureWay ? "Old capture" : "New capture";
DebugButtonColor.Text = $"Regular: {main.BUTTON_COLORS[0]}, Active: {main.BUTTON_COLORS[1]}";
}
else if (CategoriesTabControl.SelectedItem != null && CategoriesTabControl.SelectedIndex == 4)
{
Expand Down Expand Up @@ -583,6 +583,7 @@ private void AutoBuyImage_MouseDown(object sender, System.Windows.Input.MouseBut
BuyItemProperties.Visibility = Visibility.Visible;
AutoBuyImage.Visibility = Visibility.Hidden;
AutoBuyTab.Visibility = Visibility.Hidden;
AutoBuyEnabledCheckBox.Visibility = Visibility.Hidden;
BuyItemName.Text = Languages.Strings.ResourceManager.GetString($"buyitem_{item.Name.ToString().ToLower()}");
BuyItemPriority.Value = item.GetPriority();
BuyItemEnabledCheckBox.IsChecked = item.IsEnabled();
Expand Down Expand Up @@ -646,6 +647,7 @@ private async void ApplyBuyItemButton_Click(object sender, RoutedEventArgs e)
BuyItemProperties.Visibility = Visibility.Hidden;
AutoBuyImage.Visibility = Visibility.Visible;
AutoBuyTab.Visibility = Visibility.Visible;
AutoBuyEnabledCheckBox.Visibility = Visibility.Visible;
if (customSelectedItem != null)
{
CustomBuyItem item = customSelectedItem;
Expand Down Expand Up @@ -722,5 +724,10 @@ private void debugBox_Loaded(object sender, RoutedEventArgs e)
{
debugBox_TextChanged(sender, null);
}

private void DebugSettings_Click(object sender, RoutedEventArgs e)
{
new DebugSettings(this.main).Show();
}
}
}
Loading

0 comments on commit 25ef3d8

Please sign in to comment.