GithubHelp home page GithubHelp logo

robertmccoy / overwatch.net.core Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sirdoombox/overwatch.net

1.0 3.0 0.0 1.28 MB

Unofficial Overwatch Statistics API for .NET Core

License: MIT License

C# 100.00%

overwatch.net.core's Introduction

Overwatch.Net.Core

An unofficial player stats API for the Blizzard game "Overwatch".

What is it?

A simple wrapper that grabs player stats from a users PlayOverwatch.com profile and parses it to be used however you like. It's written entirely in C# using AngleSharp to parse the data from the page. The only limiting factor is the speed at which the PlayOverwatch profile can be loaded.

Current Features

  • Supports PC, Xbox 1 and Playstation 4 players.
  • Entirely async operation
  • Serializable - No complex data.
  • Region detection - Easily find the correct region for a player.
  • Platform detection - Detect which platform a player might play on.

Dependencies

  • AngleSharp - Used to parse the data from the PlayOverwatch page as no other data source is available from Blizzard.

Usage

After you've added the necessary references to your project, using the library is incredibly simple.

The below code will create a new Overwatch player with the given Battletag, it will then detect the players region and update the users stats entirely asynchronously.

OverwatchPlayer player = new OverwatchPlayer("SirDoombox#2603");
await player.DetectPlatform();
await player.DetectRegionPC();
await player.UpdateStats();
Double timePlayedInSeconds = player.CasualStats.GetHero("AllHeroes").GetCategory("Game").GetStat("Time Played").Value;

You can cut down on some of the requests you need to make (and the time that those requests take up) by specifying the region at creation (if known). This snippet also uses .GetAwaiter().GetResult() to make the method run in a synchronous fashion.

OverwatchPlayer player = new OverwatchPlayer("SirDoombox#2603", Platform.pc, Region.eu);
player.UpdateStats().GetAwaiter().GetResult();
StatCategory statCategory = player.CasualStats.GetHero("Junkrat").GetCategory("Hero Specific");

There are also some helper methods available for use to simplify some common operations

bool validTag = OverwatchAPIHelpers.IsValidBattletag("SomePlayer#1234"); // Returns true.
string profileUrl = OverwatchAPIHelpers.ProfileUrl("SomePlayer#1234", Region.eu); // Returns a PlayOverwatch profile URL.

Please see the "OverwatchDotNetTestbed" project if you'd like to see an implementation.

Contact

If you wish to contact the original creator about contributing to the project, or have any questions / suggestions please feel free to come find me on the C# discord server. - @Doombox#0661

If you wish to contact me you may do so at Battletag DirtyBert#11920.

Please report any issues or bugs that you may find at your earliest convenience so I can get them fixed ASAP.

overwatch.net.core's People

Contributors

robertmccoy avatar scottrfrost avatar sirdoombox avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.