mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 03:59:50 +02:00
feat: core chunk 2
This commit is contained in:
1 parent
e96538bae0
commit
862445259e
17 files changed
+33
-71
No files matched your search
@@ -3,12 +3,12 @@ import {
|
|||||||
SlashCommandSubcommandGroupBuilder,
|
SlashCommandSubcommandGroupBuilder,
|
||||||
} from 'discord.js';
|
} from 'discord.js';
|
||||||
import { getAccountInfo } from '../_core/blitz/getAccountInfo';
|
import { getAccountInfo } from '../_core/blitz/getAccountInfo';
|
||||||
|
import { getClanAccountInfo } from '../_core/blitz/getClanAccountInfo';
|
||||||
import * as Graph from '../components/Graph';
|
import * as Graph from '../components/Graph';
|
||||||
import NoData, { NoDataType } from '../components/NoData';
|
import NoData, { NoDataType } from '../components/NoData';
|
||||||
import TitleBar from '../components/TitleBar';
|
import TitleBar from '../components/TitleBar';
|
||||||
import Wrapper from '../components/Wrapper';
|
import Wrapper from '../components/Wrapper';
|
||||||
import { getClanLogo } from '../core/blitz/getClanLogo';
|
import { getClanLogo } from '../core/blitz/getClanLogo';
|
||||||
import { getPlayerClanInfo } from '../core/blitz/getPlayerClanInfo';
|
|
||||||
import resolveTankId from '../core/blitz/resolveTankId';
|
import resolveTankId from '../core/blitz/resolveTankId';
|
||||||
import { getBlitzStarsLinkButton } from '../core/blitzstars/getBlitzStarsLinkButton';
|
import { getBlitzStarsLinkButton } from '../core/blitzstars/getBlitzStarsLinkButton';
|
||||||
import getPlayerHistories from '../core/blitzstars/getPlayerHistories';
|
import getPlayerHistories from '../core/blitzstars/getPlayerHistories';
|
||||||
@@ -40,7 +40,7 @@ async function render(
|
|||||||
tankId: number | null,
|
tankId: number | null,
|
||||||
) {
|
) {
|
||||||
const accountInfo = await getAccountInfo(region, id);
|
const accountInfo = await getAccountInfo(region, id);
|
||||||
const clan = (await getPlayerClanInfo(region, id))[id]?.clan;
|
const clan = (await getClanAccountInfo(region, id))?.clan;
|
||||||
const logo = clan ? getClanLogo(clan.emblem_set_id) : undefined;
|
const logo = clan ? getClanLogo(clan.emblem_set_id) : undefined;
|
||||||
const histories = await (type === 'player'
|
const histories = await (type === 'player'
|
||||||
? getPlayerHistories(region, id, {
|
? getPlayerHistories(region, id, {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { SlashCommandBuilder } from 'discord.js';
|
import { SlashCommandBuilder } from 'discord.js';
|
||||||
import { getAccountInfo } from '../_core/blitz/getAccountInfo';
|
import { getAccountInfo } from '../_core/blitz/getAccountInfo';
|
||||||
|
import { getClanAccountInfo } from '../_core/blitz/getClanAccountInfo';
|
||||||
import { StatFilters, filterStats } from '../_core/statistics/filterStats';
|
import { StatFilters, filterStats } from '../_core/statistics/filterStats';
|
||||||
import GenericAllStats from '../components/GenericAllStats';
|
import GenericAllStats from '../components/GenericAllStats';
|
||||||
import NoData, { NoDataType } from '../components/NoData';
|
import NoData, { NoDataType } from '../components/NoData';
|
||||||
@@ -7,7 +8,6 @@ import TierWeights from '../components/TierWeights';
|
|||||||
import TitleBar from '../components/TitleBar';
|
import TitleBar from '../components/TitleBar';
|
||||||
import Wrapper from '../components/Wrapper';
|
import Wrapper from '../components/Wrapper';
|
||||||
import { getClanLogo } from '../core/blitz/getClanLogo';
|
import { getClanLogo } from '../core/blitz/getClanLogo';
|
||||||
import { getPlayerClanInfo } from '../core/blitz/getPlayerClanInfo';
|
|
||||||
import { filtersToDescription } from '../core/blitzkrieg/filtersToDescription';
|
import { filtersToDescription } from '../core/blitzkrieg/filtersToDescription';
|
||||||
import { getTierWeights } from '../core/blitzkrieg/getTierWeights';
|
import { getTierWeights } from '../core/blitzkrieg/getTierWeights';
|
||||||
import { getBlitzStarsLinkButton } from '../core/blitzstars/getBlitzStarsLinkButton';
|
import { getBlitzStarsLinkButton } from '../core/blitzstars/getBlitzStarsLinkButton';
|
||||||
@@ -37,7 +37,7 @@ async function render(
|
|||||||
filters: StatFilters,
|
filters: StatFilters,
|
||||||
) {
|
) {
|
||||||
const { nickname } = await getAccountInfo(region, id);
|
const { nickname } = await getAccountInfo(region, id);
|
||||||
const clan = (await getPlayerClanInfo(region, id))[id]?.clan;
|
const clan = (await getClanAccountInfo(region, id))?.clan;
|
||||||
const clanImage = clan ? getClanLogo(clan.emblem_set_id) : undefined;
|
const clanImage = clan ? getClanLogo(clan.emblem_set_id) : undefined;
|
||||||
const diffedTankStats = await getDiffedTankStats(region, id, start, end);
|
const diffedTankStats = await getDiffedTankStats(region, id, start, end);
|
||||||
const { stats, supplementary, filteredOrder } = await filterStats(
|
const { stats, supplementary, filteredOrder } = await filterStats(
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import { SlashCommandBuilder } from 'discord.js';
|
import { SlashCommandBuilder } from 'discord.js';
|
||||||
import { getAccountInfo } from '../_core/blitz/getAccountInfo';
|
import { getAccountInfo } from '../_core/blitz/getAccountInfo';
|
||||||
|
import { getClanAccountInfo } from '../_core/blitz/getClanAccountInfo';
|
||||||
import { StatFilters, filterStats } from '../_core/statistics/filterStats';
|
import { StatFilters, filterStats } from '../_core/statistics/filterStats';
|
||||||
import AllStatsOverview from '../components/AllStatsOverview';
|
import AllStatsOverview from '../components/AllStatsOverview';
|
||||||
import NoData, { NoDataType } from '../components/NoData';
|
import NoData, { NoDataType } from '../components/NoData';
|
||||||
import TitleBar from '../components/TitleBar';
|
import TitleBar from '../components/TitleBar';
|
||||||
import Wrapper from '../components/Wrapper';
|
import Wrapper from '../components/Wrapper';
|
||||||
import { getClanLogo } from '../core/blitz/getClanLogo';
|
import { getClanLogo } from '../core/blitz/getClanLogo';
|
||||||
import { getPlayerClanInfo } from '../core/blitz/getPlayerClanInfo';
|
|
||||||
import { filtersToDescription } from '../core/blitzkrieg/filtersToDescription';
|
import { filtersToDescription } from '../core/blitzkrieg/filtersToDescription';
|
||||||
import { getBlitzStarsLinkButton } from '../core/blitzstars/getBlitzStarsLinkButton';
|
import { getBlitzStarsLinkButton } from '../core/blitzstars/getBlitzStarsLinkButton';
|
||||||
import getDiffedTankStats from '../core/blitzstars/getDiffedTankStats';
|
import getDiffedTankStats from '../core/blitzstars/getDiffedTankStats';
|
||||||
@@ -34,8 +34,8 @@ async function render(
|
|||||||
{ start, end, name }: ResolvedPeriod,
|
{ start, end, name }: ResolvedPeriod,
|
||||||
filters: StatFilters,
|
filters: StatFilters,
|
||||||
) {
|
) {
|
||||||
const nickname = (await getAccountInfo(region, id))[id].nickname;
|
const { nickname } = await getAccountInfo(region, id);
|
||||||
const clan = (await getPlayerClanInfo(region, id))[id]?.clan;
|
const clan = (await getClanAccountInfo(region, id))?.clan;
|
||||||
const clanImage = clan ? getClanLogo(clan.emblem_set_id) : undefined;
|
const clanImage = clan ? getClanLogo(clan.emblem_set_id) : undefined;
|
||||||
const diffedTankStats = await getDiffedTankStats(region, id, start, end);
|
const diffedTankStats = await getDiffedTankStats(region, id, start, end);
|
||||||
const { stats, supplementary } = await filterStats(diffedTankStats, filters);
|
const { stats, supplementary } = await filterStats(diffedTankStats, filters);
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { SlashCommandBuilder } from 'discord.js';
|
import { SlashCommandBuilder } from 'discord.js';
|
||||||
import { WARGAMING_APPLICATION_ID } from '../constants/wargamingApplicationID';
|
import { getAccountInfo } from '../_core/blitz/getAccountInfo';
|
||||||
import getWargamingResponse from '../core/blitz/getWargamingResponse';
|
|
||||||
import addUsernameChoices from '../core/discord/addUsernameChoices';
|
import addUsernameChoices from '../core/discord/addUsernameChoices';
|
||||||
import autocompleteUsername from '../core/discord/autocompleteUsername';
|
import autocompleteUsername from '../core/discord/autocompleteUsername';
|
||||||
import interactionToURL from '../core/discord/interactionToURL';
|
import interactionToURL from '../core/discord/interactionToURL';
|
||||||
@@ -10,7 +9,6 @@ import resolvePlayerFromButton from '../core/discord/resolvePlayerFromButton';
|
|||||||
import resolvePlayerFromCommand from '../core/discord/resolvePlayerFromCommand';
|
import resolvePlayerFromCommand from '../core/discord/resolvePlayerFromCommand';
|
||||||
import { CommandRegistry } from '../events/interactionCreate';
|
import { CommandRegistry } from '../events/interactionCreate';
|
||||||
import today from '../renderers/today';
|
import today from '../renderers/today';
|
||||||
import { AccountInfo } from '../types/accountInfo';
|
|
||||||
|
|
||||||
export const todayCommand: CommandRegistry = {
|
export const todayCommand: CommandRegistry = {
|
||||||
inProduction: true,
|
inProduction: true,
|
||||||
@@ -50,11 +48,7 @@ export const todayCommand: CommandRegistry = {
|
|||||||
const cutoff = interaction.options.getInteger('cutoff') ?? undefined;
|
const cutoff = interaction.options.getInteger('cutoff') ?? undefined;
|
||||||
const maximized = interaction.options.getInteger('maximized') ?? undefined;
|
const maximized = interaction.options.getInteger('maximized') ?? undefined;
|
||||||
const showTotal = interaction.options.getBoolean('show-total') ?? undefined;
|
const showTotal = interaction.options.getBoolean('show-total') ?? undefined;
|
||||||
const { nickname } = (
|
const { nickname } = await getAccountInfo(player.region, player.id);
|
||||||
await getWargamingResponse<AccountInfo>(
|
|
||||||
`https://api.wotblitz.${player.region}/wotb/account/info/?application_id=${WARGAMING_APPLICATION_ID}&account_id=${player.id}`,
|
|
||||||
)
|
|
||||||
)[player.id];
|
|
||||||
const path = interactionToURL(interaction, {
|
const path = interactionToURL(interaction, {
|
||||||
...player,
|
...player,
|
||||||
cutoff,
|
cutoff,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { AllStats, SupplementaryStats } from '../../types/accountInfo';
|
import { AllStats, SupplementaryStats } from '../../_core/blitz/getAccountInfo';
|
||||||
import { WN8Display } from './components/WN8Display';
|
import { WN8Display } from './components/WN8Display';
|
||||||
import {
|
import {
|
||||||
WN8SurroundingStat,
|
WN8SurroundingStat,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
import { AllStats, SupplementaryStats } from '../../_core/blitz/getAccountInfo';
|
||||||
import getWN8Percentile from '../../core/blitz/getWN8Percentile';
|
import getWN8Percentile from '../../core/blitz/getWN8Percentile';
|
||||||
import isNumber from '../../core/node/isNumber';
|
import isNumber from '../../core/node/isNumber';
|
||||||
import { AllStats, SupplementaryStats } from '../../types/accountInfo';
|
|
||||||
import { Card } from './components/Card';
|
import { Card } from './components/Card';
|
||||||
import { Root } from './components/Root';
|
import { Root } from './components/Root';
|
||||||
import { Row } from './components/Row';
|
import { Row } from './components/Row';
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
import { Region } from '../../constants/regions';
|
|
||||||
import { WARGAMING_APPLICATION_ID } from '../../constants/wargamingApplicationID';
|
|
||||||
import { PlayerClanInfo } from '../../types/playerClanData';
|
|
||||||
import getWargamingResponse from './getWargamingResponse';
|
|
||||||
|
|
||||||
export function getPlayerClanInfo(region: Region, id: number) {
|
|
||||||
return getWargamingResponse<PlayerClanInfo>(
|
|
||||||
`https://api.wotblitz.${region}/wotb/clans/accountinfo/?application_id=${WARGAMING_APPLICATION_ID}&account_id=${id}&extra=clan`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { AllStats } from '../../types/accountInfo';
|
import { AllStats } from '../../_core/blitz/getAccountInfo';
|
||||||
import { emptyAllStats } from '../blitzstars/getDiffedTankStats';
|
import { emptyAllStats } from '../blitzstars/getDiffedTankStats';
|
||||||
|
|
||||||
export default function sumStats(allStatsCollection: AllStats[]) {
|
export default function sumStats(allStatsCollection: AllStats[]) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
|
import { AllStats } from '../../_core/blitz/getAccountInfo';
|
||||||
import { TierWeightsRecord } from '../../components/TierWeights';
|
import { TierWeightsRecord } from '../../components/TierWeights';
|
||||||
import { AllStats } from '../../types/accountInfo';
|
|
||||||
import { tankopedia } from '../blitz/tankopedia';
|
import { tankopedia } from '../blitz/tankopedia';
|
||||||
|
|
||||||
export async function getTierWeights(
|
export async function getTierWeights(
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
|
import { getAccountInfo } from '../../_core/blitz/getAccountInfo';
|
||||||
import { Region } from '../../constants/regions';
|
import { Region } from '../../constants/regions';
|
||||||
import { WARGAMING_APPLICATION_ID } from '../../constants/wargamingApplicationID';
|
|
||||||
import { AccountInfo } from '../../types/accountInfo';
|
|
||||||
import getWargamingResponse from '../blitz/getWargamingResponse';
|
|
||||||
import linkButton from '../discord/linkButton';
|
import linkButton from '../discord/linkButton';
|
||||||
|
|
||||||
export async function getBlitzStarsLinkButton(
|
export async function getBlitzStarsLinkButton(
|
||||||
@@ -9,11 +7,7 @@ export async function getBlitzStarsLinkButton(
|
|||||||
id: number,
|
id: number,
|
||||||
tankId?: number,
|
tankId?: number,
|
||||||
) {
|
) {
|
||||||
const { nickname } = (
|
const { nickname } = await getAccountInfo(region, id);
|
||||||
await getWargamingResponse<AccountInfo>(
|
|
||||||
`https://api.wotblitz.${region}/wotb/account/info/?application_id=${WARGAMING_APPLICATION_ID}&account_id=${id}`,
|
|
||||||
)
|
|
||||||
)[id];
|
|
||||||
|
|
||||||
return linkButton(
|
return linkButton(
|
||||||
`https://www.blitzstars.com/player/${region}/${nickname}${
|
`https://www.blitzstars.com/player/${region}/${nickname}${
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
|
import { AllStats } from '../../_core/blitz/getAccountInfo';
|
||||||
import { Region } from '../../constants/regions';
|
import { Region } from '../../constants/regions';
|
||||||
import { AllStats } from '../../types/accountInfo';
|
|
||||||
import getTankHistories, {
|
import getTankHistories, {
|
||||||
TankHistories,
|
TankHistories,
|
||||||
TankHistoryRaw,
|
TankHistoryRaw,
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
|
import { getAccountInfo } from '../../_core/blitz/getAccountInfo';
|
||||||
|
import { PlayerStats } from '../../_core/blitzstars/getPlayerStats';
|
||||||
import { Region } from '../../constants/regions';
|
import { Region } from '../../constants/regions';
|
||||||
import { WARGAMING_APPLICATION_ID } from '../../constants/wargamingApplicationID';
|
|
||||||
import { AccountInfo } from '../../types/accountInfo';
|
|
||||||
import {
|
import {
|
||||||
GetHistoriesOptions,
|
GetHistoriesOptions,
|
||||||
Histories,
|
Histories,
|
||||||
History,
|
History,
|
||||||
getHistoriesDefaultOptions,
|
getHistoriesDefaultOptions,
|
||||||
} from '../../types/histories';
|
} from '../../types/histories';
|
||||||
import getWargamingResponse from '../blitz/getWargamingResponse';
|
|
||||||
import { emptyAllStats } from './getDiffedTankStats';
|
import { emptyAllStats } from './getDiffedTankStats';
|
||||||
|
|
||||||
export default async function getPlayerHistories(
|
export default async function getPlayerHistories(
|
||||||
@@ -19,7 +18,7 @@ export default async function getPlayerHistories(
|
|||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
`https://www.blitzstars.com/api/playerstats/${id}`,
|
`https://www.blitzstars.com/api/playerstats/${id}`,
|
||||||
);
|
);
|
||||||
const playerHistories = ((await response.json()) as PlayerHistoriesRaw).map(
|
const playerHistories = ((await response.json()) as PlayerStats).map(
|
||||||
(history) =>
|
(history) =>
|
||||||
({
|
({
|
||||||
all: history.statistics.all,
|
all: history.statistics.all,
|
||||||
@@ -42,16 +41,9 @@ export default async function getPlayerHistories(
|
|||||||
const latestNodes: Histories = [];
|
const latestNodes: Histories = [];
|
||||||
|
|
||||||
if (mergedOptions.includeLatestHistories) {
|
if (mergedOptions.includeLatestHistories) {
|
||||||
const {
|
const { last_battle_time, statistics } = await getAccountInfo(server, id);
|
||||||
last_battle_time,
|
|
||||||
statistics: { all },
|
|
||||||
} = (
|
|
||||||
await getWargamingResponse<AccountInfo>(
|
|
||||||
`https://api.wotblitz.${server}/wotb/account/info/?application_id=${WARGAMING_APPLICATION_ID}&account_id=${id}`,
|
|
||||||
)
|
|
||||||
)[id];
|
|
||||||
|
|
||||||
latestNodes.push({ all, last_battle_time });
|
latestNodes.push({ all: statistics.all, last_battle_time });
|
||||||
}
|
}
|
||||||
|
|
||||||
const previousNodes: Histories = [];
|
const previousNodes: Histories = [];
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { AllStats } from '../../types/accountInfo';
|
import { AllStats } from '../../_core/blitz/getAccountInfo';
|
||||||
import { context } from '../blitzkrieg/context';
|
import { context } from '../blitzkrieg/context';
|
||||||
|
|
||||||
export interface SpecialStats {
|
export interface SpecialStats {
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ import {
|
|||||||
} from 'discord.js';
|
} from 'discord.js';
|
||||||
import discord from '../../../discord.json' assert { type: 'json' };
|
import discord from '../../../discord.json' assert { type: 'json' };
|
||||||
import { aboutCommand } from '../../commands/about';
|
import { aboutCommand } from '../../commands/about';
|
||||||
import { clanEventCommand } from '../../commands/clanEvent';
|
|
||||||
import { debugCommand } from '../../commands/debug';
|
import { debugCommand } from '../../commands/debug';
|
||||||
import { eligibleCommand } from '../../commands/eligible';
|
import { eligibleCommand } from '../../commands/eligible';
|
||||||
import { evolutionCommand } from '../../commands/evolution';
|
import { evolutionCommand } from '../../commands/evolution';
|
||||||
@@ -102,7 +101,6 @@ export const COMMANDS_RAW: CommandRegistry[] = [
|
|||||||
evolutionCommand,
|
evolutionCommand,
|
||||||
statsCommand,
|
statsCommand,
|
||||||
ratingsCommand,
|
ratingsCommand,
|
||||||
clanEventCommand,
|
|
||||||
];
|
];
|
||||||
|
|
||||||
export const commands = Promise.all(COMMANDS_RAW).then((rawCommands) =>
|
export const commands = Promise.all(COMMANDS_RAW).then((rawCommands) =>
|
||||||
|
|||||||
+9
-15
@@ -1,13 +1,13 @@
|
|||||||
|
import { AllStats, getAccountInfo } from '../_core/blitz/getAccountInfo';
|
||||||
|
import { getClanAccountInfo } from '../_core/blitz/getClanAccountInfo';
|
||||||
|
import calculateWN8 from '../_core/statistics/calculateWN8';
|
||||||
import * as Breakdown from '../components/Breakdown';
|
import * as Breakdown from '../components/Breakdown';
|
||||||
import NoData, { NoDataType } from '../components/NoData';
|
import NoData, { NoDataType } from '../components/NoData';
|
||||||
import TitleBar from '../components/TitleBar';
|
import TitleBar from '../components/TitleBar';
|
||||||
import Wrapper from '../components/Wrapper';
|
import Wrapper from '../components/Wrapper';
|
||||||
import { WARGAMING_APPLICATION_ID } from '../constants/wargamingApplicationID';
|
|
||||||
import calculateWN8 from '../core/blitz/calculateWN8';
|
|
||||||
import getTankStats from '../core/blitz/getTankStats';
|
import getTankStats from '../core/blitz/getTankStats';
|
||||||
import getTreeType from '../core/blitz/getTreeType';
|
import getTreeType from '../core/blitz/getTreeType';
|
||||||
import getWN8Percentile from '../core/blitz/getWN8Percentile';
|
import getWN8Percentile from '../core/blitz/getWN8Percentile';
|
||||||
import getWargamingResponse from '../core/blitz/getWargamingResponse';
|
|
||||||
import resolveTankName from '../core/blitz/resolveTankName';
|
import resolveTankName from '../core/blitz/resolveTankName';
|
||||||
import sumStats from '../core/blitz/sumStats';
|
import sumStats from '../core/blitz/sumStats';
|
||||||
import { tankopedia } from '../core/blitz/tankopedia';
|
import { tankopedia } from '../core/blitz/tankopedia';
|
||||||
@@ -16,8 +16,6 @@ import getPeriodNow from '../core/blitzstars/getPeriodNow';
|
|||||||
import getTimeDaysAgo from '../core/blitzstars/getTimeDaysAgo';
|
import getTimeDaysAgo from '../core/blitzstars/getTimeDaysAgo';
|
||||||
import { tankAverages } from '../core/blitzstars/tankAverages';
|
import { tankAverages } from '../core/blitzstars/tankAverages';
|
||||||
import { ResolvedPlayer } from '../core/discord/resolvePlayerFromCommand';
|
import { ResolvedPlayer } from '../core/discord/resolvePlayerFromCommand';
|
||||||
import { AccountInfo, AllStats } from '../types/accountInfo';
|
|
||||||
import { PlayerClanInfo } from '../types/playerClanData';
|
|
||||||
import { PossiblyPromise } from '../types/possiblyPromise';
|
import { PossiblyPromise } from '../types/possiblyPromise';
|
||||||
|
|
||||||
export default async function today(
|
export default async function today(
|
||||||
@@ -33,16 +31,12 @@ export default async function today(
|
|||||||
getTimeDaysAgo(server, 1),
|
getTimeDaysAgo(server, 1),
|
||||||
getPeriodNow(),
|
getPeriodNow(),
|
||||||
);
|
);
|
||||||
const accountInfo = await getWargamingResponse<AccountInfo>(
|
const accountInfo = await getAccountInfo(server, id);
|
||||||
`https://api.wotblitz.${server}/wotb/account/info/?application_id=${WARGAMING_APPLICATION_ID}&account_id=${id}`,
|
const clanData = await getClanAccountInfo(server, id);
|
||||||
);
|
|
||||||
const clanData = await getWargamingResponse<PlayerClanInfo>(
|
|
||||||
`https://api.wotblitz.${server}/wotb/clans/accountinfo/?application_id=${WARGAMING_APPLICATION_ID}&account_id=${id}&extra=clan`,
|
|
||||||
);
|
|
||||||
const careerTankStatsRaw = await getTankStats(server, id);
|
const careerTankStatsRaw = await getTankStats(server, id);
|
||||||
const careerStats: Record<number, AllStats> = showTotal
|
const careerStats: Record<number, AllStats> = showTotal
|
||||||
? {
|
? {
|
||||||
0: accountInfo[id].statistics.all,
|
0: accountInfo.statistics.all,
|
||||||
}
|
}
|
||||||
: {};
|
: {};
|
||||||
const allStatsToAccumulate: AllStats[] = [];
|
const allStatsToAccumulate: AllStats[] = [];
|
||||||
@@ -191,10 +185,10 @@ export default async function today(
|
|||||||
) : (
|
) : (
|
||||||
<Wrapper>
|
<Wrapper>
|
||||||
<TitleBar
|
<TitleBar
|
||||||
name={accountInfo[id].nickname}
|
name={accountInfo.nickname}
|
||||||
image={
|
image={
|
||||||
clanData[id]?.clan
|
clanData?.clan
|
||||||
? `https://wotblitz-gc.gcdn.co/icons/clanEmblems1x/clan-icon-v2-${clanData[id]?.clan?.emblem_set_id}.png`
|
? `https://wotblitz-gc.gcdn.co/icons/clanEmblems1x/clan-icon-v2-${clanData?.clan?.emblem_set_id}.png`
|
||||||
: undefined
|
: undefined
|
||||||
}
|
}
|
||||||
description="Today's breakdown"
|
description="Today's breakdown"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// a cleaner simplification of Blitz Stars' histories because it's a mess there
|
// a cleaner simplification of Blitz Stars' histories because it's a mess there
|
||||||
|
|
||||||
import { AllStats } from './accountInfo';
|
import { AllStats } from '../_core/blitz/getAccountInfo';
|
||||||
|
|
||||||
export interface History {
|
export interface History {
|
||||||
all: AllStats;
|
all: AllStats;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { AllStats } from './accountInfo';
|
import { AllStats } from '../_core/blitz/getAccountInfo';
|
||||||
|
|
||||||
export interface IndividualTankStats {
|
export interface IndividualTankStats {
|
||||||
all: AllStats;
|
all: AllStats;
|
||||||
|
|||||||
Reference in new issue
Block a user