This commit is contained in:
BubbaGumpShrump 2024-12-04 00:26:53 -05:00
parent d8f1b3930e
commit 8e4541895e
7 changed files with 207 additions and 33 deletions

View file

@ -1,20 +1,32 @@
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17 # Visual Studio Version 17
VisualStudioVersion = 17.12.35521.163 d17.12 VisualStudioVersion = 17.12.35521.163
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoTrackR2", "AutoTrackR2\AutoTrackR2.csproj", "{31093634-8FBB-4BC6-BEA4-DAD6C11404F3}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoTrackR2", "AutoTrackR2\AutoTrackR2.csproj", "{31093634-8FBB-4BC6-BEA4-DAD6C11404F3}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Test|Any CPU = Test|Any CPU
Test|x64 = Test|x64
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{31093634-8FBB-4BC6-BEA4-DAD6C11404F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {31093634-8FBB-4BC6-BEA4-DAD6C11404F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{31093634-8FBB-4BC6-BEA4-DAD6C11404F3}.Debug|Any CPU.Build.0 = Debug|Any CPU {31093634-8FBB-4BC6-BEA4-DAD6C11404F3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{31093634-8FBB-4BC6-BEA4-DAD6C11404F3}.Debug|x64.ActiveCfg = Debug|x64
{31093634-8FBB-4BC6-BEA4-DAD6C11404F3}.Debug|x64.Build.0 = Debug|x64
{31093634-8FBB-4BC6-BEA4-DAD6C11404F3}.Release|Any CPU.ActiveCfg = Release|Any CPU {31093634-8FBB-4BC6-BEA4-DAD6C11404F3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{31093634-8FBB-4BC6-BEA4-DAD6C11404F3}.Release|Any CPU.Build.0 = Release|Any CPU {31093634-8FBB-4BC6-BEA4-DAD6C11404F3}.Release|Any CPU.Build.0 = Release|Any CPU
{31093634-8FBB-4BC6-BEA4-DAD6C11404F3}.Release|x64.ActiveCfg = Release|x64
{31093634-8FBB-4BC6-BEA4-DAD6C11404F3}.Release|x64.Build.0 = Release|x64
{31093634-8FBB-4BC6-BEA4-DAD6C11404F3}.Test|Any CPU.ActiveCfg = Test|Any CPU
{31093634-8FBB-4BC6-BEA4-DAD6C11404F3}.Test|Any CPU.Build.0 = Test|Any CPU
{31093634-8FBB-4BC6-BEA4-DAD6C11404F3}.Test|x64.ActiveCfg = Test|x64
{31093634-8FBB-4BC6-BEA4-DAD6C11404F3}.Test|x64.Build.0 = Test|x64
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View file

@ -6,8 +6,7 @@
<Application.Resources> <Application.Resources>
<FontFamily x:Key="Orbitron">/AutoTrackR2;component/Fonts/Orbitron-Bold.ttf#Orbitron</FontFamily> <FontFamily x:Key="Orbitron">/AutoTrackR2;component/Fonts/Orbitron-Bold.ttf#Orbitron</FontFamily>
<FontFamily x:Key="Roboto">/AutoTrackR2;component/Fonts/Roboto-Regular.ttf#Roboto</FontFamily> <FontFamily x:Key="Roboto">/AutoTrackR2;component/Fonts/Roboto-Regular.ttf#Roboto</FontFamily>
<FontFamily x:Key="Gemunu">/AutoTrackR2;component/Fonts/GemunuLibre-VariableFont_wght.ttf#GemunuLibre</FontFamily>
<FontFamily x:Key="DynamicFont">"{}"</FontFamily>
<!-- Default theme --> <!-- Default theme -->
<Color x:Key="AccentColor">#00A9E0</Color> <Color x:Key="AccentColor">#00A9E0</Color>
@ -122,6 +121,27 @@
</Setter.Value> </Setter.Value>
</Setter> </Setter>
</Style> </Style>
<!-- Custom style for text blocks -->
<Style x:Key="RoundedTextBlock" TargetType="TextBlock">
<Setter Property="Foreground" Value="{DynamicResource TextBrush}" />
<Setter Property="FontFamily" Value="{StaticResource Roboto}" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="FontSize" Value="14" />
<Setter Property="Padding" Value="10,0,10,0" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
</Style>
<!-- Wrap TextBlock in Border to apply rounded corners -->
<Style x:Key="RoundedTextBlockWithBorder" TargetType="Border">
<Setter Property="Background" Value="{DynamicResource BackgroundLightBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource AccentBrush}"/>
<Setter Property="BorderThickness" Value="2"/>
<Setter Property="CornerRadius" Value="5"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="Margin" Value="0,10,0,0"/>
</Style>
<!-- Custom Style for Rounded TextBox --> <!-- Custom Style for Rounded TextBox -->
<Style x:Key="RoundedTextBox" TargetType="TextBox"> <Style x:Key="RoundedTextBox" TargetType="TextBox">
@ -278,15 +298,15 @@
<!-- Modern Rounded ScrollBar Style --> <!-- Modern Rounded ScrollBar Style -->
<Style TargetType="ScrollBar"> <Style TargetType="ScrollBar">
<Setter Property="Width" Value="5" /> <Setter Property="Width" Value="6" />
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="ScrollBar"> <ControlTemplate TargetType="ScrollBar">
<Grid> <Grid>
<Track Name="PART_Track" IsDirectionReversed="true" Width="12" Margin="5,0,0,0"> <Track Name="PART_Track" IsDirectionReversed="true" Width="6" Margin="0,0,0,0">
<!-- Decrease Repeat Button --> <!-- Decrease Repeat Button -->
<Track.DecreaseRepeatButton> <Track.DecreaseRepeatButton>
<RepeatButton Background="Transparent" BorderBrush="Transparent" BorderThickness="0"> <RepeatButton Background="Transparent" BorderBrush="{DynamicResource AccentBrush}" BorderThickness="0">
<RepeatButton.Template> <RepeatButton.Template>
<ControlTemplate TargetType="RepeatButton"> <ControlTemplate TargetType="RepeatButton">
<Grid x:Name="RepeatButtonGrid"> <Grid x:Name="RepeatButtonGrid">
@ -318,9 +338,9 @@
<ControlTemplate TargetType="Thumb"> <ControlTemplate TargetType="Thumb">
<Grid> <Grid>
<Border <Border
Background="{DynamicResource BackgroundBrush}" Background="{DynamicResource AccentBrush}"
BorderBrush="{DynamicResource AccentBrush}" BorderBrush="{DynamicResource AccentBrush}"
BorderThickness="2" BorderThickness="0"
CornerRadius="3" /> CornerRadius="3" />
</Grid> </Grid>
</ControlTemplate> </ControlTemplate>
@ -330,7 +350,7 @@
<!-- Increase Repeat Button --> <!-- Increase Repeat Button -->
<Track.IncreaseRepeatButton> <Track.IncreaseRepeatButton>
<RepeatButton Background="Transparent" BorderBrush="Transparent" BorderThickness="0"> <RepeatButton Background="Transparent" BorderBrush="{DynamicResource AccentBrush}" BorderThickness="0">
<RepeatButton.Template> <RepeatButton.Template>
<ControlTemplate TargetType="RepeatButton"> <ControlTemplate TargetType="RepeatButton">
<Grid x:Name="RepeatButtonGrid"> <Grid x:Name="RepeatButtonGrid">

View file

@ -6,6 +6,8 @@
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<UseWPF>true</UseWPF> <UseWPF>true</UseWPF>
<Configurations>Debug;Release;Test</Configurations>
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

Binary file not shown.

View file

@ -20,9 +20,9 @@
<!-- Border for the kill feed section --> <!-- 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}"/--> <!--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"> <Border Grid.Row="0" Grid.Column="0" Grid.RowSpan="2" BorderBrush="{DynamicResource AccentBrush}" BorderThickness="2" CornerRadius="5" Padding="10,0,0,0" Background="{DynamicResource BackgroundDarkBrush}" Margin="0,0,20,0">
<ScrollViewer VerticalScrollBarVisibility="Auto"> <ScrollViewer VerticalScrollBarVisibility="Auto" Width="419" Margin="0,0,-5,0">
<StackPanel Name="KillFeedStackPanel" Orientation="Vertical" Height="384" Width="407"/> <StackPanel Name="KillFeedStackPanel" Orientation="Vertical" Margin="0,0,0,0" Width="402" HorizontalAlignment="Left"/>
</ScrollViewer> </ScrollViewer>
</Border> </Border>
@ -30,11 +30,12 @@
<Border Background="{DynamicResource BackgroundDarkBrush}" BorderBrush="{DynamicResource AccentBrush}" Grid.Row="0" Grid.Column="1" BorderThickness="2" CornerRadius="5" Margin="0,0,0,134"/> <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"> <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 AltTextBrush}" FontSize="14"/> <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" Text="" Width="152" Height="20" Background="Transparent" FontFamily="{StaticResource Orbitron}" Margin="0,0,0,0" Foreground="{DynamicResource TextBrush}" FontSize="11" TextAlignment="Center"/> <TextBlock Name="PilotNameTextBox" Text="" Width="152" Height="20" Background="Transparent" FontFamily="{StaticResource Orbitron}" Margin="0,0,0,0" Foreground="{DynamicResource TextBrush}" FontSize="10" 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="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" Text="" Width="152" Height="20" Background="Transparent" FontFamily="{StaticResource Orbitron}" Margin="0,0,0,0" Foreground="{DynamicResource TextBrush}" FontSize="11" TextAlignment="Center"/> <TextBlock Name="PlayerShipTextBox" Text="" Width="152" Height="20" Background="Transparent" FontFamily="{StaticResource Orbitron}" Margin="0,0,0,0" Foreground="{DynamicResource TextBrush}" FontSize="10" 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="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" Text="" Width="152" Height="20" Background="Transparent" FontFamily="{StaticResource Orbitron}" Margin="0,0,0,0" Foreground="{DynamicResource TextBrush}" FontSize="11" TextAlignment="Center"/> <TextBlock Name="GameModeTextBox" Text="" Width="152" Height="20" Background="Transparent" FontFamily="{StaticResource Orbitron}" Margin="0,0,0,0" Foreground="{DynamicResource TextBrush}" FontSize="10" TextAlignment="Center"/>
<TextBox Name="DebugPanel" Text="" Width="152" Height="136" Background="Transparent" FontFamily="{StaticResource Orbitron}" Margin="0,0,0,0" Foreground="{DynamicResource TextBrush}" FontSize="8" BorderThickness="0"/>
</StackPanel> </StackPanel>
<StackPanel Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Center" Height="120" Width="172" > <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="StartButton" Content="Start" Width="100" Height="40" Style="{StaticResource ButtonStyle}" FontFamily="{StaticResource Orbitron}" Margin="0,20" Click="StartButton_Click"/>

View file

@ -4,6 +4,8 @@ using System.Windows.Controls;
using System.Windows.Media; using System.Windows.Media;
using System.Windows.Media.Effects; using System.Windows.Media.Effects;
using System.IO; using System.IO;
using System.Windows.Documents;
using System.Globalization;
namespace AutoTrackR2 namespace AutoTrackR2
{ {
@ -91,16 +93,19 @@ namespace AutoTrackR2
{ {
string pilotName = e.Data.Split('=')[1].Trim(); string pilotName = e.Data.Split('=')[1].Trim();
PilotNameTextBox.Text = pilotName; // Update the Button's Content PilotNameTextBox.Text = pilotName; // Update the Button's Content
AdjustFontSize(PilotNameTextBox);
} }
else if (e.Data.Contains("PlayerShip=")) else if (e.Data.Contains("PlayerShip="))
{ {
string playerShip = e.Data.Split('=')[1].Trim(); string playerShip = e.Data.Split('=')[1].Trim();
PlayerShipTextBox.Text = playerShip; PlayerShipTextBox.Text = playerShip;
AdjustFontSize(PlayerShipTextBox);
} }
else if (e.Data.Contains("GameMode=")) else if (e.Data.Contains("GameMode="))
{ {
string gameMode = e.Data.Split('=')[1].Trim(); string gameMode = e.Data.Split('=')[1].Trim();
GameModeTextBox.Text = gameMode; GameModeTextBox.Text = gameMode;
AdjustFontSize(GameModeTextBox);
} }
else if (e.Data.Contains("NewKill=")) else if (e.Data.Contains("NewKill="))
{ {
@ -108,21 +113,81 @@ namespace AutoTrackR2
var killData = e.Data.Split('=')[1].Trim(); // Assume the kill data follows after "NewKill=" var killData = e.Data.Split('=')[1].Trim(); // Assume the kill data follows after "NewKill="
var killParts = killData.Split(','); var killParts = killData.Split(',');
// Fetch the dynamic resource for AltTextColor
var altTextColorBrush = new SolidColorBrush((Color)Application.Current.Resources["AltTextColor"]);
// Fetch the Orbitron FontFamily from resources
var orbitronFontFamily = (FontFamily)Application.Current.Resources["Orbitron"];
var gemunuFontFamily = (FontFamily)Application.Current.Resources["Gemunu"];
// Create a new TextBlock for each kill // Create a new TextBlock for each kill
var killTextBlock = new TextBlock 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]}", Margin = new Thickness(0, 10, 0, 10),
Style = (Style)Application.Current.Resources["RoundedTextBox"], // Apply the style from resources Style = (Style)Application.Current.Resources["RoundedTextBlock"], // Apply style for text
FontSize = 14, FontSize = 14,
Margin = new Thickness(0, 10, 0, 10) FontWeight = FontWeights.Bold,
FontFamily = gemunuFontFamily,
}; };
// Add the new TextBlock to the StackPanel inside the Border // Add styled content using Run elements
KillFeedStackPanel.Children.Add(killTextBlock); killTextBlock.Inlines.Add(new Run("Victim Name: ")
{
Foreground = altTextColorBrush,
FontFamily = orbitronFontFamily,
});
killTextBlock.Inlines.Add(new Run($"{killParts[1]}\n"));
// Repeat for other lines
killTextBlock.Inlines.Add(new Run("Victim Ship: ")
{
Foreground = altTextColorBrush,
FontFamily = orbitronFontFamily,
});
killTextBlock.Inlines.Add(new Run($"{killParts[2]}\n"));
killTextBlock.Inlines.Add(new Run("Victim Org: ")
{
Foreground = altTextColorBrush,
FontFamily = orbitronFontFamily,
});
killTextBlock.Inlines.Add(new Run($"{killParts[3]}\n"));
killTextBlock.Inlines.Add(new Run("Join Date: ")
{
Foreground = altTextColorBrush,
FontFamily = orbitronFontFamily,
});
killTextBlock.Inlines.Add(new Run($"{killParts[4]}\n"));
killTextBlock.Inlines.Add(new Run("UEE Record: ")
{
Foreground = altTextColorBrush,
FontFamily = orbitronFontFamily,
});
killTextBlock.Inlines.Add(new Run($"{killParts[5]}\n"));
killTextBlock.Inlines.Add(new Run("Kill Time: ")
{
Foreground = altTextColorBrush,
FontFamily = orbitronFontFamily,
});
killTextBlock.Inlines.Add(new Run($"{killParts[6]}"));
// Create a Border and apply the RoundedTextBlockWithBorder style
var killBorder = new Border
{
Style = (Style)Application.Current.Resources["RoundedTextBlockWithBorder"], // Apply border style
Child = killTextBlock // Set the TextBlock inside the Border
};
// Add the new Border to the StackPanel inside the Border
KillFeedStackPanel.Children.Insert(0, killBorder);
} }
else else
{ {
GameModeTextBox.Text = "ERROR"; DebugPanel.AppendText(e.Data + Environment.NewLine);
} }
}); });
} }
@ -134,6 +199,7 @@ namespace AutoTrackR2
{ {
Dispatcher.Invoke(() => Dispatcher.Invoke(() =>
{ {
DebugPanel.AppendText(e.Data + Environment.NewLine);
}); });
} }
}; };
@ -169,5 +235,44 @@ namespace AutoTrackR2
PlayerShipTextBox.Text = string.Empty; PlayerShipTextBox.Text = string.Empty;
GameModeTextBox.Text = string.Empty; GameModeTextBox.Text = string.Empty;
} }
private void AdjustFontSize(TextBlock textBlock)
{
// Set a starting font size
double fontSize = 14;
double maxWidth = textBlock.Width;
if (string.IsNullOrEmpty(textBlock.Text) || double.IsNaN(maxWidth))
return;
// Measure the rendered width of the text
FormattedText formattedText = new FormattedText(
textBlock.Text,
CultureInfo.CurrentCulture,
FlowDirection.LeftToRight,
new Typeface(textBlock.FontFamily, textBlock.FontStyle, textBlock.FontWeight, textBlock.FontStretch),
fontSize,
textBlock.Foreground,
VisualTreeHelper.GetDpi(this).PixelsPerDip
);
// Reduce font size until text fits within the width
while (formattedText.Width > maxWidth && fontSize > 6)
{
fontSize -= 0.5;
formattedText = new FormattedText(
textBlock.Text,
CultureInfo.CurrentCulture,
FlowDirection.LeftToRight,
new Typeface(textBlock.FontFamily, textBlock.FontStyle, textBlock.FontWeight, textBlock.FontStretch),
fontSize,
textBlock.Foreground,
VisualTreeHelper.GetDpi(this).PixelsPerDip
);
}
// Apply the adjusted font size
textBlock.FontSize = fontSize;
}
} }
} }

