Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# SleepStrap 6.9.4
# SleepStrap 6.9.5

![SleepStrap icon](SleepStrap/SleepStrap.png)

SleepStrap is a purple Windows launcher for Roblox with skyboxes, texture presets, visual modes, fonts, and Rivals display tools.

[Download SleepStrap 6.9.4](https://github.com/SleepyDebug/SleepStrap/releases/tag/sleepstrap-6.9.4) · [Discord](https://discord.gg/W3CMjx8C7s) · [Report an issue](https://github.com/SleepyDebug/SleepStrap/issues)
[Download SleepStrap 6.9.5](https://github.com/SleepyDebug/SleepStrap/releases/tag/sleepstrap-6.9.5) · [Discord](https://discord.gg/W3CMjx8C7s) · [Report an issue](https://github.com/SleepyDebug/SleepStrap/issues)

## Repository layout

Expand Down
7 changes: 0 additions & 7 deletions SleepStrap/Models/Persistable/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,6 @@ public class Settings
public string MacroSecondaryWeapon { get; set; } = "Warper";
public string MacroMeleeWeapon { get; set; } = "Maul";
public string MacroUtilityWeapon { get; set; } = "Grappler";
public string MacroQuickLoadoutPrimaryWeapon { get; set; } = "Distortion";
public string MacroQuickLoadoutSecondaryWeapon { get; set; } = "Warper";
public string MacroQuickLoadoutMeleeWeapon { get; set; } = "Maul";
public string MacroQuickLoadoutUtilityWeapon { get; set; } = "Grappler";
public int MacroQuickLoadoutHotkeyModifiers { get; set; } = 3; // Ctrl + Alt
public int MacroQuickLoadoutHotkeyVirtualKey { get; set; } = 0x51; // Q
public bool MacroQuickLoadoutEnabled { get; set; } = true;
public bool MacroQuickRespawn { get; set; } = false;
public bool MacroAutoUtility { get; set; } = false;
public bool MacroAutoInspect { get; set; } = false;
Expand Down
345 changes: 82 additions & 263 deletions SleepStrap/Services/MacroAutomationService.cs

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions SleepStrap/SleepStrap.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<UseWPF>true</UseWPF>
<UseWindowsForms>True</UseWindowsForms>
<ApplicationIcon>SleepStrap.ico</ApplicationIcon>
<Version>6.9.4.0</Version>
<FileVersion>6.9.4.0</FileVersion>
<Version>6.9.5.0</Version>
<FileVersion>6.9.5.0</FileVersion>
<ApplicationManifest>app.manifest</ApplicationManifest>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Platforms>x64</Platforms>
Expand Down
50 changes: 2 additions & 48 deletions SleepStrap/UI/Elements/Settings/Pages/MacroPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
xmlns:dmodels="clr-namespace:SleepStrap.UI.ViewModels.Settings"
mc:Ignorable="d" d:DataContext="{d:DesignInstance dmodels:MacroViewModel, IsDesignTimeCreatable=False}"
d:DesignHeight="700" d:DesignWidth="800" Title="Macro" Scrollable="True"
PreviewKeyDown="Page_PreviewKeyDown">
d:DesignHeight="700" d:DesignWidth="800" Title="Macro" Scrollable="True">
<ui:UiPage.Resources>
<DataTemplate x:Key="WeaponChoiceTemplate">
<StackPanel Orientation="Horizontal" Margin="0,3">
Expand Down Expand Up @@ -104,13 +103,7 @@
<TextBlock Text="Loadout macro" FontSize="17" FontWeight="SemiBold" />
</ui:CardExpander.Header>
<StackPanel>
<Grid Margin="0,0,0,14">
<Grid.ColumnDefinitions><ColumnDefinition Width="*" /><ColumnDefinition Width="Auto" /></Grid.ColumnDefinitions>
<TextBlock Text="Enable Quick Loadout" FontWeight="SemiBold" VerticalAlignment="Center" />
<ui:ToggleSwitch Grid.Column="1" IsChecked="{Binding QuickLoadoutEnabled, Mode=TwoWay}" />
</Grid>

<UniformGrid Columns="2" IsEnabled="{Binding QuickLoadoutEnabled}">
<UniformGrid Columns="2">
<StackPanel Margin="0,0,8,12">
<TextBlock Text="Primary" Margin="0,0,0,5" FontWeight="SemiBold" />
<ComboBox ItemsSource="{Binding AvailablePrimary}" SelectedItem="{Binding SelectedPrimary, Mode=TwoWay}"
Expand Down Expand Up @@ -153,44 +146,5 @@
</StackPanel>
</ui:CardExpander>

<ui:CardExpander Margin="0,10,0,0" IsExpanded="True" Visibility="{Binding QuickLoadoutVisibility}">
<ui:CardExpander.Header>
<TextBlock Text="Quick loadout" FontSize="17" FontWeight="SemiBold" />
</ui:CardExpander.Header>
<StackPanel>
<UniformGrid Columns="2">
<StackPanel Margin="0,0,8,12">
<TextBlock Text="Primary" Margin="0,0,0,5" FontWeight="SemiBold" />
<ComboBox ItemsSource="{Binding AvailablePrimary}" SelectedItem="{Binding QuickSelectedPrimary, Mode=TwoWay}"
ItemTemplate="{StaticResource WeaponChoiceTemplate}" />
</StackPanel>
<StackPanel Margin="8,0,0,12">
<TextBlock Text="Secondary" Margin="0,0,0,5" FontWeight="SemiBold" />
<ComboBox ItemsSource="{Binding AvailableSecondary}" SelectedItem="{Binding QuickSelectedSecondary, Mode=TwoWay}"
ItemTemplate="{StaticResource WeaponChoiceTemplate}" />
</StackPanel>
<StackPanel Margin="0,0,8,12">
<TextBlock Text="Melee" Margin="0,0,0,5" FontWeight="SemiBold" />
<ComboBox ItemsSource="{Binding AvailableMelee}" SelectedItem="{Binding QuickSelectedMelee, Mode=TwoWay}"
ItemTemplate="{StaticResource WeaponChoiceTemplate}" />
</StackPanel>
<StackPanel Margin="8,0,0,12">
<TextBlock Text="Utility" Margin="0,0,0,5" FontWeight="SemiBold" />
<ComboBox ItemsSource="{Binding AvailableUtility}" SelectedItem="{Binding QuickSelectedUtility, Mode=TwoWay}"
ItemTemplate="{StaticResource WeaponChoiceTemplate}" />
</StackPanel>
</UniformGrid>

<TextBlock Text="Quick loadout hotkey" Margin="0,2,0,5" FontWeight="SemiBold"
IsEnabled="{Binding QuickLoadoutEnabled}" />
<TextBox x:Name="QuickHotkeyBox" Height="38" IsReadOnly="True" Cursor="Hand"
IsEnabled="{Binding QuickLoadoutEnabled}"
HorizontalContentAlignment="Center" VerticalContentAlignment="Center"
FontWeight="SemiBold" Text="{Binding QuickLoadoutHotkeyDisplay, Mode=OneWay}"
PreviewMouseLeftButtonDown="QuickHotkeyBox_PreviewMouseLeftButtonDown"
PreviewKeyDown="QuickHotkeyBox_PreviewKeyDown"
LostKeyboardFocus="QuickHotkeyBox_LostKeyboardFocus" />
</StackPanel>
</ui:CardExpander>
</StackPanel>
</ui:UiPage>
87 changes: 0 additions & 87 deletions SleepStrap/UI/Elements/Settings/Pages/MacroPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,103 +1,16 @@
using System.Windows.Controls;
using System.Windows.Input;

using SleepStrap.UI.ViewModels.Settings;

namespace SleepStrap.UI.Elements.Settings.Pages
{
public partial class MacroPage
{
private readonly MacroViewModel _viewModel;
private bool _capturingQuickHotkey;
private int _pendingModifiers;
private int _pendingVirtualKey;

public MacroPage()
{
_viewModel = new MacroViewModel();
DataContext = _viewModel;
InitializeComponent();
}

private void Page_PreviewKeyDown(object sender, KeyEventArgs e)
{
Key key = e.Key == Key.System ? e.SystemKey : e.Key;
bool sevenDown = Keyboard.IsKeyDown(Key.D7) || Keyboard.IsKeyDown(Key.NumPad7);
bool revealChord = ((key == Key.D7 || key == Key.NumPad7) && Keyboard.IsKeyDown(Key.U)) ||
(key == Key.U && sevenDown);
if (!revealChord)
return;

_viewModel.RevealQuickLoadout();
e.Handled = true;
}

private void QuickHotkeyBox_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
_capturingQuickHotkey = true;
_viewModel.SetQuickHotkeyCaptureActive(true);
_pendingModifiers = 0;
_pendingVirtualKey = 0;
QuickHotkeyBox.Text = "Press keys, then Enter";
QuickHotkeyBox.Focus();
Keyboard.Focus(QuickHotkeyBox);
e.Handled = true;
}

private void QuickHotkeyBox_PreviewKeyDown(object sender, KeyEventArgs e)
{
if (!_capturingQuickHotkey)
return;

e.Handled = true;
Key key = e.Key == Key.System ? e.SystemKey : e.Key;
if (key == Key.Enter)
{
if (_pendingVirtualKey != 0)
_viewModel.SetQuickLoadoutHotkey(_pendingModifiers, _pendingVirtualKey);
FinishQuickHotkeyCapture();
return;
}
if (key == Key.Escape)
{
FinishQuickHotkeyCapture();
return;
}
if (key is Key.LeftAlt or Key.RightAlt or Key.LeftCtrl or Key.RightCtrl or Key.LeftShift or Key.RightShift or Key.LWin or Key.RWin)
return;

ModifierKeys modifiers = Keyboard.Modifiers;
_pendingModifiers = 0;
if (modifiers.HasFlag(ModifierKeys.Alt)) _pendingModifiers |= 1;
if (modifiers.HasFlag(ModifierKeys.Control)) _pendingModifiers |= 2;
if (modifiers.HasFlag(ModifierKeys.Shift)) _pendingModifiers |= 4;
if (modifiers.HasFlag(ModifierKeys.Windows)) _pendingModifiers |= 8;
_pendingVirtualKey = KeyInterop.VirtualKeyFromKey(key);
QuickHotkeyBox.Text = FormatHotkey(key, modifiers) + " • press Enter";
}

private void QuickHotkeyBox_LostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
{
if (_capturingQuickHotkey)
FinishQuickHotkeyCapture();
}

private void FinishQuickHotkeyCapture()
{
_capturingQuickHotkey = false;
_viewModel.SetQuickHotkeyCaptureActive(false);
QuickHotkeyBox.GetBindingExpression(TextBox.TextProperty)?.UpdateTarget();
}

private static string FormatHotkey(Key key, ModifierKeys modifiers)
{
var parts = new List<string>();
if (modifiers.HasFlag(ModifierKeys.Control)) parts.Add("Ctrl");
if (modifiers.HasFlag(ModifierKeys.Alt)) parts.Add("Alt");
if (modifiers.HasFlag(ModifierKeys.Shift)) parts.Add("Shift");
if (modifiers.HasFlag(ModifierKeys.Windows)) parts.Add("Win");
parts.Add(key.ToString());
return String.Join(" + ", parts);
}
}
}
Loading
Loading