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

View file

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

View file

@ -4,6 +4,7 @@ using System.Net.Http.Headers;
using System.Net.Http; using System.Net.Http;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Text; using System.Text;
using System.Text.Json;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Media; using System.Windows.Media;
@ -11,15 +12,17 @@ using System.Windows.Media.Effects;
using System.Windows.Threading; using System.Windows.Threading;
using Microsoft.Win32; using Microsoft.Win32;
namespace AutoTrackR2 namespace AutoTrackR2;
public partial class ConfigPage : UserControl
{ {
public partial class ConfigPage : UserControl
{
// Store the current slider value // Store the current slider value
private double savedSliderValue = 0; private double savedSliderValue = 0;
private MainWindow mainWindow; private MainWindow mainWindow;
Dictionary<string, Theme>? _themes = null;
public ConfigPage(MainWindow mainWindow) public ConfigPage(MainWindow mainWindow)
{ {
InitializeComponent(); InitializeComponent();
@ -35,6 +38,11 @@ namespace AutoTrackR2
ThemeSlider.Value = ConfigManager.Theme; ThemeSlider.Value = ConfigManager.Theme;
ApplyToggleModeStyle(OfflineModeSlider.Value, VisorWipeSlider.Value, VideoRecordSlider.Value); ApplyToggleModeStyle(OfflineModeSlider.Value, VisorWipeSlider.Value, VideoRecordSlider.Value);
const string themeJsonPath = "themes.json";
var themeJson = File.ReadAllText(themeJsonPath);
_themes = JsonSerializer.Deserialize<Dictionary<string, Theme>>(themeJson);
} }
// Method to change the logo image in MainWindow // Method to change the logo image in MainWindow
@ -79,14 +87,8 @@ namespace AutoTrackR2
OfflineModeSlider.Value = offlineMode; OfflineModeSlider.Value = offlineMode;
// Handle themes // Handle themes
if (theme >= 0 && theme <= 3) ApplyTheme(theme);
{
ThemeSlider.Value = theme; // Set slider only for visible themes
}
else
{
ApplyTheme(theme); // Apply hidden themes directly
}
} }
private void ApplyToggleModeStyle(double offlineModeValue, double visorWipeValue, double videoRecordValue) private void ApplyToggleModeStyle(double offlineModeValue, double visorWipeValue, double videoRecordValue)
@ -129,228 +131,28 @@ namespace AutoTrackR2
private void ApplyTheme(int themeIndex) private void ApplyTheme(int themeIndex)
{ {
switch (themeIndex) var theme = _themes?.Values.ElementAtOrDefault(themeIndex);
if (theme == null) return;
// Update the logo
if (theme.Logo != null && theme.Logo.Path != null)
{ {
case 0: // Default Blue Theme ChangeLogo(theme.Logo.Path,
UpdateThemeColors( theme.Logo.Primary != null
(Color)ColorConverter.ConvertFromString("#00A9E0"), // Accent/Border ? (Color) ColorConverter.ConvertFromString(theme.Logo.Primary)
(Color)ColorConverter.ConvertFromString("#0F1A2B"), // Button : Colors.Transparent);
(Color)ColorConverter.ConvertFromString("#1D2D44"), // Background }
(Color)ColorConverter.ConvertFromString("#FFFFFF"), // Text
(Color)ColorConverter.ConvertFromString("#A88F2C") // AltText // Update the colors
); if (theme.Colors != null)
ChangeLogo("/Assets/AutoTrackR.png"); {
break; var accent = (Color)ColorConverter.ConvertFromString(theme.Colors.Accent);
case 1: // Green Theme var button = (Color)ColorConverter.ConvertFromString(theme.Colors.Button);
UpdateThemeColors( var backgroundDark = (Color)ColorConverter.ConvertFromString(theme.Colors.Background);
(Color)ColorConverter.ConvertFromString("#1D9F00"), // Accent/Border var text = (Color)ColorConverter.ConvertFromString(theme.Colors.Text);
(Color)ColorConverter.ConvertFromString("#262424"), // Button var altText = (Color)ColorConverter.ConvertFromString(theme.Colors.AltText);
(Color)ColorConverter.ConvertFromString("#072501"), // Background
(Color)ColorConverter.ConvertFromString("#D7AF3C"), // Text UpdateThemeColors(accent, button, backgroundDark, text, altText);
(Color)ColorConverter.ConvertFromString("#DCD6C4") // AltText
);
ChangeLogo("/Assets/AutoTrackR.png");
break;
case 2: // Red Theme
UpdateThemeColors(
(Color)ColorConverter.ConvertFromString("#D32F2F"), // Accent/Border
(Color)ColorConverter.ConvertFromString("#424242"), // Button
(Color)ColorConverter.ConvertFromString("#212121"), // Light Background
(Color)ColorConverter.ConvertFromString("#E0E0E0"), // Text
(Color)ColorConverter.ConvertFromString("#A88F2C") // AltText
);
ChangeLogo("/Assets/AutoTrackR.png");
break;
case 3: // Purple Theme
UpdateThemeColors(
(Color)ColorConverter.ConvertFromString("#32CD32"), // Accent/Border
(Color)ColorConverter.ConvertFromString("#33065F"), // Button
(Color)ColorConverter.ConvertFromString("#43065F"), // Background
(Color)ColorConverter.ConvertFromString("#00FF00"), // Text
(Color)ColorConverter.ConvertFromString("#B3976E") // AltText
);
ChangeLogo("/Assets/AutoTrackR.png");
break;
case 4: // GN Theme
UpdateThemeColors(
(Color)ColorConverter.ConvertFromString("#FF0000"), // Accent/Border
(Color)ColorConverter.ConvertFromString("#1C1C1C"), // Button
(Color)ColorConverter.ConvertFromString("#000000"), // Background
(Color)ColorConverter.ConvertFromString("#FBC603"), // Text
(Color)ColorConverter.ConvertFromString("#BFA8A6") // AltText
);
ChangeLogo("/Assets/GN.png", (Color)ColorConverter.ConvertFromString("#FF0000"));
break;
case 5: // NW Theme
UpdateThemeColors(
(Color)ColorConverter.ConvertFromString("#B92D2D"), // Accent/Border
(Color)ColorConverter.ConvertFromString("#1C1C1C"), // Button
(Color)ColorConverter.ConvertFromString("#262424"), // Background
(Color)ColorConverter.ConvertFromString("#01DDDA"), // Text
(Color)ColorConverter.ConvertFromString("#A88F2C") // AltText
);
ChangeLogo("/Assets/NW.png", (Color)ColorConverter.ConvertFromString("#01DDDA"));
break;
case 6: // D3VL Theme
UpdateThemeColors(
(Color)ColorConverter.ConvertFromString("#AA0000"), // Accent/Border
(Color)ColorConverter.ConvertFromString("#333333"), // Button
(Color)ColorConverter.ConvertFromString("#220000"), // Background
(Color)ColorConverter.ConvertFromString("#FF0000"), // Text
(Color)ColorConverter.ConvertFromString("#A88F2C") // AltText
);
ChangeLogo("/Assets/D3VL.png", (Color)ColorConverter.ConvertFromString("#CC0000"));
break;
case 7: // HIT Theme
UpdateThemeColors(
(Color)ColorConverter.ConvertFromString("#B92D2D"), // Accent/Border
(Color)ColorConverter.ConvertFromString("#1C1C1C"), // Button
(Color)ColorConverter.ConvertFromString("#262424"), // Background
(Color)ColorConverter.ConvertFromString("#7d7d7d"), // Text
(Color)ColorConverter.ConvertFromString("#A88F2C") // AltText
);
ChangeLogo("/Assets/HIT.png");
break;
case 8: // WRAITH Theme
UpdateThemeColors(
(Color)ColorConverter.ConvertFromString("#ff0000"), // Accent/Border
(Color)ColorConverter.ConvertFromString("#2a2a2a"), // Button
(Color)ColorConverter.ConvertFromString("#0a0a0a"), // Background
(Color)ColorConverter.ConvertFromString("#DFDFDF"), // Text
(Color)ColorConverter.ConvertFromString("#8B0000") // AltText
);
ChangeLogo("/Assets/WRITH.png", (Color)ColorConverter.ConvertFromString("#ff0000"));
break;
case 9: // VOX Theme
UpdateThemeColors(
(Color)ColorConverter.ConvertFromString("#C0C0C0"), // Accent/Border
(Color)ColorConverter.ConvertFromString("#1C1C1C"), // Button
(Color)ColorConverter.ConvertFromString("#424242"), // Background
(Color)ColorConverter.ConvertFromString("#FFD700"), // Text
(Color)ColorConverter.ConvertFromString("#817E79") // AltText
);
ChangeLogo("/Assets/VOX.png", (Color)ColorConverter.ConvertFromString("#FFD700"));
break;
case 10: // EMP Theme
UpdateThemeColors(
(Color)ColorConverter.ConvertFromString("#F5721C"), // Accent/Border
(Color)ColorConverter.ConvertFromString("#535353"), // Button
(Color)ColorConverter.ConvertFromString("#080000"), // Background
(Color)ColorConverter.ConvertFromString("#FFFFFF"), // Text
(Color)ColorConverter.ConvertFromString("#CEA75B") // AltText
);
ChangeLogo("/Assets/EMP.png", (Color)ColorConverter.ConvertFromString("#F3BD9B"));
break;
case 11: // AVS Theme
UpdateThemeColors(
(Color)ColorConverter.ConvertFromString("#3fbcff"), // Accent/Border
(Color)ColorConverter.ConvertFromString("#060606"), // Button
(Color)ColorConverter.ConvertFromString("#333333"), // Background
(Color)ColorConverter.ConvertFromString("#e8e8e8"), // Text
(Color)ColorConverter.ConvertFromString("#A88F2C") // AltText
);
ChangeLogo("/Assets/AVSQN.png", (Color)ColorConverter.ConvertFromString("#3fbcff"));
break;
case 12: // HEX Theme
UpdateThemeColors(
(Color)ColorConverter.ConvertFromString("#39FF14"), // Accent/Border
(Color)ColorConverter.ConvertFromString("#535353"), // Button
(Color)ColorConverter.ConvertFromString("#000800"), // Background
(Color)ColorConverter.ConvertFromString("#FFFFFF"), // Text
(Color)ColorConverter.ConvertFromString("#CFFF04") // AltText
);
ChangeLogo("/Assets/HEX.png", (Color)ColorConverter.ConvertFromString("#39FF14"));
break;
case 13: // Mammon Theme
UpdateThemeColors(
(Color)ColorConverter.ConvertFromString("#FFD700"), // Accent/Border - Royal Gold
(Color)ColorConverter.ConvertFromString("#2C2C2C"), // Button - Dark Gray
(Color)ColorConverter.ConvertFromString("#1A1A1A"), // Background - Rich Black
(Color)ColorConverter.ConvertFromString("#FFFFFF"), // Text - White
(Color)ColorConverter.ConvertFromString("#DAA520") // AltText - Golden Rod
);
ChangeLogo("/Assets/MAMMON.png", (Color)ColorConverter.ConvertFromString("#FFD700"));
break;
case 14: // Shadow Moses Theme
UpdateThemeColors(
(Color)ColorConverter.ConvertFromString("#FF69B4"), // Accent/Border - Hot Pink
(Color)ColorConverter.ConvertFromString("#2C2C2C"), // Button - Dark Gray
(Color)ColorConverter.ConvertFromString("#2C1F28"), // Background - Dark Pink-Gray
(Color)ColorConverter.ConvertFromString("#E6E6E6"), // Text - Light Gray
(Color)ColorConverter.ConvertFromString("#FF1493") // AltText - Deep Pink
);
ChangeLogo("/Assets/ShadowMoses.png", (Color)ColorConverter.ConvertFromString("#FF69B4"));
break;
case 15: // Mongrel Squad
UpdateThemeColors(
(Color)ColorConverter.ConvertFromString("#00416A"), // Accent/Border - NyQuil Dark Blue
(Color)ColorConverter.ConvertFromString("#1B3F5C"), // Button - Midnight Blue
(Color)ColorConverter.ConvertFromString("#002E4D"), // Background - Deep NyQuil Blue
(Color)ColorConverter.ConvertFromString("#B0C4DE"), // Text - Light Steel Blue
(Color)ColorConverter.ConvertFromString("#4F94CD") // AltText - Steel Blue
);
ChangeLogo("/Assets/Bobgrel.png", (Color)ColorConverter.ConvertFromString("#00BFFF"));
break;
case 16: // Feezy
UpdateThemeColors(
(Color)ColorConverter.ConvertFromString("#FFA500"), // Accent/Border
(Color)ColorConverter.ConvertFromString("#1B0C04"), // Button
(Color)ColorConverter.ConvertFromString("#1B0C04"), // Background
(Color)ColorConverter.ConvertFromString("#FFE4B5"), // Text
(Color)ColorConverter.ConvertFromString("#A88F2C") // AltText
);
ChangeLogo("/Assets/chibifox.png", (Color)ColorConverter.ConvertFromString("#FFA500"));
break;
case 17: // NMOS
UpdateThemeColors(
(Color)ColorConverter.ConvertFromString("#EAB787"), // Accent/Border
(Color)ColorConverter.ConvertFromString("#601C1B"), // Button
(Color)ColorConverter.ConvertFromString("#170402"), // Background
(Color)ColorConverter.ConvertFromString("#F6DBAD"), // Text
(Color)ColorConverter.ConvertFromString("#EBCAA0") // AltText
);
ChangeLogo("/Assets/NMOS.png", (Color)ColorConverter.ConvertFromString("#EAB787"));
break;
case 18: // Rakk Theme
UpdateThemeColors(
(Color)ColorConverter.ConvertFromString("#FF00FF"), // Accent/Border - Magenta
(Color)ColorConverter.ConvertFromString("#1C1C1C"), // Button - Dark Gray
(Color)ColorConverter.ConvertFromString("#0A0A0A"), // Background - Nearly Black
(Color)ColorConverter.ConvertFromString("#E6E6E6"), // Text - Light Gray
(Color)ColorConverter.ConvertFromString("#00BFFF") // AltText - Deep Sky Blue
);
ChangeLogo("/Assets/RACKETEERS.png", (Color)ColorConverter.ConvertFromString("#FF00FF"));
break;
case 19: // Blightveil Theme
UpdateThemeColors(
(Color)ColorConverter.ConvertFromString("#8B4AC6"), // Accent/Border - Purple from the logo border
(Color)ColorConverter.ConvertFromString("#2A2035"), // Button - Darker purple for buttons
(Color)ColorConverter.ConvertFromString("#1A1621"), // Background - Very dark purple/black
(Color)ColorConverter.ConvertFromString("#FFFFFF"), // Text - White like the logo text
(Color)ColorConverter.ConvertFromString("#FF3333") // AltText - Red like the eyes
);
ChangeLogo("/Assets/Blightveil.png", (Color)ColorConverter.ConvertFromString("#8B4AC6"));
break;
case 20: // Gankhub Theme
UpdateThemeColors(
(Color)ColorConverter.ConvertFromString("#ffa500"), // Accent/Border
(Color)ColorConverter.ConvertFromString("#2C2C2C"), // Button
(Color)ColorConverter.ConvertFromString("#1b1b1b"), // Background
(Color)ColorConverter.ConvertFromString("#FFFFFF"), // Text
(Color)ColorConverter.ConvertFromString("#ffa500") // AltText
);
ChangeLogo("/Assets/Gankhub.png");
break;
case 21: // IronPoint
UpdateThemeColors(
(Color)ColorConverter.ConvertFromString("#C83300"), // Accent/Border
(Color)ColorConverter.ConvertFromString("#2D2D2D"), // Button
(Color)ColorConverter.ConvertFromString("#161515"), // Background
(Color)ColorConverter.ConvertFromString("#ffffff"), // Text
(Color)ColorConverter.ConvertFromString("#aaaaaa") // AltText
);
ChangeLogo("/Assets/IP.png", (Color)ColorConverter.ConvertFromString("#3F1210"));
break;
} }
} }
@ -619,5 +421,25 @@ namespace AutoTrackR2
MessageBox.Show($"API Test Failure. {ex.Message}"); MessageBox.Show($"API Test Failure. {ex.Message}");
} }
} }
} }
public class Theme
{
public ThemeColors? Colors { get; set; }
public ThemeLogo? Logo { get; set; }
}
public class ThemeColors
{
public string? Accent { get; set; }
public string? Button { get; set; }
public string? Background { get; set; }
public string? Text { get; set; }
public string? AltText { get; set; }
}
public class ThemeLogo
{
public string? Path { get; set; }
public string? Primary { get; set; } // Optional: null if not used
} }

