This commit is contained in:
BubbaGumpShrump 2024-12-02 22:56:20 -05:00
parent a8b19db5e2
commit 0148992b38
6 changed files with 269 additions and 187 deletions

View file

@ -14,11 +14,13 @@
<Color x:Key="BackgroundDarkColor">#0F1A2B</Color>
<Color x:Key="BackgroundLightColor">#1D2D44</Color>
<Color x:Key="TextColor">#FFFFFF</Color>
<Color x:Key="AltTextColor">#A88F2C</Color>
<SolidColorBrush x:Key="TextBrush" Color="{DynamicResource TextColor}" />
<SolidColorBrush x:Key="AccentBrush" Color="{DynamicResource AccentColor}" />
<SolidColorBrush x:Key="BackgroundDarkBrush" Color="{DynamicResource BackgroundDarkColor}" />
<SolidColorBrush x:Key="BackgroundLightBrush" Color="{DynamicResource BackgroundLightColor}" />
<SolidColorBrush x:Key="AltTextBrush" Color="{DynamicResource AltTextColor}" />
<!-- Define the Style for Window -->
<Style TargetType="Window" x:Key="CustomWindowStyle">

View file

@ -133,52 +133,58 @@ namespace AutoTrackR2
(Color)ColorConverter.ConvertFromString("#00A9E0"), // Accent/Border
(Color)ColorConverter.ConvertFromString("#0F1A2B"), // Button
(Color)ColorConverter.ConvertFromString("#1D2D44"), // Background
(Color)ColorConverter.ConvertFromString("#FFFFFF") // Text
(Color)ColorConverter.ConvertFromString("#FFFFFF"), // Text
(Color)ColorConverter.ConvertFromString("#A88F2C") // AltText
);
ChangeLogo("/Assets/AutoTrackR.png");
break;
case 1: // Green Theme
UpdateThemeColors(
(Color)ColorConverter.ConvertFromString("#1D9F00"), // Accent/Border
(Color)ColorConverter.ConvertFromString("#262424"), // Button
(Color)ColorConverter.ConvertFromString("#072501"), // Background
(Color)ColorConverter.ConvertFromString("#D7AF3C") // Text
(Color)ColorConverter.ConvertFromString("#1D9F00"), // Accent/Border
(Color)ColorConverter.ConvertFromString("#262424"), // Button
(Color)ColorConverter.ConvertFromString("#072501"), // Background
(Color)ColorConverter.ConvertFromString("#D7AF3C"), // Text
(Color)ColorConverter.ConvertFromString("#DCD6C4") // AltText
);
ChangeLogo("/Assets/AutoTrackR.png");
break;
case 2: // Red Theme
UpdateThemeColors(
(Color)ColorConverter.ConvertFromString("#D32F2F"), // Accent/Border
(Color)ColorConverter.ConvertFromString("#424242"), // Button
(Color)ColorConverter.ConvertFromString("#212121"), // Light Background
(Color)ColorConverter.ConvertFromString("#E0E0E0") // Text
(Color)ColorConverter.ConvertFromString("#D32F2F"), // Accent/Border
(Color)ColorConverter.ConvertFromString("#424242"), // Button
(Color)ColorConverter.ConvertFromString("#212121"), // Light Background
(Color)ColorConverter.ConvertFromString("#E0E0E0"), // Text
(Color)ColorConverter.ConvertFromString("#A88F2C") // AltText
);
ChangeLogo("/Assets/AutoTrackR.png");
break;
case 3: // Purple Theme
UpdateThemeColors(
(Color)ColorConverter.ConvertFromString("#32CD32"), // Accent/Border
(Color)ColorConverter.ConvertFromString("#33065F"), // Button
(Color)ColorConverter.ConvertFromString("#43065F"), // Background
(Color)ColorConverter.ConvertFromString("#00FF00") // Text
(Color)ColorConverter.ConvertFromString("#32CD32"), // Accent/Border
(Color)ColorConverter.ConvertFromString("#33065F"), // Button
(Color)ColorConverter.ConvertFromString("#43065F"), // Background
(Color)ColorConverter.ConvertFromString("#00FF00"), // Text
(Color)ColorConverter.ConvertFromString("#B3976E") // AltText
);
ChangeLogo("/Assets/AutoTrackR.png");
break;
case 4: // GN Theme
UpdateThemeColors(
(Color)ColorConverter.ConvertFromString("#FF0000"), // Accent/Border
(Color)ColorConverter.ConvertFromString("#1C1C1C"), // Button
(Color)ColorConverter.ConvertFromString("#000000"), // Background
(Color)ColorConverter.ConvertFromString("#FBC603") // Text
(Color)ColorConverter.ConvertFromString("#FF0000"), // Accent/Border
(Color)ColorConverter.ConvertFromString("#1C1C1C"), // Button
(Color)ColorConverter.ConvertFromString("#000000"), // Background
(Color)ColorConverter.ConvertFromString("#FBC603"), // Text
(Color)ColorConverter.ConvertFromString("#BFA8A6") // AltText
);
ChangeLogo("/Assets/GN.png", (Color)ColorConverter.ConvertFromString("#FF0000"));
break;
case 5: // NW Theme
UpdateThemeColors(
(Color)ColorConverter.ConvertFromString("#B92D2D"), // Accent/Border
(Color)ColorConverter.ConvertFromString("#1C1C1C"), // Button
(Color)ColorConverter.ConvertFromString("#262424"), // Background
(Color)ColorConverter.ConvertFromString("#01DDDA") // Text
(Color)ColorConverter.ConvertFromString("#B92D2D"), // Accent/Border
(Color)ColorConverter.ConvertFromString("#1C1C1C"), // Button
(Color)ColorConverter.ConvertFromString("#262424"), // Background
(Color)ColorConverter.ConvertFromString("#01DDDA"), // Text
(Color)ColorConverter.ConvertFromString("#A88F2C") // AltText
);
ChangeLogo("/Assets/NW.png", (Color)ColorConverter.ConvertFromString("#01DDDA"));
break;
@ -187,25 +193,28 @@ namespace AutoTrackR2
(Color)ColorConverter.ConvertFromString("#000000"), // Accent/Border
(Color)ColorConverter.ConvertFromString("#3E3E3E"), // Button
(Color)ColorConverter.ConvertFromString("#4C1C1C"), // Background
(Color)ColorConverter.ConvertFromString("#FF0000") // Text
(Color)ColorConverter.ConvertFromString("#FF0000"), // Text
(Color)ColorConverter.ConvertFromString("#A88F2C") // AltText
);
ChangeLogo("/Assets/D3VL.png", (Color)ColorConverter.ConvertFromString("#000000"));
break;
case 7: // HIT Theme
UpdateThemeColors(
(Color)ColorConverter.ConvertFromString("#000000"), // Accent/Border
(Color)ColorConverter.ConvertFromString("#3E3E3E"), // Button
(Color)ColorConverter.ConvertFromString("#4C1C1C"), // Background
(Color)ColorConverter.ConvertFromString("#FF0000") // Text
(Color)ColorConverter.ConvertFromString("#B92D2D"), // Accent/Border
(Color)ColorConverter.ConvertFromString("#1C1C1C"), // Button
(Color)ColorConverter.ConvertFromString("#262424"), // Background
(Color)ColorConverter.ConvertFromString("#7d7d7d"), // Text
(Color)ColorConverter.ConvertFromString("#A88F2C") // AltText
);
ChangeLogo("/Assets/HIT.png", (Color)ColorConverter.ConvertFromString("#fd2929"));
ChangeLogo("/Assets/HIT.png");
break;
case 8: // VOX Theme
UpdateThemeColors(
(Color)ColorConverter.ConvertFromString("#C0C0C0"), // Accent/Border
(Color)ColorConverter.ConvertFromString("#1C1C1C"), // Button
(Color)ColorConverter.ConvertFromString("#424242"), // Background
(Color)ColorConverter.ConvertFromString("#FFD700") // Text
(Color)ColorConverter.ConvertFromString("#FFD700"), // Text
(Color)ColorConverter.ConvertFromString("#817E79") // AltText
);
ChangeLogo("/Assets/VOX.png", (Color)ColorConverter.ConvertFromString("#FFD700"));
break;
@ -214,7 +223,8 @@ namespace AutoTrackR2
(Color)ColorConverter.ConvertFromString("#F5721C"), // Accent/Border
(Color)ColorConverter.ConvertFromString("#535353"), // Button
(Color)ColorConverter.ConvertFromString("#080000"), // Background
(Color)ColorConverter.ConvertFromString("#FFFFFF") // Text
(Color)ColorConverter.ConvertFromString("#FFFFFF"), // Text
(Color)ColorConverter.ConvertFromString("#CEA75B") // AltText
);
ChangeLogo("/Assets/EMP.png", (Color)ColorConverter.ConvertFromString("#F3BD9B"));
break;
@ -222,19 +232,21 @@ namespace AutoTrackR2
}
// Helper method to update both Color and Brush resources
private void UpdateThemeColors(Color accent, Color backgroundDark, Color backgroundLight, Color text)
private void UpdateThemeColors(Color accent, Color backgroundDark, Color backgroundLight, Color text, Color altText)
{
// Update color resources
Application.Current.Resources["AccentColor"] = accent;
Application.Current.Resources["BackgroundDarkColor"] = backgroundDark;
Application.Current.Resources["BackgroundLightColor"] = backgroundLight;
Application.Current.Resources["TextColor"] = text;
Application.Current.Resources["AltTextColor"] = altText;
// Update SolidColorBrush resources
Application.Current.Resources["AccentBrush"] = new SolidColorBrush(accent);
Application.Current.Resources["BackgroundDarkBrush"] = new SolidColorBrush(backgroundDark);
Application.Current.Resources["BackgroundLightBrush"] = new SolidColorBrush(backgroundLight);
Application.Current.Resources["TextBrush"] = new SolidColorBrush(text);
Application.Current.Resources["AltTextBrush"] = new SolidColorBrush(altText);
}
// This method will be called when switching tabs to restore the saved slider position.

