ManiaAPI.XmlRpc
2.0.0
The package was incorrectly named. The going name onwards is ManiaAPI.Xml.
dotnet add package ManiaAPI.XmlRpc --version 2.0.0
NuGet\Install-Package ManiaAPI.XmlRpc -Version 2.0.0
<PackageReference Include="ManiaAPI.XmlRpc" Version="2.0.0" />
<PackageVersion Include="ManiaAPI.XmlRpc" Version="2.0.0" />
<PackageReference Include="ManiaAPI.XmlRpc" />
paket add ManiaAPI.XmlRpc --version 2.0.0
#r "nuget: ManiaAPI.XmlRpc, 2.0.0"
#addin nuget:?package=ManiaAPI.XmlRpc&version=2.0.0
#tool nuget:?package=ManiaAPI.XmlRpc&version=2.0.0
ManiaAPI.XmlRpc
Wraps TMF, TMT, and ManiaPlanet XML-RPC ingame APIs. Does not include dedicated server XML-RPC.
It currently does not support any authentication for its complexity and security reasons. If some of the leaderboard methods will become secured with authentication though, this will be considered. For authenticated functionality in TMUF, use the TMF.NET library.
For dedicated server XML-RPC, use the GbxRemote.Net library.
Possibilities
For TMUF:
- Get scores
- Top 10 leaderboards
- All records (without identities)
- Skillpoints
- Medals
- Get ladder zone rankings
- Get ladder player rankings
- Get available master servers
For ManiaPlanet:
- Get campaign and map leaderboard from multiple campaigns/maps at once
- Top 10 leaderboards
- All records (without identities)
- Skillpoints
- Medals
- Get campaign and map leaderboards
- Any range of records
- Skillpoints
- Medals
- Get available master servers
For TMT:
- Get all map records (without identities)
- Get campaign medal rankings (without identities)
For all games:
- Get all available zones
Setup for TMUF
using ManiaAPI.XmlRpc;
var masterServer = new MasterServerTMUF();
or with DI, using an injected HttpClient
:
using ManiaAPI.XmlRpc;
builder.Services.AddScoped<MasterServerTMUF>();
builder.Services.AddHttpClient<MasterServerTMUF>(client => client.BaseAddress = new(MasterServerTMUF.DefaultAddress));
Setup for ManiaPlanet
First examples assume Maniaplanet relay 2
master server is still running.
using ManiaAPI.XmlRpc;
var masterServer = new MasterServerMP4();
Because the responses can be quite large sometimes, it's recommended to accept compression on the client.
using ManiaAPI.XmlRpc;
var httpClient = new HttpClient(new HttpClientHandler { AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate })
{
BaseAddress = new System.Uri(MasterServerMP4.DefaultAddress)
};
var masterServer = new MasterServerMP4(httpClient);
or with DI, using an injected HttpClient
:
using ManiaAPI.XmlRpc;
builder.Services.AddScoped<MasterServerMP4>();
builder.Services.AddHttpClient<MasterServerMP4>(client => client.BaseAddress = new Uri(MasterServerMP4.DefaultAddress))
.ConfigurePrimaryHttpMessageHandler(() => new HttpClientHandler
{
AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate
});
In case Maniaplanet relay 2
shuts down / errors out, you have to reach out to init server with GetWaitingParams
and retrieve an available relay. That's how the game client does it (thanks Mystixor for figuring this out).
To be most inline with the game client, you should validate the master server first with ValidateAsync
. Behind the scenes, it first requests GetApplicationConfig
, then on catched HTTP exception, it requests GetWaitingParams
from the init server and use the available master server instead.
using ManiaAPI.XmlRpc;
var httpClient = new HttpClient(new HttpClientHandler { AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate })
{
BaseAddress = new System.Uri(MasterServerMP4.DefaultAddress)
};
var masterServer = new MasterServerMP4(httpClient);
await masterServer.ValidateAsync(); // Do this for reliability
// The master server is now ready to use
with DI, it is recommended to separate the init server's HttpClient
from the master server.
You don't have to enable decompression for the init server, as it does not return large responses.
using ManiaAPI.XmlRpc;
// Register the services
builder.Services.AddScoped<InitServerMP4>();
builder.Services.AddScoped<MasterServerMP4>();
builder.Services.AddHttpClient<InitServerMP4>(client => client.BaseAddress = new Uri(InitServerMP4.DefaultAddress));
builder.Services.AddHttpClient<MasterServerMP4>(client => client.BaseAddress = new Uri(MasterServerMP4.DefaultAddress))
.ConfigurePrimaryHttpMessageHandler(() => new HttpClientHandler
{
AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate
});
// Do the setup
var initServer = provider.GetRequiredService<InitServerMP4>();
var masterServer = provider.GetRequiredService<MasterServerMP4>();
await masterServer.ValidateAsync(initServer); // Do this for reliability
// The master server is now ready to use
Setup for TMT
TMT handles 3 platforms: PC, XB1, and PS4. Each have their own init server and master server. Nadeo still tends to change these master servers, so it's recommended to first go through the init server.
using ManiaAPI.XmlRpc;
var initServer = new InitServerTMT(Platform.PC);
var waitingParams = await initServer.GetWaitingParamsAsync();
var masterServer = new MasterServerTMT(waitingParams.MasterServers.First());
// You can repeat this exact setup for XB1 and PS4 as well if you want to work with those platforms, with something like Dictionary<Platform, MasterServerTMT> ...
Because the responses can be quite large sometimes, it's recommended to accept compression on the client for the master server. Init server does not return large responses, so it's not necessary for that one.
using ManiaAPI.XmlRpc;
var initServer = new InitServerTMT(Platform.PC);
var waitingParams = await initServer.GetWaitingParamsAsync();
var httpClient = new HttpClient(new HttpClientHandler { AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate })
{
BaseAddress = waitingParams.MasterServers.First().GetUri()
};
var masterServer = new MasterServerTMT(httpClient);
// You can repeat this exact setup for XB1 and PS4 as well if you want to work with those platforms, with something like Dictionary<Platform, MasterServerTMT> ...
or with DI, using an injected HttpClient
(not viable for multiple platforms):
using ManiaAPI.XmlRpc;
// Register the services
builder.Services.AddScoped<InitServerTMT>();
builder.Services.AddScoped<MasterServerTMT>();
builder.Services.AddHttpClient<InitServerTMT>(client => client.BaseAddress = new Uri(InitServerTMT.GetDefaultAddress(Platform.PC)));
builder.Services.AddHttpClient<MasterServerTMT>()
.ConfigurePrimaryHttpMessageHandler(() => new HttpClientHandler
{
AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate
});
// Do the setup
var initServer = provider.GetRequiredService<InitServerTMT>();
var waitingParams = await initServer.GetWaitingParamsAsync();
var masterServer = provider.GetRequiredService<MasterServerTMT>();
masterServer.Client.BaseAddress = waitingParams.MasterServers.First().GetUri();
For DI setup with multiple platforms, you can use keyed services:
using ManiaAPI.XmlRpc;
// Register the services
foreach (Platform platform in Enum.GetValues(typeof(Platform)))
{
builder.Services.AddKeyedScoped<InitServerTMT>(platform, (provider, key) => new InitServerTMT(provider.GetRequiredService<IHttpClientFactory>().CreateClient(platform.ToString())));
builder.Services.AddKeyedScoped<MasterServerTMT>(platform, (provider, key) => new MasterServerTMT(provider.GetRequiredService<IHttpClientFactory>().CreateClient(platform.ToString())));
builder.Services.AddHttpClient<InitServerTMT>(platform.ToString(), client => client.BaseAddress = new Uri(InitServerTMT.GetDefaultAddress(platform)));
builder.Services.AddHttpClient<MasterServerTMT>(platform.ToString())
.ConfigurePrimaryHttpMessageHandler(() => new HttpClientHandler
{
AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate
});
}
// Do the setup
foreach (Platform platform in Enum.GetValues(typeof(Platform)))
{
var initServer = provider.GetRequiredService<InitServerTMT>(platform);
var waitingParams = await initServer.GetWaitingParamsAsync();
var masterServer = provider.GetRequiredService<MasterServerTMT>(platform);
masterServer.Client.BaseAddress = waitingParams.MasterServers.First().GetUri();
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
-
net8.0
- MinimalXmlReader (>= 0.2.1)
- TmEssentials (>= 2.5.0)
-
net9.0
- MinimalXmlReader (>= 0.2.1)
- TmEssentials (>= 2.5.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|