feat(launcher): add Mods page, per-client presets, custom repo folder, and launch integration
This commit is contained in:
1 parent
aa7a6e7d02
commit
dbc21182a2
21 files changed
+1961
-21
No files matched your search
@@ -0,0 +1,87 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
export const ModRiskBadgeSchema = z.enum(['data', 'gui', 'script', 'exe']);
|
||||
export const ModIssueSeveritySchema = z.enum(['error', 'warning', 'info']);
|
||||
export const LocalizedTextSchema = z.union([z.string(), z.record(z.string(), z.string())]);
|
||||
|
||||
export const ModPackOperationSchema = z.object({
|
||||
pack: z.string(),
|
||||
targetPath: z.string(),
|
||||
action: z.enum(['blk-patch', 'csv-patch', 'file']),
|
||||
sourceRelativePath: z.string(),
|
||||
});
|
||||
|
||||
export const ModListItemSchema = z.object({
|
||||
id: z.string(),
|
||||
folderName: z.string(),
|
||||
rootDir: z.string(),
|
||||
name: LocalizedTextSchema,
|
||||
description: LocalizedTextSchema.optional(),
|
||||
version: z.string(),
|
||||
author: z.string(),
|
||||
apiVersion: z.string(),
|
||||
gameVersions: z.array(z.string()),
|
||||
requires: z.array(z.string()),
|
||||
conflicts: z.array(z.string()),
|
||||
loadAfter: z.array(z.string()),
|
||||
loadBefore: z.array(z.string()),
|
||||
badges: z.array(ModRiskBadgeSchema),
|
||||
hasServerScript: z.boolean(),
|
||||
serverTuningFiles: z.array(z.string()),
|
||||
packOperations: z.array(ModPackOperationSchema),
|
||||
guiPatchCount: z.number().int().nonnegative(),
|
||||
exePatchCount: z.number().int().nonnegative(),
|
||||
hasClientAddon: z.boolean(),
|
||||
addonFileCount: z.number().int().nonnegative(),
|
||||
clientFileCount: z.number().int().nonnegative(),
|
||||
hasConfigBlkPatch: z.boolean(),
|
||||
});
|
||||
|
||||
export const ModDiscoveryErrorSchema = z.object({
|
||||
folderName: z.string(),
|
||||
rootDir: z.string(),
|
||||
reason: z.string(),
|
||||
});
|
||||
|
||||
export const ModIssueSchema = z.object({
|
||||
severity: ModIssueSeveritySchema,
|
||||
kind: z.string(),
|
||||
modId: z.string(),
|
||||
otherModId: z.string().optional(),
|
||||
detail: z.string(),
|
||||
});
|
||||
|
||||
export const ModPresetSchema = z.object({
|
||||
id: z.string().min(1),
|
||||
name: z.string().min(1).max(80),
|
||||
order: z.array(z.string()),
|
||||
enabled: z.record(z.string(), z.boolean()),
|
||||
updatedAt: z.string(),
|
||||
});
|
||||
|
||||
export const ModsStateViewSchema = z.object({
|
||||
modsDir: z.string(),
|
||||
defaultModsDir: z.string(),
|
||||
isCustomModsDir: z.boolean(),
|
||||
apiVersion: z.string(),
|
||||
mods: z.array(ModListItemSchema),
|
||||
discoveryErrors: z.array(ModDiscoveryErrorSchema),
|
||||
order: z.array(z.string()),
|
||||
enabled: z.record(z.string(), z.boolean()),
|
||||
activePresetId: z.string().nullable(),
|
||||
presets: z.array(ModPresetSchema),
|
||||
issues: z.array(ModIssueSchema),
|
||||
hasBlockingErrors: z.boolean(),
|
||||
});
|
||||
|
||||
export const ModPresetTransferSchema = z.object({
|
||||
format: z.literal(1),
|
||||
name: z.string().min(1).max(80),
|
||||
order: z.array(z.string()),
|
||||
enabled: z.record(z.string(), z.boolean()),
|
||||
});
|
||||
|
||||
export type ModListItem = z.output<typeof ModListItemSchema>;
|
||||
export type ModPresetView = z.output<typeof ModPresetSchema>;
|
||||
export type ModIssueView = z.output<typeof ModIssueSchema>;
|
||||
export type ModsStateView = z.output<typeof ModsStateViewSchema>;
|
||||
@@ -37,6 +37,8 @@ export const SettingsSchema = z.object({
|
||||
developerMode: z.boolean().default(true),
|
||||
labStockPath: LabPathSchema.default(null),
|
||||
labDataPath: LabPathSchema.default(null),
|
||||
/** Custom global mods repository directory; null uses `<userData>/mods`. */
|
||||
modsFolder: LabPathSchema.default(null),
|
||||
});
|
||||
|
||||
export type Settings = z.output<typeof SettingsSchema>;
|
||||
@@ -60,6 +62,7 @@ export const SettingsPatchSchema = z.object({
|
||||
developerMode: z.boolean().optional(),
|
||||
labStockPath: LabPathSchema.optional(),
|
||||
labDataPath: LabPathSchema.optional(),
|
||||
modsFolder: LabPathSchema.optional(),
|
||||
});
|
||||
|
||||
export type SettingsPatch = z.output<typeof SettingsPatchSchema>;
|
||||
|
||||
Reference in new issue
Block a user