Compare commits

...

7 commits

Author SHA1 Message Date
Heavy Bob
eb50d878b4 Added kill hash
This hash will be generated for each kill so we can prevent duplicate kills from being reported.
2025-04-07 15:57:11 +10:00
Dork Normalize
0d9f740f32 Fix logo paths 2025-04-06 21:50:27 -07:00
Dork Normalize
ae0ecbe70f Refactor themes 2025-04-06 21:43:00 -07:00
Heavy Bob
271afee9ad Added new themes and refactor old themes 2025-04-07 14:01:50 +10:00
Dork Normalize
1de9582eaf Hard code a version 2.10 2025-04-06 20:54:15 -07:00
Dork Normalize
1294896ec6 Remove Debug print 2025-04-06 20:46:58 -07:00
Dork Normalize
39409d4ea3 Fix locations 2025-04-06 20:46:25 -07:00
17 changed files with 851 additions and 622 deletions

BIN
AutoTrackR2/Assets/ZAP.png Normal file

Binary file not shown.

After

(image error) Size: 16 KiB

Binary file not shown.

After

(image error) Size: 114 KiB

Binary file not shown.

After

(image error) Size: 5.3 MiB

View file

@ -29,9 +29,13 @@
<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>
@ -99,6 +103,15 @@
<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="21"
Maximum="24"
Value="0"
TickFrequency="1"
IsSnapToTickEnabled="True"

File diff suppressed because it is too large Load diff

View file

@ -131,13 +131,14 @@ public partial class HomePage : UserControl
};
// Ship
TrackREventDispatcher.JumpDriveStateChangedEvent += (shipName) =>
TrackREventDispatcher.JumpDriveStateChangedEvent += (data) =>
{
Dispatcher.Invoke(() =>
{
PlayerShipTextBox.Text = LocalPlayerData.CurrentGameMode == GameMode.PersistentUniverse ? shipName : "Unknown";
PlayerShipTextBox.Text = data.ShipName;
AdjustFontSize(PlayerShipTextBox);
LocalPlayerData.PlayerShip = shipName;
LocalPlayerData.PlayerShip = data.ShipName;
LocalPlayerData.LastSeenVehicleLocation = data.Location;
});
};
@ -170,13 +171,14 @@ 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 = LocalPlayerData.GameVersion?.Replace("v", "") ?? "Unknown",
TrackRver = "2.10",
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;
public static string? LastSeenVehicleLocation = "Unknown";
}

View file

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

View file

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

View file

@ -21,14 +21,16 @@ public class VehicleDestructionEvent : ILogEventHandler
public Regex Pattern { get; }
public VehicleDestructionEvent()
{
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>[^']+)'"
""");
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", ""));
}
public void Handle(LogEntry entry)

View file

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

View file

@ -25,7 +25,24 @@ namespace AutoTrackR2
public void ChangeLogoImage(string imagePath)
{
Logo.Source = new BitmapImage(new Uri(imagePath, UriKind.RelativeOrAbsolute));
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
}
}
public MainWindow()
@ -181,11 +198,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(
@ -193,12 +210,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<string>? JumpDriveStateChangedEvent;
public static void OnJumpDriveStateChangedEvent(string shipName)
public static event Action<JumpDriveStateChangedData>? JumpDriveStateChangedEvent;
public static void OnJumpDriveStateChangedEvent(JumpDriveStateChangedData data)
{
JumpDriveStateChangedEvent?.Invoke(shipName);
JumpDriveStateChangedEvent?.Invoke(data);
}
}

View file

@ -19,6 +19,7 @@ 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,6 +5,7 @@ using System.Text.Json;
using System.Text.RegularExpressions;
using AutoTrackR2.LogEventHandlers;
using System.Globalization;
using System.Security.Cryptography;
namespace AutoTrackR2;
@ -24,6 +25,27 @@ 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)
@ -82,6 +104,7 @@ public static class WebHandler
public static async Task SubmitKill(KillData killData)
{
var timestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
var apiKillData = new APIKillData
{
victim_ship = killData.EnemyShip,
@ -94,8 +117,9 @@ public static class WebHandler
loadout_ship = killData.Ship,
game_version = killData.GameVersion,
trackr_version = killData.TrackRver,
location = "Unknown",
time = DateTimeOffset.UtcNow.ToUnixTimeSeconds()
location = killData.Location,
time = timestamp,
hash = GenerateKillHash(killData.EnemyPilot!, timestamp)
};
if (string.IsNullOrEmpty(apiKillData.rsi))
@ -123,6 +147,7 @@ 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}");

321
AutoTrackR2/themes.json Normal file
View file

@ -0,0 +1,321 @@
{
"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"
}
}
}