Skip to content

Commit

Permalink
Weapons
Browse files Browse the repository at this point in the history
Some weapons was tweaked, 
Version info in the UI
  • Loading branch information
Lunat1q committed Mar 29, 2019
1 parent 53826a6 commit ed2825b
Show file tree
Hide file tree
Showing 17 changed files with 74 additions and 51 deletions.
4 changes: 4 additions & 0 deletions ScreenAssistant/Controllers/MainLogicController.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.ComponentModel;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
Expand Down Expand Up @@ -45,6 +46,8 @@ public bool MouseDown
}
}

public string CurrentVersionInfo { get; }

public MainLogicController(int deltaX, int deltaY, bool useWeaponLogic)
{
UseWeaponLogic = useWeaponLogic;
Expand All @@ -54,6 +57,7 @@ public MainLogicController(int deltaX, int deltaY, bool useWeaponLogic)
HotKeysController.BindUpToAction(KeyModifier.Ctrl, 'K', Toggle);
HotKeysController.Start(true);
ResetEquippedWeapons();
CurrentVersionInfo = Assembly.GetExecutingAssembly().GetName().Version.ToString();
}

private void ResetEquippedWeapons()
Expand Down
1 change: 0 additions & 1 deletion ScreenAssistant/Core/StringHelper.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;

