1
0
forked from metin2/server

1 Commits

Author SHA1 Message Date
418ecc5c24 change line endings to LF for .py files
Changed line endings from CRLF to LF for all .py files to solve issues with pre_qc.py and other potential problems on windows
2024-07-11 10:03:57 +03:00
1293 changed files with 38930 additions and 22939 deletions

View File

@ -10,12 +10,9 @@ Dockerfile
.gitkeep
# Compiled quests
gamefiles/data/quest/object/
gamefiles/data/quest/pre_qc/
gamefiles/data/quest/qc
gamefiles/locale/english/quest/object/
gamefiles/locale/english/quest/pre_qc/
gamefiles/locale/english/quest/qc
# Test folder
test/
# Built files
build/
test/

1
.gitattributes vendored
View File

@ -2,6 +2,7 @@
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto
*.py eol=lf
###############################################################################
# Set default behavior for command prompt diff.

6
.idea/encodings.xml generated Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="PROJECT" charset="EUC-KR" />
</component>
</project>

View File

@ -1,3 +0,0 @@
{
"cmake.configureOnOpen": true
}

View File

@ -1,15 +1,10 @@
FROM ubuntu:22.04 as build
WORKDIR /app
# Set up the CMake repository
RUN apt-get update && apt-get install -y ca-certificates gpg wget
RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null
RUN echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ jammy main' | tee /etc/apt/sources.list.d/kitware.list >/dev/null
# Update the system and install various dependencies
RUN apt-get update && \
apt-get install -y git cmake ninja-build build-essential tar curl zip unzip pkg-config autoconf python3 \
libdevil-dev libncurses5-dev libbsd-dev
libdevil-dev libncurses5-dev libbsd-dev
# Arm specific
ENV VCPKG_FORCE_SYSTEM_BINARIES=1
@ -17,7 +12,7 @@ ENV VCPKG_FORCE_SYSTEM_BINARIES=1
# Install vcpkg and the required libraries
RUN git clone https://github.com/Microsoft/vcpkg.git
RUN bash ./vcpkg/bootstrap-vcpkg.sh
RUN ./vcpkg/vcpkg install boost-system cryptopp effolkronium-random libmysql libevent lzo fmt spdlog argon2
RUN ./vcpkg/vcpkg install boost-system cryptopp effolkronium-random libmysql libevent lzo fmt spdlog
COPY . .
@ -29,7 +24,7 @@ RUN cd build && make -j $(nproc)
FROM ubuntu:22.04 as app
WORKDIR /app
RUN apt-get update && apt-get install -y gettext python2 libdevil-dev libbsd-dev && apt-get clean
RUN apt-get update && apt-get install -y python2 libdevil-dev libbsd-dev && apt-get clean
# Copy the binaries from the build stage
COPY --from=build /app/build/src/db/db /bin/db
@ -39,11 +34,8 @@ COPY --from=build /app/build/src/quest/qc /bin/qc
# Copy the game files
COPY ./gamefiles/ .
# Copy the auxiliary files
COPY ./docker/ .
# Compile the quests
RUN cd /app/data/quest && python2 make.py
RUN cd /app/locale/english/quest && python2 make.py
# Symlink the configuration files
RUN ln -s "./conf/CMD" "CMD"
@ -51,9 +43,3 @@ RUN ln -s ./conf/item_names_en.txt item_names.txt
RUN ln -s ./conf/item_proto.txt item_proto.txt
RUN ln -s ./conf/mob_names_en.txt mob_names.txt
RUN ln -s ./conf/mob_proto.txt mob_proto.txt
# Set up default environment variables
ENV PUBLIC_BIND_IP 0.0.0.0
ENV INTERNAL_BIND_IP 0.0.0.0
ENTRYPOINT ["/usr/bin/bash", "docker-entrypoint.sh"]

View File

