Compare commits

..

No commits in common. "eb50d878b4d872fa33b86c55bf1eaee3cc615c20" and "90d24b4d9b6e4bdbb08d503e5fe373b2839f5ec2" have entirely different histories.

17 changed files with 624 additions and 853 deletions

Binary file not shown.

Before

(image error) Size: 16 KiB

Binary file not shown.

Before

(image error) Size: 114 KiB

Binary file not shown.

Before

(image error) Size: 5.3 MiB

View file

@ -29,13 +29,9 @@
<None Remove="Assets\SHADOWMOSES.png" />
<None Remove="Assets\VOX.png" />
<None Remove="Assets\WRITH.png" />
<None Remove="Assets\ZAP.png" />
<None Remove="config.ini" />
<None Remove="Fonts\Orbitron-Bold.ttf" />
<None Remove="Fonts\Roboto-Regular.ttf" />
<None Update="themes.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
@ -103,15 +99,6 @@
<Resource Include="Assets\WRITH.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
<Resource Include="Assets\cinderborn.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
<Resource Include="Assets\shadowguard.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
<Resource Include="Assets\ZAP.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
<Resource Include="config.ini" />
<Resource Include="Fonts\Orbitron-Bold.ttf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>

View file

@ -207,7 +207,7 @@
Margin="0,7,0,5"/>
<Slider x:Name="ThemeSlider"
Minimum="0"
Maximum="24"
Maximum="21"
Value="0"
TickFrequency="1"
IsSnapToTickEnabled="True"

File diff suppressed because it is too large Load diff

View file

@ -131,14 +131,13 @@ public partial class HomePage : UserControl
};
// Ship
TrackREventDispatcher.JumpDriveStateChangedEvent += (data) =>
TrackREventDispatcher.JumpDriveStateChangedEvent += (shipName) =>
{
Dispatcher.Invoke(() =>
{
PlayerShipTextBox.Text = data.ShipName;
PlayerShipTextBox.Text = LocalPlayerData.CurrentGameMode == GameMode.PersistentUniverse ? shipName : "Unknown";
AdjustFontSize(PlayerShipTextBox);
LocalPlayerData.PlayerShip = data.ShipName;
LocalPlayerData.LastSeenVehicleLocation = data.Location;
LocalPlayerData.PlayerShip = shipName;
});
};
@ -171,14 +170,13 @@ public partial class HomePage : UserControl
{
EnemyPilot = actorDeathData.VictimPilot,
EnemyShip = actorDeathData.VictimShip,
Location = LocalPlayerData.LastSeenVehicleLocation,
OrgAffiliation = playerData?.OrgName,
Weapon = actorDeathData.Weapon,
Ship = LocalPlayerData.PlayerShip ?? "Unknown",
Method = actorDeathData.DamageType,
RecordNumber = playerData?.UEERecord,
GameVersion = LocalPlayerData.GameVersion ?? "Unknown",
TrackRver = "2.10",
TrackRver = LocalPlayerData.GameVersion?.Replace("v", "") ?? "Unknown",
Enlisted = playerData?.JoinDate,
KillTime = DateTime.UtcNow.ToString("dd MMM yyyy HH:mm"),
PFP = playerData?.PFPURL ?? "https://cdn.robertsspaceindustries.com/static/images/account/avatar_default_big.jpg"

View file

@ -14,5 +14,5 @@ public static class LocalPlayerData
public static string? PlayerShip;
public static string? GameVersion;
public static GameMode CurrentGameMode;
public static string? LastSeenVehicleLocation = "Unknown";
public static string? LastSeenVehicleLocation;
}

View file

