2020-05-09 15:41:25 +00:00
|
|
|
use crate::comp;
|
|
|
|
use serde_derive::{Deserialize, Serialize};
|
|
|
|
|
|
|
|
/// The limit on how many characters that a player can have
|
|
|
|
pub const MAX_CHARACTERS_PER_PLAYER: usize = 8;
|
|
|
|
|
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
|
|
|
pub struct Character {
|
|
|
|
pub id: Option<i32>,
|
|
|
|
pub alias: String,
|
|
|
|
pub tool: Option<String>, // TODO: Remove once we start persisting inventories
|
|
|
|
}
|
|
|
|
|
2020-05-11 10:06:53 +00:00
|
|
|
/// Represents a single character item in the character list presented during
|
|
|
|
/// character selection. This is a subset of the full character data used for
|
|
|
|
/// presentation purposes.
|
2020-05-09 15:41:25 +00:00
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
|
|
|
pub struct CharacterItem {
|
|
|
|
pub character: Character,
|
2020-05-11 10:06:53 +00:00
|
|
|
pub body: comp::Body,
|
|
|
|
pub level: usize,
|
|
|
|
}
|
|
|
|
|
|
|
|
/// The full representation of the data we store in the database for each
|
|
|
|
/// character
|
|
|
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
|
|
|
pub struct CharacterData {
|
2020-05-09 15:41:25 +00:00
|
|
|
pub body: comp::Body,
|
2020-04-20 08:44:29 +00:00
|
|
|
pub stats: comp::Stats,
|
2020-05-09 15:41:25 +00:00
|
|
|
}
|