vitium_api/game/components/
char.rs1use super::Pos;
2use crate::game::{level::Level, Attr, Mart, Prof, Race, Skill, Spell};
3use bevy_ecs::component::Component;
4use fe3o4::Id;
5use serde::{Deserialize, Serialize};
6use std::collections::{HashMap, HashSet};
7
8#[derive(Clone, Serialize, Deserialize, Component)]
10#[cfg_attr(target_family = "wasm", derive(tsify_next::Tsify))]
11#[cfg_attr(
12 target_family = "wasm",
13 tsify(into_wasm_abi, from_wasm_abi, large_number_types_as_bigints)
14)]
15pub struct Char {
16 pub name: String,
18 pub descr: String,
20 pub pos: Pos,
22 pub race: Id<Race>,
24 pub prof: Id<Prof>,
26 pub attr: HashMap<Id<Attr>, Level>,
28 pub skill: HashMap<Id<Skill>, Level>,
30 pub mart: HashMap<Id<Mart>, Level>,
32 pub spell: HashMap<Id<Spell>, Level>,
34 pub money: i32,
38}
39
40#[derive(Clone, Serialize, Deserialize, Component)]
42#[cfg_attr(target_family = "wasm", derive(tsify_next::Tsify))]
43#[cfg_attr(
44 target_family = "wasm",
45 tsify(into_wasm_abi, from_wasm_abi, large_number_types_as_bigints)
46)]
47pub struct PlayerChar {
48 pub user: String,
50 pub bg_story: String,
52 pub mods: HashSet<String>,
54}