80 Commits

Author SHA1 Message Date
170be95dc5 Configuration files are automatically generated based on env variables in the Docker image 2024-06-02 21:45:51 +03:00
6d65fae7e4 Argon2ID improvements 2024-06-01 14:34:27 +03:00
8ed1e7879e Merge pull request 'Use Argon2ID as the password hashing algorithm' (#26) from WildEgo/server:master into nightly
Reviewed-on: #26
2024-06-01 14:32:21 +03:00
65a81ec4a1 change: Ignore build files, replace mysql password with Argon2.
add: Missing .gitignore.
2024-05-31 10:49:21 +01:00
ae708d9315 Merge pull request 'nightly' (#2) from metin2/server:nightly into master
Reviewed-on: WildEgo/server#2
2024-05-30 22:43:22 +03:00
48ee253534 Restructured gamefiles, locale data loading refactoring, docker build fixes 2024-05-25 20:00:26 +03:00
27108d629a Merge pull request 'Merge changes from master' (#25) from master into nightly
Reviewed-on: #25
2024-05-25 17:55:22 +03:00
6616009e92 Merge pull request 'Pin Dockerfile Ubuntu version.' (#24) from halil/server:master into master
Reviewed-on: #24
2024-05-01 07:57:36 +03:00
1ada609020 Pin Dockerfile Ubuntu version. 2024-05-01 01:10:02 +03:00
21e028f186 Merge pull request 'nightly' (#1) from metin2/server:nightly into master
Reviewed-on: WildEgo/server#1
2024-04-23 13:17:19 +03:00
175816c81d Merge pull request 'Default all localized behavior to European logic' (#22) from Tr0n/server:localization/default-gf-eu into nightly
Reviewed-on: #22
2024-04-09 21:47:22 +03:00
b15eb7f3fe fix: wrong delay used for item drop despawn. 2024-04-09 20:33:14 +02:00
3a8d9e38e8 remove duplicate variable definition 2024-04-09 18:13:38 +02:00
4074c3b96a fix out of order access of variables 2024-04-09 18:13:14 +02:00
854fef68e8 revert removal of locale initialization per country. default to English 2024-04-09 18:12:58 +02:00
cf66bb3310 revert name change removal 2024-04-09 17:25:39 +02:00
254f6f6664 remove division by 1 for party exp bonus 2024-04-09 17:24:09 +02:00
0072bc5e14 revert removal of spam db 2024-04-09 17:21:46 +02:00
62f3635b86 revert removed warning for disabled version checks 2024-04-09 17:10:53 +02:00
2c37b2009d revert local testing of string localization 2024-04-09 17:10:38 +02:00
e0701ed5bd restore accidentally removed login logic 2024-04-09 17:04:10 +02:00
21381a4e3a restore accidentally removed fish logic 2024-04-09 17:03:42 +02:00
ba44269071 remove redundant condition for skill book exp consumption 2024-04-09 16:58:02 +02:00
f5ccb17736 remove redundant pointer to lucky pouch loot table 2024-04-09 16:56:43 +02:00
bb52a57ffc remove unreachable branch 2024-04-09 16:53:47 +02:00
8360d6939f set damage penalty on foreign empire maps to constant 9% 2024-04-09 16:53:37 +02:00
1e362d8507 remove isLimitedItem 2024-04-09 16:51:51 +02:00
0a907f41d2 remove unnecessary leftover closures 2024-04-07 22:11:12 +02:00
dbcabd7fa9 reduce LC_InitLocalization logic, purge LC_Is* definitions 2024-04-07 18:10:16 +02:00
fcc2a9e4a0 Logout error messages are now being sent, closes #18 2024-04-07 18:36:10 +03:00
12b6abf373 remove IS_BOTARYABLE_ZONE 2024-04-07 14:19:29 +02:00
e1daa48366 remove all localization 2024-04-07 12:54:57 +02:00
83707434ee Fix small UTF-8 conversion mistakes, converted locale_strings, added KR locale_string file 2024-04-07 10:14:51 +03:00
042414a499 Merge pull request 'encoding' (#20) from Tr0n/server:encoding into nightly
Reviewed-on: #20
2024-04-07 08:59:36 +03:00
68c7c4bc4f fix config comment 2024-04-06 18:04:29 +02:00
eafbee616f english locale as base 2024-04-06 17:58:03 +02:00
026cb861a8 fix missing quote mark 2024-04-06 17:57:30 +02:00
1ba21fb1f9 translate remaining SPDLOG calls 2024-04-06 17:57:14 +02:00
8fede9a1df manual translation of non-localized strings 2024-04-06 17:28:22 +02:00
dfb3d08998 manual translation of non-localized strings 2024-04-06 12:50:34 +02:00
326c134f9e manual translation of non-localized strings 2024-04-06 11:13:11 +02:00
9b7536ee9a Initial pass of converting string literals to english 2024-04-06 10:31:54 +02:00
9056f6c6c6 convert some more comments to utf8 2024-04-06 10:24:46 +02:00
8685b02fdc libthecore encoding conversion 2024-04-06 10:20:42 +02:00
341bef9aba Merge branch 'nightly' into comment-encoding 2024-04-06 01:09:03 +02:00
8a1acefeeb move encoding tool to separate repo 2024-04-06 00:42:30 +02:00
eacc808366 convert comments to utf-8 2024-04-05 23:34:45 +02:00
4a1460f36e convert korean characters in string literals to string encoded bytes 2024-04-05 22:24:46 +02:00
aae9b169df encoding fix script 2024-04-05 21:57:49 +02:00
dd74eafc24 fix db cpp encoding 2024-04-01 14:20:00 +02:00
d471d99a24 fix libthecore header encoding 2024-04-01 12:48:58 +02:00
350fb0d424 fix libsql header encoding 2024-04-01 12:48:16 +02:00
869720f9e6 fix libgame header encoding 2024-04-01 12:46:52 +02:00
4fc612552a fix common header encoding 2024-04-01 12:45:35 +02:00
248205ae01 fix db header encoding 2024-04-01 12:43:31 +02:00
82317e6c4d fix game header encoding 2024-04-01 12:39:34 +02:00
847ab2ef89 Fixed erroneous database table parsing due to incorrect SMS phone number removal 2024-03-31 15:30:43 +03:00
ebc479b7df Fixed "Invalid Socket Count 3, set to maximum" error 2024-03-31 09:09:35 +03:00
1ee687f269 Removed unused PROTECT_CHILD_FOR_NEWCIBN 2024-03-31 08:54:34 +03:00
d85ef28eac Removed messenger SMS 2024-03-30 21:14:50 +02:00
01cc27a7df Removed Billing/VCard 2024-03-30 19:58:21 +02:00
72b495c03c Removed PCBang/iCafe code 2024-03-30 18:55:44 +02:00
0c86f802ca Removed unused highscore Lua & DB functions 2024-03-30 18:06:36 +02:00
05a1406c7c Removed database strings and automatic greeting 2024-03-30 17:50:04 +02:00
00c5634c09 Removed country blocking (and exceptions) 2024-03-30 17:09:03 +02:00
42079d56b7 Removed hotbackup 2024-03-30 16:57:24 +02:00
0101618d89 Fixed sectree not found while loading guild buildings 2024-03-25 07:01:22 +02:00
8579828ca6 Implemented official level update fix 2024-03-11 18:08:24 +02:00
3f1ce57fa1 Enforced signed datatypes for char variables, fixing ARM builds 2024-03-03 19:10:49 +02:00
e4cbdcfc4d Remove hardcoded CMake debug flag. Closes #12 2024-03-03 19:03:53 +02:00
bba0294107 Merge pull request 'Refactored the logging code' (#14) from log-rewrite into master
Reviewed-on: #14
2024-03-03 19:02:05 +02:00
0aab8162fb Merge branch 'master' into log-rewrite 2024-03-03 18:59:23 +02:00
9fba85f947 Updated README.md with the latest changes 2024-03-03 18:55:48 +02:00
a7f4e4e54d Rewrote the log initialization functions, logs are now saved in rotating files, implemented configurable log levels 2024-03-03 18:51:51 +02:00
7e543bd05f Merge pull request 'fix arm/aarch64 builds.' (#13) from NycuRO/server:fix-arm-aarch into master
Reviewed-on: #13
2024-01-09 20:59:11 +02:00
405b05fe59 fix arm/aarch64 builds. 2024-01-09 18:26:50 +02:00
feac4c0598 Applied changes on the db executable. Removed old logging functions. Various global changes. 2024-01-07 22:05:51 +02:00
2f829ae2dc Applied changes on the game executable. 2023-12-31 12:26:59 +02:00
2c8cb0c857 Made a small-scale test with the spdlog library. Incidentally added fmt. 2023-12-30 10:30:52 +02:00
fc3f2f232c CMake build system updates, the docker image automatically compiles quests at build 2023-12-10 10:00:55 +02:00
1375 changed files with 31848 additions and 64215 deletions

View File

@ -5,5 +5,17 @@ cmake-build-release/
# Dockerfile (in order to allow changes without rebuilding)
Dockerfile
# Git files
.gitignore
.gitkeep
# Compiled quests
gamefiles/data/quest/object/
gamefiles/data/quest/pre_qc/
gamefiles/data/quest/qc
# Test folder
test/
# Built files
build/

6
.idea/encodings.xml generated
View File

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

3
.vscode/settings.json vendored Normal file
View File

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

View File

@ -1,8 +1,5 @@
cmake_minimum_required(VERSION 3.12)
# Build mode debug/release?
set(CMAKE_BUILD_TYPE Debug)
# Set C++ standard to C++17
set(CMAKE_CXX_STANDARD 17)
@ -23,15 +20,14 @@ set(METIN2_COMPILER "${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}")
set(METIN2_CPU_TARGET ${CMAKE_SYSTEM_PROCESSOR})
# Git revision
include(FindGit)
find_package(Git)
find_package(GitInfo)
if(GIT_FOUND)
GIT_WC_INFO(${PROJECT_SOURCE_DIR} Metin2)
set(METIN2_REVISION ${Metin2_WC_REVISION_NAME})
set(METIN2_REVISION ${Metin2_WC_REVISION_HASH})
set(METIN2_LAST_CHANGED_DATE ${Metin2_WC_LAST_CHANGED_DATE})
if (${Metin2_WC_LATEST_TAG} NOT STREQUAL "")
if (Metin2_WC_LATEST_TAG)
set(METIN2_LATEST_TAG ${Metin2_WC_LATEST_TAG})
else()
set(METIN2_LATEST_TAG "unknown")

View File

@ -1,38 +1,59 @@
FROM ubuntu:latest as build
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 build-essential tar curl zip unzip pkg-config autoconf python3 \
apt-get install -y git cmake ninja-build build-essential tar curl zip unzip pkg-config autoconf python3 \
libdevil-dev libncurses5-dev libbsd-dev
# Arm specific
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
RUN ./vcpkg/vcpkg install boost-system cryptopp effolkronium-random libmysql libevent lzo fmt spdlog argon2
COPY . .
# Build the binaries
RUN mkdir build/
RUN cd build && cmake -DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake ..
RUN cd build && make -j $(nproc)
FROM ubuntu:latest as app
FROM ubuntu:22.04 as app
WORKDIR /app
RUN apt-get update && apt-get install -y libdevil-dev libbsd-dev && apt-get clean
RUN apt-get update && apt-get install -y gettext 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
COPY --from=build /app/build/src/game/game /bin/game
COPY --from=build /app/build/src/quest/quest /bin/quest
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
# Symlink the configuration files
RUN ln -s "./conf/CMD" "CMD"
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 [lastest instructions](https://vcpkg.io/en/getting-started.html).
Install `vcpkg` according to the [latest 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
vcpkg install boost-system cryptopp effolkronium-random libmysql libevent lzo fmt spdlog argon2
```
Then, it's time to build your binaries. Your commands should look along the lines of:
@ -79,7 +79,9 @@ 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 `CONFIG` 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 `game.conf` 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.
@ -88,6 +90,7 @@ This is a very serious security risk and one of the reasons this project is stil
### Gameplay
- Fixed invisibility bug on login/respawn/teleport etc.
- Fixed player level not updating [(thread)](https://metin2.dev/topic/30612-official-level-update-fix-reversed/)
### Exploits
- See the warning above :(
@ -99,10 +102,9 @@ 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 `conf.txt` and `CONFIG` to a modern dotenv-like format, which would enable pretty nice Docker images.
- Migrate `db.conf` and `game.conf` 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.
- Use a modern logging library to clean up the current mess.
- Handle kernel signals (SIGTERM, SIGHUP etc.) for gracefully shutting down the game server.
- Improve memory safety.
- Use fixed width integer types instead of Microsoft-style typedefs.

View File

@ -1,176 +0,0 @@
################################################################################
#
# Program: 3D Slicer
#
# Copyright (c) Kitware Inc.
#
# See COPYRIGHT.txt
# or http://www.slicer.org/copyright/copyright.txt for details.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# This file was originally developed by Jean-Christophe Fillion-Robin, Kitware Inc.
# and was partially funded by NIH grant 3P41RR013218-12S1
#
################################################################################
#
# The module defines the following variables:
# GIT_EXECUTABLE - path to git command line client
# GIT_FOUND - true if the command line client was found
# GIT_VERSION_STRING - the version of git found (since CMake 2.8.8)
#
# If the command line client executable is found the macro
# GIT_WC_INFO(<dir> <var-prefix>)
# is defined to extract information of a git working copy at
# a given location.
#
# The macro defines the following variables:
# <var-prefix>_WC_REVISION_HASH - Current SHA1 hash
# <var-prefix>_WC_REVISION - Current SHA1 hash
# <var-prefix>_WC_REVISION_NAME - Name associated with <var-prefix>_WC_REVISION_HASH
# <var-prefix>_WC_URL - output of command `git config --get remote.origin.url'
# <var-prefix>_WC_ROOT - Same value as working copy URL
# <var-prefix>_WC_LAST_CHANGED_DATE - date of last commit
# <var-prefix>_WC_GITSVN - Set to false
#
# ... and also the following ones if it's a git-svn repository:
# <var-prefix>_WC_GITSVN - Set to True if it is a
# <var-prefix>_WC_INFO - output of command `git svn info'
# <var-prefix>_WC_URL - url of the associated SVN repository
# <var-prefix>_WC_ROOT - root url of the associated SVN repository
# <var-prefix>_WC_REVISION - current SVN revision number
# <var-prefix>_WC_LAST_CHANGED_AUTHOR - author of last commit
# <var-prefix>_WC_LAST_CHANGED_DATE - date of last commit
# <var-prefix>_WC_LAST_CHANGED_REV - revision of last commit
# <var-prefix>_WC_LAST_CHANGED_LOG - last log of base revision
#
# Example usage:
# find_package(Git)
# if(GIT_FOUND)
# GIT_WC_INFO(${PROJECT_SOURCE_DIR} Project)
# message("Current revision is ${Project_WC_REVISION_HASH}")
# message("git found: ${GIT_EXECUTABLE}")
# endif()
#
# Look for 'git' or 'eg' (easy git)
#
set(git_names git eg)
# Prefer .cmd variants on Windows unless running in a Makefile
# in the MSYS shell.
#
if(WIN32)
if(NOT CMAKE_GENERATOR MATCHES "MSYS")
# Note: Due to a bug in 'git.cmd' preventing it from returning the exit code of 'git',
# we excluded it from the list of executables to search.
# See http://code.google.com/p/msysgit/issues/detail?id=428
# TODO Check if 'git' exists, get the associated version, if the corresponding version
# is known to have a working version of 'git.cmd', use it.
set(git_names git eg.cmd eg)
endif()
endif()
find_program(GIT_EXECUTABLE ${git_names}
PATHS
"C:/Program Files/Git/bin"
"C:/Program Files (x86)/Git/bin"
DOC "git command line client")
# XXX Comment to workaround https://gitlab.kitware.com/cmake/cmake/issues/15448
# mark_as_advanced(GIT_EXECUTABLE)
if(GIT_EXECUTABLE)
execute_process(COMMAND ${GIT_EXECUTABLE} --version
OUTPUT_VARIABLE git_version
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
if (git_version MATCHES "^git version [0-9]")
string(REPLACE "git version " "" GIT_VERSION_STRING "${git_version}")
endif()
unset(git_version)
macro(GIT_WC_INFO dir prefix)
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --verify -q --short=7 HEAD
WORKING_DIRECTORY ${dir}
ERROR_VARIABLE GIT_error
OUTPUT_VARIABLE ${prefix}_WC_REVISION_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(${prefix}_WC_REVISION ${${prefix}_WC_REVISION_HASH})
if(NOT ${GIT_error} EQUAL 0)
message(SEND_ERROR "Command \"${GIT_EXECUTBALE} rev-parse --verify -q --short=7 HEAD\" in directory ${dir} failed with output:\n${GIT_error}")
else(NOT ${GIT_error} EQUAL 0)
execute_process(COMMAND ${GIT_EXECUTABLE} name-rev ${${prefix}_WC_REVISION_HASH}
WORKING_DIRECTORY ${dir}
OUTPUT_VARIABLE ${prefix}_WC_REVISION_NAME
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif(NOT ${GIT_error} EQUAL 0)
execute_process(COMMAND ${GIT_EXECUTABLE} config --get remote.origin.url
WORKING_DIRECTORY ${dir}
OUTPUT_VARIABLE ${prefix}_WC_URL
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${GIT_EXECUTABLE} show -s --format="%ci" ${${prefix}_WC_REVISION_HASH}
WORKING_DIRECTORY ${dir}
OUTPUT_VARIABLE ${prefix}_show_output
OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REGEX REPLACE "^([0-9][0-9][0-9][0-9]\\-[0-9][0-9]\\-[0-9][0-9]).*"
"\\1" ${prefix}_WC_LAST_CHANGED_DATE "${${prefix}_show_output}")
set(${prefix}_WC_GITSVN False)
# Check if this git is likely to be a git-svn repository
execute_process(COMMAND ${GIT_EXECUTABLE} config --get-regexp "^svn-remote"
WORKING_DIRECTORY ${dir}
OUTPUT_VARIABLE git_config_output
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT "${git_config_output}" STREQUAL "")
# In case git-svn is used, attempt to extract svn info
execute_process(COMMAND ${GIT_EXECUTABLE} svn info
WORKING_DIRECTORY ${dir}
TIMEOUT 3
ERROR_VARIABLE git_svn_info_error
OUTPUT_VARIABLE ${prefix}_WC_INFO
RESULT_VARIABLE git_svn_info_result
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(${git_svn_info_result} EQUAL 0)
set(${prefix}_WC_GITSVN True)
string(REGEX REPLACE "^(.*\n)?URL: ([^\n]+).*"
"\\2" ${prefix}_WC_URL "${${prefix}_WC_INFO}")
string(REGEX REPLACE "^(.*\n)?Revision: ([^\n]+).*"
"\\2" ${prefix}_WC_REVISION "${${prefix}_WC_INFO}")
string(REGEX REPLACE "^(.*\n)?Repository Root: ([^\n]+).*"
"\\2" ${prefix}_WC_ROOT "${${prefix}_WC_INFO}")
string(REGEX REPLACE "^(.*\n)?Last Changed Author: ([^\n]+).*"
"\\2" ${prefix}_WC_LAST_CHANGED_AUTHOR "${${prefix}_WC_INFO}")
string(REGEX REPLACE "^(.*\n)?Last Changed Rev: ([^\n]+).*"
"\\2" ${prefix}_WC_LAST_CHANGED_REV "${${prefix}_WC_INFO}")
string(REGEX REPLACE "^(.*\n)?Last Changed Date: ([^\n]+).*"
"\\2" ${prefix}_WC_LAST_CHANGED_DATE "${${prefix}_WC_INFO}")
endif(${git_svn_info_result} EQUAL 0)
endif(NOT "${git_config_output}" STREQUAL "")
# If there is no 'remote.origin', default to "NA" value and print a warning message.
if(NOT ${prefix}_WC_URL)
message(WARNING "No remote origin set for git repository: ${dir}" )
set( ${prefix}_WC_URL "NA" )
else()
set(${prefix}_WC_ROOT ${${prefix}_WC_URL})
endif()
endmacro(GIT_WC_INFO)
endif(GIT_EXECUTABLE)
# Handle the QUIETLY and REQUIRED arguments and set GIT_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Git DEFAULT_MSG GIT_EXECUTABLE)

View File

@ -0,0 +1,244 @@
################################################################################
#
# Program: FindGitInfo from Slicer
#
# Copyright (c) Kitware Inc.
#
# See COPYRIGHT.txt
# or http://www.slicer.org/copyright/copyright.txt for details.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# This file was originally developed by Jean-Christophe Fillion-Robin,
# Kitware Inc. and was partially funded by NIH grant 3P41RR013218-12S1
#
################################################################################
# If the command line client executable is found the macro
# GIT_WC_INFO(<dir> <var-prefix>)
# is defined to extract information of a git working copy at
# a given location.
#
# The macro defines the following variables:
# <var-prefix>_WC_REVISION_HASH - Current SHA1 hash
# <var-prefix>_WC_REVISION - Current SHA1 hash
# <var-prefix>_WC_REVISION_NAME - Name associated with <var-prefix>_WC_REVISION_HASH
# <var-prefix>_WC_URL - output of command `git config --get remote.origin.url'
# <var-prefix>_WC_ROOT - Same value as working copy URL
# <var-prefix>_WC_LAST_CHANGED_DATE - date of last commit
# <var-prefix>_WC_GITSVN - Set to false
# <var-prefix>_WC_LATEST_TAG - Latest tag found in history
# <var-prefix>_WC_LATEST_TAG_LONG - <last tag>-<commits since then>-g<actual commit hash>
#
# ... and also the following ones if it's a git-svn repository:
# <var-prefix>_WC_GITSVN - Set to True if it is a
# <var-prefix>_WC_INFO - output of command `git svn info'
# <var-prefix>_WC_URL - url of the associated SVN repository
# <var-prefix>_WC_ROOT - root url of the associated SVN repository
# <var-prefix>_WC_REVISION - current SVN revision number
# <var-prefix>_WC_LAST_CHANGED_AUTHOR - author of last commit
# <var-prefix>_WC_LAST_CHANGED_DATE - date of last commit
# <var-prefix>_WC_LAST_CHANGED_REV - revision of last commit
# <var-prefix>_WC_LAST_CHANGED_LOG - last log of base revision
#
# Example usage:
# find_package(GitInfo)
# if(GIT_FOUND)
# GIT_WC_INFO(${PROJECT_SOURCE_DIR} Project)
# message("Current revision is ${Project_WC_REVISION_HASH}")
# message("git found: ${GIT_EXECUTABLE}")
# endif()
#
# Look for git. Respect the quiet and required flags passed to this module.
set(FIND_QUIETLY_FLAG "")
if (DEFINED GitInfo_FIND_QUIETLY)
set(FIND_QUIETLY_FLAG "QUIET")
endif ()
set(FIND_REQUIRED_FLAG "")
if (DEFINED GitInfo_FIND_REQUIRED)
set(FIND_REQUIRED_FLAG "REQUIRED")
endif ()
find_package(Git ${FIND_QUIETLY_FLAG} ${FIND_REQUIRED_FLAG})
if(GIT_FOUND)
execute_process(COMMAND ${GIT_EXECUTABLE} --version
OUTPUT_VARIABLE git_version
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
if (git_version MATCHES "^git version [0-9]")
string(REPLACE "git version " "" GIT_VERSION_STRING "${git_version}")
endif()
unset(git_version)
macro(GIT_WC_INFO dir prefix)
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --verify -q --short=7 HEAD
WORKING_DIRECTORY ${dir}
ERROR_VARIABLE GIT_error
OUTPUT_VARIABLE ${prefix}_WC_REVISION_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(${prefix}_WC_REVISION ${${prefix}_WC_REVISION_HASH})
if(NOT ${GIT_error} EQUAL 0)
message(SEND_ERROR "Command \"${GIT_EXECUTBALE} rev-parse --verify -q --short=7 HEAD\" in directory ${dir} failed with output:\n${GIT_error}")
else(NOT ${GIT_error} EQUAL 0)
execute_process(COMMAND ${GIT_EXECUTABLE} name-rev ${${prefix}_WC_REVISION_HASH}
WORKING_DIRECTORY ${dir}
OUTPUT_VARIABLE ${prefix}_WC_REVISION_NAME
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif(NOT ${GIT_error} EQUAL 0)
execute_process(COMMAND ${GIT_EXECUTABLE} config --get remote.origin.url
WORKING_DIRECTORY ${dir}
OUTPUT_VARIABLE ${prefix}_WC_URL
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${GIT_EXECUTABLE} show -s --format="%ci" ${${prefix}_WC_REVISION_HASH}
WORKING_DIRECTORY ${dir}
OUTPUT_VARIABLE ${prefix}_show_output
OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REGEX REPLACE "^([0-9][0-9][0-9][0-9]\\-[0-9][0-9]\\-[0-9][0-9]).*"
"\\1" ${prefix}_WC_LAST_CHANGED_DATE "${${prefix}_show_output}")
execute_process(COMMAND ${GIT_EXECUTABLE} describe --tags --abbrev=0
WORKING_DIRECTORY ${dir}
OUTPUT_VARIABLE ${prefix}_WC_LATEST_TAG
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET)
execute_process(COMMAND ${GIT_EXECUTABLE} describe --tags
WORKING_DIRECTORY ${dir}
OUTPUT_VARIABLE ${prefix}_WC_LATEST_TAG_LONG
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET)
set(${prefix}_WC_GITSVN False)
# Check if this git is likely to be a git-svn repository
execute_process(COMMAND ${GIT_EXECUTABLE} config --get-regexp "^svn-remote"
WORKING_DIRECTORY ${dir}
OUTPUT_VARIABLE git_config_output
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT "${git_config_output}" STREQUAL "")
# In case git-svn is used, attempt to extract svn info
execute_process(COMMAND ${GIT_EXECUTABLE} svn info
WORKING_DIRECTORY ${dir}
TIMEOUT 3
ERROR_VARIABLE git_svn_info_error
OUTPUT_VARIABLE ${prefix}_WC_INFO
RESULT_VARIABLE git_svn_info_result
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(${git_svn_info_result} EQUAL 0)
set(${prefix}_WC_GITSVN True)
string(REGEX REPLACE "^(.*\n)?URL: ([^\n]+).*"
"\\2" ${prefix}_WC_URL "${${prefix}_WC_INFO}")
string(REGEX REPLACE "^(.*\n)?Revision: ([^\n]+).*"
"\\2" ${prefix}_WC_REVISION "${${prefix}_WC_INFO}")
string(REGEX REPLACE "^(.*\n)?Repository Root: ([^\n]+).*"
"\\2" ${prefix}_WC_ROOT "${${prefix}_WC_INFO}")
string(REGEX REPLACE "^(.*\n)?Last Changed Author: ([^\n]+).*"
"\\2" ${prefix}_WC_LAST_CHANGED_AUTHOR "${${prefix}_WC_INFO}")
string(REGEX REPLACE "^(.*\n)?Last Changed Rev: ([^\n]+).*"
"\\2" ${prefix}_WC_LAST_CHANGED_REV "${${prefix}_WC_INFO}")
string(REGEX REPLACE "^(.*\n)?Last Changed Date: ([^\n]+).*"
"\\2" ${prefix}_WC_LAST_CHANGED_DATE "${${prefix}_WC_INFO}")
endif(${git_svn_info_result} EQUAL 0)
endif(NOT "${git_config_output}" STREQUAL "")
# If there is no 'remote.origin', default to "NA" value and print a warning message.
if(NOT ${prefix}_WC_URL)
message(WARNING "No remote origin set for git repository: ${dir}" )
set( ${prefix}_WC_URL "NA" )
else()
set(${prefix}_WC_ROOT ${${prefix}_WC_URL})
endif()
endmacro(GIT_WC_INFO)
# Get the version info from the latest tag and set it as the projects version.
#
# Parameters:
# prefix The prefix for all version variables.
#
macro(GIT_VERSION_INFO prefix)
# If this project is not deployed via git, the following version file will
# be used as fallback and needs to be deployed along with the sources. These
# will be generated automatically by depending on the global target
# 'project-version-files', if this project has access to the related git
# repositoy.
set(VERSION_FILE "${PROJECT_SOURCE_DIR}/.version")
if (NOT TARGET project-version-files)
add_custom_target(project-version-files)
endif ()
if (EXISTS "${PROJECT_SOURCE_DIR}/.git")
git_wc_info(${PROJECT_SOURCE_DIR} GIT)
# Add commands and targets for generating the required version file for
# source package deploys. The file will also be to a global property, so
# one is able to access a list of all generated version files, e.g. to
# clean up the source directory after the package has been packed.
add_custom_command(
OUTPUT ${VERSION_FILE}
COMMAND ${GIT_EXECUTABLE} describe --tags > ${VERSION_FILE}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
set_property(GLOBAL APPEND
PROPERTY GIT_GENERATED_VERSION_FILES "${VERSION_FILE}")
add_custom_target(project-version-files-${prefix} DEPENDS ${VERSION_FILE})
add_dependencies(project-version-files project-version-files-${prefix})
# If git is not available (e.g. this git was packed as .tar.gz), try to read
# the version-info from a hidden file in the root directory. This file
# should not be versioned, but added at packaging time.
elseif (EXISTS "${VERSION_FILE}")
file(READ "${VERSION_FILE}" GIT_WC_LATEST_TAG_LONG)
string(STRIP "${GIT_WC_LATEST_TAG_LONG}" GIT_WC_LATEST_TAG_LONG)
# If no version could be gathered by git or the version file, print a
# warning, so the user has to define a version in the backup version file.
else ()
if (${ARGN} EQUAL "REQUIRED")
message(FATAL_ERROR "No version provided by git or .version file")
else ()
message(WARNING "No version provided by git or .version file")
endif()
endif ()
if (GIT_WC_LATEST_TAG_LONG MATCHES "^([^0-9]*)([0-9]+)[.]([0-9]+)(.*)")
set(${prefix}_VERSION ${GIT_WC_LATEST_TAG_LONG} CACHE STRING "" FORCE)
set(${prefix}_VERSION_MAJOR ${CMAKE_MATCH_2} CACHE STRING "" FORCE)
set(${prefix}_VERSION_MINOR ${CMAKE_MATCH_3} CACHE STRING "" FORCE)
if (GIT_WC_LATEST_TAG_LONG MATCHES
"^([^0-9]*)([0-9]+)[.]([0-9]+)[.]([0-9]+)")
set(${prefix}_VERSION_PATCH ${CMAKE_MATCH_4} CACHE STRING "" FORCE)
else ()
set(${prefix}_VERSION_PATCH 0 CACHE STRING "" FORCE)
endif()
if (GIT_WC_LATEST_TAG_LONG MATCHES
"^([^0-9]*)([0-9]+)[.]([0-9]+)(.*)-([0-9]+)-")
set(${prefix}_VERSION_TWEAK ${CMAKE_MATCH_5} CACHE STRING "" FORCE)
else ()
set(${prefix}_VERSION_TWEAK 0 CACHE STRING "" FORCE)
endif()
mark_as_advanced(${prefix}_VERSION
${prefix}_VERSION_MAJOR
${prefix}_VERSION_MINOR
${prefix}_VERSION_PATCH
${prefix}_VERSION_TWEAK)
else ()
message(FATAL_ERROR "Invalid version info: '${GIT_WC_LATEST_TAG_LONG}'.")
endif ()
endmacro()
endif(GIT_FOUND)

18
docker/conf/db.conf.tmpl Normal file
View File

@ -0,0 +1,18 @@
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

@ -0,0 +1,41 @@
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

@ -0,0 +1,9 @@
#!/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,8 +41,6 @@ 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

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