2020-06-16 01:00:32 +00:00
|
|
|
//! Structs representing a playable Character
|
|
|
|
|
2020-05-09 15:41:25 +00:00
|
|
|
use crate::comp;
|
2020-07-06 14:23:08 +00:00
|
|
|
use serde::{Deserialize, Serialize};
|
2020-05-09 15:41:25 +00:00
|
|
|
|
|
|
|
/// The limit on how many characters that a player can have
|
|
|
|
pub const MAX_CHARACTERS_PER_PLAYER: usize = 8;
|
2020-09-17 23:02:14 +00:00
|
|
|
pub type CharacterId = i64;
|
2020-06-16 01:00:32 +00:00
|
|
|
|
|
|
|
/// The minimum character data we need to create a new character on the server.
|
|
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
2020-05-09 15:41:25 +00:00
|
|
|
pub struct Character {
|
2020-09-17 23:02:14 +00:00
|
|
|
pub id: Option<CharacterId>,
|
2020-05-09 15:41:25 +00:00
|
|
|
pub alias: String,
|
|
|
|
}
|
|
|
|
|
2020-06-16 01:00:32 +00:00
|
|
|
/// Data needed to render a single character item in the character list
|
|
|
|
/// presented during character selection.
|
|
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
2020-05-09 15:41:25 +00:00
|
|
|
pub struct CharacterItem {
|
|
|
|
pub character: Character,
|
2020-05-11 10:06:53 +00:00
|
|
|
pub body: comp::Body,
|
|
|
|
pub level: usize,
|
2020-06-04 11:44:33 +00:00
|
|
|
pub loadout: comp::Loadout,
|
2020-05-11 10:06:53 +00:00
|
|
|
}
|