fix: fetch correct stages

This commit is contained in:
TrèsAbhi committed 2025-12-18 17:00:06 -06:00
1 parent c6b7918525
commit 15172e8b33
4 files changed
+12 -4

No files matched your search

@@ -11,7 +11,6 @@ import {
TankAttributeChange_Modifier, TankAttributeChange_Modifier,
VisualChanges, VisualChanges,
} from "@protos/blitz_static_tank_upgrade_single_stage"; } from "@protos/blitz_static_tank_upgrade_single_stage";
import { times } from "lodash-es";
function patch(stage0: StageParameters, stage1: StageParameters) { function patch(stage0: StageParameters, stage1: StageParameters) {
if (stage1.stage_number !== ++stage0.stage_number) { if (stage1.stage_number !== ++stage0.stage_number) {
@@ -207,7 +206,9 @@ export function aggregateStageParameters(
stage0.stage_number = 0; stage0.stage_number = 0;
times(stage, (index) => patch(stage0, stages[index])); console.log(stages.length);
stages.forEach((stage) => patch(stage0, stage));
return stage0; return stage0;
} }
@@ -117,4 +117,10 @@ export const characteristics = {
); );
return count === -1 || count === null ? Infinity : count; return count === -1 || count === null ? Infinity : count;
}, },
aim_time({ attribute }) {
return attribute(
TankAttributeChange_AttributeName.ATTRIBUTE_NAME_AIMING_TIME
);
},
} satisfies Record<string, Characteristic>; } satisfies Record<string, Characteristic>;
@@ -40,6 +40,7 @@ export const characteristicsGroups = [
{ name: "shell_velocity" }, { name: "shell_velocity" },
{ name: "shell_range" }, { name: "shell_range" },
{ name: "shell_capacity" }, { name: "shell_capacity" },
{ name: "aim_time" },
], ],
}, },
{ {
@@ -23,7 +23,7 @@ function Content({ id }: { id: string }) {
() => () =>
aggregateStageParameters( aggregateStageParameters(
tank.base_stats!, tank.base_stats!,
tank.upgrade_stages, tank.upgrade_stages.slice(0, protagonist.stage),
protagonist.shell protagonist.shell
), ),
[protagonist] [protagonist]
@@ -38,7 +38,7 @@ function Content({ id }: { id: string }) {
<h1>{id}</h1> <h1>{id}</h1>
<div style={{ display: "flex", flexWrap: "wrap" }}> <div style={{ display: "flex", flexWrap: "wrap" }}>
{times(tank.upgrade_stages.length, (index) => ( {times(tank.upgrade_stages.length + 1, (index) => (
<button <button
key={index} key={index}
onClick={() => { onClick={() => {