View file

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

View file

@ -2,6 +2,12 @@
namespace AutoTrackR2.LogEventHandlers; namespace AutoTrackR2.LogEventHandlers;
public struct JumpDriveStateChangedData
{
public string ShipName { get; set; }
public string Location { get; set; }
}
public class JumpDriveStateChangedEvent : ILogEventHandler public class JumpDriveStateChangedEvent : ILogEventHandler
{ {
public Regex Pattern { get; } public Regex Pattern { get; }
@ -9,7 +15,7 @@ public class JumpDriveStateChangedEvent : ILogEventHandler
public JumpDriveStateChangedEvent() 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) public void Handle(LogEntry entry)
@ -18,10 +24,19 @@ public class JumpDriveStateChangedEvent : ILogEventHandler
var match = Pattern.Match(entry.Message); var match = Pattern.Match(entry.Message);
if (!match.Success) return; if (!match.Success) return;
var data = new JumpDriveStateChangedData
{
Location = match.Groups["Location"].Value
};
match = _cleanUpPattern.Match(match.Groups["ShipName"].Value); match = _cleanUpPattern.Match(match.Groups["ShipName"].Value);
if (match.Success) 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() 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) public void Handle(LogEntry entry)
@ -18,10 +18,20 @@ public class RequestJumpFailedEvent : ILogEventHandler
var match = Pattern.Match(entry.Message); var match = Pattern.Match(entry.Message);
if (!match.Success) return; if (!match.Success) return;
var data = new JumpDriveStateChangedData
{
Location = match.Groups["Location"].Value
};
match = _cleanUpPattern.Match(match.Groups["ShipName"].Value); match = _cleanUpPattern.Match(match.Groups["ShipName"].Value);
if (match.Success) 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 Regex Pattern { get; }
public VehicleDestructionEvent() public VehicleDestructionEvent()
{ {
Pattern = new Regex(""" const string patternStr = """
"<(?<timestamp>[^>]+)> \[Notice\] <Vehicle Destruction> CVehicle::OnAdvanceDestroyLevel: " + <(?<timestamp>[^>]+)> \[Notice\] <Vehicle Destruction> CVehicle::OnAdvanceDestroyLevel:
"Vehicle '(?<vehicle>[^']+)' \[\d+\] in zone '(?<vehicle_zone>[^']+)' " + Vehicle '(?<vehicle>[^']+)' \[\d+\] in zone '(?<vehicle_zone>[^']+)'
"\[pos x: (?<pos_x>[-\d\.]+), y: (?<pos_y>[-\d\.]+), z: (?<pos_z>[-\d\.]+) " + \[pos x: (?<pos_x>[-\d\.]+), y: (?<pos_y>[-\d\.]+), z: (?<pos_z>[-\d\.]+)
"vel x: [^,]+, y: [^,]+, z: [^\]]+\] driven by '(?<driver>[^']+)' \[\d+\] " + vel x: [^,]+, y: [^,]+, z: [^\]]+\] driven by '(?<driver>[^']+)' \[\d+\]
"advanced from destroy level (?<destroy_level_from>\d+) to (?<destroy_level_to>\d+) " + advanced from destroy level (?<destroy_level_from>\d+) to (?<destroy_level_to>\d+)
"caused by '(?<caused_by>[^']+)' \[\d+\] with '(?<damage_type>[^']+)'" caused by '(?<caused_by>[^']+)' \[\d+\] with '(?<damage_type>[^']+)'
"""); """;
Pattern = new Regex(Regex.Replace(patternStr, @"\t|\n|\r", ""));
} }
public void Handle(LogEntry entry) public void Handle(LogEntry entry)

