essences/
class.rs

1use super::{abilities, bundles, currency::CurrencyUnit, game};
2
3use crate::prelude::*;
4use strum_macros::{Display, EnumIter, EnumString};
5
6#[derive(
7    Debug,
8    Clone,
9    Copy,
10    EnumString,
11    Display,
12    Deserialize,
13    Serialize,
14    Hash,
15    Eq,
16    PartialEq,
17    EnumIter,
18    Default,
19    JsonSchema,
20    Tsify,
21)]
22#[tsify(namespace)]
23pub enum ClassTier {
24    #[default]
25    S,
26    A,
27    B,
28    C,
29}
30
31#[derive(
32    PartialEq, Eq, Serialize, Deserialize, Default, Debug, Clone, JsonSchema, Tsify, CustomType,
33)]
34pub struct ClassTransition {
35    #[schemars(schema_with = "class_id_schema")]
36    pub class_id: uuid::Uuid,
37
38    #[schemars(title = "Стоимость перехода")]
39    pub cost: Vec<CurrencyUnit>,
40}
41
42#[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq, JsonSchema)]
43pub enum ClassAttribute {
44    EntityAttribute(game::EntityAttribute),
45    ScriptAttributes(String),
46}
47
48#[declare]
49pub type ClassId = Uuid;
50
51#[derive(
52    PartialEq, Eq, Serialize, Deserialize, Default, Debug, Clone, JsonSchema, Tsify, CustomType,
53)]
54pub struct Class {
55    #[schemars(schema_with = "id_schema")]
56    pub id: ClassId,
57
58    #[schemars(title = "Название класса")]
59    pub name: i18n::I18nString,
60
61    #[schemars(title = "Описание класса")]
62    pub description: i18n::I18nString,
63
64    #[schemars(title = "URL иконки класса", schema_with = "webp_url_schema")]
65    pub icon_url: String,
66
67    #[schemars(
68        title = "URL фона класса для Hero Screen",
69        schema_with = "webp_url_schema"
70    )]
71    pub background_image_url: String,
72
73    #[schemars(title = "Спайн класса", schema_with = "spine_schema")]
74    pub character_asset: String,
75
76    #[schemars(title = "Время каста")]
77    pub cast_time: u64,
78
79    #[schemars(title = "Спайн класса (Unity)", schema_with = "aa_entity_spine_schema")]
80    pub spine: String,
81
82    #[schemars(
83        title = "Базовые способности игрока",
84        description = "Способности, которыми игрок безусловно обладает в бою.",
85        schema_with = "ability_link_id_array_schema"
86    )]
87    pub basic_abilities: Vec<abilities::AbilityId>,
88
89    #[schemars(
90        title = "Подарочнйый набор новичка",
91        schema_with = "option_bundle_id_schema"
92    )]
93    pub starter_bundle_id: Option<bundles::BundleId>,
94
95    #[schemars(title = "Базовые атрибуты игрока")]
96    pub attributes: Vec<ClassAttribute>,
97
98    #[schemars(
99        title = "Id редкости этого класса",
100        schema_with = "ability_rarity_link_id_schema"
101    )]
102    pub ability_rarity_id: abilities::AbilityRarityId,
103
104    #[schemars(title = "Тир класса")]
105    pub tier: ClassTier,
106
107    #[schemars(title = "Доступные смены класса")]
108    pub transitions: Vec<ClassTransition>,
109}