Skip to main content

Calculate Score

Calculate tournament score based on raw game points and NFT drop counts.

Endpoint​

POST /api/v2/tournament/{id}/calculateScore

Authentication​

This endpoint is public and does not require authentication.

Description​

This endpoint calculates a tournament score based on raw game points and owned NFT drops. The system applies multipliers based on the player's NFT holdings to determine the final tournament score.

Path Parameters​

ParameterTypeRequiredDescription
idstringYesUnique identifier for the tournament

Request Body​

FieldTypeRequiredDescription
rawGamePointnumberYesRaw game points before multipliers
dropsarrayYesArray of owned NFT drop count objects

Drop Count Object Fields​

FieldTypeRequiredDescription
dropIdstringYesUnique identifier for the NFT drop
countsnumber[]YesArray of counts for different rarities

Request Example​

{
"rawGamePoint": 1500,
"drops": [
{
"dropId": "drop-123",
"counts": [5, 2, 1]
},
{
"dropId": "drop-456",
"counts": [10, 0, 0]
}
]
}

Response​

Success Response (200)​

{
"multiplier": 2.5,
"score": 3750
}

Error Response (404)​

{
"message": "Tournament not found",
"status": 404
}

Error Response (400)​

{
"message": "Invalid request payload",
"status": 400
}

Response Fields​

FieldTypeDescription
multipliernumberApplied multiplier based on NFT holdings
scorenumberFinal calculated score (rawGamePoint * multiplier)

Usage Example​

const response = await fetch("https://api.intraverse.io/api/v2/tournament/tournament-123/calculateScore", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
rawGamePoint: 1500,
drops: [
{
dropId: "drop-123",
counts: [5, 2, 1], // 5 common, 2 rare, 1 legendary
},
{
dropId: "drop-456",
counts: [10, 0, 0], // 10 common, 0 rare, 0 legendary
},
],
}),
});

const result = await response.json();

console.log(`Applied multiplier: ${result.multiplier}`);
console.log(`Raw game points: 1500`);
console.log(`Final tournament score: ${result.score}`);

// Example calculation: 1500 * 2.5 = 3750

Request Examples​

Player with Multiple Drops​

{
"rawGamePoint": 2000,
"drops": [
{
"dropId": "legendary-weapons",
"counts": [2, 1, 1] // 2 common, 1 rare, 1 legendary
},
{
"dropId": "character-skins",
"counts": [5, 0, 0] // 5 common skins only
},
{
"dropId": "power-ups",
"counts": [0, 3, 2] // 0 common, 3 rare, 2 legendary
}
]
}

Player with No NFTs​

{
"rawGamePoint": 1000,
"drops": []
}

Player with Single Drop Type​

{
"rawGamePoint": 1500,
"drops": [
{
"dropId": "starter-pack",
"counts": [10] // 10 NFTs from a single-rarity drop
}
]
}

Score Calculation​

The tournament score calculation works as follows:

  1. Raw Game Points: The base points earned from gameplay
  2. NFT Multipliers: Each owned NFT drop contributes to a multiplier based on:
    • Number of NFTs owned from each drop
    • Rarity of the owned NFTs (represented by the counts array)
    • Tournament-specific multiplier rules
  3. Final Score: rawGamePoint × multiplier = score

How Drop Counts Work​

The counts array represents the number of NFTs owned for each rarity level:

  • counts[0]: Number of common NFTs owned
  • counts[1]: Number of rare NFTs owned
  • counts[2]: Number of legendary NFTs owned
  • etc. (based on the drop's rarity structure)

Error Handling​

ErrorDescriptionSolution
Tournament not foundTournament ID doesn't existCheck tournament ID
Invalid requestRequest payload is malformedVerify request body structure
Invalid rawGamePointGame points are negative/NaNUse valid positive numbers
Invalid drop countsCounts array contains NaNEnsure all counts are numbers

Next Steps​