fix: casing 2

This commit is contained in:
TrèsAbhi committed 2024-10-07 18:48:16 -05:00
1 parent fc8e0e55f0
commit 5fcc42e065
8 files changed
+45 -45

No files matched your search

@@ -12,5 +12,4 @@ export const equipmentPriceMatrix: Record<Tier, Vector3Tuple> = {
[Tier.VIII]: [200_000, 225_000, 250_000], [Tier.VIII]: [200_000, 225_000, 250_000],
[Tier.IX]: [250_000, 275_000, 300_000], [Tier.IX]: [250_000, 275_000, 300_000],
[Tier.X]: [300_000, 350_000, 400_000], [Tier.X]: [300_000, 350_000, 400_000],
[Tier.UNRECOGNIZED]: [0, 0, 0],
}; };
@@ -12,11 +12,11 @@ export const averageDefinitionsAllStatsKeys = Object.keys(
) as (keyof BlitzkitStats)[]; ) as (keyof BlitzkitStats)[];
export const emptySamples: Samples = { export const emptySamples: Samples = {
d1: 0, d_1: 0,
d7: 0, d_7: 0,
d30: 0, d_30: 0,
d60: 0, d_60: 0,
d90: 0, d_90: 0,
d120: 0, d_120: 0,
total: 0, total: 0,
}; };
@@ -12,53 +12,53 @@ export function checkConsumableProvisionInclusivity(
gun: GunDefinition, gun: GunDefinition,
) { ) {
const included = const included =
!consumableProvision.gameModeExclusive && !consumableProvision.game_mode_exclusive &&
consumableProvision.include?.every((rule) => { consumableProvision.include?.every((rule) => {
switch (rule.filterType!.$case) { switch (rule.filter_type!.$case) {
case 'tiers': case 'tiers':
return ( return (
rule.filterType!.value.min <= tank.tier && rule.filter_type!.value.min <= tank.tier &&
tank.tier <= rule.filterType!.value.max tank.tier <= rule.filter_type!.value.max
); );
case 'ids': case 'ids':
return rule.filterType!.value.ids.includes(tank.id); return rule.filter_type!.value.ids.includes(tank.id);
case 'nations': case 'nations':
return rule.filterType!.value.nations.includes(tank.nation); return rule.filter_type!.value.nations.includes(tank.nation);
case 'categories': case 'categories':
throw new SyntaxError('Category filtering found in include rule'); throw new SyntaxError('Category filtering found in include rule');
} }
}); });
const excluded = const excluded =
consumableProvision.gameModeExclusive || consumableProvision.game_mode_exclusive ||
consumableProvision.exclude?.some((rule) => { consumableProvision.exclude?.some((rule) => {
switch (rule.filterType!.$case) { switch (rule.filter_type!.$case) {
case 'tiers': case 'tiers':
return ( return (
rule.filterType!.value.min <= tank.tier && rule.filter_type!.value.min <= tank.tier &&
tank.tier <= rule.filterType!.value.max tank.tier <= rule.filter_type!.value.max
); );
case 'ids': case 'ids':
return rule.filterType!.value.ids.includes(tank.id); return rule.filter_type!.value.ids.includes(tank.id);
case 'nations': case 'nations':
return rule.filterType!.value.nations.includes(tank.nation); return rule.filter_type!.value.nations.includes(tank.nation);
case 'categories': case 'categories':
return rule.filterType!.value.categories.some((category) => { return rule.filter_type!.value.categories.some((category) => {
switch (category) { switch (category) {
case ConsumableTankCategoryFilterCategory.CLIP: case ConsumableTankCategoryFilterCategory.CLIP:
return gun.gunType!.$case !== 'regular'; return gun.gun_type!.$case !== 'regular';
} }
}); });
} }
}); });
return ( return (
!consumableProvision.gameModeExclusive && !consumableProvision.game_mode_exclusive &&
consumableProvision.include?.length > 0 && consumableProvision.include?.length > 0 &&
included && included &&
!excluded !excluded
+11 -11
View File
@@ -11,21 +11,21 @@ export function resolveDpm(
reloadCoefficient = 1, reloadCoefficient = 1,
intraClipCoefficient = 1, intraClipCoefficient = 1,
) { ) {
const alpha = shell.armorDamage * damageCoefficient; const alpha = shell.armor_damage * damageCoefficient;
let dps: number; let dps: number;
if (gun.gunType!.$case === 'regular') { if (gun.gun_type!.$case === 'regular') {
dps = alpha / (reloadCoefficient * gun.gunType!.value.extension.reload); dps = alpha / (reloadCoefficient * gun.gun_type!.value.extension.reload);
} else if (gun.gunType!.$case === 'autoLoader') { } else if (gun.gun_type!.$case === 'auto_loader') {
dps = dps =
(alpha * gun.gunType!.value.extension.shellCount) / (alpha * gun.gun_type!.value.extension.shell_count) /
(gun.gunType!.value.extension.clipReload * reloadCoefficient + (gun.gun_type!.value.extension.clip_reload * reloadCoefficient +
(gun.gunType!.value.extension.shellCount - 1) * (gun.gun_type!.value.extension.shell_count - 1) *
gun.gunType!.value.extension.intraClip * gun.gun_type!.value.extension.intra_clip *
intraClipCoefficient); intraClipCoefficient);
} else { } else {
const mostOptimalShell = const mostOptimalShell =
gun.gunType!.value.extension.shellReloads.reduce<null | { gun.gun_type!.value.extension.shell_reloads.reduce<null | {
index: number; index: number;
reload: number; reload: number;
}>((current, reloadRaw, index) => { }>((current, reloadRaw, index) => {
@@ -33,9 +33,9 @@ export function resolveDpm(
reloadRaw * reloadCoefficient + reloadRaw * reloadCoefficient +
(index > 0 (index > 0
? ( ? (
gun.gunType!.value gun.gun_type!.value
.extension as GunDefinitionAutoReloaderProperties .extension as GunDefinitionAutoReloaderProperties
).intraClip * intraClipCoefficient ).intra_clip * intraClipCoefficient
: 0); : 0);
if (current === null || reload < current.reload) { if (current === null || reload < current.reload) {
@@ -21,11 +21,11 @@ export const CREW_MEMBER_NAMES: Record<CrewType, string> = {
[CrewType.RADIOMAN]: 'Radioman', [CrewType.RADIOMAN]: 'Radioman',
}; };
export const GUN_TYPE_NAMES: Record< export const GUN_TYPE_NAMES: Record<
Exclude<GunDefinition['gunType'], undefined>['$case'], Exclude<GunDefinition['gun_type'], undefined>['$case'],
string string
> = { > = {
autoLoader: 'Auto loader', auto_loader: 'Auto loader',
autoReloader: 'Auto reloader', auto_reloader: 'Auto reloader',
regular: 'Regular', regular: 'Regular',
}; };
/** /**
+3 -3
View File
@@ -14,9 +14,9 @@ export async function fetchTankNames() {
return { return {
id: tank.id, id: tank.id,
name: tank.name, name: tank.name,
nameFull: tank.nameFull, nameFull: tank.name_full,
searchableName: tank.nameFull ?? tank.name, searchableName: tank.name_full ?? tank.name,
searchableNameDeburr: deburr(tank.nameFull ?? tank.name), searchableNameDeburr: deburr(tank.name_full ?? tank.name),
camouflages: tank.camouflages camouflages: tank.camouflages
?.map((id) => camouflageDefinitions.camouflages[id]?.name) ?.map((id) => camouflageDefinitions.camouflages[id]?.name)
.filter(Boolean) .filter(Boolean)
+2 -2
View File
@@ -7,8 +7,8 @@ export function uniqueGuns(turrets: TurretDefinition[]) {
forEachRight(turrets, (turret) => { forEachRight(turrets, (turret) => {
forEachRight(turret.guns, (gun) => { forEachRight(turret.guns, (gun) => {
if (!gunIds.has(gun.gunType!.value.base.id)) { if (!gunIds.has(gun.gun_type!.value.base.id)) {
gunIds.add(gun.gunType!.value.base.id); gunIds.add(gun.gun_type!.value.base.id);
guns.push({ turret, gun }); guns.push({ turret, gun });
} }
}); });
+5 -4
View File
@@ -39,8 +39,9 @@ const args = [
await exec(`protoc ${args.join(' ')}`); await exec(`protoc ${args.join(' ')}`);
await writeFile( await writeFile(
`${ROOT}/index.ts`, `${ROOT}/index.ts`,
files '// @ts-nocheck\n' +
.map((file) => file.replace('.proto', '')) files
.map((file) => `export * from './${file}.ts';`) .map((file) => file.replace('.proto', ''))
.join('\n'), .map((file) => `export * from './${file}.ts';`)
.join('\n'),
); );