Browse Source

properly load monster_dar.toml

pbs
jake 5 years ago
parent
commit
f1841f6f7f
  1. 12
      src/ship/drops/mod.rs

12
src/ship/drops/mod.rs

@ -113,18 +113,10 @@ pub struct DropTable<R: Rng + SeedableRng> {
impl<R: Rng + SeedableRng> DropTable<R> { impl<R: Rng + SeedableRng> DropTable<R> {
pub fn new(episode: Episode, difficulty: Difficulty, section_id: SectionID) -> DropTable<R> { pub fn new(episode: Episode, difficulty: Difficulty, section_id: SectionID) -> DropTable<R> {
let mut path = PathBuf::from("data/drops/");
path.push(episode.to_string());
path.push(difficulty.to_string().to_lowercase());
path.push(section_id.to_string().to_lowercase());
path.push("grind_rate.toml");
let mut f = File::open(path).unwrap();
let mut s = String::new();
f.read_to_string(&mut s);
let monster_stats = toml::from_str(&s).unwrap();
let monster_stats: HashMap<String, MonsterDropStats> = load_data_file(episode, difficulty, section_id, "monster_dar.toml");
DropTable { DropTable {
monster_stats: monster_stats,
monster_stats: monster_stats.into_iter().map(|(m, s)| (m.parse().unwrap(), s)).collect(),
rare_table: RareDropTable::new(episode, difficulty, section_id), rare_table: RareDropTable::new(episode, difficulty, section_id),
weapon_table: GenericWeaponTable::new(episode, difficulty, section_id), weapon_table: GenericWeaponTable::new(episode, difficulty, section_id),
armor_table: GenericArmorTable::new(episode, difficulty, section_id), armor_table: GenericArmorTable::new(episode, difficulty, section_id),

Loading…
Cancel
Save