1use crate::prelude::*;
2
3use crate::{
4 abilities::AbilityId, currency::CurrencyId, fighting::FightTemplateId, items::AttributeId,
5};
6
7#[declare]
8pub type EntityTemplateId = Uuid;
9
10#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, Tsify, JsonSchema, CustomType)]
11pub struct EntityAttribute {
12 #[schemars(schema_with = "attribute_link_id_schema")]
13 pub attribute_id: AttributeId,
14 #[schemars(title = "Значение атрибута")]
15 pub value: u64,
16}
17
18#[derive(Debug, serde::Deserialize)]
19pub struct CharacterQuery {
20 pub character_id: String,
21}
22
23#[derive(Clone, Debug, Serialize, Deserialize, Tsify, JsonSchema, CustomType)]
24pub struct EnemyReward {
25 #[schemars(title = "Id валюты награды", schema_with = "currency_link_id_schema")]
26 pub currency_id: CurrencyId,
27 #[schemars(title = "Минимальная награда")]
28 pub from: i64,
29 #[schemars(title = "Максимальная награда")]
30 pub to: i64,
31 #[schemars(
32 title = "Шанс выпадения",
33 description = "Шанс выпадения валюты от 0 до 100"
34 )]
35 pub drop_chance: f64,
36}
37
38impl PartialEq for EnemyReward {
39 fn eq(&self, other: &Self) -> bool {
40 self.currency_id == other.currency_id && self.from == other.from && self.to == other.to
41 }
42}
43
44impl Eq for EnemyReward {}
45
46#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, Tsify, JsonSchema, CustomType)]
47pub struct EntityTemplate {
48 #[schemars(schema_with = "id_schema")]
49 pub id: EntityTemplateId,
50 #[schemars(title = "Имя врага")]
51 pub name: String,
52 #[schemars(title = "Спайн", schema_with = "aa_entity_spine_schema")]
53 pub spine: String,
54 #[schemars(title = "Визуал", schema_with = "asset_unit_spine_skin")]
55 pub spine_skin_path: String,
56 #[schemars(title = "Размер спайна врага")]
57 pub spine_scale: u64,
58 #[schemars(title = "Время каста")]
59 pub cast_time: u64,
60 #[schemars(title = "Атрибуты врага", description = "Набор атрибутов врага")]
61 pub attributes: Vec<EntityAttribute>,
62 #[schemars(
63 title = "Id способностей",
64 description = "Набор id способностей врага",
65 schema_with = "ability_link_id_array_schema"
66 )]
67 pub ability_ids: Vec<AbilityId>,
68 #[schemars(title = "Ширина врага в клетках")]
69 pub width: i8,
70 #[schemars(title = "Награда за убийство врага")]
71 pub rewards: Vec<EnemyReward>,
72}
73
74#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, Tsify, JsonSchema, CustomType)]
75pub struct Chapter {
76 #[schemars(schema_with = "id_schema")]
77 pub id: Uuid,
78 #[schemars(title = "Порядковый номер уровня")]
79 pub level: i64,
80 #[schemars(
81 title = "Набор id битв",
82 description = "Набор битв на уровне",
83 schema_with = "fight_template_link_id_array_schema"
84 )]
85 pub fight_ids: Vec<FightTemplateId>,
86 #[schemars(title = "Название боя")]
87 pub title: i18n::I18nString,
88}
89
90#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, Tsify, JsonSchema)]
91pub struct CharacterLevel {
92 #[schemars(title = "Уровень игрока")]
93 pub level: i64,
94 #[schemars(
95 title = "Минимальный опыт для получения",
96 description = "Минимальный опыт игрока для получения уровня"
97 )]
98 pub required_experience: i64,
99 #[schemars(
100 title = "Базовые аттрибуты игрока на уровне",
101 description = "Базовые аттрибуты игрока, которые выдаются на этом уровне"
102 )]
103 pub attributes: Vec<EntityAttribute>,
104}
105
106#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, Tsify, JsonSchema)]
107pub struct AbilitySlotsLevel {
108 #[schemars(title = "Минимальный уровень главы")]
109 pub from_chapter_level: i64,
110 #[schemars(title = "Сколько слотов абилок открыто на уровне")]
111 pub ability_slots: u64,
112}
113
114#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, Tsify, JsonSchema)]
115pub struct PetSlotsLevel {
116 #[schemars(title = "Минимальный уровень главы")]
117 pub from_chapter_level: i64,
118 #[schemars(title = "Сколько слотов петов открыто на уровне")]
119 pub pet_slots: u64,
120}