summaryrefslogtreecommitdiff
path: root/src/random_tables.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/random_tables.rs')
-rw-r--r--src/random_tables.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/random_tables.rs b/src/random_tables.rs
index 8bc1e61..d059fd5 100644
--- a/src/random_tables.rs
+++ b/src/random_tables.rs
@@ -1,4 +1,5 @@
use crate::dice;
+use crate::rules::classes::Classes;
use include_dir::{include_dir, Dir};
use serde::Deserialize;
use serde_yaml;
@@ -20,8 +21,9 @@ struct TableRow {
#[derive(Debug, Deserialize)]
struct TableRowStep {
- text: Option<String>,
+ class: Option<String>,
table: Option<String>,
+ text: Option<String>,
}
pub struct RandomTables {
@@ -67,6 +69,13 @@ impl RandomTables {
output_text.push_str(&inner_output);
}
+ if let Some(class_string) = &step.class {
+ let classes = Classes::new().unwrap();
+ let class = classes.class(class_string)
+ .expect("Failed to load class.");
+ output_text.push_str(&*class.name);
+ }
+
output_text.push_str("\n");
}
return output_text.trim().replace("\n", ", ").to_string();