mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-11-17 10:53:57 +01:00
feat: rename a bit
This commit is contained in:
1 parent
66eaaef6de
commit
6ce1135835
8 files changed
+104
-59
No files matched your search
+1
-1
@@ -183,7 +183,7 @@ function patch(stage0: StageParameters, stage1: StageParameters) {
|
||||
}
|
||||
}
|
||||
|
||||
export function aggregateStages(
|
||||
export function aggregateStageParameters(
|
||||
base: StageParameters,
|
||||
stages: StageParameters[],
|
||||
stage: number
|
||||
@@ -0,0 +1,52 @@
|
||||
import {
|
||||
ShellUpgrageSingleChange_AttributeName,
|
||||
TankAttributeChange_AttributeName,
|
||||
} from "@protos/blitz_static_tank_upgrade_single_stage";
|
||||
|
||||
export type CharacteristicOutput = number | string | null;
|
||||
|
||||
interface Characteristic {
|
||||
value: (helpers: {
|
||||
characteristic: (name: CharacteristicName) => CharacteristicOutput;
|
||||
attribute: (name: TankAttributeChange_AttributeName) => number;
|
||||
shell: (name: ShellUpgrageSingleChange_AttributeName) => number;
|
||||
}) => CharacteristicOutput;
|
||||
}
|
||||
|
||||
export type CharacteristicName = keyof typeof characteristics;
|
||||
|
||||
export const characteristics = {
|
||||
gun_type: {
|
||||
value({ attribute }) {
|
||||
const isPump = attribute(
|
||||
TankAttributeChange_AttributeName.ATTRIBUTE_NAME_IS_PUMP
|
||||
);
|
||||
|
||||
if (isPump === 1) return "auto_reloader";
|
||||
|
||||
const clipSize = attribute(
|
||||
TankAttributeChange_AttributeName.ATTRIBUTE_NAME_CLIP_SIZE
|
||||
);
|
||||
|
||||
if (clipSize === 1) return "regular";
|
||||
|
||||
return "auto_loader";
|
||||
},
|
||||
},
|
||||
|
||||
damage: {
|
||||
value({ shell }) {
|
||||
return shell(
|
||||
ShellUpgrageSingleChange_AttributeName.ATTRIBUTE_NAME_ARMOR_DAMAGE
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
dpm: {
|
||||
value({ characteristic }) {
|
||||
const damage = characteristic("damage");
|
||||
|
||||
return 1;
|
||||
},
|
||||
},
|
||||
} satisfies Record<string, Characteristic>;
|
||||
@@ -0,0 +1,25 @@
|
||||
import type { CharacteristicName } from "./characteristics";
|
||||
|
||||
type CharacteristicsOrder = {
|
||||
group: string;
|
||||
order: CharacteristicName[];
|
||||
}[];
|
||||
|
||||
export const characteristicsGroups = [
|
||||
{
|
||||
group: "firepower",
|
||||
order: ["gun_type", "dpm"],
|
||||
},
|
||||
{
|
||||
group: "maneuverability",
|
||||
order: [],
|
||||
},
|
||||
{
|
||||
group: "survivability",
|
||||
order: [],
|
||||
},
|
||||
{
|
||||
group: "miscellaneous",
|
||||
order: [],
|
||||
},
|
||||
] satisfies CharacteristicsOrder;
|
||||
@@ -0,0 +1,56 @@
|
||||
import type {
|
||||
ShellUpgrageSingleChange_AttributeName,
|
||||
StageParameters,
|
||||
TankAttributeChange_AttributeName,
|
||||
} from "@protos/blitz_static_tank_upgrade_single_stage";
|
||||
import {
|
||||
characteristics,
|
||||
type CharacteristicName,
|
||||
type CharacteristicOutput,
|
||||
} from "./characteristics";
|
||||
|
||||
export function renderCharacteristics(
|
||||
parameters: StageParameters,
|
||||
shellId: number
|
||||
) {
|
||||
const computed: Partial<Record<CharacteristicName, CharacteristicOutput>> =
|
||||
{};
|
||||
|
||||
function characteristic(name: CharacteristicName) {
|
||||
if (name in computed) return computed[name] as CharacteristicOutput;
|
||||
throw new Error(`${name} not computed yet`);
|
||||
}
|
||||
|
||||
function attribute(name: TankAttributeChange_AttributeName) {
|
||||
const attribute = parameters.attributes.find(
|
||||
(attribute) => attribute.attribute_name === name
|
||||
);
|
||||
|
||||
if (!attribute) throw new Error(`Attribute ${name} not found`);
|
||||
("");
|
||||
|
||||
return attribute.value;
|
||||
}
|
||||
|
||||
function shell(name: ShellUpgrageSingleChange_AttributeName) {
|
||||
const shell = parameters.shells_upgrades.find(
|
||||
(shell) => shell.shell_id === name
|
||||
);
|
||||
|
||||
if (!shell) throw new Error(`Shell ${name} not found`);
|
||||
|
||||
const attribute = shell.changes.find(
|
||||
(change) => change.attribute_name === name
|
||||
);
|
||||
|
||||
if (!attribute) throw new Error(`Shell attribute ${name} not found`);
|
||||
|
||||
return attribute.value;
|
||||
}
|
||||
|
||||
for (const _name in characteristics) {
|
||||
const name = _name as CharacteristicName;
|
||||
const _characteristic = characteristics[name];
|
||||
const value = _characteristic.value({ characteristic, attribute, shell });
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
import type { ButtonProps } from "@radix-ui/themes";
|
||||
|
||||
export interface Tool {
|
||||
id: string;
|
||||
strings?: string;
|
||||
|
||||
button: ButtonProps["color"];
|
||||
significant?: boolean;
|
||||
disabled?: boolean;
|
||||
href?: string;
|
||||
}
|
||||
|
||||
export const tools: Record<string, Tool> = {
|
||||
tanks: {
|
||||
id: "tanks",
|
||||
strings: "tankopedia",
|
||||
button: "purple",
|
||||
significant: true,
|
||||
},
|
||||
players: {
|
||||
id: "players",
|
||||
disabled: true,
|
||||
button: "blue",
|
||||
},
|
||||
compare: {
|
||||
id: "compare",
|
||||
button: "crimson",
|
||||
},
|
||||
performance: {
|
||||
id: "performance",
|
||||
button: "jade",
|
||||
},
|
||||
charts: {
|
||||
id: "charts",
|
||||
disabled: true,
|
||||
button: "bronze",
|
||||
},
|
||||
playlist: {
|
||||
id: "playlist",
|
||||
button: "tomato",
|
||||
},
|
||||
mixer: {
|
||||
id: "mixer",
|
||||
button: "gray",
|
||||
},
|
||||
guess: {
|
||||
id: "guess",
|
||||
button: "cyan",
|
||||
},
|
||||
gallery: {
|
||||
id: "gallery",
|
||||
button: "gold",
|
||||
},
|
||||
session: {
|
||||
id: "session",
|
||||
button: "blue",
|
||||
},
|
||||
discord: {
|
||||
id: "discord",
|
||||
href: "https://discord.com/application-directory/1097673957865443370",
|
||||
button: "indigo",
|
||||
},
|
||||
tier_list: {
|
||||
id: "tier-list",
|
||||
strings: "tier_list",
|
||||
button: "orange",
|
||||
},
|
||||
embed: {
|
||||
id: "embed",
|
||||
button: "red",
|
||||
},
|
||||
api: {
|
||||
id: "api",
|
||||
disabled: true,
|
||||
button: "bronze",
|
||||
},
|
||||
more: {
|
||||
id: "more",
|
||||
href: "https://discord.gg/nDt7AjGJQH",
|
||||
button: "plum",
|
||||
},
|
||||
};
|
||||
Reference in new issue
Block a user