1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
use serde::Deserialize;

#[derive(Debug, Deserialize)]
pub struct Characters {
    #[serde(rename = "avatars")]
    pub characters: Vec<GenshinCharacter>,
    pub role: GenshinSimplyRole,
}

#[derive(Debug, Deserialize)]
pub struct GenshinCharacter {
    pub id: u32,
    pub image: String,
    pub icon: String,
    pub name: String,
    pub element: String,
    pub fetter: u8,
    pub level: u8,
    pub rarity: u8,
    pub weapon: GenshinWeapon,
    pub reliquaries: Vec<GenshinRelic>,
    pub constellations: Vec<GenshinConstellation>,
    pub actived_constellation_num: u8,
    pub costumes: Option<Vec<GenshinCostume>>,
    pub external: serde_json::Value,
}

#[derive(Debug, Deserialize)]
pub struct GenshinWeapon {
    pub id: u32,
    pub name: String,
    pub icon: String,
    pub r#type: u8,
    pub rarity: u8,
    pub level: u8,
    pub promote_level: u8,
    pub type_name: String,
    pub desc: String,
    pub affix_level: u8,
}

#[derive(Debug, Deserialize)]
pub struct GenshinRelic {
    pub id: u32,
    pub name: String,
    pub icon: String,
    pub pos: u8,
    pub rarity: u8,
    pub level: u8,
    pub set: GenshinRelicsSet,
    pub pos_name: String,
}

#[derive(Debug, Deserialize)]
pub struct GenshinRelicsSet {
    pub id: u32,
    pub name: String,
    pub affixes: Vec<GenshinRelicsAffixes>,
}

#[derive(Debug, Deserialize)]
pub struct GenshinRelicsAffixes {
    #[serde(rename = "activation_number")]
    pub activation_num: u8,
    pub effect: String,
}

#[derive(Debug, Deserialize)]
pub struct GenshinConstellation {
    pub id: u16,
    pub name: String,
    pub icon: String,
    pub effect: String,
    pub is_actived: bool,
    pub pos: u8,
}
impl GenshinConstellation {
    // pub fn extract_text(&self) -> String {
    //     self.effect.replace("")
    // }
    // I will code rid of "<color=#~~~~~~>"
}

#[derive(Debug, Deserialize)]
pub struct GenshinCostume {
    pub id: u32,
    pub name: String,
    pub icon: String,
}

#[derive(Debug, Deserialize)]
pub struct GenshinSimplyRole {
    #[serde(rename = "AvatarUrl")]
    pub avatar_url: String,
    pub nickname: String,
    pub region: String,
    pub level: u8,
}