Open verdie-g opened 1 year ago
Alternatively we can kick people using family-shared account. Here chat gpt code doing that:
using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
// Replace <STEAM_API_KEY> with your actual Steam API key
string apiKey = "<STEAM_API_KEY>";
// Replace <STEAM_ID> with the Steam ID of the user you want to check
string steamId = "<STEAM_ID>";
// Replace <APP_ID> with the Steam App ID of the game you want to check ownership of
int appId = <APP_ID>;
// Construct the URL to call the "GetOwnedGames" API method
string url = $"http://api.steampowered.com/IPlayerService/GetOwnedGames/v0001/?key={apiKey}&steamid={steamId}&format=json&include_appinfo=1";
// Create an HttpClient instance to make the API call
using (HttpClient client = new HttpClient())
{
try
{
// Make the API call and get the response
HttpResponseMessage response = await client.GetAsync(url);
response.EnsureSuccessStatusCode();
// Read the response as a string
string responseBody = await response.Content.ReadAsStringAsync();
// Parse the JSON response into a dynamic object
dynamic json = Newtonsoft.Json.JsonConvert.DeserializeObject(responseBody);
// Check if the user owns the specified game and is not sharing it with family members
foreach (var game in json.response.games)
{
if (game.appid == appId && !game.is_shared)
{
Console.WriteLine($"User {steamId} owns game {appId}");
return;
}
}
Console.WriteLine($"User {steamId} does not own game {appId}");
}
catch (HttpRequestException ex)
{
Console.WriteLine($"An error occurred while calling the Steam API: {ex.Message}");
}
}
}
}
Bannerlord may depend on Steamworks.NET so we could use that library instead of crafting the request.
Bannerlord may depend on Steamworks.NET so we could use that library instead of crafting the request.
bool BIsSubscribedFromFamilySharing();
To cope with ban evading through steam family share.