site: start of basic site using astro, character select implemented
This commit is contained in:
27
site/data/character.ts
Normal file
27
site/data/character.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import globalJSON from "../../global/character.json";
|
||||
|
||||
/**
|
||||
* Character definitions.
|
||||
*/
|
||||
export interface Character {
|
||||
/**
|
||||
* Character ID.
|
||||
*/
|
||||
chara_id: number;
|
||||
/**
|
||||
* Regional name of the character.
|
||||
* E.g., Special Week for Global, or スペシャルウィーク for JP.
|
||||
*/
|
||||
name: string;
|
||||
}
|
||||
|
||||
const global = globalJSON as Character[];
|
||||
|
||||
export const character = {
|
||||
global,
|
||||
}
|
||||
|
||||
export function searchChara(charas: Character[], id: Character["chara_id"]): Character | undefined {
|
||||
// TODO(zephyr): binary search
|
||||
return charas.find((c) => c.chara_id === id);
|
||||
}
|
||||
Reference in New Issue
Block a user