diff --git a/src/handbook/data/README.md b/src/handbook/data/README.md index 90d1ffe54..9876ad7f5 100644 --- a/src/handbook/data/README.md +++ b/src/handbook/data/README.md @@ -2,8 +2,9 @@ Use Grasscutter's dumpers to generate the data to put here. ## Files Required -- `avatars.json` - `commands.json` +- `avatars.csv` +- `scenes.csv` - `items.csv` # Item Icon Notes diff --git a/src/handbook/src/backend/data.ts b/src/handbook/src/backend/data.ts index 76c74d4dd..456bf6220 100644 --- a/src/handbook/src/backend/data.ts +++ b/src/handbook/src/backend/data.ts @@ -1,16 +1,16 @@ import commands from "@data/commands.json"; import avatars from "@data/avatars.csv"; +import scenes from "@data/scenes.csv"; import items from "@data/items.csv"; -import { Quality, ItemType, ItemCategory } from "@backend/types"; -import type { Command, Avatar, Item } from "@backend/types"; +import { Quality, ItemType, ItemCategory, SceneType } from "@backend/types"; +import type { Command, Avatar, Item, Scene } from "@backend/types"; import { inRange } from "@app/utils"; type AvatarDump = { [key: number]: Avatar }; type CommandDump = { [key: string]: Command }; type TaggedItems = { [key: number]: Item[] }; -type ItemIcons = { [key: number]: string }; /** * @see {@file src/handbook/data/README.md} @@ -97,6 +97,21 @@ export function listAvatars(): Avatar[] { return Object.values(getAvatars()); } +/** + * Fetches and casts all scenes in the file. + */ +export function getScenes(): Scene[] { + return scenes.map((entry) => { + const values = Object.values(entry) as string[]; + const id = parseInt(values[0]); + return { + id, + identifier: values[1], + type: values[2] as SceneType + }; + }); +} + /** * Fetches and casts all items in the file. */ diff --git a/src/handbook/src/backend/types.ts b/src/handbook/src/backend/types.ts index 4b9776b26..cd56e935f 100644 --- a/src/handbook/src/backend/types.ts +++ b/src/handbook/src/backend/types.ts @@ -16,6 +16,12 @@ export type Avatar = { id: number; }; +export type Scene = { + identifier: string; + type: string; + id: number; +}; + export type Item = { id: number; name: string; @@ -70,6 +76,16 @@ export enum ItemType { Furniture = "ITEM_FURNITURE" } +export enum SceneType { + None = "SCENE_NONE", + World = "SCENE_WORLD", + Dungeon = "SCENE_DUNGEON", + Room = "SCENE_ROOM", + HomeWorld = "SCENE_HOME_WORLD", + HomeRoom = "SCENE_HOME_ROOM", + Activity = "SCENE_ACTIVITY" +} + export enum ItemCategory { Constellation, Avatar,