mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
dynamically import client api
This commit is contained in:
1 parent
8a3e57637d
commit
b060e65af5
5 files changed
+82
-111
No files matched your search
@@ -1,22 +0,0 @@
|
||||
import { fetchTankDefinitions } from '../blitzkit';
|
||||
import type { BlitzStats } from './compositeStats/constants';
|
||||
|
||||
export async function getTierWeights(
|
||||
stats: Record<number, BlitzStats>,
|
||||
order: number[] = Object.keys(stats).map(parseInt),
|
||||
) {
|
||||
const tankDefinitions = await fetchTankDefinitions();
|
||||
const tierWeights: TierWeightsRecord = {};
|
||||
|
||||
order.forEach((id) => {
|
||||
const entry = tankDefinitions.tanks[id];
|
||||
|
||||
if (!entry) return;
|
||||
if (!tierWeights[entry.tier]) tierWeights[entry.tier] = 0;
|
||||
|
||||
tierWeights[entry.tier]! += stats[id].battles;
|
||||
});
|
||||
|
||||
return tierWeights;
|
||||
}
|
||||
export type TierWeightsRecord = Partial<Record<number, number>>;
|
||||
@@ -1,9 +1,8 @@
|
||||
export * from './calculateWN8';
|
||||
export * from './compositeStats';
|
||||
export * from './deltaBkrlBlitzStats';
|
||||
export * from './deltaTankStats';
|
||||
export * from './getBkniPercentile';
|
||||
export * from './getTierWeights';
|
||||
export * from './getWN8Percentile';
|
||||
export * from './percentiles';
|
||||
export * from './sumAllStats';
|
||||
export * from "./calculateWN8";
|
||||
export * from "./compositeStats";
|
||||
export * from "./deltaBkrlBlitzStats";
|
||||
export * from "./deltaTankStats";
|
||||
export * from "./getBkniPercentile";
|
||||
export * from "./getWN8Percentile";
|
||||
export * from "./percentiles";
|
||||
export * from "./sumAllStats";
|
||||
Reference in new issue
Block a user