This commit is contained in:
tresabhi committed 2026-10-04 18:16:08 -05:00
1 parent 474e71843d
commit 7cb3df3da2
5 files changed
+51 -21

No files matched your search

@@ -1,9 +1,24 @@
import { ConsumablesCommon, OptionalDevices } from "../../../types";
import { BlitzEffectScript } from "../../../types/blitzEffectScript";
import { BlitzScripts } from "../../../types/blitzScripts";
import { AbstractVFS } from "../../vfs";
import { Cache } from "./0_base";
import { ServerBlitzKitAPI10 } from "./10_avatars";
function assignNormalizedScript(
target: Record<string, BlitzEffectScript>,
key: number,
script?: BlitzEffectScript,
) {
if (script === undefined) return;
if (script["#text"] === "StaticFactorDevice") {
script["#text"] = script.attribute!;
}
target[key] = script;
}
export abstract class ServerBlitzKitAPI11 extends ServerBlitzKitAPI10 {
@Cache()
async scripts() {
@@ -19,7 +34,8 @@ export abstract class ServerBlitzKitAPI11 extends ServerBlitzKitAPI10 {
for (const key in optionalDevices.root) {
const equipment = optionalDevices.root[key];
scripts.equipment[equipment.id] = equipment.script;
assignNormalizedScript(scripts.equipment, equipment.id, equipment.script);
}
async function assign(
@@ -38,7 +54,12 @@ export abstract class ServerBlitzKitAPI11 extends ServerBlitzKitAPI10 {
for (const key in things.root) {
const thing = things.root[key];
scripts[target][thing.id] = things.root[key].script;
assignNormalizedScript(
scripts[target],
thing.id,
things.root[key].script,
);
}
}
}
+1
View File
@@ -5,6 +5,7 @@
"deg": "{value}°",
"hp": "{value}hp",
"x": "x{value}",
"s": "{value}s",
"percentage": "{value}%",
"deg_s": "{value}°/s",
"plus": "+{value}"
+26 -2
View File
@@ -87,12 +87,36 @@ export const characteristics = {
let coefficient = 1;
script("protagonist", "CalibratedShells", (effect) => {
coefficient *=
1 +
coefficient +=
effect.piercingFactors![blitzkitToBlitzShellKind[shell.type]] / 100;
});
return coefficient * shell.penetration!.near;
},
},
reload: {
type: CharacteristicType.Number,
should_render({ gun }) {
return gun.gun_type!.$case !== "auto_reloader";
},
compute({ gun, script }) {
// should never happen! just for typescript
if (gun.gun_type!.$case === "auto_reloader") return -Infinity;
let coefficient = 1;
script("protagonist", "miscAttrs/gunReloadTimeFactor", (effect) => {
coefficient += effect.bonusValues!.percent / 100;
});
if (gun.gun_type!.$case === "regular") {
return coefficient * gun.gun_type!.value.reload;
}
return gun.gun_type!.value.clip_reload;
},
},
} satisfies Record<string, Characteristic>;
@@ -362,7 +362,6 @@ export function tankCharacteristics(
: undefined;
const damageWithoutAssault =
shell.armor_damage * damageCoefficientWithoutAssault;
const damage = shell.armor_damage * damageCoefficient;
const dpmEffective =
gun.gun_type!.$case === "auto_reloader"
? gun.gun_type!.value.shell_reloads[0] >
@@ -1,7 +1,6 @@
import { literalsArray } from "@blitzkit/i18n/src/literals";
import { useMemo, type ReactNode } from "react";
import { type ReactNode } from "react";
import { Text } from "../components/Text";
import { characteristicsGroups } from "../config/characteristicsGroups";
import type {
CharacteristicRenderConfig,
CharacteristicReturnType,
@@ -10,20 +9,6 @@ import { useLocale } from "./useLocale";
import { useStrings } from "./useStrings";
export function useCharacteristicRenderer() {
const groups = useMemo(() => {
const groups: string[] = [];
for (const group of characteristicsGroups) {
for (const item of group.order) {
if ("strings" in item && item.strings) {
groups.push(item.strings);
}
}
}
return groups;
}, []);
const locale = useLocale();
const strings = useStrings();