View file

@ -19,24 +19,26 @@
</Grid.ColumnDefinitions>
<!-- Border for the kill feed section -->
<TextBox Name="OutputTextBox" Grid.Row="0" Grid.Column="0" Grid.RowSpan="2" Height="NaN" Margin="0,0,20,0" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto" IsReadOnly="True" Style="{StaticResource RoundedTextBox}"/>
<!-- Border Grid.Row="0" Grid.Column="0" BorderBrush="{DynamicResource AccentBrush}" BorderThickness="2" CornerRadius="10" Padding="10" Background="{DynamicResource BackgroundDarkBrush}" Margin="0,0,20,0">
<TextBlock Text="Kill Feed Goes Here..." FontSize="18" Foreground="{DynamicResource TextBrush}" HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border -->
<!--TextBox Name="OutputTextBox" Grid.Row="0" Grid.Column="0" Grid.RowSpan="2" Height="NaN" Margin="0,0,20,0" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto" IsReadOnly="True" Style="{StaticResource RoundedTextBox}"/-->
<Border Grid.Row="0" Grid.Column="0" Grid.RowSpan="2" BorderBrush="{DynamicResource AccentBrush}" BorderThickness="2" CornerRadius="10" Padding="0" Background="{DynamicResource BackgroundDarkBrush}" Margin="0,0,20,0">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<StackPanel Name="KillFeedStackPanel" Orientation="Vertical" Height="384" Width="407"/>
</ScrollViewer>
</Border>
<!-- StackPanel for Start and Stop buttons -->
<Border Background="{DynamicResource BackgroundDarkBrush}" BorderBrush="{DynamicResource AccentBrush}" Grid.Row="0" Grid.Column="1" BorderThickness="2" CornerRadius="5" Margin="0,0,0,134"/>
<StackPanel Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Center" Height="269" Width="152">
<TextBlock Name="PilotNameTitle" Text="Pilot" Width="152" Height="20" Background="Transparent" FontFamily="{StaticResource Orbitron}" Margin="0,5,0,0" Foreground="{DynamicResource AccentBrush}" FontSize="14"/>
<TextBlock Name="PilotNameTextBox" Text="X" Width="152" Height="20" Background="Transparent" FontFamily="{StaticResource Orbitron}" Margin="0,0,0,0" Foreground="{DynamicResource TextBrush}" FontSize="11" TextAlignment="Center"/>
<TextBlock Name="PlayerShipTitle" Text="Ship" Width="152" Height="20" Background="Transparent" FontFamily="{StaticResource Orbitron}" Margin="0,5,0,0" Foreground="{DynamicResource AccentBrush}" FontSize="14" />
<TextBlock Name="PlayerShipTextBox" Text="X" Width="152" Height="20" Background="Transparent" FontFamily="{StaticResource Orbitron}" Margin="0,0,0,0" Foreground="{DynamicResource TextBrush}" FontSize="11" TextAlignment="Center"/>
<TextBlock Name="GameModeTitle" Text="Game Mode" Width="152" Height="20" Background="Transparent" FontFamily="{StaticResource Orbitron}" Margin="0,5,0,0" Foreground="{DynamicResource AccentBrush}" FontSize="14"/>
<TextBlock Name="GameModeTextBox" Text="X" Width="152" Height="20" Background="Transparent" FontFamily="{StaticResource Orbitron}" Margin="0,0,0,0" Foreground="{DynamicResource TextBrush}" FontSize="11" TextAlignment="Center"/>
<TextBlock Name="PilotNameTitle" Text="Pilot" Width="152" Height="20" Background="Transparent" FontFamily="{StaticResource Orbitron}" Margin="0,5,0,0" Foreground="{DynamicResource AltTextBrush}" FontSize="14"/>
<TextBlock Name="PilotNameTextBox" Width="152" Height="20" Background="Transparent" FontFamily="{StaticResource Orbitron}" Margin="0,0,0,0" Foreground="{DynamicResource TextBrush}" FontSize="11" TextAlignment="Center"/>
<TextBlock Name="PlayerShipTitle" Text="Ship" Width="152" Height="20" Background="Transparent" FontFamily="{StaticResource Orbitron}" Margin="0,5,0,0" Foreground="{DynamicResource AltTextBrush}" FontSize="14" />
<TextBlock Name="PlayerShipTextBox" Width="152" Height="20" Background="Transparent" FontFamily="{StaticResource Orbitron}" Margin="0,0,0,0" Foreground="{DynamicResource TextBrush}" FontSize="11" TextAlignment="Center"/>
<TextBlock Name="GameModeTitle" Text="Game Mode" Width="152" Height="20" Background="Transparent" FontFamily="{StaticResource Orbitron}" Margin="0,5,0,0" Foreground="{DynamicResource AltTextBrush}" FontSize="14"/>
<TextBlock Name="GameModeTextBox" Width="152" Height="20" Background="Transparent" FontFamily="{StaticResource Orbitron}" Margin="0,0,0,0" Foreground="{DynamicResource TextBrush}" FontSize="11" TextAlignment="Center"/>
</StackPanel>
<StackPanel Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Center" Height="120" Width="172" >
<Button Name="StartButton" Content="Start" Width="100" Height="40" Style="{StaticResource ButtonStyle}" FontFamily="{StaticResource Orbitron}" Margin="0,20" Click="StartButton_Click"/>
<Button Name="StopButton" Content="Stop" Width="100" Height="40" Style="{StaticResource DisabledButtonStyle}" FontFamily="{StaticResource Orbitron}" IsEnabled="False"/>
<Button Name="StopButton" Content="Stop" Width="100" Height="40" Style="{StaticResource DisabledButtonStyle}" FontFamily="{StaticResource Orbitron}" IsEnabled="False" Click="StopButton_Click"/>
</StackPanel>
</Grid>
</Grid>

