mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 02:37:05 +02:00
feat: some migration
This commit is contained in:
1 parent
e06aaa4bcf
commit
02aed3e3a5
25 files changed
+637
-73
No files matched your search
Vendored
+2
@@ -119,6 +119,7 @@
|
||||
"nmatname",
|
||||
"noout",
|
||||
"normalmap",
|
||||
"oneof",
|
||||
"oopsies",
|
||||
"Oopsy",
|
||||
"opentest",
|
||||
@@ -135,6 +136,7 @@
|
||||
"POSITIVEZ",
|
||||
"precompute",
|
||||
"Promisable",
|
||||
"proto",
|
||||
"protobuf",
|
||||
"protos",
|
||||
"Pyogenics",
|
||||
|
||||
+1
-1
@@ -18,10 +18,10 @@
|
||||
"build:docs": "vitepress build docs",
|
||||
"build:ratingleaderboard": "bun --script scripts/buildRatingLeaderboard.ts",
|
||||
"dev:bot": "cd packages/bot && bun run dev",
|
||||
"start:bot": "cd packages/bot && bun run start",
|
||||
"dev:docs": "vitepress dev docs",
|
||||
"dev:website": "cd packages/website && bun run dev",
|
||||
"dev:api": "bun --filter=@blitzkit/api run dev",
|
||||
"start:bot": "bun dist/bot/index.js",
|
||||
"setup:depotdownloader": "bun --filter=@blitzkit/scripts run setup:depotdownloader",
|
||||
"setup:patches": "bun --filter=@blitzkit/scripts run setup:patches",
|
||||
"start:website": "bun --filter=@blitzkit/website run start",
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
"markdown-escape": "^2.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "bun --watch src/main.ts"
|
||||
"dev": "bun --watch src/main.ts",
|
||||
"start": "bun src/main.ts"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/markdown-escape": "^1.1.3"
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import {
|
||||
StatFilters,
|
||||
emblemURL,
|
||||
filterStats,
|
||||
getAccountInfo,
|
||||
getClanAccountInfo,
|
||||
getTierWeights,
|
||||
@@ -13,6 +11,7 @@ import { NoData } from '../components/NoData';
|
||||
import { TierWeights } from '../components/TierWeights';
|
||||
import { TitleBar } from '../components/TitleBar';
|
||||
import { filtersToDescription } from '../core/blitzkit/filtersToDescription';
|
||||
import { filterStats, StatFilters } from '../core/blitzstars/filterStats';
|
||||
import { getBlitzStarsLinkButton } from '../core/blitzstars/getBlitzStarsLinkButton';
|
||||
import { getStatsInPeriod } from '../core/blitzstars/getStatsInPeriod';
|
||||
import { addPeriodicFilterOptions } from '../core/discord/addPeriodicFilterOptions';
|
||||
|
||||
@@ -167,29 +167,52 @@ export const researchCommand = new Promise<CommandRegistry>((resolve) => {
|
||||
const trackXps = new Map<number, number>();
|
||||
|
||||
tank.turrets.forEach((turret) => {
|
||||
if (turret.xp !== undefined) {
|
||||
turretXps.set(turret.id, turret.xp);
|
||||
if (
|
||||
turret.research_cost !== undefined &&
|
||||
typeof turret.research_cost.research_cost_type!.value === 'number'
|
||||
) {
|
||||
turretXps.set(
|
||||
turret.id,
|
||||
turret.research_cost.research_cost_type!.value,
|
||||
);
|
||||
}
|
||||
|
||||
turret.guns.forEach((gun) => {
|
||||
if (gun.gunType!.value.base.xp !== undefined) {
|
||||
if (
|
||||
gun.gun_type!.value.base.research_cost !== undefined &&
|
||||
typeof gun.gun_type!.value.base.research_cost
|
||||
.research_cost_type!.value === 'number'
|
||||
) {
|
||||
gunXps.set(
|
||||
gun.gunType!.value.base.id,
|
||||
gun.gunType!.value.base.xp,
|
||||
gun.gun_type!.value.base.id,
|
||||
gun.gun_type!.value.base.research_cost.research_cost_type!
|
||||
.value,
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
tank.engines.forEach((engine) => {
|
||||
if (engine.xp !== undefined) {
|
||||
engineXps.set(engine.id, engine.xp);
|
||||
if (
|
||||
engine.research_cost !== undefined &&
|
||||
typeof engine.research_cost.research_cost_type!.value === 'number'
|
||||
) {
|
||||
engineXps.set(
|
||||
engine.id,
|
||||
engine.research_cost.research_cost_type!.value,
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
tank.tracks.forEach((track) => {
|
||||
if (track.xp !== undefined) {
|
||||
trackXps.set(track.id, track.xp);
|
||||
if (
|
||||
track.research_cost !== undefined &&
|
||||
typeof track.research_cost.research_cost_type!.value === 'number'
|
||||
) {
|
||||
trackXps.set(
|
||||
track.id,
|
||||
track.research_cost.research_cost_type!.value,
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -208,7 +231,7 @@ export const researchCommand = new Promise<CommandRegistry>((resolve) => {
|
||||
});
|
||||
|
||||
return {
|
||||
research: tank.xp,
|
||||
research: tank.research_cost!.research_cost_type!.value as number,
|
||||
upgrades: moduleXp,
|
||||
purchase: tank.price.value,
|
||||
equipment: equipmentPriceMatrix[tank.tier].reduce(
|
||||
|
||||
@@ -1,16 +1,11 @@
|
||||
import {
|
||||
StatFilters,
|
||||
emblemURL,
|
||||
filterStats,
|
||||
getAccountInfo,
|
||||
getClanAccountInfo,
|
||||
} from '@blitzkit/core';
|
||||
import { emblemURL, getAccountInfo, getClanAccountInfo } from '@blitzkit/core';
|
||||
import { Locale } from 'discord.js';
|
||||
import { AllStatsOverview } from '../components/AllStatsOverview';
|
||||
import { CommandWrapper } from '../components/CommandWrapper';
|
||||
import { NoData } from '../components/NoData';
|
||||
import { TitleBar } from '../components/TitleBar';
|
||||
import { filtersToDescription } from '../core/blitzkit/filtersToDescription';
|
||||
import { filterStats, StatFilters } from '../core/blitzstars/filterStats';
|
||||
import { getBlitzStarsLinkButton } from '../core/blitzstars/getBlitzStarsLinkButton';
|
||||
import { getStatsInPeriod } from '../core/blitzstars/getStatsInPeriod';
|
||||
import { addPeriodicFilterOptions } from '../core/discord/addPeriodicFilterOptions';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { gameDefinitions } from '@blitzkit/core';
|
||||
import { gameDefinitions } from '../core/blitzkit/nonBlockingPromises';
|
||||
import { getBlitzStarsLinkButton } from '../core/blitzstars/getBlitzStarsLinkButton';
|
||||
import { addFilterOptions } from '../core/discord/addFilterOptions';
|
||||
import { addUsernameChoices } from '../core/discord/addUsernameChoices';
|
||||
|
||||
@@ -84,7 +84,7 @@ export function Row({
|
||||
displayType === 'tank'
|
||||
? type === TankType.COLLECTOR
|
||||
? theme.textLowContrast_blue
|
||||
: treeType === 'premium'
|
||||
: type === TankType.PREMIUM
|
||||
? theme.textLowContrast_amber
|
||||
: theme.textHighContrast
|
||||
: theme.textLowContrast,
|
||||
|
||||
@@ -1,19 +1,23 @@
|
||||
import { TankClass, TREE_TYPE_ICONS, TreeType } from '@blitzkit/core';
|
||||
import { TankClass, TankType, TREE_TYPE_ICONS } from '@blitzkit/core';
|
||||
import { theme } from '../../../../stitches.config';
|
||||
|
||||
export interface ItemProps {
|
||||
tankType?: TankClass;
|
||||
tankClass?: TankClass;
|
||||
name: string;
|
||||
treeType: TreeType;
|
||||
tankType: TankType;
|
||||
}
|
||||
|
||||
const TREE_TYPE_COLOR = {
|
||||
researchable: '',
|
||||
premium: '_amber',
|
||||
collector: '_blue',
|
||||
[TankType.RESEARCHABLE]: '',
|
||||
[TankType.PREMIUM]: '_amber',
|
||||
[TankType.COLLECTOR]: '_blue',
|
||||
} as const;
|
||||
|
||||
export function Item({ tankType, name, treeType }: ItemProps) {
|
||||
export function Item({
|
||||
tankClass: tankType,
|
||||
name,
|
||||
tankType: treeType,
|
||||
}: ItemProps) {
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
@@ -40,7 +44,7 @@ export function Item({ tankType, name, treeType }: ItemProps) {
|
||||
>
|
||||
{tankType && (
|
||||
<img
|
||||
alt={tankType}
|
||||
alt={TankType[tankType]}
|
||||
src={TREE_TYPE_ICONS[treeType][tankType]}
|
||||
style={{ width: 14, height: 14 }}
|
||||
/>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Locale } from 'discord.js';
|
||||
import { go } from 'fuzzysort';
|
||||
import markdownEscape from 'markdown-escape';
|
||||
import { tankNames } from '../blitzkit/nonBlockingPromises';
|
||||
import { tankDefinitions, tankNames } from '../blitzkit/nonBlockingPromises';
|
||||
import { UserError } from '../blitzkit/userError';
|
||||
import { tankNamesTechTreeOnly } from '../discord/autocompleteTanks';
|
||||
import { translator } from '../localization/translator';
|
||||
@@ -34,7 +34,9 @@ export async function resolveTankId(
|
||||
return searchResult[0].obj.id;
|
||||
}
|
||||
} else {
|
||||
if ((await tankDefinitions)[number]) {
|
||||
const awaitedTankDefinitions = await tankDefinitions;
|
||||
|
||||
if (awaitedTankDefinitions.tanks[number]) {
|
||||
return number;
|
||||
} else {
|
||||
throw new UserError(
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { flagUserActivity, idToRegion, usersDatabase } from '@blitzkit/core';
|
||||
import { idToRegion, usersDatabase } from '@blitzkit/core';
|
||||
import { flagUserActivity } from '@blitzkit/core/src/blitzkit/flagUserActivity';
|
||||
|
||||
export async function getBlitzFromDiscord(discordId: bigint) {
|
||||
const unique = await usersDatabase.discordUser.findUnique({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { TankClass, TankType } from '@blitzkit/core';
|
||||
import { TankClass, TankType, Tier } from '@blitzkit/core';
|
||||
import { SupplementaryStats } from '@blitzkit/core/src/blitz/getAccountInfo';
|
||||
import { calculateWN8 } from '@blitzkit/core/src/statistics/calculateWN8';
|
||||
import { BlitzStats } from '@blitzkit/core/src/statistics/compositeStats';
|
||||
@@ -8,7 +8,7 @@ import { blitzStarsTankAverages } from './tankAverages';
|
||||
|
||||
export interface StatFilters {
|
||||
nation?: string;
|
||||
tier?: number;
|
||||
tier?: Tier;
|
||||
class?: TankClass;
|
||||
type?: TankType;
|
||||
tank?: number;
|
||||
|
||||
@@ -62,7 +62,7 @@ export function addFilterOptions<
|
||||
...TANK_CLASSES.map(
|
||||
(tankType) =>
|
||||
({
|
||||
value: tankType,
|
||||
value: `${tankType}`,
|
||||
name: translate(`common.tank_class_short.${tankType}`),
|
||||
name_localizations: localizationObject(
|
||||
`common.tank_class_short.${tankType}`,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { gameDefinitions } from '@blitzkit/core';
|
||||
import {
|
||||
SlashCommandBuilder,
|
||||
SlashCommandSubcommandBuilder,
|
||||
SlashCommandSubcommandGroupBuilder,
|
||||
} from 'discord.js';
|
||||
import { gameDefinitions } from '../blitzkit/nonBlockingPromises';
|
||||
import { addFilterOptions } from './addFilterOptions';
|
||||
import { addPeriodSubCommands } from './addPeriodSubCommands';
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { StatFilters, TreeType } from '@blitzkit/core';
|
||||
import { TankClass, TankType } from '@blitzkit/core';
|
||||
import { ButtonInteraction } from 'discord.js';
|
||||
import { StatFilters } from '../blitzstars/filterStats';
|
||||
|
||||
export function getFiltersFromButton(interaction: ButtonInteraction) {
|
||||
const url = new URL(`https://example.com/${interaction.customId}`);
|
||||
@@ -7,9 +8,12 @@ export function getFiltersFromButton(interaction: ButtonInteraction) {
|
||||
return {
|
||||
nation: url.searchParams.get('nation') ?? undefined,
|
||||
tank: parseInt(url.searchParams.get('tank') ?? '0') || undefined,
|
||||
tankType: url.searchParams.get('tank-class') ?? undefined,
|
||||
treeType:
|
||||
(url.searchParams.get('tree-type') as TreeType | undefined) ?? undefined,
|
||||
class:
|
||||
(Number(url.searchParams.get('class')) as TankClass | undefined) ??
|
||||
undefined,
|
||||
type:
|
||||
(Number(url.searchParams.get('type')) as TankType | undefined) ??
|
||||
undefined,
|
||||
tier: parseInt(url.searchParams.get('tier') ?? '0') || undefined,
|
||||
} satisfies StatFilters;
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
import { StatFilters, TreeType } from '@blitzkit/core';
|
||||
import { TankClass, TankType } from '@blitzkit/core';
|
||||
import { ChatInputCommandInteraction } from 'discord.js';
|
||||
import { resolveTankId } from '../blitz/resolveTankId';
|
||||
import { StatFilters } from '../blitzstars/filterStats';
|
||||
|
||||
export async function getFiltersFromCommand(
|
||||
interaction: ChatInputCommandInteraction,
|
||||
@@ -9,10 +10,13 @@ export async function getFiltersFromCommand(
|
||||
|
||||
return {
|
||||
nation: interaction.options.getString('nation') ?? undefined,
|
||||
tier: parseInt(interaction.options.getString('tier') ?? '0') || undefined,
|
||||
tankType: interaction.options.getString('tank-class') ?? undefined,
|
||||
treeType:
|
||||
(interaction.options.getString('tree-type') as TreeType | undefined) ??
|
||||
tier: Number(interaction.options.getString('tier')),
|
||||
class:
|
||||
(Number(interaction.options.getString('class')) as
|
||||
| TankClass
|
||||
| undefined) ?? undefined,
|
||||
type:
|
||||
(Number(interaction.options.getString('type')) as TankType | undefined) ??
|
||||
undefined,
|
||||
tank:
|
||||
tankRaw === null
|
||||
|
||||
@@ -7,22 +7,6 @@ export const LEAGUES = [
|
||||
{ name: 'silver', minScore: 2000, index: 3 },
|
||||
{ name: 'bronze', minScore: -Infinity, index: 4 },
|
||||
];
|
||||
export type RatingInfo =
|
||||
| {
|
||||
detail: undefined;
|
||||
|
||||
title: string;
|
||||
icon: string | null;
|
||||
start_at: string;
|
||||
finish_at: string;
|
||||
current_season: number;
|
||||
updated_at: string;
|
||||
count: number;
|
||||
|
||||
rewards: RatingReward[];
|
||||
leagues: RatingLeague[];
|
||||
}
|
||||
| { detail: { error: string } };
|
||||
export interface RatingNeighbors {
|
||||
neighbors: RatingPlayer[];
|
||||
}
|
||||
|
||||
@@ -15,13 +15,13 @@ export * from './equipmentDefinitions';
|
||||
export * from './eventManager';
|
||||
// export * from './flagUserActivity';
|
||||
export * from './gameDefinitions';
|
||||
// export * from './getArchivedLatestSeasonNumber';
|
||||
// export * from './getArchivedRatingInfo';
|
||||
// export * from './getArchivedRatingLeaderboard';
|
||||
// export * from './getArchivedRatingMidnightLeaderboard';
|
||||
// export * from './getTimeDaysAgo';
|
||||
export * from './getArchivedLatestSeasonNumber';
|
||||
export * from './getArchivedRatingInfo';
|
||||
export * from './getArchivedRatingLeaderboard';
|
||||
export * from './getArchivedRatingMidnightLeaderboard';
|
||||
export * from './getTimeDaysAgo';
|
||||
export * from './isExplosive';
|
||||
// export * from './linkBlitzAndDiscord';
|
||||
export * from './linkBlitzAndDiscord';
|
||||
export * from './mapDefinitions';
|
||||
export * from './modelDefinitions';
|
||||
export * from './normalizeBoundingBox';
|
||||
|
||||
@@ -9,4 +9,3 @@ export * from './protos';
|
||||
export * from './statistics';
|
||||
export * from './streams';
|
||||
export * from './types';
|
||||
|
||||
@@ -7,6 +7,7 @@ export * from './game_definitions.ts';
|
||||
export * from './map_definitions.ts';
|
||||
export * from './model_definitions.ts';
|
||||
export * from './provision_definitions.ts';
|
||||
export * from './rating_leaderboard.ts';
|
||||
export * from './reviews.ts';
|
||||
export * from './skill_definitions.ts';
|
||||
export * from './tank_definitions.ts';
|
||||
@@ -0,0 +1,33 @@
|
||||
syntax = "proto2";
|
||||
|
||||
package blitzkit;
|
||||
|
||||
message RatingLeaderboard {
|
||||
oneof version {
|
||||
RatingLeaderboardV1 v1 = 1;
|
||||
RatingLeaderboardV2 v2 = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message RatingLeaderboardV1 {
|
||||
repeated RatingLeaderboardEntryV1 entries = 1;
|
||||
}
|
||||
|
||||
message RatingLeaderboardEntryV1 {
|
||||
required uint32 id = 1;
|
||||
required uint32 score = 2;
|
||||
}
|
||||
|
||||
message RatingLeaderboardV2 {
|
||||
repeated RatingLeaderboardEntryV2 entries = 1;
|
||||
}
|
||||
|
||||
message RatingLeaderboardEntryV2 {
|
||||
required uint32 id = 1;
|
||||
required uint32 score = 2;
|
||||
required uint32 battles = 3;
|
||||
required uint32 wins = 4;
|
||||
required uint32 survived = 5;
|
||||
required uint32 damage = 6;
|
||||
required uint32 kills = 7;
|
||||
}
|
||||
@@ -0,0 +1,512 @@
|
||||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.2.2
|
||||
// protoc v5.28.2
|
||||
// source: packages/core/src/protos/rating_leaderboard.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
|
||||
export const protobufPackage = "blitzkit";
|
||||
|
||||
export interface RatingLeaderboard {
|
||||
version?: { $case: "v1"; value: RatingLeaderboardV1 } | { $case: "v2"; value: RatingLeaderboardV2 } | undefined;
|
||||
}
|
||||
|
||||
export interface RatingLeaderboardV1 {
|
||||
entries: RatingLeaderboardEntryV1[];
|
||||
}
|
||||
|
||||
export interface RatingLeaderboardEntryV1 {
|
||||
id: number;
|
||||
score: number;
|
||||
}
|
||||
|
||||
export interface RatingLeaderboardV2 {
|
||||
entries: RatingLeaderboardEntryV2[];
|
||||
}
|
||||
|
||||
export interface RatingLeaderboardEntryV2 {
|
||||
id: number;
|
||||
score: number;
|
||||
battles: number;
|
||||
wins: number;
|
||||
survived: number;
|
||||
damage: number;
|
||||
kills: number;
|
||||
}
|
||||
|
||||
function createBaseRatingLeaderboard(): RatingLeaderboard {
|
||||
return { version: undefined };
|
||||
}
|
||||
|
||||
export const RatingLeaderboard: MessageFns<RatingLeaderboard> = {
|
||||
encode(message: RatingLeaderboard, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
switch (message.version?.$case) {
|
||||
case "v1":
|
||||
RatingLeaderboardV1.encode(message.version.value, writer.uint32(10).fork()).join();
|
||||
break;
|
||||
case "v2":
|
||||
RatingLeaderboardV2.encode(message.version.value, writer.uint32(18).fork()).join();
|
||||
break;
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): RatingLeaderboard {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseRatingLeaderboard();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.version = { $case: "v1", value: RatingLeaderboardV1.decode(reader, reader.uint32()) };
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.version = { $case: "v2", value: RatingLeaderboardV2.decode(reader, reader.uint32()) };
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): RatingLeaderboard {
|
||||
return {
|
||||
version: isSet(object.v1)
|
||||
? { $case: "v1", value: RatingLeaderboardV1.fromJSON(object.v1) }
|
||||
: isSet(object.v2)
|
||||
? { $case: "v2", value: RatingLeaderboardV2.fromJSON(object.v2) }
|
||||
: undefined,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: RatingLeaderboard): unknown {
|
||||
const obj: any = {};
|
||||
if (message.version?.$case === "v1") {
|
||||
obj.v1 = RatingLeaderboardV1.toJSON(message.version.value);
|
||||
}
|
||||
if (message.version?.$case === "v2") {
|
||||
obj.v2 = RatingLeaderboardV2.toJSON(message.version.value);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create<I extends Exact<DeepPartial<RatingLeaderboard>, I>>(base?: I): RatingLeaderboard {
|
||||
return RatingLeaderboard.fromPartial(base ?? ({} as any));
|
||||
},
|
||||
fromPartial<I extends Exact<DeepPartial<RatingLeaderboard>, I>>(object: I): RatingLeaderboard {
|
||||
const message = createBaseRatingLeaderboard();
|
||||
if (object.version?.$case === "v1" && object.version?.value !== undefined && object.version?.value !== null) {
|
||||
message.version = { $case: "v1", value: RatingLeaderboardV1.fromPartial(object.version.value) };
|
||||
}
|
||||
if (object.version?.$case === "v2" && object.version?.value !== undefined && object.version?.value !== null) {
|
||||
message.version = { $case: "v2", value: RatingLeaderboardV2.fromPartial(object.version.value) };
|
||||
}
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseRatingLeaderboardV1(): RatingLeaderboardV1 {
|
||||
return { entries: [] };
|
||||
}
|
||||
|
||||
export const RatingLeaderboardV1: MessageFns<RatingLeaderboardV1> = {
|
||||
encode(message: RatingLeaderboardV1, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
for (const v of message.entries) {
|
||||
RatingLeaderboardEntryV1.encode(v!, writer.uint32(10).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): RatingLeaderboardV1 {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseRatingLeaderboardV1();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.entries.push(RatingLeaderboardEntryV1.decode(reader, reader.uint32()));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): RatingLeaderboardV1 {
|
||||
return {
|
||||
entries: globalThis.Array.isArray(object?.entries)
|
||||
? object.entries.map((e: any) => RatingLeaderboardEntryV1.fromJSON(e))
|
||||
: [],
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: RatingLeaderboardV1): unknown {
|
||||
const obj: any = {};
|
||||
if (message.entries?.length) {
|
||||
obj.entries = message.entries.map((e) => RatingLeaderboardEntryV1.toJSON(e));
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create<I extends Exact<DeepPartial<RatingLeaderboardV1>, I>>(base?: I): RatingLeaderboardV1 {
|
||||
return RatingLeaderboardV1.fromPartial(base ?? ({} as any));
|
||||
},
|
||||
fromPartial<I extends Exact<DeepPartial<RatingLeaderboardV1>, I>>(object: I): RatingLeaderboardV1 {
|
||||
const message = createBaseRatingLeaderboardV1();
|
||||
message.entries = object.entries?.map((e) => RatingLeaderboardEntryV1.fromPartial(e)) || [];
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseRatingLeaderboardEntryV1(): RatingLeaderboardEntryV1 {
|
||||
return { id: 0, score: 0 };
|
||||
}
|
||||
|
||||
export const RatingLeaderboardEntryV1: MessageFns<RatingLeaderboardEntryV1> = {
|
||||
encode(message: RatingLeaderboardEntryV1, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.id !== 0) {
|
||||
writer.uint32(8).uint32(message.id);
|
||||
}
|
||||
if (message.score !== 0) {
|
||||
writer.uint32(16).uint32(message.score);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): RatingLeaderboardEntryV1 {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseRatingLeaderboardEntryV1();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 8) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.id = reader.uint32();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 16) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.score = reader.uint32();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): RatingLeaderboardEntryV1 {
|
||||
return {
|
||||
id: globalThis.Number(assertSet("RatingLeaderboardEntryV1.id", object.id)),
|
||||
score: globalThis.Number(assertSet("RatingLeaderboardEntryV1.score", object.score)),
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: RatingLeaderboardEntryV1): unknown {
|
||||
const obj: any = {};
|
||||
if (message.id !== 0) {
|
||||
obj.id = Math.round(message.id);
|
||||
}
|
||||
if (message.score !== 0) {
|
||||
obj.score = Math.round(message.score);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create<I extends Exact<DeepPartial<RatingLeaderboardEntryV1>, I>>(base?: I): RatingLeaderboardEntryV1 {
|
||||
return RatingLeaderboardEntryV1.fromPartial(base ?? ({} as any));
|
||||
},
|
||||
fromPartial<I extends Exact<DeepPartial<RatingLeaderboardEntryV1>, I>>(object: I): RatingLeaderboardEntryV1 {
|
||||
const message = createBaseRatingLeaderboardEntryV1();
|
||||
message.id = object.id ?? 0;
|
||||
message.score = object.score ?? 0;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseRatingLeaderboardV2(): RatingLeaderboardV2 {
|
||||
return { entries: [] };
|
||||
}
|
||||
|
||||
export const RatingLeaderboardV2: MessageFns<RatingLeaderboardV2> = {
|
||||
encode(message: RatingLeaderboardV2, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
for (const v of message.entries) {
|
||||
RatingLeaderboardEntryV2.encode(v!, writer.uint32(10).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): RatingLeaderboardV2 {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseRatingLeaderboardV2();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.entries.push(RatingLeaderboardEntryV2.decode(reader, reader.uint32()));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): RatingLeaderboardV2 {
|
||||
return {
|
||||
entries: globalThis.Array.isArray(object?.entries)
|
||||
? object.entries.map((e: any) => RatingLeaderboardEntryV2.fromJSON(e))
|
||||
: [],
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: RatingLeaderboardV2): unknown {
|
||||
const obj: any = {};
|
||||
if (message.entries?.length) {
|
||||
obj.entries = message.entries.map((e) => RatingLeaderboardEntryV2.toJSON(e));
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create<I extends Exact<DeepPartial<RatingLeaderboardV2>, I>>(base?: I): RatingLeaderboardV2 {
|
||||
return RatingLeaderboardV2.fromPartial(base ?? ({} as any));
|
||||
},
|
||||
fromPartial<I extends Exact<DeepPartial<RatingLeaderboardV2>, I>>(object: I): RatingLeaderboardV2 {
|
||||
const message = createBaseRatingLeaderboardV2();
|
||||
message.entries = object.entries?.map((e) => RatingLeaderboardEntryV2.fromPartial(e)) || [];
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseRatingLeaderboardEntryV2(): RatingLeaderboardEntryV2 {
|
||||
return { id: 0, score: 0, battles: 0, wins: 0, survived: 0, damage: 0, kills: 0 };
|
||||
}
|
||||
|
||||
export const RatingLeaderboardEntryV2: MessageFns<RatingLeaderboardEntryV2> = {
|
||||
encode(message: RatingLeaderboardEntryV2, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.id !== 0) {
|
||||
writer.uint32(8).uint32(message.id);
|
||||
}
|
||||
if (message.score !== 0) {
|
||||
writer.uint32(16).uint32(message.score);
|
||||
}
|
||||
if (message.battles !== 0) {
|
||||
writer.uint32(24).uint32(message.battles);
|
||||
}
|
||||
if (message.wins !== 0) {
|
||||
writer.uint32(32).uint32(message.wins);
|
||||
}
|
||||
if (message.survived !== 0) {
|
||||
writer.uint32(40).uint32(message.survived);
|
||||
}
|
||||
if (message.damage !== 0) {
|
||||
writer.uint32(48).uint32(message.damage);
|
||||
}
|
||||
if (message.kills !== 0) {
|
||||
writer.uint32(56).uint32(message.kills);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): RatingLeaderboardEntryV2 {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseRatingLeaderboardEntryV2();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 8) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.id = reader.uint32();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 16) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.score = reader.uint32();
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 24) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.battles = reader.uint32();
|
||||
continue;
|
||||
}
|
||||
case 4: {
|
||||
if (tag !== 32) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.wins = reader.uint32();
|
||||
continue;
|
||||
}
|
||||
case 5: {
|
||||
if (tag !== 40) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.survived = reader.uint32();
|
||||
continue;
|
||||
}
|
||||
case 6: {
|
||||
if (tag !== 48) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.damage = reader.uint32();
|
||||
continue;
|
||||
}
|
||||
case 7: {
|
||||
if (tag !== 56) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.kills = reader.uint32();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): RatingLeaderboardEntryV2 {
|
||||
return {
|
||||
id: globalThis.Number(assertSet("RatingLeaderboardEntryV2.id", object.id)),
|
||||
score: globalThis.Number(assertSet("RatingLeaderboardEntryV2.score", object.score)),
|
||||
battles: globalThis.Number(assertSet("RatingLeaderboardEntryV2.battles", object.battles)),
|
||||
wins: globalThis.Number(assertSet("RatingLeaderboardEntryV2.wins", object.wins)),
|
||||
survived: globalThis.Number(assertSet("RatingLeaderboardEntryV2.survived", object.survived)),
|
||||
damage: globalThis.Number(assertSet("RatingLeaderboardEntryV2.damage", object.damage)),
|
||||
kills: globalThis.Number(assertSet("RatingLeaderboardEntryV2.kills", object.kills)),
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: RatingLeaderboardEntryV2): unknown {
|
||||
const obj: any = {};
|
||||
if (message.id !== 0) {
|
||||
obj.id = Math.round(message.id);
|
||||
}
|
||||
if (message.score !== 0) {
|
||||
obj.score = Math.round(message.score);
|
||||
}
|
||||
if (message.battles !== 0) {
|
||||
obj.battles = Math.round(message.battles);
|
||||
}
|
||||
if (message.wins !== 0) {
|
||||
obj.wins = Math.round(message.wins);
|
||||
}
|
||||
if (message.survived !== 0) {
|
||||
obj.survived = Math.round(message.survived);
|
||||
}
|
||||
if (message.damage !== 0) {
|
||||
obj.damage = Math.round(message.damage);
|
||||
}
|
||||
if (message.kills !== 0) {
|
||||
obj.kills = Math.round(message.kills);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create<I extends Exact<DeepPartial<RatingLeaderboardEntryV2>, I>>(base?: I): RatingLeaderboardEntryV2 {
|
||||
return RatingLeaderboardEntryV2.fromPartial(base ?? ({} as any));
|
||||
},
|
||||
fromPartial<I extends Exact<DeepPartial<RatingLeaderboardEntryV2>, I>>(object: I): RatingLeaderboardEntryV2 {
|
||||
const message = createBaseRatingLeaderboardEntryV2();
|
||||
message.id = object.id ?? 0;
|
||||
message.score = object.score ?? 0;
|
||||
message.battles = object.battles ?? 0;
|
||||
message.wins = object.wins ?? 0;
|
||||
message.survived = object.survived ?? 0;
|
||||
message.damage = object.damage ?? 0;
|
||||
message.kills = object.kills ?? 0;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends { $case: string; value: unknown } ? { $case: T["$case"]; value?: DeepPartial<T["value"]> }
|
||||
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
||||
export type Exact<P, I extends P> = P extends Builtin ? P
|
||||
: P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
function assertSet<T>(field: string, value: T | undefined): T {
|
||||
if (!isSet(value)) {
|
||||
throw new TypeError(`Required field ${field} is not set`);
|
||||
}
|
||||
|
||||
return value as T;
|
||||
}
|
||||
|
||||
export interface MessageFns<T> {
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
|
||||
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
|
||||
}
|
||||
@@ -118,7 +118,7 @@ function Content() {
|
||||
}, [members]);
|
||||
|
||||
return (
|
||||
<PageWrapper color="crimson" size="100%">
|
||||
<PageWrapper color="crimson" maxWidth="100%">
|
||||
<Flex justify="center" gap="4" align="center" direction="column">
|
||||
<DamageWarning />
|
||||
<Controls
|
||||
|
||||
@@ -78,7 +78,7 @@ function Content({ embed }: PageProps) {
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<PageWrapper padding="0" size={1028 + 640} color="red">
|
||||
<PageWrapper padding="0" maxWidth="104rem" color="red">
|
||||
<Flex>
|
||||
<ScrollArea
|
||||
scrollbars="vertical"
|
||||
|
||||
@@ -5,7 +5,7 @@ import { TankopediaPersistent } from '../../../stores/tankopediaPersistent';
|
||||
|
||||
export function Page() {
|
||||
return (
|
||||
<PageWrapper color="purple" size={1028}>
|
||||
<PageWrapper color="purple" maxWidth="64rem">
|
||||
<TankopediaPersistent.Provider>
|
||||
<App.Provider>
|
||||
<TankSearch />
|
||||
|
||||
Reference in new issue
Block a user