@ -2,12 +2,6 @@
namespace AutoTrackR2.LogEventHandlers;
public struct JumpDriveStateChangedData
{
public string ShipName { get; set; }
public string Location { get; set; }
}
public class JumpDriveStateChangedEvent : ILogEventHandler
{
public Regex Pattern { get; }
@ -15,7 +9,7 @@ public class JumpDriveStateChangedEvent : ILogEventHandler
public JumpDriveStateChangedEvent()
{
Pattern = new Regex(@"<Jump Drive State Changed>.*.adam: (?<ShipName>.*.) in zone (?<Location>.*.)\)");
Pattern = new Regex(@"<Jump Drive State Changed>.*.adam: (?<ShipName>.*.) in");
}
public void Handle(LogEntry entry)
@ -23,20 +17,11 @@ public class JumpDriveStateChangedEvent : ILogEventHandler
if (entry.Message is null) return;
var match = Pattern.Match(entry.Message);
if (!match.Success) return;
var data = new JumpDriveStateChangedData
{
Location = match.Groups["Location"].Value
};
match = _cleanUpPattern.Match(match.Groups["ShipName"].Value);
if (match.Success)
{
data.ShipName = match.Groups[1].Value;
}
if (!string.IsNullOrEmpty(data.ShipName) && !string.IsNullOrEmpty(data.Location))
{
TrackREventDispatcher.OnJumpDriveStateChangedEvent(data);
TrackREventDispatcher.OnJumpDriveStateChangedEvent(match.Groups[1].Value);;
}
}
}

View file

@ -9,7 +9,7 @@ public class RequestJumpFailedEvent : ILogEventHandler
public RequestJumpFailedEvent()
{
Pattern = new Regex(@"<Request Jump Failed>.*.adam: (?<ShipName>.*.) in zone (?<Location>.*.)\)");
Pattern = new Regex(@"<Request Jump Failed>.*.adam: (?<ShipName>.*.) in");
}
public void Handle(LogEntry entry)
@ -18,20 +18,10 @@ public class RequestJumpFailedEvent : ILogEventHandler
var match = Pattern.Match(entry.Message);
if (!match.Success) return;
var data = new JumpDriveStateChangedData
{
Location = match.Groups["Location"].Value
};
match = _cleanUpPattern.Match(match.Groups["ShipName"].Value);
if (match.Success)
{
data.ShipName = match.Groups[1].Value;
}
if (!string.IsNullOrEmpty(data.ShipName) && !string.IsNullOrEmpty(data.Location))
{
TrackREventDispatcher.OnJumpDriveStateChangedEvent(data);
TrackREventDispatcher.OnJumpDriveStateChangedEvent(match.Groups[1].Value);;
}
}
}

View file

@ -21,16 +21,14 @@ public class VehicleDestructionEvent : ILogEventHandler
public Regex Pattern { get; }
public VehicleDestructionEvent()
{
const string patternStr = """
<(?<timestamp>[^>]+)> \[Notice\] <Vehicle Destruction> CVehicle::OnAdvanceDestroyLevel:
Vehicle '(?<vehicle>[^']+)' \[\d+\] in zone '(?<vehicle_zone>[^']+)'
\[pos x: (?<pos_x>[-\d\.]+), y: (?<pos_y>[-\d\.]+), z: (?<pos_z>[-\d\.]+)
vel x: [^,]+, y: [^,]+, z: [^\]]+\] driven by '(?<driver>[^']+)' \[\d+\]
advanced from destroy level (?<destroy_level_from>\d+) to (?<destroy_level_to>\d+)
caused by '(?<caused_by>[^']+)' \[\d+\] with '(?<damage_type>[^']+)'
""";
Pattern = new Regex(Regex.Replace(patternStr, @"\t|\n|\r", ""));
Pattern = new Regex("""
"<(?<timestamp>[^>]+)> \[Notice\] <Vehicle Destruction> CVehicle::OnAdvanceDestroyLevel: " +
"Vehicle '(?<vehicle>[^']+)' \[\d+\] in zone '(?<vehicle_zone>[^']+)' " +
"\[pos x: (?<pos_x>[-\d\.]+), y: (?<pos_y>[-\d\.]+), z: (?<pos_z>[-\d\.]+) " +
"vel x: [^,]+, y: [^,]+, z: [^\]]+\] driven by '(?<driver>[^']+)' \[\d+\] " +
"advanced from destroy level (?<destroy_level_from>\d+) to (?<destroy_level_to>\d+) " +
"caused by '(?<caused_by>[^']+)' \[\d+\] with '(?<damage_type>[^']+)'"
""");
}
public void Handle(LogEntry entry)

View file

