terra-plr

Crates.ioterra-plr
lib.rsterra-plr
version0.2.1
sourcesrc
created_at2024-04-21 19:28:02.814123
updated_at2024-10-17 08:30:07.552126
descriptionTerraria player parser
homepage
repositoryhttps://gitlab.com/terra-conv/terra-plr
max_upload_size
id1215624
size109,522
(Fili-pk)

documentation

README

terra-plr

Library for reading and modifying terraria player files.

Examples

Change player max life to 300

let mut player = Player::read_player(File::open("player.plr")?)?;
player.max_life = 300;
player.write_player(File::create("player.plr")?, *SUPPORTED_VERSIONS.end())?;

Set 999 dirt items to first inventory slot

let mut player = Player::read_player(File::open("player.plr")?)?;
player.inventory[0][0] = Some(InventorySlot {
    item: terra_items::Item::DirtBlock,
    prefix: None,
    count: PositiveI32::new(999).expect("In bounds"),
    is_favorite: false,
});

player.write_player(File::create("player.plr")?, *SUPPORTED_VERSIONS.end())?;

Print player name

let mut player = Player::read_player(File::open("player.plr")?)?;
println!("{}", player.name);

License

AGPL v3+ © Filip K.

Commit count: 22

cargo fmt