mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-28 00:17:23 +00:00
Merge remote-tracking branch 'upstream/main'
This commit is contained in:
commit
d2cecd0073
@ -23,10 +23,7 @@
|
||||
"name": "ci-macos-11",
|
||||
"displayName": "CI configure step for MacOS",
|
||||
"description": "Same as default, Used in GitHub actions workflow",
|
||||
"inherits": "default",
|
||||
"cacheVariables": {
|
||||
"OPENSSL_ROOT_DIR": "/usr/local/opt/openssl@3/"
|
||||
}
|
||||
"inherits": "default"
|
||||
},
|
||||
{
|
||||
"name": "ci-windows-2022",
|
||||
|
@ -8,15 +8,17 @@ LICENSE=AGPL-3.0
|
||||
# 171022 - Unmodded client
|
||||
NET_VERSION=171022
|
||||
# Debugging
|
||||
__dynamic=1
|
||||
# Set __dynamic to 1 to enable the -rdynamic flag for the linker, yielding some symbols in crashlogs.
|
||||
# __ggdb=1
|
||||
__dynamic=1
|
||||
# Set __ggdb to 1 to enable the -ggdb flag for the linker, including more debug info.
|
||||
# __include_backtrace__=1
|
||||
# __ggdb=1
|
||||
# Set __include_backtrace__ to 1 to includes the backtrace library for better crashlogs.
|
||||
# __compile_backtrace__=1
|
||||
# __include_backtrace__=1
|
||||
# Set __compile_backtrace__ to 1 to compile the backtrace library instead of using system libraries.
|
||||
__maria_db_connector_compile_jobs__=1
|
||||
# __compile_backtrace__=1
|
||||
# Set to the number of jobs (make -j equivalent) to compile the mariadbconn files with.
|
||||
__enable_testing__=1
|
||||
__maria_db_connector_compile_jobs__=1
|
||||
# When set to 1 and uncommented, compiling and linking testing folders and libraries will be done.
|
||||
__enable_testing__=1
|
||||
# The path to OpenSSL. Change this if your OpenSSL install path is different than the default.
|
||||
OPENSSL_ROOT_DIR=/usr/local/opt/openssl@3/
|
||||
|
587
README.md
587
README.md
@ -18,210 +18,188 @@ Darkflame Universe is licensed under AGPLv3, please read [LICENSE](LICENSE). Som
|
||||
Throughout the entire build and setup process a level of familiarity with the command line and preferably a Unix-like development environment is greatly advantageous.
|
||||
|
||||
### Hosting a server
|
||||
We do not recommend hosting public servers. DLU is intended for small scale deployment, for example within a group of friends. It has not been tested for large scale deployment which comes with additional security risks.
|
||||
We do not recommend hosting public servers. Darkflame Universe is intended for small scale deployment, for example within a group of friends. It has not been tested for large scale deployment which comes with additional security risks.
|
||||
|
||||
### Supply of resource files
|
||||
Darkflame Universe is a server emulator and does not distribute any LEGO® Universe files. A separate game client is required to setup this server emulator and play the game, which we cannot supply. Users are strongly suggested to refer to the safe checksums listed in the resources tab below when checking if a client will work.
|
||||
Darkflame Universe is a server emulator and does not distribute any LEGO® Universe files. A separate game client is required to setup this server emulator and play the game, which we cannot supply. Users are strongly suggested to refer to the safe checksums listed [here](#verifying-your-client-files) to see if a client will work.
|
||||
|
||||
## Build
|
||||
Development of the latest iteration of Darkflame Universe has been done primarily in a Unix-like environment and is where it has been tested and designed for deployment. It is therefore highly recommended that Darkflame Universe be built and deployed using a Unix-like environment for the most streamlined experience.
|
||||
## Steps to setup server
|
||||
* [Clone this repository](#clone-the-repository)
|
||||
* [Install dependencies](#install-dependencies)
|
||||
* [Database setup](#database-setup)
|
||||
* [Build the server](#build-the-server)
|
||||
* [Configuring your server](#configuring-your-server)
|
||||
* [Required Configuration](#required-configuration)
|
||||
* [Optional Configuration](#optional-configuration)
|
||||
* [Verify your setup](#verify-your-setup)
|
||||
* [Running the server](#running-the-server)
|
||||
* [User Guide](#user-guide)
|
||||
|
||||
### Prerequisites
|
||||
#### Clone the repository
|
||||
## Clone the repository
|
||||
If you are on Windows, you will need to download and install git from [here](https://git-scm.com/download/win)
|
||||
|
||||
Then run the following command
|
||||
```bash
|
||||
git clone --recursive https://github.com/DarkflameUniverse/DarkflameServer
|
||||
```
|
||||
#### Python
|
||||
|
||||
Some tools utilized to streamline the setup process require Python 3, make sure you have it installed.
|
||||
## Install dependencies
|
||||
|
||||
### Windows packages
|
||||
Ensure that you have either the [MSVC C++ compiler](https://visualstudio.microsoft.com/vs/features/cplusplus/) (recommended) or the [Clang compiler](https://github.com/llvm/llvm-project/releases/) installed.
|
||||
You'll also need to download and install [CMake](https://cmake.org/download/) (version <font size="4">**CMake version 3.18**</font> or later!).
|
||||
|
||||
### Choosing the right version for your client
|
||||
DLU clients identify themselves using a higher version number than the regular live clients out there.
|
||||
This was done make sure that older and incomplete clients wouldn't produce false positive bug reports for us, and because we made bug fixes and new content for the client.
|
||||
### MacOS packages
|
||||
Ensure you have [brew](https://brew.sh) installed.
|
||||
You will need to install the following packages
|
||||
```bash
|
||||
brew install cmake gcc mariadb openssl zlib
|
||||
```
|
||||
|
||||
If you're using a DLU client you'll have to go into the "CMakeVariables.txt" file and change the NET_VERSION variable to 171023 to match the modified client's version number.
|
||||
### Linux packages
|
||||
Make sure packages like `gcc`, and `zlib` are installed. Depending on the distribution, these packages might already be installed. Note that on systems like Ubuntu, you will need the `zlib1g-dev` package so that the header files are available. `libssl-dev` will also be required as well as `openssl`. You will also need a MySQL database solution to use. We recommend using `mariadb-server`.
|
||||
|
||||
### Enabling testing
|
||||
While it is highly recommended to enable testing, if you would like to save compilation time, you'll want to comment out the enable_testing variable in CMakeVariables.txt.
|
||||
It is recommended that after building and if testing is enabled, to run `ctest` and make sure all the tests pass.
|
||||
For Ubuntu, you would run the following commands. On other systems, the package install command will differ.
|
||||
|
||||
### Using Docker
|
||||
Refer to [Docker.md](/Docker.md).
|
||||
```bash
|
||||
sudo apt update && sudo apt upgrade
|
||||
|
||||
For Windows, refer to [Docker_Windows.md](/Docker_Windows.md).
|
||||
# Install packages
|
||||
sudo apt install build-essential gcc zlib1g-dev libssl-dev openssl mariadb-server cmake
|
||||
```
|
||||
|
||||
### Linux builds
|
||||
Make sure packages like `gcc`, `cmake`, and `zlib` are installed. Depending on the distribution, these packages might already be installed. Note that on systems like Ubuntu, you will need the `zlib1g-dev` package so that the header files are available. `libssl-dev` will also be required as well as `openssl`.
|
||||
#### Required CMake version
|
||||
This project uses <font size="4">**CMake version 3.18**</font> or higher and as such you will need to ensure you have this version installed.
|
||||
You can check your CMake version by using the following command in a terminal.
|
||||
```bash
|
||||
cmake --version
|
||||
```
|
||||
|
||||
CMake must be version 3.14 or higher!
|
||||
If you are going to be using an Ubuntu environment to run the server, you may need to get a more recent version of `cmake` than the packages available may provide.
|
||||
|
||||
#### Build the repository
|
||||
The general approach to do so would be to obtain a copy of the signing key and then add the CMake repository to your apt.
|
||||
You can do so with the following commands.
|
||||
|
||||
[Source of the below commands](https://askubuntu.com/questions/355565/how-do-i-install-the-latest-version-of-cmake-from-the-command-line)
|
||||
|
||||
```bash
|
||||
# Remove the old version of CMake
|
||||
sudo apt purge --auto-remove cmake
|
||||
|
||||
# Prepare for installation
|
||||
sudo apt update && sudo apt install -y software-properties-common lsb-release && sudo apt clean all
|
||||
|
||||
# Obtain a copy of the signing key
|
||||
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null
|
||||
|
||||
# Add the repository to your sources list.
|
||||
sudo apt-add-repository "deb https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main"
|
||||
|
||||
# Next you'll want to ensure that Kitware's keyring stays up to date
|
||||
sudo apt update
|
||||
sudo apt install kitware-archive-keyring
|
||||
sudo rm /etc/apt/trusted.gpg.d/kitware.gpg
|
||||
|
||||
# If sudo apt update above returned an error, copy the public key at the end of the error message and run the following command
|
||||
# if the error message was "The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 6AF7F09730B3F0A4"
|
||||
# then the below command would be "sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 6AF7F09730B3F0A4"
|
||||
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys <TheCopiedPublicKey>
|
||||
|
||||
# Finally update and install
|
||||
sudo apt update
|
||||
sudo apt install cmake
|
||||
```
|
||||
|
||||
## Database setup
|
||||
First you'll need to start MariaDB.
|
||||
|
||||
For Windows the service is always running by default.
|
||||
|
||||
For MacOS, run the following command
|
||||
```bash
|
||||
brew services start mariadb
|
||||
```
|
||||
|
||||
For Linux, run the following command
|
||||
```bash
|
||||
sudo systemctl start mysql
|
||||
# If systemctl is not a known command on your distribution, try the following instead
|
||||
sudo service mysql start
|
||||
```
|
||||
|
||||
<font size="4">**You will need to run this command every time you restart your environment**</font>
|
||||
|
||||
If you are using Linux and `systemctl` and want the MariaDB instance to start on startup, run the following command
|
||||
```bash
|
||||
sudo systemctl enable --now mysql
|
||||
```
|
||||
|
||||
Once MariaDB is started, you'll need to create a user and an empty database for Darkflame Universe to use.
|
||||
|
||||
First, login to the MariaDB instance.
|
||||
|
||||
To do this on Ubuntu/Linux, MacOS, or another Unix like operating system, run the following command in a terminal
|
||||
```bash
|
||||
# Logs you into the MariaDB instance as root
|
||||
sudo mysql
|
||||
```
|
||||
|
||||
For Windows, run the following command in the `Command Prompt (MariaDB xx.xx)` terminal
|
||||
```bash
|
||||
# Logs you into the mysql instance
|
||||
mysql -u root -p
|
||||
# You will then be prompted for the password you set for root during installation of MariaDB
|
||||
```
|
||||
|
||||
Now that you are logged in, run the following commands.
|
||||
|
||||
```bash
|
||||
# Creates a user for this computer which uses a password and grant said user all privileges.
|
||||
# Change mydarkflameuser to a custom username and password to a custom password.
|
||||
GRANT ALL ON *.* TO 'mydarkflameuser'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;
|
||||
FLUSH PRIVILEGES;
|
||||
|
||||
# Then create a database for Darkflame Universe to use.
|
||||
CREATE DATABASE darkflame;
|
||||
```
|
||||
|
||||
## Build the server
|
||||
You can either run `build.sh` when in the root folder of the repository:
|
||||
|
||||
```bash
|
||||
./build.sh
|
||||
```
|
||||
|
||||
Or manually run the commands used in `build.sh`:
|
||||
Or manually run the commands used in [build.sh](build.sh).
|
||||
|
||||
```bash
|
||||
# Create the build directory, preserving it if it already exists
|
||||
mkdir -p build
|
||||
cd build
|
||||
### Notes
|
||||
Depending on your operating system, you may need to adjust some pre-processor defines in [CMakeVariables.txt](./CMakeVariables.txt) before building:
|
||||
* If you are on MacOS, ensure OPENSSL_ROOT_DIR is pointing to the openssl root directory.
|
||||
* If you are using a Darkflame Universe client, ensure NET_VERSION is changed to 171023.
|
||||
|
||||
# Run CMake to generate make files
|
||||
cmake ..
|
||||
## Configuring your server
|
||||
This server has a few steps that need to be taken to configure the server for your use case.
|
||||
|
||||
# To build utilizing multiple cores, append `-j` and the amount of cores to utilize, for example `cmake --build . --config Release -j8'
|
||||
cmake --build . --config Release
|
||||
```
|
||||
### Required Configuration
|
||||
Darkflame Universe can run with either a packed or an unpacked client.
|
||||
Navigate to `build/sharedconfig.ini` and fill in the following fields:
|
||||
* `mysql_host` (This is the IP address or hostname of your MariaDB server. This is highly likely `localhost`)
|
||||
* If you setup your MariaDB instance on a port other than 3306, which can be done on a Windows install, you will need to make this value `tcp://localhost:portNum` where portNum is replaced with the port you chose to run MariaDB on.
|
||||
* `mysql_database` (This is the database you created for the server)
|
||||
* `mysql_username` (This is the user you created for the server)
|
||||
* `mysql_password` (This is the password for the user you created for the server)
|
||||
* `client_location` (This is the location of the client files. This should be the folder path of a packed or unpacked client)
|
||||
* Ideally the path to the client should not contain any spaces.
|
||||
|
||||
### MacOS builds
|
||||
Ensure `cmake`, `zlib` and `open ssl` are installed as well as a compiler (e.g `clang` or `gcc`).
|
||||
|
||||
In the repository root folder run the following. Ensure -DOPENSSL_ROOT_DIR=/path/to/openssl points to your openssl install location
|
||||
```bash
|
||||
# Create the build directory, preserving it if it already exists
|
||||
mkdir -p build
|
||||
cd build
|
||||
|
||||
# Run CMake to generate build files
|
||||
cmake .. -DOPENSSL_ROOT_DIR=/path/to/openssl
|
||||
|
||||
# Get cmake to build the project. If make files are being used then using make and appending `-j` and the amount of cores to utilize may be preferable, for example `make -j8`
|
||||
cmake --build . --config Release
|
||||
```
|
||||
|
||||
### Windows builds (native)
|
||||
Ensure that you have either the [MSVC](https://visualstudio.microsoft.com/vs/) or the [Clang](https://github.com/llvm/llvm-project/releases/) (recommended) compiler installed. You will also need to install [CMake](https://cmake.org/download/). Currently on native Windows the server will only work in Release mode.
|
||||
|
||||
#### Build the repository
|
||||
```batch
|
||||
:: Create the build directory
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
:: Run CMake to generate make files
|
||||
cmake ..
|
||||
|
||||
:: Run CMake with build flag to build
|
||||
cmake --build . --config Release
|
||||
```
|
||||
#### Windows for ARM has not been tested but should build by doing the following
|
||||
```batch
|
||||
:: Create the build directory
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
:: Run CMake to generate make files
|
||||
cmake .. -DMARIADB_BUILD_SOURCE=ON
|
||||
|
||||
:: Run CMake with build flag to build
|
||||
cmake --build . --config Release
|
||||
```
|
||||
|
||||
### Windows builds (WSL)
|
||||
This section will go through how to install [WSL](https://docs.microsoft.com/en-us/windows/wsl/install) and building in a Linux environment under Windows. WSL requires Windows 10 version 2004 and higher (Build 19041 and higher) or Windows 11.
|
||||
|
||||
#### Open the Command Prompt application with Administrator permissions and run the following:
|
||||
```bash
|
||||
# Installing Windows Subsystem for Linux
|
||||
wsl --install
|
||||
```
|
||||
|
||||
#### Open the Ubuntu application and run the following:
|
||||
```bash
|
||||
# Make sure the install is up to date
|
||||
apt update && apt upgrade
|
||||
|
||||
# Make sure the gcc, cmake, and build-essentials are installed
|
||||
sudo apt install gcc
|
||||
sudo apt install cmake
|
||||
sudo apt install build-essential
|
||||
```
|
||||
|
||||
[**Follow the Linux instructions**](#linux-builds)
|
||||
|
||||
### ARM builds
|
||||
AArch64 builds should work on linux and MacOS using their respective build steps. Windows ARM should build but it has not been tested
|
||||
|
||||
### Updating your build
|
||||
To update your server to the latest version navigate to your cloned directory
|
||||
```bash
|
||||
cd /path/to/DarkflameServer
|
||||
```
|
||||
run the following commands to update to the latest changes
|
||||
```bash
|
||||
git pull
|
||||
git submodule update --init --recursive
|
||||
```
|
||||
now follow the build section for your system
|
||||
|
||||
## Setting up the environment
|
||||
|
||||
### Resources
|
||||
|
||||
#### LEGO® Universe 1.10.64
|
||||
|
||||
This repository does not distribute any LEGO® Universe files. A full install of LEGO® Universe version 1.10.64 (latest) is required to finish setting up Darkflame Universe.
|
||||
|
||||
Known good SHA256 checksums of the client:
|
||||
- `8f6c7e84eca3bab93232132a88c4ae6f8367227d7eafeaa0ef9c40e86c14edf5` (packed client, rar compressed)
|
||||
- `c1531bf9401426042e8bab2de04ba1b723042dc01d9907c2635033d417de9e05` (packed client, includes extra locales, rar compressed)
|
||||
- `0d862f71eedcadc4494c4358261669721b40b2131101cbd6ef476c5a6ec6775b` (unpacked client, includes extra locales, rar compressed)
|
||||
|
||||
Known good *SHA1* checksum of the DLU client:
|
||||
- `91498e09b83ce69f46baf9e521d48f23fe502985` (packed client, zip compressed)
|
||||
|
||||
How to generate a SHA256 checksum:
|
||||
```bash
|
||||
# Replace <file> with the file path to the client
|
||||
|
||||
# If on Linux or MacOS
|
||||
shasum -a 256 <file>
|
||||
|
||||
# If on Windows
|
||||
certutil -hashfile <file> SHA256
|
||||
```
|
||||
|
||||
#### Unpacking the client
|
||||
* Clone lcdr's utilities repository [here](https://github.com/lcdr/utils)
|
||||
* Use `pkextractor.pyw` to unpack the client files if they are not already unpacked
|
||||
|
||||
#### Setup resource directory
|
||||
* In the `build` directory create a `res` directory if it does not already exist.
|
||||
* Copy over or create symlinks from `macros`, `BrickModels`, `chatplus_en_us.txt`, `names`, and `maps` in your client `res` directory to the server `build/res` directory
|
||||
* Unzip the navmeshes [here](./resources/navmeshes.zip) and place them in `build/res/maps/navmeshes`
|
||||
|
||||
#### Setup locale
|
||||
* In the `build` directory create a `locale` directory if it does not already exist
|
||||
* Copy over or create symlinks from `locale.xml` in your client `locale` directory to the `build/locale` directory
|
||||
|
||||
#### Client database
|
||||
* Move the file `res/cdclient.fdb` from the unpacked client to the `build/res` folder on the server.
|
||||
* The server will automatically copy and convert the file from fdb to sqlite should `CDServer.sqlite` not already exist.
|
||||
* You can also convert the database manually using `fdb_to_sqlite.py` using lcdr's utilities. Just make sure to rename the file to `CDServer.sqlite` instead of `cdclient.sqlite`.
|
||||
* Migrations to the database are automatically run on server start. When migrations are needed to be ran, the server may take a bit longer to start.
|
||||
|
||||
### Database
|
||||
Darkflame Universe utilizes a MySQL/MariaDB database for account and character information.
|
||||
|
||||
Initial setup can vary drastically based on which operating system or distribution you are running; there are instructions out there for most setups, follow those and come back here when you have a database up and running.
|
||||
|
||||
* All that you need to do is create a database to connect to. As long as the server can connect to the database, the schema will always be kept up to date when you start the server.
|
||||
|
||||
#### Configuration
|
||||
|
||||
After the server has been built there should be four `ini` files in the build director: `sharedconfig.ini`, `authconfig.ini`, `chatconfig.ini`, `masterconfig.ini`, and `worldconfig.ini`. Go through them and fill in the database credentials and configure other settings if necessary.
|
||||
|
||||
#### Migrations
|
||||
|
||||
The database is automatically setup and migrated to what it should look like for the latest commit whenever you start the server.
|
||||
|
||||
#### Verify
|
||||
### Optional Configuration
|
||||
* After the server has been built there should be five `ini` files in the build directory: `sharedconfig.ini`, `authconfig.ini`, `chatconfig.ini`, `masterconfig.ini`, and `worldconfig.ini`.
|
||||
* `authconfig.ini` contains an option to enable or disable play keys on your server. Do not change the default port for auth.
|
||||
* `chatconfig.ini` contains a port option.
|
||||
* `masterconfig.ini` contains options related to permissions you want to run your servers with.
|
||||
* `sharedconfig.ini` contains several options that are shared across all servers
|
||||
* `worldconfig.ini` contains several options to turn on QOL improvements should you want them. If you would like the most vanilla experience possible, you will need to turn some of these settings off.
|
||||
|
||||
## Verify your setup
|
||||
Your build directory should now look like this:
|
||||
* AuthServer
|
||||
* ChatServer
|
||||
@ -230,42 +208,35 @@ Your build directory should now look like this:
|
||||
* authconfig.ini
|
||||
* chatconfig.ini
|
||||
* masterconfig.ini
|
||||
* sharedconfig.ini
|
||||
* worldconfig.ini
|
||||
* **locale/**
|
||||
* locale.xml
|
||||
* **res/**
|
||||
* cdclient.fdb
|
||||
* chatplus_en_us.txt
|
||||
* **macros/**
|
||||
* ...
|
||||
* **BrickModels/**
|
||||
* ...
|
||||
* **maps/**
|
||||
* **navmeshes/**
|
||||
* ...
|
||||
* ...
|
||||
* ...
|
||||
|
||||
## Running the server
|
||||
If everything has been configured correctly you should now be able to run the `MasterServer` binary. Darkflame Universe utilizes port numbers under 1024, so under Linux you either have to give the binary network permissions or run it under sudo.
|
||||
If everything has been configured correctly you should now be able to run the `MasterServer` binary which is located in the `build` directory. Darkflame Universe utilizes port numbers under 1024, so under Linux you either have to give the `AuthServer` binary network permissions or run it under sudo.
|
||||
To give `AuthServer` network permissions and not require sudo, run the following command
|
||||
```bash
|
||||
sudo setcap 'cap_net_bind_service=+ep' AuthServer
|
||||
```
|
||||
and then go to `build/masterconfig.ini` and change `use_sudo_auth` to 0.
|
||||
|
||||
### First admin user
|
||||
Run `MasterServer -a` to get prompted to create an admin account. This method is only intended for the system administrator as a means to get started, do NOT use this method to create accounts for other users!
|
||||
|
||||
### Account Manager
|
||||
### Account management tool (Nexus Dashboard)
|
||||
**If you are just using this server for yourself, you can skip setting up Nexus Dashboard**
|
||||
|
||||
Follow the instructions [here](https://github.com/DarkflameUniverse/AccountManager) to setup the DLU account management Python web application. This is the intended way for users to create accounts.
|
||||
Follow the instructions [here](https://github.com/DarkflameUniverse/NexusDashboard) to setup the DLU Nexus Dashboard web application. This is the intended way for users to create accounts and the intended way for moderators to approve names/pets/properties and do other moderation actions.
|
||||
|
||||
### Admin levels
|
||||
The admin level, or Game Master level (hereafter referred to as gmlevel), is specified in the `accounts.gm_level` column in the MySQL database. Normal players should have this set to `0`, which comes with no special privileges. The system administrator will have this set to `9`, which comes will all privileges. gmlevel `8` should be used to give a player a majority of privileges without the safety critical once.
|
||||
|
||||
The admin level, or game master level, is specified in the `accounts.gm_level` column in the MySQL database. Normal players should have this set to `0`, which comes with no special privileges. The system administrator will have this set to `9`, which comes will all privileges. Admin level `8` should be used to give a player a majority of privileges without the safety critical once.
|
||||
While a character has a gmlevel of anything but `0`, some gameplay behavior will change. When testing gameplay, you should always use a character with a gmlevel of `0`.
|
||||
|
||||
While a character has a gmlevel of anything but 0, some gameplay behavior will change. When testing gameplay, you should always use a character with a gmlevel of 0.
|
||||
# User guide
|
||||
Some changes to the client `boot.cfg` file are needed to play on your server.
|
||||
|
||||
## User guide
|
||||
A few modifications have to be made to the client.
|
||||
|
||||
### Client configuration
|
||||
## Allowing a user to connect to your server
|
||||
To connect to a server follow these steps:
|
||||
* In the client directory, locate `boot.cfg`
|
||||
* Open it in a text editor and locate where it says `AUTHSERVERIP=0:`
|
||||
@ -273,155 +244,89 @@ To connect to a server follow these steps:
|
||||
* Launch `legouniverse.exe`, through `wine` if on a Unix-like operating system
|
||||
* Note that if you are on WSL2, you will need to configure the public IP in the server and client to be the IP of the WSL2 instance and not localhost, which can be found by running `ifconfig` in the terminal. Windows defaults to WSL1, so this will not apply to most users.
|
||||
|
||||
### Brick-By-Brick building
|
||||
## Brick-By-Brick building
|
||||
Should you choose to do any brick building, you will want to have some form of a http server that returns a 404 error since we are unable to emulate live User Generated Content at the moment. If you attempt to do any brick building without a 404 server running properly, you will be unable to load into your game. Python is the easiest way to do this, but any thing that returns a 404 should work fine.
|
||||
* Note: the client hard codes this request on port 80.
|
||||
|
||||
Brick-By-Brick building requires `PATCHSERVERIP=0:` in the `boot.cfg` to point to a HTTP server which always returns `HTTP 404 - Not Found` for all requests. This can be achieved by pointing it to `localhost` while having `sudo python -m http.server 80` running in the background.
|
||||
<font size="4">**If you do not plan on doing any Brick Building, then you can skip this step.**</font>
|
||||
|
||||
### In-game commands
|
||||
Here is a summary of the commands available in-game. All commands are prefixed by `/` and typed in the in-game chat window. Some commands requires admin privileges. Operands within `<>` are required, operands within `()` are not. For the full list of in-game commands, please checkout [the source file](./dGame/dUtilities/SlashCommandHandler.cpp).
|
||||
The easiest way to do this is to install [python](https://www.python.org/downloads/).
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<th>
|
||||
Command
|
||||
</th>
|
||||
<th>
|
||||
Usage
|
||||
</th>
|
||||
<th>
|
||||
Description
|
||||
</th>
|
||||
<th>
|
||||
Admin Level Requirement
|
||||
</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
info
|
||||
</td>
|
||||
<td>
|
||||
/info
|
||||
</td>
|
||||
<td>
|
||||
Displays server info to the user, including where to find the server's source code.
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
credits
|
||||
</td>
|
||||
<td>
|
||||
/credits
|
||||
</td>
|
||||
<td>
|
||||
Displays the names of the people behind Darkflame Universe.
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
instanceinfo
|
||||
</td>
|
||||
<td>
|
||||
/instanceinfo
|
||||
</td>
|
||||
<td>
|
||||
Displays in the chat the current zone, clone, and instance id.
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
gmlevel
|
||||
</td>
|
||||
<td>
|
||||
/gmlevel <level>
|
||||
</td>
|
||||
<td>
|
||||
Within the authorized range of levels for the current account, changes the character's game master level to the specified value. This is required to use certain commands.
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
testmap
|
||||
</td>
|
||||
<td>
|
||||
/testmap <zone> (clone-id)
|
||||
</td>
|
||||
<td>
|
||||
Transfers you to the given zone by id and clone id.
|
||||
</td>
|
||||
<td>
|
||||
1
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
ban
|
||||
</td>
|
||||
<td>
|
||||
/ban <username>
|
||||
</td>
|
||||
<td>
|
||||
Bans a user from the server.
|
||||
</td>
|
||||
<td>
|
||||
4
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
gmadditem
|
||||
</td>
|
||||
<td>
|
||||
/gmadditem <id> (count)
|
||||
</td>
|
||||
<td>
|
||||
Adds the given item to your inventory by id.
|
||||
</td>
|
||||
<td>
|
||||
8
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
spawn
|
||||
</td>
|
||||
<td>
|
||||
/spawn <id>
|
||||
</td>
|
||||
<td>
|
||||
Spawns an object at your location by id.
|
||||
</td>
|
||||
<td>
|
||||
8
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
metrics
|
||||
</td>
|
||||
<td>
|
||||
/metrics
|
||||
</td>
|
||||
<td>
|
||||
Prints some information about the server's performance.
|
||||
</td>
|
||||
<td>
|
||||
8
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
### Allowing a user to build in Brick-by-Brick mode
|
||||
Brick-By-Brick building requires `PATCHSERVERIP=0:` and `UGCSERVERIP=0:` in the `boot.cfg` to point to a HTTP server which always returns `HTTP 404 - Not Found` for all requests. This can be most easily achieved by pointing both of those variables to `localhost` while having running in the background.
|
||||
Each client must have their own 404 server running if they are using a locally hosted 404 server.
|
||||
```bash
|
||||
# If on linux run this command. Because this is run on a port below 1024, binary network permissions are needed.
|
||||
sudo python3 -m http.server 80
|
||||
|
||||
# If on windows one of the following will work when run through Powershell or Command Prompt assuming python is installed
|
||||
python3 -m http.server 80
|
||||
python http.server 80
|
||||
py -m http.server 80
|
||||
```
|
||||
|
||||
## Updating your server
|
||||
To update your server to the latest version navigate to your cloned directory
|
||||
```bash
|
||||
cd path/to/DarkflameServer
|
||||
```
|
||||
Run the following commands to update to the latest changes
|
||||
```bash
|
||||
git pull
|
||||
git submodule update --init --recursive
|
||||
```
|
||||
Now follow the [build](#build-the-server) section for your system and your server is up to date.
|
||||
|
||||
## In-game commands
|
||||
* A list of all in-game commands can be found [here](./docs/Commands.md).
|
||||
|
||||
## Verifying your client files
|
||||
|
||||
### LEGO® Universe 1.10.64
|
||||
To verify that you are indeed using a LEGO® Universe 1.10.64 client, make sure you have the full client compressed **in a rar file** and run the following command.
|
||||
```bash
|
||||
# Replace <file> with the file path to the zipped client
|
||||
|
||||
# If on Linux or MacOS
|
||||
shasum -a 256 <file>
|
||||
|
||||
# If on Windows using the Command Prompt
|
||||
certutil -hashfile <file> SHA256
|
||||
```
|
||||
|
||||
Below are known good SHA256 checksums of the client:
|
||||
* `8f6c7e84eca3bab93232132a88c4ae6f8367227d7eafeaa0ef9c40e86c14edf5` (packed client, rar compressed)
|
||||
* `c1531bf9401426042e8bab2de04ba1b723042dc01d9907c2635033d417de9e05` (packed client, includes extra locales, rar compressed)
|
||||
* `0d862f71eedcadc4494c4358261669721b40b2131101cbd6ef476c5a6ec6775b` (unpacked client, includes extra locales, rar compressed)
|
||||
|
||||
If the returned hash matches one of the lines above then you can continue with setting up the server. If you are using a fully downloaded and complete client from live, then it will work, but the hash above may not match. Otherwise you must obtain a full install of LEGO® Universe 1.10.64.
|
||||
|
||||
### Darkflame Universe Client
|
||||
Darkflame Universe clients identify themselves using a higher version number than the regular live clients out there.
|
||||
This was done make sure that older and incomplete clients wouldn't produce false positive bug reports for us, and because we made bug fixes and new content for the client.
|
||||
|
||||
To verify that you are indeed using a Darkflame Universe client, make sure you have the full client compressed **in a zip file** and run the following command.
|
||||
|
||||
```bash
|
||||
# Replace <file> with the file path to the zipped client
|
||||
|
||||
# If on Linux or MacOS
|
||||
shasum -a 1 <file>
|
||||
|
||||
# If on Windows using the Command Prompt
|
||||
certutil -hashfile <file> SHA1
|
||||
```
|
||||
|
||||
Known good *SHA1* checksum of the Darkflame Universe client:
|
||||
- `91498e09b83ce69f46baf9e521d48f23fe502985` (packed client, zip compressed)
|
||||
|
||||
# Development Documentation
|
||||
This is a Work in Progress, but below are some quick links to documentaion for systems and structs in the server
|
||||
[Networked message structs](https://lcdruniverse.org/lu_packets/lu_packets/index.html)
|
||||
[General system documentation](https://docs.lu-dev.net/en/latest/index.html)
|
||||
|
||||
# Credits
|
||||
|
||||
## DLU Team
|
||||
* [DarwinAnim8or](https://github.com/DarwinAnim8or)
|
||||
* [Wincent01](https://github.com/Wincent01)
|
||||
|
12
dCommon/dEnums/eBasicAttackSuccessTypes.h
Normal file
12
dCommon/dEnums/eBasicAttackSuccessTypes.h
Normal file
@ -0,0 +1,12 @@
|
||||
#ifndef __EBASICATTACKSUCCESSTYPES__H__
|
||||
#define __EBASICATTACKSUCCESSTYPES__H__
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
enum class eBasicAttackSuccessTypes : uint8_t {
|
||||
SUCCESS = 1,
|
||||
FAILARMOR,
|
||||
FAILIMMUNE
|
||||
};
|
||||
|
||||
#endif //!__EBASICATTACKSUCCESSTYPES__H__
|
@ -5,7 +5,7 @@
|
||||
#include "EntityManager.h"
|
||||
#include "DestroyableComponent.h"
|
||||
#include "BehaviorContext.h"
|
||||
|
||||
#include "eBasicAttackSuccessTypes.h"
|
||||
|
||||
void BasicAttackBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
if (context->unmanaged) {
|
||||
@ -31,130 +31,120 @@ void BasicAttackBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bi
|
||||
}
|
||||
Game::logger->LogDebug("BasicAttackBehavior", "Number of allocated bits %i", allocatedBits);
|
||||
const auto baseAddress = bitStream->GetReadOffset();
|
||||
|
||||
DoHandleBehavior(context, bitStream, branch);
|
||||
|
||||
bitStream->SetReadOffset(baseAddress + allocatedBits);
|
||||
}
|
||||
|
||||
void BasicAttackBehavior::DoHandleBehavior(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
auto* targetEntity = EntityManager::Instance()->GetEntity(branch.target);
|
||||
if (!targetEntity) {
|
||||
Game::logger->Log("BasicAttackBehavior", "Target targetEntity %i not found.", branch.target);
|
||||
return;
|
||||
}
|
||||
|
||||
auto* destroyableComponent = targetEntity->GetComponent<DestroyableComponent>();
|
||||
if (!destroyableComponent) {
|
||||
Game::logger->Log("BasicAttackBehavior", "No destroyable found on the obj/lot %llu/%i", branch.target, targetEntity->GetLOT());
|
||||
return;
|
||||
}
|
||||
|
||||
bool isBlocked{};
|
||||
bool isImmune{};
|
||||
bool isSuccess{};
|
||||
|
||||
if (!bitStream->Read(isBlocked)) {
|
||||
Game::logger->LogDebug("BasicAttackBehavior", "Unable to read isBlocked");
|
||||
Game::logger->Log("BasicAttackBehavior", "Unable to read isBlocked");
|
||||
return;
|
||||
}
|
||||
|
||||
if (isBlocked) return;
|
||||
if (isBlocked) {
|
||||
destroyableComponent->SetAttacksToBlock(std::min(destroyableComponent->GetAttacksToBlock() - 1, 0U));
|
||||
EntityManager::Instance()->SerializeEntity(targetEntity);
|
||||
this->m_OnFailBlocked->Handle(context, bitStream, branch);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!bitStream->Read(isImmune)) {
|
||||
Game::logger->LogDebug("BasicAttackBehavior", "Unable to read isImmune");
|
||||
Game::logger->Log("BasicAttackBehavior", "Unable to read isImmune");
|
||||
return;
|
||||
}
|
||||
|
||||
if (isImmune) return;
|
||||
|
||||
if (bitStream->Read(isSuccess) && isSuccess) { // Success
|
||||
uint32_t unknown{};
|
||||
if (!bitStream->Read(unknown)) {
|
||||
Game::logger->LogDebug("BasicAttackBehavior", "Unable to read unknown");
|
||||
if (isImmune) {
|
||||
this->m_OnFailImmune->Handle(context, bitStream, branch);
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t damageDealt{};
|
||||
if (!bitStream->Read(damageDealt)) {
|
||||
Game::logger->LogDebug("BasicAttackBehavior", "Unable to read damageDealt");
|
||||
if (!bitStream->Read(isSuccess)) {
|
||||
Game::logger->Log("BasicAttackBehavior", "failed to read success from bitstream");
|
||||
return;
|
||||
}
|
||||
|
||||
// A value that's too large may be a cheating attempt, so we set it to MIN too
|
||||
if (damageDealt > this->m_MaxDamage || damageDealt < this->m_MinDamage) {
|
||||
damageDealt = this->m_MinDamage;
|
||||
if (isSuccess) {
|
||||
uint32_t armorDamageDealt{};
|
||||
if (!bitStream->Read(armorDamageDealt)) {
|
||||
Game::logger->Log("BasicAttackBehavior", "Unable to read armorDamageDealt");
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t healthDamageDealt{};
|
||||
if (!bitStream->Read(healthDamageDealt)) {
|
||||
Game::logger->Log("BasicAttackBehavior", "Unable to read healthDamageDealt");
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t totalDamageDealt = armorDamageDealt + healthDamageDealt;
|
||||
|
||||
// A value that's too large may be a cheating attempt, so we set it to MIN
|
||||
if (totalDamageDealt > this->m_MaxDamage) {
|
||||
totalDamageDealt = this->m_MinDamage;
|
||||
}
|
||||
|
||||
auto* entity = EntityManager::Instance()->GetEntity(branch.target);
|
||||
bool died{};
|
||||
if (!bitStream->Read(died)) {
|
||||
Game::logger->LogDebug("BasicAttackBehavior", "Unable to read died");
|
||||
Game::logger->Log("BasicAttackBehavior", "Unable to read died");
|
||||
return;
|
||||
}
|
||||
|
||||
if (entity != nullptr) {
|
||||
auto* destroyableComponent = entity->GetComponent<DestroyableComponent>();
|
||||
if (destroyableComponent != nullptr) {
|
||||
PlayFx(u"onhit", entity->GetObjectID());
|
||||
destroyableComponent->Damage(damageDealt, context->originator, context->skillID);
|
||||
}
|
||||
}
|
||||
auto previousArmor = destroyableComponent->GetArmor();
|
||||
auto previousHealth = destroyableComponent->GetHealth();
|
||||
PlayFx(u"onhit", targetEntity->GetObjectID());
|
||||
destroyableComponent->Damage(totalDamageDealt, context->originator, context->skillID);
|
||||
}
|
||||
|
||||
uint8_t successState{};
|
||||
if (!bitStream->Read(successState)) {
|
||||
Game::logger->LogDebug("BasicAttackBehavior", "Unable to read success state");
|
||||
Game::logger->Log("BasicAttackBehavior", "Unable to read success state");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (successState) {
|
||||
case 1:
|
||||
switch (static_cast<eBasicAttackSuccessTypes>(successState)) {
|
||||
case eBasicAttackSuccessTypes::SUCCESS:
|
||||
this->m_OnSuccess->Handle(context, bitStream, branch);
|
||||
break;
|
||||
case eBasicAttackSuccessTypes::FAILARMOR:
|
||||
this->m_OnFailArmor->Handle(context, bitStream, branch);
|
||||
break;
|
||||
default:
|
||||
Game::logger->LogDebug("BasicAttackBehavior", "Unknown success state (%i)!", successState);
|
||||
if (static_cast<eBasicAttackSuccessTypes>(successState) != eBasicAttackSuccessTypes::FAILIMMUNE) {
|
||||
Game::logger->Log("BasicAttackBehavior", "Unknown success state (%i)!", successState);
|
||||
return;
|
||||
}
|
||||
this->m_OnFailImmune->Handle(context, bitStream, branch);
|
||||
break;
|
||||
}
|
||||
|
||||
bitStream->SetReadOffset(baseAddress + allocatedBits);
|
||||
}
|
||||
|
||||
void BasicAttackBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
auto* self = EntityManager::Instance()->GetEntity(context->originator);
|
||||
if (self == nullptr) {
|
||||
Game::logger->LogDebug("BasicAttackBehavior", "Invalid self entity (%llu)!", context->originator);
|
||||
return;
|
||||
}
|
||||
|
||||
bitStream->AlignWriteToByteBoundary();
|
||||
|
||||
const auto allocatedAddress = bitStream->GetWriteOffset();
|
||||
|
||||
bitStream->Write(uint16_t(0));
|
||||
bitStream->Write<uint16_t>(0);
|
||||
|
||||
const auto startAddress = bitStream->GetWriteOffset();
|
||||
|
||||
bitStream->Write0(); // Blocked
|
||||
bitStream->Write0(); // Immune
|
||||
bitStream->Write1(); // Success
|
||||
|
||||
if (true) {
|
||||
uint32_t unknown3 = 0;
|
||||
bitStream->Write(unknown3);
|
||||
|
||||
auto damage = this->m_MinDamage;
|
||||
auto* entity = EntityManager::Instance()->GetEntity(branch.target);
|
||||
|
||||
if (entity == nullptr) {
|
||||
damage = 0;
|
||||
bitStream->Write(damage);
|
||||
bitStream->Write(false);
|
||||
} else {
|
||||
bitStream->Write(damage);
|
||||
bitStream->Write(true);
|
||||
|
||||
auto* destroyableComponent = entity->GetComponent<DestroyableComponent>();
|
||||
if (damage != 0 && destroyableComponent != nullptr) {
|
||||
PlayFx(u"onhit", entity->GetObjectID(), 1);
|
||||
destroyableComponent->Damage(damage, context->originator, context->skillID, false);
|
||||
context->ScheduleUpdate(branch.target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t successState = 1;
|
||||
bitStream->Write(successState);
|
||||
|
||||
switch (successState) {
|
||||
case 1:
|
||||
this->m_OnSuccess->Calculate(context, bitStream, branch);
|
||||
break;
|
||||
default:
|
||||
Game::logger->LogDebug("BasicAttackBehavior", "Unknown success state (%i)!", successState);
|
||||
break;
|
||||
}
|
||||
DoBehaviorCalculation(context, bitStream, branch);
|
||||
|
||||
const auto endAddress = bitStream->GetWriteOffset();
|
||||
const uint16_t allocate = endAddress - startAddress + 1;
|
||||
@ -164,6 +154,87 @@ void BasicAttackBehavior::Calculate(BehaviorContext* context, RakNet::BitStream*
|
||||
bitStream->SetWriteOffset(startAddress + allocate);
|
||||
}
|
||||
|
||||
void BasicAttackBehavior::DoBehaviorCalculation(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
auto* targetEntity = EntityManager::Instance()->GetEntity(branch.target);
|
||||
if (!targetEntity) {
|
||||
Game::logger->Log("BasicAttackBehavior", "Target entity %llu is null!", branch.target);
|
||||
return;
|
||||
}
|
||||
|
||||
auto* destroyableComponent = targetEntity->GetComponent<DestroyableComponent>();
|
||||
if (!destroyableComponent || !destroyableComponent->GetParent()) {
|
||||
Game::logger->Log("BasicAttackBehavior", "No destroyable component on %llu", branch.target);
|
||||
return;
|
||||
}
|
||||
|
||||
const bool isBlocking = destroyableComponent->GetAttacksToBlock() > 0;
|
||||
|
||||
bitStream->Write(isBlocking);
|
||||
|
||||
if (isBlocking) {
|
||||
destroyableComponent->SetAttacksToBlock(destroyableComponent->GetAttacksToBlock() - 1);
|
||||
EntityManager::Instance()->SerializeEntity(targetEntity);
|
||||
this->m_OnFailBlocked->Calculate(context, bitStream, branch);
|
||||
return;
|
||||
}
|
||||
|
||||
const bool isImmune = destroyableComponent->IsImmune();
|
||||
|
||||
bitStream->Write(isImmune);
|
||||
|
||||
if (isImmune) {
|
||||
this->m_OnFailImmune->Calculate(context, bitStream, branch);
|
||||
return;
|
||||
}
|
||||
|
||||
bool isSuccess = false;
|
||||
const uint32_t previousHealth = destroyableComponent->GetHealth();
|
||||
const uint32_t previousArmor = destroyableComponent->GetArmor();
|
||||
|
||||
const auto damage = this->m_MinDamage;
|
||||
|
||||
PlayFx(u"onhit", targetEntity->GetObjectID(), 1);
|
||||
destroyableComponent->Damage(damage, context->originator, context->skillID, false);
|
||||
context->ScheduleUpdate(branch.target);
|
||||
|
||||
const uint32_t armorDamageDealt = previousArmor - destroyableComponent->GetArmor();
|
||||
const uint32_t healthDamageDealt = previousHealth - destroyableComponent->GetHealth();
|
||||
isSuccess = armorDamageDealt > 0 || healthDamageDealt > 0 || (armorDamageDealt + healthDamageDealt) > 0;
|
||||
|
||||
bitStream->Write(isSuccess);
|
||||
|
||||
eBasicAttackSuccessTypes successState = eBasicAttackSuccessTypes::FAILIMMUNE;
|
||||
if (isSuccess) {
|
||||
if (healthDamageDealt >= 1) {
|
||||
successState = eBasicAttackSuccessTypes::SUCCESS;
|
||||
} else if (armorDamageDealt >= 1) {
|
||||
successState = this->m_OnFailArmor->m_templateId == BehaviorTemplates::BEHAVIOR_EMPTY ? eBasicAttackSuccessTypes::FAILIMMUNE : eBasicAttackSuccessTypes::FAILARMOR;
|
||||
}
|
||||
|
||||
bitStream->Write(armorDamageDealt);
|
||||
bitStream->Write(healthDamageDealt);
|
||||
bitStream->Write(targetEntity->GetIsDead());
|
||||
}
|
||||
|
||||
bitStream->Write(successState);
|
||||
|
||||
switch (static_cast<eBasicAttackSuccessTypes>(successState)) {
|
||||
case eBasicAttackSuccessTypes::SUCCESS:
|
||||
this->m_OnSuccess->Calculate(context, bitStream, branch);
|
||||
break;
|
||||
case eBasicAttackSuccessTypes::FAILARMOR:
|
||||
this->m_OnFailArmor->Calculate(context, bitStream, branch);
|
||||
break;
|
||||
default:
|
||||
if (static_cast<eBasicAttackSuccessTypes>(successState) != eBasicAttackSuccessTypes::FAILIMMUNE) {
|
||||
Game::logger->Log("BasicAttackBehavior", "Unknown success state (%i)!", successState);
|
||||
break;
|
||||
}
|
||||
this->m_OnFailImmune->Calculate(context, bitStream, branch);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void BasicAttackBehavior::Load() {
|
||||
this->m_MinDamage = GetInt("min damage");
|
||||
if (this->m_MinDamage == 0) this->m_MinDamage = 1;
|
||||
@ -171,7 +242,14 @@ void BasicAttackBehavior::Load() {
|
||||
this->m_MaxDamage = GetInt("max damage");
|
||||
if (this->m_MaxDamage == 0) this->m_MaxDamage = 1;
|
||||
|
||||
// The client sets the minimum damage to maximum, so we'll do the same. These are usually the same value anyways.
|
||||
if (this->m_MinDamage < this->m_MaxDamage) this->m_MinDamage = this->m_MaxDamage;
|
||||
|
||||
this->m_OnSuccess = GetAction("on_success");
|
||||
|
||||
this->m_OnFailArmor = GetAction("on_fail_armor");
|
||||
|
||||
this->m_OnFailImmune = GetAction("on_fail_immune");
|
||||
|
||||
this->m_OnFailBlocked = GetAction("on_fail_blocked");
|
||||
}
|
||||
|
@ -7,10 +7,45 @@ public:
|
||||
explicit BasicAttackBehavior(const uint32_t behaviorId) : Behavior(behaviorId) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Reads a 16bit short from the bitStream and when the actual behavior handling finishes with all of its branches, the bitStream
|
||||
* is then offset to after the allocated bits for this stream.
|
||||
*
|
||||
*/
|
||||
void DoHandleBehavior(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch);
|
||||
|
||||
/**
|
||||
* @brief Handles a client initialized Basic Attack Behavior cast to be deserialized and verified on the server.
|
||||
*
|
||||
* @param context The Skill's Behavior context. All behaviors in the same tree share the same context
|
||||
* @param bitStream The bitStream to deserialize. BitStreams will always check their bounds before reading in a behavior
|
||||
* and will fail gracefully if an overread is detected.
|
||||
* @param branch The context of this specific branch of the Skill Behavior. Changes based on which branch you are going down.
|
||||
*/
|
||||
void Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
/**
|
||||
* @brief Writes a 16bit short to the bitStream and when the actual behavior calculation finishes with all of its branches, the number
|
||||
* of bits used is then written to where the 16bit short initially was.
|
||||
*
|
||||
*/
|
||||
void Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||
|
||||
/**
|
||||
* @brief Calculates a server initialized Basic Attack Behavior cast to be serialized to the client
|
||||
*
|
||||
* @param context The Skill's Behavior context. All behaviors in the same tree share the same context
|
||||
* @param bitStream The bitStream to serialize to.
|
||||
* @param branch The context of this specific branch of the Skill Behavior. Changes based on which branch you are going down.
|
||||
*/
|
||||
void DoBehaviorCalculation(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch);
|
||||
|
||||
/**
|
||||
* @brief Loads this Behaviors parameters from the database. For this behavior specifically:
|
||||
* max and min damage will always be the same. If min is less than max, they are both set to max.
|
||||
* If an action is not in the database, then no action is taken for that result.
|
||||
*
|
||||
*/
|
||||
void Load() override;
|
||||
private:
|
||||
uint32_t m_MinDamage;
|
||||
@ -20,4 +55,8 @@ private:
|
||||
Behavior* m_OnSuccess;
|
||||
|
||||
Behavior* m_OnFailArmor;
|
||||
|
||||
Behavior* m_OnFailImmune;
|
||||
|
||||
Behavior* m_OnFailBlocked;
|
||||
};
|
||||
|
@ -4,17 +4,17 @@
|
||||
#include "dLogger.h"
|
||||
|
||||
void MovementSwitchBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch) {
|
||||
uint32_t movementType{};
|
||||
if (!bitStream->Read(movementType)) {
|
||||
if (this->m_groundAction->m_templateId == BehaviorTemplates::BEHAVIOR_EMPTY &&
|
||||
this->m_jumpAction->m_templateId == BehaviorTemplates::BEHAVIOR_EMPTY &&
|
||||
this->m_fallingAction->m_templateId == BehaviorTemplates::BEHAVIOR_EMPTY &&
|
||||
this->m_doubleJumpAction->m_templateId == BehaviorTemplates::BEHAVIOR_EMPTY &&
|
||||
this->m_airAction->m_templateId == BehaviorTemplates::BEHAVIOR_EMPTY &&
|
||||
this->m_jetpackAction->m_templateId == BehaviorTemplates::BEHAVIOR_EMPTY) {
|
||||
this->m_jetpackAction->m_templateId == BehaviorTemplates::BEHAVIOR_EMPTY &&
|
||||
this->m_movingAction->m_templateId == BehaviorTemplates::BEHAVIOR_EMPTY) {
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t movementType{};
|
||||
if (!bitStream->Read(movementType)) {
|
||||
Game::logger->Log("MovementSwitchBehavior", "Unable to read movementType from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
|
||||
return;
|
||||
};
|
||||
@ -27,33 +27,40 @@ void MovementSwitchBehavior::Handle(BehaviorContext* context, RakNet::BitStream*
|
||||
this->m_jumpAction->Handle(context, bitStream, branch);
|
||||
break;
|
||||
case 3:
|
||||
this->m_fallingAction->Handle(context, bitStream, branch);
|
||||
this->m_airAction->Handle(context, bitStream, branch);
|
||||
break;
|
||||
case 4:
|
||||
this->m_doubleJumpAction->Handle(context, bitStream, branch);
|
||||
break;
|
||||
case 5:
|
||||
this->m_airAction->Handle(context, bitStream, branch);
|
||||
this->m_fallingAction->Handle(context, bitStream, branch);
|
||||
break;
|
||||
case 6:
|
||||
this->m_jetpackAction->Handle(context, bitStream, branch);
|
||||
break;
|
||||
default:
|
||||
Game::logger->Log("MovementSwitchBehavior", "Invalid movement behavior type (%i)!", movementType);
|
||||
this->m_groundAction->Handle(context, bitStream, branch);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void MovementSwitchBehavior::Load() {
|
||||
this->m_airAction = GetAction("air_action");
|
||||
|
||||
this->m_doubleJumpAction = GetAction("double_jump_action");
|
||||
|
||||
this->m_fallingAction = GetAction("falling_action");
|
||||
|
||||
this->m_groundAction = GetAction("ground_action");
|
||||
|
||||
this->m_jetpackAction = GetAction("jetpack_action");
|
||||
|
||||
this->m_jumpAction = GetAction("jump_action");
|
||||
Behavior* MovementSwitchBehavior::LoadMovementType(std::string movementType) {
|
||||
float actionValue = GetFloat(movementType, -1.0f);
|
||||
auto loadedBehavior = GetAction(actionValue != -1.0f ? actionValue : 0.0f);
|
||||
if (actionValue == -1.0f && loadedBehavior->m_templateId == BehaviorTemplates::BEHAVIOR_EMPTY) {
|
||||
loadedBehavior = this->m_groundAction;
|
||||
}
|
||||
return loadedBehavior;
|
||||
}
|
||||
|
||||
void MovementSwitchBehavior::Load() {
|
||||
float groundActionValue = GetFloat("ground_action", -1.0f);
|
||||
this->m_groundAction = GetAction(groundActionValue != -1.0f ? groundActionValue : 0.0f);
|
||||
|
||||
this->m_airAction = LoadMovementType("air_action");
|
||||
this->m_doubleJumpAction = LoadMovementType("double_jump_action");
|
||||
this->m_fallingAction = LoadMovementType("falling_action");
|
||||
this->m_jetpackAction = LoadMovementType("jetpack_action");
|
||||
this->m_jumpAction = LoadMovementType("jump_action");
|
||||
this->m_movingAction = LoadMovementType("moving_action");
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
class MovementSwitchBehavior final : public Behavior
|
||||
{
|
||||
public:
|
||||
private:
|
||||
/*
|
||||
* Members
|
||||
*/
|
||||
@ -19,6 +19,17 @@ public:
|
||||
|
||||
Behavior* m_jumpAction;
|
||||
|
||||
Behavior* m_movingAction;
|
||||
|
||||
/**
|
||||
* @brief Loads a movement type from the database into a behavior
|
||||
*
|
||||
* @param movementType The movement type to lookup in the database
|
||||
* @param behaviorToLoad The Behavior where the result will be stored
|
||||
*/
|
||||
Behavior* LoadMovementType(std::string movementType);
|
||||
|
||||
public:
|
||||
/*
|
||||
* Inherited
|
||||
*/
|
||||
|
@ -1,6 +1,5 @@
|
||||
# In-game commands
|
||||
|
||||
Here is a summary of the commands available in-game. All commands are prefixed by `/` and typed in the in-game chat window. Some commands requires admin privileges. Operands within `<>` are required, operands within `()` are not. For the full list of in-game commands, please checkout [the source file](../dGame/dUtilities/SlashCommandHandler.cpp).
|
||||
* All commands are prefixed by `/` and typed in the in-game chat window. Some commands require elevated gmlevel privileges. Operands within `<>` are required, operands within `()` are not.
|
||||
|
||||
## General Commands
|
||||
|
||||
@ -71,6 +70,7 @@ These commands are primarily for development and testing. The usage of many of t
|
||||
|createprivate|`/createprivate <zone id> <clone id> <password>`|Creates a private zone with password.|8|
|
||||
|debugui|`/debugui`|Toggle Debug UI.|8|
|
||||
|dismount|`/dismount`|Dismounts you from the vehicle or mount.|8|
|
||||
|reloadconfig|`/reloadconfig`|Reloads the server with the new config values.|8|
|
||||
|force-save|`/force-save`|While saving to database usually happens on regular intervals and when you disconnect from the server, this command saves your player's data to the database.|8|
|
||||
|freecam|`/freecam`|Toggles freecam mode.|8|
|
||||
|freemoney|`/freemoney <coins>`|Gives coins.|8|
|
||||
|
Loading…
Reference in New Issue
Block a user