@ -42,8 +42,7 @@ public class LogHandler
new InPersistentUniverseEvent(),
new GameVersionEvent(),
new JumpDriveStateChangedEvent(),
new RequestJumpFailedEvent(),
new VehicleDestructionEvent()
new RequestJumpFailedEvent()
];
public LogHandler(string? logPath)

View file

@ -25,24 +25,7 @@ namespace AutoTrackR2
public void ChangeLogoImage(string imagePath)
{
try
{
// Ensure the path starts with a forward slash for WPF resource paths
if (!imagePath.StartsWith("/"))
{
imagePath = "/" + imagePath;
}
// Create a pack URI for the resource
Uri uri = new Uri($"pack://application:,,,/AutoTrackR2;component{imagePath}", UriKind.Absolute);
Logo.Source = new BitmapImage(uri);
}
catch (Exception ex)
{
// Log the error or handle it appropriately
Debug.WriteLine($"Error loading logo image: {ex.Message}");
// Optionally set a default logo or handle the error
}
Logo.Source = new BitmapImage(new Uri(imagePath, UriKind.RelativeOrAbsolute));
}
public MainWindow()
@ -198,11 +181,11 @@ namespace AutoTrackR2
public static int VideoRecord { get; set; }
public static int OfflineMode { get; set; }
public static int Theme { get; set; }
static ConfigManager()
{
{
LoadConfig();
// Set default values
// AppData\Local\AutoTrackR2\Kill-log.csv
KillHistoryFile = Path.Combine(
@ -210,12 +193,12 @@ namespace AutoTrackR2
"AutoTrackR2",
"Kill-log.csv"
);
AHKScriptFolder = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
"AutoTrackR2"
);
VisorWipeScript = "visorwipe.ahk";
VideoRecordScript = "videorecord.ahk";
}

View file

@ -49,9 +49,9 @@ public static class TrackREventDispatcher
// Jump Drive state has changed
// Todo: Add proper data for this event. Right now only ship name is used.
public static event Action<JumpDriveStateChangedData>? JumpDriveStateChangedEvent;
public static void OnJumpDriveStateChangedEvent(JumpDriveStateChangedData data)
public static event Action<string>? JumpDriveStateChangedEvent;
public static void OnJumpDriveStateChangedEvent(string shipName)
{
JumpDriveStateChangedEvent?.Invoke(data);
JumpDriveStateChangedEvent?.Invoke(shipName);
}
}

View file

@ -19,7 +19,6 @@ public struct KillData
public string? Enlisted;
public string? RecordNumber;
public string? OrgAffiliation;
public string? Location;
public string? Player;
public string? Weapon;
public string? Ship;

View file