View file

@ -52,11 +52,42 @@ If (Test-Path $logFilePath) {
Write-Output "PlayerName=Logfile not found." Write-Output "PlayerName=Logfile not found."
} }
$enemyPilot = "6lasphemous"
$enemyShip = "MISC_Freelancer_MAX"
$enemyOrgs = "GrieferNet"
$joinDate = "12 Dec 2022"
$citizenRecord = "237890"
$KillTime = (Get-Date).ToUniversalTime().ToString("d MMM yyyy H:mm 'UTC'")
Write-Output "NewKill=break,$enemyPilot,$enemyShip,$($enemyOrgs),$joinDate,$citizenRecord,$killTime"
# Ship Manufacturers
$prefixes = @(
"ORIG",
"CRUS",
"RSI",
"AEGS",
"VNCL",
"DRAK",
"ANVL",
"BANU",
"MISC",
"CNOU",
"XIAN",
"GAMA",
"TMBL",
"ESPR",
"KRIG",
"GRIN",
"XNAA"
)
# Define the regex pattern to extract information # 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>[^']+)'" $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\]' $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\]'
$acPattern = "ArenaCommanderFeature" $acPattern = "ArenaCommanderFeature"
$loadoutPattern = '\[InstancedInterior\] OnEntityLeaveZone - InstancedInterior \[(?<InstancedInterior>[^\]]+)\] \[\d+\] -> Entity \[(?<Entity>[^\]]+)\] \[\d+\] -- m_openDoors\[\d+\], m_managerGEID\[(?<ManagerGEID>\d+)\], m_ownerGEID\[(?<OwnerGEID>[^\[]+)\]' $loadoutPattern = '\[InstancedInterior\] OnEntityLeaveZone - InstancedInterior \[(?<InstancedInterior>[^\]]+)\] \[\d+\] -> Entity \[(?<Entity>[^\]]+)\] \[\d+\] -- m_openDoors\[\d+\], m_managerGEID\[(?<ManagerGEID>\d+)\], m_ownerGEID\[(?<OwnerGEID>[^\[]+)\]'
$shipManPattern = "^(" + ($prefixes -join "|") + ")"
# $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\] <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_-]+)\]" $loginPattern = "\[Notice\] <Legacy login response> \[CIG-net\] User Login Success - Handle\[(?<Player>[A-Za-z0-9_-]+)\]"
$cleanupPattern = '^(.+?)_\d+$' $cleanupPattern = '^(.+?)_\d+$'
@ -67,6 +98,7 @@ $joinDatePattern = '<span class="label">Enlisted</span>\s*<strong class="value">
$orgPattern = '<IMG[^>]*>\s*([^<]+)' $orgPattern = '<IMG[^>]*>\s*([^<]+)'
$ueePattern = '<p class="entry citizen-record">\s*<span class="label">UEE Citizen Record<\/span>\s*<strong class="value">#?(n\/a|\d+)<\/strong>\s*<\/p>' $ueePattern = '<p class="entry citizen-record">\s*<span class="label">UEE Citizen Record<\/span>\s*<strong class="value">#?(n\/a|\d+)<\/strong>\s*<\/p>'
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
# Match and extract username from gamelog # Match and extract username from gamelog
@ -93,12 +125,14 @@ Do {
$entity = $matches['Entity'] $entity = $matches['Entity']
$ownerGEID = $matches['OwnerGEID'] $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*") { If ($ownerGEID -eq $global:userName -and $entity -match $shipManPattern) {
$global:loadOut = $entity $global:loadOut = $entity
If ($global:loadOut -match $cleanupPattern){ If ($global:loadOut -match $cleanupPattern){
$global:loadOut = $matches[1] $global:loadOut = $matches[1]
} }
} } else {
$global:loadout = "Player"
}
} }
} }
Write-Output "PlayerShip=$global:loadOut" Write-Output "PlayerShip=$global:loadOut"
@ -106,7 +140,7 @@ Do {
# Get gameVersion # Get gameVersion
Foreach ($line in $authlog){ Foreach ($line in $authlog){
If ($line -match $versionPattern){ If ($line -match $versionPattern){
$GameVersion = $matches[gameversion] $GameVersion = $matches['gameversion']
} }
if ($line -match $acPattern){ if ($line -match $acPattern){
$GameMode = "AC" $GameMode = "AC"
@ -115,6 +149,7 @@ Do {
$GameMode = "PU" $GameMode = "PU"
} }
} }
Write-Output "GameMode=$GameMode"
# If no match found, print "Logged In: False" # If no match found, print "Logged In: False"
if (-not $global:userName) { if (-not $global:userName) {
@ -164,10 +199,10 @@ function Read-LogEntry {
If ($ship -match $cleanupPattern){ If ($ship -match $cleanupPattern){
$ship = $matches[1] $ship = $matches[1]
} }
if ($ship -like "OOC_*"){ if ($ship -notmatch $shipManPattern){
$ship = "Player" $ship = "Player"
} }
If ($enemyShip -like "OOC_*" -or $enemyShip -like "hangar*") { If ($enemyShip -notmatch $shipManPattern) {
$enemyShip = "Player" $enemyShip = "Player"
} }
@ -187,6 +222,7 @@ function Read-LogEntry {
# Get Enlisted Date # Get Enlisted Date
if ($($page1.content) -match $joinDatePattern) { if ($($page1.content) -match $joinDatePattern) {
$joinDate = $matches[1] $joinDate = $matches[1]
$joinDate = = $date -replace ',', ''
} else { } else {
$joinDate = "UNKNOWN" $joinDate = "UNKNOWN"
} }
@ -199,10 +235,7 @@ function Read-LogEntry {
$enemyOrgs = "N/A" $enemyOrgs = "N/A"
} else { } else {
# Loop through each match and display the organization name # Loop through each match and display the organization name
foreach ($match in $orgMatches) { $enemyOrgs = $match.Groups[1].Value.Trim()
$organizationName = $match.Groups[1].Value.Trim()
$enemyOrgs = $enemyOrgs + $organizationName
}
} }
# Get UEE Number # Get UEE Number
@ -352,7 +385,7 @@ function Read-LogEntry {
$entity = $matches['Entity'] $entity = $matches['Entity']
$ownerGEID = $matches['OwnerGEID'] $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*") { If ($ownerGEID -eq $global:userName -and $entity -match $shipManPattern) {
$global:loadOut = $entity $global:loadOut = $entity
If ($global:loadOut -match $cleanupPattern){ If ($global:loadOut -match $cleanupPattern){
$global:loadOut = $matches[1] $global:loadOut = $matches[1]
@ -363,6 +396,7 @@ function Read-LogEntry {
} }
# Monitor the log file and process new lines as they are added # Monitor the log file and process new lines as they are added
Get-Content -Path $logFile -Wait -Tail 0 | ForEach-Object { Get-Content -Path $logFilePath -Wait -Tail 0 | ForEach-Object {
Read-LogEntry $_ Read-LogEntry $_
} }
#>