namespace TiqSoft.ScreenAssistant.Core
{
Expand Down
12 changes: 5 additions & 7 deletions ScreenAssistant/Games/ApLeg/Weapons/Alternator.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
using TiqSoft.ScreenAssistant.Core;

namespace TiqSoft.ScreenAssistant.Games.ApLeg.Weapons
namespace TiqSoft.ScreenAssistant.Games.ApLeg.Weapons
{
internal sealed class Alternator : UniqueLogicWeapon
{
public Alternator(string name, double burstSeconds, string recognizedName)
public Alternator(string name, double burstSeconds, string recognizedName)
: base(name, burstSeconds, recognizedName, WeaponAL.Alternator)
{
}

public override double AdjustMouse(int shotNumber)
{
AdjustmentCoefficient = CalculateAdjustment(shotNumber, 45);
AdjustmentCoefficient = CalculateAdjustment(shotNumber, 25);
var horizontalOffset = Rnd.NextDouble() * 1 * 2 - 1;
var verticalOffset = Rnd.NextDouble() + 5.5d;
MouseControl.Move((int)horizontalOffset, (int)(verticalOffset * AdjustmentCoefficient));
var verticalOffset = Rnd.NextDouble() + 6d;
MoveMouse(horizontalOffset, verticalOffset);
return GetAdjustmentTime(1d);
}
}
Expand Down
6 changes: 6 additions & 0 deletions ScreenAssistant/Games/ApLeg/Weapons/ApLegWeaponBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ protected static double CalculateAdjustment(int shotNumber, double shotsPerBurst
return result > 1 ? 1 : result;
}

protected void MoveMouse(double horizontalOffset, double verticalOffset)
{
int hOffset = AdjustmentCoefficient > 0.001 ? (int)horizontalOffset : 0;
MouseControl.Move(hOffset, (int)(verticalOffset * AdjustmentCoefficient));
}

public override string ToString()
{
return$"{Name} : {_recognizedName}";
Expand Down
7 changes: 2 additions & 5 deletions ScreenAssistant/Games/ApLeg/Weapons/Devotion.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using TiqSoft.ScreenAssistant.Core;

namespace TiqSoft.ScreenAssistant.Games.ApLeg.Weapons
namespace TiqSoft.ScreenAssistant.Games.ApLeg.Weapons
{
internal sealed class Devotion : UniqueLogicWeapon
{
Expand All @@ -28,7 +25,7 @@ public override double AdjustMouse(int shotNumber)
verticalOffset = Rnd.NextDouble() * 0.5 + 2d;
}

MouseControl.Move((int)horizontalOffset, (int)(verticalOffset * AdjustmentCoefficient));
MoveMouse(horizontalOffset, verticalOffset);

return GetAdjustmentTime(1d);
}
Expand Down
13 changes: 6 additions & 7 deletions ScreenAssistant/Games/ApLeg/Weapons/Flatline.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using TiqSoft.ScreenAssistant.Core;

namespace TiqSoft.ScreenAssistant.Games.ApLeg.Weapons
namespace TiqSoft.ScreenAssistant.Games.ApLeg.Weapons
{
// ReSharper disable once IdentifierTypo
internal sealed class Flatline : UniqueLogicWeapon
Expand All @@ -13,11 +11,12 @@ public Flatline(string name, double burstSeconds, string recognizedName)

public override double AdjustMouse(int shotNumber)
{
AdjustmentCoefficient = CalculateAdjustment(shotNumber, 40);
var hAdj = shotNumber > 20 && shotNumber < 25 ? -1d : 1.25;
AdjustmentCoefficient = CalculateAdjustment(shotNumber, 30);
var vOffset = shotNumber < 7 ? 4d : 2d;
var hAdj = shotNumber > 8 && shotNumber < 12 ? -1d : 1;
var horizontalOffset = hAdj * (Rnd.NextDouble() * 1 + 1d);
var verticalOffset = Rnd.NextDouble() + 4d;
MouseControl.Move((int)(horizontalOffset), (int)(verticalOffset * AdjustmentCoefficient));
var verticalOffset = Rnd.NextDouble() + vOffset;
MoveMouse(horizontalOffset, verticalOffset);

return GetAdjustmentTime(1d);
}
Expand Down
7 changes: 2 additions & 5 deletions ScreenAssistant/Games/ApLeg/Weapons/Havoc.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using TiqSoft.ScreenAssistant.Core;

namespace TiqSoft.ScreenAssistant.Games.ApLeg.Weapons
namespace TiqSoft.ScreenAssistant.Games.ApLeg.Weapons
{
internal sealed class Havoc : UniqueLogicWeapon
{
Expand All @@ -17,7 +14,7 @@ public override double AdjustMouse(int shotNumber)
AdjustmentCoefficient = CalculateAdjustment(shotNumber, 40);
var horizontalOffset = Rnd.NextDouble() * 1 * 2 - 1;
var verticalOffset = Rnd.NextDouble() + 5.5d;
MouseControl.Move((int)horizontalOffset, (int)(verticalOffset * AdjustmentCoefficient));
MoveMouse(horizontalOffset, verticalOffset);
}

return GetAdjustmentTime(1d);
Expand Down
4 changes: 2 additions & 2 deletions ScreenAssistant/Games/ApLeg/Weapons/Hemlok.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using TiqSoft.ScreenAssistant.Core;

// ReSharper disable IdentifierTypo

namespace TiqSoft.ScreenAssistant.Games.ApLeg.Weapons
Expand All @@ -14,7 +14,7 @@ public override double AdjustMouse(int shotNumber)
AdjustmentCoefficient = CalculateAdjustment(shotNumber, 5);
var horizontalOffset = 0;
var verticalOffset = Rnd.NextDouble() + 7d;
MouseControl.Move(horizontalOffset, (int)(verticalOffset * AdjustmentCoefficient));
MoveMouse(horizontalOffset, verticalOffset);

return GetAdjustmentTime(1d);
}
Expand Down
6 changes: 2 additions & 4 deletions ScreenAssistant/Games/ApLeg/Weapons/Prowler.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using TiqSoft.ScreenAssistant.Core;

namespace TiqSoft.ScreenAssistant.Games.ApLeg.Weapons
namespace TiqSoft.ScreenAssistant.Games.ApLeg.Weapons
{
internal sealed class Prowler : UniqueLogicWeapon
{
Expand All @@ -13,7 +11,7 @@ public override double AdjustMouse(int shotNumber)
AdjustmentCoefficient = CalculateAdjustment(shotNumber, 14);
var horizontalOffset = 0;
var verticalOffset = Rnd.NextDouble() * 1 + 5.5d;
MouseControl.Move(horizontalOffset, (int)(verticalOffset * AdjustmentCoefficient));
MoveMouse(horizontalOffset, verticalOffset);
return GetAdjustmentTime(0.3d);
}
}
Expand Down
7 changes: 2 additions & 5 deletions ScreenAssistant/Games/ApLeg/Weapons/R301.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using TiqSoft.ScreenAssistant.Core;

namespace TiqSoft.ScreenAssistant.Games.ApLeg.Weapons
namespace TiqSoft.ScreenAssistant.Games.ApLeg.Weapons
{
internal sealed class R301 : UniqueLogicWeapon
{
Expand All @@ -20,7 +17,7 @@ public override double AdjustMouse(int shotNumber)
horizontalOffset = 0;
}
var verticalOffset = Rnd.NextDouble() + 4d;
MouseControl.Move((int)horizontalOffset, (int)(verticalOffset * AdjustmentCoefficient));
MoveMouse(horizontalOffset, verticalOffset);

return GetAdjustmentTime(1d);
}
Expand Down
6 changes: 2 additions & 4 deletions ScreenAssistant/Games/ApLeg/Weapons/R99.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using TiqSoft.ScreenAssistant.Core;

namespace TiqSoft.ScreenAssistant.Games.ApLeg.Weapons
namespace TiqSoft.ScreenAssistant.Games.ApLeg.Weapons
{
internal sealed class R99 : UniqueLogicWeapon
{
Expand All @@ -14,7 +12,7 @@ public override double AdjustMouse(int shotNumber)
AdjustmentCoefficient = CalculateAdjustment(shotNumber, 35);
var horizontalOffset = Rnd.NextDouble() * -1 - 1;
var verticalOffset = Rnd.NextDouble() + 7;
MouseControl.Move((int)horizontalOffset, (int)(verticalOffset * AdjustmentCoefficient));
MoveMouse(horizontalOffset, verticalOffset);

return GetAdjustmentTime(1d);
}
Expand Down
6 changes: 2 additions & 4 deletions ScreenAssistant/Games/ApLeg/Weapons/RE45.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using TiqSoft.ScreenAssistant.Core;

namespace TiqSoft.ScreenAssistant.Games.ApLeg.Weapons
namespace TiqSoft.ScreenAssistant.Games.ApLeg.Weapons
{
// ReSharper disable once InconsistentNaming
internal sealed class RE45 : UniqueLogicWeapon
Expand All @@ -15,7 +13,7 @@ public override double AdjustMouse(int shotNumber)
AdjustmentCoefficient = CalculateAdjustment(shotNumber, 25);
var horizontalOffset = -1 * (Rnd.NextDouble() * 1 + 2d);
var verticalOffset = Rnd.NextDouble() + 4d;
MouseControl.Move((int)(horizontalOffset), (int)(verticalOffset * AdjustmentCoefficient));
MoveMouse(horizontalOffset, verticalOffset);

return GetAdjustmentTime(1d);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using TiqSoft.ScreenAssistant.Core;

namespace TiqSoft.ScreenAssistant.Games.ApLeg.Weapons
{
Expand All @@ -19,7 +18,7 @@ public override double AdjustMouse(int shotNumber)
AdjustmentCoefficient = CalculateAdjustment(shotNumber, ShotsPerBurst);
var horizontalOffset = Rnd.NextDouble() * DeltaX * 2 - DeltaX;
var verticalOffset = Rnd.NextDouble() * (MaxOffsetY - MinOffsetY) + MinOffsetY;
MouseControl.Move((int)horizontalOffset, (int)(verticalOffset * AdjustmentCoefficient));
MoveMouse(horizontalOffset, verticalOffset);
return Rnd.NextDouble() * (MaxFireRate - MinFireRate) + MinFireRate;
}

Expand Down
5 changes: 5 additions & 0 deletions ScreenAssistant/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0" Margin="5" MinHeight="35">
<Grid.ColumnDefinitions>
Expand Down Expand Up @@ -93,5 +94,9 @@
<!-- -->
<Button Content="TEST" Click="Button_Click_2"/>
</Grid>
<Grid Grid.Row="4" Margin="5,5,5,0" >
<!-- -->
<TextBlock Text="{Binding CurrentVersionInfo}" HorizontalAlignment="Right" VerticalAlignment="Center" FontStyle="Italic" Foreground="#FF404040" FontSize="9"/>
</Grid>
</Grid>
</Window>
4 changes: 2 additions & 2 deletions ScreenAssistant/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")]
[assembly: AssemblyVersion("1.2.3.0")]
[assembly: AssemblyFileVersion("1.2.3.0")]
7 changes: 4 additions & 3 deletions TiqLauncher.ScreenAssistant/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,14 @@ static void Main(string[] args)
private static void CreateSecureBinFolder(string folderPath)
{
// Way safer than string comparison against "BUILTIN\\Administrators"
IdentityReference builtinAdministrators = new SecurityIdentifier(WellKnownSidType.BuiltinAdministratorsSid, null);
IdentityReference secureSid = new SecurityIdentifier(WellKnownSidType.BuiltinAdministratorsSid, null);
//IdentityReference secureSid = new SecurityIdentifier(WellKnownSidType.LocalSystemSid, null);
DirectorySecurity dirSec = new DirectorySecurity();
dirSec.AddAccessRule(new FileSystemAccessRule(builtinAdministrators, FileSystemRights.FullControl, AccessControlType.Allow));
dirSec.AddAccessRule(new FileSystemAccessRule(secureSid, FileSystemRights.FullControl, AccessControlType.Allow));
Directory.CreateDirectory(folderPath, dirSec);
// Grab ACL from folder
var dirAccessControl = Directory.GetAccessControl(folderPath);
dirAccessControl.SetOwner(builtinAdministrators);
dirAccessControl.SetOwner(secureSid);
}

private static void PrepareBinaries()
Expand Down
27 changes: 27 additions & 0 deletions TiqLauncher.ScreenAssistant/TiqLauncher.ScreenAssistant.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,21 @@
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
Expand Down Expand Up @@ -77,6 +92,18 @@
<ItemGroup>
<Content Include="iconfinder__magic_wand_1679640_hWM_icon.ico" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.6">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.6 %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>cd $(TargetDir)
Expand Down

0 comments on commit ed2825b

Please sign in to comment.