mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-22 03:07:04 +02:00
feat: updated full stats
This commit is contained in:
1 parent
d2668974f7
commit
d062a0da1b
7 files changed
+99
-246
No files matched your search
@@ -75,5 +75,5 @@ export async function filterStats(
|
||||
) / battlesOfTanksWithTankopediaEntry,
|
||||
};
|
||||
|
||||
return { stats, supplementary };
|
||||
return { stats, supplementary, filteredOrder };
|
||||
}
|
||||
@@ -9,7 +9,7 @@ export interface TankopediaEntry {
|
||||
nation: string;
|
||||
is_premium: boolean;
|
||||
is_collectible: boolean;
|
||||
tier: number;
|
||||
tier: Tier;
|
||||
cost: { price_credit: number; price_gold: number };
|
||||
images: { preview: string; normal: string };
|
||||
tank_id: number;
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
import { TierWeightsRecord } from '../../components/TierWeights';
|
||||
import { AllStats } from '../../types/accountInfo';
|
||||
import { tankopedia } from '../blitz/tankopedia';
|
||||
|
||||
export async function getTierWeights(
|
||||
stats: Record<number, AllStats>,
|
||||
order: number[] = Object.keys(stats).map(parseInt),
|
||||
) {
|
||||
const awaitedTankopedia = await tankopedia;
|
||||
const tierWeights: TierWeightsRecord = {};
|
||||
|
||||
order.map((id) => {
|
||||
const entry = awaitedTankopedia[id];
|
||||
|
||||
if (!entry) return;
|
||||
if (!tierWeights[entry.tier]) tierWeights[entry.tier] = 0;
|
||||
|
||||
tierWeights[entry.tier]! += stats[id].battles;
|
||||
});
|
||||
|
||||
return tierWeights;
|
||||
}
|
||||
Reference in new issue
Block a user