dayz-dev-tools
Tim Jensen
Mar 26, 2022
CONTENTS:
1 Installation 3
2 Commands 5
2.1 guid. . . 5
2.2 unpbo . . . 5
2.3 run-server. . . 6
3 API Reference 11 3.1 Extracting PBO Content . . . 11
3.2 DayZ GUIDs . . . 11
3.3 Public Key Management . . . 12
3.4 Launch Settings . . . 12
3.5 Listing PBO Content . . . 14
3.6 PBO File . . . 14
3.7 PBO Reader . . . 15
3.8 Script Logs . . . 16
3.9 Server Configuration . . . 16
4 Indices and tables 19
Python Module Index 21
Index 23
dayz-dev-tools
DayZ Dev Tools contains command line tools and libraries that can be useful for DayZ mod developers and server owners.
2 CONTENTS:
CHAPTER
ONE
INSTALLATION
DayZ Dev Tools is listed onPyPIand can be installed with pip or using your preferred Python package manager.
pip install dayz-dev-tools
DayZ Dev Tools can be run on Windows, MacOS, or Linux but Python 3.8 or higher is required.
4 Chapter 1. Installation
CHAPTER
TWO
COMMANDS
All included command-line tools offer built-in help, accessible by passing either the -h or --help option, e.g.:
unpbo -h
Note: More tools will be added in the future.
2.1 guid
The guid command can be used to convert 64-bit Steam IDs to DayZ GUIDs. Pass the SteamID64 to convert as a parameter to the command:
guid 76561197970002375
2.2 unpbo
The unpbo command enables the viewing or extracting of the contents of a PBO file. Pass -l or --list to list the contents of the PBO:
unpbo --list C:\path\to\filename.pbo
To extract all of the files contained in the PBO into the current directory:
unpbo C:\path\to\filename.pbo
To extract one or more individual files from the PBO, list their full names (as displayed in the -l/--list output), space separated, on the command line after the PBO filename:
unpbo C:\path\to\filename.pbo Prefix\scripts\3_Game\foo.c Prefix\config.cpp
2.3 run-server
The run-server command provides a convenient method for running DayZ Server locally (i.e. for testing mods).
It supports loading collections of mods and configuring server parameters through the use of “bundles”, which are specified on the command line. Bundles can be defined either in the server.toml config file or as functions in a Python module.
Bundles defined in the config file generally look like:
[bundle.mybundle]
mods = '@CF;@MasPuertas;P:\MyModPack'
mission_directory = 'mpmissions\dayzoffline.enoch'
To load a bundle, specify it on the command line as a positional argument. For example:
run-server mybundle
Bundles defined in Python require more typing but offer more flexibility than config file bundles.
See also:
Bundles as Configuration Python Bundles
2.3.1 Configuration File
The run-server command can be configured using a config file, named server.toml by default. Most settings are in the server table of the file. For example:
[server]
executable = "server.exe"
config = "config.cfg"
directory = 'server\dir' profile_directory = "profile"
mission_directory = 'mpmissions\dayzoffline.enoch' bundles = 'path\to\module.py'
parameters = [ '-opt1', '-opt2=value' ] [workshop]
directory = 'E:\DayZ\Workshop'
Note: All settings are optional and have reasonable defaults.
6 Chapter 2. Commands
dayz-dev-tools
Server Executable
By default, run-server will try to run DayZ Server by running .\DayZServer_x64.exe on Windows or ./
DayZServeron Linux. To override the executable path, set the executable key:
[server]
executable = "server.exe"
Server Configuration
By default, run-server will tell DayZ Server to load its configuration from serverDZ.cfg. To override the config file path, set the config key:
[server]
config = "config.cfg"
Server Directory
By default, run-server will run DayZ Server from the current working directory. To have run-server change to a different directory before running DayZ Server, set the directory key:
[server]
directory = 'server\directory'
Note: The current working directory is changed after loading bundles specified on the command line.
Profile Directory
By default, run-server will let DayZ Server choose a profile directory automatically (usually, %LOCALAPPDATA%\
DayZ). The profile directory is where DayZ Server writes logs and other information. To override the profile directory, set the profile_directory key:
[server]
profile_directory = "profile"
DayZ Mission Directory
By default, run-server will let DayZ Server choose the mission directory based on the server configuration file (e.g.
serverDZ.cfg). To override the mission directory, set the mission_directory key:
[server]
mission_directory = 'mpmissions\dayzoffline.enoch'
Bundles Python Module
By default, run-server will look for bundles in a Python file named bundles.py. To override the Python bundles module filename, set the bundles key:
[server]
bundles = 'path\to\module.py'
Bundles can also be loaded from the run-server config file, as described below.
Extra Parameters
Use the parameters key to pass extra command line parameters to DayZ Server. For example, to enable admin logs:
[server]
parameters = [ '-adminLog' ]
DayZ Workshop Directory
By default, run-server will load mods prefixed with @ from the C:\Program Files (x86)\Steam\steamapps\
common\DayZ\!Workshop directory on Windows or $HOME/.steam/steamapps/common/DayZ/!Workshop on Linux. If DayZ client is installed in a different location or you have installed mods from the Steam workshop in a different location, override the default by setting the directory key in the workshop table:
[workshop]
directory = 'E:\DayZ\Workshop'
Note: As there is currently no Linux version of DayZ client, Linux users who want to specify mods using the @ prefix should override this setting to the location where they have installed mods using SteamCMD.
Bundles as Configuration
In the config file, each bundle is defined as atable. For example, to define a bundle named example:
[bundle.example]
executable = 'path\to\server.exe' config = 'path\to\config.cfg' directory = 'path\to\server\dir' profile_directory = 'path\to\profile' mission_directory = 'path\to\mission' workshop_directory = 'path\to\workshop'
parameters = [ '-extraParam', '-another=arg' ]
These settings work the same as the ones of the same names described inConfiguration File. In addition, bundles can define DayZ mods and server mods to add to the command line:
[bundle.example]
mods = '@Mod1;@Mod2;C:\path\to\mod'
server_mods = '@ServerMod;@ServerMod2;C:\path\to\servermod'
8 Chapter 2. Commands
dayz-dev-tools
Mods and server mods can also be configured as lists of strings:
[bundle.example]
mods = [ '@Mod1', '@Mod2', 'C:\path\to\mod' ]
server_mods = [ '@ServerMod', '@ServerMod2', 'C:\path\to\servermod' ]
Mod names and server mod names that start with @ will be loaded from the DayZ workshop directory (see DayZ Workshop Directory).
2.3.2 Python Bundles
More advanced bundles can be created using Python code in theBundles Python Module. Each function defined in the module can be referenced as a bundle. Bundle functions must take a singledayz_dev_tools.launch_settings.
LaunchSettingsargument. For example, to define a bundle named example:
def example(settings):
settings.set_mission_directory(r"path\to\mission") settings.add_mod("@Mod1")
settings.add_mod(r"C:\path\to\mod")
10 Chapter 2. Commands
CHAPTER
THREE
API REFERENCE
The APIs documented in this section are the public interface of the dayz-dev-tools package. All other functions and classes are considered private and may change without notice.
3.1 Extracting PBO Content
dayz_dev_tools.extract_pbo.extract_pbo(reader:dayz_dev_tools.pbo_reader.PBOReader, files_to_extract:
List[str], *, verbose: bool, deobfuscate: bool, cfgconvert:
Optional[str]) →None Extract one or more files contained in a PBO archive.
Parameters
• reader: APBOReaderinstance representing the PBO archive containing the file(s) to be extracted.
• files_to_extract: A list of fully-qualified paths of the files to be extracted.
• verbose: When True, print the paths of the files being extracted to stdout.
• deobfuscate: When True, attempt to deobfuscate obfuscated script files.
Note: Deobfuscation may not always work, as obfuscation techniques may evolve over time.
3.2 DayZ GUIDs
dayz_dev_tools.guid.guid_for_steamid64(steamid64: int) →str Convert a SteamID64 identifier to a DayZ GUID identifier.
Parameters
• steamid64: A 64-bit SteamID used to uniquely identify a Steam account.
Returns The DayZ GUID corresponding to the given 64-bit SteamID.
3.3 Public Key Management
dayz_dev_tools.keys.copy_keys(source: str, destination: str) → None
Recursively search for *.bikey (public key) files in one directory and copy them to another directory.
Parameters
• source: The source directory to be searched for *.bikey files.
• destination: The destination directory where found *.bikey files are to be copied to. This directory will be created if it does not already exist.
3.4 Launch Settings
class dayz_dev_tools.launch_settings.LaunchSettings
Settings that determine what command line parameters to pass when running DayZ Server.
__init__(config:dayz_dev_tools.server_config.ServerConfig)→None Create aLaunchSettingsfrom aServerConfig.
Parameters
• config: A ServerConfig instance returned by dayz_dev_tools.server_config.
load(). add_mod(name: str) →None
Add a mod to be loaded.
Parameters
• name: The name of the mod to load. If the name starts with @, it will be loaded from the DayZ workshop directory (seeLaunchSettings.workshop_directory()), else the name is expected to be the name of the directory containing the mod.
add_parameter(param: str) →None
Add extra parameter to pass on the DayZ Server command line.
Parameters
• param: The parameter to pass on the DayZ Server command line.
add_server_mod(name: str) →None Add a server mod to be loaded.
Parameters
• name: The name of the server mod to load. If the name starts with @, it will be loaded from the DayZ workshop directory (seeLaunchSettings.workshop_directory()), else the name is expected to be the name of the directory containing the server mod.
config()→str
Get the DayZ Server config filename, usually serverDZ.cfg.
Returns The DayZ Server config filename.
directory()→Optional[str]
Get the directory to switch to before running DayZ Server.
Returns The directory to switch to or None if it hasn’t been set.
12 Chapter 3. API Reference
dayz-dev-tools
executable()→str
Get the DayZ Server executable filename, usually .\DayZServer_x64.exe.
Returns The DayZ Server executable filename.
load_bundle(name: str) →None
Load a bundle to configure DayZ Server launch settings.
Parameters
• name: The name of the bundle to load.
This method will first try to find the bundle in the settings TOML file (e.g. server.toml). If the bun- dle name does not exist there, then it will then try to find the bundle in the bundles Python module (e.g.
bundles.py).
mission_directory()→Optional[str]
Get the DayZ Server mission directory.
Returns The DayZ Server mission directory, or None if the mission directory hasn’t been set.
Note: The mission directory is often configured in the DayZ Server config file (e.g. serverDZ.cfg). See alsoLaunchSettings.config().
mods()→List[str]
Get the list of mods to load.
Returns The list of mods to load.
parameters()→List[str]
Get extra command line parameters to pass to DayZ Server.
Returns The list of extra command line parameters to pass to DayZ Server.
profile_directory()→Optional[str]
Get the DayZ Server profile directory name.
Returns The DayZ Server profile directory name, or None if it hasn’t been set.
Note: When the profile directory is unspecified, DayZ Server will usually use %LOCALAPPDATA%\DayZ as the profile directory.
server_mods()→List[str]
Get the list of server mods to load.
Returns The list of server mods to load.
set_config(path: str) →None
Set the DayZ Server config filename.
Parameters
• path: The DayZ Server config filename.
set_directory(path: str) →None
set_executable(path: str) →None Set the DayZ Server executable filename.
Parameters
• path: The DayZ Server executable filename.
set_mission_directory(name: str) →None Set the DayZ Server mission directory.
Parameters
• name: The DayZ Server mission directory name.
set_profile_directory(path: str) →None Set the DayZ Server profile directory name.
Parameters
• path: The DayZ Server profile directory name.
set_workshop_directory(path: str) →None Set the DayZ (client) workshop directory name.
Parameters
• path: The DayZ workshop directory name.
workshop_directory()→str
Get the DayZ (client) workshop directory name. This should normally be set to <DayZ Installation Directory>\!Workshop.
Returns The DayZ workshop directory name.
3.5 Listing PBO Content
dayz_dev_tools.list_pbo.list_pbo(reader:dayz_dev_tools.pbo_reader.PBOReader, *, verbose: bool) → Print the contents of a PBO archive to stdout in tabular format.None
Parameters
• reader: APBOReaderinstance representing the PBO archive to list.
• verbose: When True, additional detail will be printed.
3.6 PBO File
class dayz_dev_tools.pbo_file.PBOFile
Interface for accessing a file contained within a PBO archive. Instances should be obtained using dayz_dev_tools.pbo_reader.PBOReader.file().
__init__(filename: bytes, mime_type: bytes, original_size: int, reserved: int, time_stamp: int, data_size: int, content_reader: Optional[dayz_dev_tools.pbo_file_reader.PBOFileReader] = None) →None data_size: int
The size of the file in the PBO archive filename: bytes
The raw name of the file
14 Chapter 3. API Reference
dayz-dev-tools
normalized_filename()→str
Get the normalized version of the file’s name.
The resulting filename will contain the local OS’s native directory separator character and any bytes repre- senting illegal UTF-8 will be replaced.
Returns A normalized version of the file’s name.
split_filename()→List[bytes]
Get the file’s name as a list, where each element in the list represents a component of the file’s path.
Returns A list of path components.
time_stamp: int
The file’s creation or modification time as a Unix timestamp type()→str
Get the type of the file.
Returns A 4-character string representing the file type.
unpack(output_file: BinaryIO) →None Write the contents of the file.
Parameters
• output_file: A binary file-like object where the contents are to be written.
unpacked_size()→int
Get the original size of the file. If the file is compressed, this will be different from the PBOFile.
data_size.
Returns The original size of the file.
3.7 PBO Reader
class dayz_dev_tools.pbo_reader.PBOReader Interface for reading a PBO archive.
__init__(file: BinaryIO)
Create a newPBOReaderinstance.
Parameters
• file: A binary file-like object providing PBO archive contents.
file(filename: AnyStr) →Optional[dayz_dev_tools.pbo_file.PBOFile] Get a file contained in the PBO archive, by name.
Parameters
• filename: A str or bytes containing the filename of the file to be retrieved. If a str, the filename is matched case-insensitively by the normalized filename in the PBO (seedayz_dev_tools.pbo_file.PBOFile.normalized_filename()). If a bytes, the filename is matched case-insensitively by the raw filename (seedayz_dev_tools.
pbo_file.PBOFile.filename).
headers()→List[Tuple[bytes, bytes]]
Get the PBO archive headers.
Returns A list of tuples containing the header names and values.
prefix()→Optional[bytes]
Get the PBO archive prefix.
Returns The PBO archive prefix, or None if the PBO archive does not have a prefix header.
3.8 Script Logs
dayz_dev_tools.script_logs.newest(directory: str) →Optional[str]
Find the newest script_*.log file in a directory.
Parameters
• directory: The directory to search for script_*.log files.
Returns The filename of the newest script_*.log file, or None if no script logs could be found.
dayz_dev_tools.script_logs.stream(outfile: TextIO, infile: TextIO, keep_streaming: Callable[[], bool]) → Stream the contents of a log file to another file.None
Parameters
• outfile: A file-like object to stream the log file contents to.
• infile: A file-like object containing the log to stream.
• keep_streaming: A callback function taking no arguments that returns True if streaming should continue or False if streaming should stop and the function should return.
dayz_dev_tools.script_logs.wait_for_new(directory: str, previous_log_name: Optional[str], *, timeout: int
= 10) →Optional[str]
Wait for a script log that is newer than another script log to be created in a directory.
Parameters
• directory: The directory to search for a newer script_*.log file.
• previous_log_name: The current newest script_*.log file.
• timeout: Give up and return None if no new script log is created after this many seconds.
Returns The filename of the newer script_*.log file, or None if no newer script logs are created.
3.9 Server Configuration
class dayz_dev_tools.server_config.BundleConfig Configuration file bundle settings.
__init__(executable: typing.Optional[str] = None, config: typing.Optional[str] = None, directory:
typing.Optional[str] = None, profile_directory: typing.Optional[str] = None, workshop_directory:
typing.Optional[str] = None, mods: typing.List[str] = <factory>, server_mods: typing.List[str] =
<factory>, mission_directory: typing.Optional[str] = None, parameters: typing.List[str] =
<factory>) →None
16 Chapter 3. API Reference
dayz-dev-tools
config: Optional[str] = None
DayZ Server config filename override (optional) directory: Optional[str] = None
Directory to switch to before running DayZ Server (optional) executable: Optional[str] = None
DayZ Server executable filename override (optional) mission_directory: Optional[str] = None
DayZ Server mission directory name override (optional) mods: List[str]
DayZ mod list to add parameters: List[str]
Extra server command line parameters to add profile_directory: Optional[str] = None
DayZ Server profile directory name override (optional) server_mods: List[str]
DayZ server mod list to add
workshop_directory: Optional[str] = None DayZ workshop directory name override (optional) class dayz_dev_tools.server_config.ServerConfig
Configuration file settings.
__init__(executable: str, config: str, bundle_path: str, workshop_directory: str, bundles: typing.Dict[str, dayz_dev_tools.server_config.BundleConfig], directory: typing.Optional[str] = None,
profile_directory: typing.Optional[str] = None, mission_directory: typing.Optional[str] = None, parameters: typing.List[str] = <factory>) →None
bundle_path: str
Filename of the bundles Python module
bundles: Dict[str, dayz_dev_tools.server_config.BundleConfig]
Configuration file bundles, by name (seedayz_dev_tools.server_config.BundleConfig) config: str
DayZ Server config filename directory: Optional[str] = None
Directory to switch to before running DayZ Server (optional) executable: str
DayZ Server executable filename
mission_directory: Optional[str] = None DayZ Server mission directory name (optional) parameters: List[str]
Extra server command line parameters to add profile_directory: Optional[str] = None
DayZ Server profile directory name (optional)
Parameters
• filename: The name of the configuration file to read (e.g. server.toml) Returns AServerConfig.
18 Chapter 3. API Reference
CHAPTER
FOUR
INDICES AND TABLES
• genindex
• modindex
• search
20 Chapter 4. Indices and tables
PYTHON MODULE INDEX
d
dayz_dev_tools.extract_pbo,11 dayz_dev_tools.guid,11
dayz_dev_tools.keys,12
dayz_dev_tools.launch_settings,12 dayz_dev_tools.list_pbo,14
dayz_dev_tools.pbo_file,14 dayz_dev_tools.pbo_reader,15 dayz_dev_tools.script_logs,16 dayz_dev_tools.server_config,16
22 Python Module Index
INDEX
Symbols
__init__()(dayz_dev_tools.launch_settings.LaunchSettings method),12
__init__()(dayz_dev_tools.pbo_file.PBOFile method), 14
__init__() (dayz_dev_tools.pbo_reader.PBOReader method),15
__init__()(dayz_dev_tools.server_config.BundleConfig method),16
__init__()(dayz_dev_tools.server_config.ServerConfig method),17
A
add_mod()(dayz_dev_tools.launch_settings.LaunchSettings method),12
add_parameter()(dayz_dev_tools.launch_settings.LaunchSettings method),12
add_server_mod()(dayz_dev_tools.launch_settings.LaunchSettings method),12
B
bundle_path(dayz_dev_tools.server_config.ServerConfig attribute),17
BundleConfig (class in dayz_dev_tools.server_config), 16
bundles(dayz_dev_tools.server_config.ServerConfig at- tribute),17
C
config (dayz_dev_tools.server_config.BundleConfig at- tribute),16
config (dayz_dev_tools.server_config.ServerConfig at- tribute),17
config()(dayz_dev_tools.launch_settings.LaunchSettings method),12
copy_keys()(in module dayz_dev_tools.keys),12
module,11 dayz_dev_tools.guid
module,11 dayz_dev_tools.keys
module,12
dayz_dev_tools.launch_settings module,12
dayz_dev_tools.list_pbo module,14
dayz_dev_tools.pbo_file module,14
dayz_dev_tools.pbo_reader module,15
dayz_dev_tools.script_logs module,16
dayz_dev_tools.server_config module,16
directory(dayz_dev_tools.server_config.BundleConfig attribute),17
directory (dayz_dev_tools.server_config.ServerConfig attribute),17
directory()(dayz_dev_tools.launch_settings.LaunchSettings method),12
E
executable(dayz_dev_tools.server_config.BundleConfig attribute),17
executable(dayz_dev_tools.server_config.ServerConfig attribute),17
executable()(dayz_dev_tools.launch_settings.LaunchSettings method),12
extract_pbo() (in module
dayz_dev_tools.extract_pbo),11
F
file() (dayz_dev_tools.pbo_reader.PBOReader method),15
G
guid_for_steamid64() (in module
dayz_dev_tools.guid),11
H
headers() (dayz_dev_tools.pbo_reader.PBOReader method),16
L
LaunchSettings (class in
dayz_dev_tools.launch_settings),12 list_pbo()(in module dayz_dev_tools.list_pbo),14 load()(in module dayz_dev_tools.server_config),17
load_bundle()(dayz_dev_tools.launch_settings.LaunchSettings method),13
M
mission_directory(dayz_dev_tools.server_config.BundleConfig attribute),17
mission_directory(dayz_dev_tools.server_config.ServerConfig attribute),17
mission_directory()
(dayz_dev_tools.launch_settings.LaunchSettings method),13
mods (dayz_dev_tools.server_config.BundleConfig attribute),17
mods() (dayz_dev_tools.launch_settings.LaunchSettings method),13
module
dayz_dev_tools.extract_pbo,11 dayz_dev_tools.guid,11
dayz_dev_tools.keys,12
dayz_dev_tools.launch_settings,12 dayz_dev_tools.list_pbo,14
dayz_dev_tools.pbo_file,14 dayz_dev_tools.pbo_reader,15 dayz_dev_tools.script_logs,16 dayz_dev_tools.server_config,16
N
newest()(in module dayz_dev_tools.script_logs),16 normalized_filename()
(dayz_dev_tools.pbo_file.PBOFile method),14
P
parameters(dayz_dev_tools.server_config.BundleConfig attribute),17
parameters(dayz_dev_tools.server_config.ServerConfig attribute),17
parameters()(dayz_dev_tools.launch_settings.LaunchSettings method),13
PBOFile(class in dayz_dev_tools.pbo_file),14 PBOReader(class in dayz_dev_tools.pbo_reader),15
prefix() (dayz_dev_tools.pbo_reader.PBOReader method),16
profile_directory(dayz_dev_tools.server_config.BundleConfig attribute),17
profile_directory(dayz_dev_tools.server_config.ServerConfig attribute),17
profile_directory()
(dayz_dev_tools.launch_settings.LaunchSettings method),13
S
server_mods(dayz_dev_tools.server_config.BundleConfig attribute),17
server_mods()(dayz_dev_tools.launch_settings.LaunchSettings method),13
ServerConfig (class in dayz_dev_tools.server_config), 17
set_config()(dayz_dev_tools.launch_settings.LaunchSettings method),13
set_directory()(dayz_dev_tools.launch_settings.LaunchSettings method),13
set_executable()(dayz_dev_tools.launch_settings.LaunchSettings method),13
set_mission_directory()
(dayz_dev_tools.launch_settings.LaunchSettings method),14
set_profile_directory()
(dayz_dev_tools.launch_settings.LaunchSettings method),14
set_workshop_directory()
(dayz_dev_tools.launch_settings.LaunchSettings method),14
split_filename() (dayz_dev_tools.pbo_file.PBOFile method),15
stream()(in module dayz_dev_tools.script_logs),16
T
time_stamp (dayz_dev_tools.pbo_file.PBOFile at- tribute),15
type()(dayz_dev_tools.pbo_file.PBOFile method),15
U
unpack() (dayz_dev_tools.pbo_file.PBOFile method), 15
unpacked_size() (dayz_dev_tools.pbo_file.PBOFile method),15
W
wait_for_new() (in module
dayz_dev_tools.script_logs),16
workshop_directory(dayz_dev_tools.server_config.BundleConfig attribute),17
workshop_directory(dayz_dev_tools.server_config.ServerConfig attribute),17
24 Index
dayz-dev-tools
workshop_directory()
(dayz_dev_tools.launch_settings.LaunchSettings method),14