# MualaniImpact
### Current game version: 5.0.0
![screenshot](https://git.xeondev.com/ReversedRooms/MualaniImpact/raw/branch/master/screenshot.png)
## What
**MualaniImpact** is an **open-source project reverse-engineering Genshin Impact server binaries**. This means that all logic and architecture code is being reimplemented according to decompiled pseudocode of official servers.
## How
The original server binaries are written in C++. This project aims to rewrite them in rust. Because of that, some implementation details may be different (due to rust ownership model and so on).
We also use PostgreSQL instead of MySQL that is used by miHoYo.
## Implemented services
- Dispatch
- Gateserver
- Dbgate
- Gameserver (work-in-progress)
- SDKServer (not part of game-specific services, but required for authentification, emulates miHoYo account API)
## Getting started
#### Requirements:
- [Rust](https://www.rust-lang.org/tools/install)
- [PostgreSQL](https://www.postgresql.org/download/)
- [Redis](https://redis.io/downloads/)
##### NOTE: if you are using MS Windows, use [this version of Redis](https://github.com/tporadowski/redis/releases)
### Setup
#### Server
##### a) building from sources
```
git clone https://git.xeondev.com/ReversedRooms/MualaniImpact.git
cd MualaniImpact
cargo run --bin sdkserver
cargo run --bin dispatch
cargo run --bin dbgate
cargo run --bin gateserver
cargo run --bin gameserver
```
##### b) using pre-built binaries
Navigate to the [Releases](https://git.xeondev.com/ReversedRooms/MualaniImpact/releases)
page and download the latest release for your platform.
Launch all services: `sdkserver`, `dispatch`, `dbgate`, `gateserver`, `gameserver`
##### NOTE: you don't have to install Rust if you're going to use pre-built binaries, although the preferred way is building from sources.
We don't provide support for pre-built binaries.
#### Configuration
You should configure each service using their own config files. They're being created in current working directory upon first startup.
##### Database section
You have to specify connection strings for **PostgreSQL** (`connection_string`) and **Redis** (`redis_url`)
```
[database]
connection_string = "postgres://postgres:@localhost:5432/hk4e"
redis_url = "redis://127.0.0.1/"
```
##### Application entries
If you're going to host all services locally, you don't have to modify anything here.
If you're deploying services on different machines, you have to configure their `inner_ip`.
Every service should have its own unique `app_id`
Example of application entry for `Gateserver`:
```
[[applications.Gateserver]]
app_id = 2
inner_ip = "127.0.0.1:22002"
```
##### NOTE: the top most `app_id` line (before application entries) specifies `app_id` of current service.
#### Data
The data files: TSV tables (`data/txt`) and JSON configs (`data/json`) are included in this repository. Keep in mind that you need to have the `data` subdirectory in current working directory.
#### Connecting
You have to download client of **current supported game version** (at this moment it's 5.0.0, you can [get it here](https://git.xeondev.com/YYHEggEgg/GI-Download-Library/src/branch/main/GenshinImpact/Client/5.0.0.md)), and apply the [encryption patch](https://git.xeondev.com/reversedrooms/hk4e-patch/releases).
##### NOTE: once you got all services up and running, you have to create game account.
By default, you can do so at http://127.0.0.1:21000/account/register
### Troubleshooting
[Visit our discord](https://discord.gg/reversedrooms) if you have any questions/issues
### Support
If you want to support this project, feel free to [send a tip via boosty](https://boosty.to/xeondev/donate)