@ -5,7 +5,6 @@ using System.Text.Json;
using System.Text.RegularExpressions;
using AutoTrackR2.LogEventHandlers;
using System.Globalization;
using System.Security.Cryptography;
namespace AutoTrackR2;
@ -25,27 +24,6 @@ public static class WebHandler
public string? trackr_version { get; set; }
public string? location { get; set; }
public long time { get; set; }
public string hash { get; set; } = string.Empty;
}
private static string GenerateKillHash(string victimName, long timestamp)
{
// Combine victim name and timestamp
string combined = $"{victimName}_{timestamp}";
// Create SHA256 hash
using (SHA256 sha256 = SHA256.Create())
{
byte[] bytes = sha256.ComputeHash(Encoding.UTF8.GetBytes(combined));
// Convert byte array to hex string
StringBuilder builder = new StringBuilder();
for (int i = 0; i < bytes.Length; i++)
{
builder.Append(bytes[i].ToString("x2"));
}
return builder.ToString();
}
}
public static async Task<PlayerData?> GetPlayerData(string enemyPilot)
@ -104,7 +82,6 @@ public static class WebHandler
public static async Task SubmitKill(KillData killData)
{
var timestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
var apiKillData = new APIKillData
{
victim_ship = killData.EnemyShip,
@ -117,9 +94,8 @@ public static class WebHandler
loadout_ship = killData.Ship,
game_version = killData.GameVersion,
trackr_version = killData.TrackRver,
location = killData.Location,
time = timestamp,
hash = GenerateKillHash(killData.EnemyPilot!, timestamp)
location = "Unknown",
time = DateTimeOffset.UtcNow.ToUnixTimeSeconds()
};
if (string.IsNullOrEmpty(apiKillData.rsi))
@ -147,7 +123,6 @@ public static class WebHandler
Console.WriteLine($"API URL: {ConfigManager.ApiUrl}register-kill");
Console.WriteLine($"Victim: {apiKillData.victim}");
Console.WriteLine($"Victim Ship: {apiKillData.victim_ship}");
Console.WriteLine($"Location: {apiKillData.location}");
Console.WriteLine($"Weapon: {apiKillData.weapon}");
Console.WriteLine($"Method: {apiKillData.method}");
Console.WriteLine($"Game Mode: {apiKillData.gamemode}");

View file

@ -1,321 +0,0 @@
{
"Blue": {
"Colors": {
"Accent": "#00A9E0",
"Button": "#0F1A2B",
"Background": "#1D2D44",
"Text": "#FFFFFF",
"AltText": "#A88F2C"
},
"Logo": {
"Path": "/Assets/AutoTrackR.png"
}
},
"Green": {
"Colors": {
"Accent": "#1D9F00",
"Button": "#262424",
"Background": "#072501",
"Text": "#D7AF3C",
"AltText": "#DCD6C4"
},
"Logo": {
"Path": "/Assets/AutoTrackR.png"
}
},
"Red": {
"Colors": {
"Accent": "#D32F2F",
"Button": "#424242",
"Background": "#212121",
"Text": "#E0E0E0",
"AltText": "#A88F2C"
},
"Logo": {
"Path": "/Assets/AutoTrackR.png"
}
},
"Purple": {
"Colors": {
"Accent": "#32CD32",
"Button": "#33065F",
"Background": "#43065F",
"Text": "#00FF00",
"AltText": "#B3976E"
},
"Logo": {
"Path": "/Assets/AutoTrackR.png"
}
},
"GN": {
"Colors": {
"Accent": "#FF0000",
"Button": "#1A0000",
"Background": "#0A0000",
"Text": "#FFD700",
"AltText": "#FF4500"
},
"Logo": {
"Path": "/Assets/GN.png",
"Primary": "#FF0000"
}
},
"NW": {
"Colors": {
"Accent": "#B92D2D",
"Button": "#1C1C1C",
"Background": "#262424",
"Text": "#01DDDA",
"AltText": "#A88F2C"
},
"Logo": {
"Path": "/Assets/NW.png",
"Primary": "#01DDDA"
}
},
"D3VL": {
"Colors": {
"Accent": "#AA0000",
"Button": "#333333",
"Background": "#220000",
"Text": "#FF0000",
"AltText": "#A88F2C"
},
"Logo": {
"Path": "/Assets/D3VL.png",
"Primary": "#CC0000"
}
},
"HIT": {
"Colors": {
"Accent": "#B92D2D",
"Button": "#1C1C1C",
"Background": "#262424",
"Text": "#7d7d7d",
"AltText": "#A88F2C"
},
"Logo": {
"Path": "/Assets/HIT.png"
}
},
"WRAITH": {
"Colors": {
"Accent": "#ff0000",
"Button": "#2a2a2a",
"Background": "#0a0a0a",
"Text": "#DFDFDF",
"AltText": "#8B0000"
},
"Logo": {
"Path": "/Assets/WRITH.png",
"Primary": "#ff0000"
}
},
"Cinderborn": {
"Colors": {
"Accent": "#FF4500",
"Button": "#2A0A0A",
"Background": "#1A0000",
"Text": "#FF8C42",
"AltText": "#FF6B35"
},
"Logo": {
"Path": "/Assets/cinderborn.png",
"Primary": "#FF4500"
}
},
"EMP": {
"Colors": {
"Accent": "#F5721C",
"Button": "#535353",
"Background": "#080000",
"Text": "#FFFFFF",
"AltText": "#CEA75B"
},
"Logo": {
"Path": "/Assets/EMP.png",
"Primary": "#F3BD9B"
}
},
"AVS": {
"Colors": {
"Accent": "#00BFFF",
"Button": "#001F3F",
"Background": "#000B1A",
"Text": "#FFFFFF",
"AltText": "#87CEEB"
},
"Logo": {
"Path": "/Assets/AVSQN.png",
"Primary": "#00BFFF"
}
},
"HEX": {
"Colors": {
"Accent": "#00FF00",
"Button": "#001A00",
"Background": "#000D00",
"Text": "#FFFFFF",
"AltText": "#39FF14"
},
"Logo": {
"Path": "/Assets/HEX.png",
"Primary": "#00FF00"
}
},
"Mammon": {
"Colors": {
"Accent": "#FFD700",
"Button": "#2C2C2C",
"Background": "#1A1A1A",
"Text": "#FFFFFF",
"AltText": "#DAA520"
},
"Logo": {
"Path": "/Assets/MAMMON.png",
"Primary": "#FFD700"
}
},
"Shadow Moses": {
"Colors": {
"Accent": "#FF69B4",
"Button": "#2C2C2C",
"Background": "#2C1F28",
"Text": "#E6E6E6",
"AltText": "#FF1493"
},
"Logo": {
"Path": "/Assets/ShadowMoses.png",
"Primary": "#FF69B4"
}
},
"Mongrel Squad": {
"Colors": {
"Accent": "#00BFFF",
"Button": "#003366",
"Background": "#001F3F",
"Text": "#E6F3FF",
"AltText": "#87CEEB"
},
"Logo": {
"Path": "/Assets/BOBGREL.png",
"Primary": "#00BFFF"
}
},
"Feezy": {
"Colors": {
"Accent": "#FFA500",
"Button": "#1B0C04",
"Background": "#1B0C04",
"Text": "#FFE4B5",
"AltText": "#A88F2C"
},
"Logo": {
"Path": "/Assets/chibifox.png",
"Primary": "#FFA500"
}
},
"NMOS": {
"Colors": {
"Accent": "#EAB787",
"Button": "#601C1B",
"Background": "#170402",
"Text": "#F6DBAD",
"AltText": "#EBCAA0"
},
"Logo": {
"Path": "/Assets/NMOS.png",
"Primary": "#EAB787"
}
},
"Rakk": {
"Colors": {
"Accent": "#FF00FF",
"Button": "#1C1C1C",
"Background": "#0A0A0A",
"Text": "#E6E6E6",
"AltText": "#00BFFF"
},
"Logo": {
"Path": "/Assets/RACKETEERS.png",
"Primary": "#FF00FF"
}
},
"Blightveil": {
"Colors": {
"Accent": "#8B4AC6",
"Button": "#2A2035",
"Background": "#1A1621",
"Text": "#FFFFFF",
"AltText": "#FF3333"
},
"Logo": {
"Path": "/Assets/Blightveil.png",
"Primary": "#8B4AC6"
}
},
"Gankhub": {
"Colors": {
"Accent": "#ffa500",
"Button": "#2C2C2C",
"Background": "#1b1b1b",
"Text": "#FFFFFF",
"AltText": "#ffa500"
},
"Logo": {
"Path": "/Assets/Gankhub.png"
}
},
"IronPoint": {
"Colors": {
"Accent": "#FF0000",
"Button": "#1C1C1C",
"Background": "#000000",
"Text": "#FFFFFF",
"AltText": "#A88F2C"
},
"Logo": {
"Path": "/Assets/IP.png",
"Primary": "#FF0000"
}
},
"Shadow Guardian": {
"Colors": {
"Accent": "#8B0000",
"Button": "#1A0000",
"Background": "#0A0000",
"Text": "#D3D3D3",
"AltText": "#B22222"
},
"Logo": {
"Path": "/Assets/shadowguard.png",
"Primary": "#8B0000"
}
},
"VOX": {
"Colors": {
"Accent": "#C0C0C0",
"Button": "#1C1C1C",
"Background": "#424242",
"Text": "#FFD700",
"AltText": "#817E79"
},
"Logo": {
"Path": "/Assets/VOX.png",
"Primary": "#FFD700"
}
},
"Zap": {
"Colors": {
"Accent": "#FFD700",
"Button": "#1A1A1A",
"Background": "#0A0A0A",
"Text": "#FFFFFF",
"AltText": "#FFA500"
},
"Logo": {
"Path": "/Assets/ZAP.png",
"Primary": "#FFD700"
}
}
}