mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
feat: some full stats locale
This commit is contained in:
1 parent
9f4c8c9088
commit
5620b118f4
3 files changed
+64
-19
No files matched your search
@@ -61,7 +61,11 @@ async function render(
|
|||||||
)}
|
)}
|
||||||
{stats.battles > 0 && <TierWeights weights={tierWeights!} />}
|
{stats.battles > 0 && <TierWeights weights={tierWeights!} />}
|
||||||
{stats.battles > 0 && (
|
{stats.battles > 0 && (
|
||||||
<GenericAllStats stats={stats} supplementaryStats={supplementary} />
|
<GenericAllStats
|
||||||
|
stats={stats}
|
||||||
|
supplementaryStats={supplementary}
|
||||||
|
locale={locale}
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
</CommandWrapper>
|
</CommandWrapper>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
|
import { Locale } from 'discord.js';
|
||||||
import { AllStats, SupplementaryStats } from '../../core/blitz/getAccountInfo';
|
import { AllStats, SupplementaryStats } from '../../core/blitz/getAccountInfo';
|
||||||
|
import { translator } from '../../core/localization/translator';
|
||||||
import isNumber from '../../core/math/isNumber';
|
import isNumber from '../../core/math/isNumber';
|
||||||
import getWN8Percentile from '../../core/statistics/getWN8Percentile';
|
import getWN8Percentile from '../../core/statistics/getWN8Percentile';
|
||||||
import { Card } from './components/Card';
|
import { Card } from './components/Card';
|
||||||
@@ -8,12 +10,15 @@ import { Row } from './components/Row';
|
|||||||
export interface GenericAllStatsProps {
|
export interface GenericAllStatsProps {
|
||||||
stats: AllStats;
|
stats: AllStats;
|
||||||
supplementaryStats?: SupplementaryStats;
|
supplementaryStats?: SupplementaryStats;
|
||||||
|
locale: Locale;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function GenericAllStats({
|
export default function GenericAllStats({
|
||||||
stats,
|
stats,
|
||||||
supplementaryStats,
|
supplementaryStats,
|
||||||
|
locale,
|
||||||
}: GenericAllStatsProps) {
|
}: GenericAllStatsProps) {
|
||||||
|
const { t } = translator(locale);
|
||||||
const damageRatio = stats.damage_dealt / stats.damage_received;
|
const damageRatio = stats.damage_dealt / stats.damage_received;
|
||||||
const killsToDeathRatio =
|
const killsToDeathRatio =
|
||||||
stats.frags / (stats.battles - stats.survived_battles);
|
stats.frags / (stats.battles - stats.survived_battles);
|
||||||
@@ -22,27 +27,27 @@ export default function GenericAllStats({
|
|||||||
<Root>
|
<Root>
|
||||||
<Row>
|
<Row>
|
||||||
<Card
|
<Card
|
||||||
title="Games"
|
title={t`bot.commands.full_stats.body.cards.games`}
|
||||||
items={[
|
items={[
|
||||||
{
|
{
|
||||||
label: 'Winrate',
|
label: t`bot.commands.full_stats.body.cards.games.winrate`,
|
||||||
value: `${(100 * (stats.wins / stats.battles)).toFixed(2)}%`,
|
value: `${(100 * (stats.wins / stats.battles)).toFixed(2)}%`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Battles',
|
label: t`bot.commands.full_stats.body.cards.games.battles`,
|
||||||
value: stats.battles,
|
value: stats.battles,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Wins / Losses',
|
label: t`bot.commands.full_stats.body.cards.games.wins_losses`,
|
||||||
value: `${stats.wins} / ${stats.losses}`,
|
value: `${stats.wins} / ${stats.losses}`,
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
<Card
|
<Card
|
||||||
title="Efficiency"
|
title={t`bot.commands.full_stats.body.cards.efficiency`}
|
||||||
items={[
|
items={[
|
||||||
{
|
{
|
||||||
label: 'WN8',
|
label: t`bot.commands.full_stats.body.cards.efficiency.wn8`,
|
||||||
value:
|
value:
|
||||||
supplementaryStats && isNumber(supplementaryStats.WN8)
|
supplementaryStats && isNumber(supplementaryStats.WN8)
|
||||||
? supplementaryStats.WN8!.toFixed(0)
|
? supplementaryStats.WN8!.toFixed(0)
|
||||||
@@ -52,14 +57,14 @@ export default function GenericAllStats({
|
|||||||
: undefined,
|
: undefined,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Survival',
|
label: t`bot.commands.full_stats.body.cards.efficiency.survival`,
|
||||||
value: `${(
|
value: `${(
|
||||||
100 *
|
100 *
|
||||||
(stats.survived_battles / stats.battles)
|
(stats.survived_battles / stats.battles)
|
||||||
).toFixed(2)}%`,
|
).toFixed(2)}%`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Accuracy',
|
label: t`bot.commands.full_stats.body.cards.efficiency.accuracy`,
|
||||||
value: `${((stats.hits / stats.shots) * 100).toFixed(2)}%`,
|
value: `${((stats.hits / stats.shots) * 100).toFixed(2)}%`,
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
@@ -67,14 +72,14 @@ export default function GenericAllStats({
|
|||||||
</Row>
|
</Row>
|
||||||
<Row>
|
<Row>
|
||||||
<Card
|
<Card
|
||||||
title="Lethality"
|
title={t`bot.commands.full_stats.body.cards.lethality`}
|
||||||
items={[
|
items={[
|
||||||
{
|
{
|
||||||
label: 'Average damage',
|
label: t`bot.commands.full_stats.body.cards.lethality.average_damage`,
|
||||||
value: (stats.damage_dealt / stats.battles).toFixed(0),
|
value: (stats.damage_dealt / stats.battles).toFixed(0),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Damage per tier',
|
label: t`bot.commands.full_stats.body.cards.lethality.damage_per_tier`,
|
||||||
value: supplementaryStats?.tier
|
value: supplementaryStats?.tier
|
||||||
? (
|
? (
|
||||||
stats.damage_dealt /
|
stats.damage_dealt /
|
||||||
@@ -84,32 +89,32 @@ export default function GenericAllStats({
|
|||||||
: undefined,
|
: undefined,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Damage ratio',
|
label: t`bot.commands.full_stats.body.cards.lethality.damage_ratio`,
|
||||||
value: isFinite(damageRatio) ? damageRatio.toFixed(2) : undefined,
|
value: isFinite(damageRatio) ? damageRatio.toFixed(2) : undefined,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Average kills',
|
label: t`bot.commands.full_stats.body.cards.lethality.average_kills`,
|
||||||
value: (stats.frags / stats.battles).toFixed(0),
|
value: (stats.frags / stats.battles).toFixed(0),
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
<Card
|
<Card
|
||||||
title="Miscellaneous"
|
title={t`bot.commands.full_stats.body.cards.miscellaneous`}
|
||||||
items={[
|
items={[
|
||||||
{
|
{
|
||||||
label: 'Average tier',
|
label: t`bot.commands.full_stats.body.cards.miscellaneous.average_tier`,
|
||||||
value: supplementaryStats?.tier?.toFixed(2),
|
value: supplementaryStats?.tier?.toFixed(2),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Average spots',
|
label: t`bot.commands.full_stats.body.cards.miscellaneous.average_spots`,
|
||||||
value: (stats.spotted / stats.battles).toFixed(2),
|
value: (stats.spotted / stats.battles).toFixed(2),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Average XP',
|
label: t`bot.commands.full_stats.body.cards.miscellaneous.average_xp`,
|
||||||
value: (stats.xp / stats.battles).toFixed(0),
|
value: (stats.xp / stats.battles).toFixed(0),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Kills to death ratio',
|
label: t`bot.commands.full_stats.body.cards.miscellaneous.kills_to_death_ratio`,
|
||||||
value: isFinite(killsToDeathRatio)
|
value: isFinite(killsToDeathRatio)
|
||||||
? killsToDeathRatio.toFixed(2)
|
? killsToDeathRatio.toFixed(2)
|
||||||
: undefined,
|
: undefined,
|
||||||
|
|||||||
@@ -198,6 +198,42 @@
|
|||||||
"subtitle": "Inactive for %s+ days",
|
"subtitle": "Inactive for %s+ days",
|
||||||
"listing": "%s days"
|
"listing": "%s days"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"full_stats": {
|
||||||
|
"$": "full-stats",
|
||||||
|
"description": "Full in-game statistics",
|
||||||
|
|
||||||
|
"body": {
|
||||||
|
"cards": {
|
||||||
|
"games": {
|
||||||
|
"$": "Games",
|
||||||
|
"winrate": "Winrate",
|
||||||
|
"battles": "Battles",
|
||||||
|
"wins_losses": "Wins / losses"
|
||||||
|
},
|
||||||
|
"efficiency": {
|
||||||
|
"$": "Efficiency",
|
||||||
|
"wn8": "WN8",
|
||||||
|
"survival": "Survival",
|
||||||
|
"accuracy": "Accuracy"
|
||||||
|
},
|
||||||
|
"lethality": {
|
||||||
|
"$": "Lethality",
|
||||||
|
"average_damage": "Average damage",
|
||||||
|
"damage_per_tier": "Damage per tier",
|
||||||
|
"damage_ratio": "Damage ratio",
|
||||||
|
"average_kills": "Average kills"
|
||||||
|
},
|
||||||
|
"miscellaneous": {
|
||||||
|
"$": "Miscellaneous",
|
||||||
|
"average_tier": "Average tier",
|
||||||
|
"average_spots": "Average spots",
|
||||||
|
"average_xp": "Average XP",
|
||||||
|
"kills_to_death_ratio": "Kills to death ratio"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in new issue
Block a user