feat: Basic structs

- Added Account struct
- Added Config struct
- Added empty Map struct
- Added Quest struct
This commit is contained in:
Alexey 2025-11-28 14:06:12 +03:00
commit 4e3c137f8b
8 changed files with 441 additions and 0 deletions

62
src/quest/mod.rs Normal file
View file

@ -0,0 +1,62 @@
//! Module for handling text-based quests and user answers
use serde::{ Serialize, Deserialize };
/// Difficulty of the quest
#[derive(Serialize, Deserialize)]
pub enum QuestDifficulty {
/// Easy quest
Easy,
/// Normal quest
Normal,
/// Hard quest
Hard,
/// Special case of hard quests. Also is a default value for enum
Secret
}
impl Default for QuestDifficulty {
fn default() -> Self {
QuestDifficulty::Secret
}
}
fn default_name() -> String {
"Slay the dragon".to_string()
}
fn default_description() -> String {
"Just do it in any way".to_string()
}
fn default_answer() -> String {
"Attachment should show that the dragon was slain".to_string()
}
/// Quest struct
#[derive(Serialize, Deserialize)]
pub struct Quest {
/// Quest identifier
#[serde(default)]
pub id: u16,
/// Difficulty of this quest
#[serde(default)]
pub difficulty: QuestDifficulty,
/// Reward for the quest
#[serde(default)]
pub reward: u32,
/// Visible quest name
#[serde(default = "default_name")]
pub name: String,
/// Visible quest description
#[serde(default = "default_description")]
pub description: String,
/// Quest answer, available for admins
#[serde(default = "default_answer")]
pub answer: String,
}