Skip to content

Commit

Permalink
Update: json
Browse files Browse the repository at this point in the history
  • Loading branch information
Slouchwind committed Mar 4, 2023
1 parent 7b3276a commit fe10279
Show file tree
Hide file tree
Showing 4 changed files with 412 additions and 21 deletions.
87 changes: 87 additions & 0 deletions components/students.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
interface studentsInfo {
id?: number;
info?: string;
}

interface schaleInfo {
Id: number;
IsReleased: boolean[];
DefaultOrder: number;
PathName: string;
DevName: string;
/**姓名 */
Name: string;
/**所在学校名字 */
School: string;
/**所在部门名字 */
Club: string;
StarGrade: number;
SquadType: string;
TacticRole: string;
Summons: [];
Position: string;
BulletType: string;
ArmorType: string;
StreetBattleAdaptation: number;
OutdoorBattleAdaptation: number;
IndoorBattleAdaptation: number;
WeaponType: string;
WeaponImg: string;
Cover: true;
Equipment: string[];
CollectionBG: string;
CollectionTexture: string;
FamilyName: string;
FamilyNameRuby: null;
PersonalName: string;
SchoolYear: string;
CharacterAge: string;
Birthday: string;
CharacterSSRNew: string;
ProfileIntroduction: string
Hobby: string;
CharacterVoice: string;
BirthDay: string;
ArtistName: string;
CharHeightMetric: string;
CharHeightImperial: string;
StabilityPoint: number;
AttackPower1: number;
AttackPower100: number;
MaxHP1: number;
MaxHP100: number;
DefensePower1: number;
DefensePower100: number;
HealPower1: number;
HealPower100: number;
DodgePoint: number;
AccuracyPoint: number;
CriticalPoint: number;
CriticalDamageRate: number;
AmmoCount: number;
AmmoCost: number;
Range: number;
RegenCost: number;
}

export interface Main {
studentsJson?: studentsInfo[];
schaleJson?: schaleInfo[];
}

export interface MainInfo {
json?: studentsInfo;
schale?: schaleInfo;
}

export async function getStudentJson(): Promise<Main> {
const studentsJson: studentsInfo[] = await fetch('/students.json').then(r => r.json());
const schaleJson: schaleInfo[] = await fetch('https://schale.gg/data/cn/students.min.json?v=102').then(r => r.json());
return { studentsJson, schaleJson };
}

export function getStudentInfo({ studentsJson, schaleJson }: Main, studentId: number): MainInfo {
const json = studentsJson && studentsJson.filter(info => (info.id === studentId))[0];
const schale = schaleJson && schaleJson.filter(info => (info.Id === studentId))[0];
return { json, schale };
}
Loading

1 comment on commit fe10279

@vercel
Copy link

@vercel vercel bot commented on fe10279 Mar 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.