ArtifactsMMO.NET.DependencyInjection.Extensions 3.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package ArtifactsMMO.NET.DependencyInjection.Extensions --version 3.0.2                
NuGet\Install-Package ArtifactsMMO.NET.DependencyInjection.Extensions -Version 3.0.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ArtifactsMMO.NET.DependencyInjection.Extensions" Version="3.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ArtifactsMMO.NET.DependencyInjection.Extensions --version 3.0.2                
#r "nuget: ArtifactsMMO.NET.DependencyInjection.Extensions, 3.0.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ArtifactsMMO.NET.DependencyInjection.Extensions as a Cake Addin
#addin nuget:?package=ArtifactsMMO.NET.DependencyInjection.Extensions&version=3.0.2

// Install ArtifactsMMO.NET.DependencyInjection.Extensions as a Cake Tool
#tool nuget:?package=ArtifactsMMO.NET.DependencyInjection.Extensions&version=3.0.2                

ArtifactsMMO.NET

.NET client for the Artifacts MMO - https://artifactsmmo.com/

Version: 3.0

Artifacts is an API-based MMO game where you can manage up to 5 characters to explore, fight, gather resources, craft items, and much more.

Overview

This fully implemented and well documented .NET client provides a convenient way to interact with the Artifacts API.

Error Handling

The client includes built-in error handling for various scenarios, such as:

  • Invalid requests
  • Error API responses realted to actions in game

For detailed error information, check the ApiError object returned in case of unexpected exceptions.

Installation

Install ArtifactsMMO.NET DI Extensions that includes ArtifactsMMO.NET

NuGet

dotnet add package ArtifactsMMO.NET.DependencyInjection.Extensions

Alternatively, you can install ArtifactsMMO.NET separately:

NuGet

dotnet add package ArtifactsMMO.NET

Usage

Core client:

// Using ArtifactsMMO.NET.DependencyInjection.Extensions
var serviceProvider = new ServiceCollection()
.AddArtifactsMMOClient("<your token>")
.BuildServiceProvider();

// Resolved as singleton instance
var client = serviceProvider.GetRequiredService<IArtifactsMMOClient>();
// For non-DI
// IArtifactsMMOClient client = new ArtifactsMMOClient(new HttpClient(), "<your token>");

var serverStatus = await client.GetStatusAsync();

// Get your character
var (character, error) = await client.Characters.GetAsync("<your character name>");

// Check if there any error
if (error == null)
{
    // Move your character
    var (characterMoveData, moveError) = await client.MyCharacters.MoveAsync(character.Name, new MoveRequest(1, 1));

    // Check for error
    if (moveError == null)
    {
        var (fightData, fightError) = await client.MyCharacters.FightAsync(characterMoveData.Character.Name);
    }
    else
    {
        // Handle error
        switch (moveError.Value)
        {
            // Character is in cooldown
            case MoveError.CharacterInCooldown:
                // Wait for cooldown expiration
                await Task.Delay((characterMoveData.Cooldown.StartedAt - characterMoveData.Cooldown.Expiration).Microseconds);
                // Repeat the action
                await client.MyCharacters.MoveAsync(character.Name, new MoveRequest(1, 1));
                break;

        }
    }
}
else
{
    if (error == GetCharacterError.CharacterNotFound)
    {
        // Create new character
        await client.Characters.CreateAsync(new CreateCharacterRequest("<your desired character name>", SkinCode.Men3));
    }
}

Assets client:

var serviceProvider = new ServiceCollection()
.AddArtifactsMMOAssetsClient()
.BuildServiceProvider();

var assetsClient = serviceProvider.GetRequiredService<IArtifactsMMOAssetsClient>();

Stream assetStream = await assetsClient.GetAssetAsync(AssetType.Characters, "men3");

// Handle assets stream

Accounts and Token clients:

var serviceProvider = new ServiceCollection()
.AddArtifactsMMOAccountsClient()
.AddArtifactsMMOTokenClient()
.BuildServiceProvider();
            
var accountsClient = serviceProvider.GetRequiredService<IArtifactsMMOAccountsClient>();
var tokenClient = serviceProvider.GetRequiredService<IArtifactsMMOTokenClient>();

var username = "<your username>";
var password = "<your password>";
var email = "<your email>";

await accountsClient.CreateAccountAsync(new CreateAccountRequest(username, password, email));
var token = tokenClient.GenerateTokenAsync(username, password);

Contributing

Contributions are welcome! If you encounter any issues or want to add features, feel free to open an issue or submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for more details.

Support

For issues, questions, or feature requests, please open an issue on GitHub.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.