View file

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

View file

@ -25,7 +25,24 @@ namespace AutoTrackR2
public void ChangeLogoImage(string imagePath) 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() public MainWindow()

View file

@ -49,9 +49,9 @@ public static class TrackREventDispatcher
// Jump Drive state has changed // Jump Drive state has changed
// Todo: Add proper data for this event. Right now only ship name is used. // Todo: Add proper data for this event. Right now only ship name is used.
public static event Action<string>? JumpDriveStateChangedEvent; public static event Action<JumpDriveStateChangedData>? JumpDriveStateChangedEvent;
public static void OnJumpDriveStateChangedEvent(string shipName) 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? Enlisted;
public string? RecordNumber; public string? RecordNumber;
public string? OrgAffiliation; public string? OrgAffiliation;
public string? Location;
public string? Player; public string? Player;
public string? Weapon; public string? Weapon;
public string? Ship; public string? Ship;

View file

@ -5,6 +5,7 @@ using System.Text.Json;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using AutoTrackR2.LogEventHandlers; using AutoTrackR2.LogEventHandlers;
using System.Globalization; using System.Globalization;
using System.Security.Cryptography;
namespace AutoTrackR2; namespace AutoTrackR2;
@ -24,6 +25,27 @@ public static class WebHandler
public string? trackr_version { get; set; } public string? trackr_version { get; set; }
public string? location { get; set; } public string? location { get; set; }
public long time { 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) public static async Task<PlayerData?> GetPlayerData(string enemyPilot)
@ -82,6 +104,7 @@ public static class WebHandler
public static async Task SubmitKill(KillData killData) public static async Task SubmitKill(KillData killData)
{ {
var timestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
var apiKillData = new APIKillData var apiKillData = new APIKillData
{ {
victim_ship = killData.EnemyShip, victim_ship = killData.EnemyShip,
@ -94,8 +117,9 @@ public static class WebHandler
loadout_ship = killData.Ship, loadout_ship = killData.Ship,
game_version = killData.GameVersion, game_version = killData.GameVersion,
trackr_version = killData.TrackRver, trackr_version = killData.TrackRver,
location = "Unknown", location = killData.Location,
time = DateTimeOffset.UtcNow.ToUnixTimeSeconds() time = timestamp,
hash = GenerateKillHash(killData.EnemyPilot!, timestamp)
}; };
if (string.IsNullOrEmpty(apiKillData.rsi)) if (string.IsNullOrEmpty(apiKillData.rsi))
@ -123,6 +147,7 @@ public static class WebHandler
Console.WriteLine($"API URL: {ConfigManager.ApiUrl}register-kill"); Console.WriteLine($"API URL: {ConfigManager.ApiUrl}register-kill");
Console.WriteLine($"Victim: {apiKillData.victim}"); Console.WriteLine($"Victim: {apiKillData.victim}");
Console.WriteLine($"Victim Ship: {apiKillData.victim_ship}"); Console.WriteLine($"Victim Ship: {apiKillData.victim_ship}");
Console.WriteLine($"Location: {apiKillData.location}");
Console.WriteLine($"Weapon: {apiKillData.weapon}"); Console.WriteLine($"Weapon: {apiKillData.weapon}");
Console.WriteLine($"Method: {apiKillData.method}"); Console.WriteLine($"Method: {apiKillData.method}");
Console.WriteLine($"Game Mode: {apiKillData.gamemode}"); 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"
}
}
}