Skip to content

Commit

Permalink
add new method to compute global stats with tribes
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastientromp committed Sep 10, 2021
1 parent 1c15bf9 commit 3052698
Show file tree
Hide file tree
Showing 7 changed files with 440 additions and 8 deletions.
5 changes: 2 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@firestone-hs/bgs-global-stats",
"version": "1.0.11",
"version": "1.0.13",
"description": "",
"scripts": {
"lint": "eslint --color --fix --ext .ts .",
Expand All @@ -18,8 +18,8 @@
"author": "",
"license": "MIT",
"private": false,
"main": "dist/build-battlegrounds-hero-stats.js",
"types": "dist/build-battlegrounds-hero-stats.d.ts",
"main": "dist/bgs-global-stats.js",
"types": "dist/bgs-global-stats.d.ts",
"files": [
"dist/**/*"
],
Expand Down
32 changes: 32 additions & 0 deletions src/bgs-global-stats.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Race } from '@firestone-hs/reference-data';

export class BgsGlobalStats {
lastUpdateDate: string;
heroStats: readonly BgsGlobalHeroStat[];
Expand All @@ -17,3 +19,33 @@ export class BgsGlobalHeroStat {
}

export type BgsHeroTier = 'S' | 'A' | 'B' | 'C' | 'D';

// ===============================
// New stats
// =================================
export class BgsGlobalStats2 {
readonly lastUpdateDate: string;
readonly mmrPercentiles: readonly MmrPercentile[];
readonly heroStats: readonly BgsGlobalHeroStat2[];
}

export class BgsGlobalHeroStat2 {
// The filters
readonly date: 'all-time' | 'past-three' | 'past-seven' | 'last-patch';
readonly mmrPercentile: 100 | 50 | 25 | 10 | 1;
readonly cardId: string;
readonly tribes: readonly Race[];

// The values
readonly totalMatches: number;
readonly placementDistribution: readonly { rank: number; totalMatches: number }[];
// To get the actual winrate, you will have to divide the totalWinrate by the dataPoints
readonly combatWinrate: readonly { turn: number; dataPoints: number; totalWinrate: number }[];
// Same
readonly warbandStats: readonly { turn: number; dataPoints: number; totalStats: number }[];
}

export interface MmrPercentile {
readonly mmr: number;
readonly percentile: 100 | 50 | 25 | 10 | 1;
}
Loading

0 comments on commit 3052698

Please sign in to comment.