diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..b3a74bf
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,43 @@
+cmake_minimum_required(VERSION 3.12)
+
+# Build mode debug/release?
+set(CMAKE_BUILD_TYPE Debug)
+
+# Set C++ standard to C++11
+set(CMAKE_CXX_STANDARD 11)
+
+project("Metin2 Server")
+
+set(BINARY_OUTPUT_DIR ${CMAKE_BINARY_DIR}/bin)
+
+# Set build directory
+set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
+set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
+
+# Set the CMake module directory
+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMake/Modules/")
+
+# Set environment variables
+set(METIN2_OS_NAME ${CMAKE_SYSTEM})
+set(METIN2_COMPILER_NAME ${CMAKE_CXX_COMPILER_ID})
+set(METIN2_CPU_TARGET ${CMAKE_SYSTEM_PROCESSOR})
+
+# Git revision
+include(FindGit)
+find_package(Git)
+
+set(METIN2_REVISION "unknown")
+
+message(STATUS "Current revision is ${METIN2_REVISION}")
+
+# Set the global include directories
+include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+
+add_subdirectory(libgame)
+add_subdirectory(liblua)
+add_subdirectory(libpoly)
+add_subdirectory(libsql)
+add_subdirectory(libthecore)
+add_subdirectory(game)
+add_subdirectory(db)
+add_subdirectory(quest)
diff --git a/CMakeSettings.json b/CMakeSettings.json
new file mode 100644
index 0000000..836cc1e
--- /dev/null
+++ b/CMakeSettings.json
@@ -0,0 +1,28 @@
+{
+ "configurations": [
+ {
+ "name": "x64-Debug",
+ "generator": "Ninja",
+ "configurationType": "Debug",
+ "inheritEnvironments": [ "msvc_x64_x64" ],
+ "buildRoot": "${projectDir}\\out\\build\\${name}",
+ "installRoot": "${projectDir}\\out\\install\\${name}",
+ "cmakeCommandArgs": "",
+ "buildCommandArgs": "",
+ "ctestCommandArgs": ""
+ },
+ {
+ "name": "WSL-GCC-Debug",
+ "generator": "Ninja",
+ "configurationType": "Debug",
+ "buildRoot": "${projectDir}\\out\\build\\${name}",
+ "installRoot": "${projectDir}\\out\\install\\${name}",
+ "cmakeExecutable": "cmake",
+ "cmakeCommandArgs": "",
+ "buildCommandArgs": "",
+ "ctestCommandArgs": "",
+ "inheritEnvironments": [ "linux_x64" ],
+ "wslPath": "${defaultWSLPath}"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/cmake/Modules/FindCryptoPP.cmake b/cmake/Modules/FindCryptoPP.cmake
new file mode 100644
index 0000000..5ca01e4
--- /dev/null
+++ b/cmake/Modules/FindCryptoPP.cmake
@@ -0,0 +1,108 @@
+# Module for locating the Crypto++ encryption library.
+#
+# Customizable variables:
+# CRYPTOPP_ROOT_DIR
+# This variable points to the CryptoPP root directory. On Windows the
+# library location typically will have to be provided explicitly using the
+# -D command-line option. The directory should include the include/cryptopp,
+# lib and/or bin sub-directories.
+#
+# Read-only variables:
+# CRYPTOPP_FOUND
+# Indicates whether the library has been found.
+#
+# CRYPTOPP_INCLUDE_DIRS
+# Points to the CryptoPP include directory.
+#
+# CRYPTOPP_LIBRARIES
+# Points to the CryptoPP libraries that should be passed to
+# target_link_libararies.
+#
+#
+# Copyright (c) 2012 Sergiu Dotenco
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in all
+# copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+INCLUDE (FindPackageHandleStandardArgs)
+
+FIND_PATH (CRYPTOPP_ROOT_DIR
+ NAMES cryptopp/cryptlib.h include/cryptopp/cryptlib.h
+ PATHS ENV CRYPTOPPROOT
+ DOC "CryptoPP root directory")
+
+# Re-use the previous path:
+FIND_PATH (CRYPTOPP_INCLUDE_DIR
+ NAMES cryptopp/cryptlib.h
+ HINTS ${CRYPTOPP_ROOT_DIR}
+ PATH_SUFFIXES include
+ DOC "CryptoPP include directory")
+
+FIND_LIBRARY (CRYPTOPP_LIBRARY_DEBUG
+ NAMES cryptlibd cryptoppd
+ HINTS ${CRYPTOPP_ROOT_DIR}
+ PATH_SUFFIXES lib
+ DOC "CryptoPP debug library")
+
+FIND_LIBRARY (CRYPTOPP_LIBRARY_RELEASE
+ NAMES cryptlib cryptopp
+ HINTS ${CRYPTOPP_ROOT_DIR}
+ PATH_SUFFIXES lib
+ DOC "CryptoPP release library")
+
+IF (CRYPTOPP_LIBRARY_DEBUG AND CRYPTOPP_LIBRARY_RELEASE)
+ SET (CRYPTOPP_LIBRARY
+ optimized ${CRYPTOPP_LIBRARY_RELEASE}
+ debug ${CRYPTOPP_LIBRARY_DEBUG} CACHE DOC "CryptoPP library")
+ELSEIF (CRYPTOPP_LIBRARY_RELEASE)
+ SET (CRYPTOPP_LIBRARY ${CRYPTOPP_LIBRARY_RELEASE} CACHE DOC
+ "CryptoPP library")
+ENDIF (CRYPTOPP_LIBRARY_DEBUG AND CRYPTOPP_LIBRARY_RELEASE)
+
+IF (CRYPTOPP_INCLUDE_DIR)
+ SET (_CRYPTOPP_VERSION_HEADER ${CRYPTOPP_INCLUDE_DIR}/cryptopp/config.h)
+
+ IF (EXISTS ${_CRYPTOPP_VERSION_HEADER})
+ FILE (STRINGS ${_CRYPTOPP_VERSION_HEADER} _CRYPTOPP_VERSION_TMP REGEX
+ "^#define CRYPTOPP_VERSION[ \t]+[0-9]+$")
+
+ STRING (REGEX REPLACE
+ "^#define CRYPTOPP_VERSION[ \t]+([0-9]+)" "\\1" _CRYPTOPP_VERSION_TMP
+ ${_CRYPTOPP_VERSION_TMP})
+
+ STRING (REGEX REPLACE "([0-9]+)[0-9][0-9]" "\\1" CRYPTOPP_VERSION_MAJOR
+ ${_CRYPTOPP_VERSION_TMP})
+ STRING (REGEX REPLACE "[0-9]([0-9])[0-9]" "\\1" CRYPTOPP_VERSION_MINOR
+ ${_CRYPTOPP_VERSION_TMP})
+ STRING (REGEX REPLACE "[0-9][0-9]([0-9])" "\\1" CRYPTOPP_VERSION_PATCH
+ ${_CRYPTOPP_VERSION_TMP})
+
+ SET (CRYPTOPP_VERSION_COUNT 3)
+ SET (CRYPTOPP_VERSION
+ ${CRYPTOPP_VERSION_MAJOR}.${CRYPTOPP_VERSION_MINOR}.${CRYPTOPP_VERSION_PATCH})
+ ENDIF (EXISTS ${_CRYPTOPP_VERSION_HEADER})
+ENDIF (CRYPTOPP_INCLUDE_DIR)
+
+SET (CRYPTOPP_INCLUDE_DIRS ${CRYPTOPP_INCLUDE_DIR})
+SET (CRYPTOPP_LIBRARIES ${CRYPTOPP_LIBRARY})
+
+MARK_AS_ADVANCED (CRYPTOPP_INCLUDE_DIR CRYPTOPP_LIBRARY CRYPTOPP_LIBRARY_DEBUG
+ CRYPTOPP_LIBRARY_RELEASE)
+
+FIND_PACKAGE_HANDLE_STANDARD_ARGS (CryptoPP REQUIRED_VARS CRYPTOPP_ROOT_DIR
+ CRYPTOPP_INCLUDE_DIR CRYPTOPP_LIBRARY VERSION_VAR CRYPTOPP_VERSION)
\ No newline at end of file
diff --git a/cmake/Modules/FindGit.cmake b/cmake/Modules/FindGit.cmake
new file mode 100644
index 0000000..94d864d
--- /dev/null
+++ b/cmake/Modules/FindGit.cmake
@@ -0,0 +1,176 @@
+################################################################################
+#
+# 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(
)
+# is defined to extract information of a git working copy at
+# a given location.
+#
+# The macro defines the following variables:
+# _WC_REVISION_HASH - Current SHA1 hash
+# _WC_REVISION - Current SHA1 hash
+# _WC_REVISION_NAME - Name associated with _WC_REVISION_HASH
+# _WC_URL - output of command `git config --get remote.origin.url'
+# _WC_ROOT - Same value as working copy URL
+# _WC_LAST_CHANGED_DATE - date of last commit
+# _WC_GITSVN - Set to false
+#
+# ... and also the following ones if it's a git-svn repository:
+# _WC_GITSVN - Set to True if it is a
+# _WC_INFO - output of command `git svn info'
+# _WC_URL - url of the associated SVN repository
+# _WC_ROOT - root url of the associated SVN repository
+# _WC_REVISION - current SVN revision number
+# _WC_LAST_CHANGED_AUTHOR - author of last commit
+# _WC_LAST_CHANGED_DATE - date of last commit
+# _WC_LAST_CHANGED_REV - revision of last commit
+# _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)
diff --git a/cmake/Modules/FindLZO.cmake b/cmake/Modules/FindLZO.cmake
new file mode 100644
index 0000000..4d7ca52
--- /dev/null
+++ b/cmake/Modules/FindLZO.cmake
@@ -0,0 +1,45 @@
+# Find liblzo2
+# LZO_FOUND - system has the LZO library
+# LZO_INCLUDE_DIR - the LZO include directory
+# LZO_LIBRARIES - The libraries needed to use LZO
+
+if (LZO_INCLUDE_DIR AND LZO_LIBRARIES)
+ # in cache already
+ SET(LZO_FOUND TRUE)
+else (LZO_INCLUDE_DIR AND LZO_LIBRARIES)
+ FIND_PATH(LZO_INCLUDE_DIR lzo/lzo1x.h
+ ${LZO_ROOT}/include/
+ /usr/include/
+ /usr/local/include/
+ /sw/lib/
+ /sw/local/lib/
+ )
+
+ if(WIN32 AND MSVC)
+ else(WIN32 AND MSVC)
+ FIND_LIBRARY(LZO_LIBRARIES NAMES lzo2
+ PATHS
+ ${LZO_ROOT}/lib
+ /usr/lib
+ /usr/local/lib
+ /sw/lib
+ /sw/local/lib
+ )
+ endif(WIN32 AND MSVC)
+
+ if (LZO_INCLUDE_DIR AND LZO_LIBRARIES)
+ set(LZO_FOUND TRUE)
+ endif (LZO_INCLUDE_DIR AND LZO_LIBRARIES)
+
+ if (LZO_FOUND)
+ if (NOT LZO_FIND_QUIETLY)
+ message(STATUS "Found LZO: ${LZO_LIBRARIES}")
+ endif (NOT LZO_FIND_QUIETLY)
+ else (LZO_FOUND)
+ if (LZO_FIND_REQUIRED)
+ message(FATAL_ERROR "Could NOT find LZO")
+ endif (LZO_FIND_REQUIRED)
+ endif (LZO_FOUND)
+
+ MARK_AS_ADVANCED(LZO_INCLUDE_DIR LZO_LIBRARIES)
+endif (LZO_INCLUDE_DIR AND LZO_LIBRARIES)
\ No newline at end of file
diff --git a/common/VnumHelper.h b/common/VnumHelper.h
new file mode 100644
index 0000000..c025f9d
--- /dev/null
+++ b/common/VnumHelper.h
@@ -0,0 +1,59 @@
+#ifndef __HEADER_VNUM_HELPER__
+#define __HEADER_VNUM_HELPER__
+
+/**
+ ̹ ϰų ߰ , ҽ ĺ
+ ĺ(=VNum) ϵڵϴ Ǿ־ ſ µ
+
+ δ ҽ (Ȥ ) ְ ڴ ö ߰.
+
+ * Ǵµ PCH ٲ ü ؾϴ
+ ϴ ʿ cppϿ include ؼ .
+
+ * cpp ϸ ~ ũؾϴ ׳ common ־. (game, dbƮ )
+
+ @date 2011. 8. 29.
+*/
+
+
+class CItemVnumHelper
+{
+public:
+ /// DVD һ ȯ
+ static const bool IsPhoenix(DWORD vnum) { return 53001 == vnum; } // NOTE: һ ȯ 53001 mob-vnum 34001 Դϴ.
+
+ /// ̺Ʈ ʽ´ ( ̺Ʈ Ư ̾ Ȱؼ ٰ )
+ static const bool IsRamadanMoonRing(DWORD vnum) { return 71135 == vnum; }
+
+ /// ҷ ( ʽ´ )
+ static const bool IsHalloweenCandy(DWORD vnum) { return 71136 == vnum; }
+
+ /// ũ ູ
+ static const bool IsHappinessRing(DWORD vnum) { return 71143 == vnum; }
+
+ /// ߷Ÿ ҴƮ
+ static const bool IsLovePendant(DWORD vnum) { return 71145 == vnum; }
+};
+
+class CMobVnumHelper
+{
+public:
+ /// DVD һ ȣ
+ static bool IsPhoenix(DWORD vnum) { return 34001 == vnum; }
+ static bool IsIcePhoenix(DWORD vnum) { return 34003 == vnum; }
+ /// PetSystem ϴ ΰ?
+ static bool IsPetUsingPetSystem(DWORD vnum) { return (IsPhoenix(vnum) || IsReindeerYoung(vnum)) || IsIcePhoenix(vnum); }
+
+ /// 2011 ũ ̺Ʈ (Ʊ )
+ static bool IsReindeerYoung(DWORD vnum) { return 34002 == vnum; }
+
+ /// ̺Ʈ 渶(20119) .. ҷ ̺Ʈ 渶 Ŭ( , 20219)
+ static bool IsRamadanBlackHorse(DWORD vnum) { return 20119 == vnum || 20219 == vnum || 22022 == vnum; }
+};
+
+class CVnumHelper
+{
+};
+
+
+#endif //__HEADER_VNUM_HELPER__
\ No newline at end of file
diff --git a/common/auction_table.h b/common/auction_table.h
new file mode 100644
index 0000000..e0d4568
--- /dev/null
+++ b/common/auction_table.h
@@ -0,0 +1,335 @@
+#ifndef __INC_AUCTION_TABLES_H__
+#define __INC_AUCTION_TABLES_H__
+
+#include "tables.h"
+
+typedef struct _base_auction
+{
+public:
+ DWORD item_num;
+ TItemTable* item_proto;
+ int offer_price;
+ int price;
+ DWORD offer_id;
+ char shown_name[CHARACTER_NAME_MAX_LEN + 1];
+ BYTE empire;
+ time_t expired_time;
+
+ DWORD get_item_num () { return item_num; }
+ DWORD get_offer_id () { return offer_id; }
+ BYTE get_empire () { return empire; }
+ time_t get_expired_time () { return expired_time; }
+ bool is_expired ()
+ {
+ return (time(NULL) > expired_time);
+ }
+ int get_price () { return offer_price; }
+} TAuctionSimpleItemInfo;
+
+// auction .
+// primary key (item_id)
+typedef struct _auction : public _base_auction
+{
+public:
+ DWORD item_id;
+ DWORD bidder_id;
+
+ _auction (){}
+ _auction (DWORD _item_num, int _offer_price, int _price, DWORD _offer_id,
+ char* _shown_name, time_t _expired_time, DWORD _item_id, DWORD _bidder_id, BYTE _empire)
+ {
+ item_num = _item_num;
+ offer_price= _offer_price;
+ price = _price;
+ offer_id = _offer_id;
+ thecore_memcpy(shown_name, _shown_name, strlen(_shown_name) + 1);
+ expired_time = _expired_time;
+ item_id = _item_id;
+ bidder_id = _bidder_id;
+ empire = _empire;
+ }
+
+ // ҵ auction ϴ
+ // Ҵ.
+ // by rtsummit
+ DWORD get_item_id () { return item_id; }
+ DWORD get_bidder_id () { return bidder_id; }
+ int get_bid_price () { return offer_price; }
+ void set_bid_price (int new_price)
+ {
+ offer_price = new_price;
+ }
+ int get_impur_price () { return price; }
+
+ const char* get_bidder_name () { return shown_name; }
+ void set_bidder_name (const char* new_bidder_name)
+ {
+ thecore_memcpy(shown_name, new_bidder_name, strlen(new_bidder_name) + 1);
+ }
+} TAuctionItemInfo;
+
+// primary key (item_id)
+typedef struct _sale : public _base_auction
+{
+ _sale (){}
+
+ _sale (DWORD _item_num, int _offer_price, DWORD _offer_id,
+ char* _shown_name, DWORD _item_id, DWORD _wisher_id)
+ {
+ item_num = _item_num;
+ offer_price= _offer_price;
+ offer_id = _offer_id;
+ thecore_memcpy(shown_name, _shown_name, strlen(_shown_name) + 1);
+ item_id = _item_id;
+ wisher_id = _wisher_id;
+ }
+
+ DWORD item_id;
+ DWORD wisher_id;
+
+} TSaleItemInfo;
+
+// wish ϴ .
+// primary key (item_num, wisher_id)
+typedef struct _wish : public _base_auction
+{
+ _wish (){}
+
+ _wish (DWORD _item_num, int _offer_price, DWORD _offer_id,
+ char* _shown_name, time_t _expired_time, BYTE _empire)
+ {
+ item_num = _item_num;
+ offer_price= _offer_price;
+ offer_id = _offer_id;
+ thecore_memcpy(shown_name, _shown_name, strlen(_shown_name) + 1);
+ expired_time = _expired_time;
+ empire = _empire;
+ }
+} TWishItemInfo;
+
+enum AuctionType {_AUCTION, _WISH_AUCTION, _MY_AUCTION, _MY_WISH_AUCTION, _AUCTION_MAX};
+
+enum AuctionCmd {OPEN_AUCTION, OPEN_WISH_AUCTION, OPEN_MY_AUCTION, OPEN_MY_WISH_AUCTION,
+ AUCTION_BID, AUCTION_IMME_PUR, AUCTION_ENR_AUC, AUCTION_ENR_WISH, AUCTION_ENR_SALE,
+ AUCTION_GET_AUC, AUCTION_BUY_SOLD,
+ AUCTION_CANCEL_AUC, AUCTION_CANCEL_WISH, AUCTION_CANCEL_SALE,
+ AUCTION_DELETE_AUCTION_ITEM, AUCTION_DELETE_SALE_ITEM,
+ AUCTION_CHANGING_MONEY,
+ AUCTION_REBID, AUCTION_BID_CANCEL,
+};
+
+// ݵ FAIL տ, ;Ѵ.
+// ֳ, <= AUCTION_FAIL ̷ CHECK Űŵ
+// ݴ SUCCESS ڿ, ;Ѵ. ٵ ֱ Ϸ...
+
+enum AuctionResult { AUCTION_EXPIRED, AUCTION_NOT_EXPIRED, AUCTION_NOT_ENOUGH_MONEY,
+ AUCTION_SOLD, AUCTION_CANCEL, AUCTION_ALREADY_IN, AUCTION_NOT_IN, AUCTION_FAIL, AUCTION_SUCCESS };
+
+enum AuctionSort { AUCTION_NO_ORDER,
+ AUCTION_ITEM_NAME_AC, AUCTION_ITEM_NAME_DC,
+ AUCTION_CATEGORY_AC, AUCTION_CATEGORY_DC,
+ AUCTION_TIME_AC, AUCTION_TIME_DC,
+ AUCTION_CHAR_NAME_AC, AUCTION_CHAR_NAME_DC,
+ AUCTION_PRICE_AC, AUCTION_PRICE_DC,
+};
+
+typedef struct command_get_auction_list
+{
+ AuctionCmd cmd;
+ DWORD start_idx;
+ BYTE size;
+} TPacketGDGetAuctionList;
+
+typedef struct command_auction
+{
+ void enroll_product (DWORD _item_id, BYTE _empire, int _bidPrice, int _impurPrice)
+ {
+ cmd = AUCTION_ENR_AUC;
+ item = _item_id;
+ empire = _empire;
+ price1 = _bidPrice;
+ price2 = _impurPrice;
+ }
+ void enroll_sale (DWORD _item_id, DWORD _wisher_id, int _salePrice)
+ {
+ cmd = AUCTION_ENR_SALE;
+ item = _item_id;
+ price1 = _salePrice;
+ player_id = _wisher_id;
+ }
+ void enroll_wish (DWORD _item_num, BYTE _empire, int _wishPrice)
+ {
+ cmd = AUCTION_ENR_WISH;
+ item = _item_num;
+ empire = _empire;
+ price1 = _wishPrice;
+ }
+ void bid (DWORD _item_id, int _bidPrice)
+ {
+ cmd = AUCTION_BID;
+ item = _item_id;
+ price1 = _bidPrice;
+ }
+ void impur (DWORD _item_id)
+ {
+ cmd = AUCTION_IMME_PUR;
+ item = _item_id;
+ }
+ void get_auctioned_item (DWORD _item_id)
+ {
+ cmd = AUCTION_GET_AUC;
+ item = _item_id;
+ }
+ void buy_sold_item (DWORD _item_id)
+ {
+ cmd = AUCTION_BUY_SOLD;
+ item = _item_id;
+ }
+ void cancel_auction (DWORD _item_id)
+ {
+ cmd = AUCTION_CANCEL_AUC;
+ item = _item_id;
+ }
+ void cancel_wish (DWORD _item_num)
+ {
+ cmd = AUCTION_CANCEL_WISH;
+ item = _item_num;
+ }
+ void cancel_sale (DWORD _item_id)
+ {
+ cmd = AUCTION_CANCEL_SALE;
+ item = _item_id;
+ }
+
+ void delete_auction_item (DWORD _item_id)
+ {
+ cmd = AUCTION_DELETE_AUCTION_ITEM;
+ item = _item_id;
+ }
+
+ void delete_sale_item (DWORD _item_id)
+ {
+ cmd = AUCTION_DELETE_SALE_ITEM;
+ item = _item_id;
+ }
+
+ void changing_money (int _money)
+ {
+ cmd = AUCTION_CHANGING_MONEY;
+ price1 = _money;
+ }
+ // bid cmd ٸ.
+ void rebid (DWORD _item_id, int _bidPrice)
+ {
+ cmd = AUCTION_REBID;
+ item = _item_id;
+ price1 = _bidPrice;
+ }
+ void bid_cancel (DWORD _item_id)
+ {
+ cmd = AUCTION_BID_CANCEL;
+ item = _item_id;
+ }
+ DWORD get_item () { return item; }
+
+protected:
+ AuctionCmd cmd;
+ DWORD player_id;
+ DWORD item;
+ BYTE empire;
+ int price1;
+ int price2;
+
+public:
+ AuctionCmd get_cmd() { return cmd; }
+ BYTE get_empire () { return empire; }
+} TPacketGDCommnadAuction;
+
+typedef struct result_auction
+{
+ AuctionCmd cmd;
+ BYTE result;
+ DWORD target;
+} TPacketDGResultAuction;
+
+// wrapper struct
+typedef struct auction_enroll_product : public command_auction
+{
+ DWORD get_item_id() { return item; }
+ int get_bid_price() { return price1; }
+ int get_impur_price() { return price2; }
+} AuctionEnrollProductInfo;
+
+typedef struct auction_enroll_sale : public command_auction
+{
+ DWORD get_item_id() { return item; }
+ DWORD get_wisher_id() { return player_id; }
+ int get_sale_price() { return price1; }
+} AuctionEnrollSaleInfo;
+
+typedef struct auction_enroll_wish : public command_auction
+{
+ DWORD get_item_num() { return item; }
+ int get_wish_price() { return price1; }
+} AuctionEnrollWishInfo;
+
+typedef struct auction_bid : public command_auction
+{
+ DWORD get_item_id() { return item; }
+ int get_bid_price() { return price1; }
+} AuctionBidInfo;
+
+typedef struct auction_impur : public command_auction
+{
+ DWORD get_item_id() { return item; }
+} AuctionImpurInfo;
+
+
+//typedef struct get_auction_list
+//
+//bid
+//{
+// item_id;
+// bidder_id;
+// price;
+//}
+//impur
+//{
+// item_id;
+// purchaser_id;
+//}
+//enroll_wish
+//{
+// item_num;
+// wisher_id;
+// wish_price;
+//}
+//enroll_sale
+//{
+// item_id;
+// seller_id;
+// sale_price;
+//}
+//
+//return_packet
+//{
+// isSuccess;
+//}
+//
+//
+//get_auction_simple_item_info_list
+//{
+// auction_type;
+// start_idx;
+// size;
+// conditions; öԲ غ.
+//}
+//
+//get_auction_detail_item_info
+//{
+// item_id;
+//}
+
+
+#endif
+
diff --git a/common/billing.h b/common/billing.h
new file mode 100644
index 0000000..807c0cc
--- /dev/null
+++ b/common/billing.h
@@ -0,0 +1,15 @@
+#ifndef __INC_METIN_II_COMMON_BILLING_H__
+#define __INC_METIN_II_COMMON_BILLING_H__
+
+enum EBillingTypes
+{
+ BILLING_NONE,
+ BILLING_IP_FREE,
+ BILLING_FREE,
+ BILLING_IP_TIME,
+ BILLING_IP_DAY,
+ BILLING_TIME,
+ BILLING_DAY,
+};
+
+#endif
diff --git a/common/building.h b/common/building.h
new file mode 100644
index 0000000..d42af04
--- /dev/null
+++ b/common/building.h
@@ -0,0 +1,63 @@
+#ifndef __METIN_II_COMMON_BUILDING_H__
+#define __METIN_II_COMMON_BUILDING_H__
+
+namespace building
+{
+ enum
+ {
+ OBJECT_MATERIAL_MAX_NUM = 5,
+ };
+
+ typedef struct SLand
+ {
+ DWORD dwID;
+ long lMapIndex;
+ long x, y;
+ long width, height;
+ DWORD dwGuildID;
+ BYTE bGuildLevelLimit;
+ DWORD dwPrice;
+ } TLand;
+
+ typedef struct SObjectMaterial
+ {
+ DWORD dwItemVnum;
+ DWORD dwCount;
+ } TObjectMaterial;
+
+ typedef struct SObjectProto
+ {
+ DWORD dwVnum;
+ DWORD dwPrice;
+
+ TObjectMaterial kMaterials[OBJECT_MATERIAL_MAX_NUM];
+
+ DWORD dwUpgradeVnum;
+ DWORD dwUpgradeLimitTime;
+ long lLife;
+ long lRegion[4];
+
+ DWORD dwNPCVnum;
+ long lNPCX;
+ long lNPCY;
+
+ DWORD dwGroupVnum; // ϳ Ǽ
+ DWORD dwDependOnGroupVnum; // ־ϴ
+ } TObjectProto;
+
+ typedef struct SObject
+ {
+ DWORD dwID;
+ DWORD dwLandID;
+ DWORD dwVnum;
+ long lMapIndex;
+ long x, y;
+
+ float xRot;
+ float yRot;
+ float zRot;
+ long lLife;
+ } TObject;
+};
+
+#endif
diff --git a/common/cache.h b/common/cache.h
new file mode 100644
index 0000000..e4bb759
--- /dev/null
+++ b/common/cache.h
@@ -0,0 +1,69 @@
+#ifndef __INC_COMMON_CACHE_H__
+#define __INC_COMMON_CACHE_H__
+
+template class cache
+{
+ public:
+ cache()
+ : m_bNeedQuery(false), m_expireTime(600), m_lastUpdateTime(0)
+ {
+ m_lastFlushTime = time(0);
+
+ memset( &m_data, 0, sizeof(m_data) );
+ }
+
+ T * Get(bool bUpdateTime = true)
+ {
+ if (bUpdateTime)
+ m_lastUpdateTime = time(0);
+
+ return &m_data;
+ }
+
+ void Put(T * pNew, bool bSkipQuery = false)
+ {
+ thecore_memcpy(&m_data, pNew, sizeof(T));
+ m_lastUpdateTime = time(0);
+
+ if (!bSkipQuery)
+ m_bNeedQuery = true;
+ }
+
+ bool CheckFlushTimeout()
+ {
+ if (m_bNeedQuery && time(0) - m_lastFlushTime > m_expireTime)
+ return true;
+
+ return false;
+ }
+
+ bool CheckTimeout()
+ {
+ if (time(0) - m_lastUpdateTime > m_expireTime)
+ return true;
+
+ return false;
+ }
+
+ void Flush()
+ {
+ if (!m_bNeedQuery)
+ return;
+
+ OnFlush();
+ m_bNeedQuery = false;
+ m_lastFlushTime = time(0);
+ }
+
+ virtual void OnFlush() = 0;
+
+
+ protected:
+ T m_data;
+ bool m_bNeedQuery;
+ time_t m_expireTime;
+ time_t m_lastUpdateTime;
+ time_t m_lastFlushTime;
+};
+
+#endif
diff --git a/common/d3dtype.h b/common/d3dtype.h
new file mode 100644
index 0000000..907b58c
--- /dev/null
+++ b/common/d3dtype.h
@@ -0,0 +1,40 @@
+#ifndef __INC_METIN_II_D3DTYPE_H__
+#define __INC_METIN_II_D3DTYPE_H__
+
+typedef struct D3DXVECTOR2
+{
+ float x, y;
+} D3DXVECTOR2, *LPD3DXVECTOR2;
+
+typedef struct D3DXVECTOR3
+{
+ float x, y, z;
+} D3DXVECTOR3, *LPD3DXVECTOR3;
+
+typedef struct D3DXVECTOR4
+{
+ float x, y, z, w;
+} D3DXVECTOR4, *LPD3DXVECTOR4;
+
+typedef struct D3DXQUATERNION
+{
+ float x, y, z, w;
+} D3DXQUATERNION, *LPD3DXQUATERNION;
+
+typedef struct D3DXCOLOR
+{
+ float r, g, b, a;
+} D3DXCOLOR, *LPD3DXCOLOR;
+
+typedef struct _D3DCOLORVALUE
+{
+ float r;
+ float g;
+ float b;
+ float a;
+} D3DCOLORVALUE;
+
+typedef D3DXVECTOR3 D3DVECTOR;
+
+#endif
+
diff --git a/common/item_length.h b/common/item_length.h
new file mode 100644
index 0000000..2f44961
--- /dev/null
+++ b/common/item_length.h
@@ -0,0 +1,371 @@
+#ifndef __INC_METIN2_ITEM_LENGTH_H__
+#define __INC_METIN2_ITEM_LENGTH_H__
+
+enum EItemMisc
+{
+ ITEM_NAME_MAX_LEN = 24,
+ ITEM_VALUES_MAX_NUM = 6,
+ ITEM_SMALL_DESCR_MAX_LEN = 256,
+ ITEM_LIMIT_MAX_NUM = 2,
+ ITEM_APPLY_MAX_NUM = 3,
+ ITEM_SOCKET_MAX_NUM = 3,
+ ITEM_MAX_COUNT = 200,
+ ITEM_ATTRIBUTE_MAX_NUM = 7,
+ ITEM_ATTRIBUTE_MAX_LEVEL = 5,
+ ITEM_AWARD_WHY_MAX_LEN = 50,
+
+ REFINE_MATERIAL_MAX_NUM = 5,
+
+ ITEM_ELK_VNUM = 50026,
+};
+
+const BYTE ITEM_SOCKET_REMAIN_SEC = 0;
+enum EItemValueIdice
+{
+ ITEM_VALUE_DRAGON_SOUL_POLL_OUT_BONUS_IDX = 0,
+ ITEM_VALUE_CHARGING_AMOUNT_IDX = 0,
+ ITEM_VALUE_SECONDARY_COIN_UNIT_IDX = 0,
+};
+enum EItemDragonSoulSockets
+{
+ ITEM_SOCKET_DRAGON_SOUL_ACTIVE_IDX = 2,
+ ITEM_SOCKET_CHARGING_AMOUNT_IDX = 2,
+};
+// ̰ ģ ƴϾ?
+// ߿ Ȯϸ ¼ -_-;;;
+enum EItemUniqueSockets
+{
+ ITEM_SOCKET_UNIQUE_SAVE_TIME = ITEM_SOCKET_MAX_NUM - 2,
+ ITEM_SOCKET_UNIQUE_REMAIN_TIME = ITEM_SOCKET_MAX_NUM - 1
+};
+
+enum EItemTypes
+{
+ ITEM_NONE, //0
+ ITEM_WEAPON, //1//
+ ITEM_ARMOR, //2//
+ ITEM_USE, //3//
+ ITEM_AUTOUSE, //4
+ ITEM_MATERIAL, //5
+ ITEM_SPECIAL, //6 //
+ ITEM_TOOL, //7
+ ITEM_LOTTERY, //8//
+ ITEM_ELK, //9//
+ ITEM_METIN, //10
+ ITEM_CONTAINER, //11
+ ITEM_FISH, //12//
+ ITEM_ROD, //13
+ ITEM_RESOURCE, //14
+ ITEM_CAMPFIRE, //15
+ ITEM_UNIQUE, //16
+ ITEM_SKILLBOOK, //17
+ ITEM_QUEST, //18
+ ITEM_POLYMORPH, //19
+ ITEM_TREASURE_BOX, //20//
+ ITEM_TREASURE_KEY, //21//
+ ITEM_SKILLFORGET, //22
+ ITEM_GIFTBOX, //23
+ ITEM_PICK, //24
+ ITEM_HAIR, //25//Ӹ
+ ITEM_TOTEM, //26//
+ ITEM_BLEND, //27//ɶ ϰ Ӽ ٴ
+ ITEM_COSTUME, //28//ڽ (2011 8 ߰ ڽ ýۿ )
+ ITEM_DS, //29 //ȥ
+ ITEM_SPECIAL_DS, //30 // Ư ȥ (DS_SLOT ϴ UNIQUE ̶ ϸ )
+ ITEM_EXTRACT, //31 .
+ ITEM_SECONDARY_COIN, //32 ?? ??
+ ITEM_RING, //33
+ ITEM_BELT, //34 Ʈ
+};
+
+enum EMetinSubTypes
+{
+ METIN_NORMAL,
+ METIN_GOLD,
+};
+
+enum EWeaponSubTypes
+{
+ WEAPON_SWORD,
+ WEAPON_DAGGER,
+ WEAPON_BOW,
+ WEAPON_TWO_HANDED,
+ WEAPON_BELL,
+ WEAPON_FAN,
+ WEAPON_ARROW,
+ WEAPON_MOUNT_SPEAR,
+ WEAPON_NUM_TYPES,
+};
+
+enum EArmorSubTypes
+{
+ ARMOR_BODY,
+ ARMOR_HEAD,
+ ARMOR_SHIELD,
+ ARMOR_WRIST,
+ ARMOR_FOOTS,
+ ARMOR_NECK,
+ ARMOR_EAR,
+ ARMOR_NUM_TYPES
+};
+
+enum ECostumeSubTypes
+{
+ COSTUME_BODY = ARMOR_BODY, // [߿!!] ECostumeSubTypes enum value EArmorSubTypes װͰ ƾ .
+ COSTUME_HAIR = ARMOR_HEAD, // ̴ ڽ ۿ ߰ Ӽ ̰ڴٴ û Ȱϱ .
+ COSTUME_NUM_TYPES,
+};
+
+enum EDragonSoulSubType
+{
+ DS_SLOT1,
+ DS_SLOT2,
+ DS_SLOT3,
+ DS_SLOT4,
+ DS_SLOT5,
+ DS_SLOT6,
+ DS_SLOT_MAX,
+};
+
+enum EDragonSoulGradeTypes
+{
+ DRAGON_SOUL_GRADE_NORMAL,
+ DRAGON_SOUL_GRADE_BRILLIANT,
+ DRAGON_SOUL_GRADE_RARE,
+ DRAGON_SOUL_GRADE_ANCIENT,
+ DRAGON_SOUL_GRADE_LEGENDARY,
+ DRAGON_SOUL_GRADE_MAX,
+
+};
+
+enum EDragonSoulStepTypes
+{
+ DRAGON_SOUL_STEP_LOWEST,
+ DRAGON_SOUL_STEP_LOW,
+ DRAGON_SOUL_STEP_MID,
+ DRAGON_SOUL_STEP_HIGH,
+ DRAGON_SOUL_STEP_HIGHEST,
+ DRAGON_SOUL_STEP_MAX,
+};
+#define DRAGON_SOUL_STRENGTH_MAX 7
+
+enum EDSInventoryMaxNum
+{
+ DRAGON_SOUL_INVENTORY_MAX_NUM = DS_SLOT_MAX * DRAGON_SOUL_GRADE_MAX * DRAGON_SOUL_BOX_SIZE,
+};
+
+enum EFishSubTypes
+{
+ FISH_ALIVE,
+ FISH_DEAD,
+};
+
+enum EResourceSubTypes
+{
+ RESOURCE_FISHBONE,
+ RESOURCE_WATERSTONEPIECE,
+ RESOURCE_WATERSTONE,
+ RESOURCE_BLOOD_PEARL,
+ RESOURCE_BLUE_PEARL,
+ RESOURCE_WHITE_PEARL,
+ RESOURCE_BUCKET,
+ RESOURCE_CRYSTAL,
+ RESOURCE_GEM,
+ RESOURCE_STONE,
+ RESOURCE_METIN,
+ RESOURCE_ORE,
+};
+
+enum EUniqueSubTypes
+{
+ UNIQUE_NONE,
+ UNIQUE_BOOK,
+ UNIQUE_SPECIAL_RIDE,
+ UNIQUE_SPECIAL_MOUNT_RIDE,
+};
+
+enum EUseSubTypes
+{
+ USE_POTION, // 0
+ USE_TALISMAN,
+ USE_TUNING,
+ USE_MOVE,
+ USE_TREASURE_BOX,
+ USE_MONEYBAG,
+ USE_BAIT,
+ USE_ABILITY_UP,
+ USE_AFFECT,
+ USE_CREATE_STONE,
+ USE_SPECIAL, // 10
+ USE_POTION_NODELAY,
+ USE_CLEAR,
+ USE_INVISIBILITY,
+ USE_DETACHMENT,
+ USE_BUCKET,
+ USE_POTION_CONTINUE,
+ USE_CLEAN_SOCKET,
+ USE_CHANGE_ATTRIBUTE,
+ USE_ADD_ATTRIBUTE,
+ USE_ADD_ACCESSORY_SOCKET, // 20
+ USE_PUT_INTO_ACCESSORY_SOCKET,
+ USE_ADD_ATTRIBUTE2,
+ USE_RECIPE,
+ USE_CHANGE_ATTRIBUTE2,
+ USE_BIND,
+ USE_UNBIND,
+ USE_TIME_CHARGE_PER,
+ USE_TIME_CHARGE_FIX, // 28
+ USE_PUT_INTO_BELT_SOCKET, // 29 Ʈ Ͽ ִ
+ USE_PUT_INTO_RING_SOCKET, // 30 Ͽ ִ (ũ , ߰ )
+};
+
+enum EExtractSubTypes
+{
+ EXTRACT_DRAGON_SOUL,
+ EXTRACT_DRAGON_HEART,
+};
+
+enum EAutoUseSubTypes
+{
+ AUTOUSE_POTION,
+ AUTOUSE_ABILITY_UP,
+ AUTOUSE_BOMB,
+ AUTOUSE_GOLD,
+ AUTOUSE_MONEYBAG,
+ AUTOUSE_TREASURE_BOX
+};
+
+enum EMaterialSubTypes
+{
+ MATERIAL_LEATHER,
+ MATERIAL_BLOOD,
+ MATERIAL_ROOT,
+ MATERIAL_NEEDLE,
+ MATERIAL_JEWEL,
+ MATERIAL_DS_REFINE_NORMAL,
+ MATERIAL_DS_REFINE_BLESSED,
+ MATERIAL_DS_REFINE_HOLLY,
+};
+
+enum ESpecialSubTypes
+{
+ SPECIAL_MAP,
+ SPECIAL_KEY,
+ SPECIAL_DOC,
+ SPECIAL_SPIRIT,
+};
+
+enum EToolSubTypes
+{
+ TOOL_FISHING_ROD
+};
+
+enum ELotterySubTypes
+{
+ LOTTERY_TICKET,
+ LOTTERY_INSTANT
+};
+
+enum EItemFlag
+{
+ ITEM_FLAG_REFINEABLE = (1 << 0),
+ ITEM_FLAG_SAVE = (1 << 1),
+ ITEM_FLAG_STACKABLE = (1 << 2), // ĥ
+ ITEM_FLAG_COUNT_PER_1GOLD = (1 << 3),
+ ITEM_FLAG_SLOW_QUERY = (1 << 4),
+ ITEM_FLAG_UNUSED01 = (1 << 5), // UNUSED
+ ITEM_FLAG_UNIQUE = (1 << 6),
+ ITEM_FLAG_MAKECOUNT = (1 << 7),
+ ITEM_FLAG_IRREMOVABLE = (1 << 8),
+ ITEM_FLAG_CONFIRM_WHEN_USE = (1 << 9),
+ ITEM_FLAG_QUEST_USE = (1 << 10),
+ ITEM_FLAG_QUEST_USE_MULTIPLE = (1 << 11),
+ ITEM_FLAG_QUEST_GIVE = (1 << 12),
+ ITEM_FLAG_LOG = (1 << 13),
+ ITEM_FLAG_APPLICABLE = (1 << 14),
+};
+
+enum EItemAntiFlag
+{
+ ITEM_ANTIFLAG_FEMALE = (1 << 0), // Ұ
+ ITEM_ANTIFLAG_MALE = (1 << 1), // Ұ
+ ITEM_ANTIFLAG_WARRIOR = (1 << 2), // Ұ
+ ITEM_ANTIFLAG_ASSASSIN = (1 << 3), // ڰ Ұ
+ ITEM_ANTIFLAG_SURA = (1 << 4), // Ұ
+ ITEM_ANTIFLAG_SHAMAN = (1 << 5), // Ұ
+ ITEM_ANTIFLAG_GET = (1 << 6), //
+ ITEM_ANTIFLAG_DROP = (1 << 7), //
+ ITEM_ANTIFLAG_SELL = (1 << 8), //
+ ITEM_ANTIFLAG_EMPIRE_A = (1 << 9), // A Ұ
+ ITEM_ANTIFLAG_EMPIRE_B = (1 << 10), // B Ұ
+ ITEM_ANTIFLAG_EMPIRE_C = (1 << 11), // C Ұ
+ ITEM_ANTIFLAG_SAVE = (1 << 12), //
+ ITEM_ANTIFLAG_GIVE = (1 << 13), // ŷ Ұ
+ ITEM_ANTIFLAG_PKDROP = (1 << 14), // PK
+ ITEM_ANTIFLAG_STACK = (1 << 15), // ĥ
+ ITEM_ANTIFLAG_MYSHOP = (1 << 16), // ø
+ ITEM_ANTIFLAG_SAFEBOX = (1 << 17), // â
+};
+
+enum EItemWearableFlag
+{
+ WEARABLE_BODY = (1 << 0),
+ WEARABLE_HEAD = (1 << 1),
+ WEARABLE_FOOTS = (1 << 2),
+ WEARABLE_WRIST = (1 << 3),
+ WEARABLE_WEAPON = (1 << 4),
+ WEARABLE_NECK = (1 << 5),
+ WEARABLE_EAR = (1 << 6),
+ WEARABLE_UNIQUE = (1 << 7),
+ WEARABLE_SHIELD = (1 << 8),
+ WEARABLE_ARROW = (1 << 9),
+ WEARABLE_HAIR = (1 << 10),
+ WEARABLE_ABILITY = (1 << 11),
+ WEARABLE_COSTUME_BODY = (1 << 12),
+};
+
+enum ELimitTypes
+{
+ LIMIT_NONE,
+
+ LIMIT_LEVEL,
+ LIMIT_STR,
+ LIMIT_DEX,
+ LIMIT_INT,
+ LIMIT_CON,
+ LIMIT_PCBANG,
+
+ /// ο ǽð ð (socket0 Ҹ ð : unix_timestamp Ÿ)
+ LIMIT_REAL_TIME,
+
+ /// ó (Ȥ ) Ÿ Ÿ̸
+ /// socket0 밡ɽð(ʴ, 0̸ limit value ) ִٰ
+ /// socket1 Ƚ socket0 unix_timestamp Ÿ Ҹð .
+ LIMIT_REAL_TIME_START_FIRST_USE,
+
+ /// ð Ǵ
+ /// socket0 ð ʴ . ( ش 0̸ limit value socket0 )
+ LIMIT_TIMER_BASED_ON_WEAR,
+
+ LIMIT_MAX_NUM
+};
+
+enum EAttrAddonTypes
+{
+ ATTR_ADDON_NONE,
+ // positive values are reserved for set
+ ATTR_DAMAGE_ADDON = -1,
+};
+
+enum ERefineType
+{
+ REFINE_TYPE_NORMAL,
+ REFINE_TYPE_NOT_USED1,
+ REFINE_TYPE_SCROLL,
+ REFINE_TYPE_HYUNIRON,
+ REFINE_TYPE_MONEY_ONLY,
+ REFINE_TYPE_MUSIN,
+ REFINE_TYPE_BDRAGON,
+};
+
+#endif
diff --git a/common/length.h b/common/length.h
new file mode 100644
index 0000000..90782cc
--- /dev/null
+++ b/common/length.h
@@ -0,0 +1,788 @@
+#ifndef __INC_METIN_II_LENGTH_H__
+#define __INC_METIN_II_LENGTH_H__
+
+#define WORD_MAX 0xffff
+enum EMisc
+{
+ MAX_HOST_LENGTH = 15,
+ IP_ADDRESS_LENGTH = 15,
+ LOGIN_MAX_LEN = 30,
+ PASSWD_MAX_LEN = 16,
+ PLAYER_PER_ACCOUNT = 4,
+ ACCOUNT_STATUS_MAX_LEN = 8,
+ CHARACTER_NAME_MAX_LEN = 24,
+ SHOP_SIGN_MAX_LEN = 32,
+ INVENTORY_MAX_NUM = 90,
+ ABILITY_MAX_NUM = 50,
+ EMPIRE_MAX_NUM = 4,
+ BANWORD_MAX_LEN = 24,
+ SMS_MAX_LEN = 80,
+ MOBILE_MAX_LEN = 32,
+ SOCIAL_ID_MAX_LEN = 18,
+
+ GUILD_NAME_MAX_LEN = 12,
+
+ SHOP_HOST_ITEM_MAX_NUM = 40, /* ȣƮ ִ */
+ SHOP_GUEST_ITEM_MAX_NUM = 18, /* ԽƮ ִ */
+
+ SHOP_PRICELIST_MAX_NUM = 40, ///< λ Ʈ ִ
+
+ CHAT_MAX_LEN = 512,
+
+ QUICKSLOT_MAX_NUM = 36,
+
+ JOURNAL_MAX_NUM = 2,
+
+ QUERY_MAX_LEN = 8192,
+
+ FILE_MAX_LEN = 128,
+
+ PLAYER_EXP_TABLE_MAX = 120,
+ PLAYER_MAX_LEVEL_CONST = 120,
+
+ GUILD_MAX_LEVEL = 20,
+ MOB_MAX_LEVEL = 100,
+
+ ATTRIBUTE_MAX_VALUE = 20,
+ CHARACTER_PATH_MAX_NUM = 64,
+ SKILL_MAX_NUM = 255,
+ SKILLBOOK_DELAY_MIN = 64800,
+ SKILLBOOK_DELAY_MAX = 108000,
+ SKILL_MAX_LEVEL = 40,
+
+ APPLY_NAME_MAX_LEN = 32,
+ EVENT_FLAG_NAME_MAX_LEN = 32,
+
+ MOB_SKILL_MAX_NUM = 5,
+
+ POINT_MAX_NUM = 255,
+ DRAGON_SOUL_BOX_SIZE = 32,
+ DRAGON_SOUL_BOX_COLUMN_NUM = 8,
+ DRAGON_SOUL_BOX_ROW_NUM = DRAGON_SOUL_BOX_SIZE / DRAGON_SOUL_BOX_COLUMN_NUM,
+ DRAGON_SOUL_REFINE_GRID_SIZE = 15,
+ MAX_AMOUNT_OF_MALL_BONUS = 20,
+
+ WEAR_MAX_NUM = 32,
+
+ //LIMIT_GOLD
+ GOLD_MAX = 2000000000,
+
+ MAX_PASSPOD = 8 ,
+
+
+ //END_LIMIT_GOLD
+
+ OPENID_AUTHKEY_LEN = 32,
+
+ SHOP_TAB_NAME_MAX = 32,
+ SHOP_TAB_COUNT_MAX = 3,
+
+ BELT_INVENTORY_SLOT_WIDTH = 4,
+ BELT_INVENTORY_SLOT_HEIGHT= 4,
+
+ BELT_INVENTORY_SLOT_COUNT = BELT_INVENTORY_SLOT_WIDTH * BELT_INVENTORY_SLOT_HEIGHT,
+
+
+/**
+ **** Ҵ (DB Item Position) ****
+ +------------------------------------------------------+ 0
+ | ij ⺻ κ丮 (45ĭ * 2) 90ĭ |
+ +------------------------------------------------------+ 90 = INVENTORY_MAX_NUM(90)
+ | ij â ( ) 32ĭ |
+ +------------------------------------------------------+ 122 = INVENTORY_MAX_NUM(90) + WEAR_MAX_NUM(32)
+ | ȥ â ( ȥ) 12ĭ |
+ +------------------------------------------------------+ 134 = 122 + DS_SLOT_MAX(6) * DRAGON_SOUL_DECK_MAX_NUM(2)
+ | ȥ â ( ̻) 18ĭ |
+ +------------------------------------------------------+ 152 = 134 + DS_SLOT_MAX(6) * DRAGON_SOUL_DECK_RESERVED_MAX_NUM(3)
+ | Ʈ κ丮 (Ʈ ÿ Ʈ Ȱ)|
+ +------------------------------------------------------+ 168 = 152 + BELT_INVENTORY_SLOT_COUNT(16) = INVENTORY_AND_EQUIP_CELL_MAX
+ | ̻ |
+ +------------------------------------------------------+ ??
+*/
+};
+
+enum EMatrixCard
+{
+ MATRIX_CODE_MAX_LEN = 192,
+ MATRIX_ANSWER_MAX_LEN = 8,
+};
+
+enum EWearPositions
+{
+ WEAR_BODY, // 0
+ WEAR_HEAD, // 1
+ WEAR_FOOTS, // 2
+ WEAR_WRIST, // 3
+ WEAR_WEAPON, // 4
+ WEAR_NECK, // 5
+ WEAR_EAR, // 6
+ WEAR_UNIQUE1, // 7
+ WEAR_UNIQUE2, // 8
+ WEAR_ARROW, // 9
+ WEAR_SHIELD, // 10
+ WEAR_ABILITY1, // 11
+ WEAR_ABILITY2, // 12
+ WEAR_ABILITY3, // 13
+ WEAR_ABILITY4, // 14
+ WEAR_ABILITY5, // 15
+ WEAR_ABILITY6, // 16
+ WEAR_ABILITY7, // 17
+ WEAR_ABILITY8, // 18
+ WEAR_COSTUME_BODY, // 19
+ WEAR_COSTUME_HAIR, // 20
+
+ WEAR_RING1, // 21 : ű 1 ()
+ WEAR_RING2, // 22 : ű 2 ()
+
+ WEAR_BELT, // 23 : ű Ʈ
+
+ WEAR_MAX = 32 //
+};
+
+enum EDragonSoulDeckType
+{
+ DRAGON_SOUL_DECK_0,
+ DRAGON_SOUL_DECK_1,
+ DRAGON_SOUL_DECK_MAX_NUM = 2,
+
+ DRAGON_SOUL_DECK_RESERVED_MAX_NUM = 3, // NOTE: ߿! , 3 з . DS DECK ø ݵ ŭ RESERVED ؾ !
+};
+
+enum ESex
+{
+ SEX_MALE,
+ SEX_FEMALE
+};
+
+enum EDirection
+{
+ DIR_NORTH,
+ DIR_NORTHEAST,
+ DIR_EAST,
+ DIR_SOUTHEAST,
+ DIR_SOUTH,
+ DIR_SOUTHWEST,
+ DIR_WEST,
+ DIR_NORTHWEST,
+ DIR_MAX_NUM
+};
+
+#define ABILITY_MAX_LEVEL 10 /* ִ */
+
+enum EAbilityDifficulty
+{
+ DIFFICULTY_EASY,
+ DIFFICULTY_NORMAL,
+ DIFFICULTY_HARD,
+ DIFFICULTY_VERY_HARD,
+ DIFFICULTY_NUM_TYPES
+};
+
+enum EAbilityCategory
+{
+ CATEGORY_PHYSICAL, /* ü Ƽ */
+ CATEGORY_MENTAL, /* Ƽ */
+ CATEGORY_ATTRIBUTE, /* ɷ Ƽ */
+ CATEGORY_NUM_TYPES
+};
+
+enum EJobs
+{
+ JOB_WARRIOR,
+ JOB_ASSASSIN,
+ JOB_SURA,
+ JOB_SHAMAN,
+ JOB_MAX_NUM
+};
+
+enum ESkillGroups
+{
+ SKILL_GROUP_MAX_NUM = 2,
+};
+
+enum ERaceFlags
+{
+ RACE_FLAG_ANIMAL = (1 << 0),
+ RACE_FLAG_UNDEAD = (1 << 1),
+ RACE_FLAG_DEVIL = (1 << 2),
+ RACE_FLAG_HUMAN = (1 << 3),
+ RACE_FLAG_ORC = (1 << 4),
+ RACE_FLAG_MILGYO = (1 << 5),
+ RACE_FLAG_INSECT = (1 << 6),
+ RACE_FLAG_FIRE = (1 << 7),
+ RACE_FLAG_ICE = (1 << 8),
+ RACE_FLAG_DESERT = (1 << 9),
+ RACE_FLAG_TREE = (1 << 10),
+ RACE_FLAG_ATT_ELEC = (1 << 11),
+ RACE_FLAG_ATT_FIRE = (1 << 12),
+ RACE_FLAG_ATT_ICE = (1 << 13),
+ RACE_FLAG_ATT_WIND = (1 << 14),
+ RACE_FLAG_ATT_EARTH = (1 << 15),
+ RACE_FLAG_ATT_DARK = (1 << 16),
+};
+
+enum ELoads
+{
+ LOAD_NONE,
+ LOAD_LIGHT,
+ LOAD_NORMAL,
+ LOAD_HEAVY,
+ LOAD_MASSIVE
+};
+
+enum
+{
+ QUICKSLOT_TYPE_NONE,
+ QUICKSLOT_TYPE_ITEM,
+ QUICKSLOT_TYPE_SKILL,
+ QUICKSLOT_TYPE_COMMAND,
+ QUICKSLOT_TYPE_MAX_NUM,
+};
+
+enum EParts
+{
+ PART_MAIN,
+ PART_WEAPON,
+ PART_HEAD,
+ PART_HAIR,
+
+ PART_MAX_NUM,
+ PART_WEAPON_SUB,
+};
+
+enum EChatType
+{
+ CHAT_TYPE_TALKING, /* ׳ ä */
+ CHAT_TYPE_INFO, /* ( , ġ . ) */
+ CHAT_TYPE_NOTICE, /* */
+ CHAT_TYPE_PARTY, /* Ƽ */
+ CHAT_TYPE_GUILD, /* 帻 */
+ CHAT_TYPE_COMMAND, /* Ϲ */
+ CHAT_TYPE_SHOUT, /* ġ */
+ CHAT_TYPE_WHISPER,
+ CHAT_TYPE_BIG_NOTICE,
+ CHAT_TYPE_MONARCH_NOTICE,
+ CHAT_TYPE_MAX_NUM
+};
+
+enum EWhisperType
+{
+ WHISPER_TYPE_NORMAL = 0,
+ WHISPER_TYPE_NOT_EXIST = 1,
+ WHISPER_TYPE_TARGET_BLOCKED = 2,
+ WHISPER_TYPE_SENDER_BLOCKED = 3,
+ WHISPER_TYPE_ERROR = 4,
+ WHISPER_TYPE_GM = 5,
+ WHISPER_TYPE_SYSTEM = 0xFF
+};
+
+enum ECharacterPosition
+{
+ POSITION_GENERAL,
+ POSITION_BATTLE,
+ POSITION_DYING,
+ POSITION_SITTING_CHAIR,
+ POSITION_SITTING_GROUND,
+ POSITION_INTRO,
+ POSITION_MAX_NUM
+};
+
+enum EGMLevels
+{
+ GM_PLAYER,
+ GM_LOW_WIZARD,
+ GM_WIZARD,
+ GM_HIGH_WIZARD,
+ GM_GOD,
+ GM_IMPLEMENTOR
+};
+
+enum EMobRank
+{
+ MOB_RANK_PAWN,
+ MOB_RANK_S_PAWN,
+ MOB_RANK_KNIGHT,
+ MOB_RANK_S_KNIGHT,
+ MOB_RANK_BOSS,
+ MOB_RANK_KING,
+ MOB_RANK_MAX_NUM
+};
+
+enum ECharType
+{
+ CHAR_TYPE_MONSTER,
+ CHAR_TYPE_NPC,
+ CHAR_TYPE_STONE,
+ CHAR_TYPE_WARP,
+ CHAR_TYPE_DOOR,
+ CHAR_TYPE_BUILDING,
+ CHAR_TYPE_PC,
+ CHAR_TYPE_POLYMORPH_PC,
+ CHAR_TYPE_HORSE,
+ CHAR_TYPE_GOTO
+};
+
+enum EBattleType
+{
+ BATTLE_TYPE_MELEE,
+ BATTLE_TYPE_RANGE,
+ BATTLE_TYPE_MAGIC,
+ BATTLE_TYPE_SPECIAL,
+ BATTLE_TYPE_POWER,
+ BATTLE_TYPE_TANKER,
+ BATTLE_TYPE_SUPER_POWER,
+ BATTLE_TYPE_SUPER_TANKER,
+ BATTLE_TYPE_MAX_NUM
+};
+
+enum EApplyTypes
+{
+ APPLY_NONE, // 0
+ APPLY_MAX_HP, // 1
+ APPLY_MAX_SP, // 2
+ APPLY_CON, // 3
+ APPLY_INT, // 4
+ APPLY_STR, // 5
+ APPLY_DEX, // 6
+ APPLY_ATT_SPEED, // 7
+ APPLY_MOV_SPEED, // 8
+ APPLY_CAST_SPEED, // 9
+ APPLY_HP_REGEN, // 10
+ APPLY_SP_REGEN, // 11
+ APPLY_POISON_PCT, // 12
+ APPLY_STUN_PCT, // 13
+ APPLY_SLOW_PCT, // 14
+ APPLY_CRITICAL_PCT, // 15
+ APPLY_PENETRATE_PCT, // 16
+ APPLY_ATTBONUS_HUMAN, // 17
+ APPLY_ATTBONUS_ANIMAL, // 18
+ APPLY_ATTBONUS_ORC, // 19
+ APPLY_ATTBONUS_MILGYO, // 20
+ APPLY_ATTBONUS_UNDEAD, // 21
+ APPLY_ATTBONUS_DEVIL, // 22
+ APPLY_STEAL_HP, // 23
+ APPLY_STEAL_SP, // 24
+ APPLY_MANA_BURN_PCT, // 25
+ APPLY_DAMAGE_SP_RECOVER, // 26
+ APPLY_BLOCK, // 27
+ APPLY_DODGE, // 28
+ APPLY_RESIST_SWORD, // 29
+ APPLY_RESIST_TWOHAND, // 30
+ APPLY_RESIST_DAGGER, // 31
+ APPLY_RESIST_BELL, // 32
+ APPLY_RESIST_FAN, // 33
+ APPLY_RESIST_BOW, // 34
+ APPLY_RESIST_FIRE, // 35
+ APPLY_RESIST_ELEC, // 36
+ APPLY_RESIST_MAGIC, // 37
+ APPLY_RESIST_WIND, // 38
+ APPLY_REFLECT_MELEE, // 39
+ APPLY_REFLECT_CURSE, // 40
+ APPLY_POISON_REDUCE, // 41
+ APPLY_KILL_SP_RECOVER, // 42
+ APPLY_EXP_DOUBLE_BONUS, // 43
+ APPLY_GOLD_DOUBLE_BONUS, // 44
+ APPLY_ITEM_DROP_BONUS, // 45
+ APPLY_POTION_BONUS, // 46
+ APPLY_KILL_HP_RECOVER, // 47
+ APPLY_IMMUNE_STUN, // 48
+ APPLY_IMMUNE_SLOW, // 49
+ APPLY_IMMUNE_FALL, // 50
+ APPLY_SKILL, // 51
+ APPLY_BOW_DISTANCE, // 52
+ APPLY_ATT_GRADE_BONUS, // 53
+ APPLY_DEF_GRADE_BONUS, // 54
+ APPLY_MAGIC_ATT_GRADE, // 55
+ APPLY_MAGIC_DEF_GRADE, // 56
+ APPLY_CURSE_PCT, // 57
+ APPLY_MAX_STAMINA, // 58
+ APPLY_ATTBONUS_WARRIOR, // 59
+ APPLY_ATTBONUS_ASSASSIN, // 60
+ APPLY_ATTBONUS_SURA, // 61
+ APPLY_ATTBONUS_SHAMAN, // 62
+ APPLY_ATTBONUS_MONSTER, // 63
+ APPLY_MALL_ATTBONUS, // 64 ݷ +x%
+ APPLY_MALL_DEFBONUS, // 65 +x%
+ APPLY_MALL_EXPBONUS, // 66 ġ +x%
+ APPLY_MALL_ITEMBONUS, // 67 x/10
+ APPLY_MALL_GOLDBONUS, // 68 x/10
+ APPLY_MAX_HP_PCT, // 69 ִ +x%
+ APPLY_MAX_SP_PCT, // 70 ִ ŷ +x%
+ APPLY_SKILL_DAMAGE_BONUS, // 71 ų * (100+x)%
+ APPLY_NORMAL_HIT_DAMAGE_BONUS, // 72 Ÿ * (100+x)%
+ APPLY_SKILL_DEFEND_BONUS, // 73 ų * (100-x)%
+ APPLY_NORMAL_HIT_DEFEND_BONUS, // 74 Ÿ * (100-x)%
+ APPLY_PC_BANG_EXP_BONUS, // 75 PC EXP ʽ
+ APPLY_PC_BANG_DROP_BONUS, // 76 PC ʽ
+
+ APPLY_EXTRACT_HP_PCT, // 77 HP Ҹ
+
+ APPLY_RESIST_WARRIOR, // 78 翡
+ APPLY_RESIST_ASSASSIN, // 79 ڰ
+ APPLY_RESIST_SURA, // 80
+ APPLY_RESIST_SHAMAN, // 81 翡
+ APPLY_ENERGY, // 82
+ APPLY_DEF_GRADE, // 83 . DEF_GRADE_BONUS Ŭ ι ǵ (...) ִ.
+ APPLY_COSTUME_ATTR_BONUS, // 84 ڽƬ ۿ Ӽġ ʽ
+ APPLY_MAGIC_ATTBONUS_PER, // 85 ݷ +x%
+ APPLY_MELEE_MAGIC_ATTBONUS_PER, // 86 + и ݷ +x%
+
+ APPLY_RESIST_ICE, // 87 ñ
+ APPLY_RESIST_EARTH, // 88
+ APPLY_RESIST_DARK, // 89
+
+ APPLY_ANTI_CRITICAL_PCT, //90 ũƼ
+ APPLY_ANTI_PENETRATE_PCT, //91 Ÿ
+
+
+ MAX_APPLY_NUM, //
+};
+
+enum EOnClickEvents
+{
+ ON_CLICK_NONE,
+ ON_CLICK_SHOP,
+ ON_CLICK_TALK,
+ ON_CLICK_MAX_NUM
+};
+
+enum EOnIdleEvents
+{
+ ON_IDLE_NONE,
+ ON_IDLE_GENERAL,
+ ON_IDLE_MAX_NUM
+};
+
+enum EWindows
+{
+ RESERVED_WINDOW,
+ INVENTORY,
+ EQUIPMENT,
+ SAFEBOX,
+ MALL,
+ DRAGON_SOUL_INVENTORY,
+ BELT_INVENTORY,
+#ifdef __AUCTION__
+ AUCTION,
+#endif
+ GROUND
+};
+
+enum EMobSizes
+{
+ MOBSIZE_RESERVED,
+ MOBSIZE_SMALL,
+ MOBSIZE_MEDIUM,
+ MOBSIZE_BIG
+};
+
+enum EAIFlags
+{
+ AIFLAG_AGGRESSIVE = (1 << 0),
+ AIFLAG_NOMOVE = (1 << 1),
+ AIFLAG_COWARD = (1 << 2),
+ AIFLAG_NOATTACKSHINSU = (1 << 3),
+ AIFLAG_NOATTACKJINNO = (1 << 4),
+ AIFLAG_NOATTACKCHUNJO = (1 << 5),
+ AIFLAG_ATTACKMOB = (1 << 6 ),
+ AIFLAG_BERSERK = (1 << 7),
+ AIFLAG_STONESKIN = (1 << 8),
+ AIFLAG_GODSPEED = (1 << 9),
+ AIFLAG_DEATHBLOW = (1 << 10),
+ AIFLAG_REVIVE = (1 << 11),
+};
+
+enum EMobStatType
+{
+ MOB_STATTYPE_POWER,
+ MOB_STATTYPE_TANKER,
+ MOB_STATTYPE_SUPER_POWER,
+ MOB_STATTYPE_SUPER_TANKER,
+ MOB_STATTYPE_RANGE,
+ MOB_STATTYPE_MAGIC,
+ MOB_STATTYPE_MAX_NUM
+};
+
+enum EImmuneFlags
+{
+ IMMUNE_STUN = (1 << 0),
+ IMMUNE_SLOW = (1 << 1),
+ IMMUNE_FALL = (1 << 2),
+ IMMUNE_CURSE = (1 << 3),
+ IMMUNE_POISON = (1 << 4),
+ IMMUNE_TERROR = (1 << 5),
+ IMMUNE_REFLECT = (1 << 6),
+};
+
+enum EMobEnchants
+{
+ MOB_ENCHANT_CURSE,
+ MOB_ENCHANT_SLOW,
+ MOB_ENCHANT_POISON,
+ MOB_ENCHANT_STUN,
+ MOB_ENCHANT_CRITICAL,
+ MOB_ENCHANT_PENETRATE,
+ MOB_ENCHANTS_MAX_NUM
+};
+
+enum EMobResists
+{
+ MOB_RESIST_SWORD,
+ MOB_RESIST_TWOHAND,
+ MOB_RESIST_DAGGER,
+ MOB_RESIST_BELL,
+ MOB_RESIST_FAN,
+ MOB_RESIST_BOW,
+ MOB_RESIST_FIRE,
+ MOB_RESIST_ELECT,
+ MOB_RESIST_MAGIC,
+ MOB_RESIST_WIND,
+ MOB_RESIST_POISON,
+ MOB_RESISTS_MAX_NUM
+};
+
+enum
+{
+ SKILL_ATTR_TYPE_NORMAL = 1,
+ SKILL_ATTR_TYPE_MELEE,
+ SKILL_ATTR_TYPE_RANGE,
+ SKILL_ATTR_TYPE_MAGIC
+ /*
+ SKILL_ATTR_TYPE_FIRE,
+ SKILL_ATTR_TYPE_ICE,
+ SKILL_ATTR_TYPE_ELEC,
+ SKILL_ATTR_TYPE_DARK,
+ */
+};
+
+enum
+{
+ SKILL_NORMAL,
+ SKILL_MASTER,
+ SKILL_GRAND_MASTER,
+ SKILL_PERFECT_MASTER,
+};
+
+enum EGuildWarType
+{
+ GUILD_WAR_TYPE_FIELD,
+ GUILD_WAR_TYPE_BATTLE,
+ GUILD_WAR_TYPE_FLAG,
+ GUILD_WAR_TYPE_MAX_NUM
+};
+
+enum EGuildWarState
+{
+ GUILD_WAR_NONE,
+ GUILD_WAR_SEND_DECLARE,
+ GUILD_WAR_REFUSE,
+ GUILD_WAR_RECV_DECLARE,
+ GUILD_WAR_WAIT_START,
+ GUILD_WAR_CANCEL,
+ GUILD_WAR_ON_WAR,
+ GUILD_WAR_END,
+ GUILD_WAR_OVER,
+ GUILD_WAR_RESERVE,
+
+ GUILD_WAR_DURATION = 30*60, // 1ð
+ GUILD_WAR_WIN_POINT = 1000,
+ GUILD_WAR_LADDER_HALF_PENALTY_TIME = 12*60*60,
+};
+
+enum EAttributeSet
+{
+ ATTRIBUTE_SET_WEAPON,
+ ATTRIBUTE_SET_BODY,
+ ATTRIBUTE_SET_WRIST,
+ ATTRIBUTE_SET_FOOTS,
+ ATTRIBUTE_SET_NECK,
+ ATTRIBUTE_SET_HEAD,
+ ATTRIBUTE_SET_SHIELD,
+ ATTRIBUTE_SET_EAR,
+ ATTRIBUTE_SET_MAX_NUM
+};
+
+enum EPrivType
+{
+ PRIV_NONE,
+ PRIV_ITEM_DROP,
+ PRIV_GOLD_DROP,
+ PRIV_GOLD10_DROP,
+ PRIV_EXP_PCT,
+ MAX_PRIV_NUM,
+};
+
+enum EMoneyLogType
+{
+ MONEY_LOG_RESERVED,
+ MONEY_LOG_MONSTER,
+ MONEY_LOG_SHOP,
+ MONEY_LOG_REFINE,
+ MONEY_LOG_QUEST,
+ MONEY_LOG_GUILD,
+ MONEY_LOG_MISC,
+ MONEY_LOG_MONSTER_KILL,
+ MONEY_LOG_DROP,
+ MONEY_LOG_TYPE_MAX_NUM,
+};
+
+enum EPremiumTypes
+{
+ PREMIUM_EXP, // ġ 1.2
+ PREMIUM_ITEM, // 2
+ PREMIUM_SAFEBOX, // â 1ĭ 3ĭ
+ PREMIUM_AUTOLOOT, // ڵ ݱ
+ PREMIUM_FISH_MIND, // Ȯ
+ PREMIUM_MARRIAGE_FAST, // ݽ մϴ.
+ PREMIUM_GOLD, // 1.5
+ PREMIUM_MAX_NUM = 9
+};
+
+enum SPECIAL_EFFECT
+{
+ SE_NONE,
+
+ SE_HPUP_RED,
+ SE_SPUP_BLUE,
+ SE_SPEEDUP_GREEN,
+ SE_DXUP_PURPLE,
+ SE_CRITICAL,
+ SE_PENETRATE,
+ SE_BLOCK,
+ SE_DODGE,
+ SE_CHINA_FIREWORK,
+ SE_SPIN_TOP,
+ SE_SUCCESS,
+ SE_FAIL,
+ SE_FR_SUCCESS,
+ SE_LEVELUP_ON_14_FOR_GERMANY,
+ SE_LEVELUP_UNDER_15_FOR_GERMANY,
+ SE_PERCENT_DAMAGE1,
+ SE_PERCENT_DAMAGE2,
+ SE_PERCENT_DAMAGE3,
+
+ SE_AUTO_HPUP,
+ SE_AUTO_SPUP,
+
+ SE_EQUIP_RAMADAN_RING, // ʽ´ (71135) Ʈ (ߵƮ, Ʈ ƴ)
+ SE_EQUIP_HALLOWEEN_CANDY, // ҷ (-_-;) ߵϴ Ʈ
+ SE_EQUIP_HAPPINESS_RING, // ũ ູ (71143) Ʈ (ߵƮ, Ʈ ƴ)
+ SE_EQUIP_LOVE_PENDANT, // ߷Ÿ ҴƮ(71145) Ʈ (ߵƮ, Ʈ ƴ)
+} ;
+
+enum ETeenFlags
+{
+ TEENFLAG_NONE = 0,
+ TEENFLAG_1HOUR,
+ TEENFLAG_2HOUR,
+ TEENFLAG_3HOUR,
+ TEENFLAG_4HOUR,
+ TEENFLAG_5HOUR,
+};
+
+#include "item_length.h"
+
+// inventory position Ÿ ü
+// int Ͻ ȯ ִ ,
+// κ õ Լ window_type ʰ, cell ϳ ұ ,( κ ϳ ̾ inventory type̶ ʿ ,)
+// κ Լ ȣκ ϴ ϱ ̴.
+
+enum EDragonSoulRefineWindowSize
+{
+ DRAGON_SOUL_REFINE_GRID_MAX = 15,
+};
+
+enum EMisc2
+{
+ DRAGON_SOUL_EQUIP_SLOT_START = INVENTORY_MAX_NUM + WEAR_MAX_NUM,
+ DRAGON_SOUL_EQUIP_SLOT_END = DRAGON_SOUL_EQUIP_SLOT_START + (DS_SLOT_MAX * DRAGON_SOUL_DECK_MAX_NUM),
+ DRAGON_SOUL_EQUIP_RESERVED_SLOT_END = DRAGON_SOUL_EQUIP_SLOT_END + (DS_SLOT_MAX * DRAGON_SOUL_DECK_RESERVED_MAX_NUM),
+
+ BELT_INVENTORY_SLOT_START = DRAGON_SOUL_EQUIP_RESERVED_SLOT_END,
+ BELT_INVENTORY_SLOT_END = BELT_INVENTORY_SLOT_START + BELT_INVENTORY_SLOT_COUNT,
+
+ INVENTORY_AND_EQUIP_SLOT_MAX = BELT_INVENTORY_SLOT_END,
+};
+
+#pragma pack(push, 1)
+
+typedef struct SItemPos
+{
+ BYTE window_type;
+ WORD cell;
+ SItemPos ()
+ {
+ window_type = INVENTORY;
+ cell = WORD_MAX;
+ }
+
+ SItemPos (BYTE _window_type, WORD _cell)
+ {
+ window_type = _window_type;
+ cell = _cell;
+ }
+
+ bool IsValidItemPosition() const
+ {
+ switch (window_type)
+ {
+ case RESERVED_WINDOW:
+ return false;
+ case INVENTORY:
+ case EQUIPMENT:
+ case BELT_INVENTORY:
+ return cell < INVENTORY_AND_EQUIP_SLOT_MAX;
+ case DRAGON_SOUL_INVENTORY:
+ return cell < (DRAGON_SOUL_INVENTORY_MAX_NUM);
+ // ũⰡ window valid üũ .
+ case SAFEBOX:
+ case MALL:
+ return false;
+ default:
+ return false;
+ }
+ return false;
+ }
+
+ bool IsEquipPosition() const
+ {
+ return ((INVENTORY == window_type || EQUIPMENT == window_type) && cell >= INVENTORY_MAX_NUM && cell < INVENTORY_MAX_NUM + WEAR_MAX_NUM)
+ || IsDragonSoulEquipPosition();
+ }
+
+ bool IsDragonSoulEquipPosition() const
+ {
+ return (DRAGON_SOUL_EQUIP_SLOT_START <= cell) && (DRAGON_SOUL_EQUIP_SLOT_END > cell);
+ }
+
+ bool IsBeltInventoryPosition() const
+ {
+ return (BELT_INVENTORY_SLOT_START <= cell) && (BELT_INVENTORY_SLOT_END > cell);
+ }
+
+ bool IsDefaultInventoryPosition() const
+ {
+ return INVENTORY == window_type && cell < INVENTORY_MAX_NUM;
+ }
+
+ bool operator==(const struct SItemPos& rhs) const
+ {
+ return (window_type == rhs.window_type) && (cell == rhs.cell);
+ }
+ bool operator<(const struct SItemPos& rhs) const
+ {
+ return (window_type < rhs.window_type) || ((window_type == rhs.window_type) && (cell < rhs.cell));
+ }
+} TItemPos;
+
+const TItemPos NPOS (RESERVED_WINDOW, WORD_MAX);
+
+typedef enum
+{
+ SHOP_COIN_TYPE_GOLD, // DEFAULT VALUE
+ SHOP_COIN_TYPE_SECONDARY_COIN,
+} EShopCoinType;
+
+#pragma pack(pop)
+
+#endif
diff --git a/common/noncopyable.h b/common/noncopyable.h
new file mode 100644
index 0000000..62e0ead
--- /dev/null
+++ b/common/noncopyable.h
@@ -0,0 +1,15 @@
+#ifndef INC_METIN_II_COMMON_NONCOPYABLE_TEMPLATE
+#define INC_METIN_II_COMMON_NONCOPYABLE_TEMPLATE
+
+class noncopyable
+{
+ protected:
+ noncopyable() {}
+ ~noncopyable() {}
+
+ private:
+ noncopyable(const noncopyable &);
+ noncopyable& operator = (const noncopyable &);
+};
+
+#endif
diff --git a/common/pool.h b/common/pool.h
new file mode 100644
index 0000000..f53959c
--- /dev/null
+++ b/common/pool.h
@@ -0,0 +1,185 @@
+#ifndef __INC_METIN_II_COMMON_POOL_H__
+#define __INC_METIN_II_COMMON_POOL_H__
+
+#include
+#include
+
+template
+class CPoolNode : public T
+{
+ public:
+ CPoolNode()
+ {
+ m_pNext = NULL;
+ m_pPrev = NULL;
+ }
+
+ virtual ~CPoolNode()
+ {
+ }
+
+ public:
+ CPoolNode * m_pNext;
+ CPoolNode * m_pPrev;
+};
+
+template
+class CDynamicPool
+{
+ public:
+ typedef CPoolNode TNode;
+
+ public:
+ CDynamicPool()
+ {
+ Initialize();
+ }
+
+ virtual ~CDynamicPool()
+ {
+ assert(m_pFreeList==NULL && "CDynamicPool::~CDynamicPool() - NOT Clear");
+ assert(m_pUsedList==NULL && "CDynamicPool::~CDynamicPool() - NOT Clear");
+ Clear();
+ }
+
+ void Initialize()
+ {
+ m_nodes = NULL;
+ m_nodeCount = 0;
+
+ m_pFreeList = NULL;
+ m_pUsedList = NULL;
+ }
+
+ void SetName(const char* c_szName)
+ {
+ m_stName = c_szName;
+ }
+
+ DWORD GetCapacity()
+ {
+ return m_nodeCount;
+ }
+
+ T* Alloc()
+ {
+ TNode* pnewNode;
+
+ if (m_pFreeList)
+ {
+ pnewNode = m_pFreeList;
+ m_pFreeList = m_pFreeList->m_pNext;
+ }
+ else
+ {
+ pnewNode = AllocNode();
+ }
+
+ if (!pnewNode)
+ return NULL;
+
+ if (!m_pUsedList)
+ {
+ m_pUsedList = pnewNode;
+ m_pUsedList->m_pPrev = m_pUsedList->m_pNext = NULL;
+ }
+ else
+ {
+ m_pUsedList->m_pPrev = pnewNode;
+ pnewNode->m_pNext = m_pUsedList;
+ pnewNode->m_pPrev = NULL;
+ m_pUsedList = pnewNode;
+ }
+ //Tracef("%s Pool Alloc %p\n", m_stName.c_str(), pnewNode);
+ return (T*) pnewNode;
+ }
+
+ void Free(T * pdata)
+ {
+ TNode* pfreeNode = (TNode*) pdata;
+
+ if (pfreeNode == m_pUsedList)
+ {
+ if (NULL != (m_pUsedList = m_pUsedList->m_pNext))
+ m_pUsedList->m_pPrev = NULL;
+ }
+ else
+ {
+ if (pfreeNode->m_pNext)
+ pfreeNode->m_pNext->m_pPrev = pfreeNode->m_pPrev;
+
+ if (pfreeNode->m_pPrev)
+ pfreeNode->m_pPrev->m_pNext = pfreeNode->m_pNext;
+ }
+
+ pfreeNode->m_pPrev = NULL;
+ pfreeNode->m_pNext = m_pFreeList;
+ m_pFreeList = pfreeNode;
+ //Tracef("%s Pool Free\n", m_stName.c_str());
+ }
+
+ void FreeAll()
+ {
+ TNode * pcurNode;
+ TNode * pnextNode;
+
+ pcurNode = m_pUsedList;
+
+ while (pcurNode)
+ {
+ pnextNode = pcurNode->m_pNext;
+ Free(pcurNode);
+ pcurNode = pnextNode;
+ }
+ }
+
+ void Clear()
+ {
+ TNode* pcurNode;
+ TNode* pnextNode;
+
+ DWORD count = 0;
+
+ pcurNode = m_pFreeList;
+ while (pcurNode)
+ {
+ pnextNode = pcurNode->m_pNext;
+ delete pcurNode;
+ pcurNode = pnextNode;
+ ++count;
+ }
+ m_pFreeList = NULL;
+
+ pcurNode = m_pUsedList;
+ while (pcurNode)
+ {
+ pnextNode = pcurNode->m_pNext;
+ delete pcurNode;
+ pcurNode = pnextNode;
+ ++count;
+ }
+
+ m_pUsedList = NULL;
+
+ assert(count==m_nodeCount && "CDynamicPool::Clear()");
+
+ m_nodeCount=0;
+ }
+
+ protected:
+ TNode* AllocNode()
+ {
+ ++m_nodeCount;
+ return new TNode;
+ }
+
+ protected:
+ TNode * m_nodes;
+ TNode * m_pFreeList;
+ TNode * m_pUsedList;
+
+ DWORD m_nodeCount;
+ std::string m_stName;
+};
+
+#endif
diff --git a/common/service.h b/common/service.h
new file mode 100644
index 0000000..d35e14a
--- /dev/null
+++ b/common/service.h
@@ -0,0 +1,8 @@
+#ifndef __INC_SERVICE_H__
+#define __INC_SERVICE_H__
+
+#define _IMPROVED_PACKET_ENCRYPTION_ // Ŷ ȣȭ
+//#define __AUCTION__
+#define __PET_SYSTEM__
+#define __UDP_BLOCK__
+#endif
diff --git a/common/singleton.h b/common/singleton.h
new file mode 100644
index 0000000..da4e135
--- /dev/null
+++ b/common/singleton.h
@@ -0,0 +1,44 @@
+#ifndef __INC_SINGLETON_H__
+#define __INC_SINGLETON_H__
+
+#include
+
+template class singleton
+{
+ public:
+ static T * ms_singleton;
+
+ singleton()
+ {
+ assert(!ms_singleton);
+ long offset = (long) (T*) 1 - (long) (singleton *) (T*) 1;
+ ms_singleton = (T*) ((long) this + offset);
+ }
+
+ virtual ~singleton()
+ {
+ assert(ms_singleton);
+ ms_singleton = 0;
+ }
+
+ static T & instance()
+ {
+ assert(ms_singleton);
+ return (*ms_singleton);
+ }
+
+ static T & Instance()
+ {
+ assert(ms_singleton);
+ return (*ms_singleton);
+ }
+
+ static T * instance_ptr()
+ {
+ return (ms_singleton);
+ }
+};
+
+template T * singleton ::ms_singleton = NULL;
+
+#endif
diff --git a/common/stl.h b/common/stl.h
new file mode 100644
index 0000000..32ee18f
--- /dev/null
+++ b/common/stl.h
@@ -0,0 +1,154 @@
+#ifndef __INC_METIN_II_STL_H__
+#define __INC_METIN_II_STL_H__
+
+#include
+#include
+#include