feat: reorder stuff

This commit is contained in:
TrèsAbhi committed 2025-07-31 14:12:14 -05:00
1 parent ba97a9f28b
commit b20bb97ea3
4 files changed
+63 -15

No files matched your search

+34 -3
View File
@@ -294,7 +294,7 @@ export interface TankDefinition {
crew: Crew[];
health: number;
nation: string;
name: I18nString;
name: I18nString | undefined;
type: TankType;
max_consumables: number;
max_provisions: number;
@@ -437,6 +437,7 @@ export interface GunDefinitionBase {
export interface AssaultRanges {
ranges: AssaultRange[];
types: ShellType[];
}
export interface AssaultRange {
@@ -446,7 +447,7 @@ export interface AssaultRange {
export interface ShellDefinition {
id: number;
name: I18nString | undefined;
name: I18nString;
velocity: number;
armor_damage: number;
module_damage: number;
@@ -3615,7 +3616,7 @@ export const GunDefinitionBase: MessageFns<GunDefinitionBase> = {
};
function createBaseAssaultRanges(): AssaultRanges {
return { ranges: [] };
return { ranges: [], types: [] };
}
export const AssaultRanges: MessageFns<AssaultRanges> = {
@@ -3626,6 +3627,11 @@ export const AssaultRanges: MessageFns<AssaultRanges> = {
for (const v of message.ranges) {
AssaultRange.encode(v!, writer.uint32(10).fork()).join();
}
writer.uint32(18).fork();
for (const v of message.types) {
writer.int32(v);
}
writer.join();
return writer;
},
@@ -3645,6 +3651,24 @@ export const AssaultRanges: MessageFns<AssaultRanges> = {
message.ranges.push(AssaultRange.decode(reader, reader.uint32()));
continue;
}
case 2: {
if (tag === 16) {
message.types.push(reader.int32() as any);
continue;
}
if (tag === 18) {
const end2 = reader.uint32() + reader.pos;
while (reader.pos < end2) {
message.types.push(reader.int32() as any);
}
continue;
}
break;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
@@ -3659,6 +3683,9 @@ export const AssaultRanges: MessageFns<AssaultRanges> = {
ranges: globalThis.Array.isArray(object?.ranges)
? object.ranges.map((e: any) => AssaultRange.fromJSON(e))
: [],
types: globalThis.Array.isArray(object?.types)
? object.types.map((e: any) => shellTypeFromJSON(e))
: [],
};
},
@@ -3667,6 +3694,9 @@ export const AssaultRanges: MessageFns<AssaultRanges> = {
if (message.ranges?.length) {
obj.ranges = message.ranges.map((e) => AssaultRange.toJSON(e));
}
if (message.types?.length) {
obj.types = message.types.map((e) => shellTypeToJSON(e));
}
return obj;
},
@@ -3681,6 +3711,7 @@ export const AssaultRanges: MessageFns<AssaultRanges> = {
const message = createBaseAssaultRanges();
message.ranges =
object.ranges?.map((e) => AssaultRange.fromPartial(e)) || [];
message.types = object.types?.map((e) => e) || [];
return message;
},
};
@@ -79,6 +79,12 @@ export function Body({ stats }: BodyProps) {
<Table.Body>
<CompareRow stats={stats} value="dpm" decimals={0} />
<CompareRow stats={stats} value="damage" decimals={0} />
{hasNonRegularGun && (
<CompareRow stats={stats} indent value="clipDamage" decimals={0} />
)}
<CompareRow stats={stats} value="moduleDamage" decimals={0} />
<CompareRow stats={stats} value="penetration" decimals={0} />
<CompareRow
stats={stats}
name={strings.website.tools.tankopedia.characteristics.values.reload}
@@ -105,12 +111,6 @@ export function Body({ stats }: BodyProps) {
<CompareRow stats={stats} value="shells" decimals={0} />
</>
)}
<CompareRow stats={stats} value="penetration" decimals={0} />
<CompareRow stats={stats} value="damage" decimals={0} />
{hasNonRegularGun && (
<CompareRow stats={stats} indent value="clipDamage" decimals={0} />
)}
<CompareRow stats={stats} value="moduleDamage" decimals={0} />
<CompareRow stats={stats} value="caliber" decimals={0} />
<CompareRow stats={stats} value="shellNormalization" decimals={0} />
<CompareRow
@@ -0,0 +1,9 @@
import type { AssaultRanges } from '@blitzkit/core';
interface Props {
ranges: AssaultRanges;
}
export function AssaultRangesVisualizer({ ranges }: Props) {
return null;
}
@@ -21,6 +21,7 @@ import { useEquipment } from '../../../../../../hooks/useEquipment';
import { useLocale } from '../../../../../../hooks/useLocale';
import { useTankModelDefinition } from '../../../../../../hooks/useTankModelDefinition';
import { Duel } from '../../../../../../stores/duel';
import { AssaultRangesVisualizer } from './AssaultRangesVisualizer';
import { Info } from './Info';
import { InfoWithDelta } from './InfoWithDelta';
import { RicochetVisualizer } from './RicochetVisualizer';
@@ -112,6 +113,19 @@ export function Firepower({ stats }: StatsAcceptorProps) {
{strings.common.gun_types[gun.gun_type!.$case]}
</Info>
<InfoWithDelta stats={stats} decimals={0} value="dpm" />
<InfoWithDelta stats={stats} decimals={0} value="damage" />
{gun.gun_type!.$case !== 'regular' && (
<InfoWithDelta stats={stats} indent decimals={0} value="clipDamage" />
)}
<InfoWithDelta stats={stats} decimals={0} value="moduleDamage" />
<InfoWithDelta stats={stats} decimals={0} value="penetration" />
{gun.gun_type!.value.base.assault_ranges && (
<AssaultRangesVisualizer
ranges={gun.gun_type!.value.base.assault_ranges}
/>
)}
{gun.gun_type!.$case === 'auto_reloader' && (
<InfoWithDelta stats={stats} decimals={0} indent value="dpmEffective" />
)}
@@ -172,7 +186,6 @@ export function Firepower({ stats }: StatsAcceptorProps) {
)}
{/* <ReloadVisualizer stats={stats} /> */}
<InfoWithDelta stats={stats} decimals={0} value="penetration" />
{typeof shell.penetration !== 'number' && (
<>
<InfoWithDelta
@@ -240,11 +253,6 @@ export function Firepower({ stats }: StatsAcceptorProps) {
</Flex>
</>
)}
<InfoWithDelta stats={stats} decimals={0} value="damage" />
{gun.gun_type!.$case !== 'regular' && (
<InfoWithDelta stats={stats} indent decimals={0} value="clipDamage" />
)}
<InfoWithDelta stats={stats} decimals={0} value="moduleDamage" />
{isExplosive(shell.type) && (
<InfoWithDelta
stats={stats}