mirror of
https://github.com/BubbaGumpShrump/AutoTrackR2.git
synced 2025-06-19 13:09:07 +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;
|
_UIEventsRegistered = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ public class LogHandler(string logPath)
|
||||||
new InstancedInteriorEvent(),
|
new InstancedInteriorEvent(),
|
||||||
new InArenaCommanderEvent(),
|
new InArenaCommanderEvent(),
|
||||||
new InPersistentUniverseEvent(),
|
new InPersistentUniverseEvent(),
|
||||||
new GameVersionEvent(),
|
new GameVersionEvent()
|
||||||
];
|
];
|
||||||
|
|
||||||
// Initialize the LogHandler and run all startup handlers
|
// Initialize the LogHandler and run all startup handlers
|
||||||
|
|
|
@ -51,7 +51,7 @@ public static class WebHandler
|
||||||
var ueeMatch = ueePattern.Match(content);
|
var ueeMatch = ueePattern.Match(content);
|
||||||
if (ueeMatch.Success)
|
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);
|
var orgMatch = orgPattern.Match(content);
|
||||||
|
@ -88,15 +88,28 @@ public static class WebHandler
|
||||||
rsi = enemyPlayerData?.UEERecord,
|
rsi = enemyPlayerData?.UEERecord,
|
||||||
weapon = deathData.Weapon,
|
weapon = deathData.Weapon,
|
||||||
method = deathData.DamageType,
|
method = deathData.DamageType,
|
||||||
|
// loadout_ship = LocalPlayerData.PlayerShip ?? "Unknown",
|
||||||
loadout_ship = LocalPlayerData.PlayerShip ?? "Unknown",
|
loadout_ship = LocalPlayerData.PlayerShip ?? "Unknown",
|
||||||
game_version = LocalPlayerData.GameVersion ?? "Unknown",
|
game_version = LocalPlayerData.GameVersion ?? "Unknown",
|
||||||
gamemode = LocalPlayerData.CurrentGameMode.ToString() ?? "Unknown",
|
trackr_version = UpdatePage.currentVersion.Replace("v", "") ?? "Unknown",
|
||||||
trackr_version = UpdatePage.currentVersion ?? "Unknown",
|
|
||||||
location = LocalPlayerData.LastSeenVehicleLocation ?? "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();
|
var httpClient = new HttpClient();
|
||||||
string jsonData = JsonSerializer.Serialize(killData);
|
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