Compare commits

..

1 Commits

Author SHA1 Message Date
Jett
df21009672 poggers test commit 2022-12-20 22:48:58 +00:00
532 changed files with 6295 additions and 8327 deletions

37
.clang-format Normal file
View File

@@ -0,0 +1,37 @@
---
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
BeforeLambdaBody: false
BeforeWhile: false
BreakBeforeBraces: Attach
ColumnLimit: 0
IndentWidth: 4
IndentCaseLabels: true
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '<[[:alnum:].]+\.h>'
Priority: 1
- Regex: '<[[:alnum:].]+>'
Priority: 2
- Regex: '.*/.*'
Priority: 3
- Regex: '.*'
Priority: 4
DerivePointerAlignment: false
PointerAlignment: Left
...

17
.clang-tidy Normal file
View File

@@ -0,0 +1,17 @@
Checks: '-*,readability-*,performance-*,modernize-*,-modernize-use-trailing-return-type,bugprone-*'
WarningsAsErrors: true
HeaderFilterRegex: ''
FormatStyle: none
CheckOptions:
- key: readability-identifier-naming.ClassCase
value: CamelCase
- key: readability-identifier-naming.ClassMethodCase
value: CamelCase
- key: readability-identifier-naming.ClassMemberPrefix
value: m_
- key: readability-identifier-naming.ClassMemberCase
value: CamelCase
- key: readability-identifier-naming.ClassConstantCase
value: UPPER_CASE
- key: readability-identifier-naming.FunctionCase
value: CamelCase

View File

@@ -6,6 +6,3 @@
# convert to unix line endings
72477e01e2711e0f61cdb192ee266e5e21b8846f
# enum cleanup
faf42d2f8cf432df2993b031f079b0b8c6d7dbe7

6
.gitmodules vendored
View File

@@ -14,6 +14,12 @@
path = thirdparty/mariadb-connector-cpp
url = https://github.com/mariadb-corporation/mariadb-connector-cpp.git
ignore = dirty
[submodule "thirdparty/docker-utils"]
path = thirdparty/docker-utils
url = https://github.com/lcdr/utils.git
[submodule "thirdparty/LUnpack"]
path = thirdparty/LUnpack
url = https://github.com/Xiphoseer/LUnpack.git
[submodule "thirdparty/AccountManager"]
path = thirdparty/AccountManager
url = https://github.com/DarkflameUniverse/AccountManager

View File