View file

@ -14,6 +14,8 @@ namespace AutoTrackR2
InitializeComponent();
}
private Process runningProcess; // Field to store the running process
// Update Start/Stop button states based on the isRunning flag
public void UpdateButtonState(bool isRunning)
{
@ -23,7 +25,6 @@ namespace AutoTrackR2
{
// Set Start button to "Running..." and apply glow effect
StartButton.Content = "Running...";
StartButton.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#00A9E0"));
StartButton.IsEnabled = false; // Disable Start button
StartButton.Style = (Style)FindResource("DisabledButtonStyle");
@ -31,7 +32,7 @@ namespace AutoTrackR2
StartButton.Effect = new DropShadowEffect
{
Color = accentColor,
BlurRadius = 20, // Adjust blur radius for desired glow intensity
BlurRadius = 30, // Adjust blur radius for desired glow intensity
ShadowDepth = 0, // Set shadow depth to 0 for a pure glow effect
Opacity = 1, // Set opacity for glow visibility
Direction = 0 // Direction doesn't matter for glow
@ -44,7 +45,6 @@ namespace AutoTrackR2
{
// Reset Start button back to its original state
StartButton.Content = "Start";
StartButton.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#0F1A2B"));
StartButton.IsEnabled = true; // Enable Start button
// Remove the glow effect from Start button
@ -78,55 +78,71 @@ namespace AutoTrackR2
CreateNoWindow = true
};
using (Process process = new Process { StartInfo = psi })
runningProcess = new Process { StartInfo = psi }; // Store the process in the field
runningProcess.OutputDataReceived += (s, e) =>
{
process.OutputDataReceived += (s, e) =>
if (!string.IsNullOrEmpty(e.Data))
{
if (!string.IsNullOrEmpty(e.Data))
Dispatcher.Invoke(() =>
{
Dispatcher.Invoke(() =>
// Parse and display key-value pairs in the OutputTextBox
if (e.Data.Contains("PlayerName="))
{
// Parse and display key-value pairs in the OutputTextBox
if (e.Data.Contains("PlayerName="))
{
string pilotName = e.Data.Split('=')[1].Trim();
PilotNameTextBox.Text = pilotName; // Update the Button's Content
}
else if (e.Data.Contains("PlayerShip="))
{
string playerShip = e.Data.Split('=')[1].Trim();
PlayerShipTextBox.Text = playerShip;
}
else if (e.Data.Contains("GameMode="))
{
string gameMode = e.Data.Split('=')[1].Trim();
GameModeTextBox.Text = gameMode;
}
else
{
OutputTextBox.AppendText(e.Data + Environment.NewLine);
}
});
}
};
string pilotName = e.Data.Split('=')[1].Trim();
PilotNameTextBox.Text = pilotName; // Update the Button's Content
}
else if (e.Data.Contains("PlayerShip="))
{
string playerShip = e.Data.Split('=')[1].Trim();
PlayerShipTextBox.Text = playerShip;
}
else if (e.Data.Contains("GameMode="))
{
string gameMode = e.Data.Split('=')[1].Trim();
GameModeTextBox.Text = gameMode;
}
else if (e.Data.Contains("NewKill="))
{
// Parse the kill data
var killData = e.Data.Split('=')[1].Trim(); // Assume the kill data follows after "NewKill="
var killParts = killData.Split(',');
process.ErrorDataReceived += (s, e) =>
// Create a new TextBlock for each kill
var killTextBlock = new TextBlock
{
Text = $"\nVictim Name: {killParts[1]}\nVictim Ship: {killParts[2]}\nVictim Org: {killParts[3]}\nJoin Date: {killParts[4]}\nUEE Record: {killParts[5]}\nKill Time: {killParts[6]}",
Style = (Style)Application.Current.Resources["RoundedTextBox"], // Apply the style from resources
FontSize = 14,
Margin = new Thickness(0, 10, 0, 10)
};
// Add the new TextBlock to the StackPanel inside the Border
KillFeedStackPanel.Children.Add(killTextBlock);
}
else
{
GameModeTextBox.Text = "ERROR";
}
});
}
};
runningProcess.ErrorDataReceived += (s, e) =>
{
if (!string.IsNullOrEmpty(e.Data))
{
if (!string.IsNullOrEmpty(e.Data))
Dispatcher.Invoke(() =>
{
Dispatcher.Invoke(() =>
{
OutputTextBox.AppendText("Error: " + e.Data + Environment.NewLine);
});
}
};
});
}
};
process.Start();
process.BeginOutputReadLine();
process.BeginErrorReadLine();
runningProcess.Start();
runningProcess.BeginOutputReadLine();
runningProcess.BeginErrorReadLine();
process.WaitForExit();
}
runningProcess.WaitForExit();
}
catch (Exception ex)
{
@ -138,5 +154,20 @@ namespace AutoTrackR2
});
}
private void StopButton_Click(object sender, RoutedEventArgs e)
{
if (runningProcess != null && !runningProcess.HasExited)
{
// Kill the running process
runningProcess.Kill();
runningProcess = null; // Clear the reference to the process
}
// Clear the text boxes
System.Threading.Thread.Sleep(200);
PilotNameTextBox.Text = string.Empty;
PlayerShipTextBox.Text = string.Empty;
GameModeTextBox.Text = string.Empty;
}
}
}

