mistralys / x4-core
Core files for all X4 tools.
Requires
- php: >=7.4
- ext-dom: *
- ext-json: *
- ext-mbstring: *
- ext-simplexml: *
- components/jquery: >=3.5.1
- fortawesome/font-awesome: ^5.15.3
- mistralys/application-localization: >=1.4.1
- mistralys/application-utils: >=2.3.2
- mistralys/x4-data-extractor: >=1.0.0
- thomaspark/bootswatch: ^v5.1.3
- twbs/bootstrap: ^v5.1.3
Requires (Dev)
- phpstan/phpstan: >=1.6.1
- phpunit/phpunit: >=9.5.20
- roave/security-advisories: dev-latest
README
Utility classes used to access X4: Foundations game data in an OOP way. Designed to be used as a library in other projects (see X4 Tools).
Requirements
- PHP 8.2 or higher.
- Composer.
Usage
Installation
Require the package in your Composer project:
composer require mistralys/x4-core
Accessing Race information
All races available in the game can be accessed through dedicated classes.
use Mistralys\X4\Database\Races\KnownRaces; $argon = KnownRaces::getInstance()->getArgon(); echo $argon->getLabel(); // Outputs "Argon"
Accessing translations
The official translations are bundled with the package, and can be
accessed to translate text codes like {20101,20604}
("Manorina (Gas) Vanguard").
use Mistralys\X4\Database\Translations\Languages; $english = Languages::getInstance()->getEnglish(); $shipName = $english->t('{20101,20604}');
Development setup
Unpacking game data files
The mod requires the game's data files to be unpacked using the X4 Data Extractor tool. The tool acts as a library to access the extracted information. This includes the DLC metadata necessary to generate the correct mod file structure.
Please refer to the tool's instructions to unpack the game data files.
Configuration
- Unpack the data files (see above).
- Clone this repository.
- Copy
dev-config.php.dist
todev-config.php
. - Edit the file to set the correct paths.
Database update
To update the bundled database, use the build
Composer command
to update the JSON files in the data
folder.
composer build
X4 Tools and libraries
- X4 Game Notes - Docs - Howto, tips and general information about X4.
- X4 Core - Library - Access X4 game data in an OOP way.
- X4 Data Extractor - Tool & Library - Extract X4 game files.
- X4 Savegame Parser - Tool - Parse X4 savegames to extract information.
- X4 Cargo Size Mod - Mod - Mod to increase ship cargo sizes.