slothpixel / core

Open source Hypixel data platform
https://docs.slothpixel.me
MIT License
53 stars 26 forks source link

Add more player stat fields #20

Open builder-247 opened 6 years ago

builder-247 commented 6 years ago

processPlayerData handles modifying the player object from Hypixel API to the wanted format.

The game specific objects are created using the functions processStats object. You can assign default values by adding an equal sign in object parameters e.g. coins = 0 defaults the coins value to 0. The return statement return the stats object for the minigame. If (and when) some field's name needs to be changed, it can be achieved as described below:

return {
  kills: coins,
}

This would return the coins field with the name kills.

For an example adding kills and deaths fields to Warlords, processors/games/Battleground.js file should be modified in the following way:

module.exports = ({
  // This part destructs the values from the game object returned by the Hypixel API
  coins = 0,
  kills = 0,
  deaths = 0,
}) => ({
  coins,  
  kills,
  deaths,
});

Example (TKR stats)

Resources for stats to be added:

Progress:

builder-247 commented 5 years ago

Working on Warlords.

TheMysterys commented 3 years ago

More skywars stats added in #679