1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
use serde::{Deserialize, Serialize};
use crate::core::character_definition::CategoryId;
use crate::core::word_entry::WordEntry;
#[derive(Serialize, Deserialize, Clone)]
pub struct UnknownDictionary {
pub category_references: Vec<Vec<u32>>,
pub costs: Vec<WordEntry>,
}
impl UnknownDictionary {
pub fn load(unknown_data: &[u8]) -> UnknownDictionary {
bincode::deserialize(unknown_data).unwrap()
}
pub fn word_entry(&self, word_id: u32) -> WordEntry {
self.costs[word_id as usize]
}
pub fn lookup_word_ids(&self, category_id: CategoryId) -> &[u32] {
&self.category_references[category_id.0][..]
}
}
#[cfg(test)]
mod tests {
}