Update on reverse-engineering of player Attributes and Modifiers

This commit is contained in:
mykola2312 2023-09-08 18:07:05 +03:00
parent 3108ad11bb
commit 06ebdc6062
3 changed files with 44 additions and 2 deletions

10
attribs.txt Normal file
View file

@ -0,0 +1,10 @@
7 * 4 // special, int
11 * 4 // xp/rank/age, int
26 * 4 // stats
18 * 4 // skils
18 * 1 // skill tags
27 * 1 ? // trais, bool
11 * 1 ? // type, bool
101 * 4 ? // perks, int
10 * 4 ? // unk ?
10 * 4 ? // addictions, int

View file

@ -90,4 +90,23 @@ esh data types
int32_t bottom
21 - FString
25 - FString
25 - FString
Attributes - player stats and skills
Modifiers - same as Attributes but applying new values to Attributes
Attribute - ESH
int levSincePerk
bool Binary
esbin
u32 section_size
<attribs>
int stats[7]
int traits[11]
int derived[26]
int skills[18]
bool skill_tags[18]
bool opt_traits[27]
bool type[11]
int perks[111]
int addictions[10]

View file

@ -12,6 +12,7 @@ use deflate::deflate_bytes_zlib;
use inflate::inflate_bytes_zlib;
use std::path::Path;
use super::esh::{ESH, ESHValue};
pub struct World {
pub offset: usize,
@ -40,7 +41,19 @@ impl World {
for (name, value) in &esh.props {
println!("{} {}", name, value);
}
self.entlist.dump_to_entfile(ent, Path::new("D:\\actor.ent"))?;
//self.entlist.dump_to_entfile(ent, Path::new("D:\\actor.ent"))?;
println!("");
if let ESHValue::Binary(attributes) = &esh.props["Attributes"] {
let raw = Raw { offset: 0, size: attributes.len(), mem: attributes.to_vec() };
let mut rd = ReadStream::new(&raw, 0);
let size = rd.read_u32()?;
let attrs_esh: ESH = rd.read()?;
for (name, value) in &attrs_esh.props {
println!("{} {}", name, value);
}
}
Ok(())
}