add native freesr
All checks were successful
Gitea Auto Deploy / Deploy-Container (push) Successful in 1m50s

This commit is contained in:
2025-08-14 12:14:02 +07:00
parent 03affc8593
commit 586241d3ec
3 changed files with 21 additions and 5 deletions

View File

@@ -59,6 +59,7 @@ export default function FreeSRImport() {
const handlerReadFile = (event: React.ChangeEvent<HTMLInputElement>) => { const handlerReadFile = (event: React.ChangeEvent<HTMLInputElement>) => {
setIsLoading(true) setIsLoading(true)
const file = event.target.files?.[0]; const file = event.target.files?.[0];
console.log(event.target.files)
if (!file) { if (!file) {
setSelectedCharacters([]) setSelectedCharacters([])
setFreeSRData(null) setFreeSRData(null)
@@ -104,10 +105,11 @@ export default function FreeSRImport() {
})) ?? [], })) ?? [],
} as CharacterInfoCardType } as CharacterInfoCardType
})); }));
} catch { } catch (e) {
console.log(e)
setSelectedCharacters([]) setSelectedCharacters([])
setFreeSRData(null) setFreeSRData(null)
setError(transI18n("fileIsNotAValidFreeSRJsonFile")) setError(transI18n("fileMustBeAValidJsonFile"))
} }
}; };
reader.readAsText(file); reader.readAsText(file);

View File

@@ -28,7 +28,7 @@ export interface AvatarData {
} }
export interface AvatarJson { export interface AvatarJson {
owner_uid: number; owner_uid?: number;
avatar_id: number; avatar_id: number;
data: AvatarData; data: AvatarData;
level: number; level: number;
@@ -64,12 +64,18 @@ export interface BattleConfigJson {
path_resonance_id: number; path_resonance_id: number;
monsters: MonsterJson[][]; monsters: MonsterJson[][];
} }
type LoadoutJson = {
name: string
avatar_id: number
relic_list: string[]
}
export interface FreeSRJson { export interface FreeSRJson {
key?: string;
lightcones: LightconeJson[]; lightcones: LightconeJson[];
relics: RelicJson[]; relics: RelicJson[];
avatars: { [key: string]: AvatarJson }; avatars: { [key: string]: AvatarJson };
battle_config: BattleConfigJson; battle_config: BattleConfigJson;
loadout?: LoadoutJson[];
} }
export interface PSResponse { export interface PSResponse {

View File

@@ -32,7 +32,7 @@ export const avatarDataSchema = z.object({
}); });
export const avatarJsonSchema = z.object({ export const avatarJsonSchema = z.object({
owner_uid: z.number(), owner_uid: z.number().optional(),
avatar_id: z.number(), avatar_id: z.number(),
data: avatarDataSchema, data: avatarDataSchema,
level: z.number(), level: z.number(),
@@ -69,11 +69,19 @@ export const battleConfigJsonSchema = z.object({
monsters: z.array(z.array(monsterJsonSchema)), monsters: z.array(z.array(monsterJsonSchema)),
}); });
export const loadoutJsonSchema = z.object({
name: z.string(),
avatar_id: z.number(),
relic_list: z.array(z.string()),
});
export const freeSRJsonSchema = z.object({ export const freeSRJsonSchema = z.object({
key: z.string().optional(),
lightcones: z.array(lightconeJsonSchema), lightcones: z.array(lightconeJsonSchema),
relics: z.array(relicJsonSchema), relics: z.array(relicJsonSchema),
avatars: z.record(avatarJsonSchema), avatars: z.record(avatarJsonSchema),
battle_config: battleConfigJsonSchema, battle_config: battleConfigJsonSchema,
loadout: z.array(loadoutJsonSchema).optional(),
}); });
export const pSResponseSchema = z.object({ export const pSResponseSchema = z.object({