@ -35,11 +35,11 @@ Also install DevIL (1.7.8) and the BSD compatibility library:
apt-get install -y libdevil-dev libbsd-dev
```
Install `vcpkg` according to the [latest instructions](https://vcpkg.io/en/getting-started.html).
Install `vcpkg` according to the [lastest instructions](https://vcpkg.io/en/getting-started.html).
Build and install the required libraries:
```shell
vcpkg install boost-system cryptopp effolkronium-random libmysql libevent lzo fmt spdlog argon2
vcpkg install boost-system cryptopp effolkronium-random libmysql libevent lzo fmt spdlog
```
Then, it's time to build your binaries. Your commands should look along the lines of:
@ -79,9 +79,8 @@ goodies you wish. Also, a lot of time.
- Removed unused functionalities (time bombs, activation servers, other Korean stuff)
- Switched to the [effolkronium/random PRNG](https://github.com/effolkronium/random) instead of the standard C functions.
- Refactored macros to modern C++ functions.
- Network settings are manually configurable through the `PUBLIC_IP`, `PUBLIC_BIND_IP`, `INTERNAL_IP`, `INTERNAL_BIND_IP` settings in the `game.conf` file. (Might need further work)
- Network settings are manually configurable through the `PUBLIC_IP`, `PUBLIC_BIND_IP`, `INTERNAL_IP`, `INTERNAL_BIND_IP` settings in the `CONFIG` file. (Might need further work)
- Refactored logging to use [spdlog](https://github.com/gabime/spdlog) for more consistent function calls.
- Refactored login code to use Argon2ID.
## 4. Bugfixes
**WARNING: This project is based on the "kraizy" leak. That was over 10 years ago.
@ -102,7 +101,7 @@ This is a very serious security risk and one of the reasons this project is stil
- Fixed buffer overruns and integer overflows in SQL queries.
## 5. Further plans
- Migrate `db.conf` and `game.conf` to a modern dotenv-like format, which would enable pretty nice Docker images.
- Migrate `conf.txt` and `CONFIG` to a modern dotenv-like format, which would enable pretty nice Docker images.
- Add a health check to the Docker image.
- Use the [fmt](https://fmt.dev/latest/index.html) library for safe and modern string formatting.
- Handle kernel signals (SIGTERM, SIGHUP etc.) for gracefully shutting down the game server.

View File

@ -1,18 +0,0 @@
WELCOME_MSG = "DB Server has been started"
SQL_ACCOUNT = "${MYSQL_HOST} ${MYSQL_DB_ACCOUNT} ${MYSQL_USER} ${MYSQL_PASSWORD} ${MYSQL_PORT}"
SQL_COMMON = "${MYSQL_HOST} ${MYSQL_DB_COMMON} ${MYSQL_USER} ${MYSQL_PASSWORD} ${MYSQL_PORT}"
SQL_PLAYER = "${MYSQL_HOST} ${MYSQL_DB_PLAYER} ${MYSQL_USER} ${MYSQL_PASSWORD} ${MYSQL_PORT}"
TABLE_POSTFIX = ""
BIND_PORT = ${DB_PORT}
DB_SLEEP_MSEC = 10
CLIENT_HEART_FPS = 10
HASH_PLAYER_LIFE_SEC = 600
BACKUP_LIMIT_SEC = 3600
PLAYER_ID_START = 100
PLAYER_DELETE_LEVEL_LIMIT = 70
ITEM_ID_RANGE = 10000001 20000000
TEST_SERVER = ${TEST_SERVER}

View File

@ -1,41 +0,0 @@
HOSTNAME: ${GAME_HOSTNAME}
CHANNEL: ${GAME_CHANNEL}
PUBLIC_IP: ${PUBLIC_IP}
PUBLIC_BIND_IP: ${PUBLIC_BIND_IP}
INTERNAL_IP: ${INTERNAL_IP}
INTERNAL_BIND_IP: ${INTERNAL_BIND_IP}
PORT: ${GAME_PORT}
P2P_PORT: ${GAME_P2P_PORT}
DB_ADDR: ${DB_ADDR}
DB_PORT: ${DB_PORT}
COMMON_SQL: ${MYSQL_HOST} ${MYSQL_USER} ${MYSQL_PASSWORD} ${MYSQL_DB_COMMON} ${MYSQL_PORT}
LOG_SQL: ${MYSQL_HOST} ${MYSQL_USER} ${MYSQL_PASSWORD} ${MYSQL_DB_LOG} ${MYSQL_PORT}
PLAYER_SQL: ${MYSQL_HOST} ${MYSQL_USER} ${MYSQL_PASSWORD} ${MYSQL_DB_PLAYER} ${MYSQL_PORT}
TABLE_POSTFIX:
AUTH_SERVER: ${GAME_AUTH_SERVER}
MARK_SERVER: ${GAME_MARK_SERVER}
MAP_ALLOW: ${GAME_MAP_ALLOW}
MAX_LEVEL: ${GAME_MAX_LEVEL}
PK_PROTECT_LEVEL: 15
SPAM_BLOCK_MAX_LEVEL: 90
GOLD_DROP_LIMIT_TIME: 10
MALL_URL: ${GAME_MALL_URL}
CHECK_MULTIHACK: 0
SPEEDHACK_LIMIT_COUNT: 300
SPEEDHACK_LIMIT_BONUS: 80
ADMINPAGE_IP: 127.0.0.1
ADMINPAGE_PASSWORD: metin2adminpass
PASSES_PER_SEC: 25
SAVE_EVENT_SECOND_CYCLE: 180
PING_EVENT_SECOND_CYCLE: 180
VIEW_RANGE: 8000
TEST_SERVER: ${TEST_SERVER}

View File

@ -1,9 +0,0 @@
#!/bin/sh
# docker-entrypoint.sh
# Generate configuration files based on environment variables
envsubst <"/app/conf/db.conf.tmpl" >"/app/db.conf"
envsubst <"/app/conf/game.conf.tmpl" >"/app/game.conf"
# Run the standard container command.
exec "$@"

View File

@ -41,6 +41,8 @@ tstr IMPLEMENTOR
tint IMPLEMENTOR
tcon IMPLEMENTOR
mob_ld IMPLEMENTOR
pcbang_check IMPLEMENTOR
pcbang_update IMPLEMENTOR
setqf IMPLEMENTOR
delqf IMPLEMENTOR
effect IMPLEMENTOR

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

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