npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

funcraft-api-v2

v2.0.1

Published

Une API pour récupérer les statistiques de FunCraft.net ! - modified by molo

Downloads

4

Readme

API Funcraft

Une API pour récupérer les statistiques de FunCraft.net ! - modified by molo (discord : molofdb)

Sommaire

Utilisation :

Autre informations :

Utilisation

L'API est documenté avec JSDoc. Elle est également compatible avec TypeScript.

Initialisation :

Installez le paquet avec NPM : npm install funcraft-api-v2 ou Yarn : yarn add funcraft-api-v2.

const FuncraftApi = require('funcraft-api-v2');

FuncraftApi.stats(period, game, username): Promise<StatsResponse>

Renvoie une promesse contenant les statistiques d'un mode de jeu et d'une période spécifique.

FuncraftApi.stats('toujours', 'shootcraft', 'jujoh').then(console.log).catch(console.error);
{
  code: 0,
  error: null,
  userId: '177',
  username: 'jujoh',
  month: 0,
  monthName: 'always',
  game: 'shootcraft',
  rank: 22,
  data: {
    points: 229557,
    gameCount: 5029,
    winCount: 4901,
    defeatCount: 128,
    gameTime: 15467,
    kills: 234252,
    deathCount: 30149
  },
  stats: {
    winrate: 97.455,
    kd: 7.77,
    ragequit: 38.489,
    killsPerGame: 46.58,
    deathsPerGame: 5.995,
    pointsPerGame: 45.647,
    killsPerMinute: 15.145,
    secondsPerKill: 3.962
  },
  skin: 'https://d31zb6ev5hmn3f.cloudfront.net/_u/avatar/head/jujoh/m2/f3cc7aa5869ddab02eafcfa37cc667209d34f3ca'
}

FuncraftApi.allStats(username): Promise<object>

Renvoie une promesse contenant les statistiques de tous les modes de jeux dans toutes les périodes disponibles.

FuncraftApi.allStats('jujoh').then(console.log).catch(console.error);
{
  code: 0,
  error: null,
  infos: {
    username: 'jujoh',
    skin: 'https://d31zb6ev5hmn3f.cloudfront.net/_u/avatar/head/jujoh/m2/f3cc7aa5869ddab02eafcfa37cc667209d34f3ca',
    userId: '177'
  },
  rush_retro: {
    always: null,
    march: null,
    february: null,
    january: null,
    december: null
  },
  rush_mdt: {
    always: {
      code: 0,
      error: null,
      username: 'jujoh',
      month: 0,
      monthName: 'always',
      game: 'rush_mdt',
      rank: 19605,
      data: [Object],
      stats: [Object],
      skin: 'https://d31zb6ev5hmn3f.cloudfront.net/_u/avatar/head/jujoh/m2/f3cc7aa5869ddab02eafcfa37cc667209d34f3ca',
      userId: '177'
    },
    march: null,
    february: null,
    january: null,
    december: null
  },
  ...
}

FuncraftApi.infos(username, fetchFriends? = true): Promise<InfosResponse>

Renvoie une promesse contenant les informations d'un joueur. fetchFriends est un booléen spéicifiant si une autre requête pour récupérer les amis doit être faite.

La valeur de ban peut être : NONE, TEMP ou DEF.

FuncraftApi.infos('jujoh').then(console.log);
{
  code: 0,
  error: null,
  grade: 'Shootcraft',
  username: 'jujoh',
  userId: '177',
  skin: 'https://d31zb6ev5hmn3f.cloudfront.net/_u/avatar/head/jujoh/m2/f3cc7aa5869ddab02eafcfa37cc667209d34f3ca',
  inscription: Date('2016-01-14T17:28:00.000Z'),
  lastConnection: Date('2021-03-29T21:06:00.000Z'),
  gloires: 1178354,
  gameCount: 14072,
  points: 596411,
  winCount: 12765,
  defeatCount: 1307,
  gameTime: 52529,
  kills: 276657,
  deathCount: 46711,
  ban: 'NONE',
  friends: [
    {
      nom: 'AcyD_',
      skin: 'https://d31zb6ev5hmn3f.cloudfront.net/_u/avatar/head/AcyD_/s/fa4652a59a640d3bde1aca803f6a27ed81107f94'
    },
    ...
  ]
}