@@ -89,8 +89,8 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
# Create a /resServer directory
make_directory(${CMAKE_BINARY_DIR}/resServer)
# Create a /res directory
make_directory(${CMAKE_BINARY_DIR}/res)
# Create a /logs directory
make_directory(${CMAKE_BINARY_DIR}/logs)
@@ -163,7 +163,6 @@ set(INCLUDED_DIRECTORIES
"dGame/dMission"
"dGame/dEntity"
"dGame/dPropertyBehaviors"
"dGame/dPropertyBehaviors/ControlBehaviorMessages"
"dGame/dUtilities"
"dPhysics"
"dNavigation"
@@ -177,7 +176,6 @@ set(INCLUDED_DIRECTORIES
"dScripts/ai"
"dScripts/client"
"dScripts/EquipmentScripts"
"dScripts/EquipmentTriggers"
"dScripts/zone"
"dScripts/02_server/DLU"
"dScripts/02_server/Enemy"
@@ -338,6 +336,7 @@ endif()
add_subdirectory(dWorldServer)
add_subdirectory(dAuthServer)
add_subdirectory(dChatServer)
add_subdirectory(dUgcServer)
add_subdirectory(dMasterServer) # Add MasterServer last so it can rely on the other binaries
# Add our precompiled headers

View File

@@ -23,7 +23,10 @@
"name": "ci-macos-11",
"displayName": "CI configure step for MacOS",
"description": "Same as default, Used in GitHub actions workflow",
"inherits": "default"
"inherits": "default",
"cacheVariables": {
"OPENSSL_ROOT_DIR": "/usr/local/opt/openssl@3/"
}
},
{
"name": "ci-windows-2022",

View File

@@ -8,17 +8,15 @@ LICENSE=AGPL-3.0
# 171022 - Unmodded client
NET_VERSION=171022
# Debugging
# Set __dynamic to 1 to enable the -rdynamic flag for the linker, yielding some symbols in crashlogs.
__dynamic=1
# Set __ggdb to 1 to enable the -ggdb flag for the linker, including more debug info.
# Set __dynamic to 1 to enable the -rdynamic flag for the linker, yielding some symbols in crashlogs.
# __ggdb=1
# Set __include_backtrace__ to 1 to includes the backtrace library for better crashlogs.
# Set __ggdb to 1 to enable the -ggdb flag for the linker, including more debug info.
# __include_backtrace__=1
# Set __compile_backtrace__ to 1 to compile the backtrace library instead of using system libraries.
# Set __include_backtrace__ to 1 to includes the backtrace library for better crashlogs.
# __compile_backtrace__=1
# Set to the number of jobs (make -j equivalent) to compile the mariadbconn files with.
# Set __compile_backtrace__ to 1 to compile the backtrace library instead of using system libraries.
__maria_db_connector_compile_jobs__=1
# When set to 1 and uncommented, compiling and linking testing folders and libraries will be done.
# Set to the number of jobs (make -j equivalent) to compile the mariadbconn files with.
__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/
# When set to 1 and uncommented, compiling and linking testing folders and libraries will be done.

View File

@@ -4,7 +4,7 @@
- [Docker](https://docs.docker.com/get-docker/) (Docker Desktop or on Linux normal Docker)
- [Docker Compose](https://docs.docker.com/compose/install/) (Included in Docker Desktop)
- LEGO® Universe Client. Check the main [README](./README.md) for details on this.
- LEGO® Universe packed Client. Check the main [README](./README.md) for details on this.
## Run server inside Docker

View File

@@ -25,7 +25,7 @@
11. Once the command has completed (you can see you path again and can enter commands), close the window.
12. Inside the downloaded folder, copy `.env.example` and name the copy `.env`
13. Open `.env` with Notepad by right-clicking it and selecting _Open With_ -> _More apps_ -> _Notepad_.
14. Change the text after `CLIENT_PATH=` to the location of your client. This folder must contain either a folder `client` or `legouniverse.exe`.
14. Change the text after `CLIENT_PATH=` to the location of your client. The folder you are pointing to must contain a folder called `client` which should contain the client files.
> If you need the extra performance, place the client files in `\\wsl$\<your linux OS>\...` to avoid working across file systems, see [Docker Best Practices](https://docs.docker.com/desktop/windows/wsl/#best-practices) and [WSL documentation](https://docs.microsoft.com/en-us/windows/wsl/filesystems#file-storage-and-performance-across-file-systems).
15. Optionally, you can change the number after `BUILD_THREADS=` to the number of cores / threads your processor has. If your computer crashes while building, you can try to reduce this value.

611
README.md
View File

@@ -18,192 +18,210 @@ 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. 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.
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.
### 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 [here](#verifying-your-client-files) to see 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 in the resources tab below when checking if a client will work.
## 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)
## 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.
## 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
### Prerequisites
#### Clone the repository
```bash
git clone --recursive https://github.com/DarkflameUniverse/DarkflameServer
```
#### Python
## Install dependencies
Some tools utilized to streamline the setup process require Python 3, make sure you have it installed.
### 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!).
### 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
```
### 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.
### 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`.
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.
For Ubuntu, you would run the following commands. On other systems, the package install command will differ.
### 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.
```bash
sudo apt update && sudo apt upgrade
### Using Docker
Refer to [Docker.md](/Docker.md).
# Install packages
sudo apt install build-essential gcc zlib1g-dev libssl-dev openssl mariadb-server cmake
```
For Windows, refer to [Docker_Windows.md](/Docker_Windows.md).
#### 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
```
### 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`.
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.
CMake must be version 3.14 or higher!
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.
#### Build the repository
[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](build.sh).
Or manually run the commands used in `build.sh`:
If you would like to build the server faster, append `-j<number>` where number is the number of simultaneous compile jobs to run at once. It is recommended that you have this number always be 1 less than your core count to prevent slowdowns. The command would look like this if you would build with 4 jobs at once:
```bash
./build.sh -j4
# Create the build directory, preserving it if it already exists
mkdir -p build
cd build
# Run CMake to generate make files
cmake ..
# 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
```
### 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.
## Configuring your server
This server has a few steps that need to be taken to configure the server for your use case.
### MacOS builds
Ensure `cmake`, `zlib` and `open ssl` are installed as well as a compiler (e.g `clang` or `gcc`).
### 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.
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
### 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.
# 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
## Verify your setup
Your build directory should now look like this:
* AuthServer
* ChatServer
@@ -212,35 +230,42 @@ 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 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.
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.
### 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 management tool (Nexus Dashboard)
**If you are just using this server for yourself, you can skip setting up Nexus Dashboard**
### Account Manager
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.
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.
### 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.
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`.
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.
# User guide
Some changes to the client `boot.cfg` file are needed to play on your server.
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.
## Allowing a user to connect to your server
## User guide
A few modifications have to be made to the client.
### Client configuration
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:`
@@ -248,88 +273,159 @@ 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
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
<font size="4">**If you do not plan on doing any Brick Building, then you can skip this step.**</font>
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.
The easiest way to do this is to install [python](https://www.python.org/downloads/).
### 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).
### 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)
<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 &#60;level&#62;
</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 &#60;zone&#62; (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 &#60;username&#62;
</td>
<td>
Bans a user from the server.
</td>
<td>
4
</td>
</tr>
<tr>
<td>
gmadditem
</td>
<td>
/gmadditem &#60;id&#62; (count)
</td>
<td>
Adds the given item to your inventory by id.
</td>
<td>
8
</td>
</tr>
<tr>
<td>
spawn
</td>
<td>
/spawn &#60;id&#62;
</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>
# Credits
## Active Contributors
* [EmosewaMC](https://github.com/EmosewaMC)
* [Jettford](https://github.com/Jettford)
* [Aaron K.](https://github.com/aronwk-aaron)
## DLU Team
* [DarwinAnim8or](https://github.com/DarwinAnim8or)
@@ -338,30 +434,25 @@ This is a Work in Progress, but below are some quick links to documentaion for s
* [averysumner](https://github.com/codeshaunted)
* [Jon002](https://github.com/jaller200)
* [Jonny](https://github.com/cuzitsjonny)
* [Aaron K.](https://github.com/aronwk-aaron)
### Research and Tools
### Research and tools
* [lcdr](https://github.com/lcdr)
* [Xiphoseer](https://github.com/Xiphoseer)
### Community Management
### Community management
* [Neal](https://github.com/NealSpellman)
### Logo
* Cole Peterson (BlasterBuilder)
## Active Contributors
* [EmosewaMC](https://github.com/EmosewaMC)
* [Jettford](https://github.com/Jettford)
## Former Contributors
### Former contributors
* TheMachine
* Matthew
* [Raine](https://github.com/Rainebannister)
* Bricknave
## Special Thanks
### Logo
* Cole Peterson (BlasterBuilder)
## Special thanks
* humanoid24
* pwjones1969
* [Simon](https://github.com/SimonNitzsche)
* [ALL OF THE NETDEVIL AND LEGO TEAMS!](https://www.mobygames.com/game/macintosh/lego-universe/credits)
* ALL OF THE NETDEVIL AND LEGO TEAMS!

View File

@@ -9,5 +9,5 @@ cd build
cmake ..
# 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 $1
cmake --build . --config Release

View File

@@ -32,8 +32,6 @@ dLogger* SetupLogger();
void HandlePacket(Packet* packet);
int main(int argc, char** argv) {
constexpr uint32_t authFramerate = mediumFramerate;
constexpr uint32_t authFrameDelta = mediumFrameDelta;
Diagnostics::SetProcessName("Auth");
Diagnostics::SetProcessFileName(argv[0]);
Diagnostics::Initialize();
@@ -69,7 +67,7 @@ int main(int argc, char** argv) {
//Find out the master's IP:
std::string masterIP;
uint32_t masterPort = 1500;
int masterPort = 1500;
sql::PreparedStatement* stmt = Database::CreatePreppedStmt("SELECT ip, port FROM servers WHERE name='master';");
auto res = stmt->executeQuery();
while (res->next()) {
@@ -81,8 +79,8 @@ int main(int argc, char** argv) {
delete stmt;
//It's safe to pass 'localhost' here, as the IP is only used as the external IP.
uint32_t maxClients = 50;
uint32_t ourPort = 1001; //LU client is hardcoded to use this for auth port, so I'm making it the default.
int maxClients = 50;
int ourPort = 1001; //LU client is hardcoded to use this for auth port, so I'm making it the default.
if (Game::config->GetValue("max_clients") != "") maxClients = std::stoi(Game::config->GetValue("max_clients"));
if (Game::config->GetValue("port") != "") ourPort = std::atoi(Game::config->GetValue("port").c_str());
@@ -91,18 +89,16 @@ int main(int argc, char** argv) {
//Run it until server gets a kill message from Master:
auto t = std::chrono::high_resolution_clock::now();
Packet* packet = nullptr;
constexpr uint32_t logFlushTime = 30 * authFramerate; // 30 seconds in frames
constexpr uint32_t sqlPingTime = 10 * 60 * authFramerate; // 10 minutes in frames
uint32_t framesSinceLastFlush = 0;
uint32_t framesSinceMasterDisconnect = 0;
uint32_t framesSinceLastSQLPing = 0;
int framesSinceLastFlush = 0;
int framesSinceMasterDisconnect = 0;
int framesSinceLastSQLPing = 0;
while (!Game::shouldShutdown) {
//Check if we're still connected to master:
if (!Game::server->GetIsConnectedToMaster()) {
framesSinceMasterDisconnect++;
if (framesSinceMasterDisconnect >= authFramerate)
if (framesSinceMasterDisconnect >= 30)
break; //Exit our loop, shut down.
} else framesSinceMasterDisconnect = 0;
@@ -118,16 +114,16 @@ int main(int argc, char** argv) {
}
//Push our log every 30s:
if (framesSinceLastFlush >= logFlushTime) {
if (framesSinceLastFlush >= 900) {
Game::logger->Flush();
framesSinceLastFlush = 0;
} else framesSinceLastFlush++;
//Every 10 min we ping our sql server to keep it alive hopefully:
if (framesSinceLastSQLPing >= sqlPingTime) {
if (framesSinceLastSQLPing >= 40000) {
//Find out the master's IP for absolutely no reason:
std::string masterIP;
uint32_t masterPort;
int masterPort;
sql::PreparedStatement* stmt = Database::CreatePreppedStmt("SELECT ip, port FROM servers WHERE name='master';");
auto res = stmt->executeQuery();
while (res->next()) {
@@ -142,7 +138,7 @@ int main(int argc, char** argv) {
} else framesSinceLastSQLPing++;
//Sleep our thread since auth can afford to.
t += std::chrono::milliseconds(authFrameDelta); //Auth can run at a lower "fps"
t += std::chrono::milliseconds(mediumFramerate); //Auth can run at a lower "fps"
std::this_thread::sleep_until(t);
}

View File

@@ -8,8 +8,8 @@
#include "dServer.h"
#include "GeneralUtils.h"
#include "dLogger.h"
#include "eAddFriendResponseCode.h"
#include "eAddFriendResponseType.h"
#include "AddFriendResponseCode.h"
#include "AddFriendResponseType.h"
#include "RakString.h"
#include "dConfig.h"
@@ -115,7 +115,7 @@ void ChatPacketHandler::HandleFriendRequest(Packet* packet) {
auto requestor = playerContainer.GetPlayerData(requestorPlayerID);
if (requestor->playerName == playerName) {
SendFriendResponse(requestor, requestor, eAddFriendResponseType::MYTHRAN);
SendFriendResponse(requestor, requestor, AddFriendResponseType::MYTHRAN);
return;
};
std::unique_ptr<PlayerData> requestee(playerContainer.GetPlayerData(playerName));
@@ -153,7 +153,7 @@ void ChatPacketHandler::HandleFriendRequest(Packet* packet) {
requestee.reset(new PlayerData());
requestee->playerName = playerName;
SendFriendResponse(requestor, requestee.get(), result->next() ? eAddFriendResponseType::NOTONLINE : eAddFriendResponseType::INVALIDCHARACTER);
SendFriendResponse(requestor, requestee.get(), result->next() ? AddFriendResponseType::NOTONLINE : AddFriendResponseType::INVALIDCHARACTER);
return;
}
@@ -197,10 +197,10 @@ void ChatPacketHandler::HandleFriendRequest(Packet* packet) {
if (oldBestFriendStatus != bestFriendStatus) {
if (requestee->countOfBestFriends >= maxNumberOfBestFriends || requestor->countOfBestFriends >= maxNumberOfBestFriends) {
if (requestee->countOfBestFriends >= maxNumberOfBestFriends) {
SendFriendResponse(requestor, requestee.get(), eAddFriendResponseType::THEIRFRIENDLISTFULL, false);
SendFriendResponse(requestor, requestee.get(), AddFriendResponseType::THEIRFRIENDLISTFULL, false);
}
if (requestor->countOfBestFriends >= maxNumberOfBestFriends) {
SendFriendResponse(requestor, requestee.get(), eAddFriendResponseType::YOURFRIENDSLISTFULL, false);
SendFriendResponse(requestor, requestee.get(), AddFriendResponseType::YOURFRIENDSLISTFULL, false);
}
} else {
// Then update the database with this new info.
@@ -215,8 +215,8 @@ void ChatPacketHandler::HandleFriendRequest(Packet* packet) {
if (bestFriendStatus == 3U) {
requestee->countOfBestFriends += 1;
requestor->countOfBestFriends += 1;
if (requestee->sysAddr != UNASSIGNED_SYSTEM_ADDRESS) SendFriendResponse(requestee.get(), requestor, eAddFriendResponseType::ACCEPTED, false, true);
if (requestor->sysAddr != UNASSIGNED_SYSTEM_ADDRESS) SendFriendResponse(requestor, requestee.get(), eAddFriendResponseType::ACCEPTED, false, true);
if (requestee->sysAddr != UNASSIGNED_SYSTEM_ADDRESS) SendFriendResponse(requestee.get(), requestor, AddFriendResponseType::ACCEPTED, false, true);
if (requestor->sysAddr != UNASSIGNED_SYSTEM_ADDRESS) SendFriendResponse(requestor, requestee.get(), AddFriendResponseType::ACCEPTED, false, true);
for (auto& friendData : requestor->friends) {
if (friendData.friendID == requestee->playerID) {
friendData.isBestFriend = true;
@@ -230,7 +230,7 @@ void ChatPacketHandler::HandleFriendRequest(Packet* packet) {
}
}
} else {
if (requestor->sysAddr != UNASSIGNED_SYSTEM_ADDRESS) SendFriendResponse(requestor, requestee.get(), eAddFriendResponseType::WAITINGAPPROVAL, true, true);
if (requestor->sysAddr != UNASSIGNED_SYSTEM_ADDRESS) SendFriendResponse(requestor, requestee.get(), AddFriendResponseType::WAITINGAPPROVAL, true, true);
}
} else {
// Do not send this if we are requesting to be a best friend.
@@ -247,7 +247,7 @@ void ChatPacketHandler::HandleFriendResponse(Packet* packet) {
inStream.Read(playerID);
inStream.Read(playerID);
eAddFriendResponseCode clientResponseCode = static_cast<eAddFriendResponseCode>(packet->data[0x14]);
AddFriendResponseCode clientResponseCode = static_cast<AddFriendResponseCode>(packet->data[0x14]);
std::string friendName = PacketUtils::ReadString(0x15, packet, true);
//Now to try and find both of these:
@@ -255,29 +255,29 @@ void ChatPacketHandler::HandleFriendResponse(Packet* packet) {
auto requestee = playerContainer.GetPlayerData(friendName);
if (!requestor || !requestee) return;
eAddFriendResponseType serverResponseCode{};
AddFriendResponseType serverResponseCode{};
uint8_t isAlreadyBestFriends = 0U;
// We need to convert this response code to one we can actually send back to the client.
switch (clientResponseCode) {
case eAddFriendResponseCode::ACCEPTED:
serverResponseCode = eAddFriendResponseType::ACCEPTED;
case AddFriendResponseCode::ACCEPTED:
serverResponseCode = AddFriendResponseType::ACCEPTED;
break;
case eAddFriendResponseCode::BUSY:
serverResponseCode = eAddFriendResponseType::BUSY;
case AddFriendResponseCode::BUSY:
serverResponseCode = AddFriendResponseType::BUSY;
break;
case eAddFriendResponseCode::CANCELLED:
serverResponseCode = eAddFriendResponseType::CANCELLED;
case AddFriendResponseCode::CANCELLED:
serverResponseCode = AddFriendResponseType::CANCELLED;
break;
case eAddFriendResponseCode::REJECTED:
serverResponseCode = eAddFriendResponseType::DECLINED;
case AddFriendResponseCode::REJECTED:
serverResponseCode = AddFriendResponseType::DECLINED;
break;
}
// Now that we have handled the base cases, we need to check the other cases.
if (serverResponseCode == eAddFriendResponseType::ACCEPTED) {
if (serverResponseCode == AddFriendResponseType::ACCEPTED) {
for (auto friendData : requestor->friends) {
if (friendData.friendID == requestee->playerID) {
serverResponseCode = eAddFriendResponseType::ALREADYFRIEND;
serverResponseCode = AddFriendResponseType::ALREADYFRIEND;
if (friendData.isBestFriend) {
isAlreadyBestFriends = 1U;
}
@@ -286,7 +286,7 @@ void ChatPacketHandler::HandleFriendResponse(Packet* packet) {
}
// This message is NOT sent for best friends and is handled differently for those requests.
if (serverResponseCode == eAddFriendResponseType::ACCEPTED) {
if (serverResponseCode == AddFriendResponseType::ACCEPTED) {
// Add the each player to the others friend list.
FriendData requestorData;
requestorData.zoneID = requestor->zoneID;
@@ -313,8 +313,8 @@ void ChatPacketHandler::HandleFriendResponse(Packet* packet) {
statement->execute();
}
if (serverResponseCode != eAddFriendResponseType::DECLINED) SendFriendResponse(requestor, requestee, serverResponseCode, isAlreadyBestFriends);
if (serverResponseCode != eAddFriendResponseType::ALREADYFRIEND) SendFriendResponse(requestee, requestor, serverResponseCode, isAlreadyBestFriends);
if (serverResponseCode != AddFriendResponseType::DECLINED) SendFriendResponse(requestor, requestee, serverResponseCode, isAlreadyBestFriends);
if (serverResponseCode != AddFriendResponseType::ALREADYFRIEND) SendFriendResponse(requestee, requestor, serverResponseCode, isAlreadyBestFriends);
}
void ChatPacketHandler::HandleRemoveFriend(Packet* packet) {
@@ -922,7 +922,7 @@ void ChatPacketHandler::SendFriendRequest(PlayerData* receiver, PlayerData* send
//Make sure people aren't requesting people that they're already friends with:
for (auto fr : receiver->friends) {
if (fr.friendID == sender->playerID) {
SendFriendResponse(sender, receiver, eAddFriendResponseType::ALREADYFRIEND, fr.isBestFriend);
SendFriendResponse(sender, receiver, AddFriendResponseType::ALREADYFRIEND, fr.isBestFriend);
return; //we have this player as a friend, yeet this function so it doesn't send another request.
}
}
@@ -940,7 +940,7 @@ void ChatPacketHandler::SendFriendRequest(PlayerData* receiver, PlayerData* send
SEND_PACKET;
}
void ChatPacketHandler::SendFriendResponse(PlayerData* receiver, PlayerData* sender, eAddFriendResponseType responseCode, uint8_t isBestFriendsAlready, uint8_t isBestFriendRequest) {
void ChatPacketHandler::SendFriendResponse(PlayerData* receiver, PlayerData* sender, AddFriendResponseType responseCode, uint8_t isBestFriendsAlready, uint8_t isBestFriendRequest) {
if (!receiver || !sender) return;
CBITSTREAM;
@@ -951,11 +951,11 @@ void ChatPacketHandler::SendFriendResponse(PlayerData* receiver, PlayerData* sen
PacketUtils::WriteHeader(bitStream, CLIENT, MSG_CLIENT_ADD_FRIEND_RESPONSE);
bitStream.Write(responseCode);
// For all requests besides accepted, write a flag that says whether or not we are already best friends with the receiver.
bitStream.Write<uint8_t>(responseCode != eAddFriendResponseType::ACCEPTED ? isBestFriendsAlready : sender->sysAddr != UNASSIGNED_SYSTEM_ADDRESS);
bitStream.Write<uint8_t>(responseCode != AddFriendResponseType::ACCEPTED ? isBestFriendsAlready : sender->sysAddr != UNASSIGNED_SYSTEM_ADDRESS);
// Then write the player name
PacketUtils::WritePacketWString(sender->playerName.c_str(), 33, &bitStream);
// Then if this is an acceptance code, write the following extra info.
if (responseCode == eAddFriendResponseType::ACCEPTED) {
if (responseCode == AddFriendResponseType::ACCEPTED) {
bitStream.Write(sender->playerID);
bitStream.Write(sender->zoneID);
bitStream.Write(isBestFriendRequest); //isBFF

View File

@@ -4,7 +4,7 @@
#include "BitStream.h"
struct PlayerData;
enum class eAddFriendResponseType : uint8_t;
enum class AddFriendResponseType : uint8_t;
namespace ChatPacketHandler {
void HandleFriendlistRequest(Packet* packet);
@@ -35,6 +35,6 @@ namespace ChatPacketHandler {
void SendFriendUpdate(PlayerData* friendData, PlayerData* playerData, uint8_t notifyType, uint8_t isBestFriend);
void SendFriendRequest(PlayerData* receiver, PlayerData* sender);
void SendFriendResponse(PlayerData* receiver, PlayerData* sender, eAddFriendResponseType responseCode, uint8_t isBestFriendsAlready = 0U, uint8_t isBestFriendRequest = 0U);
void SendFriendResponse(PlayerData* receiver, PlayerData* sender, AddFriendResponseType responseCode, uint8_t isBestFriendsAlready = 0U, uint8_t isBestFriendRequest = 0U);
void SendRemoveFriend(PlayerData* receiver, std::string& personToRemove, bool isSuccessful);
};

View File

@@ -19,9 +19,6 @@
#include "ChatPacketHandler.h"
#include "Game.h"
//RakNet includes:
#include "RakNetDefines.h"
namespace Game {
dLogger* logger = nullptr;
dServer* server = nullptr;
@@ -31,6 +28,8 @@ namespace Game {
bool shouldShutdown = false;
}
//RakNet includes:
#include "RakNetDefines.h"
dLogger* SetupLogger();
void HandlePacket(Packet* packet);
@@ -38,8 +37,6 @@ void HandlePacket(Packet* packet);
PlayerContainer playerContainer;
int main(int argc, char** argv) {
constexpr uint32_t chatFramerate = mediumFramerate;
constexpr uint32_t chatFrameDelta = mediumFrameDelta;
Diagnostics::SetProcessName("Chat");
Diagnostics::SetProcessFileName(argv[0]);
Diagnostics::Initialize();
@@ -68,7 +65,7 @@ int main(int argc, char** argv) {
Game::assetManager = new AssetManager(clientPath);
} catch (std::runtime_error& ex) {
Game::logger->Log("ChatServer", "Got an error while setting up assets: %s", ex.what());
return EXIT_FAILURE;
}
@@ -90,7 +87,7 @@ int main(int argc, char** argv) {
//Find out the master's IP:
std::string masterIP;
uint32_t masterPort = 1000;
int masterPort = 1000;
sql::PreparedStatement* stmt = Database::CreatePreppedStmt("SELECT ip, port FROM servers WHERE name='master';");
auto res = stmt->executeQuery();
while (res->next()) {
@@ -102,8 +99,8 @@ int main(int argc, char** argv) {
delete stmt;
//It's safe to pass 'localhost' here, as the IP is only used as the external IP.
uint32_t maxClients = 50;
uint32_t ourPort = 1501;
int maxClients = 50;
int ourPort = 1501;
if (Game::config->GetValue("max_clients") != "") maxClients = std::stoi(Game::config->GetValue("max_clients"));
if (Game::config->GetValue("port") != "") ourPort = std::atoi(Game::config->GetValue("port").c_str());
@@ -114,18 +111,16 @@ int main(int argc, char** argv) {
//Run it until server gets a kill message from Master:
auto t = std::chrono::high_resolution_clock::now();
Packet* packet = nullptr;
constexpr uint32_t logFlushTime = 30 * chatFramerate; // 30 seconds in frames
constexpr uint32_t sqlPingTime = 10 * 60 * chatFramerate; // 10 minutes in frames
uint32_t framesSinceLastFlush = 0;
uint32_t framesSinceMasterDisconnect = 0;
uint32_t framesSinceLastSQLPing = 0;
int framesSinceLastFlush = 0;
int framesSinceMasterDisconnect = 0;
int framesSinceLastSQLPing = 0;
while (!Game::shouldShutdown) {
//Check if we're still connected to master:
if (!Game::server->GetIsConnectedToMaster()) {
framesSinceMasterDisconnect++;
if (framesSinceMasterDisconnect >= chatFramerate)
if (framesSinceMasterDisconnect >= 30)
break; //Exit our loop, shut down.
} else framesSinceMasterDisconnect = 0;
@@ -141,16 +136,16 @@ int main(int argc, char** argv) {
}
//Push our log every 30s:
if (framesSinceLastFlush >= logFlushTime) {
if (framesSinceLastFlush >= 900) {
Game::logger->Flush();
framesSinceLastFlush = 0;
} else framesSinceLastFlush++;
//Every 10 min we ping our sql server to keep it alive hopefully:
if (framesSinceLastSQLPing >= sqlPingTime) {
if (framesSinceLastSQLPing >= 40000) {
//Find out the master's IP for absolutely no reason:
std::string masterIP;
uint32_t masterPort;
int masterPort;
sql::PreparedStatement* stmt = Database::CreatePreppedStmt("SELECT ip, port FROM servers WHERE name='master';");
auto res = stmt->executeQuery();
while (res->next()) {
@@ -165,7 +160,7 @@ int main(int argc, char** argv) {
} else framesSinceLastSQLPing++;
//Sleep our thread since auth can afford to.
t += std::chrono::milliseconds(chatFrameDelta); //Chat can run at a lower "fps"
t += std::chrono::milliseconds(mediumFramerate); //Chat can run at a lower "fps"
std::this_thread::sleep_until(t);
}

View File

@@ -257,7 +257,7 @@ private:
/*!
\return The AMF value type
*/
AMFValueType GetValueType() override { return ValueType; }
AMFValueType GetValueType() { return ValueType; }
public:
static const AMFValueType ValueType = AMFArray;
@@ -362,7 +362,7 @@ private:
/*!
\return The AMF value type
*/
AMFValueType GetValueType() override { return ValueType; }
AMFValueType GetValueType() { return ValueType; }
~AMFObjectValue() override;
public:

View File

@@ -10,11 +10,10 @@
#include "GeneralUtils.h"
#include "Game.h"
#include "dLogger.h"
#include "AssetManager.h"
#include "eSqliteDataType.h"
std::map<eSqliteDataType, std::string> FdbToSqlite::Convert::m_SqliteType = {
std::map<eSqliteDataType, std::string> FdbToSqlite::Convert::sqliteType = {
{ eSqliteDataType::NONE, "none"},
{ eSqliteDataType::INT32, "int32"},
{ eSqliteDataType::REAL, "real"},
@@ -24,23 +23,20 @@ std::map<eSqliteDataType, std::string> FdbToSqlite::Convert::m_SqliteType = {
{ eSqliteDataType::TEXT_8, "text_8"}
};
FdbToSqlite::Convert::Convert(std::string binaryOutPath) {
this->m_BinaryOutPath = binaryOutPath;
FdbToSqlite::Convert::Convert(std::string basePath) {
this->basePath = basePath;
}
bool FdbToSqlite::Convert::ConvertDatabase(AssetMemoryBuffer& buffer) {
if (m_ConversionStarted) return false;
bool FdbToSqlite::Convert::ConvertDatabase() {
fdb.open(basePath + "/cdclient.fdb", std::ios::binary);
std::istream cdClientBuffer(&buffer);
this->m_ConversionStarted = true;
try {
CDClientDatabase::Connect(m_BinaryOutPath + "/CDServer.sqlite");
CDClientDatabase::Connect(basePath + "/CDServer.sqlite");
CDClientDatabase::ExecuteQuery("BEGIN TRANSACTION;");
int32_t numberOfTables = ReadInt32(cdClientBuffer);
ReadTables(numberOfTables, cdClientBuffer);
int32_t numberOfTables = ReadInt32();
ReadTables(numberOfTables);
CDClientDatabase::ExecuteQuery("COMMIT;");
} catch (CppSQLite3Exception& e) {
@@ -48,133 +44,138 @@ bool FdbToSqlite::Convert::ConvertDatabase(AssetMemoryBuffer& buffer) {
return false;
}
fdb.close();
return true;
}
int32_t FdbToSqlite::Convert::ReadInt32(std::istream& cdClientBuffer) {
int32_t FdbToSqlite::Convert::ReadInt32() {
int32_t nextInt{};
BinaryIO::BinaryRead(cdClientBuffer, nextInt);
BinaryIO::BinaryRead(fdb, nextInt);
return nextInt;
}
int64_t FdbToSqlite::Convert::ReadInt64(std::istream& cdClientBuffer) {
int32_t prevPosition = SeekPointer(cdClientBuffer);
int64_t FdbToSqlite::Convert::ReadInt64() {
int32_t prevPosition = SeekPointer();
int64_t value{};
BinaryIO::BinaryRead(cdClientBuffer, value);
BinaryIO::BinaryRead(fdb, value);
cdClientBuffer.seekg(prevPosition);
fdb.seekg(prevPosition);
return value;
}
std::string FdbToSqlite::Convert::ReadString(std::istream& cdClientBuffer) {
int32_t prevPosition = SeekPointer(cdClientBuffer);
std::string FdbToSqlite::Convert::ReadString() {
int32_t prevPosition = SeekPointer();
auto readString = BinaryIO::ReadString(cdClientBuffer);
auto readString = BinaryIO::ReadString(fdb);
cdClientBuffer.seekg(prevPosition);
fdb.seekg(prevPosition);
return readString;
}
int32_t FdbToSqlite::Convert::SeekPointer(std::istream& cdClientBuffer) {
int32_t FdbToSqlite::Convert::SeekPointer() {
int32_t position{};
BinaryIO::BinaryRead(cdClientBuffer, position);
int32_t prevPosition = cdClientBuffer.tellg();
cdClientBuffer.seekg(position);
BinaryIO::BinaryRead(fdb, position);
int32_t prevPosition = fdb.tellg();
fdb.seekg(position);
return prevPosition;
}
std::string FdbToSqlite::Convert::ReadColumnHeader(std::istream& cdClientBuffer) {
int32_t prevPosition = SeekPointer(cdClientBuffer);
std::string FdbToSqlite::Convert::ReadColumnHeader() {
int32_t prevPosition = SeekPointer();
int32_t numberOfColumns = ReadInt32(cdClientBuffer);
std::string tableName = ReadString(cdClientBuffer);
int32_t numberOfColumns = ReadInt32();
std::string tableName = ReadString();
auto columns = ReadColumns(numberOfColumns, cdClientBuffer);
auto columns = ReadColumns(numberOfColumns);
std::string newTable = "CREATE TABLE IF NOT EXISTS '" + tableName + "' (" + columns + ");";
CDClientDatabase::ExecuteDML(newTable);
cdClientBuffer.seekg(prevPosition);
fdb.seekg(prevPosition);
return tableName;
}
void FdbToSqlite::Convert::ReadTables(int32_t& numberOfTables, std::istream& cdClientBuffer) {
int32_t prevPosition = SeekPointer(cdClientBuffer);
void FdbToSqlite::Convert::ReadTables(int32_t& numberOfTables) {
int32_t prevPosition = SeekPointer();
for (int32_t i = 0; i < numberOfTables; i++) {
auto columnHeader = ReadColumnHeader(cdClientBuffer);
ReadRowHeader(columnHeader, cdClientBuffer);
auto columnHeader = ReadColumnHeader();
ReadRowHeader(columnHeader);
}
cdClientBuffer.seekg(prevPosition);
fdb.seekg(prevPosition);
}
std::string FdbToSqlite::Convert::ReadColumns(int32_t& numberOfColumns, std::istream& cdClientBuffer) {
std::string FdbToSqlite::Convert::ReadColumns(int32_t& numberOfColumns) {
std::stringstream columnsToCreate;
int32_t prevPosition = SeekPointer(cdClientBuffer);
int32_t prevPosition = SeekPointer();
std::string name{};
eSqliteDataType dataType{};
for (int32_t i = 0; i < numberOfColumns; i++) {
if (i != 0) columnsToCreate << ", ";
dataType = static_cast<eSqliteDataType>(ReadInt32(cdClientBuffer));
name = ReadString(cdClientBuffer);
columnsToCreate << "'" << name << "' " << FdbToSqlite::Convert::m_SqliteType[dataType];
dataType = static_cast<eSqliteDataType>(ReadInt32());
name = ReadString();
columnsToCreate << "'" << name << "' " << FdbToSqlite::Convert::sqliteType[dataType];
}
cdClientBuffer.seekg(prevPosition);
fdb.seekg(prevPosition);
return columnsToCreate.str();
}
void FdbToSqlite::Convert::ReadRowHeader(std::string& tableName, std::istream& cdClientBuffer) {
int32_t prevPosition = SeekPointer(cdClientBuffer);
void FdbToSqlite::Convert::ReadRowHeader(std::string& tableName) {
int32_t prevPosition = SeekPointer();
int32_t numberOfAllocatedRows = ReadInt32(cdClientBuffer);
int32_t numberOfAllocatedRows = ReadInt32();
if (numberOfAllocatedRows != 0) assert((numberOfAllocatedRows & (numberOfAllocatedRows - 1)) == 0); // assert power of 2 allocation size
ReadRows(numberOfAllocatedRows, tableName, cdClientBuffer);
ReadRows(numberOfAllocatedRows, tableName);
cdClientBuffer.seekg(prevPosition);
fdb.seekg(prevPosition);
}
void FdbToSqlite::Convert::ReadRows(int32_t& numberOfAllocatedRows, std::string& tableName, std::istream& cdClientBuffer) {
int32_t prevPosition = SeekPointer(cdClientBuffer);
void FdbToSqlite::Convert::ReadRows(int32_t& numberOfAllocatedRows, std::string& tableName) {
int32_t prevPosition = SeekPointer();
int32_t rowid = 0;
for (int32_t row = 0; row < numberOfAllocatedRows; row++) {
int32_t rowPointer = ReadInt32(cdClientBuffer);
int32_t rowPointer = ReadInt32();
if (rowPointer == -1) rowid++;
else ReadRow(rowPointer, tableName, cdClientBuffer);
else ReadRow(rowid, rowPointer, tableName);
}
cdClientBuffer.seekg(prevPosition);
fdb.seekg(prevPosition);
}
void FdbToSqlite::Convert::ReadRow(int32_t& position, std::string& tableName, std::istream& cdClientBuffer) {
int32_t prevPosition = cdClientBuffer.tellg();
cdClientBuffer.seekg(position);
void FdbToSqlite::Convert::ReadRow(int32_t& rowid, int32_t& position, std::string& tableName) {
int32_t prevPosition = fdb.tellg();
fdb.seekg(position);
while (true) {
ReadRowInfo(tableName, cdClientBuffer);
int32_t linked = ReadInt32(cdClientBuffer);
ReadRowInfo(tableName);
int32_t linked = ReadInt32();
rowid += 1;
if (linked == -1) break;
cdClientBuffer.seekg(linked);
fdb.seekg(linked);
}
cdClientBuffer.seekg(prevPosition);
fdb.seekg(prevPosition);
}
void FdbToSqlite::Convert::ReadRowInfo(std::string& tableName, std::istream& cdClientBuffer) {
int32_t prevPosition = SeekPointer(cdClientBuffer);
void FdbToSqlite::Convert::ReadRowInfo(std::string& tableName) {
int32_t prevPosition = SeekPointer();
int32_t numberOfColumns = ReadInt32(cdClientBuffer);
ReadRowValues(numberOfColumns, tableName, cdClientBuffer);
int32_t numberOfColumns = ReadInt32();
ReadRowValues(numberOfColumns, tableName);
cdClientBuffer.seekg(prevPosition);
fdb.seekg(prevPosition);
}
void FdbToSqlite::Convert::ReadRowValues(int32_t& numberOfColumns, std::string& tableName, std::istream& cdClientBuffer) {
int32_t prevPosition = SeekPointer(cdClientBuffer);
void FdbToSqlite::Convert::ReadRowValues(int32_t& numberOfColumns, std::string& tableName) {
int32_t prevPosition = SeekPointer();
int32_t emptyValue{};
int32_t intValue{};
@@ -188,26 +189,26 @@ void FdbToSqlite::Convert::ReadRowValues(int32_t& numberOfColumns, std::string&
for (int32_t i = 0; i < numberOfColumns; i++) {
if (i != 0) insertedRow << ", "; // Only append comma and space after first entry in row.
switch (static_cast<eSqliteDataType>(ReadInt32(cdClientBuffer))) {
switch (static_cast<eSqliteDataType>(ReadInt32())) {
case eSqliteDataType::NONE:
BinaryIO::BinaryRead(cdClientBuffer, emptyValue);
BinaryIO::BinaryRead(fdb, emptyValue);
assert(emptyValue == 0);
insertedRow << "NULL";
break;
case eSqliteDataType::INT32:
intValue = ReadInt32(cdClientBuffer);
intValue = ReadInt32();
insertedRow << intValue;
break;
case eSqliteDataType::REAL:
BinaryIO::BinaryRead(cdClientBuffer, floatValue);
BinaryIO::BinaryRead(fdb, floatValue);
insertedRow << std::fixed << std::setprecision(34) << floatValue; // maximum precision of floating point number
break;
case eSqliteDataType::TEXT_4:
case eSqliteDataType::TEXT_8: {
stringValue = ReadString(cdClientBuffer);
stringValue = ReadString();
size_t position = 0;
// Need to escape quote with a double of ".
@@ -223,12 +224,12 @@ void FdbToSqlite::Convert::ReadRowValues(int32_t& numberOfColumns, std::string&
}
case eSqliteDataType::INT_BOOL:
BinaryIO::BinaryRead(cdClientBuffer, boolValue);
BinaryIO::BinaryRead(fdb, boolValue);
insertedRow << static_cast<bool>(boolValue);
break;
case eSqliteDataType::INT64:
int64Value = ReadInt64(cdClientBuffer);
int64Value = ReadInt64();
insertedRow << std::to_string(int64Value);
break;
@@ -243,5 +244,5 @@ void FdbToSqlite::Convert::ReadRowValues(int32_t& numberOfColumns, std::string&
auto copiedString = insertedRow.str();
CDClientDatabase::ExecuteDML(copiedString);
cdClientBuffer.seekg(prevPosition);
fdb.seekg(prevPosition);
}

View File

@@ -7,139 +7,43 @@
#include <iosfwd>
#include <map>
class AssetMemoryBuffer;
enum class eSqliteDataType : int32_t;
namespace FdbToSqlite {
class Convert {
public:
/**
* Create a new convert object with an input .fdb file and an output binary path.
*
* @param inputFile The file which ends in .fdb to be converted
* @param binaryPath The base path where the file will be saved
*/
Convert(std::string binaryOutPath);
Convert(std::string inputFile);
/**
* Converts the input file to sqlite. Calling multiple times is safe.
*
* @return true if the database was converted properly, false otherwise.
*/
bool ConvertDatabase(AssetMemoryBuffer& buffer);
bool ConvertDatabase();
/**
* @brief Reads a 32 bit int from the fdb file.
*
* @return The read value
*/
int32_t ReadInt32(std::istream& cdClientBuffer);
int32_t ReadInt32();
/**
* @brief Reads a 64 bit integer from the fdb file.
*
* @return The read value
*/
int64_t ReadInt64(std::istream& cdClientBuffer);
int64_t ReadInt64();
/**
* @brief Reads a string from the fdb file.
*
* @return The read string
*
* TODO This needs to be translated to latin-1!
*/
std::string ReadString(std::istream& cdClientBuffer);
std::string ReadString();
/**
* @brief Seeks to a pointer position.
*
* @return The previous position before the seek
*/
int32_t SeekPointer(std::istream& cdClientBuffer);
int32_t SeekPointer();
/**
* @brief Reads a column header from the fdb file and creates the table in the database
*
* @return The table name
*/
std::string ReadColumnHeader(std::istream& cdClientBuffer);
std::string ReadColumnHeader();
/**
* @brief Read the tables from the fdb file.
*
* @param numberOfTables The number of tables to read
*/
void ReadTables(int32_t& numberOfTables, std::istream& cdClientBuffer);
void ReadTables(int32_t& numberOfTables);
/**
* @brief Reads the columns from the fdb file.
*
* @param numberOfColumns The number of columns to read
* @return All columns of the table formatted for a sql query
*/
std::string ReadColumns(int32_t& numberOfColumns, std::istream& cdClientBuffer);
std::string ReadColumns(int32_t& numberOfColumns);
/**
* @brief Reads the row header from the fdb file.
*
* @param tableName The tables name
*/
void ReadRowHeader(std::string& tableName, std::istream& cdClientBuffer);
void ReadRowHeader(std::string& tableName);
/**
* @brief Read the rows from the fdb file.,
*
* @param numberOfAllocatedRows The number of rows that were allocated. Always a power of 2!
* @param tableName The tables name.
*/
void ReadRows(int32_t& numberOfAllocatedRows, std::string& tableName, std::istream& cdClientBuffer);
void ReadRows(int32_t& numberOfAllocatedRows, std::string& tableName);
/**
* @brief Reads a row from the fdb file.
*
* @param position The position to seek in the fdb to
* @param tableName The tables name
*/
void ReadRow(int32_t& position, std::string& tableName, std::istream& cdClientBuffer);
void ReadRow(int32_t& rowid, int32_t& position, std::string& tableName);
/**
* @brief Reads the row info from the fdb file.
*
* @param tableName The tables name
*/
void ReadRowInfo(std::string& tableName, std::istream& cdClientBuffer);
void ReadRowInfo(std::string& tableName);
/**
* @brief Reads each row and its values from the fdb file and inserts them into the database
*
* @param numberOfColumns The number of columns to read in
* @param tableName The tables name
*/
void ReadRowValues(int32_t& numberOfColumns, std::string& tableName, std::istream& cdClientBuffer);
void ReadRowValues(int32_t& numberOfColumns, std::string& tableName);
private:
/**
* Maps each sqlite data type to its string equivalent.
*/
static std::map<eSqliteDataType, std::string> m_SqliteType;
/**
* Base path of the folder containing the fdb file
*/
std::string m_BasePath{};
/**
* Whether or not a conversion was started. If one was started, do not attempt to convert the file again.
*/
bool m_ConversionStarted{};
/**
* The path where the CDServer will be stored
*/
std::string m_BinaryOutPath{};
}; //! class FdbToSqlite
static std::map<eSqliteDataType, std::string> sqliteType;
std::string basePath{};
std::ifstream fdb{};
}; // class FdbToSqlite
}; //! namespace FdbToSqlite
#endif //!__FDBTOSQLITE__H__

View File

@@ -15,7 +15,6 @@
#include "dLogger.h"
enum eInventoryType : uint32_t;
enum class eReplicaComponentType : uint32_t;
/*!
\file GeneralUtils.hpp
@@ -182,11 +181,6 @@ namespace GeneralUtils {
return static_cast<eInventoryType>(std::stoul(value));
}
template <>
inline eReplicaComponentType Parse(const char* value) {
return static_cast<eReplicaComponentType>(std::stoul(value));
}
template <typename T>
bool TryParse(const char* value, T& dst) {
try {

42
dCommon/PermissionMap.h Normal file
View File

@@ -0,0 +1,42 @@
#pragma once
#include <cstdint>
/**
* Bitmap of permissions and restrictions for characters.
*/
enum class PermissionMap : uint64_t
{
/**
* Reserved for future use, bit 0-3.
*/
/**
* The character has restricted trade acccess, bit 4.
*/
RestrictedTradeAccess = 0x1 << 4,
/**
* The character has restricted mail access, bit 5.
*/
RestrictedMailAccess = 0x1 << 5,
/**
* The character has restricted chat access, bit 6.
*/
RestrictedChatAccess = 0x1 << 6,
//
// Combined permissions
//
/**
* The character is marked as 'old', restricted from trade and mail.
*/
Old = RestrictedTradeAccess | RestrictedMailAccess,
/**
* The character is soft banned, restricted from trade, mail, and chat.
*/
SoftBanned = RestrictedTradeAccess | RestrictedMailAccess | RestrictedChatAccess,
};

View File

@@ -8,6 +8,34 @@ namespace ZCompression {
return (nLenSrc + 6 + (n16kBlocks * 5));
}
int32_t GZipCompress(const uint8_t* abSrc, int32_t nLenSrc, uint8_t* abDst, int32_t nLenDst) {
z_stream stream;
stream.next_in = (Bytef*)abSrc;
stream.avail_in = nLenSrc;
stream.next_out = (Bytef*)abDst;
stream.avail_out = nLenDst;
stream.zalloc = Z_NULL;
stream.zfree = Z_NULL;
stream.opaque = Z_NULL;
int32_t nErr, nRet = -1;
nErr = deflateInit2(&stream, Z_DEFAULT_COMPRESSION, Z_DEFLATED, -MAX_WBITS, 8, Z_DEFAULT_STRATEGY);
if (nErr == Z_OK) {
nErr = deflate(&stream, Z_FINISH);
if (nErr == Z_STREAM_END) {
nRet = stream.total_out;
} else {
deflateEnd(&stream);
return nErr;
}
} else {
return nErr;
}
nErr = deflateEnd(&stream);
return (nErr == Z_OK) ? nRet : nErr;
}
int32_t Compress(const uint8_t* abSrc, int32_t nLenSrc, uint8_t* abDst, int32_t nLenDst) {
z_stream zInfo = { 0 };
zInfo.total_in = zInfo.avail_in = nLenSrc;

View File

@@ -5,6 +5,7 @@
namespace ZCompression {
int32_t GetMaxCompressedLength(int32_t nLenSrc);
int32_t GZipCompress(const uint8_t* abSrc, int32_t nLenSrc, uint8_t* abDst, int32_t nLenDst);
int32_t Compress(const uint8_t* abSrc, int32_t nLenSrc, uint8_t* abDst, int32_t nLenDst);
int32_t Decompress(const uint8_t* abSrc, int32_t nLenSrc, uint8_t* abDst, int32_t nLenDst, int32_t& nErr);

View File

@@ -45,6 +45,9 @@ AssetManager::AssetManager(const std::filesystem::path& path) {
switch (m_AssetBundleType) {
case eAssetBundleType::Packed: {
this->LoadPackIndex();
this->UnpackRequiredAssets();
break;
}
}
@@ -157,6 +160,31 @@ AssetMemoryBuffer AssetManager::GetFileAsBuffer(const char* name) {
return AssetMemoryBuffer(buf, len, success);
}
void AssetManager::UnpackRequiredAssets() {
if (std::filesystem::exists(m_ResPath / "cdclient.fdb")) return;
char* data;
uint32_t size;
bool success = this->GetFile("cdclient.fdb", &data, &size);
if (!success) {
Game::logger->Log("AssetManager", "Failed to extract required files from the packs.");
delete data;
return;
}
std::ofstream cdclientOutput(m_ResPath / "cdclient.fdb", std::ios::out | std::ios::binary);
cdclientOutput.write(data, size);
cdclientOutput.close();
delete data;
return;
}
uint32_t AssetManager::crc32b(uint32_t base, uint8_t* message, size_t l) {
size_t i, j;
uint32_t crc, msb;

View File

@@ -60,6 +60,7 @@ public:
private:
void LoadPackIndex();
void UnpackRequiredAssets();
// Modified crc algorithm (mpeg2)
// Reference: https://stackoverflow.com/questions/54339800/how-to-modify-crc-32-to-crc-32-mpeg-2

View File

@@ -24,6 +24,7 @@ public:
* Reloads the config file to reset values
*/
void ReloadConfig();
private:
void ProcessLine(const std::string& line);

View File

@@ -1,11 +1,11 @@
#pragma once
#ifndef __EADDFRIENDRESPONSECODE__H__
#define __EADDFRIENDRESPONSECODE__H__
#ifndef __ADDFRIENDRESPONSECODE__H__
#define __ADDFRIENDRESPONSECODE__H__
#include <cstdint>
enum class eAddFriendResponseCode : uint8_t {
enum class AddFriendResponseCode : uint8_t {
ACCEPTED = 0,
REJECTED,
BUSY,

View File

@@ -1,11 +1,11 @@
#pragma once
#ifndef __EADDFRIENDRESPONSETYPE__H__
#define __EADDFRIENDRESPONSETYPE__H__
#ifndef __ADDFRIENDRESPONSETYPE__H__
#define __ADDFRIENDRESPONSETYPE__H__
#include <cstdint>
enum class eAddFriendResponseType : uint8_t {
enum class AddFriendResponseType : uint8_t {
ACCEPTED = 0,
ALREADYFRIEND,
INVALIDCHARACTER,
@@ -21,4 +21,4 @@ enum class eAddFriendResponseType : uint8_t {
FRIENDISFREETRIAL
};
#endif //!__EADDFRIENDRESPONSETYPE__H__
#endif //!__ADDFRIENDRESPONSETYPE__H__

View File

@@ -0,0 +1,105 @@
#pragma once
/**
2 Engineer (Rank 1) Item Set
3 Engineer (Rank 2) Item Set
4 Engineer (Rank 3) Item Set
7 Knight (Rank 1) Item Set
8 Knight (Rank 2) Item Set
9 Knight (Rank 3) Item Set
10 Space Ranger (Rank 1) Item Set
11 Space Ranger (Rank 2) Item Set
12 Space Ranger (Rank 3) Item Set
13 Samurai (Rank 1) Item Set
14 Samurai (Rank 2) Item Set
15 Samurai (Rank 3) Item Set
16 Sorcerer (Rank 1) Item Set
17 Sorcerer (Rank 2) Item Set
18 Sorcerer (Rank 3) Item Set
19 Space Marauder (Rank 1) Item Set
20 Space Marauder (Rank 2) Item Set
21 Space Marauder (Rank 3) Item Set
22 Shinobi (Rank 1) Item Set
23 Shinobi (Rank 2) Item Set
24 Shinobi (Rank 3) Item Set
25 Inventor (Rank 1) Item Set
26 Inventor (Rank 2) Item Set
27 Inventor (Rank 3) Item Set
28 Summoner (Rank 1) Item Set
29 Summoner (Rank 2) Item Set
30 Summoner (Rank 3) Item Set
31 Adventurer (Rank 1) Item Set
32 Adventurer (Rank 2) Item Set
33 Adventurer (Rank 3) Item Set
34 Daredevil (Rank 1) Item Set
35 Daredevil (Rank 2) Item Set
36 Daredevil (Rank 3) Item Set
37 Buccaneer (Rank 1) Item Set
38 Buccaneer (Rank 2) Item Set
39 Buccaneer (Rank 3) Item Set
40 Bone Suit Item Set
41 Imagination Spinjitzu Item Set
42 Bat Lord Item Set
43 Mosaic Jester Item Set
44 Explorien Bot Item Set
45 [Unnamed] Item Set
46 [Unnamed] Item Set
47 [Unnamed] Item Set
48 Earth Spinjitzu Item Set
49 [Unnamed] Item Set
50 Fire Spinjitzu Item Set
51 Ice Spinjitzu Item Set
52 Lightning Spinjitzu Item Set
*/
enum class ItemSetPassiveAbilityID
{
EngineerRank1 = 2,
EngineerRank2 = 3,
EngineerRank3 = 4,
KnightRank1 = 7,
KnightRank2 = 8,
KnightRank3 = 9,
SpaceRangerRank1 = 10,
SpaceRangerRank2 = 11,
SpaceRangerRank3 = 12,
SamuraiRank1 = 13,
SamuraiRank2 = 14,
SamuraiRank3 = 15,
SorcererRank1 = 16,
SorcererRank2 = 17,
SorcererRank3 = 18,
SpaceMarauderRank1 = 19,
SpaceMarauderRank2 = 20,
SpaceMarauderRank3 = 21,
ShinobiRank1 = 22,
ShinobiRank2 = 23,
ShinobiRank3 = 24,
InventorRank1 = 25,
InventorRank2 = 26,
InventorRank3 = 27,
SummonerRank1 = 28,
SummonerRank2 = 29,
SummonerRank3 = 30,
AdventurerRank1 = 31,
AdventurerRank2 = 32,
AdventurerRank3 = 33,
DaredevilRank1 = 34,
DaredevilRank2 = 35,
DaredevilRank3 = 36,
BuccaneerRank1 = 37,
BuccaneerRank2 = 38,
BuccaneerRank3 = 39,
BoneSuit = 40,
ImaginationSpinjitzu = 41,
BatLord = 42,
MosaicJester = 43,
ExplorienBot = 44,
Unnamed1 = 45,
Unnamed2 = 46,
Unnamed3 = 47,
EarthSpinjitzu = 48,
Unnamed4 = 49,
FireSpinjitzu = 50,
IceSpinjitzu = 51,
LightningSpinjitzu = 52
};

View File

@@ -0,0 +1,13 @@
#pragma once
#ifndef MISSIONLOCKSTATE_H
#define MISSIONLOCKSTATE_H
enum class MissionLockState : int
{
MISSION_LOCK_LOCKED,
MISSION_LOCK_NEW,
MISSION_LOCK_UNLOCKED,
};
#endif

View File

@@ -0,0 +1,56 @@
#pragma once
#ifndef __MISSIONSTATE__H__
#define __MISSIONSTATE__H__
/**
* Represents the possible states a mission can be in
*/
enum class MissionState : int {
/**
* The mission state is unknown
*/
MISSION_STATE_UNKNOWN = -1,
/**
* The mission is yielding rewards
*/
MISSION_STATE_REWARDING = 0,
/**
* The mission can be accepted
*/
MISSION_STATE_AVAILABLE = 1,
/**
* The mission has been accepted but not yet completed
*/
MISSION_STATE_ACTIVE = 2,
/**
* All the tasks for the mission have been completed and the entity can turn the mission in to complete it
*/
MISSION_STATE_READY_TO_COMPLETE = 4, //!< The mission is ready to complete
/**
* The mission has been completed
*/
MISSION_STATE_COMPLETE = 8,
/**
* The mission is available again and has been completed before. Used for daily missions.
*/
MISSION_STATE_COMPLETE_AVAILABLE = 9,
/**
* The mission is active and has been completed before. Used for daily missions.
*/
MISSION_STATE_COMPLETE_ACTIVE = 10,
/**
* The mission has been completed before and has now been completed again. Used for daily missions.
*/
MISSION_STATE_COMPLETE_READY_TO_COMPLETE = 12
};
#endif //!__MISSIONSTATE__H__

View File

@@ -0,0 +1,31 @@
#pragma once
#ifndef MISSIONTASKTYPE_H
#define MISSIONTASKTYPE_H
//! An enum for mission task types
enum class MissionTaskType : int {
MISSION_TASK_TYPE_UNKNOWN = -1, //!< The task type is unknown
MISSION_TASK_TYPE_SMASH = 0, //!< A task for smashing something
MISSION_TASK_TYPE_SCRIPT = 1, //!< A task handled by a server LUA script
MISSION_TASK_TYPE_ACTIVITY = 2, //!< A task for completing a quickbuild
MISSION_TASK_TYPE_ENVIRONMENT = 3, //!< A task for something in the environment
MISSION_TASK_TYPE_MISSION_INTERACTION = 4, //!< A task for interacting with a mission
MISSION_TASK_TYPE_EMOTE = 5, //!< A task for playing an emote
MISSION_TASK_TYPE_FOOD = 9, //!< A task for eating food
MISSION_TASK_TYPE_SKILL = 10, //!< A task for performing a skill
MISSION_TASK_TYPE_ITEM_COLLECTION = 11, //!< A task for collecting an item
MISSION_TASK_TYPE_LOCATION = 12, //!< A task for finding a location
MISSION_TASK_TYPE_MINIGAME = 14, //!< A task for doing something in a minigame
MISSION_TASK_TYPE_NON_MISSION_INTERACTION = 15, //!< A task for interacting with a non-mission
MISSION_TASK_TYPE_MISSION_COMPLETE = 16, //!< A task for completing a mission
MISSION_TASK_TYPE_EARN_REPUTATION = 17, //!< A task for earning reputation
MISSION_TASK_TYPE_POWERUP = 21, //!< A task for collecting a powerup
MISSION_TASK_TYPE_PET_TAMING = 22, //!< A task for taming a pet
MISSION_TASK_TYPE_RACING = 23, //!< A task for racing
MISSION_TASK_TYPE_PLAYER_FLAG = 24, //!< A task for setting a player flag
MISSION_TASK_TYPE_PLACE_MODEL = 25, //!< A task for picking up a model
MISSION_TASK_TYPE_VISIT_PROPERTY = 30 //!< A task for visiting a property
};
#endif

View File

@@ -0,0 +1,20 @@
#pragma once
#include <cstdint>
enum class RacingTaskParam : int32_t {
RACING_TASK_PARAM_FINISH_WITH_PLACEMENT = 1, //<! A task param for finishing with a specific placement.
RACING_TASK_PARAM_LAP_TIME = 2, //<! A task param for finishing with a specific lap time.
RACING_TASK_PARAM_TOTAL_TRACK_TIME = 3, //<! A task param for finishing with a specific track time.
RACING_TASK_PARAM_COMPLETE_ANY_RACING_TASK = 4, //<! A task param for completing a racing task.
RACING_TASK_PARAM_COMPLETE_TRACK_TASKS = 5, //<! A task param for completing a task for a specific track.
RACING_TASK_PARAM_MODULAR_BUILDING = 6, //<! A task param for modular building with racing builds.
RACING_TASK_PARAM_SAFE_DRIVER = 10, //<! A task param for completing a race without smashing.
RACING_TASK_PARAM_SMASHABLES = 11, //<! A task param for smashing entities during a race.
RACING_TASK_PARAM_COLLECT_IMAGINATION = 12, //<! A task param for collecting imagination during a race.
RACING_TASK_PARAM_COMPETED_IN_RACE = 13, //<! A task param for competing in a race.
RACING_TASK_PARAM_WIN_RACE_IN_WORLD = 14, //<! A task param for winning a race in a specific world.
RACING_TASK_PARAM_FIRST_PLACE_MULTIPLE_TRACKS = 15, //<! A task param for finishing in first place on multiple tracks.
RACING_TASK_PARAM_LAST_PLACE_FINISH = 16, //<! A task param for finishing in last place.
RACING_TASK_PARAM_SMASH_SPECIFIC_SMASHABLE = 17 //<! A task param for smashing dragon eggs during a race.
};

View File

@@ -6,25 +6,15 @@
#include <cstdint>
#include <string>
#include <set>
#include "BitStream.h"
#include "../thirdparty/raknet/Source/BitStream.h"
#pragma warning (disable:4251) //Disables SQL warnings
typedef int RESTICKET;
// These are the same define, but they mean two different things in different contexts
// so a different define to distinguish what calculation is happening will help clarity.
#define FRAMES_TO_MS(x) 1000 / x
#define MS_TO_FRAMES(x) 1000 / x
//=========== FRAME TIMINGS ===========
constexpr uint32_t highFramerate = 60;
constexpr uint32_t mediumFramerate = 30;
constexpr uint32_t lowFramerate = 15;
constexpr uint32_t highFrameDelta = FRAMES_TO_MS(highFramerate);
constexpr uint32_t mediumFrameDelta = FRAMES_TO_MS(mediumFramerate);
constexpr uint32_t lowFrameDelta = FRAMES_TO_MS(lowFramerate);
const int highFrameRate = 16; //60fps
const int mediumFramerate = 33; //30fps
const int lowFramerate = 66; //15fps
//========== MACROS ===========
@@ -43,7 +33,8 @@ typedef uint32_t LWOCLONEID; //!< Used for Clone IDs
typedef uint16_t LWOMAPID; //!< Used for Map IDs
typedef uint16_t LWOINSTANCEID; //!< Used for Instance IDs
typedef uint32_t PROPERTYCLONELIST; //!< Used for Property Clone IDs
typedef uint32_t StripId;
typedef uint32_t STRIPID;
typedef uint32_t BEHAVIORSTATE;
typedef int32_t PetTamingPiece; //!< Pet Taming Pieces
@@ -64,6 +55,11 @@ typedef std::set<LWOOBJID> TSetObjID;
const float PI = 3.14159f;
#if defined(__unix) || defined(__APPLE__)
//For Linux:
typedef __int64_t __int64;
#endif
//============ STRUCTS ==============
struct LWOSCENEID {
@@ -256,6 +252,20 @@ enum eReplicaPacketType {
PACKET_TYPE_DESTRUCTION //!< A destruction packet
};
enum ServerDisconnectIdentifiers {
SERVER_DISCON_UNKNOWN_SERVER_ERROR = 0, //!< Unknown server error
SERVER_DISCON_DUPLICATE_LOGIN = 4, //!< Used when another user with the same username is logged in (duplicate login)
SERVER_DISCON_SERVER_SHUTDOWN = 5, //!< Used when the server is shutdown
SERVER_DISCON_SERVER_MAP_LOAD_FAILURE = 6, //!< Used when the server cannot load a map
SERVER_DISCON_INVALID_SESSION_KEY = 7, //!< Used if the session is invalid
SERVER_DISCON_ACCOUNT_NOT_IN_PENDING_LIST = 8, //!< ???
SERVER_DISCON_CHARACTER_NOT_FOUND = 9, //!< Used if a character that the server has is not found (i.e, corruption with user-player data)
SERVER_DISCON_CHARACTER_CORRUPTED = 10, //!< Similar to abovce
SERVER_DISCON_KICK = 11, //!< Used if the user is kicked from the server
SERVER_DISCON_FREE_TRIAL_EXPIRED = 12, //!< Used if the user's free trial expired
SERVER_DISCON_PLAY_SCHEDULE_TIME_DONE = 13 //!< Used if the user's play time is used up
};
//! The Behavior Types for use with the AI system
enum eCombatBehaviorTypes : uint32_t {
PASSIVE = 0, //!< The object is passive
@@ -346,7 +356,7 @@ enum eControlSceme {
SCHEME_WEAR_A_ROBOT //== freecam?
};
enum class eStateChangeType : uint32_t {
enum eStunState {
PUSH,
POP
};
@@ -360,6 +370,56 @@ enum eNotifyType {
NOTIFY_TYPE_NAMINGPET
};
enum eReplicaComponentType : int32_t {
COMPONENT_TYPE_CONTROLLABLE_PHYSICS = 1, //!< The ControllablePhysics Component
COMPONENT_TYPE_RENDER = 2, //!< The Render Component
COMPONENT_TYPE_SIMPLE_PHYSICS = 3, //!< The SimplePhysics Component
COMPONENT_TYPE_CHARACTER = 4, //!< The Character Component
COMPONENT_TYPE_SCRIPT = 5, //!< The Script Component
COMPONENT_TYPE_BOUNCER = 6, //!< The Bouncer Component
COMPONENT_TYPE_BUFF = 7, //!< The Buff Component
COMPONENT_TYPE_SKILL = 9, //!< The Skill Component
COMPONENT_TYPE_ITEM = 11, //!< The Item Component
COMPONENT_TYPE_VENDOR = 16, //!< The Vendor Component
COMPONENT_TYPE_INVENTORY = 17, //!< The Inventory Component
COMPONENT_TYPE_SHOOTING_GALLERY = 19, //!< The Shooting Gallery Component
COMPONENT_TYPE_RIGID_BODY_PHANTOM_PHYSICS = 20, //!< The RigidBodyPhantomPhysics Component
COMPONENT_TYPE_COLLECTIBLE = 23, //!< The Collectible Component
COMPONENT_TYPE_MOVING_PLATFORM = 25, //!< The MovingPlatform Component
COMPONENT_TYPE_PET = 26, //!< The Pet Component
COMPONENT_TYPE_VEHICLE_PHYSICS = 30, //!< The VehiclePhysics Component
COMPONENT_TYPE_MOVEMENT_AI = 31, //!< The MovementAI Component
COMPONENT_TYPE_PROPERTY = 36, //!< The Property Component
COMPONENT_TYPE_SCRIPTED_ACTIVITY = 39, //!< The ScriptedActivity Component
COMPONENT_TYPE_PHANTOM_PHYSICS = 40, //!< The PhantomPhysics Component
COMPONENT_TYPE_MODEL = 42, //!< The Model Component
COMPONENT_TYPE_PROPERTY_ENTRANCE = 43, //!< The PhantomPhysics Component
COMPONENT_TYPE_PROPERTY_MANAGEMENT = 45, //!< The PropertyManagement Component
COMPONENT_TYPE_REBUILD = 48, //!< The Rebuild Component
COMPONENT_TYPE_SWITCH = 49, //!< The Switch Component
COMPONENT_TYPE_ZONE_CONTROL = 50, //!< The ZoneControl Component
COMPONENT_TYPE_PACKAGE = 53, //!< The Package Component
COMPONENT_TYPE_PLAYER_FLAG = 58, //!< The PlayerFlag Component
COMPONENT_TYPE_BASE_COMBAT_AI = 60, //!< The BaseCombatAI Component
COMPONENT_TYPE_MODULE_ASSEMBLY = 61, //!< The ModuleAssembly Component
COMPONENT_TYPE_PROPERTY_VENDOR = 65, //!< The PropertyVendor Component
COMPONENT_TYPE_ROCKET_LAUNCH = 67, //!< The RocketLaunch Component
COMPONENT_TYPE_RACING_CONTROL = 71, //!< The RacingControl Component
COMPONENT_TYPE_MISSION_OFFER = 73, //!< The MissionOffer Component
COMPONENT_TYPE_EXHIBIT = 75, //!< The Exhibit Component
COMPONENT_TYPE_RACING_STATS = 74, //!< The Racing Stats Component
COMPONENT_TYPE_SOUND_TRIGGER = 77, //!< The Sound Trigger Component
COMPONENT_TYPE_PROXIMITY_MONITOR = 78, //!< The Proximity Monitor Component
COMPONENT_TYPE_MISSION = 84, //!< The Mission Component
COMPONENT_TYPE_ROCKET_LAUNCH_LUP = 97, //!< The LUP Launchpad Componen
COMPONENT_TYPE_RAIL_ACTIVATOR = 104, //!< The Rail Activator Component
COMPONENT_TYPE_PLAYER_FORCED_MOVEMENT = 106, //!< The Player Forced Movement Component
COMPONENT_TYPE_POSSESSABLE = 108, //!< The Possessable Component
COMPONENT_TYPE_LEVEL_PROGRESSION = 109, //!< The Level Progression Component
COMPONENT_TYPE_POSSESSOR = 110, //!< The Possessor Component
COMPONENT_TYPE_BUILD_BORDER = 114, //!< The Build Border Component
COMPONENT_TYPE_DESTROYABLE = 1000, //!< The Destroyable Component
};
enum class UseItemResponse : uint32_t {
NoImaginationForPet = 1,

View File

@@ -293,7 +293,6 @@ enum GAME_MSG : unsigned short {
GAME_MSG_POP_EQUIPPED_ITEMS_STATE = 192,
GAME_MSG_SET_GM_LEVEL = 193,
GAME_MSG_SET_STUNNED = 198,
GAME_MSG_SET_STUN_IMMUNITY = 200,
GAME_MSG_KNOCKBACK = 202,
GAME_MSG_REBUILD_CANCEL = 209,
GAME_MSG_ENABLE_REBUILD = 213,
@@ -374,8 +373,6 @@ enum GAME_MSG : unsigned short {
GAME_MSG_PET_TAMING_TRY_BUILD_RESULT = 668,
GAME_MSG_NOTIFY_TAMING_BUILD_SUCCESS = 673,
GAME_MSG_NOTIFY_TAMING_MODEL_LOADED_ON_SERVER = 674,
GAME_MSG_ACTIVATE_BUBBLE_BUFF = 678,
GAME_MSG_DEACTIVATE_BUBBLE_BUFF = 679,
GAME_MSG_ADD_PET_TO_PLAYER = 681,
GAME_MSG_REQUEST_SET_PET_NAME = 683,
GAME_MSG_SET_PET_NAME = 684,
@@ -388,10 +385,7 @@ enum GAME_MSG : unsigned short {
GAME_MSG_QUERY_PROPERTY_DATA = 717,
GAME_MSG_PROPERTY_EDITOR_BEGIN = 724,
GAME_MSG_PROPERTY_EDITOR_END = 725,
GAME_MSG_IS_MINIFIG_IN_A_BUBBLE = 729,
GAME_MSG_START_PATHING = 733,
GAME_MSG_ACTIVATE_BUBBLE_BUFF_FROM_SERVER = 734,
GAME_MSG_DEACTIVATE_BUBBLE_BUFF_FROM_SERVER = 735,
GAME_MSG_START_PATHING = 735,
GAME_MSG_NOTIFY_CLIENT_ZONE_OBJECT = 737,
GAME_MSG_UPDATE_REPUTATION = 746,
GAME_MSG_PROPERTY_RENTAL_RESPONSE = 750,
@@ -518,7 +512,6 @@ enum GAME_MSG : unsigned short {
GAME_MSG_UPDATE_CHAT_MODE = 1395,
GAME_MSG_VEHICLE_NOTIFY_FINISHED_RACE = 1396,
GAME_MSG_SET_CONSUMABLE_ITEM = 1409,
GAME_MSG_SET_STATUS_IMMUNITY = 1435,
GAME_MSG_SET_PET_NAME_MODERATED = 1448,
GAME_MSG_MODIFY_LEGO_SCORE = 1459,
GAME_MSG_RESTORE_TO_POST_LOAD_STATS = 1468,
@@ -546,8 +539,6 @@ enum GAME_MSG : unsigned short {
GAME_MSG_REMOVE_RUN_SPEED_MODIFIER = 1506,
GAME_MSG_UPDATE_PROPERTY_PERFORMANCE_COST = 1547,
GAME_MSG_PROPERTY_ENTRANCE_BEGIN = 1553,
GAME_MSG_SET_RESURRECT_RESTORE_VALUES = 1591,
GAME_MSG_VEHICLE_STOP_BOOST = 1617,
GAME_MSG_REMOVE_BUFF = 1648,
GAME_MSG_REQUEST_MOVE_ITEM_BETWEEN_INVENTORY_TYPES = 1666,
GAME_MSG_RESPONSE_MOVE_ITEM_BETWEEN_INVENTORY_TYPES = 1667,

View File

@@ -1,12 +0,0 @@
#ifndef __EBASICATTACKSUCCESSTYPES__H__
#define __EBASICATTACKSUCCESSTYPES__H__
#include <cstdint>
enum class eBasicAttackSuccessTypes : uint8_t {
SUCCESS = 1,
FAILARMOR,
FAILIMMUNE
};
#endif //!__EBASICATTACKSUCCESSTYPES__H__

View File

@@ -1,14 +0,0 @@
#pragma once
#ifndef __EBUBBLETYPE__H__
#define __EBUBBLETYPE__H__
#include <cstdint>
enum class eBubbleType : uint32_t {
DEFAULT = 0,
ENERGY,
SKUNK
};
#endif //!__EBUBBLETYPE__H__

View File

@@ -1,41 +0,0 @@
#ifndef __EHELPTYPE__H__
#define __EHELPTYPE__H__
#include <cstdint>
enum class eHelpType : int32_t {
NONE = 0,
UNLOCK_MINIMAP = 2,
TOGGLETOOLTIP_OUTOFTIME_REBUILD = 3,
TOGGLETOOLTIP_LEAVELOSE_REBUILD = 4,
TOGGLECONTROLSTUTORIAL_WALKING = 6,
DISPLAYTUTORIAL_PASSPORT_1ST_SMASH = 7,
TOOLTIP_1ST_IMAGINATION_PICKUP = 8,
UNKNOWN9 = 9,
PETTAMINGMINIGAME_TUTORIAL_01 = 15,
PR_BOUNCER_TUTORIAL_03 = 16,
PR_TOOLTIP_1ST_PET_JUMPED_ON_SWITCH = 17,
PR_DIG_TUTORIAL_01 = 18,
PR_DIG_TUTORIAL_03 = 19,
PR_BOUNCER_TUTORIAL_01 = 20,
PR_NO_IMAGINATION_HIBERNATE = 21,
UNKNOWN22 = 22,
TOGGLECONTROLSTUTORIAL_JUMPING = 26,
TOGGLECONTROLSTUTORIAL_DOUBLEJUMPING = 27,
TOGGLECONTROLSTUTORIAL_CAMERA = 28,
TOGGLECONTROLSTUTORIAL_SMASH = 30,
UNKNOWN38 = 38,
UI_MOD_BUILD_PUT_ON_HAT = 40,
UI_MOD_BUILD_EQUIP_FIRST_MODULE = 41,
UNKNOWN42 = 42,
UNKNOWN43 = 43,
UI_MOD_BUILD_GO_LAUNCH_ROCKET = 44,
UI_MOD_BUILD_TALK_TO_SKYLANE = 45,
UNKNOWN53 = 53,
PET_DESPAWN_BY_OWNER_HIBERNATE = 69,
PET_DESPAWN_TAMING_NEW_PET = 70,
UI_INVENTORY_FULL_CANNOT_PICKUP_ITEM = 86
};
#endif //!__EHELPTYPE__H__

View File

@@ -1,58 +0,0 @@
#pragma once
#ifndef __EITEMSETPASSIVEABILITYID__H__
#define __EITEMSETPASSIVEABILITYID__H__
enum class eItemSetPassiveAbilityID {
EngineerRank1 = 2,
EngineerRank2 = 3,
EngineerRank3 = 4,
KnightRank1 = 7,
KnightRank2 = 8,
KnightRank3 = 9,
SpaceRangerRank1 = 10,
SpaceRangerRank2 = 11,
SpaceRangerRank3 = 12,
SamuraiRank1 = 13,
SamuraiRank2 = 14,
SamuraiRank3 = 15,
SorcererRank1 = 16,
SorcererRank2 = 17,
SorcererRank3 = 18,
SpaceMarauderRank1 = 19,
SpaceMarauderRank2 = 20,
SpaceMarauderRank3 = 21,
ShinobiRank1 = 22,
ShinobiRank2 = 23,
ShinobiRank3 = 24,
InventorRank1 = 25,
InventorRank2 = 26,
InventorRank3 = 27,
SummonerRank1 = 28,
SummonerRank2 = 29,
SummonerRank3 = 30,
AdventurerRank1 = 31,
AdventurerRank2 = 32,
AdventurerRank3 = 33,
DaredevilRank1 = 34,
DaredevilRank2 = 35,
DaredevilRank3 = 36,
BuccaneerRank1 = 37,
BuccaneerRank2 = 38,
BuccaneerRank3 = 39,
BoneSuit = 40,
ImaginationSpinjitzu = 41,
BatLord = 42,
MosaicJester = 43,
ExplorienBot = 44,
Unnamed1 = 45,
Unnamed2 = 46,
Unnamed3 = 47,
EarthSpinjitzu = 48,
Unnamed4 = 49,
FireSpinjitzu = 50,
IceSpinjitzu = 51,
LightningSpinjitzu = 52
};
#endif //!__EITEMSETPASSIVEABILITYID__H__

View File

@@ -6,31 +6,31 @@
#include <cstdint>
enum class eItemType : int32_t {
UNKNOWN = -1,
BRICK = 1,
HAT,
HAIR,
NECK,
LEFT_HAND,
RIGHT_HAND,
LEGS,
LEFT_TRINKET,
RIGHT_TRINKET,
BEHAVIOR,
PROPERTY,
MODEL,
COLLECTIBLE,
CONSUMABLE,
CHEST,
EGG,
PET_FOOD,
QUEST_OBJECT,
PET_INVENTORY_ITEM,
PACKAGE,
LOOT_MODEL,
VEHICLE,
LUP_MODEL,
MOUNT
ITEM_TYPE_UNKNOWN = -1, //!< An unknown item type
ITEM_TYPE_BRICK = 1, //!< A brick
ITEM_TYPE_HAT = 2, //!< A hat / head item
ITEM_TYPE_HAIR = 3, //!< A hair item
ITEM_TYPE_NECK = 4, //!< A neck item
ITEM_TYPE_LEFT_HAND = 5, //!< A left handed item
ITEM_TYPE_RIGHT_HAND = 6, //!< A right handed item
ITEM_TYPE_LEGS = 7, //!< A pants item
ITEM_TYPE_LEFT_TRINKET = 8, //!< A left handled trinket item
ITEM_TYPE_RIGHT_TRINKET = 9, //!< A right handed trinket item
ITEM_TYPE_BEHAVIOR = 10, //!< A behavior
ITEM_TYPE_PROPERTY = 11, //!< A property
ITEM_TYPE_MODEL = 12, //!< A model
ITEM_TYPE_COLLECTIBLE = 13, //!< A collectible item
ITEM_TYPE_CONSUMABLE = 14, //!< A consumable item
ITEM_TYPE_CHEST = 15, //!< A chest item
ITEM_TYPE_EGG = 16, //!< An egg
ITEM_TYPE_PET_FOOD = 17, //!< A pet food item
ITEM_TYPE_QUEST_OBJECT = 18, //!< A quest item
ITEM_TYPE_PET_INVENTORY_ITEM = 19, //!< A pet inventory item
ITEM_TYPE_PACKAGE = 20, //!< A package
ITEM_TYPE_LOOT_MODEL = 21, //!< A loot model
ITEM_TYPE_VEHICLE = 22, //!< A vehicle
ITEM_TYPE_CURRENCY = 23, //!< Currency
ITEM_TYPE_MOUNT = 24 //!< A Mount
};
#endif //!__EITEMTYPE__H__

View File

@@ -1,12 +0,0 @@
#pragma once
#ifndef __EMISSIONLOCKSTATE__H__
#define __EMISSIONLOCKSTATE__H__
enum class eMissionLockState : int {
LOCKED,
NEW,
UNLOCKED,
};
#endif //!__EMISSIONLOCKSTATE__H__

View File

@@ -1,56 +0,0 @@
#pragma once
#ifndef __MISSIONSTATE__H__
#define __MISSIONSTATE__H__
/**
* Represents the possible states a mission can be in
*/
enum class eMissionState : int {
/**
* The mission state is unknown
*/
UNKNOWN = -1,
/**
* The mission is yielding rewards
*/
REWARDING = 0,
/**
* The mission can be accepted
*/
AVAILABLE = 1,
/**
* The mission has been accepted but not yet completed
*/
ACTIVE = 2,
/**
* All the tasks for the mission have been completed and the entity can turn the mission in to complete it
*/
READY_TO_COMPLETE = 4, //!< The mission is ready to complete
/**
* The mission has been completed
*/
COMPLETE = 8,
/**
* The mission is available again and has been completed before. Used for daily missions.
*/
COMPLETE_AVAILABLE = 9,
/**
* The mission is active and has been completed before. Used for daily missions.
*/
COMPLETE_ACTIVE = 10,
/**
* The mission has been completed before and has now been completed again. Used for daily missions.
*/
COMPLETE_READY_TO_COMPLETE = 12
};
#endif //!__MISSIONSTATE__H__

View File

@@ -1,43 +0,0 @@
#pragma once
#ifndef __EMISSIONTASKTYPE__H__
#define __EMISSIONTASKTYPE__H__
enum class eMissionTaskType : int {
UNKNOWN = -1,
SMASH,
SCRIPT,
ACTIVITY,
COLLECTION,
TALK_TO_NPC,
EMOTE,
SHASH_CHAIN,
BUY,
SELL,
USE_ITEM,
USE_SKILL,
GATHER,
EXPLORE,
DELIVERY,
PERFORM_ACTIVITY,
INTERACT,
META,
EARN_REPUTATION,
VOTING,
SHOWCASE_DELIVERY,
REVIECE_CAST,
POWERUP,
PET_TAMING,
RACING,
PLAYER_FLAG,
PLACE_MODEL,
REMOVE_MODEL,
ADD_BEHAVIOR,
REMOVE_BEHAVIOR,
CLAIM_PROPERTY,
VISIT_PROPERTY,
TIME_PLAYED,
DONATION
};
#endif //!__EMISSIONTASKTYPE__H__

View File

@@ -1,16 +0,0 @@
#ifndef __EMOVEMENTPLATFORMSTATE__H__
#define __EMOVEMENTPLATFORMSTATE__H__
#include <cstdint>
/**
* The different types of platform movement state, supposedly a bitmap
*/
enum class eMovementPlatformState : uint32_t
{
Moving = 0b00010,
Stationary = 0b11001,
Stopped = 0b01100
};
#endif //!__EMOVEMENTPLATFORMSTATE__H__

View File

@@ -1,13 +0,0 @@
#ifndef __EPACKAGETYPE__H__
#define __EPACKAGETYPE__H__
enum class ePackageType {
INVALID = -1,
ITEM,
BRICKS,
MODELS,
CAR_MODELS
};
#endif //!__EPACKAGETYPE__H__

View File

@@ -1,46 +0,0 @@
#pragma once
#include <cstdint>
#ifndef __EPERMISSIONMAP__H__
#define __EPERMISSIONMAP__H__
/**
* Bitmap of permissions and restrictions for characters.
*/
enum class ePermissionMap : uint64_t {
/**
* Reserved for future use, bit 0-3.
*/
/**
* The character has restricted trade acccess, bit 4.
*/
RestrictedTradeAccess = 0x1 << 4,
/**
* The character has restricted mail access, bit 5.
*/
RestrictedMailAccess = 0x1 << 5,
/**
* The character has restricted chat access, bit 6.
*/
RestrictedChatAccess = 0x1 << 6,
//
// Combined permissions
//
/**
* The character is marked as 'old', restricted from trade and mail.
*/
Old = RestrictedTradeAccess | RestrictedMailAccess,
/**
* The character is soft banned, restricted from trade, mail, and chat.
*/
SoftBanned = RestrictedTradeAccess | RestrictedMailAccess | RestrictedChatAccess,
};
#endif //!__EPERMISSIONMAP__H__

View File

@@ -1,14 +0,0 @@
#ifndef __EPHYSICSBEHAVIORTYPE__H__
#define __EPHYSICSBEHAVIORTYPE__H__
#include <cstdint>
enum class ePhysicsBehaviorType : int32_t {
INVALID = -1,
GROUND,
FLYING,
STANDARD,
DYNAMIC
};
#endif //!__EPHYSICSBEHAVIORTYPE__H__

View File

@@ -1,25 +0,0 @@
#pragma once
#ifndef __ERACINGTASKPARAM__H__
#define __ERACINGTASKPARAM__H__
#include <cstdint>
enum class eRacingTaskParam : int32_t {
FINISH_WITH_PLACEMENT = 1,
LAP_TIME,
TOTAL_TRACK_TIME,
COMPLETE_ANY_RACING_TASK,
COMPLETE_TRACK_TASKS,
MODULAR_BUILDING,
SAFE_DRIVER = 10,
SMASHABLES,
COLLECT_IMAGINATION,
COMPETED_IN_RACE,
WIN_RACE_IN_WORLD,
FIRST_PLACE_MULTIPLE_TRACKS,
LAST_PLACE_FINISH,
SMASH_SPECIFIC_SMASHABLE
};
#endif //!__ERACINGTASKPARAM__H__

View File

@@ -1,127 +0,0 @@
#ifndef __EREPLICACOMPONENTTYPE__H__
#define __EREPLICACOMPONENTTYPE__H__
#include <cstdint>
enum class eReplicaComponentType : uint32_t {
INVALID = 0,
CONTROLLABLE_PHYSICS,
RENDER,
SIMPLE_PHYSICS,
CHARACTER,
SCRIPT,
BOUNCER,
BUFF, // buff is really 98, this is DESTROYABLE
GHOST,
SKILL,
SPAWNER,
ITEM,
REBUILD,
REBUILD_START,
REBUILD_ACTIVATOR,
ICON_ONLY,
VENDOR,
INVENTORY,
PROJECTILE_PHYSICS,
SHOOTING_GALLERY,
RIGID_BODY_PHANTOM_PHYSICS,
DROP_EFFECT,
CHEST,
COLLECTIBLE,
BLUEPRINT,
MOVING_PLATFORM,
PET,
PLATFORM_BOUNDARY,
MODULE,
ARCADE,
VEHICLE_PHYSICS, // Havok demo based
MOVEMENT_AI,
EXHIBIT,
OVERHEAD_ICON,
PET_CONTROL,
MINIFIG,
PROPERTY,
PET_CREATOR,
MODEL_BUILDER,
SCRIPTED_ACTIVITY,
PHANTOM_PHYSICS,
SPRINGPAD,
MODEL,
PROPERTY_ENTRANCE,
FX,
PROPERTY_MANAGEMENT,
VEHICLE_PHYSICS_NEW, // internal physics based on havok
PHYSICS_SYSTEM,
QUICK_BUILD,
SWITCH,
ZONE_CONTROL, // Minigame
CHANGLING,
CHOICE_BUILD,
PACKAGE,
SOUND_REPEATER,
SOUND_AMBIENT_2D,
SOUND_AMBIENT_3D,
PRECONDITION,
PLAYER_FLAG,
CUSTOM_BUILD_ASSEMBLY,
BASE_COMBAT_AI,
MODULE_ASSEMBLY,
SHOWCASE_MODEL_HANDLER,
RACING_MODULE,
GENERIC_ACTIVATOR,
PROPERTY_VENDOR,
HF_LIGHT_DIRECTION_GADGET,
ROCKET_LAUNCH,
ROCKET_LANDING,
TRIGGER,
DROPPED_LOOT,
RACING_CONTROL,
FACTION_TRIGGER,
MISSION_OFFER,
RACING_STATS,
LUP_EXHIBIT,
BBB,
SOUND_TRIGGER,
PROXIMITY_MONITOR,
RACING_SOUND_TRIGGER,
CHAT,
FRIENDS_LIST,
GUILD,
LOCAL_SYSTEM,
MISSION,
MUTABLE_MODEL_BEHAVIORS,
PATHFINDING,
PET_TAMING_CONTROL,
PROPERTY_EDITOR,
SKINNED_RENDER,
SLASH_COMMAND,
STATUS_EFFECT,
TEAMS,
TEXT_EFFECT,
TRADE,
USER_CONTROL,
IGNORE_LIST,
ROCKET_LAUNCH_LUP,
BUFF_REAL, // the real buff component, should just be name BUFF
INTERACTION_MANAGER,
DONATION_VENDOR,
COMBAT_MEDIATOR,
COMMENDATION_VENDOR,
UNKNOWN_103,
RAIL_ACTIVATOR,
ROLLER,
PLAYER_FORCED_MOVEMENT,
CRAFTING,
POSSESSABLE,
LEVEL_PROGRESSION,
POSSESSOR,
MOUNT_CONTROL,
UNKNOWN_112,
PROPERTY_PLAQUE,
BUILD_BORDER,
UNKOWN_115,
CULLING_PLANE,
DESTROYABLE = 1000 // Actually 7
};
#endif //!__EREPLICACOMPONENTTYPE__H__

View File

@@ -1,24 +0,0 @@
#ifndef __ESERVERDISCONNECTIDENTIFIERS__H__
#define __ESERVERDISCONNECTIDENTIFIERS__H__
#include <cstdint>
enum class eServerDisconnectIdentifiers : uint32_t {
UNKNOWN_SERVER_ERROR = 0,
WRONG_GAME_VERSION,
WRONG_SERVER_VERSION,
CONNECTION_ON_INVALID_PORT,
DUPLICATE_LOGIN,
SERVER_SHUTDOWN,
SERVER_MAP_LOAD_FAILURE,
INVALID_SESSION_KEY,
ACCOUNT_NOT_IN_PENDING_LIST,
CHARACTER_NOT_FOUND,
CHARACTER_CORRUPTED,
KICK,
SAVE_FAILURE,
FREE_TRIAL_EXPIRED,
PLAY_SCHEDULE_TIME_DONE
};
#endif //!__ESERVERDISCONNECTIDENTIFIERS__H__

View File

@@ -1,119 +0,0 @@
#ifndef __ETRIGGERCOMMANDTYPE__H__
#define __ETRIGGERCOMMANDTYPE__H__
// For info about Trigger Command see:
// https://docs.lu-dev.net/en/latest/file-structures/lutriggers.html?highlight=trigger#possible-values-commands
enum class eTriggerCommandType {
INVALID,
ZONE_PLAYER,
FIRE_EVENT,
DESTROY_OBJ,
TOGGLE_TRIGGER,
RESET_REBUILD,
SET_PATH,
SET_PICK_TYPE,
MOVE_OBJECT,
ROTATE_OBJECT,
PUSH_OBJECT,
REPEL_OBJECT,
SET_TIMER,
CANCEL_TIMER,
PLAY_CINEMATIC,
TOGGLE_BBB,
UPDATE_MISSION,
SET_BOUNCER_STATE,
BOUNCE_ALL_ON_BOUNCER,
TURN_AROUND_ON_PATH,
GO_FORWARD_ON_PATH,
GO_BACKWARD_ON_PATH,
STOP_PATHING,
START_PATHING,
LOCK_OR_UNLOCK_CONTROLS,
PLAY_EFFECT,
STOP_EFFECT,
ACTIVATE_MUSIC_CUE,
DEACTIVATE_MUSIC_CUE,
FLASH_MUSIC_CUE,
SET_MUSIC_PARAMETER,
PLAY_2D_AMBIENT_SOUND,
STOP_2D_AMBIENT_SOUND,
PLAY_3D_AMBIENT_SOUND,
STOP_3D_AMBIENT_SOUND,
ACTIVATE_MIXER_PROGRAM,
DEACTIVATE_MIXER_PROGRAM,
CAST_SKILL,
DISPLAY_ZONE_SUMMARY,
SET_PHYSICS_VOLUME_EFFECT,
SET_PHYSICS_VOLUME_STATUS,
SET_MODEL_TO_BUILD,
SPAWN_MODEL_BRICKS,
ACTIVATE_SPAWNER_NETWORK,
DEACTIVATE_SPAWNER_NETWORK,
RESET_SPAWNER_NETWORK,
DESTROY_SPAWNER_NETWORK_OBJECTS,
GO_TO_WAYPOINT,
ACTIVATE_PHYSICS
};
class TriggerCommandType {
public:
static eTriggerCommandType StringToTriggerCommandType(std::string commandString) {
const std::map<std::string, eTriggerCommandType> TriggerCommandMap = {
{ "zonePlayer", eTriggerCommandType::ZONE_PLAYER},
{ "fireEvent", eTriggerCommandType::FIRE_EVENT},
{ "destroyObj", eTriggerCommandType::DESTROY_OBJ},
{ "toggleTrigger", eTriggerCommandType::TOGGLE_TRIGGER},
{ "resetRebuild", eTriggerCommandType::RESET_REBUILD},
{ "setPath", eTriggerCommandType::SET_PATH},
{ "setPickType", eTriggerCommandType::SET_PICK_TYPE},
{ "moveObject", eTriggerCommandType::MOVE_OBJECT},
{ "rotateObject", eTriggerCommandType::ROTATE_OBJECT},
{ "pushObject", eTriggerCommandType::PUSH_OBJECT},
{ "repelObject", eTriggerCommandType::REPEL_OBJECT},
{ "setTimer", eTriggerCommandType::SET_TIMER},
{ "cancelTimer", eTriggerCommandType::CANCEL_TIMER},
{ "playCinematic", eTriggerCommandType::PLAY_CINEMATIC},
{ "toggleBBB", eTriggerCommandType::TOGGLE_BBB},
{ "updateMission", eTriggerCommandType::UPDATE_MISSION},
{ "setBouncerState", eTriggerCommandType::SET_BOUNCER_STATE},
{ "bounceAllOnBouncer", eTriggerCommandType::BOUNCE_ALL_ON_BOUNCER},
{ "turnAroundOnPath", eTriggerCommandType::TURN_AROUND_ON_PATH},
{ "goForwardOnPath", eTriggerCommandType::GO_FORWARD_ON_PATH},
{ "goBackwardOnPath", eTriggerCommandType::GO_BACKWARD_ON_PATH},
{ "stopPathing", eTriggerCommandType::STOP_PATHING},
{ "startPathing", eTriggerCommandType::START_PATHING},
{ "LockOrUnlockControls", eTriggerCommandType::LOCK_OR_UNLOCK_CONTROLS},
{ "PlayEffect", eTriggerCommandType::PLAY_EFFECT},
{ "StopEffect", eTriggerCommandType::STOP_EFFECT},
{ "activateMusicCue", eTriggerCommandType::ACTIVATE_MUSIC_CUE},
{ "deactivateMusicCue", eTriggerCommandType::DEACTIVATE_MUSIC_CUE},
{ "flashMusicCue", eTriggerCommandType::FLASH_MUSIC_CUE},
{ "setMusicParameter", eTriggerCommandType::SET_MUSIC_PARAMETER},
{ "play2DAmbientSound", eTriggerCommandType::PLAY_2D_AMBIENT_SOUND},
{ "stop2DAmbientSound", eTriggerCommandType::STOP_2D_AMBIENT_SOUND},
{ "play3DAmbientSound", eTriggerCommandType::PLAY_3D_AMBIENT_SOUND},
{ "stop3DAmbientSound", eTriggerCommandType::STOP_3D_AMBIENT_SOUND},
{ "activateMixerProgram", eTriggerCommandType::ACTIVATE_MIXER_PROGRAM},
{ "deactivateMixerProgram", eTriggerCommandType::DEACTIVATE_MIXER_PROGRAM},
{ "CastSkill", eTriggerCommandType::CAST_SKILL},
{ "displayZoneSummary", eTriggerCommandType::DISPLAY_ZONE_SUMMARY},
{ "SetPhysicsVolumeEffect", eTriggerCommandType::SET_PHYSICS_VOLUME_EFFECT},
{ "SetPhysicsVolumeStatus", eTriggerCommandType::SET_PHYSICS_VOLUME_STATUS},
{ "setModelToBuild", eTriggerCommandType::SET_MODEL_TO_BUILD},
{ "spawnModelBricks", eTriggerCommandType::SPAWN_MODEL_BRICKS},
{ "ActivateSpawnerNetwork", eTriggerCommandType::ACTIVATE_SPAWNER_NETWORK},
{ "DeactivateSpawnerNetwork", eTriggerCommandType::DEACTIVATE_SPAWNER_NETWORK},
{ "ResetSpawnerNetwork", eTriggerCommandType::RESET_SPAWNER_NETWORK},
{ "DestroySpawnerNetworkObjects", eTriggerCommandType::DESTROY_SPAWNER_NETWORK_OBJECTS},
{ "Go_To_Waypoint", eTriggerCommandType::GO_TO_WAYPOINT},
{ "ActivatePhysics", eTriggerCommandType::ACTIVATE_PHYSICS}
};
auto intermed = TriggerCommandMap.find(commandString);
return (intermed != TriggerCommandMap.end()) ? intermed->second : eTriggerCommandType::INVALID;
};
};
#endif //!__ETRIGGERCOMMANDTYPE__H__

View File

@@ -1,53 +0,0 @@
#ifndef __ETRIGGEREVENTTYPE__H__
#define __ETRIGGEREVENTTYPE__H__
enum class eTriggerEventType {
INVALID,
DESTROY,
CUSTOM_EVENT,
ENTER,
EXIT,
CREATE,
HIT,
TIMER_DONE,
REBUILD_COMPLETE,
ACTIVATED,
DEACTIVATED,
ARRIVED,
ARRIVED_AT_END_OF_PATH,
ZONE_SUMMARY_DISMISSED,
ARRIVED_AT_DESIRED_WAYPOINT,
PET_ON_SWITCH,
PET_OFF_SWITCH,
INTERACT
};
class TriggerEventType {
public:
static eTriggerEventType StringToTriggerEventType(std::string commandString) {
const std::map<std::string, eTriggerEventType> TriggerEventMap = {
{"OnDestroy", eTriggerEventType::DESTROY},
{"OnCustomEvent", eTriggerEventType::CUSTOM_EVENT},
{"OnEnter", eTriggerEventType::ENTER},
{"OnExit", eTriggerEventType::EXIT},
{"OnCreate", eTriggerEventType::CREATE},
{"OnHit", eTriggerEventType::HIT},
{"OnTimerDone", eTriggerEventType::TIMER_DONE},
{"OnRebuildComplete", eTriggerEventType::REBUILD_COMPLETE},
{"OnActivated", eTriggerEventType::ACTIVATED},
{"OnDeactivated", eTriggerEventType::DEACTIVATED},
{"OnArrived", eTriggerEventType::ARRIVED},
{"OnArrivedAtEndOfPath", eTriggerEventType::ARRIVED_AT_END_OF_PATH},
{"OnZoneSummaryDismissed", eTriggerEventType::ZONE_SUMMARY_DISMISSED},
{"OnArrivedAtDesiredWaypoint", eTriggerEventType::ARRIVED_AT_DESIRED_WAYPOINT},
{"OnPetOnSwitch", eTriggerEventType::PET_ON_SWITCH},
{"OnPetOffSwitch", eTriggerEventType::PET_OFF_SWITCH},
{"OnInteract", eTriggerEventType::INTERACT},
};
auto intermed = TriggerEventMap.find(commandString);
return (intermed != TriggerEventMap.end()) ? intermed->second : eTriggerEventType::INVALID;
};
};
#endif //!__ETRIGGEREVENTTYPE__H__

View File

@@ -1,13 +0,0 @@
#ifndef __EUGCMODERATIONSTATUS__H__
#define __EUGCMODERATIONSTATUS__H__
#include <cstdint>
enum class eUgcModerationStatus : uint32_t {
NoStatus,
Approved,
Rejected,
};
#endif //!__EUGCMODERATIONSTATUS__H__

View File

@@ -89,7 +89,7 @@ void dLogger::Log(const std::string& className, const std::string& message) {
void dLogger::LogDebug(const char* className, const char* format, ...) {
if (!m_logDebugStatements) return;
va_list args;
std::string log = "[" + std::string(className) + "] " + std::string(format) + "\n";
std::string log = "[" + std::string(className) + "] " + std::string(format);
va_start(args, format);
vLog(log.c_str(), args);
va_end(args);

View File

@@ -1,80 +1,46 @@
#include "CDClientManager.h"
#include "CDActivityRewardsTable.h"
#include "CDAnimationsTable.h"
#include "CDBehaviorParameterTable.h"
#include "CDBehaviorTemplateTable.h"
#include "CDComponentsRegistryTable.h"
#include "CDCurrencyTableTable.h"
#include "CDDestructibleComponentTable.h"
#include "CDEmoteTable.h"
#include "CDInventoryComponentTable.h"
#include "CDItemComponentTable.h"
#include "CDItemSetsTable.h"
#include "CDItemSetSkillsTable.h"
#include "CDLevelProgressionLookupTable.h"
#include "CDLootMatrixTable.h"
#include "CDLootTableTable.h"
#include "CDMissionNPCComponentTable.h"
#include "CDMissionTasksTable.h"
#include "CDMissionsTable.h"
#include "CDObjectSkillsTable.h"
#include "CDObjectsTable.h"
#include "CDPhysicsComponentTable.h"
#include "CDRebuildComponentTable.h"
#include "CDScriptComponentTable.h"
#include "CDSkillBehaviorTable.h"
#include "CDZoneTableTable.h"
#include "CDVendorComponentTable.h"
#include "CDActivitiesTable.h"
#include "CDPackageComponentTable.h"
#include "CDProximityMonitorComponentTable.h"
#include "CDMovementAIComponentTable.h"
#include "CDBrickIDTableTable.h"
#include "CDRarityTableTable.h"
#include "CDMissionEmailTable.h"
#include "CDRewardsTable.h"
#include "CDPropertyEntranceComponentTable.h"
#include "CDPropertyTemplateTable.h"
#include "CDFeatureGatingTable.h"
#include "CDRailActivatorComponent.h"
CDClientManager::CDClientManager() {
CDActivityRewardsTable::Instance();
UNUSED(CDAnimationsTable::Instance());
CDBehaviorParameterTable::Instance();
CDBehaviorTemplateTable::Instance();
CDComponentsRegistryTable::Instance();
CDCurrencyTableTable::Instance();
CDDestructibleComponentTable::Instance();
CDEmoteTableTable::Instance();
CDInventoryComponentTable::Instance();
CDItemComponentTable::Instance();
CDItemSetsTable::Instance();
CDItemSetSkillsTable::Instance();
CDLevelProgressionLookupTable::Instance();
CDLootMatrixTable::Instance();
CDLootTableTable::Instance();
CDMissionNPCComponentTable::Instance();
CDMissionTasksTable::Instance();
CDMissionsTable::Instance();
CDObjectSkillsTable::Instance();
CDObjectsTable::Instance();
CDPhysicsComponentTable::Instance();
CDRebuildComponentTable::Instance();
CDScriptComponentTable::Instance();
CDSkillBehaviorTable::Instance();
CDZoneTableTable::Instance();
CDVendorComponentTable::Instance();
CDActivitiesTable::Instance();
CDPackageComponentTable::Instance();
CDProximityMonitorComponentTable::Instance();
CDMovementAIComponentTable::Instance();
CDBrickIDTableTable::Instance();
CDRarityTableTable::Instance();
CDMissionEmailTable::Instance();
CDRewardsTable::Instance();
CDPropertyEntranceComponentTable::Instance();
CDPropertyTemplateTable::Instance();
CDFeatureGatingTable::Instance();
CDRailActivatorComponentTable::Instance();
// Static Variables
CDClientManager* CDClientManager::m_Address = nullptr;
//! Initializes the manager
void CDClientManager::Initialize(void) {
tables.insert(std::make_pair("ActivityRewards", new CDActivityRewardsTable()));
UNUSED(tables.insert(std::make_pair("Animations", new CDAnimationsTable())));
tables.insert(std::make_pair("BehaviorParameter", new CDBehaviorParameterTable()));
tables.insert(std::make_pair("BehaviorTemplate", new CDBehaviorTemplateTable()));
tables.insert(std::make_pair("ComponentsRegistry", new CDComponentsRegistryTable()));
tables.insert(std::make_pair("CurrencyTable", new CDCurrencyTableTable()));
tables.insert(std::make_pair("DestructibleComponent", new CDDestructibleComponentTable()));
tables.insert(std::make_pair("EmoteTable", new CDEmoteTableTable()));
tables.insert(std::make_pair("InventoryComponent", new CDInventoryComponentTable()));
tables.insert(std::make_pair("ItemComponent", new CDItemComponentTable()));
tables.insert(std::make_pair("ItemSets", new CDItemSetsTable()));
tables.insert(std::make_pair("ItemSetSkills", new CDItemSetSkillsTable()));
tables.insert(std::make_pair("LevelProgressionLookup", new CDLevelProgressionLookupTable()));
tables.insert(std::make_pair("LootMatrix", new CDLootMatrixTable()));
tables.insert(std::make_pair("LootTable", new CDLootTableTable()));
tables.insert(std::make_pair("MissionNPCComponent", new CDMissionNPCComponentTable()));
tables.insert(std::make_pair("MissionTasks", new CDMissionTasksTable()));
tables.insert(std::make_pair("Missions", new CDMissionsTable()));
tables.insert(std::make_pair("ObjectSkills", new CDObjectSkillsTable()));
tables.insert(std::make_pair("Objects", new CDObjectsTable()));
tables.insert(std::make_pair("PhysicsComponent", new CDPhysicsComponentTable()));
tables.insert(std::make_pair("RebuildComponent", new CDRebuildComponentTable()));
tables.insert(std::make_pair("ScriptComponent", new CDScriptComponentTable()));
tables.insert(std::make_pair("SkillBehavior", new CDSkillBehaviorTable()));
tables.insert(std::make_pair("ZoneTable", new CDZoneTableTable()));
tables.insert(std::make_pair("VendorComponent", new CDVendorComponentTable()));
tables.insert(std::make_pair("Activities", new CDActivitiesTable()));
tables.insert(std::make_pair("PackageComponent", new CDPackageComponentTable()));
tables.insert(std::make_pair("ProximityMonitorComponent", new CDProximityMonitorComponentTable()));
tables.insert(std::make_pair("MovementAIComponent", new CDMovementAIComponentTable()));
tables.insert(std::make_pair("BrickIDTable", new CDBrickIDTableTable()));
tables.insert(std::make_pair("RarityTable", new CDRarityTableTable()));
tables.insert(std::make_pair("MissionEmail", new CDMissionEmailTable()));
tables.insert(std::make_pair("Rewards", new CDRewardsTable()));
tables.insert(std::make_pair("PropertyEntranceComponent", new CDPropertyEntranceComponentTable()));
tables.insert(std::make_pair("PropertyTemplate", new CDPropertyTemplateTable()));
tables.insert(std::make_pair("FeatureGating", new CDFeatureGatingTable()));
tables.insert(std::make_pair("RailActivatorComponent", new CDRailActivatorComponentTable()));
}

View File

@@ -1,24 +1,96 @@
#pragma once
// Custom Classes
#include "CDTable.h"
#include "Singleton.h"
// Tables
#include "CDActivityRewardsTable.h"
#include "CDAnimationsTable.h"
#include "CDBehaviorParameterTable.h"
#include "CDBehaviorTemplateTable.h"
#include "CDComponentsRegistryTable.h"
#include "CDCurrencyTableTable.h"
#include "CDDestructibleComponentTable.h"
#include "CDEmoteTable.h"
#include "CDInventoryComponentTable.h"
#include "CDItemComponentTable.h"
#include "CDItemSetsTable.h"
#include "CDItemSetSkillsTable.h"
#include "CDLevelProgressionLookupTable.h"
#include "CDLootMatrixTable.h"
#include "CDLootTableTable.h"
#include "CDMissionNPCComponentTable.h"
#include "CDMissionTasksTable.h"
#include "CDMissionsTable.h"
#include "CDObjectSkillsTable.h"
#include "CDObjectsTable.h"
#include "CDPhysicsComponentTable.h"
#include "CDRebuildComponentTable.h"
#include "CDScriptComponentTable.h"
#include "CDSkillBehaviorTable.h"
#include "CDZoneTableTable.h"
#include "CDVendorComponentTable.h"
#include "CDActivitiesTable.h"
#include "CDPackageComponentTable.h"
#include "CDProximityMonitorComponentTable.h"
#include "CDMovementAIComponentTable.h"
#include "CDBrickIDTableTable.h"
#include "CDRarityTableTable.h"
#include "CDMissionEmailTable.h"
#include "CDRewardsTable.h"
#include "CDPropertyEntranceComponentTable.h"
#include "CDPropertyTemplateTable.h"
#include "CDFeatureGatingTable.h"
#include "CDRailActivatorComponent.h"
/**
* Initialize the CDClient tables so they are all loaded into memory.
// C++
#include <type_traits>
#include <unordered_map>
/*!
\file CDClientManager.hpp
\brief A manager for the CDClient tables
*/
class CDClientManager : public Singleton<CDClientManager> {
public:
CDClientManager();
/**
* Fetch a table from CDClient
*
* @tparam Table type to fetch
* @return A pointer to the requested table.
//! Manages all data from the CDClient
class CDClientManager {
private:
static CDClientManager* m_Address; //!< The singleton address
std::unordered_map<std::string, CDTable*> tables; //!< The tables
public:
//! The singleton method
static CDClientManager* Instance() {
if (m_Address == 0) {
m_Address = new CDClientManager;
}
return m_Address;
}
//! Initializes the manager
void Initialize(void);
//! Fetches a CDClient table
/*!
This function uses typename T which must be a subclass of CDTable.
It returns the class that conforms to the class name
\param tableName The table name
\return The class or nullptr
*/
template<typename T>
T* GetTable() {
return &T::Instance();
T* GetTable(const std::string& tableName) {
static_assert(std::is_base_of<CDTable, T>::value, "T should inherit from CDTable!");
for (auto itr = this->tables.begin(); itr != this->tables.end(); ++itr) {
if (itr->first == tableName) {
return dynamic_cast<T*>(itr->second);
}
}
return nullptr;
}
};

View File

@@ -54,7 +54,7 @@ void MigrationRunner::RunMigrations() {
if (doExit) continue;
Game::logger->Log("MigrationRunner", "Running migration: %s", migration.name.c_str());
if (migration.name == "dlu/5_brick_model_sd0.sql") {
if (migration.name == "5_brick_model_sd0.sql") {
runSd0Migrations = true;
} else {
finalSQL.append(migration.data.c_str());

View File

@@ -1,5 +1,6 @@
#include "CDActivitiesTable.h"
//! Constructor
CDActivitiesTable::CDActivitiesTable(void) {
// First, get the size of the table
@@ -20,25 +21,25 @@ CDActivitiesTable::CDActivitiesTable(void) {
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM Activities");
while (!tableData.eof()) {
CDActivities entry;
entry.ActivityID = tableData.getIntField("ActivityID", -1);
entry.locStatus = tableData.getIntField("locStatus", -1);
entry.instanceMapID = tableData.getIntField("instanceMapID", -1);
entry.minTeams = tableData.getIntField("minTeams", -1);
entry.maxTeams = tableData.getIntField("maxTeams", -1);
entry.minTeamSize = tableData.getIntField("minTeamSize", -1);
entry.maxTeamSize = tableData.getIntField("maxTeamSize", -1);
entry.waitTime = tableData.getIntField("waitTime", -1);
entry.startDelay = tableData.getIntField("startDelay", -1);
entry.requiresUniqueData = tableData.getIntField("requiresUniqueData", -1);
entry.leaderboardType = tableData.getIntField("leaderboardType", -1);
entry.localize = tableData.getIntField("localize", -1);
entry.optionalCostLOT = tableData.getIntField("optionalCostLOT", -1);
entry.optionalCostCount = tableData.getIntField("optionalCostCount", -1);
entry.showUIRewards = tableData.getIntField("showUIRewards", -1);
entry.CommunityActivityFlagID = tableData.getIntField("CommunityActivityFlagID", -1);
entry.gate_version = tableData.getStringField("gate_version", "");
entry.noTeamLootOnDeath = tableData.getIntField("noTeamLootOnDeath", -1);
entry.optionalPercentage = tableData.getFloatField("optionalPercentage", -1.0f);
entry.ActivityID = tableData.getIntField(0, -1);
entry.locStatus = tableData.getIntField(1, -1);
entry.instanceMapID = tableData.getIntField(2, -1);
entry.minTeams = tableData.getIntField(3, -1);
entry.maxTeams = tableData.getIntField(4, -1);
entry.minTeamSize = tableData.getIntField(5, -1);
entry.maxTeamSize = tableData.getIntField(6, -1);
entry.waitTime = tableData.getIntField(7, -1);
entry.startDelay = tableData.getIntField(8, -1);
entry.requiresUniqueData = tableData.getIntField(9, -1);
entry.leaderboardType = tableData.getIntField(10, -1);
entry.localize = tableData.getIntField(11, -1);
entry.optionalCostLOT = tableData.getIntField(12, -1);
entry.optionalCostCount = tableData.getIntField(13, -1);
entry.showUIRewards = tableData.getIntField(14, -1);
entry.CommunityActivityFlagID = tableData.getIntField(15, -1);
entry.gate_version = tableData.getStringField(16, "");
entry.noTeamLootOnDeath = tableData.getIntField(17, -1);
entry.optionalPercentage = tableData.getFloatField(18, -1.0f);
this->entries.push_back(entry);
tableData.nextRow();
@@ -47,6 +48,15 @@ CDActivitiesTable::CDActivitiesTable(void) {
tableData.finalize();
}
//! Destructor
CDActivitiesTable::~CDActivitiesTable(void) {}
//! Returns the table's name
std::string CDActivitiesTable::GetName(void) const {
return "Activities";
}
//! Queries the table with a custom "where" clause
std::vector<CDActivities> CDActivitiesTable::Query(std::function<bool(CDActivities)> predicate) {
std::vector<CDActivities> data = cpplinq::from(this->entries)
@@ -56,7 +66,7 @@ std::vector<CDActivities> CDActivitiesTable::Query(std::function<bool(CDActiviti
return data;
}
//! Gets all the entries in the table
std::vector<CDActivities> CDActivitiesTable::GetEntries(void) const {
return this->entries;
}

View File

@@ -3,6 +3,12 @@
// Custom Classes
#include "CDTable.h"
/*!
\file CDActivitiesTable.hpp
\brief Contains data for the Activities table
*/
//! Activities Entry Struct
struct CDActivities {
unsigned int ActivityID;
unsigned int locStatus;
@@ -25,14 +31,36 @@ struct CDActivities {
float optionalPercentage;
};
class CDActivitiesTable : public CDTable<CDActivitiesTable> {
//! Activities table
class CDActivitiesTable : public CDTable {
private:
std::vector<CDActivities> entries;
public:
CDActivitiesTable();
// Queries the table with a custom "where" clause
//! Constructor
CDActivitiesTable(void);
//! Destructor
~CDActivitiesTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
std::vector<CDActivities> Query(std::function<bool(CDActivities)> predicate);
//! Gets all the entries in the table
/*!
\return The entries
*/
std::vector<CDActivities> GetEntries(void) const;
};

View File

@@ -1,5 +1,6 @@
#include "CDActivityRewardsTable.h"
//! Constructor
CDActivityRewardsTable::CDActivityRewardsTable(void) {
// First, get the size of the table
@@ -20,13 +21,13 @@ CDActivityRewardsTable::CDActivityRewardsTable(void) {
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM ActivityRewards");
while (!tableData.eof()) {
CDActivityRewards entry;
entry.objectTemplate = tableData.getIntField("objectTemplate", -1);
entry.ActivityRewardIndex = tableData.getIntField("ActivityRewardIndex", -1);
entry.activityRating = tableData.getIntField("activityRating", -1);
entry.LootMatrixIndex = tableData.getIntField("LootMatrixIndex", -1);
entry.CurrencyIndex = tableData.getIntField("CurrencyIndex", -1);
entry.ChallengeRating = tableData.getIntField("ChallengeRating", -1);
entry.description = tableData.getStringField("description", "");
entry.objectTemplate = tableData.getIntField(0, -1);
entry.ActivityRewardIndex = tableData.getIntField(1, -1);
entry.activityRating = tableData.getIntField(2, -1);
entry.LootMatrixIndex = tableData.getIntField(3, -1);
entry.CurrencyIndex = tableData.getIntField(4, -1);
entry.ChallengeRating = tableData.getIntField(5, -1);
entry.description = tableData.getStringField(6, "");
this->entries.push_back(entry);
tableData.nextRow();
@@ -35,6 +36,15 @@ CDActivityRewardsTable::CDActivityRewardsTable(void) {
tableData.finalize();
}
//! Destructor
CDActivityRewardsTable::~CDActivityRewardsTable(void) {}
//! Returns the table's name
std::string CDActivityRewardsTable::GetName(void) const {
return "ActivityRewards";
}
//! Queries the table with a custom "where" clause
std::vector<CDActivityRewards> CDActivityRewardsTable::Query(std::function<bool(CDActivityRewards)> predicate) {
std::vector<CDActivityRewards> data = cpplinq::from(this->entries)
@@ -44,7 +54,7 @@ std::vector<CDActivityRewards> CDActivityRewardsTable::Query(std::function<bool(
return data;
}
//! Gets all the entries in the table
std::vector<CDActivityRewards> CDActivityRewardsTable::GetEntries(void) const {
return this->entries;
}

View File

@@ -3,6 +3,12 @@
// Custom Classes
#include "CDTable.h"
/*!
\file CDActivityRewardsTable.hpp
\brief Contains data for the ActivityRewards table
*/
//! ActivityRewards Entry Struct
struct CDActivityRewards {
unsigned int objectTemplate; //!< The object template (?)
unsigned int ActivityRewardIndex; //!< The activity reward index
@@ -13,15 +19,36 @@ struct CDActivityRewards {
std::string description; //!< The description
};
class CDActivityRewardsTable : public CDTable<CDActivityRewardsTable> {
//! ActivityRewards table
class CDActivityRewardsTable : public CDTable {
private:
std::vector<CDActivityRewards> entries;
public:
CDActivityRewardsTable();
// Queries the table with a custom "where" clause
//! Constructor
CDActivityRewardsTable(void);
//! Destructor
~CDActivityRewardsTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
std::vector<CDActivityRewards> Query(std::function<bool(CDActivityRewards)> predicate);
//! Gets all the entries in the table
/*!
\return The entries
*/
std::vector<CDActivityRewards> GetEntries(void) const;
};

View File

@@ -1,5 +1,6 @@
#include "CDAnimationsTable.h"
//! Constructor
CDAnimationsTable::CDAnimationsTable(void) {
// First, get the size of the table
@@ -20,19 +21,19 @@ CDAnimationsTable::CDAnimationsTable(void) {
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM Animations");
while (!tableData.eof()) {
CDAnimations entry;
entry.animationGroupID = tableData.getIntField("animationGroupID", -1);
entry.animation_type = tableData.getStringField("animation_type", "");
entry.animation_name = tableData.getStringField("animation_name", "");
entry.chance_to_play = tableData.getFloatField("chance_to_play", -1.0f);
entry.min_loops = tableData.getIntField("min_loops", -1);
entry.max_loops = tableData.getIntField("max_loops", -1);
entry.animation_length = tableData.getFloatField("animation_length", -1.0f);
entry.hideEquip = tableData.getIntField("hideEquip", -1) == 1 ? true : false;
entry.ignoreUpperBody = tableData.getIntField("ignoreUpperBody", -1) == 1 ? true : false;
entry.restartable = tableData.getIntField("restartable", -1) == 1 ? true : false;
entry.face_animation_name = tableData.getStringField("face_animation_name", "");
entry.priority = tableData.getFloatField("priority", -1.0f);
entry.blendTime = tableData.getFloatField("blendTime", -1.0f);
entry.animationGroupID = tableData.getIntField(0, -1);
entry.animation_type = tableData.getStringField(1, "");
entry.animation_name = tableData.getStringField(2, "");
entry.chance_to_play = tableData.getFloatField(3, -1.0f);
entry.min_loops = tableData.getIntField(4, -1);
entry.max_loops = tableData.getIntField(5, -1);
entry.animation_length = tableData.getFloatField(6, -1.0f);
entry.hideEquip = tableData.getIntField(7, -1) == 1 ? true : false;
entry.ignoreUpperBody = tableData.getIntField(8, -1) == 1 ? true : false;
entry.restartable = tableData.getIntField(9, -1) == 1 ? true : false;
entry.face_animation_name = tableData.getStringField(10, "");
entry.priority = tableData.getFloatField(11, -1.0f);
entry.blendTime = tableData.getFloatField(12, -1.0f);
this->entries.push_back(entry);
tableData.nextRow();
@@ -41,6 +42,15 @@ CDAnimationsTable::CDAnimationsTable(void) {
tableData.finalize();
}
//! Destructor
CDAnimationsTable::~CDAnimationsTable(void) {}
//! Returns the table's name
std::string CDAnimationsTable::GetName(void) const {
return "Animations";
}
//! Queries the table with a custom "where" clause
std::vector<CDAnimations> CDAnimationsTable::Query(std::function<bool(CDAnimations)> predicate) {
std::vector<CDAnimations> data = cpplinq::from(this->entries)
@@ -50,7 +60,7 @@ std::vector<CDAnimations> CDAnimationsTable::Query(std::function<bool(CDAnimatio
return data;
}
//! Gets all the entries in the table
std::vector<CDAnimations> CDAnimationsTable::GetEntries(void) const {
return this->entries;
}

View File

@@ -3,6 +3,12 @@
// Custom Classes
#include "CDTable.h"
/*!
\file CDAnimationsTable.hpp
\brief Contains data for the Animations table
*/
//! Animations Entry Struct
struct CDAnimations {
unsigned int animationGroupID; //!< The animation group ID
std::string animation_type; //!< The animation type
@@ -20,14 +26,35 @@ struct CDAnimations {
};
class CDAnimationsTable : public CDTable<CDAnimationsTable> {
//! Animations table
class CDAnimationsTable : public CDTable {
private:
std::vector<CDAnimations> entries;
public:
CDAnimationsTable();
// Queries the table with a custom "where" clause
//! Constructor
CDAnimationsTable(void);
//! Destructor
~CDAnimationsTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
std::vector<CDAnimations> Query(std::function<bool(CDAnimations)> predicate);
//! Gets all the entries in the table
/*!
\return The entries
*/
std::vector<CDAnimations> GetEntries(void) const;
};

View File

@@ -1,25 +1,28 @@
#include "CDBehaviorParameterTable.h"
#include "GeneralUtils.h"
//! Constructor
CDBehaviorParameterTable::CDBehaviorParameterTable(void) {
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM BehaviorParameter");
uint32_t uniqueParameterId = 0;
uint64_t hash = 0;
size_t hash = 0;
while (!tableData.eof()) {
hash = 0;
CDBehaviorParameter entry;
entry.behaviorID = tableData.getIntField("behaviorID", -1);
auto candidateStringToAdd = std::string(tableData.getStringField("parameterID", ""));
entry.behaviorID = tableData.getIntField(0, -1);
auto candidateStringToAdd = std::string(tableData.getStringField(1, ""));
auto parameter = m_ParametersList.find(candidateStringToAdd);
if (parameter != m_ParametersList.end()) {
entry.parameterID = parameter;
} else {
entry.parameterID = m_ParametersList.insert(std::make_pair(candidateStringToAdd, uniqueParameterId)).first;
uniqueParameterId++;
entry.parameterID = m_ParametersList.insert(candidateStringToAdd).first;
}
hash = entry.behaviorID;
hash = (hash << 31U) | entry.parameterID->second;
entry.value = tableData.getFloatField("value", -1.0f);
entry.value = tableData.getFloatField(2, -1.0f);
GeneralUtils::hash_combine(hash, entry.behaviorID);
GeneralUtils::hash_combine(hash, *entry.parameterID);
auto it = m_Entries.find(entry.behaviorID);
m_ParametersList.insert(*entry.parameterID);
m_Entries.insert(std::make_pair(hash, entry));
tableData.nextRow();
@@ -27,30 +30,40 @@ CDBehaviorParameterTable::CDBehaviorParameterTable(void) {
tableData.finalize();
}
float CDBehaviorParameterTable::GetValue(const uint32_t behaviorID, const std::string& name, const float defaultValue) {
auto parameterID = this->m_ParametersList.find(name);
if (parameterID == this->m_ParametersList.end()) return defaultValue;
//! Destructor
CDBehaviorParameterTable::~CDBehaviorParameterTable(void) {}
uint64_t hash = behaviorID;
//! Returns the table's name
std::string CDBehaviorParameterTable::GetName(void) const {
return "BehaviorParameter";
}
hash = (hash << 31U) | parameterID->second;
CDBehaviorParameter CDBehaviorParameterTable::GetEntry(const uint32_t behaviorID, const std::string& name, const float defaultValue) {
CDBehaviorParameter returnValue;
returnValue.behaviorID = 0;
returnValue.parameterID = m_ParametersList.end();
returnValue.value = defaultValue;
size_t hash = 0;
GeneralUtils::hash_combine(hash, behaviorID);
GeneralUtils::hash_combine(hash, name);
// Search for specific parameter
const auto& it = m_Entries.find(hash);
return it != m_Entries.end() ? it->second.value : defaultValue;
return it != m_Entries.end() ? it->second : returnValue;
}
std::map<std::string, float> CDBehaviorParameterTable::GetParametersByBehaviorID(uint32_t behaviorID) {
uint64_t hashBase = behaviorID;
size_t hash;
std::map<std::string, float> returnInfo;
uint64_t hash;
for (auto& parameterCandidate : m_ParametersList) {
hash = (hashBase << 31U) | parameterCandidate.second;
for (auto parameterCandidate : m_ParametersList) {
hash = 0;
GeneralUtils::hash_combine(hash, behaviorID);
GeneralUtils::hash_combine(hash, parameterCandidate);
auto infoCandidate = m_Entries.find(hash);
if (infoCandidate != m_Entries.end()) {
returnInfo.insert(std::make_pair(infoCandidate->second.parameterID->first, infoCandidate->second.value));
returnInfo.insert(std::make_pair(*(infoCandidate->second.parameterID), infoCandidate->second.value));
}
}
return returnInfo;
}

View File

@@ -5,19 +5,38 @@
#include <unordered_map>
#include <unordered_set>
/*!
\file CDBehaviorParameterTable.hpp
\brief Contains data for the BehaviorParameter table
*/
//! BehaviorParameter Entry Struct
struct CDBehaviorParameter {
unsigned int behaviorID; //!< The Behavior ID
std::unordered_map<std::string, uint32_t>::iterator parameterID; //!< The Parameter ID
float value; //!< The value of the behavior template
unsigned int behaviorID; //!< The Behavior ID
std::unordered_set<std::string>::iterator parameterID; //!< The Parameter ID
float value; //!< The value of the behavior template
};
class CDBehaviorParameterTable : public CDTable<CDBehaviorParameterTable> {
//! BehaviorParameter table
class CDBehaviorParameterTable : public CDTable {
private:
std::unordered_map<uint64_t, CDBehaviorParameter> m_Entries;
std::unordered_map<std::string, uint32_t> m_ParametersList;
std::unordered_map<size_t, CDBehaviorParameter> m_Entries;
std::unordered_set<std::string> m_ParametersList;
public:
CDBehaviorParameterTable();
float GetValue(const uint32_t behaviorID, const std::string& name, const float defaultValue = 0);
//! Constructor
CDBehaviorParameterTable(void);
//! Destructor
~CDBehaviorParameterTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
CDBehaviorParameter GetEntry(const uint32_t behaviorID, const std::string& name, const float defaultValue = 0);
std::map<std::string, float> GetParametersByBehaviorID(uint32_t behaviorID);
};

View File

@@ -1,5 +1,6 @@
#include "CDBehaviorTemplateTable.h"
//! Constructor
CDBehaviorTemplateTable::CDBehaviorTemplateTable(void) {
// First, get the size of the table
@@ -20,9 +21,9 @@ CDBehaviorTemplateTable::CDBehaviorTemplateTable(void) {
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM BehaviorTemplate");
while (!tableData.eof()) {
CDBehaviorTemplate entry;
entry.behaviorID = tableData.getIntField("behaviorID", -1);
entry.templateID = tableData.getIntField("templateID", -1);
entry.effectID = tableData.getIntField("effectID", -1);
entry.behaviorID = tableData.getIntField(0, -1);
entry.templateID = tableData.getIntField(1, -1);
entry.effectID = tableData.getIntField(2, -1);
auto candidateToAdd = tableData.getStringField(3, "");
auto parameter = m_EffectHandles.find(candidateToAdd);
if (parameter != m_EffectHandles.end()) {
@@ -39,6 +40,15 @@ CDBehaviorTemplateTable::CDBehaviorTemplateTable(void) {
tableData.finalize();
}
//! Destructor
CDBehaviorTemplateTable::~CDBehaviorTemplateTable(void) {}
//! Returns the table's name
std::string CDBehaviorTemplateTable::GetName(void) const {
return "BehaviorTemplate";
}
//! Queries the table with a custom "where" clause
std::vector<CDBehaviorTemplate> CDBehaviorTemplateTable::Query(std::function<bool(CDBehaviorTemplate)> predicate) {
std::vector<CDBehaviorTemplate> data = cpplinq::from(this->entries)
@@ -48,6 +58,7 @@ std::vector<CDBehaviorTemplate> CDBehaviorTemplateTable::Query(std::function<boo
return data;
}
//! Gets all the entries in the table
std::vector<CDBehaviorTemplate> CDBehaviorTemplateTable::GetEntries(void) const {
return this->entries;
}
@@ -64,4 +75,3 @@ const CDBehaviorTemplate CDBehaviorTemplateTable::GetByBehaviorID(uint32_t behav
return entry->second;
}
}

View File

@@ -5,6 +5,12 @@
#include <unordered_map>
#include <unordered_set>
/*!
\file CDBehaviorTemplateTable.hpp
\brief Contains data for the BehaviorTemplate table
*/
//! BehaviorTemplate Entry Struct
struct CDBehaviorTemplate {
unsigned int behaviorID; //!< The Behavior ID
unsigned int templateID; //!< The Template ID (LOT)
@@ -13,16 +19,36 @@ struct CDBehaviorTemplate {
};
class CDBehaviorTemplateTable : public CDTable<CDBehaviorTemplateTable> {
//! BehaviorTemplate table
class CDBehaviorTemplateTable : public CDTable {
private:
std::vector<CDBehaviorTemplate> entries;
std::unordered_map<uint32_t, CDBehaviorTemplate> entriesMappedByBehaviorID;
std::unordered_set<std::string> m_EffectHandles;
public:
CDBehaviorTemplateTable();
// Queries the table with a custom "where" clause
//! Constructor
CDBehaviorTemplateTable(void);
//! Destructor
~CDBehaviorTemplateTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
std::vector<CDBehaviorTemplate> Query(std::function<bool(CDBehaviorTemplate)> predicate);
//! Gets all the entries in the table
/*!
\return The entries
*/
std::vector<CDBehaviorTemplate> GetEntries(void) const;
const CDBehaviorTemplate GetByBehaviorID(uint32_t behaviorID);

View File

@@ -1,5 +1,6 @@
#include "CDBrickIDTableTable.h"
//! Constructor
CDBrickIDTableTable::CDBrickIDTableTable(void) {
// First, get the size of the table
@@ -20,8 +21,8 @@ CDBrickIDTableTable::CDBrickIDTableTable(void) {
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM BrickIDTable");
while (!tableData.eof()) {
CDBrickIDTable entry;
entry.NDObjectID = tableData.getIntField("NDObjectID", -1);
entry.LEGOBrickID = tableData.getIntField("LEGOBrickID", -1);
entry.NDObjectID = tableData.getIntField(0, -1);
entry.LEGOBrickID = tableData.getIntField(1, -1);
this->entries.push_back(entry);
tableData.nextRow();
@@ -30,6 +31,15 @@ CDBrickIDTableTable::CDBrickIDTableTable(void) {
tableData.finalize();
}
//! Destructor
CDBrickIDTableTable::~CDBrickIDTableTable(void) {}
//! Returns the table's name
std::string CDBrickIDTableTable::GetName(void) const {
return "BrickIDTable";
}
//! Queries the table with a custom "where" clause
std::vector<CDBrickIDTable> CDBrickIDTableTable::Query(std::function<bool(CDBrickIDTable)> predicate) {
std::vector<CDBrickIDTable> data = cpplinq::from(this->entries)
@@ -39,7 +49,7 @@ std::vector<CDBrickIDTable> CDBrickIDTableTable::Query(std::function<bool(CDBric
return data;
}
//! Gets all the entries in the table
std::vector<CDBrickIDTable> CDBrickIDTableTable::GetEntries(void) const {
return this->entries;
}

View File

@@ -16,14 +16,34 @@ struct CDBrickIDTable {
//! BrickIDTable table
class CDBrickIDTableTable : public CDTable<CDBrickIDTableTable> {
class CDBrickIDTableTable : public CDTable {
private:
std::vector<CDBrickIDTable> entries;
public:
CDBrickIDTableTable();
// Queries the table with a custom "where" clause
//! Constructor
CDBrickIDTableTable(void);
//! Destructor
~CDBrickIDTableTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
std::vector<CDBrickIDTable> Query(std::function<bool(CDBrickIDTable)> predicate);
//! Gets all the entries in the table
/*!
\return The entries
*/
std::vector<CDBrickIDTable> GetEntries(void) const;
};

View File

@@ -1,8 +1,8 @@
#include "CDComponentsRegistryTable.h"
#include "eReplicaComponentType.h"
#define CDCLIENT_CACHE_ALL
//! Constructor
CDComponentsRegistryTable::CDComponentsRegistryTable(void) {
#ifdef CDCLIENT_CACHE_ALL
@@ -24,12 +24,30 @@ CDComponentsRegistryTable::CDComponentsRegistryTable(void) {
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM ComponentsRegistry");
while (!tableData.eof()) {
CDComponentsRegistry entry;
entry.id = tableData.getIntField("id", -1);
entry.component_type = static_cast<eReplicaComponentType>(tableData.getIntField("component_type", 0));
entry.component_id = tableData.getIntField("component_id", -1);
entry.id = tableData.getIntField(0, -1);
entry.component_type = tableData.getIntField(1, -1);
entry.component_id = tableData.getIntField(2, -1);
this->mappedEntries.insert_or_assign(((uint64_t)entry.component_type) << 32 | ((uint64_t)entry.id), entry.component_id);
//this->entries.push_back(entry);
/*
//Darwin's stuff:
const auto& it = this->mappedEntries.find(entry.id);
if (it != mappedEntries.end()) {
const auto& iter = it->second.find(entry.component_type);
if (iter == it->second.end()) {
it->second.insert(std::make_pair(entry.component_type, entry.component_id));
}
}
else {
std::map<unsigned int, unsigned int> map;
map.insert(std::make_pair(entry.component_type, entry.component_id));
this->mappedEntries.insert(std::make_pair(entry.id, map));
}
*/
tableData.nextRow();
}
@@ -37,7 +55,15 @@ CDComponentsRegistryTable::CDComponentsRegistryTable(void) {
#endif
}
int32_t CDComponentsRegistryTable::GetByIDAndType(uint32_t id, eReplicaComponentType componentType, int32_t defaultValue) {
//! Destructor
CDComponentsRegistryTable::~CDComponentsRegistryTable(void) {}
//! Returns the table's name
std::string CDComponentsRegistryTable::GetName(void) const {
return "ComponentsRegistry";
}
int32_t CDComponentsRegistryTable::GetByIDAndType(uint32_t id, uint32_t componentType, int32_t defaultValue) {
const auto& iter = this->mappedEntries.find(((uint64_t)componentType) << 32 | ((uint64_t)id));
if (iter == this->mappedEntries.end()) {
@@ -46,6 +72,16 @@ int32_t CDComponentsRegistryTable::GetByIDAndType(uint32_t id, eReplicaComponent
return iter->second;
/*
const auto& it = this->mappedEntries.find(id);
if (it != mappedEntries.end()) {
const auto& iter = it->second.find(componentType);
if (iter != it->second.end()) {
return iter->second;
}
}
*/
#ifndef CDCLIENT_CACHE_ALL
// Now get the data
std::stringstream query;
@@ -55,9 +91,9 @@ int32_t CDComponentsRegistryTable::GetByIDAndType(uint32_t id, eReplicaComponent
auto tableData = CDClientDatabase::ExecuteQuery(query.str());
while (!tableData.eof()) {
CDComponentsRegistry entry;
entry.id = tableData.getIntField("id", -1);
entry.component_type = tableData.getIntField("component_type", -1);
entry.component_id = tableData.getIntField("component_id", -1);
entry.id = tableData.getIntField(0, -1);
entry.component_type = tableData.getIntField(1, -1);
entry.component_id = tableData.getIntField(2, -1);
//this->entries.push_back(entry);
@@ -90,4 +126,3 @@ int32_t CDComponentsRegistryTable::GetByIDAndType(uint32_t id, eReplicaComponent
return defaultValue;
#endif
}

View File

@@ -3,19 +3,38 @@
// Custom Classes
#include "CDTable.h"
enum class eReplicaComponentType : uint32_t;
/*!
\file CDComponentsRegistryTable.hpp
\brief Contains data for the ComponentsRegistry table
*/
//! ComponentsRegistry Entry Struct
struct CDComponentsRegistry {
unsigned int id; //!< The LOT is used as the ID
eReplicaComponentType component_type; //!< See ComponentTypes enum for values
unsigned int component_type; //!< See ComponentTypes enum for values
unsigned int component_id; //!< The ID used within the component's table (0 may either mean it's non-networked, or that the ID is actually 0
};
class CDComponentsRegistryTable : public CDTable<CDComponentsRegistryTable> {
//! ComponentsRegistry table
class CDComponentsRegistryTable : public CDTable {
private:
//std::vector<CDComponentsRegistry> entries;
std::map<uint64_t, uint32_t> mappedEntries; //id, component_type, component_id
public:
CDComponentsRegistryTable();
int32_t GetByIDAndType(uint32_t id, eReplicaComponentType componentType, int32_t defaultValue = 0);
//! Constructor
CDComponentsRegistryTable(void);
//! Destructor
~CDComponentsRegistryTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
int32_t GetByIDAndType(uint32_t id, uint32_t componentType, int32_t defaultValue = 0);
};

View File

@@ -21,11 +21,11 @@ CDCurrencyTableTable::CDCurrencyTableTable(void) {
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM CurrencyTable");
while (!tableData.eof()) {
CDCurrencyTable entry;
entry.currencyIndex = tableData.getIntField("currencyIndex", -1);
entry.npcminlevel = tableData.getIntField("npcminlevel", -1);
entry.minvalue = tableData.getIntField("minvalue", -1);
entry.maxvalue = tableData.getIntField("maxvalue", -1);
entry.id = tableData.getIntField("id", -1);
entry.currencyIndex = tableData.getIntField(0, -1);
entry.npcminlevel = tableData.getIntField(1, -1);
entry.minvalue = tableData.getIntField(2, -1);
entry.maxvalue = tableData.getIntField(3, -1);
entry.id = tableData.getIntField(4, -1);
this->entries.push_back(entry);
tableData.nextRow();
@@ -34,6 +34,15 @@ CDCurrencyTableTable::CDCurrencyTableTable(void) {
tableData.finalize();
}
//! Destructor
CDCurrencyTableTable::~CDCurrencyTableTable(void) {}
//! Returns the table's name
std::string CDCurrencyTableTable::GetName(void) const {
return "CurrencyTable";
}
//! Queries the table with a custom "where" clause
std::vector<CDCurrencyTable> CDCurrencyTableTable::Query(std::function<bool(CDCurrencyTable)> predicate) {
std::vector<CDCurrencyTable> data = cpplinq::from(this->entries)
@@ -43,7 +52,7 @@ std::vector<CDCurrencyTable> CDCurrencyTableTable::Query(std::function<bool(CDCu
return data;
}
//! Gets all the entries in the table
std::vector<CDCurrencyTable> CDCurrencyTableTable::GetEntries(void) const {
return this->entries;
}

View File

@@ -18,14 +18,34 @@ struct CDCurrencyTable {
};
//! CurrencyTable table
class CDCurrencyTableTable : public CDTable<CDCurrencyTableTable> {
class CDCurrencyTableTable : public CDTable {
private:
std::vector<CDCurrencyTable> entries;
public:
CDCurrencyTableTable();
// Queries the table with a custom "where" clause
//! Constructor
CDCurrencyTableTable(void);
//! Destructor
~CDCurrencyTableTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
std::vector<CDCurrencyTable> Query(std::function<bool(CDCurrencyTable)> predicate);
//! Gets all the entries in the table
/*!
\return The entries
*/
std::vector<CDCurrencyTable> GetEntries(void) const;
};

View File

@@ -21,20 +21,20 @@ CDDestructibleComponentTable::CDDestructibleComponentTable(void) {
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM DestructibleComponent");
while (!tableData.eof()) {
CDDestructibleComponent entry;
entry.id = tableData.getIntField("id", -1);
entry.faction = tableData.getIntField("faction", -1);
entry.factionList = tableData.getStringField("factionList", "");
entry.life = tableData.getIntField("life", -1);
entry.imagination = tableData.getIntField("imagination", -1);
entry.LootMatrixIndex = tableData.getIntField("LootMatrixIndex", -1);
entry.CurrencyIndex = tableData.getIntField("CurrencyIndex", -1);
entry.level = tableData.getIntField("level", -1);
entry.armor = tableData.getFloatField("armor", -1.0f);
entry.death_behavior = tableData.getIntField("death_behavior", -1);
entry.isnpc = tableData.getIntField("isnpc", -1) == 1 ? true : false;
entry.attack_priority = tableData.getIntField("attack_priority", -1);
entry.isSmashable = tableData.getIntField("isSmashable", -1) == 1 ? true : false;
entry.difficultyLevel = tableData.getIntField("difficultyLevel", -1);
entry.id = tableData.getIntField(0, -1);
entry.faction = tableData.getIntField(1, -1);
entry.factionList = tableData.getStringField(2, "");
entry.life = tableData.getIntField(3, -1);
entry.imagination = tableData.getIntField(4, -1);
entry.LootMatrixIndex = tableData.getIntField(5, -1);
entry.CurrencyIndex = tableData.getIntField(6, -1);
entry.level = tableData.getIntField(7, -1);
entry.armor = tableData.getFloatField(8, -1.0f);
entry.death_behavior = tableData.getIntField(9, -1);
entry.isnpc = tableData.getIntField(10, -1) == 1 ? true : false;
entry.attack_priority = tableData.getIntField(11, -1);
entry.isSmashable = tableData.getIntField(12, -1) == 1 ? true : false;
entry.difficultyLevel = tableData.getIntField(13, -1);
this->entries.push_back(entry);
tableData.nextRow();
@@ -43,6 +43,15 @@ CDDestructibleComponentTable::CDDestructibleComponentTable(void) {
tableData.finalize();
}
//! Destructor
CDDestructibleComponentTable::~CDDestructibleComponentTable(void) {}
//! Returns the table's name
std::string CDDestructibleComponentTable::GetName(void) const {
return "DestructibleComponent";
}
//! Queries the table with a custom "where" clause
std::vector<CDDestructibleComponent> CDDestructibleComponentTable::Query(std::function<bool(CDDestructibleComponent)> predicate) {
std::vector<CDDestructibleComponent> data = cpplinq::from(this->entries)
@@ -52,7 +61,7 @@ std::vector<CDDestructibleComponent> CDDestructibleComponentTable::Query(std::fu
return data;
}
//! Gets all the entries in the table
std::vector<CDDestructibleComponent> CDDestructibleComponentTable::GetEntries(void) const {
return this->entries;
}

View File

@@ -3,6 +3,12 @@
// Custom Classes
#include "CDTable.h"
/*!
\file CDDestructibleComponentTable.hpp
\brief Contains data for the DestructibleComponent table
*/
//! ItemComponent Struct
struct CDDestructibleComponent {
unsigned int id; //!< The component ID from the ComponentsRegistry Table
int faction; //!< The Faction ID of the object
@@ -20,14 +26,35 @@ struct CDDestructibleComponent {
int difficultyLevel; //!< ???
};
class CDDestructibleComponentTable : public CDTable<CDDestructibleComponentTable> {
//! ItemComponent table
class CDDestructibleComponentTable : public CDTable {
private:
std::vector<CDDestructibleComponent> entries;
public:
CDDestructibleComponentTable();
// Queries the table with a custom "where" clause
//! Constructor
CDDestructibleComponentTable(void);
//! Destructor
~CDDestructibleComponentTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
std::vector<CDDestructibleComponent> Query(std::function<bool(CDDestructibleComponent)> predicate);
//! Gets all the entries in the table
/*!
\return The entries
*/
std::vector<CDDestructibleComponent> GetEntries(void) const;
};

View File

@@ -5,14 +5,14 @@ CDEmoteTableTable::CDEmoteTableTable(void) {
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM Emotes");
while (!tableData.eof()) {
CDEmoteTable* entry = new CDEmoteTable();
entry->ID = tableData.getIntField("id", -1);
entry->animationName = tableData.getStringField("animationName", "");
entry->iconFilename = tableData.getStringField("iconFilename", "");
entry->channel = tableData.getIntField("channel", -1);
entry->locked = tableData.getIntField("locked", -1) != 0;
entry->localize = tableData.getIntField("localize", -1) != 0;
entry->locState = tableData.getIntField("locStatus", -1);
entry->gateVersion = tableData.getStringField("gate_version", "");
entry->ID = tableData.getIntField(0, -1);
entry->animationName = tableData.getStringField(1, "");
entry->iconFilename = tableData.getStringField(2, "");
entry->channel = tableData.getIntField(3, -1);
entry->locked = tableData.getIntField(5, -1) != 0;
entry->localize = tableData.getIntField(6, -1) != 0;
entry->locState = tableData.getIntField(7, -1);
entry->gateVersion = tableData.getIntField(8, -1);
entries.insert(std::make_pair(entry->ID, entry));
tableData.nextRow();
@@ -30,6 +30,11 @@ CDEmoteTableTable::~CDEmoteTableTable(void) {
entries.clear();
}
//! Returns the table's name
std::string CDEmoteTableTable::GetName(void) const {
return "Emotes";
}
CDEmoteTable* CDEmoteTableTable::GetEmote(int id) {
for (auto e : entries) {
if (e.first == id) return e.second;
@@ -37,4 +42,3 @@ CDEmoteTable* CDEmoteTableTable::GetEmote(int id) {
return nullptr;
}

View File

@@ -4,6 +4,12 @@
#include "CDTable.h"
#include <map>
/*!
\file CDEmoteTable.hpp
\brief Contains data for the CDEmoteTable table
*/
//! CDEmoteEntry Struct
struct CDEmoteTable {
CDEmoteTable() {
ID = -1;
@@ -13,7 +19,7 @@ struct CDEmoteTable {
channel = -1;
locked = false;
localize = false;
gateVersion = "";
gateVersion = -1;
}
int ID;
@@ -23,16 +29,28 @@ struct CDEmoteTable {
int channel;
bool locked;
bool localize;
std::string gateVersion;
int gateVersion;
};
class CDEmoteTableTable : public CDTable<CDEmoteTableTable> {
//! CDEmoteTable table
class CDEmoteTableTable : public CDTable {
private:
std::map<int, CDEmoteTable*> entries;
public:
CDEmoteTableTable();
~CDEmoteTableTable();
// Returns an emote by ID
//! Constructor
CDEmoteTableTable(void);
//! Destructor
~CDEmoteTableTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Returns an emote by ID
CDEmoteTable* GetEmote(int id);
};

View File

@@ -21,11 +21,11 @@ CDFeatureGatingTable::CDFeatureGatingTable(void) {
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM FeatureGating");
while (!tableData.eof()) {
CDFeatureGating entry;
entry.featureName = tableData.getStringField("featureName", "");
entry.major = tableData.getIntField("major", -1);
entry.current = tableData.getIntField("current", -1);
entry.minor = tableData.getIntField("minor", -1);
entry.description = tableData.getStringField("description", "");
entry.featureName = tableData.getStringField(0, "");
entry.major = tableData.getIntField(1, -1);
entry.current = tableData.getIntField(2, -1);
entry.minor = tableData.getIntField(3, -1);
entry.description = tableData.getStringField(4, "");
this->entries.push_back(entry);
tableData.nextRow();
@@ -34,6 +34,15 @@ CDFeatureGatingTable::CDFeatureGatingTable(void) {
tableData.finalize();
}
//! Destructor
CDFeatureGatingTable::~CDFeatureGatingTable(void) {}
//! Returns the table's name
std::string CDFeatureGatingTable::GetName(void) const {
return "FeatureGating";
}
//! Queries the table with a custom "where" clause
std::vector<CDFeatureGating> CDFeatureGatingTable::Query(std::function<bool(CDFeatureGating)> predicate) {
std::vector<CDFeatureGating> data = cpplinq::from(this->entries)
@@ -53,7 +62,7 @@ bool CDFeatureGatingTable::FeatureUnlocked(const std::string& feature) const {
return false;
}
//! Gets all the entries in the table
std::vector<CDFeatureGating> CDFeatureGatingTable::GetEntries(void) const {
return this->entries;
}

View File

@@ -3,6 +3,11 @@
// Custom Classes
#include "CDTable.h"
/*!
\file CDFeatureGatingTable.hpp
*/
//! ItemComponent Struct
struct CDFeatureGating {
std::string featureName;
int32_t major;
@@ -11,16 +16,37 @@ struct CDFeatureGating {
std::string description;
};
class CDFeatureGatingTable : public CDTable<CDFeatureGatingTable> {
//! ItemComponent table
class CDFeatureGatingTable : public CDTable {
private:
std::vector<CDFeatureGating> entries;
public:
CDFeatureGatingTable();
// Queries the table with a custom "where" clause
//! Constructor
CDFeatureGatingTable(void);
//! Destructor
~CDFeatureGatingTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
std::vector<CDFeatureGating> Query(std::function<bool(CDFeatureGating)> predicate);
bool FeatureUnlocked(const std::string& feature) const;
//! Gets all the entries in the table
/*!
\return The entries
*/
std::vector<CDFeatureGating> GetEntries(void) const;
};

View File

@@ -21,10 +21,10 @@ CDInventoryComponentTable::CDInventoryComponentTable(void) {
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM InventoryComponent");
while (!tableData.eof()) {
CDInventoryComponent entry;
entry.id = tableData.getIntField("id", -1);
entry.itemid = tableData.getIntField("itemid", -1);
entry.count = tableData.getIntField("count", -1);
entry.equip = tableData.getIntField("equip", -1) == 1 ? true : false;
entry.id = tableData.getIntField(0, -1);
entry.itemid = tableData.getIntField(1, -1);
entry.count = tableData.getIntField(2, -1);
entry.equip = tableData.getIntField(3, -1) == 1 ? true : false;
this->entries.push_back(entry);
tableData.nextRow();
@@ -33,6 +33,15 @@ CDInventoryComponentTable::CDInventoryComponentTable(void) {
tableData.finalize();
}
//! Destructor
CDInventoryComponentTable::~CDInventoryComponentTable(void) {}
//! Returns the table's name
std::string CDInventoryComponentTable::GetName(void) const {
return "InventoryComponent";
}
//! Queries the table with a custom "where" clause
std::vector<CDInventoryComponent> CDInventoryComponentTable::Query(std::function<bool(CDInventoryComponent)> predicate) {
std::vector<CDInventoryComponent> data = cpplinq::from(this->entries)
@@ -42,7 +51,7 @@ std::vector<CDInventoryComponent> CDInventoryComponentTable::Query(std::function
return data;
}
//! Gets all the entries in the table
std::vector<CDInventoryComponent> CDInventoryComponentTable::GetEntries(void) const {
return this->entries;
}

View File

@@ -3,6 +3,12 @@
// Custom Classes
#include "CDTable.h"
/*!
\file CDInventoryComponentTable.hpp
\brief Contains data for the InventoryComponent table
*/
//! ItemComponent Struct
struct CDInventoryComponent {
unsigned int id; //!< The component ID for this object
unsigned int itemid; //!< The LOT of the object
@@ -10,14 +16,35 @@ struct CDInventoryComponent {
bool equip; //!< Whether or not to equip the item
};
class CDInventoryComponentTable : public CDTable<CDInventoryComponentTable> {
//! ItemComponent table
class CDInventoryComponentTable : public CDTable {
private:
std::vector<CDInventoryComponent> entries;
public:
CDInventoryComponentTable();
// Queries the table with a custom "where" clause
//! Constructor
CDInventoryComponentTable(void);
//! Destructor
~CDInventoryComponentTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
std::vector<CDInventoryComponent> Query(std::function<bool(CDInventoryComponent)> predicate);
//! Gets all the entries in the table
/*!
\return The entries
*/
std::vector<CDInventoryComponent> GetEntries(void) const;
};

View File

@@ -23,48 +23,48 @@ CDItemComponentTable::CDItemComponentTable(void) {
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM ItemComponent");
while (!tableData.eof()) {
CDItemComponent entry;
entry.id = tableData.getIntField("id", -1);
entry.equipLocation = tableData.getStringField("equipLocation", "");
entry.baseValue = tableData.getIntField("baseValue", -1);
entry.isKitPiece = tableData.getIntField("isKitPiece", -1) == 1 ? true : false;
entry.rarity = tableData.getIntField("rarity", 0);
entry.itemType = tableData.getIntField("itemType", -1);
entry.itemInfo = tableData.getInt64Field("itemInfo", -1);
entry.inLootTable = tableData.getIntField("inLootTable", -1) == 1 ? true : false;
entry.inVendor = tableData.getIntField("inVendor", -1) == 1 ? true : false;
entry.isUnique = tableData.getIntField("isUnique", -1) == 1 ? true : false;
entry.isBOP = tableData.getIntField("isBOP", -1) == 1 ? true : false;
entry.isBOE = tableData.getIntField("isBOE", -1) == 1 ? true : false;
entry.reqFlagID = tableData.getIntField("reqFlagID", -1);
entry.reqSpecialtyID = tableData.getIntField("reqSpecialtyID", -1);
entry.reqSpecRank = tableData.getIntField("reqSpecRank", -1);
entry.reqAchievementID = tableData.getIntField("reqAchievementID", -1);
entry.stackSize = tableData.getIntField("stackSize", -1);
entry.color1 = tableData.getIntField("color1", -1);
entry.decal = tableData.getIntField("decal", -1);
entry.offsetGroupID = tableData.getIntField("offsetGroupID", -1);
entry.buildTypes = tableData.getIntField("buildTypes", -1);
entry.reqPrecondition = tableData.getStringField("reqPrecondition", "");
entry.animationFlag = tableData.getIntField("animationFlag", 0);
entry.equipEffects = tableData.getIntField("equipEffects", -1);
entry.readyForQA = tableData.getIntField("readyForQA", -1) == 1 ? true : false;
entry.itemRating = tableData.getIntField("itemRating", -1);
entry.isTwoHanded = tableData.getIntField("isTwoHanded", -1) == 1 ? true : false;
entry.minNumRequired = tableData.getIntField("minNumRequired", -1);
entry.delResIndex = tableData.getIntField("delResIndex", -1);
entry.currencyLOT = tableData.getIntField("currencyLOT", -1);
entry.altCurrencyCost = tableData.getIntField("altCurrencyCost", -1);
entry.subItems = tableData.getStringField("subItems", "");
entry.audioEventUse = tableData.getStringField("audioEventUse", "");
entry.noEquipAnimation = tableData.getIntField("noEquipAnimation", -1) == 1 ? true : false;
entry.commendationLOT = tableData.getIntField("commendationLOT", -1);
entry.commendationCost = tableData.getIntField("commendationCost", -1);
entry.audioEquipMetaEventSet = tableData.getStringField("audioEquipMetaEventSet", "");
entry.currencyCosts = tableData.getStringField("currencyCosts", "");
entry.ingredientInfo = tableData.getStringField("ingredientInfo", "");
entry.locStatus = tableData.getIntField("locStatus", -1);
entry.forgeType = tableData.getIntField("forgeType", -1);
entry.SellMultiplier = tableData.getFloatField("SellMultiplier", -1.0f);
entry.id = tableData.getIntField(0, -1);
entry.equipLocation = tableData.getStringField(1, "");
entry.baseValue = tableData.getIntField(2, -1);
entry.isKitPiece = tableData.getIntField(3, -1) == 1 ? true : false;
entry.rarity = tableData.getIntField(4, 0);
entry.itemType = tableData.getIntField(5, -1);
entry.itemInfo = tableData.getInt64Field(6, -1);
entry.inLootTable = tableData.getIntField(7, -1) == 1 ? true : false;
entry.inVendor = tableData.getIntField(8, -1) == 1 ? true : false;
entry.isUnique = tableData.getIntField(9, -1) == 1 ? true : false;
entry.isBOP = tableData.getIntField(10, -1) == 1 ? true : false;
entry.isBOE = tableData.getIntField(11, -1) == 1 ? true : false;
entry.reqFlagID = tableData.getIntField(12, -1);
entry.reqSpecialtyID = tableData.getIntField(13, -1);
entry.reqSpecRank = tableData.getIntField(14, -1);
entry.reqAchievementID = tableData.getIntField(15, -1);
entry.stackSize = tableData.getIntField(16, -1);
entry.color1 = tableData.getIntField(17, -1);
entry.decal = tableData.getIntField(18, -1);
entry.offsetGroupID = tableData.getIntField(19, -1);
entry.buildTypes = tableData.getIntField(20, -1);
entry.reqPrecondition = tableData.getStringField(21, "");
entry.animationFlag = tableData.getIntField(22, 0);
entry.equipEffects = tableData.getIntField(23, -1);
entry.readyForQA = tableData.getIntField(24, -1) == 1 ? true : false;
entry.itemRating = tableData.getIntField(25, -1);
entry.isTwoHanded = tableData.getIntField(26, -1) == 1 ? true : false;
entry.minNumRequired = tableData.getIntField(27, -1);
entry.delResIndex = tableData.getIntField(28, -1);
entry.currencyLOT = tableData.getIntField(29, -1);
entry.altCurrencyCost = tableData.getIntField(30, -1);
entry.subItems = tableData.getStringField(31, "");
entry.audioEventUse = tableData.getStringField(32, "");
entry.noEquipAnimation = tableData.getIntField(33, -1) == 1 ? true : false;
entry.commendationLOT = tableData.getIntField(34, -1);
entry.commendationCost = tableData.getIntField(35, -1);
entry.audioEquipMetaEventSet = tableData.getStringField(36, "");
entry.currencyCosts = tableData.getStringField(37, "");
entry.ingredientInfo = tableData.getStringField(38, "");
entry.locStatus = tableData.getIntField(39, -1);
entry.forgeType = tableData.getIntField(40, -1);
entry.SellMultiplier = tableData.getFloatField(41, -1.0f);
this->entries.insert(std::make_pair(entry.id, entry));
tableData.nextRow();
@@ -74,6 +74,14 @@ CDItemComponentTable::CDItemComponentTable(void) {
#endif
}
//! Destructor
CDItemComponentTable::~CDItemComponentTable(void) {}
//! Returns the table's name
std::string CDItemComponentTable::GetName(void) const {
return "ItemComponent";
}
const CDItemComponent& CDItemComponentTable::GetItemComponentByID(unsigned int skillID) {
const auto& it = this->entries.find(skillID);
if (it != this->entries.end()) {
@@ -93,48 +101,48 @@ const CDItemComponent& CDItemComponentTable::GetItemComponentByID(unsigned int s
while (!tableData.eof()) {
CDItemComponent entry;
entry.id = tableData.getIntField("id", -1);
entry.equipLocation = tableData.getStringField("equipLocation", "");
entry.baseValue = tableData.getIntField("baseValue", -1);
entry.isKitPiece = tableData.getIntField("isKitPiece", -1) == 1 ? true : false;
entry.rarity = tableData.getIntField("rarity", 0);
entry.itemType = tableData.getIntField("itemType", -1);
entry.itemInfo = tableData.getInt64Field("itemInfo", -1);
entry.inLootTable = tableData.getIntField("inLootTable", -1) == 1 ? true : false;
entry.inVendor = tableData.getIntField("inVendor", -1) == 1 ? true : false;
entry.isUnique = tableData.getIntField("isUnique", -1) == 1 ? true : false;
entry.isBOP = tableData.getIntField("isBOP", -1) == 1 ? true : false;
entry.isBOE = tableData.getIntField("isBOE", -1) == 1 ? true : false;
entry.reqFlagID = tableData.getIntField("reqFlagID", -1);
entry.reqSpecialtyID = tableData.getIntField("reqSpecialtyID", -1);
entry.reqSpecRank = tableData.getIntField("reqSpecRank", -1);
entry.reqAchievementID = tableData.getIntField("reqAchievementID", -1);
entry.stackSize = tableData.getIntField("stackSize", -1);
entry.color1 = tableData.getIntField("color1", -1);
entry.decal = tableData.getIntField("decal", -1);
entry.offsetGroupID = tableData.getIntField("offsetGroupID", -1);
entry.buildTypes = tableData.getIntField("buildTypes", -1);
entry.reqPrecondition = tableData.getStringField("reqPrecondition", "");
entry.animationFlag = tableData.getIntField("animationFlag", 0);
entry.equipEffects = tableData.getIntField("equipEffects", -1);
entry.readyForQA = tableData.getIntField("readyForQA", -1) == 1 ? true : false;
entry.itemRating = tableData.getIntField("itemRating", -1);
entry.isTwoHanded = tableData.getIntField("isTwoHanded", -1) == 1 ? true : false;
entry.minNumRequired = tableData.getIntField("minNumRequired", -1);
entry.delResIndex = tableData.getIntField("delResIndex", -1);
entry.currencyLOT = tableData.getIntField("currencyLOT", -1);
entry.altCurrencyCost = tableData.getIntField("altCurrencyCost", -1);
entry.subItems = tableData.getStringField("subItems", "");
UNUSED(entry.audioEventUse = tableData.getStringField("audioEventUse", ""));
entry.noEquipAnimation = tableData.getIntField("noEquipAnimation", -1) == 1 ? true : false;
entry.commendationLOT = tableData.getIntField("commendationLOT", -1);
entry.commendationCost = tableData.getIntField("commendationCost", -1);
UNUSED(entry.audioEquipMetaEventSet = tableData.getStringField("audioEquipMetaEventSet", ""));
entry.currencyCosts = tableData.getStringField("currencyCosts", "");
UNUSED(entry.ingredientInfo = tableData.getStringField("ingredientInfo", ""));
entry.locStatus = tableData.getIntField("locStatus", -1);
entry.forgeType = tableData.getIntField("forgeType", -1);
entry.SellMultiplier = tableData.getFloatField("SellMultiplier", -1.0f);
entry.id = tableData.getIntField(0, -1);
entry.equipLocation = tableData.getStringField(1, "");
entry.baseValue = tableData.getIntField(2, -1);
entry.isKitPiece = tableData.getIntField(3, -1) == 1 ? true : false;
entry.rarity = tableData.getIntField(4, 0);
entry.itemType = tableData.getIntField(5, -1);
entry.itemInfo = tableData.getInt64Field(6, -1);
entry.inLootTable = tableData.getIntField(7, -1) == 1 ? true : false;
entry.inVendor = tableData.getIntField(8, -1) == 1 ? true : false;
entry.isUnique = tableData.getIntField(9, -1) == 1 ? true : false;
entry.isBOP = tableData.getIntField(10, -1) == 1 ? true : false;
entry.isBOE = tableData.getIntField(11, -1) == 1 ? true : false;
entry.reqFlagID = tableData.getIntField(12, -1);
entry.reqSpecialtyID = tableData.getIntField(13, -1);
entry.reqSpecRank = tableData.getIntField(14, -1);
entry.reqAchievementID = tableData.getIntField(15, -1);
entry.stackSize = tableData.getIntField(16, -1);
entry.color1 = tableData.getIntField(17, -1);
entry.decal = tableData.getIntField(18, -1);
entry.offsetGroupID = tableData.getIntField(19, -1);
entry.buildTypes = tableData.getIntField(20, -1);
entry.reqPrecondition = tableData.getStringField(21, "");
entry.animationFlag = tableData.getIntField(22, 0);
entry.equipEffects = tableData.getIntField(23, -1);
entry.readyForQA = tableData.getIntField(24, -1) == 1 ? true : false;
entry.itemRating = tableData.getIntField(25, -1);
entry.isTwoHanded = tableData.getIntField(26, -1) == 1 ? true : false;
entry.minNumRequired = tableData.getIntField(27, -1);
entry.delResIndex = tableData.getIntField(28, -1);
entry.currencyLOT = tableData.getIntField(29, -1);
entry.altCurrencyCost = tableData.getIntField(30, -1);
entry.subItems = tableData.getStringField(31, "");
UNUSED(entry.audioEventUse = tableData.getStringField(32, ""));
entry.noEquipAnimation = tableData.getIntField(33, -1) == 1 ? true : false;
entry.commendationLOT = tableData.getIntField(34, -1);
entry.commendationCost = tableData.getIntField(35, -1);
UNUSED(entry.audioEquipMetaEventSet = tableData.getStringField(36, ""));
entry.currencyCosts = tableData.getStringField(37, "");
UNUSED(entry.ingredientInfo = tableData.getStringField(38, ""));
entry.locStatus = tableData.getIntField(39, -1);
entry.forgeType = tableData.getIntField(40, -1);
entry.SellMultiplier = tableData.getFloatField(41, -1.0f);
this->entries.insert(std::make_pair(entry.id, entry));
tableData.nextRow();
@@ -169,4 +177,3 @@ std::map<LOT, uint32_t> CDItemComponentTable::ParseCraftingCurrencies(const CDIt
return currencies;
}

View File

@@ -4,6 +4,12 @@
#include "CDTable.h"
#include "dCommonVars.h"
/*!
\file CDItemComponentTable.hpp
\brief Contains data for the ItemComponent table
*/
//! ItemComponent Struct
struct CDItemComponent {
unsigned int id; //!< The Component ID
std::string equipLocation; //!< The equip location
@@ -49,15 +55,28 @@ struct CDItemComponent {
float SellMultiplier; //!< Something to do with early vendors perhaps (but replaced)
};
class CDItemComponentTable : public CDTable<CDItemComponentTable> {
//! ItemComponent table
class CDItemComponentTable : public CDTable {
private:
std::map<unsigned int, CDItemComponent> entries;
public:
CDItemComponentTable();
//! Constructor
CDItemComponentTable(void);
//! Destructor
~CDItemComponentTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
static std::map<LOT, uint32_t> ParseCraftingCurrencies(const CDItemComponent& itemComponent);
// Gets an entry by ID
//! Gets an entry by ID
const CDItemComponent& GetItemComponentByID(unsigned int skillID);
static CDItemComponent Default;

View File

@@ -21,9 +21,9 @@ CDItemSetSkillsTable::CDItemSetSkillsTable(void) {
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM ItemSetSkills");
while (!tableData.eof()) {
CDItemSetSkills entry;
entry.SkillSetID = tableData.getIntField("SkillSetID", -1);
entry.SkillID = tableData.getIntField("SkillID", -1);
entry.SkillCastType = tableData.getIntField("SkillCastType", -1);
entry.SkillSetID = tableData.getIntField(0, -1);
entry.SkillID = tableData.getIntField(1, -1);
entry.SkillCastType = tableData.getIntField(2, -1);
this->entries.push_back(entry);
tableData.nextRow();
@@ -32,6 +32,15 @@ CDItemSetSkillsTable::CDItemSetSkillsTable(void) {
tableData.finalize();
}
//! Destructor
CDItemSetSkillsTable::~CDItemSetSkillsTable(void) {}
//! Returns the table's name
std::string CDItemSetSkillsTable::GetName(void) const {
return "ItemSetSkills";
}
//! Queries the table with a custom "where" clause
std::vector<CDItemSetSkills> CDItemSetSkillsTable::Query(std::function<bool(CDItemSetSkills)> predicate) {
std::vector<CDItemSetSkills> data = cpplinq::from(this->entries)
@@ -41,6 +50,7 @@ std::vector<CDItemSetSkills> CDItemSetSkillsTable::Query(std::function<bool(CDIt
return data;
}
//! Gets all the entries in the table
std::vector<CDItemSetSkills> CDItemSetSkillsTable::GetEntries(void) const {
return this->entries;
}

View File

@@ -3,22 +3,50 @@
// Custom Classes
#include "CDTable.h"
/*!
\file CDItemSetSkillsTable.hpp
\brief Contains data for the ItemSetSkills table
*/
//! ZoneTable Struct
struct CDItemSetSkills {
unsigned int SkillSetID; //!< The skill set ID
unsigned int SkillID; //!< The skill ID
unsigned int SkillCastType; //!< The skill cast type
};
class CDItemSetSkillsTable : public CDTable<CDItemSetSkillsTable> {
//! ItemSets table
class CDItemSetSkillsTable : public CDTable {
private:
std::vector<CDItemSetSkills> entries;
public:
CDItemSetSkillsTable();
// Queries the table with a custom "where" clause
//! Constructor
CDItemSetSkillsTable(void);
//! Destructor
~CDItemSetSkillsTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
std::vector<CDItemSetSkills> Query(std::function<bool(CDItemSetSkills)> predicate);
//! Gets all the entries in the table
/*!
\return The entries
*/
std::vector<CDItemSetSkills> GetEntries(void) const;
std::vector<CDItemSetSkills> GetBySkillID(unsigned int SkillSetID);
};

View File

@@ -21,21 +21,21 @@ CDItemSetsTable::CDItemSetsTable(void) {
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM ItemSets");
while (!tableData.eof()) {
CDItemSets entry;
entry.setID = tableData.getIntField("setID", -1);
entry.locStatus = tableData.getIntField("locStatus", -1);
entry.itemIDs = tableData.getStringField("itemIDs", "");
entry.kitType = tableData.getIntField("kitType", -1);
entry.kitRank = tableData.getIntField("kitRank", -1);
entry.kitImage = tableData.getIntField("kitImage", -1);
entry.skillSetWith2 = tableData.getIntField("skillSetWith2", -1);
entry.skillSetWith3 = tableData.getIntField("skillSetWith3", -1);
entry.skillSetWith4 = tableData.getIntField("skillSetWith4", -1);
entry.skillSetWith5 = tableData.getIntField("skillSetWith5", -1);
entry.skillSetWith6 = tableData.getIntField("skillSetWith6", -1);
entry.localize = tableData.getIntField("localize", -1) == 1 ? true : false;
entry.gate_version = tableData.getStringField("gate_version", "");
entry.kitID = tableData.getIntField("kitID", -1);
entry.priority = tableData.getFloatField("priority", -1.0f);
entry.setID = tableData.getIntField(0, -1);
entry.locStatus = tableData.getIntField(1, -1);
entry.itemIDs = tableData.getStringField(2, "");
entry.kitType = tableData.getIntField(3, -1);
entry.kitRank = tableData.getIntField(4, -1);
entry.kitImage = tableData.getIntField(5, -1);
entry.skillSetWith2 = tableData.getIntField(6, -1);
entry.skillSetWith3 = tableData.getIntField(7, -1);
entry.skillSetWith4 = tableData.getIntField(8, -1);
entry.skillSetWith5 = tableData.getIntField(9, -1);
entry.skillSetWith6 = tableData.getIntField(10, -1);
entry.localize = tableData.getIntField(11, -1) == 1 ? true : false;
entry.gate_version = tableData.getStringField(12, "");
entry.kitID = tableData.getIntField(13, -1);
entry.priority = tableData.getFloatField(14, -1.0f);
this->entries.push_back(entry);
tableData.nextRow();
@@ -44,6 +44,15 @@ CDItemSetsTable::CDItemSetsTable(void) {
tableData.finalize();
}
//! Destructor
CDItemSetsTable::~CDItemSetsTable(void) {}
//! Returns the table's name
std::string CDItemSetsTable::GetName(void) const {
return "ItemSets";
}
//! Queries the table with a custom "where" clause
std::vector<CDItemSets> CDItemSetsTable::Query(std::function<bool(CDItemSets)> predicate) {
std::vector<CDItemSets> data = cpplinq::from(this->entries)
@@ -53,7 +62,7 @@ std::vector<CDItemSets> CDItemSetsTable::Query(std::function<bool(CDItemSets)> p
return data;
}
//! Gets all the entries in the table
std::vector<CDItemSets> CDItemSetsTable::GetEntries(void) const {
return this->entries;
}

View File

@@ -3,6 +3,12 @@
// Custom Classes
#include "CDTable.h"
/*!
\file CDItemSetsTable.hpp
\brief Contains data for the ItemSets table
*/
//! ZoneTable Struct
struct CDItemSets {
unsigned int setID; //!< The item set ID
unsigned int locStatus; //!< The loc status
@@ -21,15 +27,36 @@ struct CDItemSets {
float priority; //!< The priority
};
class CDItemSetsTable : public CDTable<CDItemSetsTable> {
//! ItemSets table
class CDItemSetsTable : public CDTable {
private:
std::vector<CDItemSets> entries;
public:
CDItemSetsTable();
// Queries the table with a custom "where" clause
//! Constructor
CDItemSetsTable(void);
//! Destructor
~CDItemSetsTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
std::vector<CDItemSets> Query(std::function<bool(CDItemSets)> predicate);
//! Gets all the entries in the table
/*!
\return The entries
*/
std::vector<CDItemSets> GetEntries(void) const;
};

View File

@@ -21,9 +21,9 @@ CDLevelProgressionLookupTable::CDLevelProgressionLookupTable(void) {
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM LevelProgressionLookup");
while (!tableData.eof()) {
CDLevelProgressionLookup entry;
entry.id = tableData.getIntField("id", -1);
entry.requiredUScore = tableData.getIntField("requiredUScore", -1);
entry.BehaviorEffect = tableData.getStringField("BehaviorEffect", "");
entry.id = tableData.getIntField(0, -1);
entry.requiredUScore = tableData.getIntField(1, -1);
entry.BehaviorEffect = tableData.getStringField(2, "");
this->entries.push_back(entry);
tableData.nextRow();
@@ -32,6 +32,14 @@ CDLevelProgressionLookupTable::CDLevelProgressionLookupTable(void) {
tableData.finalize();
}
//! Destructor
CDLevelProgressionLookupTable::~CDLevelProgressionLookupTable(void) {}
//! Returns the table's name
std::string CDLevelProgressionLookupTable::GetName(void) const {
return "LevelProgressionLookup";
}
//! Queries the table with a custom "where" clause
std::vector<CDLevelProgressionLookup> CDLevelProgressionLookupTable::Query(std::function<bool(CDLevelProgressionLookup)> predicate) {
@@ -46,4 +54,3 @@ std::vector<CDLevelProgressionLookup> CDLevelProgressionLookupTable::Query(std::
std::vector<CDLevelProgressionLookup> CDLevelProgressionLookupTable::GetEntries(void) const {
return this->entries;
}

View File

@@ -3,21 +3,47 @@
// Custom Classes
#include "CDTable.h"
/*!
\file CDLevelProgressionLookupTable.hpp
\brief Contains data for the LevelProgressionLookup table
*/
//! LevelProgressionLookup Entry Struct
struct CDLevelProgressionLookup {
unsigned int id; //!< The Level ID
unsigned int requiredUScore; //!< The required LEGO Score
std::string BehaviorEffect; //!< The behavior effect attached to this
};
class CDLevelProgressionLookupTable : public CDTable<CDLevelProgressionLookupTable> {
//! LevelProgressionLookup table
class CDLevelProgressionLookupTable : public CDTable {
private:
std::vector<CDLevelProgressionLookup> entries;
public:
CDLevelProgressionLookupTable();
// Queries the table with a custom "where" clause
//! Constructor
CDLevelProgressionLookupTable(void);
//! Destructor
~CDLevelProgressionLookupTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
std::vector<CDLevelProgressionLookup> Query(std::function<bool(CDLevelProgressionLookup)> predicate);
// Gets all the entries in the table
//! Gets all the entries in the table
/*!
\return The entries
*/
std::vector<CDLevelProgressionLookup> GetEntries(void) const;
};

View File

@@ -21,15 +21,15 @@ CDLootMatrixTable::CDLootMatrixTable(void) {
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM LootMatrix");
while (!tableData.eof()) {
CDLootMatrix entry;
entry.LootMatrixIndex = tableData.getIntField("LootMatrixIndex", -1);
entry.LootTableIndex = tableData.getIntField("LootTableIndex", -1);
entry.RarityTableIndex = tableData.getIntField("RarityTableIndex", -1);
entry.percent = tableData.getFloatField("percent", -1.0f);
entry.minToDrop = tableData.getIntField("minToDrop", -1);
entry.maxToDrop = tableData.getIntField("maxToDrop", -1);
entry.id = tableData.getIntField("id", -1);
entry.flagID = tableData.getIntField("flagID", -1);
UNUSED(entry.gate_version = tableData.getStringField("gate_version", ""));
entry.LootMatrixIndex = tableData.getIntField(0, -1);
entry.LootTableIndex = tableData.getIntField(1, -1);
entry.RarityTableIndex = tableData.getIntField(2, -1);
entry.percent = tableData.getFloatField(3, -1.0f);
entry.minToDrop = tableData.getIntField(4, -1);
entry.maxToDrop = tableData.getIntField(5, -1);
entry.id = tableData.getIntField(6, -1);
entry.flagID = tableData.getIntField(7, -1);
UNUSED(entry.gate_version = tableData.getStringField(8, ""));
this->entries.push_back(entry);
tableData.nextRow();
@@ -38,6 +38,15 @@ CDLootMatrixTable::CDLootMatrixTable(void) {
tableData.finalize();
}
//! Destructor
CDLootMatrixTable::~CDLootMatrixTable(void) {}
//! Returns the table's name
std::string CDLootMatrixTable::GetName(void) const {
return "LootMatrix";
}
//! Queries the table with a custom "where" clause
std::vector<CDLootMatrix> CDLootMatrixTable::Query(std::function<bool(CDLootMatrix)> predicate) {
std::vector<CDLootMatrix> data = cpplinq::from(this->entries)
@@ -47,7 +56,7 @@ std::vector<CDLootMatrix> CDLootMatrixTable::Query(std::function<bool(CDLootMatr
return data;
}
//! Gets all the entries in the table
const std::vector<CDLootMatrix>& CDLootMatrixTable::GetEntries(void) const {
return this->entries;
}

View File

@@ -3,6 +3,12 @@
// Custom Classes
#include "CDTable.h"
/*!
\file CDLootMatrixTable.hpp
\brief Contains data for the ObjectSkills table
*/
//! LootMatrix Struct
struct CDLootMatrix {
unsigned int LootMatrixIndex; //!< The Loot Matrix Index
unsigned int LootTableIndex; //!< The Loot Table Index
@@ -15,15 +21,36 @@ struct CDLootMatrix {
UNUSED(std::string gate_version); //!< The Gate Version
};
class CDLootMatrixTable : public CDTable<CDLootMatrixTable> {
//! MissionNPCComponent table
class CDLootMatrixTable : public CDTable {
private:
std::vector<CDLootMatrix> entries;
public:
CDLootMatrixTable();
// Queries the table with a custom "where" clause
//! Constructor
CDLootMatrixTable(void);
//! Destructor
~CDLootMatrixTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
std::vector<CDLootMatrix> Query(std::function<bool(CDLootMatrix)> predicate);
//! Gets all the entries in the table
/*!
\return The entries
*/
const std::vector<CDLootMatrix>& GetEntries(void) const;
};

View File

@@ -21,12 +21,12 @@ CDLootTableTable::CDLootTableTable(void) {
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM LootTable");
while (!tableData.eof()) {
CDLootTable entry;
entry.id = tableData.getIntField("id", -1);
entry.itemid = tableData.getIntField("itemid", -1);
entry.LootTableIndex = tableData.getIntField("LootTableIndex", -1);
entry.id = tableData.getIntField("id", -1);
entry.MissionDrop = tableData.getIntField("MissionDrop", -1) == 1 ? true : false;
entry.sortPriority = tableData.getIntField("sortPriority", -1);
entry.id = tableData.getIntField(0, -1);
entry.itemid = tableData.getIntField(0, -1);
entry.LootTableIndex = tableData.getIntField(1, -1);
entry.id = tableData.getIntField(2, -1);
entry.MissionDrop = tableData.getIntField(3, -1) == 1 ? true : false;
entry.sortPriority = tableData.getIntField(4, -1);
this->entries.push_back(entry);
tableData.nextRow();
@@ -35,6 +35,14 @@ CDLootTableTable::CDLootTableTable(void) {
tableData.finalize();
}
//! Destructor
CDLootTableTable::~CDLootTableTable(void) {}
//! Returns the table's name
std::string CDLootTableTable::GetName(void) const {
return "LootTable";
}
//! Queries the table with a custom "where" clause
std::vector<CDLootTable> CDLootTableTable::Query(std::function<bool(CDLootTable)> predicate) {
@@ -49,4 +57,3 @@ std::vector<CDLootTable> CDLootTableTable::Query(std::function<bool(CDLootTable)
const std::vector<CDLootTable>& CDLootTableTable::GetEntries(void) const {
return this->entries;
}

View File

@@ -3,6 +3,12 @@
// Custom Classes
#include "CDTable.h"
/*!
\file CDLootTableTable.hpp
\brief Contains data for the LootTable table
*/
//! LootTable Struct
struct CDLootTable {
unsigned int itemid; //!< The LOT of the item
unsigned int LootTableIndex; //!< The Loot Table Index
@@ -11,15 +17,36 @@ struct CDLootTable {
unsigned int sortPriority; //!< The sorting priority
};
class CDLootTableTable : public CDTable<CDLootTableTable> {
//! LootTable table
class CDLootTableTable : public CDTable {
private:
std::vector<CDLootTable> entries;
public:
CDLootTableTable();
// Queries the table with a custom "where" clause
//! Constructor
CDLootTableTable(void);
//! Destructor
~CDLootTableTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
std::vector<CDLootTable> Query(std::function<bool(CDLootTable)> predicate);
//! Gets all the entries in the table
/*!
\return The entries
*/
const std::vector<CDLootTable>& GetEntries(void) const;
};

View File

@@ -21,14 +21,14 @@ CDMissionEmailTable::CDMissionEmailTable(void) {
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM MissionEmail");
while (!tableData.eof()) {
CDMissionEmail entry;
entry.ID = tableData.getIntField("ID", -1);
entry.messageType = tableData.getIntField("messageType", -1);
entry.notificationGroup = tableData.getIntField("notificationGroup", -1);
entry.missionID = tableData.getIntField("missionID", -1);
entry.attachmentLOT = tableData.getIntField("attachmentLOT", 0);
entry.localize = (bool)tableData.getIntField("localize", -1);
entry.locStatus = tableData.getIntField("locStatus", -1);
entry.gate_version = tableData.getStringField("gate_version", "");
entry.ID = tableData.getIntField(0, -1);
entry.messageType = tableData.getIntField(1, -1);
entry.notificationGroup = tableData.getIntField(2, -1);
entry.missionID = tableData.getIntField(3, -1);
entry.attachmentLOT = tableData.getIntField(4, 0);
entry.localize = (bool)tableData.getIntField(5, -1);
entry.locStatus = tableData.getIntField(6, -1);
entry.gate_version = tableData.getStringField(7, "");
this->entries.push_back(entry);
tableData.nextRow();
@@ -37,6 +37,14 @@ CDMissionEmailTable::CDMissionEmailTable(void) {
tableData.finalize();
}
//! Destructor
CDMissionEmailTable::~CDMissionEmailTable(void) {}
//! Returns the table's name
std::string CDMissionEmailTable::GetName(void) const {
return "MissionEmail";
}
//! Queries the table with a custom "where" clause
std::vector<CDMissionEmail> CDMissionEmailTable::Query(std::function<bool(CDMissionEmail)> predicate) {
@@ -51,4 +59,3 @@ std::vector<CDMissionEmail> CDMissionEmailTable::Query(std::function<bool(CDMiss
std::vector<CDMissionEmail> CDMissionEmailTable::GetEntries(void) const {
return this->entries;
}

View File

@@ -3,6 +3,12 @@
// Custom Classes
#include "CDTable.h"
/*!
\file CDMissionEmailTable.hpp
\brief Contains data for the MissionEmail table
*/
//! MissionEmail Entry Struct
struct CDMissionEmail {
unsigned int ID;
unsigned int messageType;
@@ -15,14 +21,35 @@ struct CDMissionEmail {
};
class CDMissionEmailTable : public CDTable<CDMissionEmailTable> {
//! MissionEmail table
class CDMissionEmailTable : public CDTable {
private:
std::vector<CDMissionEmail> entries;
public:
CDMissionEmailTable();
// Queries the table with a custom "where" clause
//! Constructor
CDMissionEmailTable(void);
//! Destructor
~CDMissionEmailTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
std::vector<CDMissionEmail> Query(std::function<bool(CDMissionEmail)> predicate);
//! Gets all the entries in the table
/*!
\return The entries
*/
std::vector<CDMissionEmail> GetEntries(void) const;
};

View File

@@ -21,11 +21,11 @@ CDMissionNPCComponentTable::CDMissionNPCComponentTable(void) {
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM MissionNPCComponent");
while (!tableData.eof()) {
CDMissionNPCComponent entry;
entry.id = tableData.getIntField("id", -1);
entry.missionID = tableData.getIntField("missionID", -1);
entry.offersMission = tableData.getIntField("offersMission", -1) == 1 ? true : false;
entry.acceptsMission = tableData.getIntField("acceptsMission", -1) == 1 ? true : false;
entry.gate_version = tableData.getStringField("gate_version", "");
entry.id = tableData.getIntField(0, -1);
entry.missionID = tableData.getIntField(1, -1);
entry.offersMission = tableData.getIntField(2, -1) == 1 ? true : false;
entry.acceptsMission = tableData.getIntField(3, -1) == 1 ? true : false;
entry.gate_version = tableData.getStringField(4, "");
this->entries.push_back(entry);
tableData.nextRow();
@@ -34,6 +34,14 @@ CDMissionNPCComponentTable::CDMissionNPCComponentTable(void) {
tableData.finalize();
}
//! Destructor
CDMissionNPCComponentTable::~CDMissionNPCComponentTable(void) {}
//! Returns the table's name
std::string CDMissionNPCComponentTable::GetName(void) const {
return "MissionNPCComponent";
}
//! Queries the table with a custom "where" clause
std::vector<CDMissionNPCComponent> CDMissionNPCComponentTable::Query(std::function<bool(CDMissionNPCComponent)> predicate) {
@@ -48,4 +56,3 @@ std::vector<CDMissionNPCComponent> CDMissionNPCComponentTable::Query(std::functi
std::vector<CDMissionNPCComponent> CDMissionNPCComponentTable::GetEntries(void) const {
return this->entries;
}

View File

@@ -3,6 +3,12 @@
// Custom Classes
#include "CDTable.h"
/*!
\file CDMissionNPCComponentTable.hpp
\brief Contains data for the ObjectSkills table
*/
//! MissionNPCComponent Struct
struct CDMissionNPCComponent {
unsigned int id; //!< The ID
unsigned int missionID; //!< The Mission ID
@@ -11,16 +17,35 @@ struct CDMissionNPCComponent {
std::string gate_version; //!< The gate version
};
class CDMissionNPCComponentTable : public CDTable<CDMissionNPCComponentTable> {
//! MissionNPCComponent table
class CDMissionNPCComponentTable : public CDTable {
private:
std::vector<CDMissionNPCComponent> entries;
public:
CDMissionNPCComponentTable();
// Queries the table with a custom "where" clause
//! Constructor
CDMissionNPCComponentTable(void);
//! Destructor
~CDMissionNPCComponentTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
std::vector<CDMissionNPCComponent> Query(std::function<bool(CDMissionNPCComponent)> predicate);
// Gets all the entries in the table
//! Gets all the entries in the table
/*!
\return The entries
*/
std::vector<CDMissionNPCComponent> GetEntries(void) const;
};

View File

@@ -21,19 +21,19 @@ CDMissionTasksTable::CDMissionTasksTable(void) {
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM MissionTasks");
while (!tableData.eof()) {
CDMissionTasks entry;
entry.id = tableData.getIntField("id", -1);
UNUSED(entry.locStatus = tableData.getIntField("locStatus", -1));
entry.taskType = tableData.getIntField("taskType", -1);
entry.target = tableData.getIntField("target", -1);
entry.targetGroup = tableData.getStringField("targetGroup", "");
entry.targetValue = tableData.getIntField("targetValue", -1);
entry.taskParam1 = tableData.getStringField("taskParam1", "");
UNUSED(entry.largeTaskIcon = tableData.getStringField("largeTaskIcon", ""));
UNUSED(entry.IconID = tableData.getIntField("IconID", -1));
entry.uid = tableData.getIntField("uid", -1);
UNUSED(entry.largeTaskIconID = tableData.getIntField("largeTaskIconID", -1));
UNUSED(entry.localize = tableData.getIntField("localize", -1) == 1 ? true : false);
UNUSED(entry.gate_version = tableData.getStringField("gate_version", ""));
entry.id = tableData.getIntField(0, -1);
UNUSED(entry.locStatus = tableData.getIntField(1, -1));
entry.taskType = tableData.getIntField(2, -1);
entry.target = tableData.getIntField(3, -1);
entry.targetGroup = tableData.getStringField(4, "");
entry.targetValue = tableData.getIntField(5, -1);
entry.taskParam1 = tableData.getStringField(6, "");
UNUSED(entry.largeTaskIcon = tableData.getStringField(7, ""));
UNUSED(entry.IconID = tableData.getIntField(8, -1));
entry.uid = tableData.getIntField(9, -1);
UNUSED(entry.largeTaskIconID = tableData.getIntField(10, -1));
UNUSED(entry.localize = tableData.getIntField(11, -1) == 1 ? true : false);
UNUSED(entry.gate_version = tableData.getStringField(12, ""));
this->entries.push_back(entry);
tableData.nextRow();
@@ -42,6 +42,15 @@ CDMissionTasksTable::CDMissionTasksTable(void) {
tableData.finalize();
}
//! Destructor
CDMissionTasksTable::~CDMissionTasksTable(void) {}
//! Returns the table's name
std::string CDMissionTasksTable::GetName(void) const {
return "MissionTasks";
}
//! Queries the table with a custom "where" clause
std::vector<CDMissionTasks> CDMissionTasksTable::Query(std::function<bool(CDMissionTasks)> predicate) {
std::vector<CDMissionTasks> data = cpplinq::from(this->entries)
@@ -65,7 +74,7 @@ std::vector<CDMissionTasks*> CDMissionTasksTable::GetByMissionID(uint32_t missio
return tasks;
}
//! Gets all the entries in the table
const std::vector<CDMissionTasks>& CDMissionTasksTable::GetEntries(void) const {
return this->entries;
}

View File

@@ -3,6 +3,12 @@
// Custom Classes
#include "CDTable.h"
/*!
\file CDMissionTasksTable.hpp
\brief Contains data for the MissionTasks table
*/
//! ObjectSkills Struct
struct CDMissionTasks {
unsigned int id; //!< The Mission ID that the task belongs to
UNUSED(unsigned int locStatus); //!< ???
@@ -19,17 +25,37 @@ struct CDMissionTasks {
UNUSED(std::string gate_version); //!< ???
};
class CDMissionTasksTable : public CDTable<CDMissionTasksTable> {
//! ObjectSkills table
class CDMissionTasksTable : public CDTable {
private:
std::vector<CDMissionTasks> entries;
public:
CDMissionTasksTable();
// Queries the table with a custom "where" clause
//! Constructor
CDMissionTasksTable(void);
//! Destructor
~CDMissionTasksTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
std::vector<CDMissionTasks> Query(std::function<bool(CDMissionTasks)> predicate);
std::vector<CDMissionTasks*> GetByMissionID(uint32_t missionID);
//! Gets all the entries in the table
/*!
\return The entries
*/
const std::vector<CDMissionTasks>& GetEntries(void) const;
};

View File

@@ -23,58 +23,58 @@ CDMissionsTable::CDMissionsTable(void) {
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM Missions");
while (!tableData.eof()) {
CDMissions entry;
entry.id = tableData.getIntField("id", -1);
entry.defined_type = tableData.getStringField("defined_type", "");
entry.defined_subtype = tableData.getStringField("defined_subtype", "");
entry.UISortOrder = tableData.getIntField("UISortOrder", -1);
entry.offer_objectID = tableData.getIntField("offer_objectID", -1);
entry.target_objectID = tableData.getIntField("target_objectID", -1);
entry.reward_currency = tableData.getInt64Field("reward_currency", -1);
entry.LegoScore = tableData.getIntField("LegoScore", -1);
entry.reward_reputation = tableData.getIntField("reward_reputation", -1);
entry.isChoiceReward = tableData.getIntField("isChoiceReward", -1) == 1 ? true : false;
entry.reward_item1 = tableData.getIntField("reward_item1", 0);
entry.reward_item1_count = tableData.getIntField("reward_item1_count", 0);
entry.reward_item2 = tableData.getIntField("reward_item2", 0);
entry.reward_item2_count = tableData.getIntField("reward_item2_count", 0);
entry.reward_item3 = tableData.getIntField("reward_item3", 0);
entry.reward_item3_count = tableData.getIntField("reward_item3_count", 0);
entry.reward_item4 = tableData.getIntField("reward_item4", 0);
entry.reward_item4_count = tableData.getIntField("reward_item4_count", 0);
entry.reward_emote = tableData.getIntField("reward_emote", -1);
entry.reward_emote2 = tableData.getIntField("reward_emote2", -1);
entry.reward_emote3 = tableData.getIntField("reward_emote3", -1);
entry.reward_emote4 = tableData.getIntField("reward_emote4", -1);
entry.reward_maximagination = tableData.getIntField("reward_maximagination", -1);
entry.reward_maxhealth = tableData.getIntField("reward_maxhealth", -1);
entry.reward_maxinventory = tableData.getIntField("reward_maxinventory", -1);
entry.reward_maxmodel = tableData.getIntField("reward_maxmodel", -1);
entry.reward_maxwidget = tableData.getIntField("reward_maxwidget", -1);
entry.reward_maxwallet = tableData.getIntField("reward_maxwallet", -1);
entry.repeatable = tableData.getIntField("repeatable", -1) == 1 ? true : false;
entry.reward_currency_repeatable = tableData.getIntField("reward_currency_repeatable", -1);
entry.reward_item1_repeatable = tableData.getIntField("reward_item1_repeatable", -1);
entry.reward_item1_repeat_count = tableData.getIntField("reward_item1_repeat_count", -1);
entry.reward_item2_repeatable = tableData.getIntField("reward_item2_repeatable", -1);
entry.reward_item2_repeat_count = tableData.getIntField("reward_item2_repeat_count", -1);
entry.reward_item3_repeatable = tableData.getIntField("reward_item3_repeatable", -1);
entry.reward_item3_repeat_count = tableData.getIntField("reward_item3_repeat_count", -1);
entry.reward_item4_repeatable = tableData.getIntField("reward_item4_repeatable", -1);
entry.reward_item4_repeat_count = tableData.getIntField("reward_item4_repeat_count", -1);
entry.time_limit = tableData.getIntField("time_limit", -1);
entry.isMission = tableData.getIntField("isMission", -1) ? true : false;
entry.missionIconID = tableData.getIntField("missionIconID", -1);
entry.prereqMissionID = tableData.getStringField("prereqMissionID", "");
entry.localize = tableData.getIntField("localize", -1) == 1 ? true : false;
entry.inMOTD = tableData.getIntField("inMOTD", -1) == 1 ? true : false;
entry.cooldownTime = tableData.getInt64Field("cooldownTime", -1);
entry.isRandom = tableData.getIntField("isRandom", -1) == 1 ? true : false;
entry.randomPool = tableData.getStringField("randomPool", "");
entry.UIPrereqID = tableData.getIntField("UIPrereqID", -1);
UNUSED(entry.gate_version = tableData.getStringField("gate_version", ""));
UNUSED(entry.HUDStates = tableData.getStringField("HUDStates", ""));
UNUSED(entry.locStatus = tableData.getIntField("locStatus", -1));
entry.reward_bankinventory = tableData.getIntField("reward_bankinventory", -1);
entry.id = tableData.getIntField(0, -1);
entry.defined_type = tableData.getStringField(1, "");
entry.defined_subtype = tableData.getStringField(2, "");
entry.UISortOrder = tableData.getIntField(3, -1);
entry.offer_objectID = tableData.getIntField(4, -1);
entry.target_objectID = tableData.getIntField(5, -1);
entry.reward_currency = tableData.getInt64Field(6, -1);
entry.LegoScore = tableData.getIntField(7, -1);
entry.reward_reputation = tableData.getIntField(8, -1);
entry.isChoiceReward = tableData.getIntField(9, -1) == 1 ? true : false;
entry.reward_item1 = tableData.getIntField(10, 0);
entry.reward_item1_count = tableData.getIntField(11, 0);
entry.reward_item2 = tableData.getIntField(12, 0);
entry.reward_item2_count = tableData.getIntField(13, 0);
entry.reward_item3 = tableData.getIntField(14, 0);
entry.reward_item3_count = tableData.getIntField(15, 0);
entry.reward_item4 = tableData.getIntField(16, 0);
entry.reward_item4_count = tableData.getIntField(17, 0);
entry.reward_emote = tableData.getIntField(18, -1);
entry.reward_emote2 = tableData.getIntField(19, -1);
entry.reward_emote3 = tableData.getIntField(20, -1);
entry.reward_emote4 = tableData.getIntField(21, -1);
entry.reward_maximagination = tableData.getIntField(22, -1);
entry.reward_maxhealth = tableData.getIntField(23, -1);
entry.reward_maxinventory = tableData.getIntField(24, -1);
entry.reward_maxmodel = tableData.getIntField(25, -1);
entry.reward_maxwidget = tableData.getIntField(26, -1);
entry.reward_maxwallet = tableData.getIntField(27, -1);
entry.repeatable = tableData.getIntField(28, -1) == 1 ? true : false;
entry.reward_currency_repeatable = tableData.getIntField(29, -1);
entry.reward_item1_repeatable = tableData.getIntField(30, -1);
entry.reward_item1_repeat_count = tableData.getIntField(31, -1);
entry.reward_item2_repeatable = tableData.getIntField(32, -1);
entry.reward_item2_repeat_count = tableData.getIntField(33, -1);
entry.reward_item3_repeatable = tableData.getIntField(34, -1);
entry.reward_item3_repeat_count = tableData.getIntField(35, -1);
entry.reward_item4_repeatable = tableData.getIntField(36, -1);
entry.reward_item4_repeat_count = tableData.getIntField(37, -1);
entry.time_limit = tableData.getIntField(38, -1);
entry.isMission = tableData.getIntField(39, -1) ? true : false;
entry.missionIconID = tableData.getIntField(40, -1);
entry.prereqMissionID = tableData.getStringField(41, "");
entry.localize = tableData.getIntField(42, -1) == 1 ? true : false;
entry.inMOTD = tableData.getIntField(43, -1) == 1 ? true : false;
entry.cooldownTime = tableData.getInt64Field(44, -1);
entry.isRandom = tableData.getIntField(45, -1) == 1 ? true : false;
entry.randomPool = tableData.getStringField(46, "");
entry.UIPrereqID = tableData.getIntField(47, -1);
UNUSED(entry.gate_version = tableData.getStringField(48, ""));
UNUSED(entry.HUDStates = tableData.getStringField(49, ""));
UNUSED(entry.locStatus = tableData.getIntField(50, -1));
entry.reward_bankinventory = tableData.getIntField(51, -1);
this->entries.push_back(entry);
tableData.nextRow();
@@ -85,6 +85,15 @@ CDMissionsTable::CDMissionsTable(void) {
Default.id = -1;
}
//! Destructor
CDMissionsTable::~CDMissionsTable(void) {}
//! Returns the table's name
std::string CDMissionsTable::GetName(void) const {
return "Missions";
}
//! Queries the table with a custom "where" clause
std::vector<CDMissions> CDMissionsTable::Query(std::function<bool(CDMissions)> predicate) {
std::vector<CDMissions> data = cpplinq::from(this->entries)
@@ -94,6 +103,7 @@ std::vector<CDMissions> CDMissionsTable::Query(std::function<bool(CDMissions)> p
return data;
}
//! Gets all the entries in the table
const std::vector<CDMissions>& CDMissionsTable::GetEntries(void) const {
return this->entries;
}
@@ -121,4 +131,3 @@ const CDMissions& CDMissionsTable::GetByMissionID(uint32_t missionID, bool& foun
return Default;
}

Some files were not shown because too many files have changed in this diff Show More