mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 18:57:03 +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
@@ -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';
|
||||
|
||||
export default function sumStats(allStatsCollection: AllStats[]) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { AllStats } from '../../_core/blitz/getAccountInfo';
|
||||
import { TierWeightsRecord } from '../../components/TierWeights';
|
||||
import { AllStats } from '../../types/accountInfo';
|
||||
import { tankopedia } from '../blitz/tankopedia';
|
||||
|
||||
export async function getTierWeights(
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import { getAccountInfo } from '../../_core/blitz/getAccountInfo';
|
||||
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';
|
||||
|
||||
export async function getBlitzStarsLinkButton(
|
||||
@@ -9,11 +7,7 @@ export async function getBlitzStarsLinkButton(
|
||||
id: number,
|
||||
tankId?: number,
|
||||
) {
|
||||
const { nickname } = (
|
||||
await getWargamingResponse<AccountInfo>(
|
||||
`https://api.wotblitz.${region}/wotb/account/info/?application_id=${WARGAMING_APPLICATION_ID}&account_id=${id}`,
|
||||
)
|
||||
)[id];
|
||||
const { nickname } = await getAccountInfo(region, id);
|
||||
|
||||
return linkButton(
|
||||
`https://www.blitzstars.com/player/${region}/${nickname}${
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { AllStats } from '../../_core/blitz/getAccountInfo';
|
||||
import { Region } from '../../constants/regions';
|
||||
import { AllStats } from '../../types/accountInfo';
|
||||
import getTankHistories, {
|
||||
TankHistories,
|
||||
TankHistoryRaw,
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
import { getAccountInfo } from '../../_core/blitz/getAccountInfo';
|
||||
import { PlayerStats } from '../../_core/blitzstars/getPlayerStats';
|
||||
import { Region } from '../../constants/regions';
|
||||
import { WARGAMING_APPLICATION_ID } from '../../constants/wargamingApplicationID';
|
||||
import { AccountInfo } from '../../types/accountInfo';
|
||||
import {
|
||||
GetHistoriesOptions,
|
||||
Histories,
|
||||
History,
|
||||
getHistoriesDefaultOptions,
|
||||
} from '../../types/histories';
|
||||
import getWargamingResponse from '../blitz/getWargamingResponse';
|
||||
import { emptyAllStats } from './getDiffedTankStats';
|
||||
|
||||
export default async function getPlayerHistories(
|
||||
@@ -19,7 +18,7 @@ export default async function getPlayerHistories(
|
||||
const response = await fetch(
|
||||
`https://www.blitzstars.com/api/playerstats/${id}`,
|
||||
);
|
||||
const playerHistories = ((await response.json()) as PlayerHistoriesRaw).map(
|
||||
const playerHistories = ((await response.json()) as PlayerStats).map(
|
||||
(history) =>
|
||||
({
|
||||
all: history.statistics.all,
|
||||
@@ -42,16 +41,9 @@ export default async function getPlayerHistories(
|
||||
const latestNodes: Histories = [];
|
||||
|
||||
if (mergedOptions.includeLatestHistories) {
|
||||
const {
|
||||
last_battle_time,
|
||||
statistics: { all },
|
||||
} = (
|
||||
await getWargamingResponse<AccountInfo>(
|
||||
`https://api.wotblitz.${server}/wotb/account/info/?application_id=${WARGAMING_APPLICATION_ID}&account_id=${id}`,
|
||||
)
|
||||
)[id];
|
||||
const { last_battle_time, statistics } = await getAccountInfo(server, id);
|
||||
|
||||
latestNodes.push({ all, last_battle_time });
|
||||
latestNodes.push({ all: statistics.all, last_battle_time });
|
||||
}
|
||||
|
||||
const previousNodes: Histories = [];
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { AllStats } from '../../types/accountInfo';
|
||||
import { AllStats } from '../../_core/blitz/getAccountInfo';
|
||||
import { context } from '../blitzkrieg/context';
|
||||
|
||||
export interface SpecialStats {
|
||||
|
||||
Reference in new issue
Block a user