fix: casing

This commit is contained in:
TrèsAbhi committed 2024-10-07 18:45:11 -05:00
1 parent ef52434a42
commit fc8e0e55f0
34 files changed
+321 -304

No files matched your search

@@ -75,7 +75,7 @@ export function Characteristics() {
const tankModelDefinition = useTankModelDefinition();
const turretModelDefinition = tankModelDefinition.turrets[turret.id];
const gunModelDefinition =
turretModelDefinition.guns[gun.gunType!.value.base.id];
turretModelDefinition.guns[gun.gun_type!.value.base.id];
const stats = tankCharacteristics(
{
tank,
@@ -148,7 +148,7 @@ export function Characteristics() {
<Heading size="5">Firepower</Heading>
<Flex>
{gun.gunType!.value.base.shells.map((thisShell, shellIndex) => (
{gun.gun_type!.value.base.shells.map((thisShell, shellIndex) => (
<Tooltip content={thisShell.name} key={thisShell.id}>
<IconButton
color={thisShell.id === shell.id ? undefined : 'gray'}
@@ -157,11 +157,13 @@ export function Characteristics() {
borderTopLeftRadius: shellIndex === 0 ? undefined : 0,
borderBottomLeftRadius: shellIndex === 0 ? undefined : 0,
borderTopRightRadius:
shellIndex === gun.gunType!.value.base.shells.length - 1
shellIndex ===
gun.gun_type!.value.base.shells.length - 1
? undefined
: 0,
borderBottomRightRadius:
shellIndex === gun.gunType!.value.base.shells.length - 1
shellIndex ===
gun.gun_type!.value.base.shells.length - 1
? undefined
: 0,
marginLeft: shellIndex === 0 ? 0 : -1,
@@ -183,11 +185,11 @@ export function Characteristics() {
))}
</Flex>
</Flex>
<Info name="Gun type">{GUN_TYPE_NAMES[gun.gunType!.$case]}</Info>
<Info name="Gun type">{GUN_TYPE_NAMES[gun.gun_type!.$case]}</Info>
<InfoWithDelta name="DPM" decimals={0} unit="hp / min">
{stats.dpm}
</InfoWithDelta>
{gun.gunType!.$case === 'autoReloader' && (
{gun.gun_type!.$case === 'auto_reloader' && (
<InfoWithDelta
decimals={0}
indent
@@ -197,10 +199,10 @@ export function Characteristics() {
{stats.dpmEffective!}
</InfoWithDelta>
)}
{gun.gunType!.$case !== 'regular' && (
{gun.gun_type!.$case !== 'regular' && (
<InfoWithDelta name="Shells">{stats.shells}</InfoWithDelta>
)}
{gun.gunType!.$case === 'autoReloader' ? (
{gun.gun_type!.$case === 'auto_reloader' ? (
<>
<Info indent name="Most optimal shell index">
{stats.mostOptimalShellIndex! + 1}
@@ -228,8 +230,8 @@ export function Characteristics() {
{stats.shellReload!}
</InfoWithDelta>
)}
{(gun.gunType!.$case === 'autoLoader' ||
gun.gunType!.$case === 'autoReloader') && (
{(gun.gun_type!.$case === 'auto_loader' ||
gun.gun_type!.$case === 'auto_reloader') && (
<InfoWithDelta
indent
decimals={2}
@@ -300,7 +302,7 @@ export function Characteristics() {
<InfoWithDelta name="Damage" unit="hp" decimals={0}>
{stats.damage}
</InfoWithDelta>
{gun.gunType!.$case !== 'regular' && (
{gun.gun_type!.$case !== 'regular' && (
<InfoWithDelta name="Clipping potential" indent>
{stats.clipDamage!}
</InfoWithDelta>
@@ -74,7 +74,7 @@ export function Consumables() {
consumables={consumablesList}
selected={consumables}
cooldownBooster={cooldownBooster}
disabled={protagonist.tank.maxConsumables === consumables.length}
disabled={protagonist.tank.max_consumables === consumables.length}
hasConsumableDeliverySystem={hasConsumableDeliverySystem}
hasHighEndConsumables={hasHighEndConsumables}
timers
@@ -10,7 +10,7 @@ export function Equipment() {
const mutateDuel = Duel.useMutation();
const protagonist = Duel.use((state) => state.protagonist);
const equipmentPreset =
equipmentDefinitions.presets[protagonist.tank.equipmentPreset];
equipmentDefinitions.presets[protagonist.tank.equipment_preset];
const equipmentMatrix = Duel.use(
(state) => state.protagonist.equipmentMatrix,
);
@@ -38,7 +38,7 @@ export function Miscellaneous() {
<Heading size="4">Miscellaneous</Heading>
<Flex gap="2" align="center">
{!tank.fixedCamouflage && (
{!tank.fixed_camouflage && (
<GenericTankComponentButton
icon={asset('icons/camo.webp')}
selected={camouflage}
@@ -32,8 +32,8 @@ type ModuleDefinition =
| EngineDefinition;
function extractModule(raw: ModuleDefinition | TankDefinition) {
if ('gunType' in raw) {
return raw.gunType!.value.base;
if ('gun_type' in raw) {
return raw.gun_type!.value.base;
} else
return raw as Exclude<ModuleDefinition | TankDefinition, GunDefinition>;
}
@@ -172,34 +172,36 @@ export function Modules() {
if (
!draft.protagonist.turret.guns.some(
(gun) =>
gun.gunType!.value.base.id ===
draft.protagonist.gun.gunType!.value.base.id,
gun.gun_type!.value.base.id ===
draft.protagonist.gun.gun_type!.value.base.id,
)
) {
draft.protagonist.gun = draft.protagonist.turret.guns.at(-1)!;
draft.protagonist.shell =
draft.protagonist.gun.gunType!.value.base.shells[0];
draft.protagonist.gun.gun_type!.value.base.shells[0];
}
} else if (unlock.type === ModuleType.GUN) {
const gunInTurret = draft.protagonist.turret.guns.find(
(gun) => gun.gunType!.value.base.id === unlock.id,
(gun) => gun.gun_type!.value.base.id === unlock.id,
);
if (gunInTurret) {
draft.protagonist.gun = gunInTurret;
draft.protagonist.shell = gunInTurret.gunType!.value.base.shells[0];
draft.protagonist.shell = gunInTurret.gun_type!.value.base.shells[0];
} else {
// TODO: warn somehow?
const suitableTurret = draft.protagonist.tank.turrets.find((turret) =>
turret.guns.some((gun) => gun.gunType!.value.base.id === unlock.id),
turret.guns.some(
(gun) => gun.gun_type!.value.base.id === unlock.id,
),
)!;
const gunInSuitableTurret = suitableTurret.guns.find(
(gun) => gun.gunType!.value.base.id === unlock.id,
(gun) => gun.gun_type!.value.base.id === unlock.id,
)!;
draft.protagonist.turret = suitableTurret;
draft.protagonist.gun = gunInSuitableTurret;
draft.protagonist.shell =
gunInSuitableTurret.gunType!.value.base.shells[0];
gunInSuitableTurret.gun_type!.value.base.shells[0];
}
} else if (unlock.type === ModuleType.ENGINE) {
draft.protagonist.engine = draft.protagonist.tank.engines.find(
@@ -232,10 +234,10 @@ export function Modules() {
module = tank.turrets
.find((turret) =>
turret.guns.some(
(gun) => gun.gunType!.value.base.id === unlock.id,
(gun) => gun.gun_type!.value.base.id === unlock.id,
),
)!
.guns.find((gun) => gun.gunType!.value.base.id === unlock.id)!;
.guns.find((gun) => gun.gun_type!.value.base.id === unlock.id)!;
} else if (unlock.type === ModuleType.VEHICLE) {
module = tankDefinitions.tanks[unlock.id];
}
@@ -298,7 +300,7 @@ export function Modules() {
(unlock.type === ModuleType.TURRET
? turret.id
: unlock.type === ModuleType.GUN
? gun.gunType!.value.base.id
? gun.gun_type!.value.base.id
: unlock.type === ModuleType.ENGINE
? engine.id
: unlock.type === ModuleType.TRACKS
@@ -310,7 +312,7 @@ export function Modules() {
? extractModule(module).id == topTurret.id
: unlock.type === ModuleType.GUN
? extractModule(module).id ===
topGun.gunType!.value.base.id
topGun.gun_type!.value.base.id
: unlock.type === ModuleType.ENGINE
? extractModule(module).id === topEngine.id
: unlock.type === ModuleType.TRACKS
@@ -360,7 +362,7 @@ export function Modules() {
draft.protagonist.turret = draft.protagonist.tank.turrets[0];
draft.protagonist.gun = draft.protagonist.turret.guns[0];
draft.protagonist.shell =
draft.protagonist.gun.gunType!.value.base.shells[0];
draft.protagonist.gun.gun_type!.value.base.shells[0];
draft.protagonist.engine = draft.protagonist.tank.engines[0];
draft.protagonist.track = draft.protagonist.tank.tracks[0];
});
@@ -376,7 +378,7 @@ export function Modules() {
draft.protagonist.tank.turrets.at(-1)!;
draft.protagonist.gun = draft.protagonist.turret.guns.at(-1)!;
draft.protagonist.shell =
draft.protagonist.gun.gunType!.value.base.shells[0];
draft.protagonist.gun.gun_type!.value.base.shells[0];
draft.protagonist.engine =
draft.protagonist.tank.engines.at(-1)!;
draft.protagonist.track =
@@ -415,7 +417,7 @@ export function Modules() {
{tree(ModuleType.GUN, [
{
cost: { type: 'xp', value: 0 },
id: gun0.gunType!.value.base.id,
id: gun0.gun_type!.value.base.id,
type: ModuleType.GUN,
},
])}
@@ -32,7 +32,7 @@ export function Provisions() {
<ProvisionsManager
provisions={provisionsList.map((provision) => provision.id)}
selected={provisions}
disabled={tank.maxProvisions === provisions.length}
disabled={tank.max_provisions === provisions.length}
onChange={(provisions) => {
mutateDuel((draft) => {
draft.protagonist.provisions = provisions;