2 changed files with 88 additions and 0 deletions
@ -0,0 +1,87 @@ |
|||
use serde::{Serialize, Deserialize};
|
|||
|
|||
|
|||
use crate::entity::character::{CharacterEntityId, SectionID};
|
|||
use crate::ship::room::{Episode, Difficulty, RoomMode};
|
|||
|
|||
|
|||
#[derive(PartialEq, Eq, Copy, Clone, Debug, Hash, PartialOrd, Ord, Serialize, Deserialize)]
|
|||
pub struct RoomEntityId(pub u32);
|
|||
|
|||
|
|||
#[derive(Debug, Copy, Clone)]
|
|||
pub enum RoomEntityMode {
|
|||
Single,
|
|||
Multi,
|
|||
Challenge,
|
|||
Battle,
|
|||
}
|
|||
|
|||
|
|||
#[derive(Debug, Clone)]
|
|||
pub struct RoomEntity {
|
|||
pub id: RoomEntityId,
|
|||
pub name: String,
|
|||
pub section_id: SectionID,
|
|||
pub mode: RoomEntityMode,
|
|||
pub episode: Episode,
|
|||
pub difficulty: Difficulty,
|
|||
}
|
|||
|
|||
|
|||
#[derive(Debug, Clone)]
|
|||
pub struct NewRoomEntity {
|
|||
pub name: String,
|
|||
pub section_id: SectionID,
|
|||
pub mode: RoomEntityMode,
|
|||
pub episode: Episode,
|
|||
pub difficulty: Difficulty,
|
|||
}
|
|||
|
|||
impl NewRoomEntity {
|
|||
fn new(name: String, section_id: SectionID, mode: RoomMode) -> NewRoomEntity {
|
|||
NewRoomEntity {
|
|||
name: name,
|
|||
section_id: section_id,
|
|||
mode: match mode {
|
|||
RoomMode::Single {..} => RoomEntityMode::Single,
|
|||
RoomMode::Multi {..} => RoomEntityMode::Multi,
|
|||
RoomMode::Challenge {..} => RoomEntityMode::Challenge,
|
|||
RoomMode::Battle {..} => RoomEntityMode::Battle,
|
|||
},
|
|||
episode: match mode {
|
|||
RoomMode::Single { episode, .. } => episode,
|
|||
RoomMode::Multi { episode, ..} => episode ,
|
|||
RoomMode::Challenge { episode, ..} => episode,
|
|||
RoomMode::Battle { episode, ..} => episode,
|
|||
},
|
|||
difficulty: match mode {
|
|||
RoomMode::Single { difficulty, .. } => difficulty,
|
|||
RoomMode::Multi { difficulty, ..} => difficulty ,
|
|||
RoomMode::Challenge {..} => Difficulty::Normal,
|
|||
RoomMode::Battle { difficulty, ..} => difficulty,
|
|||
},
|
|||
}
|
|||
}
|
|||
}
|
|||
|
|||
|
|||
#[derive(Debug, Copy, Clone)]
|
|||
pub enum RoomNote {
|
|||
Create {
|
|||
character_id: CharacterEntityId,
|
|||
},
|
|||
PlayerJoin {
|
|||
character_id: CharacterEntityId,
|
|||
},
|
|||
PlayerLeave {
|
|||
character_id: CharacterEntityId,
|
|||
},
|
|||
QuestStart {
|
|||
// quest id
|
|||
},
|
|||
QuestComplete {
|
|||
// quest id
|
|||
},
|
|||
|
|||
}
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue