Skip to content

up2moon/MapleStory.NET

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

80 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MapleStory.NET

English | 한국어

NuGet

MapleStory.NET is a wrapper to simplify the use of Nexon's MapleStory Open API, which offers functionality for retrieving data, such as character details, cube usage results, and various rankings.

Installation

dotnet add package MapleStory.NET

How to use

API Key

Register your application on the Nexon Open API Center to generate an API key.

Example code

using System;
using System.Linq;
using System.Net.Http;
using MapleStory.NET;

const string ApiKey = "Your_api_key_here";
using var httpClient = new HttpClient();

var client = new MapleStoryClient(httpClient, ApiKey);
var dateYesterday = DateOnly.FromDateTime(DateTime.Now).AddDays(-1);

var overallRankingResult = await client.RankingApi.GetOverallRankingAsync(dateYesterday); //fetch overall ranking

if (overallRankingResult.Data is null)
{
    Console.WriteLine(overallRankingResult.Error);
    return;
}

var top10 = overallRankingResult.Data.Ranking?.Take(10); //get top 10 characters
var firstPlace = top10?.FirstOrDefault(); //get first place

if (firstPlace?.CharacterName is null)
{
    Console.WriteLine("Unable to get first place.");
    return;
}

var characterResult = await client.CharacterApi.GetAsync(firstPlace.CharacterName); //fetch character identifier(ocid)

if (characterResult.Data is null)
{
    Console.WriteLine(characterResult.Error);
    return;
}

var ocid = characterResult.Data.Ocid;

if (ocid is null)
{
    Console.WriteLine("Unable to get ocid.");
    return;
}

var characterBasicResult = await client.CharacterApi.GetBasicAsync(ocid); //fetch basic data

if (characterBasicResult.Data is null)
{
    Console.WriteLine(characterBasicResult.Error);
    return;
}

var characterBasic = characterBasicResult.Data;
Console.WriteLine(characterBasic.ToJsonString());

About

.NET API wrapper for Nexon's MapleStory Open API

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages