Giter Club home page Giter Club logo

saberquest-backend's Introduction

This branch is currently stale, the rewrite is being done on the dev/knex/pgsql branch

Why are you rewriting the project?!

In short, the web server was basically broken from release and didn't work properly half the time, and as such, this version of the web server is largely unsupported and anything gained/done on the current version will be lost when the rewrite releases.

Are you a developer? We welcome contributions!

While yes, we're working on this largely internally, all of our code is open source under Apache-2.0 and welcomes contributions to make development go faster, making you, the end-user have the product faster. All questions regarding the project should be asked in the developer channel in the discord


API Endpoints

Use these API endpoints if you want to get data from SaberQuest.

/api/current-deals - Returns a JSON array of all the items that are currently being sold in the shop.

{
    "message": "string",
    "deals": object[]
}

// Example of the deals object

{
    "id": "string",
    "price": int,
    "rarity": "string",
    "value": int
}

/api/daily-challenges - Returns a JSON array of the current challenges.

{
    "message": "string",
    "type": "string",
    "task": "string",
    "dailyChallenges": object[]
}

// Daily Challenges object is different depending on the type of challenge.

/api/items - Returns a JSON array of all the items available on SaberQuest. The objects contain the item ID, full name and where their image is being stored.

// Returns all of the objects in one response, example of one object below.

{
    "id": "string",
    "image": "string",
    "name": "string"
}

/api/top-players - Returns a JSON array of all the top players. Must include a page query. Example: /api/top-players?page=1

{
    "message": "string",
    "topPlayers": object[]
}

// Example of a topPLayers object

{
    "_id": "string",
    "userId": "string",
    "r": int, // Rank
    "cp": int, // Challenges completed
    "value": int
}

/api/user - Returns a JSON object of the requested user. Needed parameter is the user ID. Example: /api/user/76561198343533017

{
    "message": "string",
    "user": "string",
    "preference": "string",
    "rank": int,
    "qp": int, // Quest points
    "challengesCompleted": int,
    "collectibles": object[],
    "value": int,
    "diff": int, // Currently selected difficulty, 4 = none selected
    "completed": bool // If challenge is completed or not
}

// Example of collectibles object

{
    "name": "string",
    "amount": int
}

Websocket

SaberQuest also has a websocket that you can listen to if you want to get all the latest updates.

The websocket runs on port 8080, you can listen to it at ws://saberquest.xyz:8080.

Each update has it's own specific event, so make sure to listen to the events that you need.

Events

userUpdate - Emitted each time a user gets a new collectible or gets one taken away through crafting.

{
    "userId": "string",
    "type": "string", // (add/remove)
    "collectibles": string[],
    "value": int
}

challengeCompleted - Emitted each time a user completes a challenge.

{
    "userId": "string",
    "difficulty": "string",
    "rewards": string[]
}

itemBought - Emitted each time a user buys a new collectible from the shop.

{
    "userId": "string",
    "item": "string",
    "qp": int,
    "value": int
}

newUser - Emitted each time a new user gets added to SaberQuest.

{
    "userId": "string",
    "link": "string"
}

gamble - Emitted each time a user gambles and gets something.

{
    "userId": "string",
    "itemWon": "string",
    "rarity": "string"
}

saberquest-backend's People

Contributors

stormpacer avatar raineio avatar dependabot[bot] 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.