world¶
Module containing subclasses of Pack which together can parse a complete Terraria world save file.
Other than PackWorld, it contains a submodule for each section of the world file:
world¶
Submodule containing the class PackWorld itself.
- class lihzahrd.terraria.world.world.PackWorld(file_metadata: FileMetadata, section_addresses: WorldSections, frame_important: WorldFrameImportant, unknown_file_metadata_bytes: PackUnknown, header: WorldHeader, unknown_header_bytes: PackUnknown, tiles: WorldTiles, unknown_tiles_bytes: PackUnknown, chests: WorldChestsCollection, unknown_chests_bytes: PackUnknown, signs: WorldSignsCollection, unknown_signs_bytes: PackUnknown, characters: WorldCharacters, unknown_npcs_bytes: PackUnknown, tile_entities: TileEntitiesCollection, unknown_tile_entities_bytes: PackUnknown, pressure_plates: WorldWeightedPressurePlatesCollection, unknown_pressure_plates_bytes: PackUnknown, rooms: RoomsCollection, unknown_rooms_bytes: PackUnknown, bestiary: Bestiary, unknown_bestiary_bytes: PackUnknown, journey: JourneySettingsCollection, unknown_journey_bytes: PackUnknown, footer: WorldFooter, unknown_footer_bytes: PackUnknown)¶
Packwhich represents a Terraria world save file in its totality.World save files are split in sections; this class represents each section with a separate
Pack.Danger
Denial-of-service vector: Maliciously structured world files may cause
readandwriteto block for a very, very long time. Only load world files you trust!- Parameters:
debug_skip_tiles – Skip reading or writing
tiles, and read the whole section tounknown_tiles_bytesinstead.tile_cache_path – Instead of reading
tiles, if a file at the given path exists, load them from there, and read the section tounknown_tiles_bytesinstead. Otherwise, readtilesas normal, but additionally save the read data in an efficient (but large) format as a file at the given path.
- file_metadata: FileMetadata¶
The file metadata header, stopping right before the list of pointers to the various sections.
- sections: WorldSections¶
Pointers to the byte offsets where the various sections of the save file start.
Warning
Automatically overwritten with the correct values once
write()is called.
- frame_important: WorldFrameImportant¶
Array describing which block IDs have been written as FrameImportant.
- unknown_file_metadata_bytes: PackUnknown¶
Bytes between
frame_importantandheader.
- header: WorldHeader¶
The world metadata header.
Contains most important information about the game’s progress, like which NPCs have been rescued and which bosses have been defeated.
- unknown_header_bytes: PackUnknown¶
- tiles: WorldTiles¶
The world’s tile matrix.
- unknown_tiles_bytes: PackUnknown¶
- chests: WorldChestsCollection¶
Collection of all the chests in the world and their contents.
- unknown_chests_bytes: PackUnknown¶
- signs: WorldSignsCollection¶
Collection of all the signs in the world and their text.
- unknown_signs_bytes: PackUnknown¶
Bytes between
signsandcharacters.
- characters: WorldCharacters¶
Collection of all the characters (monsters, critters, and NPCs) in the world and their locations.
- unknown_characters_bytes: PackUnknown¶
Bytes between
charactersandtile_entities.
- tile_entities: TileEntitiesCollection¶
Collection of all the tile entities (mannequins, hat racks, …) in the world and their locations and metadata.
- unknown_tile_entities_bytes: PackUnknown¶
Bytes between
tile_entitiesandpressure_plates.
- pressure_plates: WorldWeightedPressurePlatesCollection¶
Collection of all the weighted pressure plates in the world and their positions.
- unknown_pressure_plates_bytes: PackUnknown¶
Bytes between
pressure_platesandrooms.
- rooms: RoomsCollection¶
Collection of all the assignments of rooms to NPCs.
- unknown_rooms_bytes: PackUnknown¶
- unknown_bestiary_bytes: PackUnknown¶
- journey: JourneySettingsCollection¶
Current configuration of Journey mode powers.
- unknown_journey_bytes: PackUnknown¶
Extra validation data for the world.
Bytes after
footer, but before the end of the file.