Adds boilerplate for monsters

This commit is contained in:
Dandaedre 2026-07-15 02:12:24 +02:00
parent 707dc2e223
commit 529f90b93e
Signed by: Dandaedre
GPG Key ID: 440C6592E8A26D99
8 changed files with 91 additions and 1 deletions

View File

@ -41,6 +41,7 @@ fast_class = {path = "./crates/fast_class"}
formatter = {path = "./crates/formatter"}
weaponry = {path = "./crates/weaponry"}
more_fields = {path = "./crates/more_fields"}
monsters = {path = "./crates/monsters"}
anyhow = "1.0.103"
toml = "1.1.3"

View File

@ -8,7 +8,8 @@ use config::{
fast_tables::FastTableConfig,
formatter::FormatterConfig,
graph::GraphConfig,
make::{MakeTargets, VerboseLevel, HELP_BLOCK_SELECTION},
make::{HELP_BLOCK_SELECTION, MakeTargets, VerboseLevel},
monsters::MonsterConfig,
statsolver::StatConfig,
tablegen::{Craft, TableArgs},
};
@ -48,6 +49,8 @@ pub enum Commands {
Analysis(AnalysisConfig),
/// Better Generation
BetterGen(FastTableConfig),
/// Monster database handling
Monsters(MonsterConfig),
}
#[derive(Debug, Args)]

View File

@ -12,5 +12,6 @@ pub mod fast_tables;
pub mod formatter;
pub mod graph;
pub mod make;
pub mod monsters;
pub mod statsolver;
pub mod tablegen;

View File

@ -0,0 +1,28 @@
// Workspace: config
// File: config/src/monsters.rs
//! The inner config for monster module
//!
use clap::{Args, ValueEnum};
#[derive(Args, Debug, Clone)]
/// The configuration struct for the Graph
pub struct MonsterConfig {
/// Special target
pub target: MonsterTarget,
/// Clean all the artefacts (including generated images)
#[arg(short, long)]
pub all: bool,
}
#[derive(ValueEnum, Debug, Clone)]
/// The action to execute
pub enum MonsterTarget {
/// Clean the generated monsters directory
Clean,
/// Generate the monster list
Export,
/// Show useful data
Show,
}

View File

@ -0,0 +1,25 @@
[package]
name = "monsters"
edition = "2024"
version.workspace = true
[dependencies]
config = {workspace = true}
cli_parser = {workspace = true}
more_fields = {workspace = true}
anyhow = {workspace = true}
# regex = {workspace = true}
# csv = {workspace = true}
# serde = {workspace = true}
# comfy-table = "7.2.2"
# probability = "0.20.3"
rusqlite = { version = "0.40.1" } # , features = ["bundled"]
serde_rusqlite = "0.43.0"
# serde_json = { version = "1.0.150", features = ["alloc"] }
strum = { version = "0.28.0", features = ["derive"] }
# charming = { version = "0.4.0", features = [] }
[dev-dependencies]
regex = {workspace = true}
pretty_assertions = {workspace = true}
clap = {workspace = true}

View File

@ -0,0 +1,29 @@
//! # Monsters Module
//!
//! The `monsters` crate orchestrates the processing of *ravenous* monster data.
//!
//! It can:
//! * **Parse** raw monster definitions into ergonomic Rust structs.
//! * Perform **balancing** calculations to keep encounters fair.
//! * **Show** concise, human‑readable summaries in the terminal.
//! * **Export** processed data as LaTeX/TeX for printing or further editing.
//!
//! All functionality is exposed through a single entry point:
//! [`monsters_dispatch`]. The dispatcher interprets command‑line arguments
//! (`MonsterConfig`) and delegates to the appropriate sub‑routine (clean, export or show).
//!
use anyhow::Result;
use cli_parser::Config;
use config::monsters::MonsterConfig;
/// Dispatches the chosen monster action.
pub fn monsters_dispatch(args: &MonsterConfig, _config: &Config) -> Result<()> {
use config::monsters::MonsterTarget;
match args.target {
MonsterTarget::Clean => todo!("implement cleaning logic"),
MonsterTarget::Export => todo!("implement export logic"),
MonsterTarget::Show => todo!("implement show logic"),
}
}

View File

@ -17,6 +17,7 @@ clap = {workspace = true}
tokio = {workspace = true}
formatter = {workspace = true}
weaponry = {workspace = true}
monsters = {workspace = true}
[package.metadata.cargo-machete]
ignored = ["tokio"]

View File

@ -10,6 +10,7 @@ use fast_class::make_better_gen;
use formatter::format_file;
use graphs::make_graphs;
use make::make_pdf;
use monsters::monsters_dispatch;
use stats::stat_solver;
use tablegen::table_gen;
use weaponry::analysis::launch_analysis;
@ -37,6 +38,7 @@ fn main() -> Result<()> {
Commands::Format(args) => format_file(&args, &config),
Commands::Analysis(args) => Ok(launch_analysis(&args, &config)?), // Not using anyhow but a custom error
Commands::BetterGen(args) => make_better_gen(&args, &config),
Commands::Monsters(args) => monsters_dispatch(&args, &config),
}
}