View file

@ -1,10 +1,12 @@
# Path to the config file
$TrackRver = "2.0"
# Path to the config file
$scriptFolder = Split-Path -Parent $MyInvocation.MyCommand.Path
$configFile = Join-Path -Path $scriptFolder -ChildPath "config.ini"
# Read the config file into a hashtable
if (Test-Path $configFile) {
Write-Output "Config.ini found."
Write-Output "PlayerName=Config.ini found."
$configContent = Get-Content $configFile | Where-Object { $_ -notmatch '^#|^\s*$' }
# Escape backslashes by doubling them
@ -13,20 +15,12 @@ if (Test-Path $configFile) {
# Convert to key-value pairs
$config = $configContent -replace '^([^=]+)=(.+)$', '$1=$2' | ConvertFrom-StringData
} else {
Write-Output "Config.ini not found."
Write-Output "PlayerName=Config.ini not found."
exit
}
$PlayerName = "Immersion_Breaker"
$PlayerShip = "ANVL_F7A_Mk2"
$GameMode = "PU"
Write-Output "PlayerName=$PlayerName"
Write-Output "PlayerShip=$PlayerShip"
Write-Output "GameMode=$GameMode"
# Access config values
$logFile = $config.Logfile
$logFilePath = $config.Logfile
$apiUrl = $config.ApiUrl
$apiKey = $config.ApiKey
$videoPath = $config.VideoPath
@ -46,15 +40,18 @@ if ($videoRecord -eq 1){
$videoRecord = $false
}
$logfileContent = Get-Content $logFile
If (Test-Path $logFile) {
Write-Output "Logfile found."
if ($visorWipe -eq 1){
$visorWipe = $true
} else {
Write-Output "Logfile not found."
$visorWipe = $false
}
If (Test-Path $logFilePath) {
Write-Output "PlayerName=Logfile found"
} else {
Write-Output "PlayerName=Logfile not found."
}
Write-Output $logfileContent
<# Define the regex pattern to extract information
$killPattern = "<Actor Death> CActor::Kill: '(?<EnemyPilot>[^']+)' \[\d+\] in zone '(?<EnemyShip>[^']+)' killed by '(?<Player>[^']+)' \[[^']+\] using '(?<Weapon>[^']+)' \[Class (?<Class>[^\]]+)\] with damage type '(?<DamageType>[^']+)'"
$puPattern = '<\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z> \[Notice\] <ContextEstablisherTaskFinished> establisher="CReplicationModel" message="CET completed" taskname="StopLoadingScreen" state=[^ ]+ status="Finished" runningTime=\d+\.\d+ numRuns=\d+ map="megamap" gamerules="SC_Default" sessionId="[a-f0-9\-]+" \[Team_Network\]\[Network\]\[Replication\]\[Loading\]\[Persistence\]'
@ -63,6 +60,7 @@ $loadoutPattern = '\[InstancedInterior\] OnEntityLeaveZone - InstancedInterior \
# $loginPattern = "\[Notice\] <AccountLoginCharacterStatus_Character> Character: createdAt [A-Za-z0-9]+ - updatedAt [A-Za-z0-9]+ - geid [A-Za-z0-9]+ - accountId [A-Za-z0-9]+ - name (?<Player>[A-Za-z0-9_-]+) - state STATE_CURRENT" # KEEP THIS INCASE LEGACY LOGIN IS REMOVED
$loginPattern = "\[Notice\] <Legacy login response> \[CIG-net\] User Login Success - Handle\[(?<Player>[A-Za-z0-9_-]+)\]"
$cleanupPattern = '^(.+?)_\d+$'
$versionPattern = "--system-trace-env-id='pub-sc-alpha-(?<gameversion>\d{4}-\d{7})'"
# Lookup Patterns
$joinDatePattern = '<span class="label">Enlisted</span>\s*<strong class="value">([^<]+)</strong>'
@ -71,21 +69,77 @@ $ueePattern = '<p class="entry citizen-record">\s*<span class="label">UEE Citize
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
# Function to process new log entries and write to the host
# Match and extract username from gamelog
Do {
# Load gamelog into memory
$authLog = Get-Content -Path $logFilePath
# Initialize variable to store username
$global:userName = $null
$global:loadOut = $null
# Loop through each line in the log to find the matching line
foreach ($line in $authLog) {
if ($line -match $loginPattern) {
$global:userName = $matches['Player']
Write-Output "PlayerName=$global:userName"
break
}
}
# Get Loadout
foreach ($line in $authLog) {
if ($line -match $loadoutPattern){
$entity = $matches['Entity']
$ownerGEID = $matches['OwnerGEID']
If ($ownerGEID -eq $global:userName -and $entity -notlike "*SoundListener*" -and $entity -notlike "*StreamingSOC*" -and $entity -ne $global:userName -and $entity -notlike "*debris*") {
$global:loadOut = $entity
If ($global:loadOut -match $cleanupPattern){
$global:loadOut = $matches[1]
}
}
}
}
Write-Output "PlayerShip=$global:loadOut"
# Get gameVersion
Foreach ($line in $authlog){
If ($line -match $versionPattern){
$GameVersion = $matches[gameversion]
}
if ($line -match $acPattern){
$GameMode = "AC"
}
if ($line -match $puPattern){
$GameMode = "PU"
}
}
# If no match found, print "Logged In: False"
if (-not $global:userName) {
Start-Sleep -Seconds 30
}
# Clear the log from memory
$authLog = $null
} until ($null -ne $global:userName)
<# Function to process new log entries and write to the host
function Read-LogEntry {
param (
[string]$line
)
# Apply the regex pattern to the line
if ($line -match $killPattern -and $global:logStart -eq $TRUE) {
if ($line -match $killPattern) {
# Access the named capture groups from the regex match
$enemyPilot = $matches['EnemyPilot']
$enemyShip = $matches['EnemyShip']
$player = $matches['Player']
$weapon = $matches['Weapon']
$damageType = $matches['DamageType']
$ship = $global:loadOut
$weapon = $matches['Weapon']
$damageType = $matches['DamageType']
$ship = $global:loadOut
If ($enemyShip -eq $global:lastKill){
$enemyShip = "Passenger"
@ -164,13 +218,9 @@ function Read-LogEntry {
$citizenRecordAPI = $citizenRecord
}
# Cleanup Output
$textColor = "Green"
$killText = "Congratulations!"
# Send to API
# Define the data to send
If ($apiDetected -eq $true -and $urlDetected -eq $true){
If ($apiUrl -eq $true -and $offlineMode -eq $false){
$data = @{
victim_ship = $enemyShip
victim = $enemyPilot
@ -179,7 +229,9 @@ function Read-LogEntry {
weapon = $weapon
method = $damageType
loadout_ship = $ship
#version = $version
gameVersion = $GameVersion
gameMode = $GameMode
trackrVersion = $TrackRver
}
# Headers which may or may not be necessary
@ -192,60 +244,44 @@ function Read-LogEntry {
try {
# Send the POST request with JSON data
Invoke-RestMethod -Uri $apiURL -Method Post -Body ($data | ConvertTo-Json -Depth 5) -Headers $headers
$logMode = "API"
} catch {
# Catch and display errors
Write-Output "Error: $($_)" -ForegroundColor red
Write-output "Send error to devs"
Write-Output "Kill saved in $outputPath"
$apiError = $_
# Add to output file
Add-Content -Path $outputPath -value $($_)
Add-Content -Path "$scriptFolder\kill-log.csv" -value $($_)
$logMode = "Err-Local"
}
} Else {
$logMode = "Local"
}
# Define the output CSV path
$csvPath = "$scriptFolder\Kill-log.csv"
# Create an object to hold the data
$killData = New-Object PSObject -property @{
KillTime = $killTime
EnemyPilot = $enemyPilot
EnemyShip = $enemyShip
Enlisted = $joinDate
RecordNumber = $citizenRecord
OrgAffiliation = $enemyOrgs[0]
Player = $player
Weapon = $weapon
Ship = $ship
Method = $damageType
Mode = $GameMode
GameVersion = $GameVersion
TrackRver = $TrackRver
}
# Write-Output to console
write-host "=== $killText" -ForegroundColor $textColor
Write-Host "$killTime"
Write-Host "Enemy Pilot: " -NoNewLine -ForegroundColor $textColor
Write-Host "$enemyPilot"
Write-Host "Enemy Ship: " -NoNewLine -ForegroundColor $textColor
Write-Host "$enemyShip"
Write-Host "Enlisted: " -NoNewLine -ForegroundColor $textColor
Write-Host "$joinDate"
Write-Host "Record #: " -NoNewLine -ForegroundColor $textColor
Write-Host "$citizenRecord"
Write-Host "Org Affiliation: " -NoNewLine -ForegroundColor $textColor
ForEach ($org in $enemyOrgs){
Write-Host $org
}
Write-Host "Player: " -NoNewLine -ForegroundColor $textColor
Write-Host "$player"
Write-Host "Weapon: " -NoNewLine -ForegroundColor $textColor
Write-Host "$weapon"
Write-Host "Ship: " -NoNewLine -ForegroundColor $textColor
Write-Host "$ship"s
Write-Host "Method: " -NoNewLine -ForegroundColor $textColor
Write-Host "$damageType"
Write-Host "-------------------------"
# Write output to local log
If ($apiDetected -eq $false -or $urlDetected -eq $false -or $null -ne $apiError){
Add-Content -Path $outputPath -Value "=== $killText"
Add-Content -Path $outputPath -Value "$killTime"
Add-Content -Path $outputPath -Value "Enemy Pilot: $enemyPilot"
Add-Content -Path $outputPath -Value "Enemy Ship: $enemyShip"
Add-Content -Path $outputPath -Value "Enlisted: $joinDate"
Add-Content -Path $outputPath -Value "Record #: $citizenRecord"
Add-Content -Path $outputPath -Value "Org Affiliation: " -NoNewLine
ForEach ($org in $enemyOrgs){
Add-Content -Path $outputPath -Value $org
}
Add-Content -Path $outputPath -Value "Player: $player"
Add-Content -Path $outputPath -Value "Weapon: $weapon"
Add-Content -Path $outputPath -Value "Ship: $ship"
Add-Content -Path $outputPath -Value "Method: $damageType"
Add-Content -Path $outputPath -Value "-------------------------"
}
Write-Output "NewKill=break,$enemyPilot,$enemyShip,$($enemyOrgs[0]),$joinDate,$citizenRecord,$killTime"
# Export the object to a CSV
# If the CSV file does not exist, it will create a new file with headers.
# If the file already exists, it will append the data.
$killData | Export-Csv -Path $csvPath -Append -NoTypeInformation
$sleeptimer = 10
@ -254,7 +290,7 @@ function Read-LogEntry {
# send keybind for visorwipe
start-sleep 1
$sleeptimer = $sleeptimer -1
&$visorPath
&"$scriptFolder\visorwipe.ahk"
}
# Record video
@ -262,19 +298,24 @@ function Read-LogEntry {
# send keybind for windows game bar recording
Start-Sleep 2
$sleeptimer = $sleeptimer -9
&$recordPath
Write-Host "=== Kill Clipped!" -ForegroundColor Green
Write-Host "-------------------------"
&"$scriptFolder\videorecord.ahk"
Start-Sleep 7
#
$latestFile = Get-ChildItem -Path $videoPath | Where-Object { -not $_.PSIsContainer } | Sort-Object CreationTime -Descending | Select-Object -First 1
# Generate a timestamp in ddMMMyyyy-HH:mm format
$timestamp = (Get-Date).ToString("ddMMMyyyy-HHmm")
# Rename the file if it exists
# Check if the latest file is no more than 10 seconds old
if ($latestFile) {
Rename-Item -Path $latestFile.FullName -NewName "$enemyPilot.$enemyShip.$timestamp.mp4"
}
$fileAgeInSeconds = (New-TimeSpan -Start $latestFile.CreationTime -End (Get-Date)).TotalSeconds
if ($fileAgeInSeconds -le 10) {
# Generate a timestamp in ddMMMyyyy-HH:mm format
$timestamp = (Get-Date).ToString("ddMMMyyyy-HHmm")
# Extract the file extension to preserve it
$fileExtension = $latestFile.Extension
# Rename the file, preserving the original file extension
Rename-Item -Path $latestFile.FullName -NewName "$enemyPilot.$enemyShip.$timestamp$fileExtension"
} else {}
} else {}
}
Start-Sleep $sleeptimer
}
@ -292,21 +333,18 @@ function Read-LogEntry {
If ($authLog -match $nameExtract -and $global:userName -ne $nameExtract){
$global:userName = $matches['PlayerName']
Write-Host "Logged in as $global:userName" -ForegroundColor Green
Write-Host "-------------------------"
Write-Output "PlayerName=$global:userName"
}
}
# Detect PU or AC
if ($line -match $puPattern -and $global:logStart -eq $FALSE) {
$global:logStart = $TRUE
Write-Host "=== Logging: $global:logStart" -ForegroundColor Green
Write-Host "-------------------------"
if ($line -match $puPattern) {
$GameMode = "PU"
Write-Output "GameMode=$GameMode"
}
if ($line -match $acPattern -and $global:logStart -eq $TRUE) {
$global:logStart = $FALSE
Write-Host "=== Logging: $global:logStart" -ForegroundColor Red
Write-Host "-------------------------"
if ($line -match $acPattern) {
$GameMode = "AC"
Write-Output "GameMode=$GameMode"
}
#Set loadout
@ -314,14 +352,12 @@ function Read-LogEntry {
$entity = $matches['Entity']
$ownerGEID = $matches['OwnerGEID']
If ($ownerGEID -eq $global:userName -and $entity -notlike "*SoundListener*" -and $entity -notlike "*StreamingSOC*" -and $entity -ne $global:userName) {
If ($ownerGEID -eq $global:userName -and $entity -notlike "*SoundListener*" -and $entity -notlike "*StreamingSOC*" -and $entity -ne $global:userName -and $entity -notlike "*debris*") {
$global:loadOut = $entity
If ($global:loadOut -match $cleanupPattern){
$global:loadOut = $matches[1]
}
Write-Host "=== Loadout: $global:loadOut" -ForegroundColor Yellow
Write-Host "-------------------------"
Write-Output "PlayerShip=$global:loadOut"
}
}
}
@ -329,5 +365,4 @@ function Read-LogEntry {
# Monitor the log file and process new lines as they are added
Get-Content -Path $logFile -Wait -Tail 0 | ForEach-Object {
Read-LogEntry $_
}
#>
}

View file

@ -128,7 +128,7 @@ namespace AutoTrackR2
tabButton.Effect = new DropShadowEffect
{
Color = accentColor,
BlurRadius = 20, // Adjust blur radius for desired glow intensity
BlurRadius = 30, // Adjust blur radius for desired glow intensity
ShadowDepth = 0, // Set shadow depth to 0 for a pure glow effect
Opacity = 1, // Set opacity for glow visibility
Direction = 0 // Direction doesn't matter for glow