feat : big update
CI / Verify (push) Successful in 3m14s
CI / Build immutable images and deploy (push) Successful in 4m0s

This commit is contained in:
2026-10-01 18:37:15 +07:00 Unverified
parent c5037154cb
commit 0022625edb
76 changed files with 18671 additions and 29 deletions
+38
View File
@@ -0,0 +1,38 @@
import * as z from "zod";
const key = z.string().min(1).max(64);
const member = z.object({
characterKey: key,
weaponKey: key,
artifactKey: key,
constellation: z.enum(["0", "1", "2", "3", "4", "5", "6", "0-6"]).default("0"),
refinement: z.enum(["1", "2", "3", "4", "5", "1-5"]).default("1"),
});
const team = z.object({ members: z.array(member).length(4) }).refine(
({ members }) => new Set(members.map((item) => item.characterKey)).size === 4,
"A team needs four different characters",
);
const weaponComparison = z.object({ characterKey: key, weaponKeys: z.array(key).min(2).max(100) }).refine(
({ weaponKeys }) => new Set(weaponKeys).size === weaponKeys.length,
"Choose different weapons",
);
const constellationComparison = z.object({
characterKey: key,
levels: z.array(z.number().int().min(0).max(6)).min(1).max(7),
}).refine(({ levels }) => new Set(levels).size === levels.length, "Choose different constellation levels");
export const commissionRequestSchema = z.object({
teams: z.array(team).max(20),
weapons: z.array(weaponComparison).max(20),
constellations: z.array(constellationComparison).max(20),
}).refine((value) => value.teams.length + value.weapons.length + value.constellations.length > 0,
"Choose at least one commission item");
export type CommissionRequest = z.infer<typeof commissionRequestSchema>;
export function commissionPrice(request: CommissionRequest): number {
const hasItems = request.teams.length + request.weapons.length + request.constellations.length > 0;
return (hasItems ? Math.max(1, request.teams.length) * 100 : 0) +
request.weapons.reduce((sum, item) => sum + item.weaponKeys.filter(Boolean).length * 20, 0) +
request.constellations.reduce((sum, item) => sum + item.levels.length * 20, 0);
}