pub struct ChangeSet { /* private fields */ }Expand description
Represents a set of changes to apply to a save file
This is useful for batching multiple changes together and for tracking modifications in a GUI before applying them.
Implementations§
Source§impl ChangeSet
impl ChangeSet
Sourcepub fn add_parsed(&mut self, path: String, value_str: &str)
pub fn add_parsed(&mut self, path: String, value_str: &str)
Add a change with a string value (auto-parsed)
Sourcepub fn add_raw(&mut self, path: String, yaml_str: &str) -> Result<(), SaveError>
pub fn add_raw(&mut self, path: String, yaml_str: &str) -> Result<(), SaveError>
Add a raw YAML change from a string (for complex/unknown structures)
Sourcepub fn has_change(&self, path: &str) -> bool
pub fn has_change(&self, path: &str) -> bool
Check if a specific path has been modified
Sourcepub fn get_change(&self, path: &str) -> Option<&Value>
pub fn get_change(&self, path: &str) -> Option<&Value>
Get the pending change for a path, if any
Sourcepub fn apply(&self, save: &mut SaveFile) -> Result<(), SaveError>
pub fn apply(&self, save: &mut SaveFile) -> Result<(), SaveError>
Apply all changes to a SaveFile
Sourcepub fn set_character_name(&mut self, name: &str)
pub fn set_character_name(&mut self, name: &str)
Convenience methods for common operations
Set character name
Sourcepub fn set_eridium(&mut self, amount: u64)
pub fn set_eridium(&mut self, amount: u64)
Set eridium amount
Sourcepub fn set_character_xp(&mut self, xp: u64)
pub fn set_character_xp(&mut self, xp: u64)
Set character XP
Sourcepub fn set_specialization_xp(&mut self, xp: u64)
pub fn set_specialization_xp(&mut self, xp: u64)
Set specialization XP
Sourcepub fn add_backpack_item(&mut self, slot: u8, serial: &str, flags: StateFlags)
pub fn add_backpack_item(&mut self, slot: u8, serial: &str, flags: StateFlags)
Add an item to a backpack slot.
§Arguments
slot- Backpack slot number (0-22 typically)serial- Item serial string (e.g., “@Ugr$ZCm/…”)flags- State flags for the item
§Example
use bl4::{ChangeSet, StateFlags};
let mut changes = ChangeSet::new();
changes.add_backpack_item(0, "@Ugr$ZCm/...", StateFlags::backpack());Sourcepub fn set_backpack_flags(&mut self, slot: u8, flags: StateFlags)
pub fn set_backpack_flags(&mut self, slot: u8, flags: StateFlags)
Set state_flags on an existing backpack item.
Sourcepub fn set_favorite(&mut self, slot: u8, value: bool)
pub fn set_favorite(&mut self, slot: u8, value: bool)
Set or clear the favorite flag on a backpack item.
Sourcepub fn set_junk(&mut self, slot: u8, value: bool)
pub fn set_junk(&mut self, slot: u8, value: bool)
Set or clear the junk flag on a backpack item.
Sourcepub fn set_label1(&mut self, slot: u8, value: bool)
pub fn set_label1(&mut self, slot: u8, value: bool)
Set or clear label 1 on a backpack item.
Sourcepub fn set_label2(&mut self, slot: u8, value: bool)
pub fn set_label2(&mut self, slot: u8, value: bool)
Set or clear label 2 on a backpack item.
Sourcepub fn set_label3(&mut self, slot: u8, value: bool)
pub fn set_label3(&mut self, slot: u8, value: bool)
Set or clear label 3 on a backpack item.
Sourcepub fn set_label4(&mut self, slot: u8, value: bool)
pub fn set_label4(&mut self, slot: u8, value: bool)
Set or clear label 4 on a backpack item.
Sourcepub fn add_bank_item(&mut self, slot: u16, serial: &str, flags: StateFlags)
pub fn add_bank_item(&mut self, slot: u16, serial: &str, flags: StateFlags)
Add an item to a bank slot.
Note: Bank items are stored in profile.sav, not character saves.
§Arguments
slot- Bank slot numberserial- Item serial stringflags- State flags for the item
Sourcepub fn set_bank_flags(&mut self, slot: u16, flags: StateFlags)
pub fn set_bank_flags(&mut self, slot: u16, flags: StateFlags)
Set state_flags on an existing bank item.
Sourcepub fn equip_item(&mut self, slot: u8, serial: &str)
pub fn equip_item(&mut self, slot: u8, serial: &str)
Equip an item to a slot.
This adds the item to equipped_inventory. The item should also exist in the backpack with matching flags.
§Arguments
slot- Equipped slot (0-3 weapons, 4 shield, 5 grenade, 6+ gear)serial- Item serial string
Sourcepub fn unequip_slot(&mut self, slot: u8)
pub fn unequip_slot(&mut self, slot: u8)
Clear an equipped slot (unequip item).