mirror of
https://github.com/BubbaGumpShrump/AutoTrackR2.git
synced 2025-06-19 13:09:07 +00:00
More bugfixes
This commit is contained in:
parent
cff4860338
commit
d1558ee1a4
2 changed files with 102 additions and 20 deletions
AutoTrackR2
|
@ -6,6 +6,7 @@ using System.Windows.Media.Effects;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Windows.Documents;
|
using System.Windows.Documents;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
|
||||||
namespace AutoTrackR2
|
namespace AutoTrackR2
|
||||||
{
|
{
|
||||||
|
@ -73,7 +74,7 @@ namespace AutoTrackR2
|
||||||
ProcessStartInfo psi = new ProcessStartInfo
|
ProcessStartInfo psi = new ProcessStartInfo
|
||||||
{
|
{
|
||||||
FileName = "powershell.exe",
|
FileName = "powershell.exe",
|
||||||
Arguments = $"-NoProfile -ExecutionPolicy Bypass -File \"C:\\Program Files\\GrieferNET\\AutoTrackR2_Setup\\KillTrackR_MainScript.ps1\"",
|
Arguments = $"-NoProfile -ExecutionPolicy Bypass -File {scriptPath}",
|
||||||
WorkingDirectory = AppDomain.CurrentDomain.BaseDirectory,
|
WorkingDirectory = AppDomain.CurrentDomain.BaseDirectory,
|
||||||
RedirectStandardOutput = true,
|
RedirectStandardOutput = true,
|
||||||
RedirectStandardError = true,
|
RedirectStandardError = true,
|
||||||
|
@ -116,6 +117,7 @@ namespace AutoTrackR2
|
||||||
|
|
||||||
// Fetch the dynamic resource for AltTextColor
|
// Fetch the dynamic resource for AltTextColor
|
||||||
var altTextColorBrush = new SolidColorBrush((Color)Application.Current.Resources["AltTextColor"]);
|
var altTextColorBrush = new SolidColorBrush((Color)Application.Current.Resources["AltTextColor"]);
|
||||||
|
var accentColorBrush = new SolidColorBrush((Color)Application.Current.Resources["AccentColor"]);
|
||||||
|
|
||||||
// Fetch the Orbitron FontFamily from resources
|
// Fetch the Orbitron FontFamily from resources
|
||||||
var orbitronFontFamily = (FontFamily)Application.Current.Resources["Orbitron"];
|
var orbitronFontFamily = (FontFamily)Application.Current.Resources["Orbitron"];
|
||||||
|
@ -179,12 +181,54 @@ namespace AutoTrackR2
|
||||||
var killBorder = new Border
|
var killBorder = new Border
|
||||||
{
|
{
|
||||||
Style = (Style)Application.Current.Resources["RoundedTextBlockWithBorder"], // Apply border style
|
Style = (Style)Application.Current.Resources["RoundedTextBlockWithBorder"], // Apply border style
|
||||||
Child = killTextBlock // Set the TextBlock inside the Border
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Create a Grid to hold the TextBlock and the Image
|
||||||
|
var killGrid = new Grid
|
||||||
|
{
|
||||||
|
Width = 400, // Adjust the width of the Grid
|
||||||
|
Height = 130, // Adjust the height as needed
|
||||||
|
};
|
||||||
|
|
||||||
|
// Define two columns in the Grid: one for the text and one for the image
|
||||||
|
killGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(3, GridUnitType.Star) }); // Text column
|
||||||
|
killGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Auto) }); // Image column
|
||||||
|
|
||||||
|
// Add the TextBlock to the first column of the Grid
|
||||||
|
Grid.SetColumn(killTextBlock, 0);
|
||||||
|
killGrid.Children.Add(killTextBlock);
|
||||||
|
|
||||||
|
// Create the Image for the profile
|
||||||
|
var profileImage = new Image
|
||||||
|
{
|
||||||
|
Source = new BitmapImage(new Uri(killParts[7])), // Assuming the 8th part contains the profile image URL
|
||||||
|
Width = 90,
|
||||||
|
Height = 90,
|
||||||
|
Stretch = Stretch.Fill, // Adjust how the image fits
|
||||||
|
};
|
||||||
|
|
||||||
|
// Create a Border around the Image
|
||||||
|
var imageBorder = new Border
|
||||||
|
{
|
||||||
|
BorderBrush = accentColorBrush, // Set the border color
|
||||||
|
BorderThickness = new Thickness(2), // Set the border thickness
|
||||||
|
Padding = new Thickness(0), // Optional padding inside the border
|
||||||
|
CornerRadius = new CornerRadius(5),
|
||||||
|
Margin = new Thickness(10,18,15,18),
|
||||||
|
Child = profileImage // Set the Image as the content of the Border
|
||||||
|
};
|
||||||
|
|
||||||
|
// Add the Border (with the image inside) to the Grid
|
||||||
|
Grid.SetColumn(imageBorder, 1);
|
||||||
|
killGrid.Children.Add(imageBorder);
|
||||||
|
|
||||||
|
// Set the Grid as the child of the Border
|
||||||
|
killBorder.Child = killGrid;
|
||||||
|
|
||||||
// Add the new Border to the StackPanel inside the Border
|
// Add the new Border to the StackPanel inside the Border
|
||||||
KillFeedStackPanel.Children.Insert(0, killBorder);
|
KillFeedStackPanel.Children.Insert(0, killBorder);
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DebugPanel.AppendText(e.Data + Environment.NewLine);
|
DebugPanel.AppendText(e.Data + Environment.NewLine);
|
||||||
|
|
|
@ -87,12 +87,51 @@ $versionPattern = "--system-trace-env-id='pub-sc-alpha-(?<gameversion>\d{4}-\d{7
|
||||||
|
|
||||||
# Lookup Patterns
|
# Lookup Patterns
|
||||||
$joinDatePattern = '<span class="label">Enlisted</span>\s*<strong class="value">([^<]+)</strong>'
|
$joinDatePattern = '<span class="label">Enlisted</span>\s*<strong class="value">([^<]+)</strong>'
|
||||||
$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>'
|
||||||
$global:loadout = "Player"
|
$global:loadout = "Player"
|
||||||
|
|
||||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||||
|
|
||||||
|
<#
|
||||||
|
$enemyPilot = "feezydafox"
|
||||||
|
$enemyShip = "AEGS_Gladius"
|
||||||
|
$KillTime = (Get-Date).ToUniversalTime().ToString("d MMM yyyy H:mm 'UTC'")
|
||||||
|
$page1 = Invoke-WebRequest -uri "https://robertsspaceindustries.com/citizens/$enemyPilot"
|
||||||
|
|
||||||
|
# Get Enlisted Date
|
||||||
|
if ($($page1.content) -match $joinDatePattern) {
|
||||||
|
$joinDate = $matches[1]
|
||||||
|
$joinDate = $joinDate -replace ',', ''
|
||||||
|
} else {
|
||||||
|
$joinDate = "-"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check if there are any matches
|
||||||
|
$enemyOrgs = $page1.links[4].innerHTML
|
||||||
|
|
||||||
|
if ($null -eq $enemyOrgs) {
|
||||||
|
$enemyOrgs = "-"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Get UEE Number
|
||||||
|
if ($($page1.content) -match $ueePattern) {
|
||||||
|
# The matched UEE Citizen Record number is in $matches[1]
|
||||||
|
$citizenRecord = $matches[1]
|
||||||
|
} else {
|
||||||
|
$citizenRecord = "-"
|
||||||
|
}
|
||||||
|
If ($citizenRecord -eq "n/a") {
|
||||||
|
$citizenRecordAPI = "-1"
|
||||||
|
$citizenRecord = "-"
|
||||||
|
} Else {
|
||||||
|
$citizenRecordAPI = $citizenRecord
|
||||||
|
}
|
||||||
|
# Get PFP
|
||||||
|
$victimPFP = "https://robertsspaceindustries.com$($page1.images[0].src)"
|
||||||
|
|
||||||
|
Write-Output "NewKill=break,$enemyPilot,$enemyShip,$enemyOrgs,$joinDate,$citizenRecord,$killTime,$victimPFP"
|
||||||
|
#>
|
||||||
|
|
||||||
# Match and extract username from gamelog
|
# Match and extract username from gamelog
|
||||||
Do {
|
Do {
|
||||||
# Load gamelog into memory
|
# Load gamelog into memory
|
||||||
|
@ -203,25 +242,20 @@ function Read-LogEntry {
|
||||||
|
|
||||||
$KillTime = (Get-Date).ToUniversalTime().ToString("d MMM yyyy H:mm 'UTC'")
|
$KillTime = (Get-Date).ToUniversalTime().ToString("d MMM yyyy H:mm 'UTC'")
|
||||||
$page1 = Invoke-WebRequest -uri "https://robertsspaceindustries.com/citizens/$enemyPilot"
|
$page1 = Invoke-WebRequest -uri "https://robertsspaceindustries.com/citizens/$enemyPilot"
|
||||||
$page2 = Invoke-WebRequest -uri "https://robertsspaceindustries.com/citizens/$enemyPilot/organizations"
|
|
||||||
|
|
||||||
# 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 ',', ''
|
$joinDate = $joinDate -replace ',', ''
|
||||||
} else {
|
} else {
|
||||||
$joinDate = "UNKNOWN"
|
$joinDate = "-"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Find Org matches using the regex pattern
|
|
||||||
$orgMatches = [regex]::matches($($page2.links.innerhtml), $orgPattern)
|
|
||||||
# Check if there are any matches
|
# Check if there are any matches
|
||||||
$enemyOrgs = @()
|
$enemyOrgs = $page1.links[4].innerHTML
|
||||||
if ($orgMatches.Count -eq 0) {
|
|
||||||
$enemyOrgs = "N/A"
|
if ($null -eq $enemyOrgs) {
|
||||||
} else {
|
$enemyOrgs = "-"
|
||||||
# Loop through each match and display the organization name
|
|
||||||
$enemyOrgs = $match.Groups[1].Value.Trim()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get UEE Number
|
# Get UEE Number
|
||||||
|
@ -229,14 +263,18 @@ function Read-LogEntry {
|
||||||
# The matched UEE Citizen Record number is in $matches[1]
|
# The matched UEE Citizen Record number is in $matches[1]
|
||||||
$citizenRecord = $matches[1]
|
$citizenRecord = $matches[1]
|
||||||
} else {
|
} else {
|
||||||
$citizenRecord = "-1"
|
$citizenRecord = "-"
|
||||||
}
|
}
|
||||||
If ($citizenRecord -eq "N/A") {
|
If ($citizenRecord -eq "n/a") {
|
||||||
$citizenRecordAPI = "-1"
|
$citizenRecordAPI = "-1"
|
||||||
|
$citizenRecord = "-"
|
||||||
} Else {
|
} Else {
|
||||||
$citizenRecordAPI = $citizenRecord
|
$citizenRecordAPI = $citizenRecord
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Get PFP
|
||||||
|
$victimPFP = "https://robertsspaceindustries.com$($page1.images[0].src)"
|
||||||
|
|
||||||
# Send to API
|
# Send to API
|
||||||
# Define the data to send
|
# Define the data to send
|
||||||
If ($apiUrl -eq $true -and $offlineMode -eq $false){
|
If ($apiUrl -eq $true -and $offlineMode -eq $false){
|
||||||
|
@ -248,9 +286,9 @@ function Read-LogEntry {
|
||||||
weapon = $weapon
|
weapon = $weapon
|
||||||
method = $damageType
|
method = $damageType
|
||||||
loadout_ship = $ship
|
loadout_ship = $ship
|
||||||
gameVersion = $GameVersion
|
#gameVersion = $GameVersion
|
||||||
gameMode = $GameMode
|
#gameMode = $GameMode
|
||||||
trackrVersion = $TrackRver
|
#trackrVersion = $TrackRver
|
||||||
}
|
}
|
||||||
|
|
||||||
# Headers which may or may not be necessary
|
# Headers which may or may not be necessary
|
||||||
|
@ -296,7 +334,7 @@ function Read-LogEntry {
|
||||||
Logged = $logMode
|
Logged = $logMode
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Output "NewKill=break,$enemyPilot,$enemyShip,$($enemyOrgs[0]),$joinDate,$citizenRecord,$killTime"
|
Write-Output "NewKill=break,$enemyPilot,$enemyShip,$enemyOrgs,$joinDate,$citizenRecord,$killTime,$victimPFP"
|
||||||
|
|
||||||
# Export the object to a CSV
|
# Export the object to a CSV
|
||||||
# If the CSV file does not exist, it will create a new file with headers.
|
# If the CSV file does not exist, it will create a new file with headers.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue