diff --git a/AutoTrackR2/AutoTrackR2.csproj b/AutoTrackR2/AutoTrackR2.csproj index dcd9bac..ecb58c1 100644 --- a/AutoTrackR2/AutoTrackR2.csproj +++ b/AutoTrackR2/AutoTrackR2.csproj @@ -92,7 +92,7 @@ <CopyToOutputDirectory>Always</CopyToOutputDirectory> </Resource> <EmbeddedResource Include="KillTrackR_MainScript.ps1"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> </EmbeddedResource> </ItemGroup> diff --git a/AutoTrackR2/HomePage.xaml.cs b/AutoTrackR2/HomePage.xaml.cs index 3ea74e8..f65af75 100644 --- a/AutoTrackR2/HomePage.xaml.cs +++ b/AutoTrackR2/HomePage.xaml.cs @@ -15,6 +15,12 @@ namespace AutoTrackR2 public HomePage() { InitializeComponent(); + + // Get the current month + string currentMonth = DateTime.Now.ToString("MMMM", CultureInfo.InvariantCulture); + + // Set the TextBlock text + KillTallyTitle.Text = $"Kill Tally - {currentMonth}"; } private Process runningProcess; // Field to store the running process diff --git a/AutoTrackR2/KillTrackR_MainScript.ps1 b/AutoTrackR2/KillTrackR_MainScript.ps1 index e812779..92130b2 100644 --- a/AutoTrackR2/KillTrackR_MainScript.ps1 +++ b/AutoTrackR2/KillTrackR_MainScript.ps1 @@ -108,11 +108,19 @@ $global:killTally = 0 # Load historic kills from csv if (Test-Path "$scriptFolder\Kill-Log.csv") { $historicKills = Import-CSV "$scriptFolder\Kill-log.csv" + $currentDate = Get-Date + $dateFormat = "dd MMM yyyy HH:mm UTC" foreach ($kill in $historicKills) { + $killDate = [datetime]::parseExact($kill.KillTime, $dateFormat, $null) + If ($killdate.year -eq $currentDate.Year -and $killdate.month -eq $currentDate.Month) { + $global:killTally++ + + } Try { Write-Output "NewKill=throwaway,$($kill.EnemyPilot),$($kill.EnemyShip),$($kill.OrgAffiliation),$($kill.Enlisted),$($kill.RecordNumber),$($kill.KillTime), $($kill.PFP)" - $global:killTally++ - } Catch {Write-Output "Error Loading Kill: $($kill.EnemyPilot)"} + } Catch { + Write-Output "Error Loading Kill: $($kill.EnemyPilot)" + } } } Write-Output "KillTally=$global:killTally" @@ -198,7 +206,7 @@ function Read-LogEntry { Stop-Process -Id $PID -Force } - If ($enemyShip -eq $global:lastKill){ + If ($enemyShip -eq $global:lastKill -and $global:lastKill -ne "Player"){ $enemyShip = "Passenger" } Else { $global:lastKill = $enemyShip @@ -217,6 +225,7 @@ function Read-LogEntry { } if ($damageType -like "*bullet*") { $ship = "Player" + $enemyShip = "Player" } If ($ship -match $cleanupPattern){ $ship = $matches[1]