mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 18:57:03 +02:00
fix: update all
This commit is contained in:
1 parent
bdea9fdab3
commit
e2f50871ec
86 files changed
+1939
-1537
No files matched your search
@@ -1,5 +1,7 @@
|
||||
import { ShellDefinition, ShellType } from "../protos";
|
||||
|
||||
export function canSplash(type: ShellDefinition["type"]): type is ShellType.HE {
|
||||
return type === ShellType.HE;
|
||||
export function canSplash(
|
||||
type: ShellDefinition["type"],
|
||||
): type is ShellType.SHELL_TYPE_HE {
|
||||
return type === ShellType.SHELL_TYPE_HE;
|
||||
}
|
||||
@@ -2,22 +2,22 @@ import { TankClass, TankType } from "../protos";
|
||||
import type { BlitzStats } from "../statistics";
|
||||
|
||||
export const TANK_TYPES = [
|
||||
TankType.RESEARCHABLE,
|
||||
TankType.PREMIUM,
|
||||
TankType.COLLECTOR,
|
||||
TankType.TANK_TYPE_RESEARCHABLE,
|
||||
TankType.TANK_TYPE_PREMIUM,
|
||||
TankType.TANK_TYPE_COLLECTOR,
|
||||
];
|
||||
|
||||
export const TANK_TYPE_COMMAND_NAMES = {
|
||||
[TankType.RESEARCHABLE]: "researchable",
|
||||
[TankType.PREMIUM]: "premium",
|
||||
[TankType.COLLECTOR]: "collector",
|
||||
[TankType.TANK_TYPE_RESEARCHABLE]: "researchable",
|
||||
[TankType.TANK_TYPE_PREMIUM]: "premium",
|
||||
[TankType.TANK_TYPE_COLLECTOR]: "collector",
|
||||
};
|
||||
|
||||
export const TANK_CLASSES = [
|
||||
TankClass.LIGHT,
|
||||
TankClass.MEDIUM,
|
||||
TankClass.HEAVY,
|
||||
TankClass.TANK_DESTROYER,
|
||||
TankClass.TANK_CLASS_LIGHT,
|
||||
TankClass.TANK_CLASS_MEDIUM,
|
||||
TankClass.TANK_CLASS_HEAVY,
|
||||
TankClass.TANK_CLASS_TANK_DESTROYER,
|
||||
];
|
||||
|
||||
export const emptyAllStats: BlitzStats = {
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
export function checkConsumableProvisionInclusivity(
|
||||
consumableProvision: Consumable | Provision,
|
||||
tank: TankDefinition,
|
||||
gun: GunDefinition
|
||||
gun: GunDefinition,
|
||||
) {
|
||||
const included = consumableProvision.include?.every((rule) => {
|
||||
switch (rule.filter_type!.$case) {
|
||||
@@ -46,7 +46,7 @@ export function checkConsumableProvisionInclusivity(
|
||||
case "categories":
|
||||
return rule.filter_type!.value.categories.some((category) => {
|
||||
switch (category) {
|
||||
case ConsumableTankCategoryFilterCategory.CLIP:
|
||||
case ConsumableTankCategoryFilterCategory.CONSUMABLE_TANK_CATEGORY_FILTER_CATEGORY_CLIP:
|
||||
return gun.gun_type!.$case !== "regular";
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { ShellDefinition, ShellType } from "../protos";
|
||||
|
||||
export function isExplosive(
|
||||
type: ShellDefinition["type"]
|
||||
): type is ShellType.HEAT | ShellType.HE {
|
||||
return type === ShellType.HEAT || type === ShellType.HE;
|
||||
type: ShellDefinition["type"],
|
||||
): type is ShellType.SHELL_TYPE_HEAT | ShellType.SHELL_TYPE_HE {
|
||||
return type === ShellType.SHELL_TYPE_HEAT || type === ShellType.SHELL_TYPE_HE;
|
||||
}
|
||||
@@ -2,27 +2,27 @@ import { TANK_CLASSES } from "../blitz/constants";
|
||||
import { GameDefinitions, TankDefinition, TankType } from "../protos";
|
||||
|
||||
const treeTypeOrder = [
|
||||
TankType.RESEARCHABLE,
|
||||
TankType.PREMIUM,
|
||||
TankType.COLLECTOR,
|
||||
TankType.TANK_TYPE_RESEARCHABLE,
|
||||
TankType.TANK_TYPE_PREMIUM,
|
||||
TankType.TANK_TYPE_COLLECTOR,
|
||||
];
|
||||
|
||||
export function metaSortTank(
|
||||
tanks: TankDefinition[],
|
||||
gameDefinitions: GameDefinitions
|
||||
gameDefinitions: GameDefinitions,
|
||||
) {
|
||||
return tanks
|
||||
.sort((a, b) => b.tier - a.tier)
|
||||
.sort(
|
||||
(a, b) => treeTypeOrder.indexOf(b.type) - treeTypeOrder.indexOf(a.type)
|
||||
(a, b) => treeTypeOrder.indexOf(b.type) - treeTypeOrder.indexOf(a.type),
|
||||
)
|
||||
.sort(
|
||||
(a, b) => TANK_CLASSES.indexOf(b.class) - TANK_CLASSES.indexOf(a.class)
|
||||
(a, b) => TANK_CLASSES.indexOf(b.class) - TANK_CLASSES.indexOf(a.class),
|
||||
)
|
||||
.sort(
|
||||
(a, b) =>
|
||||
gameDefinitions.nations.indexOf(b.nation) -
|
||||
gameDefinitions.nations.indexOf(a.nation)
|
||||
gameDefinitions.nations.indexOf(a.nation),
|
||||
)
|
||||
.sort((a, b) => a.tier - b.tier);
|
||||
}
|
||||
@@ -2,8 +2,8 @@ import { BoundingBox, Vector3 } from "../protos";
|
||||
|
||||
export function normalizeBoundingBox(boundingBox: BoundingBox) {
|
||||
return {
|
||||
x: boundingBox.max.x - boundingBox.min.x,
|
||||
y: boundingBox.max.y - boundingBox.min.y,
|
||||
z: boundingBox.max.z - boundingBox.min.z,
|
||||
x: boundingBox.max!.x - boundingBox.min!.x,
|
||||
y: boundingBox.max!.y - boundingBox.min!.y,
|
||||
z: boundingBox.max!.z - boundingBox.min!.z,
|
||||
} satisfies Vector3;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ShellType } from '../protos';
|
||||
import { ShellType } from "../protos";
|
||||
|
||||
export function resolvePenetrationCoefficient(
|
||||
calibratedShells: boolean,
|
||||
@@ -6,11 +6,11 @@ export function resolvePenetrationCoefficient(
|
||||
) {
|
||||
if (!calibratedShells) return 1;
|
||||
|
||||
return type === ShellType.AP
|
||||
return type === ShellType.SHELL_TYPE_AP
|
||||
? 1.08
|
||||
: type === ShellType.APCR
|
||||
: type === ShellType.SHELL_TYPE_APCR
|
||||
? 1.05
|
||||
: type === ShellType.HEAT
|
||||
: type === ShellType.SHELL_TYPE_HEAT
|
||||
? 1.13
|
||||
: 1.08;
|
||||
}
|
||||
@@ -1,74 +1,74 @@
|
||||
import { times } from 'lodash-es';
|
||||
import { CrewType, ShellType, TankClass, TankType } from '../../protos';
|
||||
import { times } from "lodash-es";
|
||||
import { CrewType, ShellType, TankClass, TankType } from "../../protos";
|
||||
|
||||
export const SHELL_NAMES: Record<ShellType, string> = {
|
||||
[ShellType.AP]: 'AP',
|
||||
[ShellType.APCR]: 'APCR',
|
||||
[ShellType.HEAT]: 'HEAT',
|
||||
[ShellType.HE]: 'HE',
|
||||
[ShellType.SHELL_TYPE_AP]: "AP",
|
||||
[ShellType.SHELL_TYPE_APCR]: "APCR",
|
||||
[ShellType.SHELL_TYPE_HEAT]: "HEAT",
|
||||
[ShellType.SHELL_TYPE_HE]: "HE",
|
||||
};
|
||||
export const CREW_MEMBER_NAMES = {
|
||||
[CrewType.COMMANDER]: 'commander',
|
||||
[CrewType.DRIVER]: 'driver',
|
||||
[CrewType.GUNNER]: 'gunner',
|
||||
[CrewType.LOADER]: 'loader',
|
||||
[CrewType.RADIOMAN]: 'radioman',
|
||||
[CrewType.CREW_TYPE_COMMANDER]: "commander",
|
||||
[CrewType.CREW_TYPE_DRIVER]: "driver",
|
||||
[CrewType.CREW_TYPE_GUNNER]: "gunner",
|
||||
[CrewType.CREW_TYPE_LOADER]: "loader",
|
||||
[CrewType.CREW_TYPE_RADIOMAN]: "radioman",
|
||||
} as const;
|
||||
|
||||
/**
|
||||
* @deprecated use svg
|
||||
*/
|
||||
export const TANK_ICONS: Record<TankClass, string> = {
|
||||
[TankClass.TANK_DESTROYER]: 'https://i.imgur.com/BIHSEH0.png',
|
||||
[TankClass.LIGHT]: 'https://i.imgur.com/CSNha5V.png',
|
||||
[TankClass.MEDIUM]: 'https://i.imgur.com/wvf3ltm.png',
|
||||
[TankClass.HEAVY]: 'https://i.imgur.com/ECeqlZa.png',
|
||||
[TankClass.TANK_CLASS_TANK_DESTROYER]: "https://i.imgur.com/BIHSEH0.png",
|
||||
[TankClass.TANK_CLASS_LIGHT]: "https://i.imgur.com/CSNha5V.png",
|
||||
[TankClass.TANK_CLASS_MEDIUM]: "https://i.imgur.com/wvf3ltm.png",
|
||||
[TankClass.TANK_CLASS_HEAVY]: "https://i.imgur.com/ECeqlZa.png",
|
||||
};
|
||||
/**
|
||||
* @deprecated use svg
|
||||
*/
|
||||
export const TANK_ICONS_PREMIUM: Record<TankClass, string> = {
|
||||
[TankClass.TANK_DESTROYER]: 'https://i.imgur.com/TCu3EdR.png',
|
||||
[TankClass.LIGHT]: 'https://i.imgur.com/zdkpTRb.png',
|
||||
[TankClass.MEDIUM]: 'https://i.imgur.com/3z7eHX6.png',
|
||||
[TankClass.HEAVY]: 'https://i.imgur.com/P3vbmyA.png',
|
||||
[TankClass.TANK_CLASS_TANK_DESTROYER]: "https://i.imgur.com/TCu3EdR.png",
|
||||
[TankClass.TANK_CLASS_LIGHT]: "https://i.imgur.com/zdkpTRb.png",
|
||||
[TankClass.TANK_CLASS_MEDIUM]: "https://i.imgur.com/3z7eHX6.png",
|
||||
[TankClass.TANK_CLASS_HEAVY]: "https://i.imgur.com/P3vbmyA.png",
|
||||
};
|
||||
/**
|
||||
* @deprecated use svg
|
||||
*/
|
||||
export const TANK_ICONS_COLLECTOR: Record<TankClass, string> = {
|
||||
[TankClass.TANK_DESTROYER]: 'https://i.imgur.com/WTjeirB.png',
|
||||
[TankClass.LIGHT]: 'https://i.imgur.com/EwhtKkU.png',
|
||||
[TankClass.MEDIUM]: 'https://i.imgur.com/u8YDMBh.png',
|
||||
[TankClass.HEAVY]: 'https://i.imgur.com/8xRf3nc.png',
|
||||
[TankClass.TANK_CLASS_TANK_DESTROYER]: "https://i.imgur.com/WTjeirB.png",
|
||||
[TankClass.TANK_CLASS_LIGHT]: "https://i.imgur.com/EwhtKkU.png",
|
||||
[TankClass.TANK_CLASS_MEDIUM]: "https://i.imgur.com/u8YDMBh.png",
|
||||
[TankClass.TANK_CLASS_HEAVY]: "https://i.imgur.com/8xRf3nc.png",
|
||||
};
|
||||
export const TIERS = times(10, (index) => index + 1);
|
||||
export const TIER_ROMAN_NUMERALS: Record<number, string> = {
|
||||
1: 'I',
|
||||
2: 'II',
|
||||
3: 'III',
|
||||
4: 'IV',
|
||||
5: 'V',
|
||||
6: 'VI',
|
||||
7: 'VII',
|
||||
8: 'VIII',
|
||||
9: 'IX',
|
||||
10: 'X',
|
||||
1: "I",
|
||||
2: "II",
|
||||
3: "III",
|
||||
4: "IV",
|
||||
5: "V",
|
||||
6: "VI",
|
||||
7: "VII",
|
||||
8: "VIII",
|
||||
9: "IX",
|
||||
10: "X",
|
||||
};
|
||||
|
||||
export const flags: Record<string, string> = {
|
||||
ussr: '<:ussr:1218421042033197197>',
|
||||
germany: '🇩🇪',
|
||||
usa: '🇺🇸',
|
||||
china: '🇨🇳',
|
||||
uk: '🇬🇧',
|
||||
france: '🇫🇷',
|
||||
japan: '🇯🇵',
|
||||
european: '🇪🇺',
|
||||
other: '<:other:1218421572243558482>',
|
||||
ussr: "<:ussr:1218421042033197197>",
|
||||
germany: "🇩🇪",
|
||||
usa: "🇺🇸",
|
||||
china: "🇨🇳",
|
||||
uk: "🇬🇧",
|
||||
france: "🇫🇷",
|
||||
japan: "🇯🇵",
|
||||
european: "🇪🇺",
|
||||
other: "<:other:1218421572243558482>",
|
||||
};
|
||||
export const TREE_TYPE_ICONS: Record<TankType, Record<TankClass, string>> = {
|
||||
[TankType.RESEARCHABLE]: TANK_ICONS,
|
||||
[TankType.PREMIUM]: TANK_ICONS_PREMIUM,
|
||||
[TankType.COLLECTOR]: TANK_ICONS_COLLECTOR,
|
||||
[TankType.TANK_TYPE_RESEARCHABLE]: TANK_ICONS,
|
||||
[TankType.TANK_TYPE_PREMIUM]: TANK_ICONS_PREMIUM,
|
||||
[TankType.TANK_TYPE_COLLECTOR]: TANK_ICONS_COLLECTOR,
|
||||
};
|
||||
@@ -15,7 +15,7 @@ export async function fetchTankNames() {
|
||||
tankDefinitionsArray.map(async (tank) => {
|
||||
const searchableNameDeburr: I18nString = { locales: {} };
|
||||
|
||||
Object.entries(tank.name).forEach(([key, value]) => {
|
||||
Object.entries(tank.name!).forEach(([key, value]) => {
|
||||
searchableNameDeburr.locales[key] = deburr(value);
|
||||
});
|
||||
|
||||
@@ -28,8 +28,8 @@ export async function fetchTankNames() {
|
||||
?.map((id) =>
|
||||
locales.supported.map(
|
||||
({ locale }) =>
|
||||
camouflageDefinitions.camouflages[id]?.name.locales[locale]
|
||||
)
|
||||
camouflageDefinitions.camouflages[id]?.name!.locales[locale],
|
||||
),
|
||||
)
|
||||
.flat()
|
||||
.filter(Boolean)
|
||||
@@ -37,7 +37,7 @@ export async function fetchTankNames() {
|
||||
.join(" "),
|
||||
treeType: tank.type,
|
||||
};
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,14 +3,14 @@ import { BoundingBox } from "../protos";
|
||||
export function unionBoundingBox(a: BoundingBox, b: BoundingBox) {
|
||||
return {
|
||||
min: {
|
||||
x: Math.min(a.min.x, b.min.x),
|
||||
y: Math.min(a.min.y, b.min.y),
|
||||
z: Math.min(a.min.z, b.min.z),
|
||||
x: Math.min(a.min!.x, b.min!.x),
|
||||
y: Math.min(a.min!.y, b.min!.y),
|
||||
z: Math.min(a.min!.z, b.min!.z),
|
||||
},
|
||||
max: {
|
||||
x: Math.max(a.max.x, b.max.x),
|
||||
y: Math.max(a.max.y, b.max.y),
|
||||
z: Math.max(a.max.z, b.max.z),
|
||||
x: Math.max(a.max!.x, b.max!.x),
|
||||
y: Math.max(a.max!.y, b.max!.y),
|
||||
z: Math.max(a.max!.z, b.max!.z),
|
||||
},
|
||||
} satisfies BoundingBox;
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user