mirror of
https://github.com/BubbaGumpShrump/AutoTrackR2.git
synced 2025-05-22 08:45:30 +00:00
Fix APIcalls
This commit is contained in:
parent
a08de59a73
commit
c6e6a7e6bd
3 changed files with 23 additions and 5 deletions
AutoTrackR2
|
@ -147,6 +147,11 @@ public partial class HomePage : UserControl
|
|||
}
|
||||
};
|
||||
|
||||
// Vehicle Destruction
|
||||
TrackREventDispatcher.VehicleDestructionEvent += (data) => {
|
||||
LocalPlayerData.LastSeenVehicleLocation = data.VehicleZone;
|
||||
};
|
||||
|
||||
_UIEventsRegistered = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ public class LogHandler(string logPath)
|
|||
new InstancedInteriorEvent(),
|
||||
new InArenaCommanderEvent(),
|
||||
new InPersistentUniverseEvent(),
|
||||
new GameVersionEvent(),
|
||||
new GameVersionEvent()
|
||||
];
|
||||
|
||||
// Initialize the LogHandler and run all startup handlers
|
||||
|
|
|
@ -51,7 +51,7 @@ public static class WebHandler
|
|||
var ueeMatch = ueePattern.Match(content);
|
||||
if (ueeMatch.Success)
|
||||
{
|
||||
playerData.UEERecord = ueeMatch.Groups[1].Value;
|
||||
playerData.UEERecord = ueeMatch.Groups[1].Value == "n/a" ? "-1" : ueeMatch.Groups[1].Value;
|
||||
}
|
||||
|
||||
var orgMatch = orgPattern.Match(content);
|
||||
|
@ -88,15 +88,28 @@ public static class WebHandler
|
|||
rsi = enemyPlayerData?.UEERecord,
|
||||
weapon = deathData.Weapon,
|
||||
method = deathData.DamageType,
|
||||
// loadout_ship = LocalPlayerData.PlayerShip ?? "Unknown",
|
||||
loadout_ship = LocalPlayerData.PlayerShip ?? "Unknown",
|
||||
game_version = LocalPlayerData.GameVersion ?? "Unknown",
|
||||
gamemode = LocalPlayerData.CurrentGameMode.ToString() ?? "Unknown",
|
||||
trackr_version = UpdatePage.currentVersion ?? "Unknown",
|
||||
trackr_version = UpdatePage.currentVersion.Replace("v", "") ?? "Unknown",
|
||||
location = LocalPlayerData.LastSeenVehicleLocation ?? "Unknown"
|
||||
};
|
||||
|
||||
switch (LocalPlayerData.CurrentGameMode)
|
||||
{
|
||||
case GameMode.PersistentUniverse:
|
||||
killData.gamemode = "pu";
|
||||
break;
|
||||
case GameMode.ArenaCommander:
|
||||
killData.gamemode = "ac";
|
||||
break;
|
||||
}
|
||||
|
||||
var httpClient = new HttpClient();
|
||||
string jsonData = JsonSerializer.Serialize(killData);
|
||||
await httpClient.PostAsync(ConfigManager.ApiUrl + "/register-kill", new StringContent(jsonData, Encoding.UTF8, "application/json"));
|
||||
httpClient.DefaultRequestHeaders.Add("Authorization", "Bearer " + ConfigManager.ApiKey);
|
||||
httpClient.DefaultRequestHeaders.Add("User-Agent", "AutoTrackR2");
|
||||
httpClient.DefaultRequestHeaders.Add("Accept", "application/json");
|
||||
await httpClient.PostAsync(ConfigManager.ApiUrl + "register-kill", new StringContent(jsonData, Encoding.UTF8, "application/json"));
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue