Edit research branches in local saves
This commit is contained in:
1 parent
3e2acc5a17
commit
3e08e9314e
14 files changed
+291
-15
No files matched your search
@@ -15,7 +15,7 @@ import {
|
||||
} from '../schemas/install.ts';
|
||||
import { LabInfoSchema, LaunchStateSchema } from '../schemas/launch.ts';
|
||||
import { MaintenanceInfoSchema, MaintenanceProgressSchema, MaintenanceRequestSchema } from '../schemas/maintenance.ts';
|
||||
import { OfficialImportOptionsSchema, OfficialPreviewSchema, SaveOfficialRequestSchema, CurrencyEditsSchema, SaveBackupNameSchema, SaveBackupSchema, SaveDetailsSchema, SaveKeysSchema, SaveListSchema, SaveRegistrationSchema, SaveTransferSchema } from '../schemas/saves.ts';
|
||||
import { ResearchBranchSchema, ResearchOperationSchema, SaveResearchSchema, OfficialImportOptionsSchema, OfficialPreviewSchema, SaveOfficialRequestSchema, CurrencyEditsSchema, SaveBackupNameSchema, SaveBackupSchema, SaveDetailsSchema, SaveKeysSchema, SaveListSchema, SaveRegistrationSchema, SaveTransferSchema } from '../schemas/saves.ts';
|
||||
import { SettingsPatchSchema, SettingsSchema } from '../schemas/settings.ts';
|
||||
|
||||
/**
|
||||
@@ -188,6 +188,14 @@ export const ipcContract = {
|
||||
input: SaveOfficialRequestSchema.extend({ options: OfficialImportOptionsSchema }),
|
||||
output: OfficialPreviewSchema,
|
||||
},
|
||||
'saves:research': {
|
||||
input: SaveKeysSchema.extend({ branch: ResearchBranchSchema.optional() }),
|
||||
output: SaveResearchSchema,
|
||||
},
|
||||
'saves:editResearch': {
|
||||
input: SaveKeysSchema.extend({ branch: ResearchBranchSchema, action: ResearchOperationSchema }),
|
||||
output: SaveResearchSchema,
|
||||
},
|
||||
'launch:getState': {
|
||||
input: z.void(),
|
||||
output: LaunchStateSchema,
|
||||
|
||||
@@ -64,6 +64,19 @@ export const OfficialPreviewSchema = z.object({
|
||||
vehicles: z.array(z.string()),
|
||||
omitted: z.array(z.string()),
|
||||
});
|
||||
export const ResearchBranchSchema = z.object({ country: z.string().min(1), type: z.string().min(1) });
|
||||
export const ResearchOperationSchema = z.enum(['research', 'purchase', 'equipment']);
|
||||
export const SaveResearchSchema = z.object({
|
||||
branches: z.array(ResearchBranchSchema),
|
||||
selected: ResearchBranchSchema.nullable(),
|
||||
vehicles: z.array(z.object({
|
||||
name: z.string(), rank: z.number(), owned: z.boolean(), points: z.number(), needed: z.number(),
|
||||
})),
|
||||
});
|
||||
export type ResearchBranch = z.output<typeof ResearchBranchSchema>;
|
||||
export type ResearchOperation = z.output<typeof ResearchOperationSchema>;
|
||||
export type SaveResearch = z.output<typeof SaveResearchSchema>;
|
||||
|
||||
export type OfficialPreview = z.output<typeof OfficialPreviewSchema>;
|
||||
export type OfficialImportOptions = z.output<typeof OfficialImportOptionsSchema>;
|
||||
|
||||
|
||||
Reference in new issue
Block a user