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
36
37
38
39
40
41
42
43
44
45
46
47
//! Read and write Diablo 2 save files: `.d2s` character saves and `.d2i` shared stash files.
//!
//! Supports the original Lord of Destruction format (version 96) and Diablo 2
//! Resurrected formats (versions 97-105), including conversion between them.
//! Reading and writing an unmodified file produces byte-identical output.
//!
//! ```no_run
//! use d2s::{D2Save, StatId};
//!
//! # fn main() -> d2s::Result<()> {
//! let bytes = std::fs::read("MyCharacter.d2s")?;
//! let mut save = D2Save::from_bytes(&bytes)?;
//! println!("{} (level {})", save.name(), save.character.level);
//!
//! save.stats.set(StatId::STRENGTH, 200);
//! for item in &save.items {
//! println!("{} {:?}", item.code, item.quality);
//! }
//!
//! std::fs::write("MyCharacter.d2s", save.to_bytes()?)?;
//! # Ok(())
//! # }
//! ```
//!
//! Parsing items requires game data (bit widths of stats, item classifications).
//! The data for versions 96, 97, 99 and 105 is embedded (feature `embedded-data`,
//! enabled by default); modded games can load their own .txt files with
//! [`TxtData::from_dir`] and use the `*_with` methods.
pub use ;
pub use *;
pub use ;
pub use *;
pub use StatId;