FuncraftApi.friends(userId): Promise<object>

Renvoie une promesse contenant la liste des amis d'un joueur.

FuncraftApi.friends('177').then(console.log);
{
  code: 0,
  error: null,
  friends: [
    {
      nom: 'AcyD_',
      skin: 'https://d31zb6ev5hmn3f.cloudfront.net/_u/avatar/head/AcyD_/s/fa4652a59a640d3bde1aca803f6a27ed81107f94'
    },
    ...
  ]
}

FuncraftApi.head(username): Promise<string>

Renvoie une promesse contenant l'URL du skin de la tête d'un joueur.

FuncraftApi.head('jujoh').then(console.log);
'https://d31zb6ev5hmn3f.cloudfront.net/_u/avatar/head/jujoh/m2/f3cc7aa5869ddab02eafcfa37cc667209d34f3ca'

FuncraftApi.table(period, game): Promise<StatsResponse[]>

Renvoie une promesse contenant les stats du top 100 d'un jeu. Les skins ne sont disponible que pour les 3 premiers joueurs.

FuncraftApi.table('always', 'shootcraft').then(console.log);
[
  {
    code: 0,
    error: null,
    userId: '393176',
    username: 'CptnKILL',
    month: 0,
    monthName: 'always',
    game: 'shootcraft',
    rank: 1,
    data: {
      points: 1402275,
      gameCount: 13440,
      winCount: 9462,
      defeatCount: 3978,
      gameTime: 50883,
      kills: 640543,
      deathCount: 207115
    },
    stats: {
      winrate: 70.402,
      kd: 3.093,
      ragequit: 24.281,
      killsPerGame: 47.659,
      deathsPerGame: 15.41,
      pointsPerGame: 104.336,
      killsPerMinute: 12.589,
      secondsPerKill: 4.766
    },
    skin: 'https://d31zb6ev5hmn3f.cloudfront.net/_u/avatar/head/CptnKILL/s/cc9d545b3ccc7b9789cb902aed70e8bfe276317b'
  },
  ...
]

Autres informations

Codes d'erreur

Lorsqu'une requête échoue, la promesse retourn une erreur sous la forme d'un objet de la forme suivante :

{ code: 1, error: 'Specified game is incorrect.' }

Voici les différents codes d'erreur :

| Code | Description | |:----:| ------------------------------------- | | 0 | Aucune erreur | | 1 | Jeu incorrect | | 2 | Période incorrecte | | 3 | Joueur inconnu | | 4 | Aucune données pour cette période | | 5 | Erreur de connexion avec funcraft.net |

Périodes

Pour les statistiques global, vous pouvez utiliser :

  • toujours
  • always
  • 0

Pour les statistiques mensuels :

  • le nom du mois en français (janvier, février, fevrier, etc.)
  • le nom du mois en anglais (january, february, etc.)
  • le chiffre le représentant (1 = janvier, 2 = février, etc.)

Pour les tableaux du top 100, vous devez spécifier soit always, soit la période sous la forme YYYY-MM.

Note : vous ne pouvez pas récupérer via la méthode stats les statistiques datant de plus de 3 mois. Note 2 : les accents ne sont pas pris en compte.

Jeux

Les noms et alias des jeux sont :

| Noms | rush_retro | rush_mdt | hikabrain | skywars | octogone | shootcraft | infected | survival | blitz | pvpsmash | landrush | |-------|------------|----------|-----------|---------|----------|------------|----------|----------|-------|----------|----------| | Alias | | rush | hika | sky | mma | shoot | infecte | | | pvp | land |

Note : les accents ne sont pas pris en compte.

Outils

Vous pouvez récupérer les liste des noms et alias des jeux dans FuncraftApi.utils.data.

Les fonction FuncraftApi.utils.vGetPeriod et FuncraftApi.utils.vGetGame servent à déterminer si une période ou un mode de jeu est valide.

Se référer à la JSDoc ou voir le code source pour plus de détails.

Licence

Licence MIT

Copyright (c) 2021 gauthier-th