luminol_data/rmxp/
class.rs

1// Copyright (C) 2024 Melody Madeline Lyons
2//
3// This file is part of Luminol.
4//
5// Luminol is free software: you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// Luminol is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with Luminol.  If not, see <http://www.gnu.org/licenses/>.
17pub use crate::{id_alox, id_serde, id_vec_alox, id_vec_serde, Table1};
18
19#[derive(Default, Debug, serde::Deserialize, serde::Serialize)]
20#[derive(alox_48::Deserialize, alox_48::Serialize)]
21#[marshal(class = "RPG::Class")]
22pub struct Class {
23    #[serde(with = "id_serde")]
24    #[marshal(with = "id_alox")]
25    pub id: usize,
26    pub name: String,
27    pub position: Position,
28    #[serde(with = "id_vec_serde")]
29    #[marshal(with = "id_vec_alox")]
30    pub weapon_set: Vec<usize>,
31    #[serde(with = "id_vec_serde")]
32    #[marshal(with = "id_vec_alox")]
33    pub armor_set: Vec<usize>,
34    pub element_ranks: Table1,
35    pub state_ranks: Table1,
36    pub learnings: Vec<Learning>,
37}
38
39#[derive(Default, Debug, serde::Deserialize, serde::Serialize)]
40#[derive(alox_48::Deserialize, alox_48::Serialize)]
41#[marshal(class = "RPG::Class::Learning")]
42pub struct Learning {
43    pub level: i32,
44    #[serde(with = "id_serde")]
45    #[marshal(with = "id_alox")]
46    pub skill_id: usize,
47}
48
49#[derive(Clone, Copy, Debug, Eq, PartialEq, Default)]
50#[derive(
51    num_enum::TryFromPrimitive,
52    num_enum::IntoPrimitive,
53    strum::Display,
54    strum::EnumIter
55)]
56#[derive(serde::Deserialize, serde::Serialize)]
57#[derive(alox_48::Deserialize, alox_48::Serialize)]
58#[repr(u8)]
59#[serde(into = "u8")]
60#[serde(try_from = "u8")]
61#[marshal(into = "u8")]
62#[marshal(try_from = "u8")]
63pub enum Position {
64    #[default]
65    Front = 0,
66    Middle = 1,
67    Rear = 2,
68}