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