mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-24 22:32:29 +00:00
Compare commits
432 Commits
login-token-old
...
v1.2
| Author | SHA1 | Date | |
|---|---|---|---|
| 2d7267cb4e | |||
| 3443d8eb25 | |||
| 1c5f0fba4f | |||
| 5b6f9d3bfb | |||
| 595138679d | |||
| 9e03d76211 | |||
| 94aa271a84 | |||
| 57c1cd0be4 | |||
| d331114f71 | |||
| 5b05987e27 | |||
| ed37715993 | |||
| d079feeb66 | |||
| 880285afa6 | |||
| 6faaff31be | |||
| 465071c2cf | |||
| cf6a9d6b2a | |||
| 782c5ebc75 | |||
| ef39395580 | |||
| 86c9b6b079 | |||
| 4a036116dd | |||
| 2bab945c34 | |||
| 26ed80bdda | |||
| a6c1314e3e | |||
| 979e54daa7 | |||
| b87e355db3 | |||
| 88ed2e64bb | |||
| 2010d1ba83 | |||
| 332a3d6c6a | |||
| 214503617e | |||
| 1a1cce859a | |||
| 0786b1158a | |||
| 4d87216ec6 | |||
| 7dbf24b95d | |||
| e7cf687d2b | |||
| 5544fd0ae5 | |||
| 842a40f76d | |||
| 70f55179b6 | |||
| a2e12667b4 | |||
| 213a496efb | |||
| b0336302ee | |||
| 58725b061e | |||
| 90c18c1dc9 | |||
| 97ee8e59a1 | |||
| 50eededd9f | |||
| ee95a2a0c8 | |||
| 254764c1e6 | |||
| 352e70cf28 | |||
| 0558b1bc48 | |||
| 2b38dbf1fb | |||
| bce92c5e02 | |||
| 653824ae9e | |||
| b61f612fbe | |||
| 028dbc4bda | |||
| 49b90eae76 | |||
| 65acefc6b1 | |||
| c985307057 | |||
| b475f66014 | |||
| eae7183de2 | |||
| 1d088a1ac1 | |||
| 7d0b7560bc | |||
| 7e86337b80 | |||
| ac25d49a62 | |||
| 8a911682bf | |||
| a87bf5681f | |||
| b84b98dd7c | |||
| c487acbf1a | |||
| 72349ddbb6 | |||
| c8389103e3 | |||
| 7a7069959f | |||
| a20615ea11 | |||
| 0e8672562a | |||
| 05ae8c8219 | |||
| add0c4de47 | |||
| 510d8083b3 | |||
| d0e960e64b | |||
| b8a844b9dc | |||
| f46e4f9aa4 | |||
| a828443b46 | |||
| e28ddcff25 | |||
| 80c7643396 | |||
| 66aaa92bd1 | |||
| eb463eef97 | |||
| d43273fd1b | |||
| 2c91d1db6e | |||
| d504397593 | |||
| 95043d637c | |||
| 51a006654a | |||
| dde3f603be | |||
| 4fe6836cf0 | |||
| fdcd39398c | |||
| f7fe10fc98 | |||
| 7d99becca9 | |||
| a53f65d86b | |||
| fb7362c092 | |||
| 714f8172ec | |||
| 9344896238 | |||
| 3081f7b24f | |||
| e594b7eac6 | |||
| 0f3fbc3883 | |||
| 2d20d5858e | |||
| fe57e4d924 | |||
| e4e40505b6 | |||
| 5b5c3a08e6 | |||
| 137d2d723d | |||
| aff481bd37 | |||
| a5a660b828 | |||
| d08b7dafa4 | |||
| 3e1b86a7c3 | |||
| fe68c7bc14 | |||
| 4ee35d7e56 | |||
| dbdad80960 | |||
| 72940b2511 | |||
| 70922975cf | |||
| 135cfd7617 | |||
| d58e88a2f7 | |||
| c29bdd4b1d | |||
| 0643bf9783 | |||
| 386261181e | |||
| d8b704ef7d | |||
| e46e2952e6 | |||
| a339d0d41d | |||
| d62f2d41fc | |||
| 339e921f17 | |||
| 5e963c05af | |||
| 638d43e3cf | |||
| fdef1090c3 | |||
| 89303d9218 | |||
| 341bc0723b | |||
| a6b31017e3 | |||
| ca29cb037e | |||
| d59931dc4d | |||
| 876335bb54 | |||
| 5c87b8152d | |||
| ef487112df | |||
| 49089f7537 | |||
| 736890119b | |||
| 2da70c69da | |||
| ae966e546b | |||
| 0d63c8b9ef | |||
| 8f66527e02 | |||
| 7e7f5f0bd6 | |||
| b3ac1001c9 | |||
| e5e779c064 | |||
| 525db1819d | |||
| bb3c0b41f6 | |||
| 35c4867334 | |||
| 690d8f9155 | |||
| b63923264d | |||
| 5aab187e17 | |||
| ee4a79616f | |||
| b667944612 | |||
| 6fb3c66fe5 | |||
| 66ef95b9c9 | |||
| bb3596d245 | |||
| a5c32b63b7 | |||
| 9e4f728f21 | |||
| 3cb7b362c8 | |||
| 1beb221337 | |||
| 28cb11f521 | |||
| d71e79b306 | |||
| 7edc891605 | |||
| 8e4aff391e | |||
| 1b84905941 | |||
| 06d22fa009 | |||
| 29f89cdfbc | |||
| 6f49a37914 | |||
| 1e316102ea | |||
| 03b2550520 | |||
| e547a1e778 | |||
| 9c69eed211 | |||
| 464c1cb584 | |||
| 4fbe55cc35 | |||
| 008b17aaf2 | |||
| c469571f62 | |||
| 6c2a8edea6 | |||
| 361937d443 | |||
| 4071e1d4d9 | |||
| 46a358abe6 | |||
| fc339cc9d0 | |||
| c87380fa54 | |||
| 959337b592 | |||
| ca0b9bc374 | |||
| 2d459a962e | |||
| f3b2ac6c17 | |||
| 6027a80c14 | |||
| 6934552dd9 | |||
| 0b755cac54 | |||
| 765ee5eeed | |||
| c36a1cd6dc | |||
| a493242c3c | |||
| 97bb50a5c4 | |||
| 27225b6047 | |||
| cbd68ff8c8 | |||
| a32dedeb48 | |||
| 91d3851d76 | |||
| b5e9c0f996 | |||
| de4782368d | |||
| 3e39c0c11a | |||
| d2360753fb | |||
| e747ea851a | |||
| 68d563c72f | |||
| c5e4bb08f4 | |||
| 0b97db9fd2 | |||
| fb8873e77b | |||
| e943771945 | |||
| 05a3c4b2b8 | |||
| 24b396e516 | |||
| cdd0b2de00 | |||
| 4096ee1f1e | |||
| f720e51585 | |||
| c5c93bb2e6 | |||
| 85bafecc93 | |||
| 2ed185aa2c | |||
| 1b2316ad1f | |||
| 80ad3a8940 | |||
| cef4928dd0 | |||
| ab65bb1d57 | |||
| c21293e508 | |||
| 3c794cfc07 | |||
| d71dbd1751 | |||
| 8805021960 | |||
| dd2b12b517 | |||
| 78f3a2aa64 | |||
| 03dbe47546 | |||
| 13ad5e4b46 | |||
| 6716e580f3 | |||
| 5d9c8c8e27 | |||
| 7bd5213be4 | |||
| 93ddf915a2 | |||
| f8ce10472b | |||
| ceb2b287bb | |||
| 8e9fa38197 | |||
| 5763672175 | |||
| 6ed3301110 | |||
| fbe456ed45 | |||
| 518a5e8ab1 | |||
| 008ac97a64 | |||
| 7892fed6d9 | |||
| 6042410b4b | |||
| 26532c03ac | |||
| 0fa5053ad1 | |||
| 39a94dba0d | |||
| a440269c6b | |||
| a7310cba17 | |||
| b82100bcd7 | |||
| e7ce79261d | |||
| d8bbb428d8 | |||
| 7adc93d806 | |||
| 62dcc188d1 | |||
| aa1114c387 | |||
| 462349ad84 | |||
| 19183f958e | |||
| 42d3a7e4f6 | |||
| af02b9f958 | |||
| f67d280845 | |||
| 6d7203ef4b | |||
| 90a9b98ae6 | |||
| 61fb708b73 | |||
| 4629b4f261 | |||
| 865c8562da | |||
| 7fea04c663 | |||
| 8620e1b7c9 | |||
| 9102c1a13a | |||
| 682df81339 | |||
| 40ebee9ff4 | |||
| 26213f9049 | |||
| 680f1f017d | |||
| cee3dc370d | |||
| f91de33e5d | |||
| fc844cefd7 | |||
| a5e65b93c9 | |||
| 92e20d07ae | |||
| c4432bcd7e | |||
| b6fc878aab | |||
| d18fb730ec | |||
| 4cd7d98224 | |||
| 760ba01e6b | |||
| fb2f8327e2 | |||
| 7559d96a0e | |||
| 1471784035 | |||
| 057823e4c1 | |||
| e1f8354905 | |||
| 50cc093250 | |||
| e25499b3f2 | |||
| 14b3525e9c | |||
| c2a35bb2e1 | |||
| 279cd4660d | |||
| 2dad087bbd | |||
| 4b612400da | |||
| 91da1305a4 | |||
| ee581f27c4 | |||
| d90982e63b | |||
| a3dc36ae22 | |||
| b25c5d509d | |||
| 6e1c8c665b | |||
| feafd43fdf | |||
| 7d7b9d0238 | |||
| c2b5820153 | |||
| a6b9cd87ec | |||
| 11092da32d | |||
| dfccb4a2bc | |||
| c1ad00cbc6 | |||
| 6686346473 | |||
| 0356c0a891 | |||
| 8af4730ddf | |||
| 994e2001a0 | |||
| c65864ffb6 | |||
| 8011c48641 | |||
| 97873ff42d | |||
| 9af9deb0f5 | |||
| 477ba3f4b9 | |||
| 9c6dbe699f | |||
| 9cfe6b936b | |||
| 9b4e63fbc7 | |||
| ba1a317119 | |||
| 55f1767001 | |||
| f8b924c262 | |||
| e19b7bd368 | |||
| 3bfa1d68f7 | |||
| aaac2c5a84 | |||
| 29a62dfa85 | |||
| 790304d1f1 | |||
| 7e0e9a037d | |||
| 712fe1f6ec | |||
| b03e9af597 | |||
| 52d31a6846 | |||
| a8427ca610 | |||
| 5880593cb1 | |||
| 6bb3ebc00e | |||
| da163be8db | |||
| e928046a95 | |||
| 3eaa0b4fb1 | |||
| 37bedfe9ba | |||
| df0004c1b0 | |||
| 24e4730204 | |||
| 7d12382333 | |||
| bc348dadad | |||
| ceadb1325d | |||
| 15f7440af2 | |||
| cd748e7d8b | |||
| ed98aa45d2 | |||
| 10477d3795 | |||
| 982c078926 | |||
| a721179aa8 | |||
| 50d5f3785c | |||
| 9856df20fb | |||
| c8b75e982e | |||
| 199dd7d618 | |||
| ab569681b1 | |||
| b10f5d3745 | |||
| 7dd904c8d1 | |||
| 624be70990 | |||
| b9d2c1b9f6 | |||
| 00b2debb32 | |||
| f29fe17496 | |||
| e80f3c87e9 | |||
| a7d0251b77 | |||
| 3bcfcc6308 | |||
| 7d004e1eb0 | |||
| 90f6023f0f | |||
| 4e9c3e19d2 | |||
| 0f1ca0856c | |||
| 2ef5ade596 | |||
| 75e60b7f8e | |||
| 64d39134b9 | |||
| 414cafdbed | |||
| f566cba56a | |||
| 8400994c57 | |||
| 43f459b194 | |||
| e352171efa | |||
| 6c2f554a31 | |||
| bb2a6dce23 | |||
| 288ae4bad3 | |||
| f2c48d4c58 | |||
| f8571a57dd | |||
| 5285e8a163 | |||
| f8a4f2e6bd | |||
| c7ad873581 | |||
| 78759add4a | |||
| 48b674a13d | |||
| 8c9b852586 | |||
| 9634bef7fc | |||
| cbbfae0cfc | |||
| fc7623b690 | |||
| 0cf5a7aec3 | |||
| 59152a9d77 | |||
| e3972cc9e6 | |||
| 2a4d6523b1 | |||
| 6d8b96068d | |||
| e88cd61097 | |||
| b71f3031bc | |||
| 240f04eda7 | |||
| 7b4c130e0a | |||
| 7e3fdee86c | |||
| dd8d23be62 | |||
| 519c049902 | |||
| 898ec8fcf1 | |||
| c4d7fb8724 | |||
| b8c0b2c326 | |||
| 8ec9f36954 | |||
| db0b4045a2 | |||
| b4a234b1c0 | |||
| dcfefee060 | |||
| 6859d92716 | |||
| 84b1a719f2 | |||
| 734d79d540 | |||
| 2c388117ad | |||
| 92a678d0b4 | |||
| ed1015fa89 | |||
| 934450b749 | |||
| e025bfdb46 | |||
| 055daddcaf | |||
| 618252882c | |||
| efda99c230 | |||
| 8a50039482 | |||
| 79e825b7c7 | |||
| ec6b74aa7f | |||
| dad6f2ead5 | |||
| 0977471201 | |||
| e61e7fd008 | |||
| 10a27c2081 | |||
| b9336bad7e | |||
| 4ed6e20b35 | |||
| de7e6e8e66 | |||
| b33f2e5989 | |||
| 4d12481822 | |||
| d0ef6a5293 | |||
| a6e2110f3d | |||
| 9296f2bdc5 | |||
| 5a88ea6950 | |||
| 9841ca233d | |||
| 999677d314 |
@@ -37,3 +37,6 @@ x64/
|
||||
x86/
|
||||
log/
|
||||
logs/
|
||||
vcpkg/
|
||||
|
||||
.idea/*
|
||||
+20
-25
@@ -1,32 +1,27 @@
|
||||
language: cpp
|
||||
compiler: gcc
|
||||
sudo: false
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- gcc-4.8
|
||||
- g++-4.8
|
||||
- libmysqlclient-dev
|
||||
- libperl-dev
|
||||
- libboost-dev
|
||||
- liblua5.1-0-dev
|
||||
- zlib1g-dev
|
||||
- uuid-dev
|
||||
- libssl-dev
|
||||
dist: trusty
|
||||
|
||||
before_install:
|
||||
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
|
||||
- sudo apt-get update -qq
|
||||
- mkdir $HOME/usr
|
||||
- export PATH="$HOME/usr/bin:$PATH"
|
||||
- wget https://cmake.org/files/v3.11/cmake-3.11.2-Linux-x86_64.sh
|
||||
- chmod +x cmake-3.11.2-Linux-x86_64.sh
|
||||
- ./cmake-3.11.2-Linux-x86_64.sh --prefix=$HOME/usr --exclude-subdir --skip-license
|
||||
|
||||
install:
|
||||
- if [ "$CXX" = "g++" ]; then export CXX="g++-4.8" CC="gcc-4.8"; fi
|
||||
- sudo apt-get install -qq g++-7
|
||||
- sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 90
|
||||
- sudo apt-get install libmysqlclient-dev
|
||||
- sudo apt-get install libperl-dev
|
||||
- sudo apt-get install libboost-dev
|
||||
- sudo apt-get install liblua5.1-0-dev
|
||||
- sudo apt-get install zlib1g-dev
|
||||
- sudo apt-get install uuid-dev
|
||||
- sudo apt-get install libssl-dev
|
||||
script:
|
||||
- cmake -G "Unix Makefiles" -DEQEMU_BUILD_TESTS=ON -DEQEMU_ENABLE_BOTS=ON -DEQEMU_BUILD_LOGIN=ON
|
||||
- make -j2
|
||||
- ./bin/tests
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- stable
|
||||
notifications:
|
||||
email: false
|
||||
irc:
|
||||
channels: "irc.eqemulator.net#eqemucoders"
|
||||
os: linux
|
||||
+3
-49
@@ -27,8 +27,6 @@
|
||||
#EQEMU_USE_MAP_MMFS
|
||||
#EQEMU_MAP_DIR
|
||||
|
||||
#We set a fairly new version (as of 2013) because I found finding perl was a bit... buggy on older ones
|
||||
#Can change this if you really want but you should upgrade!
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
|
||||
|
||||
#FindMySQL is located here so lets make it so CMake can find it
|
||||
@@ -42,6 +40,8 @@ IF(NOT CMAKE_BUILD_TYPE)
|
||||
SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE)
|
||||
ENDIF(NOT CMAKE_BUILD_TYPE)
|
||||
|
||||
SET(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/dependencies" "${CMAKE_PREFIX_PATH}")
|
||||
|
||||
#Add our various windows definitions
|
||||
IF(MSVC OR MINGW)
|
||||
ADD_DEFINITIONS(-D_WINDOWS)
|
||||
@@ -53,35 +53,6 @@ IF(MSVC OR MINGW)
|
||||
ENDIF(MSVC OR MINGW)
|
||||
|
||||
IF(MSVC)
|
||||
#Set our default locations for zlib/mysql based on x86/x64
|
||||
IF(CMAKE_CL_64)
|
||||
SET(ZLIB_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/zlib_x64")
|
||||
SET(MYSQL_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/mysql_x64")
|
||||
SET(LUA_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/luaj_x64")
|
||||
SET(OPENSSL_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/openssl_x64")
|
||||
SET(SODIUM_INCLUDE_HINTS "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/libsodium/include")
|
||||
IF(MSVC_VERSION GREATER 1800)
|
||||
SET(SODIUM_LIBRARY_HINTS "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/libsodium/x64/Release/v140/dynamic")
|
||||
ELSEIF(MSVC_VERSION EQUAL 1800)
|
||||
SET(SODIUM_LIBRARY_HINTS "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/libsodium/x64/Release/v120/dynamic")
|
||||
ELSE()
|
||||
SET(SODIUM_LIBRARY_HINTS "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/libsodium/x64/Release/v110/dynamic")
|
||||
ENDIF()
|
||||
ELSE(CMAKE_CL_64)
|
||||
SET(ZLIB_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/zlib_x86")
|
||||
SET(MYSQL_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/mysql_x86")
|
||||
SET(LUA_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/luaj_x86")
|
||||
SET(SODIUM_INCLUDE_HINTS "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/libsodium/include")
|
||||
SET(OPENSSL_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/openssl_x86")
|
||||
IF(MSVC_VERSION GREATER 1800)
|
||||
SET(SODIUM_LIBRARY_HINTS "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/libsodium/Win32/Release/v140/dynamic")
|
||||
ELSEIF(MSVC_VERSION EQUAL 1800)
|
||||
SET(SODIUM_LIBRARY_HINTS "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/libsodium/Win32/Release/v120/dynamic")
|
||||
ELSE()
|
||||
SET(SODIUM_LIBRARY_HINTS "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/libsodium/Win32/Release/v110/dynamic")
|
||||
ENDIF()
|
||||
ENDIF(CMAKE_CL_64)
|
||||
|
||||
#disable CRT warnings on windows cause they're annoying as shit and we use C functions everywhere
|
||||
OPTION(EQEMU_DISABLE_CRT_SECURE_WARNINGS "Disable Secure CRT Warnings" ON)
|
||||
IF(EQEMU_DISABLE_CRT_SECURE_WARNINGS)
|
||||
@@ -100,23 +71,6 @@ IF(MSVC)
|
||||
ADD_DEFINITIONS(-DCRASH_LOGGING)
|
||||
ENDIF(EQEMU_ENABLE_CRASH_LOGGING)
|
||||
|
||||
#Disable safe SEH or not?
|
||||
OPTION(EQEMU_DISABLE_SAFESEH "Disable Safe SEH (Needed for Strawberry Perl)" OFF)
|
||||
IF(EQEMU_DISABLE_SAFESEH)
|
||||
SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /SAFESEH:NO")
|
||||
SET(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL} /SAFESEH:NO")
|
||||
SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /SAFESEH:NO")
|
||||
SET(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} /SAFESEH:NO")
|
||||
SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} /SAFESEH:NO")
|
||||
SET(CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL "${CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL} /SAFESEH:NO")
|
||||
SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /SAFESEH:NO")
|
||||
SET(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO} /SAFESEH:NO")
|
||||
SET(CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG} /SAFESEH:NO")
|
||||
SET(CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL "${CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL} /SAFESEH:NO")
|
||||
SET(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} /SAFESEH:NO")
|
||||
SET(CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO} /SAFESEH:NO")
|
||||
ENDIF(EQEMU_DISABLE_SAFESEH)
|
||||
|
||||
OPTION(EQEMU_BUILD_MSVC_MP "Enable build with multiple processes." ON)
|
||||
IF(EQEMU_BUILD_MSVC_MP)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
|
||||
@@ -342,7 +296,7 @@ IF(EQEMU_BUILD_LUA)
|
||||
|
||||
FIND_PACKAGE(Boost REQUIRED)
|
||||
INCLUDE_DIRECTORIES(SYSTEM "${LUA_INCLUDE_DIR}" "${Boost_INCLUDE_DIRS}")
|
||||
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/luabind")
|
||||
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/libs/luabind")
|
||||
|
||||
OPTION(EQEMU_SANITIZE_LUA_LIBS "Sanitize Lua Libraries (Remove OS and IO standard libraries from being able to run)." ON)
|
||||
IF(EQEMU_SANITIZE_LUA_LIBS)
|
||||
|
||||
@@ -1,339 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
@@ -0,0 +1,165 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
The server code and utilities are released under GPLv3.
|
||||
|
||||
We also include some small libraries for convienence that may be under different licensing:
|
||||
|
||||
SocketLib - GPL
|
||||
LibXML - ZLib License
|
||||
StackWalker - New BSD License
|
||||
ZLib - ZLib License
|
||||
MySQL - GPL
|
||||
Perl - GPL / ActiveState (under the assumption that this is a free project).
|
||||
CPPUnit - GLP
|
||||
StringUtilities - Apache
|
||||
@@ -1,7 +1,7 @@
|
||||
# EQEmulator Core Server
|
||||
|Travis CI (Linux)|Appveyor (Windows) |
|
||||
|:---:|:---:|
|
||||
|[](https://travis-ci.org/EQEmu/Server) |[](https://ci.appveyor.com/project/KimLS/server/branch/master) |
|
||||
|Travis CI (Linux)|Appveyor w/ Bots (Windows) |Appveyor w/o Bots (Windows) |
|
||||
|:---:|:---:|:---:|
|
||||
|[](https://travis-ci.org/EQEmu/Server) |[](https://ci.appveyor.com/project/KimLS/server-87crp/branch/master) |[](https://ci.appveyor.com/project/KimLS/server-w0pq2/branch/master) |
|
||||
|
||||
***
|
||||
|
||||
@@ -17,10 +17,7 @@
|
||||
|:---:|:---:|:---:|
|
||||
|**Install Count**|||
|
||||
### > Windows
|
||||
* [Easy Install](http://wiki.eqemulator.org/p?Akkas_PEQ_Server_Installer&frm=Main#from-scratch-installation-instructions-windows)
|
||||
* [Advanced Setup](http://wiki.eqemulator.org/p?Complete_Windows-based_Server_Setup_Guide)
|
||||
|
||||
|
||||
* [Install](https://github.com/EQEmu/Server/wiki/Windows-Server)
|
||||
|
||||
### > Debian/Ubuntu/CentOS/Fedora
|
||||
* You can use curl or wget to kick off the installer (whichever your OS has)
|
||||
@@ -53,7 +50,23 @@ forum, although pull requests will be much quicker and easier on all parties.
|
||||
- **User Discord Channel**: `#general`
|
||||
- **Developer Discord Channel**: `#eqemucoders`
|
||||
|
||||
Resources
|
||||
---
|
||||
## Resources
|
||||
- [EQEmulator Forums](http://www.eqemulator.org/forums)
|
||||
- [EQEmulator Wiki](http://wiki.eqemulator.org/i?M=Wiki)
|
||||
- [EQEmulator Wiki](https://github.com/EQEmu/Server/wiki)
|
||||
|
||||
## Related Repositories
|
||||
* [ProjectEQ Quests](https://github.com/ProjectEQ/projecteqquests)
|
||||
* [Maps](https://github.com/Akkadius/EQEmuMaps)
|
||||
* [Installer Resources](https://github.com/Akkadius/EQEmuInstall)
|
||||
* [Zone Utilities](https://github.com/EQEmu/zone-utilities) - Various utilities and libraries for parsing, rendering and manipulating EQ Zone files.
|
||||
|
||||
## Other License Info
|
||||
|
||||
* The server code and utilities are released under **GPLv3**
|
||||
* We also include some small libraries for convienence that may be under different licensing
|
||||
* SocketLib - GPL LibXML
|
||||
* zlib - zlib license
|
||||
* MariaDB/MySQL - GPL
|
||||
* GPL Perl - GPL / ActiveState (under the assumption that this is a free project)
|
||||
* CPPUnit - GLP StringUtilities - Apache
|
||||
* LUA - MIT
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
version: 1.0.{build}
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
image: Visual Studio 2017
|
||||
configuration: RelWithDebInfo
|
||||
clone_folder: c:\projects\eqemu
|
||||
init:
|
||||
- ps: git config --global core.autocrlf input
|
||||
before_build:
|
||||
- ps: >-
|
||||
$wc = New-Object System.Net.WebClient
|
||||
|
||||
$wc.DownloadFile("https://github.com/EQEmu/eqemu.github.com/blob/master/downloads/appveyor/vcpkg-export.7z?raw=true", "c:\projects\eqemu\vcpkg-export.7z")
|
||||
|
||||
$wc.DownloadFile("http://strawberryperl.com/download/5.26.2.1/strawberry-perl-5.26.2.1-64bit-portable.zip", "c:\projects\eqemu\strawberry-perl-5.26.2.1-64bit-portable.zip")
|
||||
|
||||
cd c:\projects\eqemu
|
||||
|
||||
7z x c:/projects/eqemu/vcpkg-export.7z -oc:/projects/eqemu/vcpkg -y
|
||||
|
||||
7z x c:/projects/eqemu/strawberry-perl-5.26.2.1-64bit-portable.zip -oc:/projects/eqemu/strawberry-perl-portable -y
|
||||
|
||||
(Get-Content C:/projects/eqemu/strawberry-perl-portable/perl/lib/CORE/config.h).replace('#define PERL_STATIC_INLINE static __inline__', '#define PERL_STATIC_INLINE static __inline') | Set-Content C:/projects/eqemu/strawberry-perl-portable/perl/lib/CORE/config.h
|
||||
|
||||
mkdir build
|
||||
|
||||
cd build
|
||||
|
||||
cmake -G "Visual Studio 15 2017 Win64" -DEQEMU_BUILD_TESTS=ON -DEQEMU_BUILD_LOGIN=ON -EQEMU_ENABLE_BOTS=ON -DPERL_EXECUTABLE="C:/projects/eqemu/strawberry-perl-portable/perl/bin/perl.exe" -DPERL_INCLUDE_PATH="C:/projects/eqemu/strawberry-perl-portable/perl/lib/CORE" -DPERL_LIBRARY="C:/projects/eqemu/strawberry-perl-portable/perl/lib/CORE/libperl526.a" -DCMAKE_TOOLCHAIN_FILE="C:/projects/eqemu/vcpkg/vcpkg-export-20180627-133249/scripts/buildsystems/vcpkg.cmake" ..
|
||||
build:
|
||||
project: C:\projects\eqemu\build\EQEmu.sln
|
||||
parallel: true
|
||||
verbosity: minimal
|
||||
after_build:
|
||||
- cmd: >-
|
||||
7z a build_x64-bots.zip C:\projects\eqemu\build\bin\RelWithDebInfo\*.exe C:\projects\eqemu\build\bin\RelWithDebInfo\*.dll C:\projects\eqemu\build\bin\RelWithDebInfo\*.pdb
|
||||
|
||||
appveyor PushArtifact build_x64-bots.zip
|
||||
@@ -0,0 +1,39 @@
|
||||
version: 1.0.{build}
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
image: Visual Studio 2017
|
||||
configuration: RelWithDebInfo
|
||||
clone_folder: c:\projects\eqemu
|
||||
init:
|
||||
- ps: git config --global core.autocrlf input
|
||||
before_build:
|
||||
- ps: >-
|
||||
$wc = New-Object System.Net.WebClient
|
||||
|
||||
$wc.DownloadFile("https://github.com/EQEmu/eqemu.github.com/blob/master/downloads/appveyor/vcpkg-export.7z?raw=true", "c:\projects\eqemu\vcpkg-export.7z")
|
||||
|
||||
$wc.DownloadFile("http://strawberryperl.com/download/5.26.2.1/strawberry-perl-5.26.2.1-64bit-portable.zip", "c:\projects\eqemu\strawberry-perl-5.26.2.1-64bit-portable.zip")
|
||||
|
||||
cd c:\projects\eqemu
|
||||
|
||||
7z x c:/projects/eqemu/vcpkg-export.7z -oc:/projects/eqemu/vcpkg -y
|
||||
|
||||
7z x c:/projects/eqemu/strawberry-perl-5.26.2.1-64bit-portable.zip -oc:/projects/eqemu/strawberry-perl-portable -y
|
||||
|
||||
(Get-Content C:/projects/eqemu/strawberry-perl-portable/perl/lib/CORE/config.h).replace('#define PERL_STATIC_INLINE static __inline__', '#define PERL_STATIC_INLINE static __inline') | Set-Content C:/projects/eqemu/strawberry-perl-portable/perl/lib/CORE/config.h
|
||||
|
||||
mkdir build
|
||||
|
||||
cd build
|
||||
|
||||
cmake -G "Visual Studio 15 2017 Win64" -DEQEMU_BUILD_TESTS=ON -DEQEMU_BUILD_LOGIN=ON -EQEMU_ENABLE_BOTS=OFF -DPERL_EXECUTABLE="C:/projects/eqemu/strawberry-perl-portable/perl/bin/perl.exe" -DPERL_INCLUDE_PATH="C:/projects/eqemu/strawberry-perl-portable/perl/lib/CORE" -DPERL_LIBRARY="C:/projects/eqemu/strawberry-perl-portable/perl/lib/CORE/libperl526.a" -DCMAKE_TOOLCHAIN_FILE="C:/projects/eqemu/vcpkg/vcpkg-export-20180627-133249/scripts/buildsystems/vcpkg.cmake" ..
|
||||
build:
|
||||
project: C:\projects\eqemu\build\EQEmu.sln
|
||||
parallel: true
|
||||
verbosity: minimal
|
||||
after_build:
|
||||
- cmd: >-
|
||||
7z a build_x64-no-bots.zip C:\projects\eqemu\build\bin\RelWithDebInfo\*.exe C:\projects\eqemu\build\bin\RelWithDebInfo\*.dll C:\projects\eqemu\build\bin\RelWithDebInfo\*.pdb
|
||||
|
||||
appveyor PushArtifact build_x64-no-bots.zip
|
||||
+107
@@ -1,5 +1,112 @@
|
||||
EQEMu Changelog (Started on Sept 24, 2003 15:50)
|
||||
-------------------------------------------------------
|
||||
== 05/28/2018 ==
|
||||
Akkadius: Fixed an issue where size 0 NPC's hop in and out of the ground at idle
|
||||
Akkadius: NPC's now open doors within proximity given the door doesn't have locked requirements
|
||||
Akkadius: #reloadallrules will now display zones that have had their rules reloaded to GM's
|
||||
Akkadius: Zones should now respect "shutdowndelay" in the zones table at all times
|
||||
Akkadius: Fixed an issue where boats would snap to the bed of the body of water
|
||||
Akkadius: Added rule Aggro:NPCAggroMaxDistanceEnabled - defaults to true
|
||||
Akkadius: Changed map directory load structure
|
||||
- maps/base/*.map
|
||||
- maps/nav/*.nav
|
||||
- maps/water/*.wtr
|
||||
- maps/path/*.path
|
||||
|
||||
KLS: Implemented navigation mesh
|
||||
- All up to date maps and navs can be found https://github.com/Akkadius/EQEmuMaps
|
||||
- To update maps either check out the maps found in the above repository or use the maintenance command:
|
||||
perl eqemu_server.pl maps
|
||||
|
||||
== 03/28/2018 ==
|
||||
Kayen: SE_CastOnFadeEffect, SE_CastOnFadeEffectNPC, SE_CastOnFadeEffectAlway triggered spell will now hit
|
||||
the correct targets.
|
||||
|
||||
== 03/07/2018 ==
|
||||
Uleat: Added command '#ucs' to force a reconnect to UCS server.
|
||||
- Works in place of client auto-reconnect packet in zones where feature is unsupported
|
||||
- Currently, you will need to manually re-join channels
|
||||
|
||||
== 03/04/2018 ==
|
||||
Uleat: Updated UCS versioning
|
||||
- SoF and higher clients have a new opcode identified (update your *.conf files)
|
||||
- Rework of previous ucs connectivity code
|
||||
- Unrelated: Zone::weatherSend() now takes an optional parameter for singular updates (as in client entering zone)
|
||||
-- prior to this, every client already in-zone received a weather update packet whenever a new client zoned in
|
||||
|
||||
== 02/18/2018 ==
|
||||
Uleat: Bug reporting fix and overhaul.
|
||||
- Fixed bug reporting for SoD+ clients
|
||||
- Added ability to disable bug reporting (set rule 'Bugs:ReportingSystemActive' to 'false')
|
||||
- Implemented a more detailed reporting system (set rule 'Bugs:UseOldReportingMethod' to 'false')
|
||||
-- New system is not currently compatible with script-based monitoring
|
||||
- Soft-removal of defunct 'Petition Bug' system
|
||||
|
||||
== 02/14/2018 ==
|
||||
mackal: Fix Heading -- Quests broken
|
||||
|
||||
Please report any other issues with heading, most things were tested and worked
|
||||
|
||||
You can use eqemu_server.pl to run a conversion to fix your headings in quests.
|
||||
Some may need manual review.
|
||||
|
||||
== 02/10/2018 ==
|
||||
mackal: Add Global Loot system
|
||||
|
||||
This will allow us to implement global loot similarly to how it works on live
|
||||
This system reuses our current loottable tables which the global_loot table references.
|
||||
The limits for the rules to govern if a table should be rolled are min level, max level, rare,
|
||||
raid, race, class, bodytype, and zone
|
||||
|
||||
race, class, bodytype, and zone are a pipe | separated list of IDs.
|
||||
|
||||
== 01/31/2018 ==
|
||||
Uleat: Re-work of Bot::AI_Process(). Overall behavior is much improved.
|
||||
- Removed a 'ton' of unneeded packet updates
|
||||
- Added a 'leash' to the distance a bot can travel
|
||||
- Added a 'main assist' feature to target control (set using group roles)
|
||||
- Added combat 'jitter' movement to complement the existing rogue movement
|
||||
- Attack can now be aborted if target contains no leash owner nor bot hate and leash owner turns off auto-attack
|
||||
- Please report any issues with the bot AI code
|
||||
|
||||
Added a work-around for heal rotations crashing the server - under certain conditions.
|
||||
|
||||
== 01/28/2018 ==
|
||||
Mackal: Spell AI tweaks
|
||||
|
||||
AI spells are treated as "innate" spells (devs use this term, and I think this is what they mean by it)
|
||||
These spells are spammed by the NPC, lots of encounters on live work like this and this will greatly reduce
|
||||
the need to do quest scripting on these types of encounters.
|
||||
|
||||
You can safely run update npc_spells_entries set priority = priority + 1 where priority >= 0; if you want to disable this new behavior
|
||||
|
||||
== 10/08/2017 ==
|
||||
Mackal: Rework regens
|
||||
|
||||
Regen will now match whats reported by modern clients, besides where they lie due to known bugs
|
||||
|
||||
HP and END regens are now based on the BaseData.txt values allowing easy customization
|
||||
Those cases:
|
||||
- The client always applies hunger penalties, it appears they don't exist anymore on live you can turn them on with a rule
|
||||
- The way the client gets buff mana/end regen benefits incorrectly applies the bard mod making these values lie sometimes
|
||||
|
||||
== 9/17/2017 ==
|
||||
Akkadius: Add model/race offset to FixZ calc (KLS)
|
||||
Akkadius: Fix 95% of food/water consumption issues, if there are additional modifiers for race/class combos - those will need to be applied
|
||||
|
||||
Stages should be put in place if not already:
|
||||
https://wiki.project1999.com/Food_and_drink#Stages_of_Hunger_and_Thirst
|
||||
|
||||
Values stored in the database are 0-6000, previously we capped it at 6000 but previous math would have normal values in the 60k+ range in order for food to be consumed at a reasonable rate. We are now using more native logic where 1 = 1 minute, following logic:
|
||||
|
||||
(Minutes)
|
||||
0 - 5 - This is a snack.
|
||||
6 - 20 - This is a meal.
|
||||
21 - 30 - This is a hearty meal.
|
||||
31 - 40 - This is a banquet size meal.
|
||||
41 - 50 - This meal is a feast!
|
||||
51 - 60 - This is an enduring meal!
|
||||
61 - X - This is a miraculous meal!
|
||||
|
||||
== 7/14/2017 ==
|
||||
Akkadius: HP Update tuning - HP Updates are now forced when a client is targeted
|
||||
|
||||
+2
-2
@@ -24,8 +24,8 @@ struct BaseDataStruct
|
||||
double base_hp;
|
||||
double base_mana;
|
||||
double base_end;
|
||||
double unk1;
|
||||
double unk2;
|
||||
double hp_regen;
|
||||
double end_regen;
|
||||
double hp_factor;
|
||||
double mana_factor;
|
||||
double endurance_factor;
|
||||
|
||||
@@ -472,16 +472,6 @@ bool Database::CheckDatabaseConversions() {
|
||||
CheckDatabaseConvertPPDeblob();
|
||||
CheckDatabaseConvertCorpseDeblob();
|
||||
|
||||
/* Fetch EQEmu Server script */
|
||||
if (!std::ifstream("eqemu_server.pl")){
|
||||
std::cout << "Pulling down automatic database upgrade script..." << std::endl;
|
||||
#ifdef _WIN32
|
||||
system("perl -MLWP::UserAgent -e \"require LWP::UserAgent; my $ua = LWP::UserAgent->new; $ua->timeout(10); $ua->env_proxy; my $response = $ua->get('https://raw.githubusercontent.com/EQEmu/Server/master/utils/scripts/eqemu_server.pl'); if ($response->is_success){ open(FILE, '> eqemu_server.pl'); print FILE $response->decoded_content; close(FILE); }\"");
|
||||
#else
|
||||
system("wget --no-check-certificate -O eqemu_server.pl https://raw.githubusercontent.com/EQEmu/Server/master/utils/scripts/eqemu_server.pl");
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Run EQEmu Server script (Checks for database updates) */
|
||||
system("perl eqemu_server.pl ran_from_world");
|
||||
|
||||
|
||||
@@ -18,3 +18,68 @@
|
||||
*/
|
||||
|
||||
#include "emu_constants.h"
|
||||
|
||||
|
||||
const char* EQEmu::bug::CategoryIDToCategoryName(CategoryID category_id) {
|
||||
switch (category_id) {
|
||||
case catVideo:
|
||||
return "Video";
|
||||
case catAudio:
|
||||
return "Audio";
|
||||
case catPathing:
|
||||
return "Pathing";
|
||||
case catQuest:
|
||||
return "Quest";
|
||||
case catTradeskills:
|
||||
return "Tradeskills";
|
||||
case catSpellStacking:
|
||||
return "Spell stacking";
|
||||
case catDoorsPortals:
|
||||
return "Doors/Portals";
|
||||
case catItems:
|
||||
return "Items";
|
||||
case catNPC:
|
||||
return "NPC";
|
||||
case catDialogs:
|
||||
return "Dialogs";
|
||||
case catLoNTCG:
|
||||
return "LoN - TCG";
|
||||
case catMercenaries:
|
||||
return "Mercenaries";
|
||||
case catOther:
|
||||
default:
|
||||
return "Other";
|
||||
}
|
||||
}
|
||||
|
||||
EQEmu::bug::CategoryID EQEmu::bug::CategoryNameToCategoryID(const char* category_name) {
|
||||
if (!category_name)
|
||||
return catOther;
|
||||
|
||||
if (!strcmp(category_name, "Video"))
|
||||
return catVideo;
|
||||
if (!strcmp(category_name, "Audio"))
|
||||
return catAudio;
|
||||
if (!strcmp(category_name, "Pathing"))
|
||||
return catPathing;
|
||||
if (!strcmp(category_name, "Quest"))
|
||||
return catQuest;
|
||||
if (!strcmp(category_name, "Tradeskills"))
|
||||
return catTradeskills;
|
||||
if (!strcmp(category_name, "Spell stacking"))
|
||||
return catSpellStacking;
|
||||
if (!strcmp(category_name, "Doors/Portals"))
|
||||
return catDoorsPortals;
|
||||
if (!strcmp(category_name, "Items"))
|
||||
return catItems;
|
||||
if (!strcmp(category_name, "NPC"))
|
||||
return catNPC;
|
||||
if (!strcmp(category_name, "Dialogs"))
|
||||
return catDialogs;
|
||||
if (!strcmp(category_name, "LoN - TCG"))
|
||||
return catLoNTCG;
|
||||
if (!strcmp(category_name, "Mercenaries"))
|
||||
return catMercenaries;
|
||||
|
||||
return catOther;
|
||||
}
|
||||
|
||||
+36
-1
@@ -24,7 +24,7 @@
|
||||
#include "emu_legacy.h"
|
||||
#include "emu_versions.h"
|
||||
|
||||
#include <string>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
namespace EQEmu
|
||||
@@ -114,7 +114,11 @@ namespace EQEmu
|
||||
const EQEmu::versions::ClientVersion CharacterCreationClient = EQEmu::versions::ClientVersion::RoF2;
|
||||
const size_t CharacterCreationMax = RoF2::constants::CharacterCreationLimit;
|
||||
|
||||
const size_t SayLinkOpenerSize = 1;
|
||||
const size_t SayLinkBodySize = RoF2::constants::SayLinkBodySize;
|
||||
const size_t SayLinkTextSize = 256; // this may be varied until it breaks something (tested:374) - the others are constant
|
||||
const size_t SayLinkCloserSize = 1;
|
||||
const size_t SayLinkMaximumSize = (SayLinkOpenerSize + SayLinkBodySize + SayLinkTextSize + SayLinkCloserSize);
|
||||
|
||||
const int LongBuffs = RoF2::constants::LongBuffs;
|
||||
const int ShortBuffs = RoF2::constants::ShortBuffs;
|
||||
@@ -126,6 +130,37 @@ namespace EQEmu
|
||||
|
||||
} /*constants*/
|
||||
|
||||
namespace bug {
|
||||
enum CategoryID : uint32 {
|
||||
catOther = 0,
|
||||
catVideo,
|
||||
catAudio,
|
||||
catPathing,
|
||||
catQuest,
|
||||
catTradeskills,
|
||||
catSpellStacking,
|
||||
catDoorsPortals,
|
||||
catItems,
|
||||
catNPC,
|
||||
catDialogs,
|
||||
catLoNTCG,
|
||||
catMercenaries
|
||||
};
|
||||
|
||||
enum OptionalInfoFlag : uint32 {
|
||||
infoNoOptionalInfo = 0x0,
|
||||
infoCanDuplicate = 0x1,
|
||||
infoCrashBug = 0x2,
|
||||
infoTargetInfo = 0x4,
|
||||
infoCharacterFlags = 0x8,
|
||||
infoUnknownValue = 0xFFFFFFF0
|
||||
};
|
||||
|
||||
const char* CategoryIDToCategoryName(CategoryID category_id);
|
||||
CategoryID CategoryNameToCategoryID(const char* category_name);
|
||||
|
||||
} // namespace bug
|
||||
|
||||
enum class CastingSlot : uint32 {
|
||||
Gem1 = 0,
|
||||
Gem2 = 1,
|
||||
|
||||
+2
-2
@@ -78,6 +78,8 @@ namespace EQEmu
|
||||
SLOT_CURSOR_BAG_END = 340,
|
||||
SLOT_TRIBUTE_BEGIN = 400,
|
||||
SLOT_TRIBUTE_END = 404,
|
||||
SLOT_GUILD_TRIBUTE_BEGIN = 450,
|
||||
SLOT_GUILD_TRIBUTE_END = 451,
|
||||
SLOT_BANK_BEGIN = 2000,
|
||||
SLOT_BANK_END = 2023,
|
||||
SLOT_BANK_BAGS_BEGIN = 2031,
|
||||
@@ -173,8 +175,6 @@ namespace EQEmu
|
||||
|
||||
// POTION_BELT_SIZE sets maximum limit..active limit will need to be handled by the appropriate AA or spell (or item?)
|
||||
static const size_t POTION_BELT_ITEM_COUNT = 5;
|
||||
|
||||
static const size_t TEXT_LINK_BODY_LENGTH = 56;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ N(OP_AcceptNewTask),
|
||||
N(OP_AckPacket),
|
||||
N(OP_Action),
|
||||
N(OP_Action2),
|
||||
N(OP_AddNimbusEffect),
|
||||
N(OP_AdventureData),
|
||||
N(OP_AdventureDetails),
|
||||
N(OP_AdventureFinish),
|
||||
@@ -339,6 +340,7 @@ N(OP_MOTD),
|
||||
N(OP_MoveCoin),
|
||||
N(OP_MoveDoor),
|
||||
N(OP_MoveItem),
|
||||
N(OP_MoveMultipleItems),
|
||||
N(OP_MoveLogDisregard),
|
||||
N(OP_MoveLogRequest),
|
||||
N(OP_MultiLineMsg),
|
||||
@@ -391,6 +393,7 @@ N(OP_PVPLeaderBoardReply),
|
||||
N(OP_PVPLeaderBoardRequest),
|
||||
N(OP_PVPStats),
|
||||
N(OP_QueryResponseThing),
|
||||
N(OP_QueryUCSServerStatus),
|
||||
N(OP_RaidInvite),
|
||||
N(OP_RaidJoin),
|
||||
N(OP_RaidUpdate),
|
||||
|
||||
+16
-2
@@ -28,7 +28,7 @@
|
||||
namespace EQEmu
|
||||
{
|
||||
namespace versions {
|
||||
enum class ClientVersion {
|
||||
enum class ClientVersion : uint32 {
|
||||
Unknown = 0,
|
||||
Client62, // Build: 'Aug 4 2005 15:40:59'
|
||||
Titanium, // Build: 'Oct 31 2005 10:33:37'
|
||||
@@ -72,7 +72,7 @@ namespace EQEmu
|
||||
uint32 ConvertClientVersionToExpansion(ClientVersion client_version);
|
||||
|
||||
|
||||
enum class MobVersion {
|
||||
enum class MobVersion : uint32 {
|
||||
Unknown = 0,
|
||||
Client62,
|
||||
Titanium,
|
||||
@@ -121,6 +121,20 @@ namespace EQEmu
|
||||
ClientVersion ConvertOfflinePCMobVersionToClientVersion(MobVersion mob_version);
|
||||
MobVersion ConvertClientVersionToOfflinePCMobVersion(ClientVersion client_version);
|
||||
|
||||
|
||||
enum UCSVersion : char {
|
||||
ucsUnknown = '\0',
|
||||
ucsClient62Chat = 'A',
|
||||
ucsClient62Mail = 'a',
|
||||
ucsTitaniumChat = 'B',
|
||||
ucsTitaniumMail = 'b',
|
||||
ucsSoFCombined = 'C',
|
||||
ucsSoDCombined = 'D',
|
||||
ucsUFCombined = 'E',
|
||||
ucsRoFCombined = 'F',
|
||||
ucsRoF2Combined = 'G'
|
||||
};
|
||||
|
||||
} /*versions*/
|
||||
|
||||
} /*EQEmu*/
|
||||
|
||||
+81
-48
@@ -280,7 +280,7 @@ union
|
||||
// horse: 0=brown, 1=white, 2=black, 3=tan
|
||||
};
|
||||
/*0340*/ uint32 spawnId; // Spawn Id
|
||||
/*0344*/ uint8 unknown0344[3];
|
||||
/*0344*/ float bounding_radius; // used in melee, overrides calc
|
||||
/*0347*/ uint8 IsMercenary;
|
||||
/*0348*/ EQEmu::TintProfile equipment_tint;
|
||||
/*0384*/ uint8 lfg; // 0=off, 1=lfg on
|
||||
@@ -551,6 +551,7 @@ struct BlockedBuffs_Struct
|
||||
/*86*/ uint16 Flags;
|
||||
};
|
||||
|
||||
// same for adding
|
||||
struct RemoveNimbusEffect_Struct
|
||||
{
|
||||
/*00*/ uint32 spawnid; // Spawn ID
|
||||
@@ -854,6 +855,7 @@ static const uint32 MAX_PP_REF_SPELLBOOK = 480; // Set for Player Profile size r
|
||||
static const uint32 MAX_PP_REF_MEMSPELL = 9; // Set for Player Profile size retain
|
||||
|
||||
static const uint32 MAX_PP_SKILL = PACKET_SKILL_ARRAY_SIZE; // 100 - actual skills buffer size
|
||||
static const uint32 MAX_PP_INNATE_SKILL = 25;
|
||||
static const uint32 MAX_PP_AA_ARRAY = 240;
|
||||
static const uint32 MAX_GROUP_MEMBERS = 6;
|
||||
static const uint32 MAX_RECAST_TYPES = 20;
|
||||
@@ -993,7 +995,8 @@ struct PlayerProfile_Struct
|
||||
/*4768*/ int32 platinum_shared; // Platinum shared between characters
|
||||
/*4772*/ uint8 unknown4808[24];
|
||||
/*4796*/ uint32 skills[MAX_PP_SKILL]; // [400] List of skills // 100 dword buffer
|
||||
/*5196*/ uint8 unknown5132[184];
|
||||
/*5196*/ uint32 InnateSkills[MAX_PP_INNATE_SKILL];
|
||||
/*5296*/ uint8 unknown5132[84];
|
||||
/*5380*/ uint32 pvp2; //
|
||||
/*5384*/ uint32 unknown5420; //
|
||||
/*5388*/ uint32 pvptype; //
|
||||
@@ -1250,21 +1253,22 @@ struct Action_Struct
|
||||
{
|
||||
/* 00 */ uint16 target; // id of target
|
||||
/* 02 */ uint16 source; // id of caster
|
||||
/* 04 */ uint16 level; // level of caster
|
||||
/* 06 */ uint16 instrument_mod;
|
||||
/* 08 */ uint32 bard_focus_id;
|
||||
/* 12 */ uint16 unknown16;
|
||||
// some kind of sequence that's the same in both actions
|
||||
// as well as the combat damage, to tie em together?
|
||||
/* 14 */ uint32 sequence;
|
||||
/* 18 */ uint32 unknown18;
|
||||
/* 22 */ uint8 type; // 231 (0xE7) for spells
|
||||
/* 23 */ uint32 unknown23;
|
||||
/* 04 */ uint16 level; // level of caster for spells, OSX dump says attack rating, guess spells use it for level
|
||||
/* 06 */ uint32 instrument_mod; // OSX dump says base damage, spells use it for bard song (different from newer clients)
|
||||
/* 10 */ float force;
|
||||
/* 14 */ float hit_heading;
|
||||
/* 18 */ float hit_pitch;
|
||||
/* 22 */ uint8 type; // 231 (0xE7) for spells, skill
|
||||
/* 23 */ uint16 unknown23; // OSX says min_damage
|
||||
/* 25 */ uint16 unknown25; // OSX says tohit
|
||||
/* 27 */ uint16 spell; // spell id being cast
|
||||
/* 29 */ uint8 unknown29;
|
||||
/* 29 */ uint8 spell_level;
|
||||
// this field seems to be some sort of success flag, if it's 4
|
||||
/* 30 */ uint8 buff_unknown; // if this is 4, a buff icon is made
|
||||
/* 31 */
|
||||
/* 30 */ uint8 effect_flag; // if this is 4, a buff icon is made
|
||||
// newer clients have some data for setting LaunchSpellData when effect_flag & 4
|
||||
// /* 31 */ uint8 spell_gem;
|
||||
// /* 32 */ uint32 inventory_slot;
|
||||
// /* 36 */ uint32 item_cast_type;
|
||||
};
|
||||
|
||||
// this is what prints the You have been struck. and the regular
|
||||
@@ -1274,12 +1278,12 @@ struct CombatDamage_Struct
|
||||
{
|
||||
/* 00 */ uint16 target;
|
||||
/* 02 */ uint16 source;
|
||||
/* 04 */ uint8 type; //slashing, etc. 231 (0xE7) for spells
|
||||
/* 04 */ uint8 type; //slashing, etc. 231 (0xE7) for spells, skill
|
||||
/* 05 */ uint16 spellid;
|
||||
/* 07 */ uint32 damage;
|
||||
/* 11 */ float force;
|
||||
/* 15 */ float meleepush_xy; // see above notes in Action_Struct
|
||||
/* 19 */ float meleepush_z;
|
||||
/* 15 */ float hit_heading; // see above notes in Action_Struct
|
||||
/* 19 */ float hit_pitch;
|
||||
/* 23 */ uint32 special; // 2 = Rampage, 1 = Wild Rampage
|
||||
};
|
||||
|
||||
@@ -3320,23 +3324,32 @@ struct GuildMakeLeader{
|
||||
char target[64];
|
||||
};
|
||||
|
||||
struct BugStruct{
|
||||
/*0000*/ char chartype[64];
|
||||
/*0064*/ char name[96];
|
||||
/*0160*/ char ui[128];
|
||||
/*0288*/ float x;
|
||||
/*0292*/ float y;
|
||||
/*0296*/ float z;
|
||||
/*0300*/ float heading;
|
||||
/*0304*/ uint32 unknown304;
|
||||
/*0308*/ char unknown308[160];
|
||||
/*0468*/ char target_name[64];
|
||||
/*0532*/ uint32 type;
|
||||
/*0536*/ char unknown536[2052];
|
||||
/*2584*/ char bug[2048];
|
||||
/*4632*/ char unknown4632[6];
|
||||
/*4638*/ char system_info[4094];
|
||||
struct BugReport_Struct {
|
||||
/*0000*/ uint32 category_id;
|
||||
/*0004*/ char category_name[64];
|
||||
/*0068*/ char reporter_name[64];
|
||||
/*0132*/ char unused_0132[32];
|
||||
/*0164*/ char ui_path[128];
|
||||
/*0292*/ float pos_x;
|
||||
/*0296*/ float pos_y;
|
||||
/*0300*/ float pos_z;
|
||||
/*0304*/ uint32 heading;
|
||||
/*0308*/ uint32 unused_0308;
|
||||
/*0312*/ uint32 time_played;
|
||||
/*0316*/ char padding_0316[8];
|
||||
/*0324*/ uint32 target_id;
|
||||
/*0328*/ char padding_0328[140];
|
||||
/*0468*/ uint32 unknown_0468; // seems to always be '0'
|
||||
/*0472*/ char target_name[64];
|
||||
/*0536*/ uint32 optional_info_mask;
|
||||
|
||||
// this looks like a butchered 8k buffer with 2 trailing dword fields
|
||||
/*0540*/ char unused_0540[2052];
|
||||
/*2592*/ char bug_report[2050];
|
||||
/*4642*/ char system_info[4098];
|
||||
/*8740*/
|
||||
};
|
||||
|
||||
struct Make_Pet_Struct { //Simple struct for getting pet info
|
||||
uint8 level;
|
||||
uint8 class_;
|
||||
@@ -3363,20 +3376,21 @@ struct Ground_Spawn{
|
||||
struct Ground_Spawns {
|
||||
struct Ground_Spawn spawn[50]; //Assigned max number to allow
|
||||
};
|
||||
struct PetitionBug_Struct{
|
||||
uint32 petition_number;
|
||||
uint32 unknown4;
|
||||
char accountname[64];
|
||||
uint32 zoneid;
|
||||
char name[64];
|
||||
uint32 level;
|
||||
uint32 class_;
|
||||
uint32 race;
|
||||
uint32 unknown152[3];
|
||||
uint32 time;
|
||||
uint32 unknown168;
|
||||
char text[1028];
|
||||
};
|
||||
|
||||
//struct PetitionBug_Struct{
|
||||
// uint32 petition_number;
|
||||
// uint32 unknown4;
|
||||
// char accountname[64];
|
||||
// uint32 zoneid;
|
||||
// char name[64];
|
||||
// uint32 level;
|
||||
// uint32 class_;
|
||||
// uint32 race;
|
||||
// uint32 unknown152[3];
|
||||
// uint32 time;
|
||||
// uint32 unknown168;
|
||||
// char text[1028];
|
||||
//};
|
||||
|
||||
struct ApproveZone_Struct {
|
||||
char name[64];
|
||||
@@ -4764,6 +4778,7 @@ struct BuffIconEntry_Struct
|
||||
uint32 spell_id;
|
||||
int32 tics_remaining;
|
||||
uint32 num_hits;
|
||||
char caster[64];
|
||||
};
|
||||
|
||||
struct BuffIcon_Struct
|
||||
@@ -4773,6 +4788,7 @@ struct BuffIcon_Struct
|
||||
uint16 count;
|
||||
uint8 type; // 0 = self buff window, 1 = self target window, 4 = group, 5 = PC, 7 = NPC
|
||||
int32 tic_timer;
|
||||
int32 name_lengths; // so ahh we kind of do these packets hacky, this is the total length of all the names to make creating the real packets in the translators easier
|
||||
BuffIconEntry_Struct entries[0];
|
||||
};
|
||||
|
||||
@@ -5351,6 +5367,23 @@ struct AuraDestory_Struct {
|
||||
};
|
||||
// I think we can assume it's just action for 2, client doesn't seem to do anything with the rest of the data in that case
|
||||
|
||||
struct SayLinkBodyFrame_Struct {
|
||||
/*000*/ char ActionID[1];
|
||||
/*001*/ char ItemID[5];
|
||||
/*006*/ char Augment1[5];
|
||||
/*011*/ char Augment2[5];
|
||||
/*016*/ char Augment3[5];
|
||||
/*021*/ char Augment4[5];
|
||||
/*026*/ char Augment5[5];
|
||||
/*031*/ char Augment6[5];
|
||||
/*036*/ char IsEvolving[1];
|
||||
/*037*/ char EvolveGroup[4];
|
||||
/*041*/ char EvolveLevel[2];
|
||||
/*043*/ char OrnamentIcon[5];
|
||||
/*048*/ char Hash[8];
|
||||
/*056*/
|
||||
};
|
||||
|
||||
// Restore structure packing to default
|
||||
#pragma pack()
|
||||
|
||||
|
||||
+96
-336
@@ -23,351 +23,112 @@
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
std::string EQEmuConfig::ConfigFile = "eqemu_config.xml";
|
||||
std::string EQEmuConfig::ConfigFile = "eqemu_config.json";
|
||||
EQEmuConfig *EQEmuConfig::_config = nullptr;
|
||||
|
||||
void EQEmuConfig::do_world(TiXmlElement *ele)
|
||||
{
|
||||
const char *text;
|
||||
TiXmlElement * sub_ele;;
|
||||
text = ParseTextBlock(ele, "shortname");
|
||||
if (text) {
|
||||
ShortName = text;
|
||||
}
|
||||
text = ParseTextBlock(ele, "longname");
|
||||
if (text) {
|
||||
LongName = text;
|
||||
}
|
||||
text = ParseTextBlock(ele, "address", true);
|
||||
if (text) {
|
||||
WorldAddress = text;
|
||||
}
|
||||
text = ParseTextBlock(ele, "localaddress", true);
|
||||
if (text) {
|
||||
LocalAddress = text;
|
||||
}
|
||||
text = ParseTextBlock(ele, "maxclients", true);
|
||||
if (text) {
|
||||
MaxClients = atoi(text);
|
||||
}
|
||||
// Get the <key> element
|
||||
text = ParseTextBlock(ele, "key", true);
|
||||
if (text) {
|
||||
SharedKey = text;
|
||||
}
|
||||
// Get the <loginserver> element
|
||||
sub_ele = ele->FirstChildElement("loginserver");
|
||||
if (sub_ele) {
|
||||
text = ParseTextBlock(sub_ele, "host", true);
|
||||
if (text) {
|
||||
LoginHost = text;
|
||||
}
|
||||
text = ParseTextBlock(sub_ele, "port", true);
|
||||
if (text) {
|
||||
LoginPort = atoi(text);
|
||||
}
|
||||
text = ParseTextBlock(sub_ele, "legacy", true);
|
||||
if (text) {
|
||||
LoginLegacy = atoi(text) > 0 ? true : false;
|
||||
}
|
||||
text = ParseTextBlock(sub_ele, "account", true);
|
||||
if (text) {
|
||||
LoginAccount = text;
|
||||
}
|
||||
text = ParseTextBlock(sub_ele, "password", true);
|
||||
if (text) {
|
||||
LoginPassword = text;
|
||||
}
|
||||
void EQEmuConfig::parse_config() {
|
||||
|
||||
ShortName = _root["server"]["world"].get("shortname", "").asString();
|
||||
LongName = _root["server"]["world"].get("longname", "").asString();
|
||||
WorldAddress = _root["server"]["world"].get("address", "").asString();
|
||||
LocalAddress = _root["server"]["world"].get("localaddress", "").asString();
|
||||
MaxClients = atoi(_root["server"]["world"].get("maxclients", "-1").asString().c_str());
|
||||
SharedKey = _root["server"]["world"].get("key", "").asString();
|
||||
LoginCount = 0;
|
||||
|
||||
if (_root["server"]["world"]["loginserver"].isObject()) {
|
||||
LoginHost = _root["server"]["world"]["loginserver"].get("host", "login.eqemulator.net").asString();
|
||||
LoginPort = atoi(_root["server"]["world"]["loginserver"].get("port", "5998").asString().c_str());
|
||||
LoginLegacy = false;
|
||||
if (_root["server"]["world"]["loginserver"].get("legacy", "0").asString() == "1") LoginLegacy = true;
|
||||
LoginAccount = _root["server"]["world"]["loginserver"].get("account", "").asString();
|
||||
LoginPassword = _root["server"]["world"]["loginserver"].get("password", "").asString();
|
||||
} else {
|
||||
char str[32];
|
||||
char str[32];
|
||||
loginlist.Clear();
|
||||
do {
|
||||
sprintf(str, "loginserver%i", ++LoginCount);
|
||||
sub_ele = ele->FirstChildElement(str);
|
||||
if (sub_ele) {
|
||||
auto loginconfig = new LoginConfig;
|
||||
text = ParseTextBlock(sub_ele, "host", true);
|
||||
if (text) {
|
||||
loginconfig->LoginHost = text;
|
||||
}
|
||||
text = ParseTextBlock(sub_ele, "port", true);
|
||||
if (text) {
|
||||
loginconfig->LoginPort = atoi(text);
|
||||
}
|
||||
text = ParseTextBlock(sub_ele, "legacy", true);
|
||||
if (text) {
|
||||
loginconfig->LoginLegacy = atoi(text) > 0 ? true : false;
|
||||
}
|
||||
text = ParseTextBlock(sub_ele, "account", true);
|
||||
if (text) {
|
||||
loginconfig->LoginAccount = text;
|
||||
}
|
||||
text = ParseTextBlock(sub_ele, "password", true);
|
||||
if (text) {
|
||||
loginconfig->LoginPassword = text;
|
||||
}
|
||||
loginlist.Insert(loginconfig);
|
||||
if (!_root["server"]["world"][str].isObject()) {
|
||||
break;
|
||||
}
|
||||
} while (sub_ele);
|
||||
}
|
||||
// Check for locked
|
||||
sub_ele = ele->FirstChildElement("locked");
|
||||
if (sub_ele != nullptr) {
|
||||
Locked = true;
|
||||
}
|
||||
// Get the <tcp> element
|
||||
sub_ele = ele->FirstChildElement("tcp");
|
||||
if (sub_ele != nullptr) {
|
||||
text = sub_ele->Attribute("ip");
|
||||
if (text) {
|
||||
WorldIP = text;
|
||||
}
|
||||
text = sub_ele->Attribute("port");
|
||||
if (text) {
|
||||
WorldTCPPort = atoi(text);
|
||||
}
|
||||
}
|
||||
|
||||
sub_ele = ele->FirstChildElement("telnet");
|
||||
if (sub_ele != nullptr) {
|
||||
text = sub_ele->Attribute("ip");
|
||||
if (text) {
|
||||
TelnetIP = text;
|
||||
}
|
||||
text = sub_ele->Attribute("port");
|
||||
if (text) {
|
||||
TelnetTCPPort = atoi(text);
|
||||
}
|
||||
text = sub_ele->Attribute("enabled");
|
||||
if (text && !strcasecmp(text, "true")) {
|
||||
TelnetEnabled = true;
|
||||
}
|
||||
}
|
||||
auto loginconfig = new LoginConfig;
|
||||
loginconfig->LoginHost = _root["server"]["world"][str].get("host", "login.eqemulator.net").asString();
|
||||
loginconfig->LoginPort = atoi(_root["server"]["world"][str].get("port", "5998").asString().c_str());
|
||||
loginconfig->LoginAccount = _root["server"]["world"][str].get("account", "").asString();
|
||||
loginconfig->LoginPassword = _root["server"]["world"][str].get("password", "").asString();
|
||||
|
||||
// Get the <http> element
|
||||
sub_ele = ele->FirstChildElement("http");
|
||||
if (sub_ele != nullptr) {
|
||||
// text = sub_ele->Attribute("ip");
|
||||
// if (text)
|
||||
// WorldIP=text;
|
||||
text = sub_ele->Attribute("mimefile");
|
||||
if (text) {
|
||||
WorldHTTPMimeFile = text;
|
||||
}
|
||||
text = sub_ele->Attribute("port");
|
||||
if (text) {
|
||||
WorldHTTPPort = atoi(text);
|
||||
}
|
||||
text = sub_ele->Attribute("enabled");
|
||||
if (text && !strcasecmp(text, "true")) {
|
||||
WorldHTTPEnabled = true;
|
||||
}
|
||||
loginconfig->LoginLegacy = false;
|
||||
if (_root["server"]["world"][str].get("legacy", "0").asString() == "1") loginconfig->LoginLegacy = true;
|
||||
loginlist.Insert(loginconfig);
|
||||
} while (LoginCount < 100);
|
||||
}
|
||||
|
||||
|
||||
//<locked> from xml converts to json as locked: "", so i default to "false".
|
||||
//The only way to enable locked is by switching to true, meaning this value is always false until manually set true
|
||||
Locked = false;
|
||||
if (_root["server"]["world"].get("locked", "false").asString() == "true") Locked = true;
|
||||
WorldIP = _root["server"]["world"]["tcp"].get("host", "127.0.0.1").asString();
|
||||
WorldTCPPort = atoi(_root["server"]["world"]["tcp"].get("port", "9000").asString().c_str());
|
||||
|
||||
TelnetIP = _root["server"]["world"]["telnet"].get("ip", "127.0.0.1").asString();
|
||||
TelnetTCPPort = atoi(_root["server"]["world"]["telnet"].get("port", "9001").asString().c_str());
|
||||
TelnetEnabled = false;
|
||||
if (_root["server"]["world"]["telnet"].get("enabled", "false").asString() == "true") TelnetEnabled = true;
|
||||
|
||||
WorldHTTPMimeFile = _root["server"]["world"]["http"].get("mimefile", "mime.types").asString();
|
||||
WorldHTTPPort = atoi(_root["server"]["world"]["http"].get("port", "9080").asString().c_str());
|
||||
WorldHTTPEnabled = false;
|
||||
if (_root["server"]["world"]["http"].get("enabled", "false").asString() == "true") WorldHTTPEnabled = true;
|
||||
|
||||
ChatHost = _root["server"]["chatserver"].get("host", "eqchat.eqemulator.net").asString();
|
||||
ChatPort = atoi(_root["server"]["chatserver"].get("port", "7778").asString().c_str());
|
||||
|
||||
MailHost = _root["server"]["mailserver"].get("host", "eqmail.eqemulator.net").asString();
|
||||
MailPort = atoi(_root["server"]["mailserver"].get("port", "7778").asString().c_str());
|
||||
|
||||
DatabaseUsername = _root["server"]["database"].get("username", "eq").asString();
|
||||
DatabasePassword = _root["server"]["database"].get("password", "eq").asString();
|
||||
DatabaseHost = _root["server"]["database"].get("host", "localhost").asString();
|
||||
DatabasePort = atoi(_root["server"]["database"].get("port", "3306").asString().c_str());
|
||||
DatabaseDB = _root["server"]["database"].get("db", "eq").asString();
|
||||
|
||||
QSDatabaseHost = _root["server"]["qsdatabase"].get("host", "localhost").asString();
|
||||
QSDatabasePort = atoi(_root["server"]["qsdatabase"].get("port", "3306").asString().c_str());
|
||||
QSDatabaseUsername = _root["server"]["qsdatabase"].get("username", "eq").asString();
|
||||
QSDatabasePassword = _root["server"]["qsdatabase"].get("password", "eq").asString();
|
||||
QSDatabaseDB = _root["server"]["qsdatabase"].get("db", "eq").asString();
|
||||
|
||||
DefaultStatus = atoi(_root["server"]["zones"].get("defaultstatus", 0).asString().c_str());
|
||||
ZonePortLow = atoi(_root["server"]["zones"]["ports"].get("low", "7000").asString().c_str());
|
||||
ZonePortHigh = atoi(_root["server"]["zones"]["ports"].get("high", "7999").asString().c_str());
|
||||
|
||||
SpellsFile = _root["server"]["files"].get("spells", "spells_us.txt").asString();
|
||||
OpCodesFile = _root["server"]["files"].get("opcodes", "opcodes.conf").asString();
|
||||
PluginPlFile = _root["server"]["files"].get("plugin.pl", "plugin.pl").asString();
|
||||
|
||||
MapDir = _root["server"]["directories"].get("maps", "Maps/").asString();
|
||||
QuestDir = _root["server"]["directories"].get("quests", "quests/").asString();
|
||||
PluginDir = _root["server"]["directories"].get("plugins", "plugins/").asString();
|
||||
LuaModuleDir = _root["server"]["directories"].get("lua_modules", "lua_modules/").asString();
|
||||
PatchDir = _root["server"]["directories"].get("patches", "./").asString();
|
||||
SharedMemDir = _root["server"]["directories"].get("shared_memory", "shared/").asString();
|
||||
LogDir = _root["server"]["directories"].get("logs", "logs/").asString();
|
||||
|
||||
LogPrefix = _root["server"]["launcher"].get("logprefix", "logs/zone-").asString();
|
||||
LogSuffix = _root["server"]["launcher"].get("logsuffix", ".log").asString();
|
||||
RestartWait = atoi(_root["server"]["launcher"]["timers"].get("restart", "10000").asString().c_str());
|
||||
TerminateWait = atoi(_root["server"]["launcher"]["timers"].get("reterminate", "10000").asString().c_str());
|
||||
InitialBootWait = atoi(_root["server"]["launcher"]["timers"].get("initial", "20000").asString().c_str());
|
||||
ZoneBootInterval = atoi(_root["server"]["launcher"]["timers"].get("interval", "2000").asString().c_str());
|
||||
#ifdef WIN32
|
||||
ZoneExe = _root["server"]["launcher"].get("exe", "zone.exe").asString();
|
||||
#else
|
||||
ZoneExe = _root["server"]["launcher"].get("exe", "./zone").asString();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void EQEmuConfig::do_chatserver(TiXmlElement *ele)
|
||||
{
|
||||
const char *text;
|
||||
text = ParseTextBlock(ele, "host", true);
|
||||
if (text) {
|
||||
ChatHost = text;
|
||||
}
|
||||
text = ParseTextBlock(ele, "port", true);
|
||||
if (text) {
|
||||
ChatPort = atoi(text);
|
||||
}
|
||||
}
|
||||
|
||||
void EQEmuConfig::do_mailserver(TiXmlElement *ele)
|
||||
{
|
||||
const char *text;
|
||||
text = ParseTextBlock(ele, "host", true);
|
||||
if (text) {
|
||||
MailHost = text;
|
||||
}
|
||||
text = ParseTextBlock(ele, "port", true);
|
||||
if (text) {
|
||||
MailPort = atoi(text);
|
||||
}
|
||||
}
|
||||
|
||||
void EQEmuConfig::do_database(TiXmlElement *ele)
|
||||
{
|
||||
const char *text;
|
||||
text = ParseTextBlock(ele, "host", true);
|
||||
if (text) {
|
||||
DatabaseHost = text;
|
||||
}
|
||||
text = ParseTextBlock(ele, "port", true);
|
||||
if (text) {
|
||||
DatabasePort = atoi(text);
|
||||
}
|
||||
text = ParseTextBlock(ele, "username", true);
|
||||
if (text) {
|
||||
DatabaseUsername = text;
|
||||
}
|
||||
text = ParseTextBlock(ele, "password", true);
|
||||
if (text) {
|
||||
DatabasePassword = text;
|
||||
}
|
||||
text = ParseTextBlock(ele, "db", true);
|
||||
if (text) {
|
||||
DatabaseDB = text;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void EQEmuConfig::do_qsdatabase(TiXmlElement *ele)
|
||||
{
|
||||
const char *text;
|
||||
text = ParseTextBlock(ele, "host", true);
|
||||
if (text) {
|
||||
QSDatabaseHost = text;
|
||||
}
|
||||
text = ParseTextBlock(ele, "port", true);
|
||||
if (text) {
|
||||
QSDatabasePort = atoi(text);
|
||||
}
|
||||
text = ParseTextBlock(ele, "username", true);
|
||||
if (text) {
|
||||
QSDatabaseUsername = text;
|
||||
}
|
||||
text = ParseTextBlock(ele, "password", true);
|
||||
if (text) {
|
||||
QSDatabasePassword = text;
|
||||
}
|
||||
text = ParseTextBlock(ele, "db", true);
|
||||
if (text) {
|
||||
QSDatabaseDB = text;
|
||||
}
|
||||
}
|
||||
|
||||
void EQEmuConfig::do_zones(TiXmlElement *ele)
|
||||
{
|
||||
const char *text;
|
||||
TiXmlElement *sub_ele;
|
||||
// TiXmlNode *node,*sub_node;
|
||||
text = ParseTextBlock(ele, "defaultstatus", true);
|
||||
if (text) {
|
||||
DefaultStatus = atoi(text);
|
||||
}
|
||||
// Get the <ports> element
|
||||
sub_ele = ele->FirstChildElement("ports");
|
||||
if (sub_ele != nullptr) {
|
||||
text = sub_ele->Attribute("low");
|
||||
if (text) {
|
||||
ZonePortLow = atoi(text);
|
||||
};
|
||||
text = sub_ele->Attribute("high");
|
||||
if (text) {
|
||||
ZonePortHigh = atoi(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EQEmuConfig::do_files(TiXmlElement *ele)
|
||||
{
|
||||
const char *text;
|
||||
text = ParseTextBlock(ele, "spells", true);
|
||||
if (text) {
|
||||
SpellsFile = text;
|
||||
}
|
||||
text = ParseTextBlock(ele, "opcodes", true);
|
||||
if (text) {
|
||||
OpCodesFile = text;
|
||||
}
|
||||
text = ParseTextBlock(ele, "plugin.pl", true);
|
||||
if (text) {
|
||||
PluginPlFile = text;
|
||||
}
|
||||
}
|
||||
|
||||
void EQEmuConfig::do_directories(TiXmlElement *ele)
|
||||
{
|
||||
const char *text;
|
||||
text = ParseTextBlock(ele, "maps", true);
|
||||
if (text) {
|
||||
MapDir = text;
|
||||
if ( MapDir.back() != '/' )
|
||||
MapDir += '/';
|
||||
}
|
||||
text = ParseTextBlock(ele, "quests", true);
|
||||
if (text) {
|
||||
QuestDir = text;
|
||||
if ( QuestDir.back() != '/' )
|
||||
QuestDir += '/';
|
||||
}
|
||||
text = ParseTextBlock(ele, "plugins", true);
|
||||
if (text) {
|
||||
PluginDir = text;
|
||||
if ( PluginDir.back() != '/' )
|
||||
PluginDir += '/';
|
||||
}
|
||||
text = ParseTextBlock(ele, "lua_modules", true);
|
||||
if (text) {
|
||||
LuaModuleDir = text;
|
||||
if ( LuaModuleDir.back() != '/' )
|
||||
LuaModuleDir += '/';
|
||||
}
|
||||
text = ParseTextBlock(ele, "patches", true);
|
||||
if (text) {
|
||||
PatchDir = text;
|
||||
if ( PatchDir.back() != '/' )
|
||||
PatchDir += '/';
|
||||
}
|
||||
text = ParseTextBlock(ele, "shared_memory", true);
|
||||
if (text) {
|
||||
SharedMemDir = text;
|
||||
if ( SharedMemDir.back() != '/' )
|
||||
SharedMemDir += '/';
|
||||
}
|
||||
//Not Fully Implemented yet LogDir
|
||||
text = ParseTextBlock(ele, "logs", true);
|
||||
if (text) {
|
||||
LogDir = text;
|
||||
if ( LogDir.back() != '/' )
|
||||
LogDir += '/';
|
||||
}
|
||||
}
|
||||
|
||||
void EQEmuConfig::do_launcher(TiXmlElement *ele)
|
||||
{
|
||||
const char *text;
|
||||
TiXmlElement *sub_ele;
|
||||
text = ParseTextBlock(ele, "logprefix", true);
|
||||
if (text) {
|
||||
LogPrefix = text;
|
||||
}
|
||||
text = ParseTextBlock(ele, "logsuffix", true);
|
||||
if (text) {
|
||||
LogSuffix = text;
|
||||
}
|
||||
// Get the <exe> element
|
||||
text = ParseTextBlock(ele, "exe", true);
|
||||
if (text) {
|
||||
ZoneExe = text;
|
||||
}
|
||||
// Get the <timers> element
|
||||
sub_ele = ele->FirstChildElement("timers");
|
||||
if (sub_ele != nullptr) {
|
||||
text = sub_ele->Attribute("restart");
|
||||
if (text) {
|
||||
RestartWait = atoi(text);
|
||||
}
|
||||
text = sub_ele->Attribute("reterminate");
|
||||
if (text) {
|
||||
TerminateWait = atoi(text);
|
||||
}
|
||||
text = sub_ele->Attribute("initial");
|
||||
if (text) {
|
||||
InitialBootWait = atoi(text);
|
||||
}
|
||||
text = sub_ele->Attribute("interval");
|
||||
if (text) {
|
||||
ZoneBootInterval = atoi(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::string EQEmuConfig::GetByName(const std::string &var_name) const
|
||||
{
|
||||
if (var_name == "ShortName") {
|
||||
@@ -564,4 +325,3 @@ void EQEmuConfig::Dump() const
|
||||
std::cout << "DefaultStatus = " << (int)DefaultStatus << std::endl;
|
||||
// std::cout << "DynamicCount = " << DynamicCount << std::endl;
|
||||
}
|
||||
|
||||
|
||||
+27
-84
@@ -18,8 +18,9 @@
|
||||
#ifndef __EQEmuConfig_H
|
||||
#define __EQEmuConfig_H
|
||||
|
||||
#include "xml_parser.h"
|
||||
#include "json/json.h"
|
||||
#include "linked_list.h"
|
||||
#include <fstream>
|
||||
|
||||
struct LoginConfig {
|
||||
std::string LoginHost;
|
||||
@@ -29,7 +30,7 @@ struct LoginConfig {
|
||||
bool LoginLegacy;
|
||||
};
|
||||
|
||||
class EQEmuConfig : public XMLParser
|
||||
class EQEmuConfig
|
||||
{
|
||||
public:
|
||||
virtual std::string GetByName(const std::string &var_name) const;
|
||||
@@ -115,88 +116,14 @@ class EQEmuConfig : public XMLParser
|
||||
protected:
|
||||
|
||||
static EQEmuConfig *_config;
|
||||
|
||||
Json::Value _root;
|
||||
static std::string ConfigFile;
|
||||
|
||||
#define ELEMENT(name) \
|
||||
void do_##name(TiXmlElement *ele);
|
||||
#include "eqemu_config_elements.h"
|
||||
|
||||
void parse_config();
|
||||
|
||||
EQEmuConfig()
|
||||
{
|
||||
// import the needed handler prototypes
|
||||
#define ELEMENT(name) \
|
||||
Handlers[#name]=(ElementHandler)&EQEmuConfig::do_##name;
|
||||
#include "eqemu_config_elements.h"
|
||||
// Set sane defaults
|
||||
// Login server
|
||||
LoginHost = "login.eqemulator.net";
|
||||
LoginPort = 5998;
|
||||
LoginLegacy = false;
|
||||
// World
|
||||
Locked = false;
|
||||
WorldTCPPort = 9000;
|
||||
TelnetTCPPort = 9001;
|
||||
TelnetEnabled = false;
|
||||
WorldHTTPEnabled = false;
|
||||
WorldHTTPPort = 9080;
|
||||
WorldHTTPMimeFile = "mime.types";
|
||||
SharedKey = ""; //blank disables authentication
|
||||
// Mail
|
||||
ChatHost = "eqchat.eqemulator.net";
|
||||
ChatPort = 7778;
|
||||
// Mail
|
||||
MailHost = "eqmail.eqemulator.net";
|
||||
MailPort = 7779;
|
||||
// Mysql
|
||||
DatabaseHost = "localhost";
|
||||
DatabasePort = 3306;
|
||||
DatabaseUsername = "eq";
|
||||
DatabasePassword = "eq";
|
||||
DatabaseDB = "eq";
|
||||
// QueryServ Database
|
||||
QSDatabaseHost = "localhost";
|
||||
QSDatabasePort = 3306;
|
||||
QSDatabaseUsername = "eq";
|
||||
QSDatabasePassword = "eq";
|
||||
QSDatabaseDB = "eq";
|
||||
// Files
|
||||
SpellsFile = "spells_us.txt";
|
||||
OpCodesFile = "opcodes.conf";
|
||||
PluginPlFile = "plugin.pl";
|
||||
// Dirs
|
||||
MapDir = "Maps/";
|
||||
QuestDir = "quests/";
|
||||
PluginDir = "plugins/";
|
||||
LuaModuleDir = "lua_modules/";
|
||||
PatchDir = "./";
|
||||
SharedMemDir = "shared/";
|
||||
LogDir = "logs/";
|
||||
{
|
||||
|
||||
// Launcher
|
||||
LogPrefix = "logs/zone-";
|
||||
LogSuffix = ".log";
|
||||
RestartWait = 10000; //milliseconds
|
||||
TerminateWait = 10000; //milliseconds
|
||||
InitialBootWait = 20000; //milliseconds
|
||||
ZoneBootInterval = 2000; //milliseconds
|
||||
#ifdef WIN32
|
||||
ZoneExe = "zone.exe";
|
||||
#else
|
||||
ZoneExe = "./zone";
|
||||
#endif
|
||||
// Zones
|
||||
ZonePortLow = 7000;
|
||||
ZonePortHigh = 7999;
|
||||
DefaultStatus = 0;
|
||||
// For where zones need to connect to.
|
||||
WorldIP = "127.0.0.1";
|
||||
TelnetIP = "127.0.0.1";
|
||||
// Dynamics to start
|
||||
//DynamicCount=5;
|
||||
MaxClients = -1;
|
||||
LoginCount = 0;
|
||||
}
|
||||
virtual ~EQEmuConfig() {}
|
||||
|
||||
@@ -205,9 +132,7 @@ class EQEmuConfig : public XMLParser
|
||||
// Produce a const singleton
|
||||
static const EQEmuConfig *get()
|
||||
{
|
||||
if (_config == nullptr) {
|
||||
LoadConfig();
|
||||
}
|
||||
LoadConfig();
|
||||
return (_config);
|
||||
}
|
||||
|
||||
@@ -221,10 +146,28 @@ class EQEmuConfig : public XMLParser
|
||||
static bool LoadConfig()
|
||||
{
|
||||
if (_config != nullptr) {
|
||||
delete _config;
|
||||
return true;
|
||||
}
|
||||
_config = new EQEmuConfig;
|
||||
return _config->ParseFile(EQEmuConfig::ConfigFile.c_str(), "server");
|
||||
|
||||
return parseFile();
|
||||
}
|
||||
|
||||
// Load config file and parse data
|
||||
static bool parseFile() {
|
||||
if (_config == nullptr) {
|
||||
return LoadConfig();
|
||||
}
|
||||
|
||||
std::ifstream fconfig(EQEmuConfig::ConfigFile, std::ifstream::binary);
|
||||
try {
|
||||
fconfig >> _config->_root;
|
||||
_config->parse_config();
|
||||
}
|
||||
catch (std::exception) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void Dump() const;
|
||||
|
||||
@@ -88,6 +88,8 @@ enum LogCategory {
|
||||
Headless_Client,
|
||||
HP_Update,
|
||||
FixZ,
|
||||
Food,
|
||||
Traps,
|
||||
MaxCategoryID /* Don't Remove this*/
|
||||
};
|
||||
|
||||
@@ -140,7 +142,9 @@ static const char* LogCategoryName[LogCategory::MaxCategoryID] = {
|
||||
"Client Login",
|
||||
"Headless Client",
|
||||
"HP Update",
|
||||
"FixZ"
|
||||
"FixZ",
|
||||
"Food",
|
||||
"Traps"
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "event_sub.h"
|
||||
#include <string.h>
|
||||
|
||||
void EventSubscriptionWatcher::Subscribe(const std::string &event_name)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <unordered_map>
|
||||
#include <string>
|
||||
|
||||
class EventSubscriptionWatcher
|
||||
{
|
||||
|
||||
@@ -154,6 +154,7 @@ enum { //timer settings, all in milliseconds
|
||||
AIscanarea_delay = 6000,
|
||||
AIfeignremember_delay = 500,
|
||||
AItarget_check_duration = 500,
|
||||
AI_scan_door_open_interval = 1000,
|
||||
// AIClientScanarea_delay = 750, //used in REVERSE_AGGRO
|
||||
AIassistcheck_delay = 3000, //now often a fighting NPC will yell for help
|
||||
AI_check_signal_timer_delay = 500, // How often EVENT_SIGNAL checks are processed
|
||||
@@ -219,6 +220,9 @@ enum { //some random constants
|
||||
//the square of the maximum range at whihc you could possibly use NPC services (shop, tribute, etc)
|
||||
#define USE_NPC_RANGE2 200*200 //arbitrary right now
|
||||
|
||||
// Squared range for rampage 75.0 * 75.0 for now
|
||||
#define NPC_RAMPAGE_RANGE2 5625.0f
|
||||
|
||||
//the formula for experience for killing a mob.
|
||||
//level is the only valid variable to use
|
||||
#define EXP_FORMULA level*level*75*35/10
|
||||
@@ -276,6 +280,11 @@ enum {
|
||||
#define SAYLINK_ITEM_ID 0xFFFFF
|
||||
|
||||
|
||||
// consumption timers for food/drink here instead of rules because the client
|
||||
// uses these. Times in ms.
|
||||
#define CONSUMPTION_TIMER 46000
|
||||
#define CONSUMPTION_MNK_TIMER 92000
|
||||
|
||||
/*
|
||||
|
||||
Developer configuration
|
||||
|
||||
@@ -111,7 +111,8 @@
|
||||
#define GLM_COMPILER_GCC70 0x02000A00
|
||||
#define GLM_COMPILER_GCC71 0x02000B00
|
||||
#define GLM_COMPILER_GCC72 0x02000C00
|
||||
#define GLM_COMPILER_GCC80 0x02000D00
|
||||
#define GLM_COMPILER_GCC73 0x02000D00
|
||||
#define GLM_COMPILER_GCC80 0x02000E00
|
||||
|
||||
// CUDA
|
||||
#define GLM_COMPILER_CUDA 0x10000000
|
||||
@@ -283,6 +284,8 @@
|
||||
# define GLM_COMPILER (GLM_COMPILER_GCC71)
|
||||
# elif (__GNUC__ == 7) && (__GNUC_MINOR__ == 2)
|
||||
# define GLM_COMPILER (GLM_COMPILER_GCC72)
|
||||
# elif (__GNUC__ == 7) && (__GNUC_MINOR__ == 3)
|
||||
# define GLM_COMPILER (GLM_COMPILER_GCC73)
|
||||
# elif (__GNUC__ >= 8)
|
||||
# define GLM_COMPILER (GLM_COMPILER_GCC80)
|
||||
# else
|
||||
|
||||
+52
-14
@@ -194,32 +194,70 @@ uint32 rnd_hash( time_t t, clock_t c )
|
||||
|
||||
float EQ13toFloat(int d)
|
||||
{
|
||||
return ( float(d)/float(1<<2));
|
||||
}
|
||||
|
||||
float NewEQ13toFloat(int d)
|
||||
{
|
||||
return ( float(d)/float(1<<6));
|
||||
return static_cast<float>(d) / 64.0f;
|
||||
}
|
||||
|
||||
float EQ19toFloat(int d)
|
||||
{
|
||||
return ( float(d)/float(1<<3));
|
||||
return static_cast<float>(d) / 8.0f;
|
||||
}
|
||||
|
||||
int FloatToEQ13(float d)
|
||||
{
|
||||
return int(d*float(1<<2));
|
||||
}
|
||||
|
||||
int NewFloatToEQ13(float d)
|
||||
{
|
||||
return int(d*float(1<<6));
|
||||
return static_cast<int>(d * 64.0f);
|
||||
}
|
||||
|
||||
int FloatToEQ19(float d)
|
||||
{
|
||||
return int(d*float(1<<3));
|
||||
return static_cast<int>(d * 8.0f);
|
||||
}
|
||||
|
||||
float EQ12toFloat(int d)
|
||||
{
|
||||
return static_cast<float>(d) / 4.0f;
|
||||
}
|
||||
|
||||
int FloatToEQ12(float d)
|
||||
{
|
||||
return static_cast<int>((d + 2048.0f) * 4.0f) % 2048;
|
||||
}
|
||||
|
||||
float EQ10toFloat(int d)
|
||||
{
|
||||
return static_cast<float>(d) / 20.0f;
|
||||
}
|
||||
|
||||
int FloatToEQ10(float d)
|
||||
{
|
||||
return static_cast<int>(d * 20.0f);
|
||||
}
|
||||
|
||||
float EQSpeedRunToFloat(int d)
|
||||
{
|
||||
return static_cast<float>(d) / 40.0f;
|
||||
}
|
||||
|
||||
int FloatToEQSpeedRun(float d)
|
||||
{
|
||||
return static_cast<int>(d * 40.0f);
|
||||
}
|
||||
|
||||
float FixHeading(float in)
|
||||
{
|
||||
int i = 0;
|
||||
if (in >= 512.0f) {
|
||||
do {
|
||||
in -= 512.0f;
|
||||
} while (in >= 512.0f && i++ <= 5);
|
||||
}
|
||||
i = 0;
|
||||
if (in < 0.0f) {
|
||||
do {
|
||||
in += 512.0f;
|
||||
} while (in < 0.0f && i++ <= 5);
|
||||
}
|
||||
|
||||
return in;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+14
-2
@@ -50,13 +50,25 @@ uint32 ResolveIP(const char* hostname, char* errbuf = 0);
|
||||
bool ParseAddress(const char* iAddress, uint32* oIP, uint16* oPort, char* errbuf = 0);
|
||||
void CoutTimestamp(bool ms = true);
|
||||
float EQ13toFloat(int d);
|
||||
float NewEQ13toFloat(int d);
|
||||
float EQ19toFloat(int d);
|
||||
float EQHtoFloat(int d);
|
||||
int FloatToEQ13(float d);
|
||||
int NewFloatToEQ13(float d);
|
||||
int FloatToEQ19(float d);
|
||||
int FloatToEQH(float d);
|
||||
|
||||
float EQ12toFloat(int d);
|
||||
int FloatToEQ12(float d);
|
||||
|
||||
float EQ10toFloat(int d);
|
||||
int FloatToEQ10(float d);
|
||||
|
||||
// this is also a 10 bit float
|
||||
float EQSpeedRunToFloat(int d);
|
||||
int FloatToEQSpeedRun(float d);
|
||||
|
||||
// brings heading back into EQ angles range
|
||||
float FixHeading(float in);
|
||||
|
||||
uint32 SwapBits21and22(uint32 mask);
|
||||
uint32 Catch22(uint32 mask);
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
#include <mysql.h>
|
||||
#include "types.h"
|
||||
#include "mysql_request_row.h"
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#include "console_server.h"
|
||||
#include "../common/util/uuid.h"
|
||||
#include "../common/net/packet.h"
|
||||
#include "../common/eqemu_logsys.h"
|
||||
#include "../common/servertalk.h"
|
||||
#include "../common/rulesys.h"
|
||||
#include "../util/uuid.h"
|
||||
#include "../net/packet.h"
|
||||
#include "../eqemu_logsys.h"
|
||||
#include "../servertalk.h"
|
||||
#include "../rulesys.h"
|
||||
|
||||
EQ::Net::ConsoleServerConnection::ConsoleServerConnection(ConsoleServer *parent, std::shared_ptr<TCPConnection> connection)
|
||||
{
|
||||
|
||||
@@ -165,7 +165,7 @@ void EQ::Net::DaybreakConnectionManager::ProcessResend()
|
||||
{
|
||||
auto iter = m_connections.begin();
|
||||
while (iter != m_connections.end()) {
|
||||
auto connection = iter->second;
|
||||
auto &connection = iter->second;
|
||||
auto status = connection->m_status;
|
||||
|
||||
switch (status)
|
||||
@@ -747,7 +747,7 @@ void EQ::Net::DaybreakConnection::ProcessDecodedPacket(const Packet &p)
|
||||
response.zero = 0;
|
||||
response.opcode = OP_SessionStatResponse;
|
||||
response.timestamp = request.timestamp;
|
||||
response.our_timestamp = EQ::Net::HostToNetwork(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now().time_since_epoch()).count());
|
||||
response.our_timestamp = EQ::Net::HostToNetwork(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now().time_since_epoch()).count());
|
||||
response.client_sent = request.packets_sent;
|
||||
response.client_recv = request.packets_recv;
|
||||
response.server_sent = EQ::Net::HostToNetwork(m_stats.sent_packets);
|
||||
@@ -1397,4 +1397,4 @@ EQ::Net::SequenceOrder EQ::Net::DaybreakConnection::CompareSequence(uint16_t exp
|
||||
}
|
||||
|
||||
return SequencePast;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,8 +68,8 @@ namespace EQ
|
||||
SequencePast
|
||||
};
|
||||
|
||||
typedef std::chrono::high_resolution_clock::time_point Timestamp;
|
||||
typedef std::chrono::high_resolution_clock Clock;
|
||||
typedef std::chrono::steady_clock::time_point Timestamp;
|
||||
typedef std::chrono::steady_clock Clock;
|
||||
|
||||
struct DaybreakConnectionStats
|
||||
{
|
||||
@@ -282,4 +282,4 @@ namespace EQ
|
||||
friend class DaybreakConnection;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+60
-56
@@ -57,11 +57,11 @@ namespace RoF
|
||||
static inline uint32 RoFToServerTypelessSlot(structs::TypelessInventorySlot_Struct rofSlot);
|
||||
static inline uint32 RoFToServerCorpseSlot(uint32 rofCorpseSlot);
|
||||
|
||||
// server to client text link converter
|
||||
static inline void ServerToRoFTextLink(std::string& rofTextLink, const std::string& serverTextLink);
|
||||
// server to client say link converter
|
||||
static inline void ServerToRoFSayLink(std::string& rofSayLink, const std::string& serverSayLink);
|
||||
|
||||
// client to server text link converter
|
||||
static inline void RoFToServerTextLink(std::string& serverTextLink, const std::string& rofTextLink);
|
||||
// client to server say link converter
|
||||
static inline void RoFToServerSayLink(std::string& serverSayLink, const std::string& rofSayLink);
|
||||
|
||||
static inline CastingSlot ServerToRoFCastingSlot(EQEmu::CastingSlot slot);
|
||||
static inline EQEmu::CastingSlot RoFToServerCastingSlot(CastingSlot slot);
|
||||
@@ -163,22 +163,23 @@ namespace RoF
|
||||
OUT(level);
|
||||
eq->unknown06 = 0;
|
||||
eq->instrument_mod = 1.0f + (emu->instrument_mod - 10) / 10.0f;
|
||||
eq->bard_focus_id = emu->bard_focus_id;
|
||||
eq->knockback_angle = emu->sequence;
|
||||
eq->unknown22 = 0;
|
||||
OUT(force);
|
||||
OUT(hit_heading);
|
||||
OUT(hit_pitch);
|
||||
OUT(type);
|
||||
eq->damage = 0;
|
||||
eq->unknown31 = 0;
|
||||
OUT(spell);
|
||||
eq->level2 = eq->level;
|
||||
eq->effect_flag = emu->buff_unknown;
|
||||
eq->unknown39 = 14;
|
||||
eq->unknown43 = 0;
|
||||
eq->unknown44 = 17;
|
||||
eq->unknown45 = 0;
|
||||
eq->unknown46 = -1;
|
||||
eq->unknown50 = 0;
|
||||
eq->unknown54 = 0;
|
||||
OUT(spell_level);
|
||||
OUT(effect_flag);
|
||||
eq->spell_gem = 0;
|
||||
eq->slot.Type = INVALID_INDEX;
|
||||
eq->slot.Unknown02 = 0;
|
||||
eq->slot.Slot = INVALID_INDEX;
|
||||
eq->slot.SubIndex = INVALID_INDEX;
|
||||
eq->slot.AugIndex = INVALID_INDEX;
|
||||
eq->slot.Unknown01 = 0;
|
||||
eq->item_cast_type = 0;
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
@@ -460,7 +461,7 @@ namespace RoF
|
||||
{
|
||||
SETUP_VAR_ENCODE(BuffIcon_Struct);
|
||||
|
||||
uint32 sz = 12 + (17 * emu->count);
|
||||
uint32 sz = 12 + (17 * emu->count) + emu->name_lengths; // 17 includes nullterm
|
||||
__packet->size = sz;
|
||||
__packet->pBuffer = new unsigned char[sz];
|
||||
memset(__packet->pBuffer, 0, sz);
|
||||
@@ -476,7 +477,7 @@ namespace RoF
|
||||
__packet->WriteUInt32(emu->entries[i].spell_id);
|
||||
__packet->WriteUInt32(emu->entries[i].tics_remaining);
|
||||
__packet->WriteUInt32(emu->entries[i].num_hits); // Unknown
|
||||
__packet->WriteString("");
|
||||
__packet->WriteString(emu->entries[i].caster);
|
||||
}
|
||||
__packet->WriteUInt8(emu->type); // Unknown
|
||||
|
||||
@@ -520,7 +521,7 @@ namespace RoF
|
||||
|
||||
std::string old_message = emu->message;
|
||||
std::string new_message;
|
||||
ServerToRoFTextLink(new_message, old_message);
|
||||
ServerToRoFSayLink(new_message, old_message);
|
||||
|
||||
//in->size = strlen(emu->sender) + 1 + strlen(emu->targetname) + 1 + strlen(emu->message) + 1 + 36;
|
||||
in->size = strlen(emu->sender) + strlen(emu->targetname) + new_message.length() + 39;
|
||||
@@ -659,8 +660,8 @@ namespace RoF
|
||||
OUT(spellid);
|
||||
OUT(damage);
|
||||
OUT(force);
|
||||
OUT(meleepush_xy);
|
||||
OUT(meleepush_z);
|
||||
OUT(hit_heading);
|
||||
OUT(hit_pitch);
|
||||
OUT(special);
|
||||
|
||||
FINISH_ENCODE();
|
||||
@@ -847,7 +848,7 @@ namespace RoF
|
||||
|
||||
std::string old_message = emu->message;
|
||||
std::string new_message;
|
||||
ServerToRoFTextLink(new_message, old_message);
|
||||
ServerToRoFSayLink(new_message, old_message);
|
||||
|
||||
//if (new_message.length() > 512) // length restricted in packet building function due vari-length name size (no nullterm)
|
||||
// new_message = new_message.substr(0, 512);
|
||||
@@ -899,7 +900,7 @@ namespace RoF
|
||||
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
if (old_message_array[i].length() == 0) { break; }
|
||||
ServerToRoFTextLink(new_message_array[i], old_message_array[i]);
|
||||
ServerToRoFSayLink(new_message_array[i], old_message_array[i]);
|
||||
new_message_size += new_message_array[i].length() + 1;
|
||||
}
|
||||
|
||||
@@ -2184,11 +2185,11 @@ namespace RoF
|
||||
outapp->WriteUInt32(emu->skills[r]);
|
||||
}
|
||||
|
||||
outapp->WriteUInt32(25); // Unknown count
|
||||
outapp->WriteUInt32(structs::MAX_PP_INNATE_SKILL); // Innate Skills count
|
||||
|
||||
for (uint32 r = 0; r < 25; r++)
|
||||
for (uint32 r = 0; r < structs::MAX_PP_INNATE_SKILL; r++)
|
||||
{
|
||||
outapp->WriteUInt32(0); // Unknown
|
||||
outapp->WriteUInt32(emu->InnateSkills[r]); // Innate Skills (regen, slam, etc)
|
||||
}
|
||||
|
||||
outapp->WriteUInt32(structs::MAX_PP_DISCIPLINES); // Discipline count
|
||||
@@ -3295,7 +3296,7 @@ namespace RoF
|
||||
std::string old_message = &emu->message[strlen(emu->sayer)];
|
||||
std::string new_message;
|
||||
|
||||
ServerToRoFTextLink(new_message, old_message);
|
||||
ServerToRoFSayLink(new_message, old_message);
|
||||
|
||||
//in->size = 3 + 4 + 4 + strlen(emu->sayer) + 1 + 12 + new_message.length() + 1;
|
||||
in->size = strlen(emu->sayer) + new_message.length() + 25;
|
||||
@@ -3369,7 +3370,7 @@ namespace RoF
|
||||
|
||||
std::string old_message = InBuffer; // start 'Reward' as string
|
||||
std::string new_message;
|
||||
ServerToRoFTextLink(new_message, old_message);
|
||||
ServerToRoFSayLink(new_message, old_message);
|
||||
|
||||
in->size = sizeof(TaskDescriptionHeader_Struct) + sizeof(TaskDescriptionData1_Struct)+
|
||||
sizeof(TaskDescriptionData2_Struct) + sizeof(TaskDescriptionTrailer_Struct)+
|
||||
@@ -3847,9 +3848,12 @@ namespace RoF
|
||||
OUT(y);
|
||||
OUT(x);
|
||||
OUT(z)
|
||||
OUT(zone_reason);
|
||||
OUT(zone_reason);
|
||||
OUT(success);
|
||||
|
||||
if (eq->success < 0)
|
||||
eq->success -= 1;
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
@@ -4352,7 +4356,7 @@ namespace RoF
|
||||
|
||||
std::string old_message = InBuffer;
|
||||
std::string new_message;
|
||||
RoFToServerTextLink(new_message, old_message);
|
||||
RoFToServerSayLink(new_message, old_message);
|
||||
|
||||
//__packet->size = sizeof(ChannelMessage_Struct)+strlen(InBuffer) + 1;
|
||||
__packet->size = sizeof(ChannelMessage_Struct) + new_message.length() + 1;
|
||||
@@ -4463,7 +4467,7 @@ namespace RoF
|
||||
IN(type);
|
||||
IN(spellid);
|
||||
IN(damage);
|
||||
IN(meleepush_xy);
|
||||
IN(hit_heading);
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
@@ -4486,7 +4490,7 @@ namespace RoF
|
||||
|
||||
std::string old_message = (char *)&__eq_buffer[4]; // unknown01 offset
|
||||
std::string new_message;
|
||||
RoFToServerTextLink(new_message, old_message);
|
||||
RoFToServerSayLink(new_message, old_message);
|
||||
|
||||
__packet->size = sizeof(Emote_Struct);
|
||||
__packet->pBuffer = new unsigned char[__packet->size];
|
||||
@@ -5913,19 +5917,19 @@ namespace RoF
|
||||
return (rofCorpseSlot - 1);
|
||||
}
|
||||
|
||||
static inline void ServerToRoFTextLink(std::string& rofTextLink, const std::string& serverTextLink)
|
||||
static inline void ServerToRoFSayLink(std::string& rofSayLink, const std::string& serverSayLink)
|
||||
{
|
||||
if ((constants::SayLinkBodySize == EQEmu::legacy::TEXT_LINK_BODY_LENGTH) || (serverTextLink.find('\x12') == std::string::npos)) {
|
||||
rofTextLink = serverTextLink;
|
||||
if ((constants::SayLinkBodySize == EQEmu::constants::SayLinkBodySize) || (serverSayLink.find('\x12') == std::string::npos)) {
|
||||
rofSayLink = serverSayLink;
|
||||
return;
|
||||
}
|
||||
|
||||
auto segments = SplitString(serverTextLink, '\x12');
|
||||
auto segments = SplitString(serverSayLink, '\x12');
|
||||
|
||||
for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) {
|
||||
if (segment_iter & 1) {
|
||||
if (segments[segment_iter].length() <= EQEmu::legacy::TEXT_LINK_BODY_LENGTH) {
|
||||
rofTextLink.append(segments[segment_iter]);
|
||||
if (segments[segment_iter].length() <= EQEmu::constants::SayLinkBodySize) {
|
||||
rofSayLink.append(segments[segment_iter]);
|
||||
// TODO: log size mismatch error
|
||||
continue;
|
||||
}
|
||||
@@ -5935,36 +5939,36 @@ namespace RoF
|
||||
// RoF: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX X XXXXX XXXXXXXX (55)
|
||||
// Diff: ^
|
||||
|
||||
rofTextLink.push_back('\x12');
|
||||
rofTextLink.append(segments[segment_iter].substr(0, 41));
|
||||
rofSayLink.push_back('\x12');
|
||||
rofSayLink.append(segments[segment_iter].substr(0, 41));
|
||||
|
||||
if (segments[segment_iter][41] == '0')
|
||||
rofTextLink.push_back(segments[segment_iter][42]);
|
||||
rofSayLink.push_back(segments[segment_iter][42]);
|
||||
else
|
||||
rofTextLink.push_back('F');
|
||||
rofSayLink.push_back('F');
|
||||
|
||||
rofTextLink.append(segments[segment_iter].substr(43));
|
||||
rofTextLink.push_back('\x12');
|
||||
rofSayLink.append(segments[segment_iter].substr(43));
|
||||
rofSayLink.push_back('\x12');
|
||||
}
|
||||
else {
|
||||
rofTextLink.append(segments[segment_iter]);
|
||||
rofSayLink.append(segments[segment_iter]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline void RoFToServerTextLink(std::string& serverTextLink, const std::string& rofTextLink)
|
||||
static inline void RoFToServerSayLink(std::string& serverSayLink, const std::string& rofSayLink)
|
||||
{
|
||||
if ((EQEmu::legacy::TEXT_LINK_BODY_LENGTH == constants::SayLinkBodySize) || (rofTextLink.find('\x12') == std::string::npos)) {
|
||||
serverTextLink = rofTextLink;
|
||||
if ((EQEmu::constants::SayLinkBodySize == constants::SayLinkBodySize) || (rofSayLink.find('\x12') == std::string::npos)) {
|
||||
serverSayLink = rofSayLink;
|
||||
return;
|
||||
}
|
||||
|
||||
auto segments = SplitString(rofTextLink, '\x12');
|
||||
auto segments = SplitString(rofSayLink, '\x12');
|
||||
|
||||
for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) {
|
||||
if (segment_iter & 1) {
|
||||
if (segments[segment_iter].length() <= constants::SayLinkBodySize) {
|
||||
serverTextLink.append(segments[segment_iter]);
|
||||
serverSayLink.append(segments[segment_iter]);
|
||||
// TODO: log size mismatch error
|
||||
continue;
|
||||
}
|
||||
@@ -5974,14 +5978,14 @@ namespace RoF
|
||||
// RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56)
|
||||
// Diff: ^
|
||||
|
||||
serverTextLink.push_back('\x12');
|
||||
serverTextLink.append(segments[segment_iter].substr(0, 41));
|
||||
serverTextLink.push_back('0');
|
||||
serverTextLink.append(segments[segment_iter].substr(41));
|
||||
serverTextLink.push_back('\x12');
|
||||
serverSayLink.push_back('\x12');
|
||||
serverSayLink.append(segments[segment_iter].substr(0, 41));
|
||||
serverSayLink.push_back('0');
|
||||
serverSayLink.append(segments[segment_iter].substr(41));
|
||||
serverSayLink.push_back('\x12');
|
||||
}
|
||||
else {
|
||||
serverTextLink.append(segments[segment_iter]);
|
||||
serverSayLink.append(segments[segment_iter]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+55
-51
@@ -57,11 +57,11 @@ namespace RoF2
|
||||
static inline uint32 RoF2ToServerTypelessSlot(structs::TypelessInventorySlot_Struct rof2Slot);
|
||||
static inline uint32 RoF2ToServerCorpseSlot(uint32 rof2CorpseSlot);
|
||||
|
||||
// server to client text link converter
|
||||
static inline void ServerToRoF2TextLink(std::string& rof2TextLink, const std::string& serverTextLink);
|
||||
// server to client say link converter
|
||||
static inline void ServerToRoF2SayLink(std::string& rof2SayLink, const std::string& serverSayLink);
|
||||
|
||||
// client to server text link converter
|
||||
static inline void RoF2ToServerTextLink(std::string& serverTextLink, const std::string& rof2TextLink);
|
||||
// client to server say link converter
|
||||
static inline void RoF2ToServerSayLink(std::string& serverSayLink, const std::string& rof2SayLink);
|
||||
|
||||
static inline CastingSlot ServerToRoF2CastingSlot(EQEmu::CastingSlot slot);
|
||||
static inline EQEmu::CastingSlot RoF2ToServerCastingSlot(CastingSlot slot);
|
||||
@@ -232,22 +232,23 @@ namespace RoF2
|
||||
OUT(level);
|
||||
eq->unknown06 = 0;
|
||||
eq->instrument_mod = 1.0f + (emu->instrument_mod - 10) / 10.0f;
|
||||
eq->bard_focus_id = emu->bard_focus_id;
|
||||
eq->knockback_angle = emu->sequence;
|
||||
eq->unknown22 = 0;
|
||||
OUT(force);
|
||||
OUT(hit_heading);
|
||||
OUT(hit_pitch);
|
||||
OUT(type);
|
||||
eq->damage = 0;
|
||||
eq->unknown31 = 0;
|
||||
OUT(spell);
|
||||
eq->level2 = eq->level;
|
||||
eq->effect_flag = emu->buff_unknown;
|
||||
eq->unknown39 = 14;
|
||||
eq->unknown43 = 0;
|
||||
eq->unknown44 = 17;
|
||||
eq->unknown45 = 0;
|
||||
eq->unknown46 = -1;
|
||||
eq->unknown50 = 0;
|
||||
eq->unknown54 = 0;
|
||||
OUT(spell_level);
|
||||
OUT(effect_flag);
|
||||
eq->spell_gem = 0;
|
||||
eq->slot.Type = INVALID_INDEX;
|
||||
eq->slot.Unknown02 = 0;
|
||||
eq->slot.Slot = INVALID_INDEX;
|
||||
eq->slot.SubIndex = INVALID_INDEX;
|
||||
eq->slot.AugIndex = INVALID_INDEX;
|
||||
eq->slot.Unknown01 = 0;
|
||||
eq->item_cast_type = 0;
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
@@ -528,7 +529,7 @@ namespace RoF2
|
||||
{
|
||||
SETUP_VAR_ENCODE(BuffIcon_Struct);
|
||||
|
||||
uint32 sz = 12 + (17 * emu->count);
|
||||
uint32 sz = 12 + (17 * emu->count) + emu->name_lengths; // 17 includes nullterm
|
||||
__packet->size = sz;
|
||||
__packet->pBuffer = new unsigned char[sz];
|
||||
memset(__packet->pBuffer, 0, sz);
|
||||
@@ -544,7 +545,7 @@ namespace RoF2
|
||||
__packet->WriteUInt32(emu->entries[i].spell_id);
|
||||
__packet->WriteUInt32(emu->entries[i].tics_remaining);
|
||||
__packet->WriteUInt32(emu->entries[i].num_hits); // Unknown
|
||||
__packet->WriteString("");
|
||||
__packet->WriteString(emu->entries[i].caster);
|
||||
}
|
||||
__packet->WriteUInt8(emu->type); // Unknown
|
||||
|
||||
@@ -588,7 +589,7 @@ namespace RoF2
|
||||
|
||||
std::string old_message = emu->message;
|
||||
std::string new_message;
|
||||
ServerToRoF2TextLink(new_message, old_message);
|
||||
ServerToRoF2SayLink(new_message, old_message);
|
||||
|
||||
//in->size = strlen(emu->sender) + 1 + strlen(emu->targetname) + 1 + strlen(emu->message) + 1 + 36;
|
||||
in->size = strlen(emu->sender) + strlen(emu->targetname) + new_message.length() + 39;
|
||||
@@ -727,8 +728,8 @@ namespace RoF2
|
||||
OUT(spellid);
|
||||
OUT(damage);
|
||||
OUT(force);
|
||||
OUT(meleepush_xy);
|
||||
OUT(meleepush_z);
|
||||
OUT(hit_heading);
|
||||
OUT(hit_pitch);
|
||||
OUT(special);
|
||||
|
||||
FINISH_ENCODE();
|
||||
@@ -915,7 +916,7 @@ namespace RoF2
|
||||
|
||||
std::string old_message = emu->message;
|
||||
std::string new_message;
|
||||
ServerToRoF2TextLink(new_message, old_message);
|
||||
ServerToRoF2SayLink(new_message, old_message);
|
||||
|
||||
//if (new_message.length() > 512) // length restricted in packet building function due vari-length name size (no nullterm)
|
||||
// new_message = new_message.substr(0, 512);
|
||||
@@ -967,7 +968,7 @@ namespace RoF2
|
||||
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
if (old_message_array[i].length() == 0) { break; }
|
||||
ServerToRoF2TextLink(new_message_array[i], old_message_array[i]);
|
||||
ServerToRoF2SayLink(new_message_array[i], old_message_array[i]);
|
||||
new_message_size += new_message_array[i].length() + 1;
|
||||
}
|
||||
|
||||
@@ -2261,11 +2262,11 @@ namespace RoF2
|
||||
outapp->WriteUInt32(emu->skills[r]);
|
||||
}
|
||||
|
||||
outapp->WriteUInt32(25); // Unknown count
|
||||
outapp->WriteUInt32(structs::MAX_PP_INNATE_SKILL); // Innate Skills count
|
||||
|
||||
for (uint32 r = 0; r < 25; r++)
|
||||
for (uint32 r = 0; r < structs::MAX_PP_INNATE_SKILL; r++)
|
||||
{
|
||||
outapp->WriteUInt32(0); // Unknown
|
||||
outapp->WriteUInt32(emu->InnateSkills[r]); // Innate Skills (regen, slam, etc)
|
||||
}
|
||||
|
||||
outapp->WriteUInt32(structs::MAX_PP_DISCIPLINES); // Discipline count
|
||||
@@ -3364,7 +3365,7 @@ namespace RoF2
|
||||
std::string old_message = &emu->message[strlen(emu->sayer)];
|
||||
std::string new_message;
|
||||
|
||||
ServerToRoF2TextLink(new_message, old_message);
|
||||
ServerToRoF2SayLink(new_message, old_message);
|
||||
|
||||
//in->size = 3 + 4 + 4 + strlen(emu->sayer) + 1 + 12 + new_message.length() + 1;
|
||||
in->size = strlen(emu->sayer) + new_message.length() + 25;
|
||||
@@ -3438,7 +3439,7 @@ namespace RoF2
|
||||
|
||||
std::string old_message = InBuffer; // start 'Reward' as string
|
||||
std::string new_message;
|
||||
ServerToRoF2TextLink(new_message, old_message);
|
||||
ServerToRoF2SayLink(new_message, old_message);
|
||||
|
||||
in->size = sizeof(TaskDescriptionHeader_Struct) + sizeof(TaskDescriptionData1_Struct)+
|
||||
sizeof(TaskDescriptionData2_Struct) + sizeof(TaskDescriptionTrailer_Struct)+
|
||||
@@ -3991,9 +3992,12 @@ namespace RoF2
|
||||
OUT(y);
|
||||
OUT(x);
|
||||
OUT(z)
|
||||
OUT(zone_reason);
|
||||
OUT(zone_reason);
|
||||
OUT(success);
|
||||
|
||||
if (eq->success < 0)
|
||||
eq->success -= 1;
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
@@ -4592,7 +4596,7 @@ namespace RoF2
|
||||
|
||||
std::string old_message = InBuffer;
|
||||
std::string new_message;
|
||||
RoF2ToServerTextLink(new_message, old_message);
|
||||
RoF2ToServerSayLink(new_message, old_message);
|
||||
|
||||
//__packet->size = sizeof(ChannelMessage_Struct)+strlen(InBuffer) + 1;
|
||||
__packet->size = sizeof(ChannelMessage_Struct) + new_message.length() + 1;
|
||||
@@ -4703,7 +4707,7 @@ namespace RoF2
|
||||
IN(type);
|
||||
IN(spellid);
|
||||
IN(damage);
|
||||
IN(meleepush_xy);
|
||||
IN(hit_heading);
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
@@ -4726,7 +4730,7 @@ namespace RoF2
|
||||
|
||||
std::string old_message = (char *)&__eq_buffer[4]; // unknown01 offset
|
||||
std::string new_message;
|
||||
RoF2ToServerTextLink(new_message, old_message);
|
||||
RoF2ToServerSayLink(new_message, old_message);
|
||||
|
||||
__packet->size = sizeof(Emote_Struct);
|
||||
__packet->pBuffer = new unsigned char[__packet->size];
|
||||
@@ -6230,19 +6234,19 @@ namespace RoF2
|
||||
return (rof2CorpseSlot + EQEmu::legacy::CORPSE_BEGIN - 1);
|
||||
}
|
||||
|
||||
static inline void ServerToRoF2TextLink(std::string& rof2TextLink, const std::string& serverTextLink)
|
||||
static inline void ServerToRoF2SayLink(std::string& rof2SayLink, const std::string& serverSayLink)
|
||||
{
|
||||
if ((constants::SayLinkBodySize == EQEmu::legacy::TEXT_LINK_BODY_LENGTH) || (serverTextLink.find('\x12') == std::string::npos)) {
|
||||
rof2TextLink = serverTextLink;
|
||||
if ((constants::SayLinkBodySize == EQEmu::constants::SayLinkBodySize) || (serverSayLink.find('\x12') == std::string::npos)) {
|
||||
rof2SayLink = serverSayLink;
|
||||
return;
|
||||
}
|
||||
|
||||
auto segments = SplitString(serverTextLink, '\x12');
|
||||
auto segments = SplitString(serverSayLink, '\x12');
|
||||
|
||||
for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) {
|
||||
if (segment_iter & 1) {
|
||||
if (segments[segment_iter].length() <= EQEmu::legacy::TEXT_LINK_BODY_LENGTH) {
|
||||
rof2TextLink.append(segments[segment_iter]);
|
||||
if (segments[segment_iter].length() <= EQEmu::constants::SayLinkBodySize) {
|
||||
rof2SayLink.append(segments[segment_iter]);
|
||||
// TODO: log size mismatch error
|
||||
continue;
|
||||
}
|
||||
@@ -6252,29 +6256,29 @@ namespace RoF2
|
||||
// RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56)
|
||||
// Diff:
|
||||
|
||||
rof2TextLink.push_back('\x12');
|
||||
rof2TextLink.append(segments[segment_iter]);
|
||||
rof2TextLink.push_back('\x12');
|
||||
rof2SayLink.push_back('\x12');
|
||||
rof2SayLink.append(segments[segment_iter]);
|
||||
rof2SayLink.push_back('\x12');
|
||||
}
|
||||
else {
|
||||
rof2TextLink.append(segments[segment_iter]);
|
||||
rof2SayLink.append(segments[segment_iter]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline void RoF2ToServerTextLink(std::string& serverTextLink, const std::string& rof2TextLink)
|
||||
static inline void RoF2ToServerSayLink(std::string& serverSayLink, const std::string& rof2SayLink)
|
||||
{
|
||||
if ((EQEmu::legacy::TEXT_LINK_BODY_LENGTH == constants::SayLinkBodySize) || (rof2TextLink.find('\x12') == std::string::npos)) {
|
||||
serverTextLink = rof2TextLink;
|
||||
if ((EQEmu::constants::SayLinkBodySize == constants::SayLinkBodySize) || (rof2SayLink.find('\x12') == std::string::npos)) {
|
||||
serverSayLink = rof2SayLink;
|
||||
return;
|
||||
}
|
||||
|
||||
auto segments = SplitString(rof2TextLink, '\x12');
|
||||
auto segments = SplitString(rof2SayLink, '\x12');
|
||||
|
||||
for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) {
|
||||
if (segment_iter & 1) {
|
||||
if (segments[segment_iter].length() <= constants::SayLinkBodySize) {
|
||||
serverTextLink.append(segments[segment_iter]);
|
||||
serverSayLink.append(segments[segment_iter]);
|
||||
// TODO: log size mismatch error
|
||||
continue;
|
||||
}
|
||||
@@ -6284,12 +6288,12 @@ namespace RoF2
|
||||
// RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56)
|
||||
// Diff:
|
||||
|
||||
serverTextLink.push_back('\x12');
|
||||
serverTextLink.append(segments[segment_iter]);
|
||||
serverTextLink.push_back('\x12');
|
||||
serverSayLink.push_back('\x12');
|
||||
serverSayLink.append(segments[segment_iter]);
|
||||
serverSayLink.push_back('\x12');
|
||||
}
|
||||
else {
|
||||
serverTextLink.append(segments[segment_iter]);
|
||||
serverSayLink.append(segments[segment_iter]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ namespace RoF2
|
||||
ItemPacket11 = 111,
|
||||
ItemPacket12 = 112,
|
||||
ItemPacketRecovery = 113,
|
||||
ItemPacket14 = 115
|
||||
ItemPacket14 = 115 // Parcel? adds to merchant window too
|
||||
};
|
||||
|
||||
} /*item*/
|
||||
|
||||
@@ -131,6 +131,7 @@ static const uint32 MAX_PP_LANGUAGE = 32; // was 25
|
||||
static const uint32 MAX_PP_SPELLBOOK = 720; // was 480
|
||||
static const uint32 MAX_PP_MEMSPELL = 16; // was 12
|
||||
static const uint32 MAX_PP_SKILL = PACKET_SKILL_ARRAY_SIZE; // 100 - actual skills buffer size
|
||||
static const uint32 MAX_PP_INNATE_SKILL = 25;
|
||||
static const uint32 MAX_PP_AA_ARRAY = 300;
|
||||
static const uint32 MAX_PP_DISCIPLINES = 300; // was 200
|
||||
static const uint32 MAX_GROUP_MEMBERS = 6;
|
||||
@@ -399,7 +400,7 @@ struct Spawn_Struct_Position
|
||||
|
||||
struct Spawn_Struct_Position
|
||||
{
|
||||
signed padding0000:12;
|
||||
signed angle:12; // pitch of camera?
|
||||
signed y:19;
|
||||
signed padding0001:1;
|
||||
|
||||
@@ -415,7 +416,7 @@ struct Spawn_Struct_Position
|
||||
signed z:19;
|
||||
signed padding0020:3;
|
||||
|
||||
signed animation:10; // animation
|
||||
signed animation:10; // SpeedRun
|
||||
signed deltaY:13;
|
||||
signed padding0023:9;
|
||||
};
|
||||
@@ -429,7 +430,7 @@ struct Spawn_Struct
|
||||
/*0000*/ //uint8 nullterm1; // hack to null terminate name
|
||||
/*0064*/ uint32 spawnId;
|
||||
/*0068*/ uint8 level;
|
||||
/*0069*/ float unknown1;
|
||||
/*0069*/ float bounding_radius; // used in melee, overrides calc
|
||||
/*0073*/ uint8 NPC; // 0=player,1=npc,2=pc corpse,3=npc corpse
|
||||
Spawn_Struct_Bitfields Bitfields;
|
||||
/*0000*/ uint8 otherData; // & 4 - has title, & 8 - has suffix, & 1 - it's a chest or untargetable
|
||||
@@ -1155,8 +1156,8 @@ union
|
||||
/*01012*/ AA_Array aa_array[MAX_PP_AA_ARRAY]; // [300] 3600 bytes - AAs 12 bytes each
|
||||
/*04612*/ uint32 skill_count; // Seen 100
|
||||
/*04616*/ uint32 skills[MAX_PP_SKILL]; // [100] 400 bytes - List of skills
|
||||
/*05016*/ uint32 unknown15_count; // Seen 25
|
||||
/*05020*/ uint32 unknown_rof15[25]; // Most are 255 or 0
|
||||
/*05016*/ uint32 InnateSkills_count; // Seen 25
|
||||
/*05020*/ uint32 InnateSkills[MAX_PP_INNATE_SKILL]; // Most are 255 or 0
|
||||
/*05120*/ uint32 discipline_count; // Seen 200
|
||||
/*05124*/ Disciplines_Struct disciplines; // [200] 800 bytes Known disciplines
|
||||
/*05924*/ uint32 timestamp_count; // Seen 20
|
||||
@@ -1461,17 +1462,17 @@ struct Action_Struct
|
||||
{
|
||||
/*00*/ uint16 target; // id of target
|
||||
/*02*/ uint16 source; // id of caster
|
||||
/*04*/ uint16 level; // level of caster - Seen 0
|
||||
/*06*/ uint32 unknown06;
|
||||
/*04*/ uint16 level; // level of caster for spells, OSX dump says attack rating, guess spells use it for level
|
||||
/*06*/ uint32 unknown06; // OSX dump says base_damage, was used for bard mod too, this is 0'd :(
|
||||
/*10*/ float instrument_mod;
|
||||
/*14*/ uint32 bard_focus_id; // seen 0
|
||||
/*18*/ float knockback_angle; //seems to go from 0-512 then it rolls over again
|
||||
/*22*/ uint32 unknown22;
|
||||
/*26*/ uint8 type;
|
||||
/*27*/ uint32 damage;
|
||||
/*31*/ uint16 unknown31;
|
||||
/*14*/ float force;
|
||||
/*18*/ float hit_heading;
|
||||
/*22*/ float hit_pitch;
|
||||
/*26*/ uint8 type; // 231 (0xE7) for spells, skill
|
||||
/*27*/ uint32 damage; // OSX says min_damage
|
||||
/*31*/ uint16 unknown31; // OSX says tohit
|
||||
/*33*/ uint32 spell; // spell id being cast
|
||||
/*37*/ uint8 level2; // level of caster again? Or maybe the castee
|
||||
/*37*/ uint8 spell_level; // level of caster again? Or maybe the castee
|
||||
/*38*/ uint8 effect_flag; // if this is 4, the effect is valid: or if two are sent at the same time?
|
||||
/*39*/
|
||||
};
|
||||
@@ -1483,25 +1484,21 @@ struct ActionAlt_Struct
|
||||
{
|
||||
/*00*/ uint16 target; // id of target
|
||||
/*02*/ uint16 source; // id of caster
|
||||
/*04*/ uint16 level; // level of caster - Seen 0
|
||||
/*06*/ uint32 unknown06;
|
||||
/*04*/ uint16 level; // level of caster for spells, OSX dump says attack rating, guess spells use it for level
|
||||
/*06*/ uint32 unknown06; // OSX dump says base_damage, was used for bard mod too, this is 0'd :(
|
||||
/*10*/ float instrument_mod;
|
||||
/*14*/ uint32 bard_focus_id; // seen 0
|
||||
/*18*/ float knockback_angle; //seems to go from 0-512 then it rolls over again
|
||||
/*22*/ uint32 unknown22;
|
||||
/*26*/ uint8 type;
|
||||
/*27*/ uint32 damage;
|
||||
/*31*/ uint16 unknown31;
|
||||
/*14*/ float force;
|
||||
/*18*/ float hit_heading;
|
||||
/*22*/ float hit_pitch;
|
||||
/*26*/ uint8 type; // 231 (0xE7) for spells, skill
|
||||
/*27*/ uint32 damage; // OSX says min_damage
|
||||
/*31*/ uint16 unknown31; // OSX says tohit
|
||||
/*33*/ uint32 spell; // spell id being cast
|
||||
/*37*/ uint8 level2; // level of caster again? Or maybe the castee
|
||||
/*37*/ uint8 spell_level; // level of caster again? Or maybe the castee
|
||||
/*38*/ uint8 effect_flag; // if this is 4, the effect is valid: or if two are sent at the same time?
|
||||
/*39*/ uint32 unknown39; // New field to Underfoot - Seen 14
|
||||
/*43*/ uint8 unknown43; // New field to Underfoot - Seen 0
|
||||
/*44*/ uint8 unknown44; // New field to Underfoot - Seen 17
|
||||
/*45*/ uint8 unknown45; // New field to Underfoot - Seen 0
|
||||
/*46*/ int32 unknown46; // New field to Underfoot - Seen -1
|
||||
/*50*/ uint32 unknown50; // New field to Underfoot - Seen 0
|
||||
/*54*/ uint16 unknown54; // New field to Underfoot - Seen 0
|
||||
/*39*/ uint8 spell_gem;
|
||||
/*40*/ InventorySlot_Struct slot;
|
||||
/*52*/ uint32 item_cast_type; // ItemSpellTypes enum from MQ2
|
||||
/*56*/
|
||||
};
|
||||
|
||||
@@ -1516,9 +1513,9 @@ struct CombatDamage_Struct
|
||||
/* 05 */ uint32 spellid;
|
||||
/* 09 */ int32 damage;
|
||||
/* 13 */ float force; // cd cc cc 3d
|
||||
/* 17 */ float meleepush_xy; // see above notes in Action_Struct
|
||||
/* 21 */ float meleepush_z;
|
||||
/* 25 */ uint8 unknown25; // was [9]
|
||||
/* 17 */ float hit_heading; // see above notes in Action_Struct
|
||||
/* 21 */ float hit_pitch;
|
||||
/* 25 */ uint8 secondary; // 0 for primary hand, 1 for secondary
|
||||
/* 26 */ uint32 special; // 2 = Rampage, 1 = Wild Rampage
|
||||
/* 30 */
|
||||
};
|
||||
@@ -1826,6 +1823,20 @@ struct MoveItem_Struct
|
||||
/*0028*/
|
||||
};
|
||||
|
||||
struct MultiMoveItemSub_Struct
|
||||
{
|
||||
/*0000*/ InventorySlot_Struct from_slot;
|
||||
/*0012*/ InventorySlot_Struct to_slot;
|
||||
/*0024*/ uint32 number_in_stack;
|
||||
/*0028*/ uint8 unknown[8];
|
||||
};
|
||||
|
||||
struct MultiMoveItem_Struct
|
||||
{
|
||||
/*0000*/ uint32 count;
|
||||
/*0004*/ MultiMoveItemSub_Struct moves[0];
|
||||
};
|
||||
|
||||
//
|
||||
// from_slot/to_slot
|
||||
// -1 - destroy
|
||||
@@ -2335,7 +2346,6 @@ struct AltCurrencySelectItem_Struct
|
||||
/*064*/ uint32 unknown064;
|
||||
/*068*/ uint32 unknown068;
|
||||
/*072*/ uint32 unknown072;
|
||||
/*076*/ uint32 unknown076;
|
||||
};
|
||||
|
||||
//Server -> Client
|
||||
@@ -3590,21 +3600,6 @@ struct GuildSetRank_Struct
|
||||
/*80*/
|
||||
};
|
||||
|
||||
struct BugStruct{
|
||||
/*0000*/ char chartype[64];
|
||||
/*0064*/ char name[96];
|
||||
/*0160*/ char ui[128];
|
||||
/*0288*/ float x;
|
||||
/*0292*/ float y;
|
||||
/*0296*/ float z;
|
||||
/*0300*/ float heading;
|
||||
/*0304*/ uint32 unknown304;
|
||||
/*0308*/ uint32 type;
|
||||
/*0312*/ char unknown312[2144];
|
||||
/*2456*/ char bug[1024];
|
||||
/*3480*/ char placeholder[2];
|
||||
/*3482*/ char system_info[4098];
|
||||
};
|
||||
struct Make_Pet_Struct { //Simple struct for getting pet info
|
||||
uint8 level;
|
||||
uint8 class_;
|
||||
@@ -3631,20 +3626,21 @@ struct Ground_Spawn{
|
||||
struct Ground_Spawns {
|
||||
struct Ground_Spawn spawn[50]; //Assigned max number to allow
|
||||
};
|
||||
struct PetitionBug_Struct{
|
||||
uint32 petition_number;
|
||||
uint32 unknown4;
|
||||
char accountname[64];
|
||||
uint32 zoneid;
|
||||
char name[64];
|
||||
uint32 level;
|
||||
uint32 class_;
|
||||
uint32 race;
|
||||
uint32 unknown152[3];
|
||||
uint32 time;
|
||||
uint32 unknown168;
|
||||
char text[1028];
|
||||
};
|
||||
|
||||
//struct PetitionBug_Struct{
|
||||
// uint32 petition_number;
|
||||
// uint32 unknown4;
|
||||
// char accountname[64];
|
||||
// uint32 zoneid;
|
||||
// char name[64];
|
||||
// uint32 level;
|
||||
// uint32 class_;
|
||||
// uint32 race;
|
||||
// uint32 unknown152[3];
|
||||
// uint32 time;
|
||||
// uint32 unknown168;
|
||||
// char text[1028];
|
||||
//};
|
||||
|
||||
struct ApproveZone_Struct {
|
||||
char name[64];
|
||||
@@ -5088,6 +5084,23 @@ struct CrystalCountUpdate_Struct
|
||||
/*012*/ uint32 CareerEbonCrystals;
|
||||
};
|
||||
|
||||
struct SayLinkBodyFrame_Struct {
|
||||
/*000*/ char ActionID[1];
|
||||
/*001*/ char ItemID[5];
|
||||
/*006*/ char Augment1[5];
|
||||
/*011*/ char Augment2[5];
|
||||
/*016*/ char Augment3[5];
|
||||
/*021*/ char Augment4[5];
|
||||
/*026*/ char Augment5[5];
|
||||
/*031*/ char Augment6[5];
|
||||
/*036*/ char IsEvolving[1];
|
||||
/*037*/ char EvolveGroup[4];
|
||||
/*041*/ char EvolveLevel[2];
|
||||
/*043*/ char OrnamentIcon[5];
|
||||
/*048*/ char Hash[8];
|
||||
/*056*/
|
||||
};
|
||||
|
||||
}; /*structs*/
|
||||
|
||||
}; /*RoF2*/
|
||||
|
||||
@@ -131,6 +131,7 @@ static const uint32 MAX_PP_LANGUAGE = 32; // was 25
|
||||
static const uint32 MAX_PP_SPELLBOOK = 720; // was 480
|
||||
static const uint32 MAX_PP_MEMSPELL = 16; // was 12
|
||||
static const uint32 MAX_PP_SKILL = PACKET_SKILL_ARRAY_SIZE; // 100 - actual skills buffer size
|
||||
static const uint32 MAX_PP_INNATE_SKILL = 25;
|
||||
static const uint32 MAX_PP_AA_ARRAY = 300;
|
||||
static const uint32 MAX_PP_DISCIPLINES = 200; // was 100
|
||||
static const uint32 MAX_GROUP_MEMBERS = 6;
|
||||
@@ -407,7 +408,7 @@ struct Spawn_Struct
|
||||
/*0000*/ //uint8 nullterm1; // hack to null terminate name
|
||||
/*0064*/ uint32 spawnId;
|
||||
/*0068*/ uint8 level;
|
||||
/*0069*/ float unknown1;
|
||||
/*0069*/ float bounding_radius; // used in melee, overrides calc
|
||||
/*0073*/ uint8 NPC; // 0=player,1=npc,2=pc corpse,3=npc corpse
|
||||
Spawn_Struct_Bitfields Bitfields;
|
||||
/*0000*/ uint8 otherData; // & 4 - has title, & 8 - has suffix, & 1 - it's a chest or untargetable
|
||||
@@ -1096,8 +1097,8 @@ union
|
||||
/*01012*/ AA_Array aa_array[MAX_PP_AA_ARRAY]; // [300] 3600 bytes - AAs 12 bytes each
|
||||
/*04612*/ uint32 skill_count; // Seen 100
|
||||
/*04616*/ uint32 skills[MAX_PP_SKILL]; // [100] 400 bytes - List of skills
|
||||
/*05016*/ uint32 unknown15_count; // Seen 25
|
||||
/*05020*/ uint32 unknown_rof15[25]; // Most are 255 or 0
|
||||
/*05016*/ uint32 InnateSkills_count; // Seen 25
|
||||
/*05020*/ uint32 InnateSkills[MAX_PP_INNATE_SKILL]; // Most are 255 or 0
|
||||
/*05120*/ uint32 discipline_count; // Seen 200
|
||||
/*05124*/ Disciplines_Struct disciplines; // [200] 800 bytes Known disciplines
|
||||
/*05924*/ uint32 timestamp_count; // Seen 20
|
||||
@@ -1449,17 +1450,17 @@ struct Action_Struct
|
||||
{
|
||||
/*00*/ uint16 target; // id of target
|
||||
/*02*/ uint16 source; // id of caster
|
||||
/*04*/ uint16 level; // level of caster - Seen 0
|
||||
/*06*/ uint32 unknown06;
|
||||
/*04*/ uint16 level; // level of caster for spells, OSX dump says attack rating, guess spells use it for level
|
||||
/*06*/ uint32 unknown06; // OSX dump says base_damage, was used for bard mod too, this is 0'd :(
|
||||
/*10*/ float instrument_mod;
|
||||
/*14*/ uint32 bard_focus_id; // seen 0
|
||||
/*18*/ float knockback_angle; //seems to go from 0-512 then it rolls over again
|
||||
/*22*/ uint32 unknown22;
|
||||
/*26*/ uint8 type;
|
||||
/*27*/ uint32 damage;
|
||||
/*31*/ uint16 unknown31;
|
||||
/*14*/ float force;
|
||||
/*18*/ float hit_heading;
|
||||
/*22*/ float hit_pitch;
|
||||
/*26*/ uint8 type; // 231 (0xE7) for spells, skill
|
||||
/*27*/ uint32 damage; // OSX says min_damage
|
||||
/*31*/ uint16 unknown31; // OSX says tohit
|
||||
/*33*/ uint32 spell; // spell id being cast
|
||||
/*37*/ uint8 level2; // level of caster again? Or maybe the castee
|
||||
/*37*/ uint8 spell_level; // level of caster again? Or maybe the castee
|
||||
/*38*/ uint8 effect_flag; // if this is 4, the effect is valid: or if two are sent at the same time?
|
||||
/*39*/
|
||||
};
|
||||
@@ -1471,25 +1472,21 @@ struct ActionAlt_Struct
|
||||
{
|
||||
/*00*/ uint16 target; // id of target
|
||||
/*02*/ uint16 source; // id of caster
|
||||
/*04*/ uint16 level; // level of caster - Seen 0
|
||||
/*06*/ uint32 unknown06;
|
||||
/*04*/ uint16 level; // level of caster for spells, OSX dump says attack rating, guess spells use it for level
|
||||
/*06*/ uint32 unknown06; // OSX dump says base_damage, was used for bard mod too, this is 0'd :(
|
||||
/*10*/ float instrument_mod;
|
||||
/*14*/ uint32 bard_focus_id; // seen 0
|
||||
/*18*/ float knockback_angle; //seems to go from 0-512 then it rolls over again
|
||||
/*22*/ uint32 unknown22;
|
||||
/*26*/ uint8 type;
|
||||
/*27*/ uint32 damage;
|
||||
/*31*/ uint16 unknown31;
|
||||
/*14*/ float force;
|
||||
/*18*/ float hit_heading;
|
||||
/*22*/ float hit_pitch;
|
||||
/*26*/ uint8 type; // 231 (0xE7) for spells, skill
|
||||
/*27*/ uint32 damage; // OSX says min_damage
|
||||
/*31*/ uint16 unknown31; // OSX says tohit
|
||||
/*33*/ uint32 spell; // spell id being cast
|
||||
/*37*/ uint8 level2; // level of caster again? Or maybe the castee
|
||||
/*37*/ uint8 spell_level; // level of caster again? Or maybe the castee
|
||||
/*38*/ uint8 effect_flag; // if this is 4, the effect is valid: or if two are sent at the same time?
|
||||
/*39*/ uint32 unknown39; // New field to Underfoot - Seen 14
|
||||
/*43*/ uint8 unknown43; // New field to Underfoot - Seen 0
|
||||
/*44*/ uint8 unknown44; // New field to Underfoot - Seen 17
|
||||
/*45*/ uint8 unknown45; // New field to Underfoot - Seen 0
|
||||
/*46*/ int32 unknown46; // New field to Underfoot - Seen -1
|
||||
/*50*/ uint32 unknown50; // New field to Underfoot - Seen 0
|
||||
/*54*/ uint16 unknown54; // New field to Underfoot - Seen 0
|
||||
/*39*/ uint8 spell_gem;
|
||||
/*40*/ InventorySlot_Struct slot;
|
||||
/*52*/ uint32 item_cast_type; // ItemSpellTypes enum from MQ2
|
||||
/*56*/
|
||||
};
|
||||
|
||||
@@ -1504,9 +1501,9 @@ struct CombatDamage_Struct
|
||||
/* 05 */ uint32 spellid;
|
||||
/* 09 */ int32 damage;
|
||||
/* 13 */ float force; // cd cc cc 3d
|
||||
/* 17 */ float meleepush_xy; // see above notes in Action_Struct
|
||||
/* 21 */ float meleepush_z;
|
||||
/* 25 */ uint8 unknown25; // was [9]
|
||||
/* 17 */ float hit_heading; // see above notes in Action_Struct
|
||||
/* 21 */ float hit_pitch;
|
||||
/* 25 */ uint8 secondary; // 0 for primary hand, 1 for secondary
|
||||
/* 26 */ uint32 special; // 2 = Rampage, 1 = Wild Rampage
|
||||
/* 30 */
|
||||
};
|
||||
@@ -3544,21 +3541,6 @@ struct GuildSetRank_Struct
|
||||
/*80*/
|
||||
};
|
||||
|
||||
struct BugStruct{
|
||||
/*0000*/ char chartype[64];
|
||||
/*0064*/ char name[96];
|
||||
/*0160*/ char ui[128];
|
||||
/*0288*/ float x;
|
||||
/*0292*/ float y;
|
||||
/*0296*/ float z;
|
||||
/*0300*/ float heading;
|
||||
/*0304*/ uint32 unknown304;
|
||||
/*0308*/ uint32 type;
|
||||
/*0312*/ char unknown312[2144];
|
||||
/*2456*/ char bug[1024];
|
||||
/*3480*/ char placeholder[2];
|
||||
/*3482*/ char system_info[4098];
|
||||
};
|
||||
struct Make_Pet_Struct { //Simple struct for getting pet info
|
||||
uint8 level;
|
||||
uint8 class_;
|
||||
@@ -3585,20 +3567,21 @@ struct Ground_Spawn{
|
||||
struct Ground_Spawns {
|
||||
struct Ground_Spawn spawn[50]; //Assigned max number to allow
|
||||
};
|
||||
struct PetitionBug_Struct{
|
||||
uint32 petition_number;
|
||||
uint32 unknown4;
|
||||
char accountname[64];
|
||||
uint32 zoneid;
|
||||
char name[64];
|
||||
uint32 level;
|
||||
uint32 class_;
|
||||
uint32 race;
|
||||
uint32 unknown152[3];
|
||||
uint32 time;
|
||||
uint32 unknown168;
|
||||
char text[1028];
|
||||
};
|
||||
|
||||
//struct PetitionBug_Struct{
|
||||
// uint32 petition_number;
|
||||
// uint32 unknown4;
|
||||
// char accountname[64];
|
||||
// uint32 zoneid;
|
||||
// char name[64];
|
||||
// uint32 level;
|
||||
// uint32 class_;
|
||||
// uint32 race;
|
||||
// uint32 unknown152[3];
|
||||
// uint32 time;
|
||||
// uint32 unknown168;
|
||||
// char text[1028];
|
||||
//};
|
||||
|
||||
struct ApproveZone_Struct {
|
||||
char name[64];
|
||||
@@ -5019,6 +5002,23 @@ struct MercenaryMerchantRequest_Struct {
|
||||
struct MercenaryMerchantResponse_Struct {
|
||||
/*0000*/ uint32 ResponseType;
|
||||
/*0004*/
|
||||
};
|
||||
|
||||
struct SayLinkBodyFrame_Struct {
|
||||
/*000*/ char ActionID[1];
|
||||
/*001*/ char ItemID[5];
|
||||
/*006*/ char Augment1[5];
|
||||
/*011*/ char Augment2[5];
|
||||
/*016*/ char Augment3[5];
|
||||
/*021*/ char Augment4[5];
|
||||
/*026*/ char Augment5[5];
|
||||
/*031*/ char Augment6[5];
|
||||
/*036*/ char IsEvolving[1];
|
||||
/*037*/ char EvolveGroup[4];
|
||||
/*041*/ char EvolveLevel[1];
|
||||
/*042*/ char OrnamentIcon[5];
|
||||
/*047*/ char Hash[8];
|
||||
/*055*/
|
||||
};
|
||||
|
||||
}; /*structs*/
|
||||
|
||||
+46
-65
@@ -53,11 +53,11 @@ namespace SoD
|
||||
static inline uint32 SoDToServerSlot(uint32 sodSlot);
|
||||
static inline uint32 SoDToServerCorpseSlot(uint32 sodCorpseSlot);
|
||||
|
||||
// server to client text link converter
|
||||
static inline void ServerToSoDTextLink(std::string& sodTextLink, const std::string& serverTextLink);
|
||||
// server to client say link converter
|
||||
static inline void ServerToSoDSayLink(std::string& sodSayLink, const std::string& serverSayLink);
|
||||
|
||||
// client to server text link converter
|
||||
static inline void SoDToServerTextLink(std::string& serverTextLink, const std::string& sodTextLink);
|
||||
// client to server say link converter
|
||||
static inline void SoDToServerSayLink(std::string& serverSayLink, const std::string& sodSayLink);
|
||||
|
||||
static inline CastingSlot ServerToSoDCastingSlot(EQEmu::CastingSlot slot);
|
||||
static inline EQEmu::CastingSlot SoDToServerCastingSlot(CastingSlot slot);
|
||||
@@ -161,15 +161,14 @@ namespace SoD
|
||||
OUT(source);
|
||||
OUT(level);
|
||||
OUT(instrument_mod);
|
||||
eq->sequence = emu->sequence;
|
||||
OUT(force);
|
||||
OUT(hit_heading);
|
||||
OUT(hit_pitch);
|
||||
OUT(type);
|
||||
//OUT(damage);
|
||||
OUT(spell);
|
||||
eq->level2 = emu->level;
|
||||
OUT(buff_unknown); // if this is 4, a buff icon is made
|
||||
//eq->unknown0036 = -1;
|
||||
//eq->unknown0040 = -1;
|
||||
//eq->unknown0044 = -1;
|
||||
OUT(spell_level);
|
||||
OUT(effect_flag); // if this is 4, a buff icon is made
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
@@ -346,7 +345,7 @@ namespace SoD
|
||||
|
||||
std::string old_message = emu->message;
|
||||
std::string new_message;
|
||||
ServerToSoDTextLink(new_message, old_message);
|
||||
ServerToSoDSayLink(new_message, old_message);
|
||||
|
||||
in->size = sizeof(ChannelMessage_Struct) + new_message.length() + 1;
|
||||
|
||||
@@ -458,8 +457,8 @@ namespace SoD
|
||||
OUT(spellid);
|
||||
OUT(damage);
|
||||
OUT(force);
|
||||
OUT(meleepush_xy);
|
||||
OUT(meleepush_z);
|
||||
OUT(hit_heading);
|
||||
OUT(hit_pitch);
|
||||
OUT(special);
|
||||
|
||||
FINISH_ENCODE();
|
||||
@@ -625,7 +624,7 @@ namespace SoD
|
||||
|
||||
std::string old_message = emu->message;
|
||||
std::string new_message;
|
||||
ServerToSoDTextLink(new_message, old_message);
|
||||
ServerToSoDSayLink(new_message, old_message);
|
||||
|
||||
//if (new_message.length() > 512) // length restricted in packet building function due vari-length name size (no nullterm)
|
||||
// new_message = new_message.substr(0, 512);
|
||||
@@ -677,7 +676,7 @@ namespace SoD
|
||||
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
if (old_message_array[i].length() == 0) { break; }
|
||||
ServerToSoDTextLink(new_message_array[i], old_message_array[i]);
|
||||
ServerToSoDSayLink(new_message_array[i], old_message_array[i]);
|
||||
new_message_size += new_message_array[i].length() + 1;
|
||||
}
|
||||
|
||||
@@ -1605,6 +1604,7 @@ namespace SoD
|
||||
OUT(copper_cursor);
|
||||
|
||||
OUT_array(skills, structs::MAX_PP_SKILL); // 1:1 direct copy (100 dword)
|
||||
OUT_array(InnateSkills, structs::MAX_PP_INNATE_SKILL); // 1:1 direct copy (25 dword)
|
||||
|
||||
// OUT(unknown04760[236]);
|
||||
OUT(toxicity);
|
||||
@@ -2155,7 +2155,7 @@ namespace SoD
|
||||
std::string old_message = &emu->message[strlen(emu->sayer)];
|
||||
std::string new_message;
|
||||
|
||||
ServerToSoDTextLink(new_message, old_message);
|
||||
ServerToSoDSayLink(new_message, old_message);
|
||||
|
||||
//in->size = 3 + 4 + 4 + strlen(emu->sayer) + 1 + 12 + new_message.length() + 1;
|
||||
in->size = strlen(emu->sayer) + new_message.length() + 25;
|
||||
@@ -2251,7 +2251,7 @@ namespace SoD
|
||||
|
||||
std::string old_message = InBuffer; // start 'Reward' as string
|
||||
std::string new_message;
|
||||
ServerToSoDTextLink(new_message, old_message);
|
||||
ServerToSoDSayLink(new_message, old_message);
|
||||
|
||||
in->size = sizeof(TaskDescriptionHeader_Struct) + sizeof(TaskDescriptionData1_Struct)+
|
||||
sizeof(TaskDescriptionData2_Struct) + sizeof(TaskDescriptionTrailer_Struct)+
|
||||
@@ -2932,25 +2932,6 @@ namespace SoD
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
|
||||
DECODE(OP_Bug)
|
||||
{
|
||||
DECODE_LENGTH_EXACT(structs::BugStruct);
|
||||
SETUP_DIRECT_DECODE(BugStruct, structs::BugStruct);
|
||||
|
||||
strn0cpy(emu->chartype, eq->chartype, sizeof(emu->chartype));
|
||||
strn0cpy(emu->name, eq->name, sizeof(emu->name));
|
||||
strn0cpy(emu->ui, eq->ui, sizeof(emu->ui));
|
||||
IN(x);
|
||||
IN(y);
|
||||
IN(z);
|
||||
IN(heading);
|
||||
strn0cpy(emu->target_name, eq->target_name, sizeof(emu->target_name));
|
||||
strn0cpy(emu->bug, eq->bug, sizeof(emu->bug));
|
||||
strn0cpy(emu->system_info, eq->system_info, sizeof(emu->system_info));
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
|
||||
DECODE(OP_CastSpell)
|
||||
{
|
||||
DECODE_LENGTH_EXACT(structs::CastSpell_Struct);
|
||||
@@ -2971,7 +2952,7 @@ namespace SoD
|
||||
|
||||
std::string old_message = (char *)&__eq_buffer[sizeof(ChannelMessage_Struct)];
|
||||
std::string new_message;
|
||||
SoDToServerTextLink(new_message, old_message);
|
||||
SoDToServerSayLink(new_message, old_message);
|
||||
|
||||
__packet->size = sizeof(ChannelMessage_Struct) + new_message.length() + 1;
|
||||
__packet->pBuffer = new unsigned char[__packet->size];
|
||||
@@ -3085,7 +3066,7 @@ namespace SoD
|
||||
|
||||
std::string old_message = (char *)&__eq_buffer[4]; // unknown01 offset
|
||||
std::string new_message;
|
||||
SoDToServerTextLink(new_message, old_message);
|
||||
SoDToServerSayLink(new_message, old_message);
|
||||
|
||||
__packet->size = sizeof(Emote_Struct);
|
||||
__packet->pBuffer = new unsigned char[__packet->size];
|
||||
@@ -3935,19 +3916,19 @@ namespace SoD
|
||||
return (sodCorpseSlot - 1);
|
||||
}
|
||||
|
||||
static inline void ServerToSoDTextLink(std::string& sodTextLink, const std::string& serverTextLink)
|
||||
static inline void ServerToSoDSayLink(std::string& sodSayLink, const std::string& serverSayLink)
|
||||
{
|
||||
if ((constants::SayLinkBodySize == EQEmu::legacy::TEXT_LINK_BODY_LENGTH) || (serverTextLink.find('\x12') == std::string::npos)) {
|
||||
sodTextLink = serverTextLink;
|
||||
if ((constants::SayLinkBodySize == EQEmu::constants::SayLinkBodySize) || (serverSayLink.find('\x12') == std::string::npos)) {
|
||||
sodSayLink = serverSayLink;
|
||||
return;
|
||||
}
|
||||
|
||||
auto segments = SplitString(serverTextLink, '\x12');
|
||||
auto segments = SplitString(serverSayLink, '\x12');
|
||||
|
||||
for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) {
|
||||
if (segment_iter & 1) {
|
||||
if (segments[segment_iter].length() <= EQEmu::legacy::TEXT_LINK_BODY_LENGTH) {
|
||||
sodTextLink.append(segments[segment_iter]);
|
||||
if (segments[segment_iter].length() <= EQEmu::constants::SayLinkBodySize) {
|
||||
sodSayLink.append(segments[segment_iter]);
|
||||
// TODO: log size mismatch error
|
||||
continue;
|
||||
}
|
||||
@@ -3957,37 +3938,37 @@ namespace SoD
|
||||
// SoF: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX X XXXXX XXXXXXXX (50)
|
||||
// Diff: ^^^^^ ^
|
||||
|
||||
sodTextLink.push_back('\x12');
|
||||
sodTextLink.append(segments[segment_iter].substr(0, 31));
|
||||
sodTextLink.append(segments[segment_iter].substr(36, 5));
|
||||
sodSayLink.push_back('\x12');
|
||||
sodSayLink.append(segments[segment_iter].substr(0, 31));
|
||||
sodSayLink.append(segments[segment_iter].substr(36, 5));
|
||||
|
||||
if (segments[segment_iter][41] == '0')
|
||||
sodTextLink.push_back(segments[segment_iter][42]);
|
||||
sodSayLink.push_back(segments[segment_iter][42]);
|
||||
else
|
||||
sodTextLink.push_back('F');
|
||||
sodSayLink.push_back('F');
|
||||
|
||||
sodTextLink.append(segments[segment_iter].substr(43));
|
||||
sodTextLink.push_back('\x12');
|
||||
sodSayLink.append(segments[segment_iter].substr(43));
|
||||
sodSayLink.push_back('\x12');
|
||||
}
|
||||
else {
|
||||
sodTextLink.append(segments[segment_iter]);
|
||||
sodSayLink.append(segments[segment_iter]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline void SoDToServerTextLink(std::string& serverTextLink, const std::string& sodTextLink)
|
||||
static inline void SoDToServerSayLink(std::string& serverSayLink, const std::string& sodSayLink)
|
||||
{
|
||||
if ((EQEmu::legacy::TEXT_LINK_BODY_LENGTH == constants::SayLinkBodySize) || (sodTextLink.find('\x12') == std::string::npos)) {
|
||||
serverTextLink = sodTextLink;
|
||||
if ((EQEmu::constants::SayLinkBodySize == constants::SayLinkBodySize) || (sodSayLink.find('\x12') == std::string::npos)) {
|
||||
serverSayLink = sodSayLink;
|
||||
return;
|
||||
}
|
||||
|
||||
auto segments = SplitString(sodTextLink, '\x12');
|
||||
auto segments = SplitString(sodSayLink, '\x12');
|
||||
|
||||
for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) {
|
||||
if (segment_iter & 1) {
|
||||
if (segments[segment_iter].length() <= constants::SayLinkBodySize) {
|
||||
serverTextLink.append(segments[segment_iter]);
|
||||
serverSayLink.append(segments[segment_iter]);
|
||||
// TODO: log size mismatch error
|
||||
continue;
|
||||
}
|
||||
@@ -3997,16 +3978,16 @@ namespace SoD
|
||||
// RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56)
|
||||
// Diff: ^^^^^ ^
|
||||
|
||||
serverTextLink.push_back('\x12');
|
||||
serverTextLink.append(segments[segment_iter].substr(0, 31));
|
||||
serverTextLink.append("00000");
|
||||
serverTextLink.append(segments[segment_iter].substr(31, 5));
|
||||
serverTextLink.push_back('0');
|
||||
serverTextLink.append(segments[segment_iter].substr(36));
|
||||
serverTextLink.push_back('\x12');
|
||||
serverSayLink.push_back('\x12');
|
||||
serverSayLink.append(segments[segment_iter].substr(0, 31));
|
||||
serverSayLink.append("00000");
|
||||
serverSayLink.append(segments[segment_iter].substr(31, 5));
|
||||
serverSayLink.push_back('0');
|
||||
serverSayLink.append(segments[segment_iter].substr(36));
|
||||
serverSayLink.push_back('\x12');
|
||||
}
|
||||
else {
|
||||
serverTextLink.append(segments[segment_iter]);
|
||||
serverSayLink.append(segments[segment_iter]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +104,6 @@ D(OP_AugmentInfo)
|
||||
D(OP_AugmentItem)
|
||||
D(OP_BazaarSearch)
|
||||
D(OP_Buff)
|
||||
D(OP_Bug)
|
||||
D(OP_CastSpell)
|
||||
D(OP_ChannelMessage)
|
||||
D(OP_CharacterCreate)
|
||||
|
||||
@@ -292,7 +292,7 @@ struct Spawn_Struct
|
||||
/*0000*/ //uint8 nullterm1; // hack to null terminate name
|
||||
/*0064*/ uint32 spawnId;
|
||||
/*0068*/ uint8 level;
|
||||
/*0069*/ float unknown1;
|
||||
/*0069*/ float bounding_radius; // used in melee, overrides calc
|
||||
/*0073*/ uint8 NPC; // 0=player,1=npc,2=pc corpse,3=npc corpse
|
||||
Spawn_Struct_Bitfields Bitfields;
|
||||
/*0000*/ uint8 otherData; // & 4 - has title, & 8 - has suffix, & 1 - it's a chest or untargetable
|
||||
@@ -818,6 +818,7 @@ static const uint32 MAX_PP_LANGUAGE = 25; //
|
||||
static const uint32 MAX_PP_SPELLBOOK = 480; // Confirmed 60 pages on Live now
|
||||
static const uint32 MAX_PP_MEMSPELL = 10; //was 9 now 10 on Live
|
||||
static const uint32 MAX_PP_SKILL = PACKET_SKILL_ARRAY_SIZE; // 100 - actual skills buffer size
|
||||
static const uint32 MAX_PP_INNATE_SKILL = 25;
|
||||
static const uint32 MAX_PP_AA_ARRAY = 300; //was 299
|
||||
static const uint32 MAX_GROUP_MEMBERS = 6;
|
||||
static const uint32 MAX_RECAST_TYPES = 20;
|
||||
@@ -923,7 +924,8 @@ struct PlayerProfile_Struct
|
||||
/*06488*/ uint32 silver_cursor; // Silver Pieces on cursor
|
||||
/*06492*/ uint32 copper_cursor; // Copper Pieces on cursor
|
||||
/*06496*/ uint32 skills[MAX_PP_SKILL]; // [400] List of skills // 100 dword buffer
|
||||
/*06896*/ uint8 unknown04760[136];
|
||||
/*06896*/ uint32 InnateSkills[MAX_PP_INNATE_SKILL];
|
||||
/*06996*/ uint8 unknown04760[36];
|
||||
/*07032*/ uint32 toxicity; // Potion Toxicity (15=too toxic, each potion adds 3)
|
||||
/*07036*/ uint32 thirst_level; // Drink (ticks till next drink)
|
||||
/*07040*/ uint32 hunger_level; // Food (ticks till next eat)
|
||||
@@ -1213,20 +1215,18 @@ struct Action_Struct
|
||||
{
|
||||
/* 00 */ uint16 target; // id of target
|
||||
/* 02 */ uint16 source; // id of caster
|
||||
/* 04 */ uint16 level; // level of caster
|
||||
/* 06 */ uint16 instrument_mod; // seems to be fixed to 0x0A
|
||||
/* 08 */ uint32 unknown08;
|
||||
/* 12 */ uint16 unknown16;
|
||||
// some kind of sequence that's the same in both actions
|
||||
// as well as the combat damage, to tie em together?
|
||||
/* 14 */ float sequence; // was uint32
|
||||
/* 18 */ uint32 unknown18;
|
||||
/* 22 */ uint8 type; // 231 (0xE7) for spells
|
||||
/* 23 */ uint32 unknown23;
|
||||
/* 04 */ uint16 level; // level of caster for spells, OSX dump says attack rating, guess spells use it for level
|
||||
/* 06 */ uint32 instrument_mod; // OSX dump says base damage, spells use it for bard song (different from newer clients)
|
||||
/* 10 */ float force;
|
||||
/* 14 */ float hit_heading;
|
||||
/* 18 */ float hit_pitch;
|
||||
/* 22 */ uint8 type; // 231 (0xE7) for spells, skill
|
||||
/* 23 */ uint16 unknown23; // OSX says min_damage
|
||||
/* 25 */ uint16 unknown25; // OSX says tohit
|
||||
/* 27 */ uint16 spell; // spell id being cast
|
||||
/* 29 */ uint8 level2; // level of caster again? Or maybe the castee
|
||||
/* 29 */ uint8 spell_level; // level of caster again? Or maybe the castee
|
||||
// this field seems to be some sort of success flag, if it's 4
|
||||
/* 30 */ uint8 buff_unknown; // if this is 4, a buff icon is made
|
||||
/* 30 */ uint8 effect_flag; // if this is 4, a buff icon is made
|
||||
/* 31 */
|
||||
};
|
||||
|
||||
@@ -1235,26 +1235,23 @@ struct Action_Struct
|
||||
// has to do with buff blocking??
|
||||
struct ActionAlt_Struct // ActionAlt_Struct - Size: 56 bytes
|
||||
{
|
||||
/*0000*/ uint16 target; // Target ID
|
||||
/*0002*/ uint16 source; // SourceID
|
||||
/*0004*/ uint16 level; // level of caster
|
||||
/*0006*/ uint16 instrument_mod; // seems to be fixed to 0x0A
|
||||
/*0008*/ uint32 unknown08;
|
||||
/*0012*/ uint16 unknown16;
|
||||
/*0014*/ uint32 sequence;
|
||||
/*0018*/ uint32 unknown18;
|
||||
/*0022*/ uint8 type; // Casts, Falls, Bashes, etc...
|
||||
/*0023*/ uint32 damage; // Amount of Damage
|
||||
/*0027*/ uint16 spell; // SpellID
|
||||
/*0029*/ uint8 unknown29;
|
||||
/*0030*/ uint8 buff_unknown; // if this is 4, a buff icon is made
|
||||
/*0031*/ uint32 unknown0031; // seen 00 00 00 00
|
||||
/*0035*/ uint8 unknown0035; // seen 00
|
||||
/*0036*/ uint32 unknown0036; // seen ff ff ff ff
|
||||
/*0040*/ uint32 unknown0040; // seen ff ff ff ff
|
||||
/*0044*/ uint32 unknown0044; // seen ff ff ff ff
|
||||
/*0048*/ uint32 unknown0048; // seen 00 00 00 00
|
||||
/*0052*/ uint32 unknown0052; // seen 00 00 00 00
|
||||
/*0000*/ uint16 target; // id of target
|
||||
/*0002*/ uint16 source; // id of caster
|
||||
/*0004*/ uint16 level; // level of caster for spells, OSX dump says attack rating, guess spells use it for level
|
||||
/*0006*/ uint32 instrument_mod; // OSX dump says base damage, spells use it for bard song (different from newer clients)
|
||||
/*0010*/ float force;
|
||||
/*0014*/ float hit_heading;
|
||||
/*0018*/ float hit_pitch;
|
||||
/*0022*/ uint8 type; // 231 (0xE7) for spells, skill
|
||||
/*0023*/ uint16 unknown23; // OSX says min_damage
|
||||
/*0025*/ uint16 unknown25; // OSX says tohit
|
||||
/*0027*/ uint16 spell; // spell id being cast
|
||||
/*0029*/ uint8 spell_level; // level of caster again? Or maybe the castee
|
||||
// this field seems to be some sort of success flag, if it's 4
|
||||
/*0030*/ uint8 effect_flag; // if this is 4, a buff icon is made
|
||||
/*0031*/ uint8 spell_slot;
|
||||
/*0032*/ uint32 slot[5];
|
||||
/*0052*/ uint32 item_cast_type; // ItemSpellTypes enum from MQ2
|
||||
/*0056*/
|
||||
};
|
||||
|
||||
@@ -1269,9 +1266,9 @@ struct CombatDamage_Struct
|
||||
/* 05 */ uint16 spellid;
|
||||
/* 07 */ int32 damage;
|
||||
/* 11 */ float force; // cd cc cc 3d
|
||||
/* 15 */ float meleepush_xy; // see above notes in Action_Struct
|
||||
/* 19 */ float meleepush_z;
|
||||
/* 23 */ uint8 unknown23; // was [9]
|
||||
/* 15 */ float hit_heading; // see above notes in Action_Struct
|
||||
/* 19 */ float hit_pitch;
|
||||
/* 23 */ uint8 secondary; // 0 for primary hand, 1 for secondary
|
||||
/* 24 */ uint32 special; // 2 = Rampage, 1 = Wild Rampage
|
||||
/* 28 */
|
||||
};
|
||||
@@ -3006,24 +3003,6 @@ struct GuildMakeLeader{
|
||||
char target[64];
|
||||
};
|
||||
|
||||
struct BugStruct{
|
||||
/*0000*/ uint32 type1; //seems to be just a different way of seeing type; seems to be ordered completely differently
|
||||
/*0004*/ char chartype[64];
|
||||
/*0068*/ char name[96];
|
||||
/*0164*/ char ui[128];
|
||||
/*0292*/ float x;
|
||||
/*0296*/ float y;
|
||||
/*0300*/ float z;
|
||||
/*0304*/ float heading;
|
||||
/*0308*/ uint32 unknown304;
|
||||
/*0312*/ char unknown308[160];
|
||||
/*0472*/ char target_name[64];
|
||||
/*0536*/ uint32 type;
|
||||
/*0540*/ char unknown536[2052];
|
||||
/*2588*/ char bug[2048];
|
||||
/*4636*/ char unknown4632[6];
|
||||
/*4642*/ char system_info[4094];
|
||||
};
|
||||
struct Make_Pet_Struct { //Simple struct for getting pet info
|
||||
uint8 level;
|
||||
uint8 class_;
|
||||
@@ -3050,20 +3029,21 @@ struct Ground_Spawn{
|
||||
struct Ground_Spawns {
|
||||
struct Ground_Spawn spawn[50]; //Assigned max number to allow
|
||||
};
|
||||
struct PetitionBug_Struct{
|
||||
uint32 petition_number;
|
||||
uint32 unknown4;
|
||||
char accountname[64];
|
||||
uint32 zoneid;
|
||||
char name[64];
|
||||
uint32 level;
|
||||
uint32 class_;
|
||||
uint32 race;
|
||||
uint32 unknown152[3];
|
||||
uint32 time;
|
||||
uint32 unknown168;
|
||||
char text[1028];
|
||||
};
|
||||
|
||||
//struct PetitionBug_Struct{
|
||||
// uint32 petition_number;
|
||||
// uint32 unknown4;
|
||||
// char accountname[64];
|
||||
// uint32 zoneid;
|
||||
// char name[64];
|
||||
// uint32 level;
|
||||
// uint32 class_;
|
||||
// uint32 race;
|
||||
// uint32 unknown152[3];
|
||||
// uint32 time;
|
||||
// uint32 unknown168;
|
||||
// char text[1028];
|
||||
//};
|
||||
|
||||
struct ApproveZone_Struct {
|
||||
char name[64];
|
||||
@@ -4400,6 +4380,22 @@ struct MercenaryAssign_Struct {
|
||||
/*0004*/ uint32 MercUnk01; //
|
||||
/*0008*/ uint32 MercUnk02; //
|
||||
/*0012*/
|
||||
};
|
||||
|
||||
struct SayLinkBodyFrame_Struct {
|
||||
/*000*/ char ActionID[1];
|
||||
/*001*/ char ItemID[5];
|
||||
/*006*/ char Augment1[5];
|
||||
/*011*/ char Augment2[5];
|
||||
/*016*/ char Augment3[5];
|
||||
/*021*/ char Augment4[5];
|
||||
/*026*/ char Augment5[5];
|
||||
/*031*/ char IsEvolving[1];
|
||||
/*032*/ char EvolveGroup[4];
|
||||
/*036*/ char EvolveLevel[1];
|
||||
/*037*/ char OrnamentIcon[5];
|
||||
/*042*/ char Hash[8];
|
||||
/*050*/
|
||||
};
|
||||
|
||||
}; /*structs*/
|
||||
|
||||
+57
-46
@@ -53,11 +53,11 @@ namespace SoF
|
||||
static inline uint32 SoFToServerSlot(uint32 sofSlot);
|
||||
static inline uint32 SoFToServerCorpseSlot(uint32 sofCorpseSlot);
|
||||
|
||||
// server to client text link converter
|
||||
static inline void ServerToSoFTextLink(std::string& sofTextLink, const std::string& serverTextLink);
|
||||
// server to client say link converter
|
||||
static inline void ServerToSoFSayLink(std::string& sofSayLink, const std::string& serverSayLink);
|
||||
|
||||
// client to server text link converter
|
||||
static inline void SoFToServerTextLink(std::string& serverTextLink, const std::string& sofTextLink);
|
||||
// client to server say link converter
|
||||
static inline void SoFToServerSayLink(std::string& serverSayLink, const std::string& sofSayLink);
|
||||
|
||||
static inline CastingSlot ServerToSoFCastingSlot(EQEmu::CastingSlot slot);
|
||||
static inline EQEmu::CastingSlot SoFToServerCastingSlot(CastingSlot slot, uint32 itemlocation);
|
||||
@@ -161,15 +161,14 @@ namespace SoF
|
||||
OUT(source);
|
||||
OUT(level);
|
||||
OUT(instrument_mod);
|
||||
eq->sequence = emu->sequence;
|
||||
OUT(force);
|
||||
OUT(hit_heading);
|
||||
OUT(hit_pitch);
|
||||
OUT(type);
|
||||
//OUT(damage);
|
||||
OUT(spell);
|
||||
eq->level2 = emu->level;
|
||||
OUT(buff_unknown); // if this is 4, a buff icon is made
|
||||
//eq->unknown0036 = -1;
|
||||
//eq->unknown0040 = -1;
|
||||
//eq->unknown0044 = -1;
|
||||
OUT(spell_level);
|
||||
OUT(effect_flag); // if this is 4, a buff icon is made
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
@@ -328,7 +327,7 @@ namespace SoF
|
||||
|
||||
std::string old_message = emu->message;
|
||||
std::string new_message;
|
||||
ServerToSoFTextLink(new_message, old_message);
|
||||
ServerToSoFSayLink(new_message, old_message);
|
||||
|
||||
in->size = sizeof(ChannelMessage_Struct) + new_message.length() + 1;
|
||||
|
||||
@@ -440,8 +439,8 @@ namespace SoF
|
||||
OUT(spellid);
|
||||
OUT(damage);
|
||||
OUT(force);
|
||||
OUT(meleepush_xy);
|
||||
OUT(meleepush_z);
|
||||
OUT(hit_heading);
|
||||
OUT(hit_pitch);
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
@@ -613,7 +612,7 @@ namespace SoF
|
||||
|
||||
std::string old_message = emu->message;
|
||||
std::string new_message;
|
||||
ServerToSoFTextLink(new_message, old_message);
|
||||
ServerToSoFSayLink(new_message, old_message);
|
||||
|
||||
//if (new_message.length() > 512) // length restricted in packet building function due vari-length name size (no nullterm)
|
||||
// new_message = new_message.substr(0, 512);
|
||||
@@ -665,7 +664,7 @@ namespace SoF
|
||||
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
if (old_message_array[i].length() == 0) { break; }
|
||||
ServerToSoFTextLink(new_message_array[i], old_message_array[i]);
|
||||
ServerToSoFSayLink(new_message_array[i], old_message_array[i]);
|
||||
new_message_size += new_message_array[i].length() + 1;
|
||||
}
|
||||
|
||||
@@ -1276,6 +1275,7 @@ namespace SoF
|
||||
OUT(copper_cursor);
|
||||
|
||||
OUT_array(skills, structs::MAX_PP_SKILL); // 1:1 direct copy (100 dword)
|
||||
OUT_array(InnateSkills, structs::MAX_PP_INNATE_SKILL); // 1:1 direct copy (25 dword)
|
||||
|
||||
// OUT(unknown04760[236]);
|
||||
OUT(toxicity);
|
||||
@@ -1813,7 +1813,7 @@ namespace SoF
|
||||
std::string old_message = &emu->message[strlen(emu->sayer)];
|
||||
std::string new_message;
|
||||
|
||||
ServerToSoFTextLink(new_message, old_message);
|
||||
ServerToSoFSayLink(new_message, old_message);
|
||||
|
||||
//in->size = 3 + 4 + 4 + strlen(emu->sayer) + 1 + 12 + new_message.length() + 1;
|
||||
in->size = strlen(emu->sayer) + new_message.length() + 25;
|
||||
@@ -1881,7 +1881,7 @@ namespace SoF
|
||||
|
||||
std::string old_message = InBuffer; // start 'Reward' as string
|
||||
std::string new_message;
|
||||
ServerToSoFTextLink(new_message, old_message);
|
||||
ServerToSoFSayLink(new_message, old_message);
|
||||
|
||||
in->size = sizeof(TaskDescriptionHeader_Struct) + sizeof(TaskDescriptionData1_Struct)+
|
||||
sizeof(TaskDescriptionData2_Struct) + sizeof(TaskDescriptionTrailer_Struct)+
|
||||
@@ -2384,6 +2384,17 @@ namespace SoF
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
|
||||
DECODE(OP_Bug)
|
||||
{
|
||||
DECODE_LENGTH_EXACT(structs::BugReport_Struct);
|
||||
SETUP_DIRECT_DECODE(BugReport_Struct, structs::BugReport_Struct);
|
||||
|
||||
emu->category_id = EQEmu::bug::CategoryNameToCategoryID(eq->category_name);
|
||||
memcpy(emu->category_name, eq, sizeof(structs::BugReport_Struct));
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
|
||||
DECODE(OP_CastSpell)
|
||||
{
|
||||
DECODE_LENGTH_EXACT(structs::CastSpell_Struct);
|
||||
@@ -2403,7 +2414,7 @@ namespace SoF
|
||||
|
||||
std::string old_message = (char *)&__eq_buffer[sizeof(ChannelMessage_Struct)];
|
||||
std::string new_message;
|
||||
SoFToServerTextLink(new_message, old_message);
|
||||
SoFToServerSayLink(new_message, old_message);
|
||||
|
||||
__packet->size = sizeof(ChannelMessage_Struct) + new_message.length() + 1;
|
||||
__packet->pBuffer = new unsigned char[__packet->size];
|
||||
@@ -2517,7 +2528,7 @@ namespace SoF
|
||||
|
||||
std::string old_message = (char *)&__eq_buffer[4]; // unknown01 offset
|
||||
std::string new_message;
|
||||
SoFToServerTextLink(new_message, old_message);
|
||||
SoFToServerSayLink(new_message, old_message);
|
||||
|
||||
__packet->size = sizeof(Emote_Struct);
|
||||
__packet->pBuffer = new unsigned char[__packet->size];
|
||||
@@ -3304,19 +3315,19 @@ namespace SoF
|
||||
return (sofCorpseSlot - 1);
|
||||
}
|
||||
|
||||
static inline void ServerToSoFTextLink(std::string& sofTextLink, const std::string& serverTextLink)
|
||||
static inline void ServerToSoFSayLink(std::string& sofSayLink, const std::string& serverSayLink)
|
||||
{
|
||||
if ((constants::SayLinkBodySize == EQEmu::legacy::TEXT_LINK_BODY_LENGTH) || (serverTextLink.find('\x12') == std::string::npos)) {
|
||||
sofTextLink = serverTextLink;
|
||||
if ((constants::SayLinkBodySize == EQEmu::constants::SayLinkBodySize) || (serverSayLink.find('\x12') == std::string::npos)) {
|
||||
sofSayLink = serverSayLink;
|
||||
return;
|
||||
}
|
||||
|
||||
auto segments = SplitString(serverTextLink, '\x12');
|
||||
auto segments = SplitString(serverSayLink, '\x12');
|
||||
|
||||
for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) {
|
||||
if (segment_iter & 1) {
|
||||
if (segments[segment_iter].length() <= EQEmu::legacy::TEXT_LINK_BODY_LENGTH) {
|
||||
sofTextLink.append(segments[segment_iter]);
|
||||
if (segments[segment_iter].length() <= EQEmu::constants::SayLinkBodySize) {
|
||||
sofSayLink.append(segments[segment_iter]);
|
||||
// TODO: log size mismatch error
|
||||
continue;
|
||||
}
|
||||
@@ -3326,37 +3337,37 @@ namespace SoF
|
||||
// SoF: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX X XXXXX XXXXXXXX (50)
|
||||
// Diff: ^^^^^ ^
|
||||
|
||||
sofTextLink.push_back('\x12');
|
||||
sofTextLink.append(segments[segment_iter].substr(0, 31));
|
||||
sofTextLink.append(segments[segment_iter].substr(36, 5));
|
||||
sofSayLink.push_back('\x12');
|
||||
sofSayLink.append(segments[segment_iter].substr(0, 31));
|
||||
sofSayLink.append(segments[segment_iter].substr(36, 5));
|
||||
|
||||
if (segments[segment_iter][41] == '0')
|
||||
sofTextLink.push_back(segments[segment_iter][42]);
|
||||
sofSayLink.push_back(segments[segment_iter][42]);
|
||||
else
|
||||
sofTextLink.push_back('F');
|
||||
sofSayLink.push_back('F');
|
||||
|
||||
sofTextLink.append(segments[segment_iter].substr(43));
|
||||
sofTextLink.push_back('\x12');
|
||||
sofSayLink.append(segments[segment_iter].substr(43));
|
||||
sofSayLink.push_back('\x12');
|
||||
}
|
||||
else {
|
||||
sofTextLink.append(segments[segment_iter]);
|
||||
sofSayLink.append(segments[segment_iter]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline void SoFToServerTextLink(std::string& serverTextLink, const std::string& sofTextLink)
|
||||
static inline void SoFToServerSayLink(std::string& serverSayLink, const std::string& sofSayLink)
|
||||
{
|
||||
if ((EQEmu::legacy::TEXT_LINK_BODY_LENGTH == constants::SayLinkBodySize) || (sofTextLink.find('\x12') == std::string::npos)) {
|
||||
serverTextLink = sofTextLink;
|
||||
if ((EQEmu::constants::SayLinkBodySize == constants::SayLinkBodySize) || (sofSayLink.find('\x12') == std::string::npos)) {
|
||||
serverSayLink = sofSayLink;
|
||||
return;
|
||||
}
|
||||
|
||||
auto segments = SplitString(sofTextLink, '\x12');
|
||||
auto segments = SplitString(sofSayLink, '\x12');
|
||||
|
||||
for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) {
|
||||
if (segment_iter & 1) {
|
||||
if (segments[segment_iter].length() <= constants::SayLinkBodySize) {
|
||||
serverTextLink.append(segments[segment_iter]);
|
||||
serverSayLink.append(segments[segment_iter]);
|
||||
// TODO: log size mismatch error
|
||||
continue;
|
||||
}
|
||||
@@ -3366,16 +3377,16 @@ namespace SoF
|
||||
// RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56)
|
||||
// Diff: ^^^^^ ^
|
||||
|
||||
serverTextLink.push_back('\x12');
|
||||
serverTextLink.append(segments[segment_iter].substr(0, 31));
|
||||
serverTextLink.append("00000");
|
||||
serverTextLink.append(segments[segment_iter].substr(31, 5));
|
||||
serverTextLink.push_back('0');
|
||||
serverTextLink.append(segments[segment_iter].substr(36));
|
||||
serverTextLink.push_back('\x12');
|
||||
serverSayLink.push_back('\x12');
|
||||
serverSayLink.append(segments[segment_iter].substr(0, 31));
|
||||
serverSayLink.append("00000");
|
||||
serverSayLink.append(segments[segment_iter].substr(31, 5));
|
||||
serverSayLink.push_back('0');
|
||||
serverSayLink.append(segments[segment_iter].substr(36));
|
||||
serverSayLink.push_back('\x12');
|
||||
}
|
||||
else {
|
||||
serverTextLink.append(segments[segment_iter]);
|
||||
serverSayLink.append(segments[segment_iter]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,6 +95,7 @@ D(OP_ApplyPoison)
|
||||
D(OP_AugmentInfo)
|
||||
D(OP_AugmentItem)
|
||||
D(OP_Buff)
|
||||
D(OP_Bug)
|
||||
D(OP_CastSpell)
|
||||
D(OP_ChannelMessage)
|
||||
D(OP_CharacterCreate)
|
||||
|
||||
+122
-66
@@ -52,6 +52,25 @@ struct EnterWorld_Struct {
|
||||
struct WorldObjectsSent_Struct {
|
||||
};
|
||||
|
||||
// yep, even SoF had a version of the new inventory system, used by OP_MoveMultipleItems
|
||||
struct InventorySlot_Struct
|
||||
{
|
||||
/*000*/ int32 Type; // Worn and Normal inventory = 0, Bank = 1, Shared Bank = 2, Trade = 3, World = 4, Limbo = 5
|
||||
/*004*/ int32 Slot;
|
||||
/*008*/ int32 SubIndex;
|
||||
/*012*/ int32 AugIndex;
|
||||
/*016*/ int32 Unknown01;
|
||||
};
|
||||
|
||||
// unsure if they have a version of this, completeness though
|
||||
struct TypelessInventorySlot_Struct
|
||||
{
|
||||
/*000*/ int32 Slot;
|
||||
/*004*/ int32 SubIndex;
|
||||
/*008*/ int32 AugIndex;
|
||||
/*012*/ int32 Unknown01;
|
||||
};
|
||||
|
||||
/* Name Approval Struct */
|
||||
/* Len: */
|
||||
/* Opcode: 0x8B20*/
|
||||
@@ -307,7 +326,8 @@ union
|
||||
/*0725*/ uint8 targetable; // 1 = Targetable 0 = Not Targetable (is_npc?)
|
||||
/*0726*/ uint8 unknown0726[4];
|
||||
/*0730*/ uint8 NPC; // 0=player,1=npc,2=pc corpse,3=npc corpse
|
||||
/*0731*/ uint8 unknown0731[11];
|
||||
/*0731*/ float bounding_radius; // used in melee, overrides calc
|
||||
/*0735*/ uint8 unknown0731[7];
|
||||
/*0742*/ uint8 targetable_with_hotkey;
|
||||
/*0743*/ signed padding00:12; // ***Placeholder
|
||||
signed x:19; // x coord
|
||||
@@ -799,6 +819,7 @@ static const uint32 MAX_PP_LANGUAGE = 25; //
|
||||
static const uint32 MAX_PP_SPELLBOOK = 480; // Confirmed 60 pages on Live now
|
||||
static const uint32 MAX_PP_MEMSPELL = 10; //was 9 now 10 on Live
|
||||
static const uint32 MAX_PP_SKILL = PACKET_SKILL_ARRAY_SIZE; // 100 - actual skills buffer size
|
||||
static const uint32 MAX_PP_INNATE_SKILL = 25;
|
||||
static const uint32 MAX_PP_AA_ARRAY = 300; //was 299
|
||||
static const uint32 MAX_GROUP_MEMBERS = 6;
|
||||
static const uint32 MAX_RECAST_TYPES = 20;
|
||||
@@ -903,7 +924,8 @@ struct PlayerProfile_Struct //23576 Octets
|
||||
/*06488*/ uint32 silver_cursor; // Silver Pieces on cursor
|
||||
/*06492*/ uint32 copper_cursor; // Copper Pieces on cursor
|
||||
/*06496*/ uint32 skills[MAX_PP_SKILL]; // [400] List of skills // 100 dword buffer
|
||||
/*06896*/ uint8 unknown04760[136];
|
||||
/*06896*/ uint32 InnateSkills[MAX_PP_INNATE_SKILL];
|
||||
/*06996*/ uint8 unknown04760[36];
|
||||
/*07032*/ uint32 toxicity; // Potion Toxicity (15=too toxic, each potion adds 3)
|
||||
/*07036*/ uint32 thirst_level; // Drink (ticks till next drink)
|
||||
/*07040*/ uint32 hunger_level; // Food (ticks till next eat)
|
||||
@@ -1193,20 +1215,18 @@ struct Action_Struct
|
||||
{
|
||||
/* 00 */ uint16 target; // id of target
|
||||
/* 02 */ uint16 source; // id of caster
|
||||
/* 04 */ uint16 level; // level of caster
|
||||
/* 06 */ uint16 instrument_mod; // seems to be fixed to 0x0A
|
||||
/* 08 */ uint32 unknown08;
|
||||
/* 12 */ uint16 unknown16;
|
||||
// some kind of sequence that's the same in both actions
|
||||
// as well as the combat damage, to tie em together?
|
||||
/* 14 */ float sequence; // was uint32
|
||||
/* 18 */ uint32 unknown18;
|
||||
/* 22 */ uint8 type; // 231 (0xE7) for spells
|
||||
/* 23 */ uint32 unknown23;
|
||||
/* 04 */ uint16 level; // level of caster for spells, OSX dump says attack rating, guess spells use it for level
|
||||
/* 06 */ uint32 instrument_mod; // OSX dump says base damage, spells use it for bard song (different from newer clients)
|
||||
/* 10 */ float force;
|
||||
/* 14 */ float hit_heading;
|
||||
/* 18 */ float hit_pitch;
|
||||
/* 22 */ uint8 type; // 231 (0xE7) for spells, skill
|
||||
/* 23 */ uint16 unknown23; // OSX says min_damage
|
||||
/* 25 */ uint16 unknown25; // OSX says tohit
|
||||
/* 27 */ uint16 spell; // spell id being cast
|
||||
/* 29 */ uint8 level2; // level of caster again? Or maybe the castee
|
||||
/* 29 */ uint8 spell_level; // level of caster again? Or maybe the castee
|
||||
// this field seems to be some sort of success flag, if it's 4
|
||||
/* 30 */ uint8 buff_unknown; // if this is 4, a buff icon is made
|
||||
/* 30 */ uint8 effect_flag; // if this is 4, a buff icon is made
|
||||
/* 31 */
|
||||
};
|
||||
|
||||
@@ -1215,26 +1235,23 @@ struct Action_Struct
|
||||
// has to do with buff blocking??
|
||||
struct ActionAlt_Struct // ActionAlt_Struct - Size: 56 bytes
|
||||
{
|
||||
/*0000*/ uint16 target; // Target ID
|
||||
/*0002*/ uint16 source; // SourceID
|
||||
/*0004*/ uint16 level; // level of caster
|
||||
/*0006*/ uint16 instrument_mod; // seems to be fixed to 0x0A
|
||||
/*0008*/ uint32 unknown08;
|
||||
/*0012*/ uint16 unknown16;
|
||||
/*0014*/ uint32 sequence;
|
||||
/*0018*/ uint32 unknown18;
|
||||
/*0022*/ uint8 type; // Casts, Falls, Bashes, etc...
|
||||
/*0023*/ uint32 damage; // Amount of Damage
|
||||
/*0027*/ uint16 spell; // SpellID
|
||||
/*0029*/ uint8 unknown29;
|
||||
/*0030*/ uint8 buff_unknown; // if this is 4, a buff icon is made
|
||||
/*0031*/ uint32 unknown0031; // seen 00 00 00 00
|
||||
/*0035*/ uint8 unknown0035; // seen 00
|
||||
/*0036*/ uint32 unknown0036; // seen ff ff ff ff
|
||||
/*0040*/ uint32 unknown0040; // seen ff ff ff ff
|
||||
/*0044*/ uint32 unknown0044; // seen ff ff ff ff
|
||||
/*0048*/ uint32 unknown0048; // seen 00 00 00 00
|
||||
/*0052*/ uint32 unknown0052; // seen 00 00 00 00
|
||||
/*0000*/ uint16 target; // id of target
|
||||
/*0002*/ uint16 source; // id of caster
|
||||
/*0004*/ uint16 level; // level of caster for spells, OSX dump says attack rating, guess spells use it for level
|
||||
/*0006*/ uint32 instrument_mod; // OSX dump says base damage, spells use it for bard song (different from newer clients)
|
||||
/*0010*/ float force;
|
||||
/*0014*/ float hit_heading;
|
||||
/*0018*/ float hit_pitch;
|
||||
/*0022*/ uint8 type; // 231 (0xE7) for spells, skill
|
||||
/*0023*/ uint16 unknown23; // OSX says min_damage
|
||||
/*0025*/ uint16 unknown25; // OSX says tohit
|
||||
/*0027*/ uint16 spell; // spell id being cast
|
||||
/*0029*/ uint8 spell_level; // level of caster again? Or maybe the castee
|
||||
// this field seems to be some sort of success flag, if it's 4
|
||||
/*0030*/ uint8 effect_flag; // if this is 4, a buff icon is made
|
||||
/*0031*/ uint8 spell_slot;
|
||||
/*0032*/ uint32 slot[5];
|
||||
/*0052*/ uint32 item_cast_type; // ItemSpellTypes enum from MQ2
|
||||
/*0056*/
|
||||
};
|
||||
|
||||
@@ -1249,9 +1266,10 @@ struct CombatDamage_Struct
|
||||
/* 05 */ uint16 spellid;
|
||||
/* 07 */ int32 damage;
|
||||
/* 11 */ float force; // cd cc cc 3d
|
||||
/* 15 */ float meleepush_xy; // see above notes in Action_Struct
|
||||
/* 19 */ float meleepush_z;
|
||||
/* 23 */ uint8 unknown23[5]; // was [9] this appears unrelated to the stuff the other clients do here?
|
||||
/* 15 */ float hit_heading; // see above notes in Action_Struct
|
||||
/* 19 */ float hit_pitch;
|
||||
/* 23 */ uint8 secondary; // 0 for primary hand, 1 for secondary
|
||||
/* 24 */ uint32 special; // 2 = Rampage, 1 = Wild Rampage, Report function doesn't seem to check this :P
|
||||
/* 28 */
|
||||
};
|
||||
|
||||
@@ -1555,6 +1573,19 @@ struct MoveItem_Struct
|
||||
/*0012*/
|
||||
};
|
||||
|
||||
struct MultiMoveItemSub_Struct
|
||||
{
|
||||
/*0000*/ InventorySlot_Struct from_slot;
|
||||
/*0020*/ uint32 number_in_stack; // so the amount we are moving from the source
|
||||
/*0024*/ InventorySlot_Struct to_slot;
|
||||
};
|
||||
|
||||
struct MultiMoveItem_Struct
|
||||
{
|
||||
/*0000*/ uint32 count;
|
||||
/*0004*/ MultiMoveItemSub_Struct moves[0];
|
||||
};
|
||||
|
||||
//
|
||||
// from_slot/to_slot
|
||||
// -1 - destroy
|
||||
@@ -2872,23 +2903,31 @@ struct GuildMakeLeader{
|
||||
char target[64];
|
||||
};
|
||||
|
||||
struct BugReport_Struct {
|
||||
/*0000*/ char category_name[64];
|
||||
/*0064*/ char character_name[64];
|
||||
/*0128*/ char unused_0128[32];
|
||||
/*0160*/ char ui_path[128];
|
||||
/*0288*/ float pos_x;
|
||||
/*0292*/ float pos_y;
|
||||
/*0296*/ float pos_z;
|
||||
/*0300*/ uint32 heading;
|
||||
/*0304*/ uint32 unused_0304;
|
||||
/*0308*/ uint32 time_played;
|
||||
/*0312*/ char padding_0312[8];
|
||||
/*0320*/ uint32 target_id;
|
||||
/*0324*/ char padding_0324[140];
|
||||
/*0464*/ uint32 unknown_0464; // seems to always be '0'
|
||||
/*0468*/ char target_name[64];
|
||||
/*0532*/ uint32 optional_info_mask;
|
||||
|
||||
|
||||
struct BugStruct{
|
||||
/*0000*/ char chartype[64];
|
||||
/*0064*/ char name[96];
|
||||
/*0160*/ char ui[128];
|
||||
/*0288*/ float x;
|
||||
/*0292*/ float y;
|
||||
/*0296*/ float z;
|
||||
/*0300*/ float heading;
|
||||
/*0304*/ uint32 unknown304;
|
||||
/*0308*/ uint32 type;
|
||||
/*0312*/ char unknown312[2144];
|
||||
/*2456*/ char bug[1024];
|
||||
/*3480*/ char placeholder[2];
|
||||
/*3482*/ char system_info[4098];
|
||||
// this looks like a butchered 8k buffer with 2 trailing dword fields
|
||||
/*0536*/ char unused_0536[2052];
|
||||
/*2588*/ char bug_report[2050];
|
||||
/*4638*/ char system_info[4098];
|
||||
/*8736*/
|
||||
};
|
||||
|
||||
struct Make_Pet_Struct { //Simple struct for getting pet info
|
||||
uint8 level;
|
||||
uint8 class_;
|
||||
@@ -2915,20 +2954,21 @@ struct Ground_Spawn{
|
||||
struct Ground_Spawns {
|
||||
struct Ground_Spawn spawn[50]; //Assigned max number to allow
|
||||
};
|
||||
struct PetitionBug_Struct{
|
||||
uint32 petition_number;
|
||||
uint32 unknown4;
|
||||
char accountname[64];
|
||||
uint32 zoneid;
|
||||
char name[64];
|
||||
uint32 level;
|
||||
uint32 class_;
|
||||
uint32 race;
|
||||
uint32 unknown152[3];
|
||||
uint32 time;
|
||||
uint32 unknown168;
|
||||
char text[1028];
|
||||
};
|
||||
|
||||
//struct PetitionBug_Struct{
|
||||
// uint32 petition_number;
|
||||
// uint32 unknown4;
|
||||
// char accountname[64];
|
||||
// uint32 zoneid;
|
||||
// char name[64];
|
||||
// uint32 level;
|
||||
// uint32 class_;
|
||||
// uint32 race;
|
||||
// uint32 unknown152[3];
|
||||
// uint32 time;
|
||||
// uint32 unknown168;
|
||||
// char text[1028];
|
||||
//};
|
||||
|
||||
struct ApproveZone_Struct {
|
||||
char name[64];
|
||||
@@ -4112,6 +4152,22 @@ struct AltCurrencySellItem_Struct {
|
||||
/*004*/ uint32 slot_id;
|
||||
/*006*/ uint32 charges;
|
||||
/*010*/ uint32 cost;
|
||||
};
|
||||
|
||||
struct SayLinkBodyFrame_Struct {
|
||||
/*000*/ char ActionID[1];
|
||||
/*001*/ char ItemID[5];
|
||||
/*006*/ char Augment1[5];
|
||||
/*011*/ char Augment2[5];
|
||||
/*016*/ char Augment3[5];
|
||||
/*021*/ char Augment4[5];
|
||||
/*026*/ char Augment5[5];
|
||||
/*031*/ char IsEvolving[1];
|
||||
/*032*/ char EvolveGroup[4];
|
||||
/*036*/ char EvolveLevel[1];
|
||||
/*037*/ char OrnamentIcon[5];
|
||||
/*042*/ char Hash[8];
|
||||
/*050*/
|
||||
};
|
||||
|
||||
}; /*structs*/
|
||||
|
||||
+59
-44
@@ -52,11 +52,11 @@ namespace Titanium
|
||||
static inline uint32 TitaniumToServerSlot(int16 titaniumSlot);
|
||||
static inline uint32 TitaniumToServerCorpseSlot(int16 titaniumCorpseSlot);
|
||||
|
||||
// server to client text link converter
|
||||
static inline void ServerToTitaniumTextLink(std::string& titaniumTextLink, const std::string& serverTextLink);
|
||||
// server to client say link converter
|
||||
static inline void ServerToTitaniumSayLink(std::string& titaniumSayLink, const std::string& serverSayLink);
|
||||
|
||||
// client to server text link converter
|
||||
static inline void TitaniumToServerTextLink(std::string& serverTextLink, const std::string& titaniumTextLink);
|
||||
// client to server say link converter
|
||||
static inline void TitaniumToServerSayLink(std::string& serverSayLink, const std::string& titaniumSayLink);
|
||||
|
||||
static inline CastingSlot ServerToTitaniumCastingSlot(EQEmu::CastingSlot slot);
|
||||
static inline EQEmu::CastingSlot TitaniumToServerCastingSlot(CastingSlot slot, uint32 itemlocation);
|
||||
@@ -164,11 +164,14 @@ namespace Titanium
|
||||
OUT(source);
|
||||
OUT(level);
|
||||
OUT(instrument_mod);
|
||||
OUT(sequence);
|
||||
OUT(force);
|
||||
OUT(hit_heading);
|
||||
OUT(hit_pitch);
|
||||
OUT(type);
|
||||
//OUT(damage);
|
||||
OUT(spell);
|
||||
OUT(buff_unknown); // if this is 4, a buff icon is made
|
||||
OUT(spell_level);
|
||||
OUT(effect_flag); // if this is 4, a buff icon is made
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
@@ -290,7 +293,7 @@ namespace Titanium
|
||||
|
||||
std::string old_message = emu->message;
|
||||
std::string new_message;
|
||||
ServerToTitaniumTextLink(new_message, old_message);
|
||||
ServerToTitaniumSayLink(new_message, old_message);
|
||||
|
||||
in->size = sizeof(ChannelMessage_Struct) + new_message.length() + 1;
|
||||
|
||||
@@ -358,8 +361,8 @@ namespace Titanium
|
||||
OUT(spellid);
|
||||
OUT(damage);
|
||||
OUT(force);
|
||||
OUT(meleepush_xy);
|
||||
OUT(meleepush_z);
|
||||
OUT(hit_heading);
|
||||
OUT(hit_pitch);
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
@@ -532,7 +535,7 @@ namespace Titanium
|
||||
|
||||
std::string old_message = emu->message;
|
||||
std::string new_message;
|
||||
ServerToTitaniumTextLink(new_message, old_message);
|
||||
ServerToTitaniumSayLink(new_message, old_message);
|
||||
|
||||
//if (new_message.length() > 512) // length restricted in packet building function due vari-length name size (no nullterm)
|
||||
// new_message = new_message.substr(0, 512);
|
||||
@@ -574,7 +577,7 @@ namespace Titanium
|
||||
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
if (old_message_array[i].length() == 0) { break; }
|
||||
ServerToTitaniumTextLink(new_message_array[i], old_message_array[i]);
|
||||
ServerToTitaniumSayLink(new_message_array[i], old_message_array[i]);
|
||||
new_message_size += new_message_array[i].length() + 1;
|
||||
}
|
||||
|
||||
@@ -1020,6 +1023,7 @@ namespace Titanium
|
||||
OUT(copper_cursor);
|
||||
|
||||
OUT_array(skills, structs::MAX_PP_SKILL); // 1:1 direct copy (100 dword)
|
||||
OUT_array(InnateSkills, structs::MAX_PP_INNATE_SKILL); // 1:1 direct copy (25 dword)
|
||||
|
||||
// OUT(unknown04760[236]);
|
||||
OUT(toxicity);
|
||||
@@ -1401,7 +1405,7 @@ namespace Titanium
|
||||
std::string old_message = &emu->message[strlen(emu->sayer)];
|
||||
std::string new_message;
|
||||
|
||||
ServerToTitaniumTextLink(new_message, old_message);
|
||||
ServerToTitaniumSayLink(new_message, old_message);
|
||||
|
||||
//in->size = 3 + 4 + 4 + strlen(emu->sayer) + 1 + 12 + new_message.length() + 1;
|
||||
in->size = strlen(emu->sayer) + new_message.length() + 25;
|
||||
@@ -1457,7 +1461,7 @@ namespace Titanium
|
||||
|
||||
std::string old_message = InBuffer; // start 'Reward' as string
|
||||
std::string new_message;
|
||||
ServerToTitaniumTextLink(new_message, old_message);
|
||||
ServerToTitaniumSayLink(new_message, old_message);
|
||||
|
||||
in->size = sizeof(TaskDescriptionHeader_Struct) + sizeof(TaskDescriptionData1_Struct) +
|
||||
sizeof(TaskDescriptionData2_Struct) + sizeof(TaskDescriptionTrailer_Struct) +
|
||||
@@ -1788,6 +1792,17 @@ namespace Titanium
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
|
||||
DECODE(OP_Bug)
|
||||
{
|
||||
DECODE_LENGTH_EXACT(structs::BugReport_Struct);
|
||||
SETUP_DIRECT_DECODE(BugReport_Struct, structs::BugReport_Struct);
|
||||
|
||||
emu->category_id = EQEmu::bug::CategoryNameToCategoryID(eq->category_name);
|
||||
memcpy(emu->category_name, eq, sizeof(structs::BugReport_Struct));
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
|
||||
DECODE(OP_CastSpell)
|
||||
{
|
||||
DECODE_LENGTH_EXACT(structs::CastSpell_Struct);
|
||||
@@ -1807,7 +1822,7 @@ namespace Titanium
|
||||
|
||||
std::string old_message = (char *)&__eq_buffer[sizeof(ChannelMessage_Struct)];
|
||||
std::string new_message;
|
||||
TitaniumToServerTextLink(new_message, old_message);
|
||||
TitaniumToServerSayLink(new_message, old_message);
|
||||
|
||||
__packet->size = sizeof(ChannelMessage_Struct) + new_message.length() + 1;
|
||||
__packet->pBuffer = new unsigned char[__packet->size];
|
||||
@@ -1879,7 +1894,7 @@ namespace Titanium
|
||||
|
||||
std::string old_message = (char *)&__eq_buffer[4]; // unknown01 offset
|
||||
std::string new_message;
|
||||
TitaniumToServerTextLink(new_message, old_message);
|
||||
TitaniumToServerSayLink(new_message, old_message);
|
||||
|
||||
__packet->size = sizeof(Emote_Struct);
|
||||
__packet->pBuffer = new unsigned char[__packet->size];
|
||||
@@ -2473,19 +2488,19 @@ namespace Titanium
|
||||
return titaniumCorpseSlot;
|
||||
}
|
||||
|
||||
static inline void ServerToTitaniumTextLink(std::string& titaniumTextLink, const std::string& serverTextLink)
|
||||
static inline void ServerToTitaniumSayLink(std::string& titaniumSayLink, const std::string& serverSayLink)
|
||||
{
|
||||
if ((constants::SayLinkBodySize == EQEmu::legacy::TEXT_LINK_BODY_LENGTH) || (serverTextLink.find('\x12') == std::string::npos)) {
|
||||
titaniumTextLink = serverTextLink;
|
||||
if ((constants::SayLinkBodySize == EQEmu::constants::SayLinkBodySize) || (serverSayLink.find('\x12') == std::string::npos)) {
|
||||
titaniumSayLink = serverSayLink;
|
||||
return;
|
||||
}
|
||||
|
||||
auto segments = SplitString(serverTextLink, '\x12');
|
||||
auto segments = SplitString(serverSayLink, '\x12');
|
||||
|
||||
for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) {
|
||||
if (segment_iter & 1) {
|
||||
if (segments[segment_iter].length() <= EQEmu::legacy::TEXT_LINK_BODY_LENGTH) {
|
||||
titaniumTextLink.append(segments[segment_iter]);
|
||||
if (segments[segment_iter].length() <= EQEmu::constants::SayLinkBodySize) {
|
||||
titaniumSayLink.append(segments[segment_iter]);
|
||||
// TODO: log size mismatch error
|
||||
continue;
|
||||
}
|
||||
@@ -2495,37 +2510,37 @@ namespace Titanium
|
||||
// 6.2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX X XXXXXXXX (45)
|
||||
// Diff: ^^^^^ ^ ^^^^^
|
||||
|
||||
titaniumTextLink.push_back('\x12');
|
||||
titaniumTextLink.append(segments[segment_iter].substr(0, 31));
|
||||
titaniumTextLink.append(segments[segment_iter].substr(36, 5));
|
||||
titaniumSayLink.push_back('\x12');
|
||||
titaniumSayLink.append(segments[segment_iter].substr(0, 31));
|
||||
titaniumSayLink.append(segments[segment_iter].substr(36, 5));
|
||||
|
||||
if (segments[segment_iter][41] == '0')
|
||||
titaniumTextLink.push_back(segments[segment_iter][42]);
|
||||
titaniumSayLink.push_back(segments[segment_iter][42]);
|
||||
else
|
||||
titaniumTextLink.push_back('F');
|
||||
titaniumSayLink.push_back('F');
|
||||
|
||||
titaniumTextLink.append(segments[segment_iter].substr(48));
|
||||
titaniumTextLink.push_back('\x12');
|
||||
titaniumSayLink.append(segments[segment_iter].substr(48));
|
||||
titaniumSayLink.push_back('\x12');
|
||||
}
|
||||
else {
|
||||
titaniumTextLink.append(segments[segment_iter]);
|
||||
titaniumSayLink.append(segments[segment_iter]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline void TitaniumToServerTextLink(std::string& serverTextLink, const std::string& titaniumTextLink)
|
||||
static inline void TitaniumToServerSayLink(std::string& serverSayLink, const std::string& titaniumSayLink)
|
||||
{
|
||||
if ((EQEmu::legacy::TEXT_LINK_BODY_LENGTH == constants::SayLinkBodySize) || (titaniumTextLink.find('\x12') == std::string::npos)) {
|
||||
serverTextLink = titaniumTextLink;
|
||||
if ((EQEmu::constants::SayLinkBodySize == constants::SayLinkBodySize) || (titaniumSayLink.find('\x12') == std::string::npos)) {
|
||||
serverSayLink = titaniumSayLink;
|
||||
return;
|
||||
}
|
||||
|
||||
auto segments = SplitString(titaniumTextLink, '\x12');
|
||||
auto segments = SplitString(titaniumSayLink, '\x12');
|
||||
|
||||
for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) {
|
||||
if (segment_iter & 1) {
|
||||
if (segments[segment_iter].length() <= constants::SayLinkBodySize) {
|
||||
serverTextLink.append(segments[segment_iter]);
|
||||
serverSayLink.append(segments[segment_iter]);
|
||||
// TODO: log size mismatch error
|
||||
continue;
|
||||
}
|
||||
@@ -2535,18 +2550,18 @@ namespace Titanium
|
||||
// RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56)
|
||||
// Diff: ^^^^^ ^ ^^^^^
|
||||
|
||||
serverTextLink.push_back('\x12');
|
||||
serverTextLink.append(segments[segment_iter].substr(0, 31));
|
||||
serverTextLink.append("00000");
|
||||
serverTextLink.append(segments[segment_iter].substr(31, 5));
|
||||
serverTextLink.push_back('0');
|
||||
serverTextLink.push_back(segments[segment_iter][36]);
|
||||
serverTextLink.append("00000");
|
||||
serverTextLink.append(segments[segment_iter].substr(37));
|
||||
serverTextLink.push_back('\x12');
|
||||
serverSayLink.push_back('\x12');
|
||||
serverSayLink.append(segments[segment_iter].substr(0, 31));
|
||||
serverSayLink.append("00000");
|
||||
serverSayLink.append(segments[segment_iter].substr(31, 5));
|
||||
serverSayLink.push_back('0');
|
||||
serverSayLink.push_back(segments[segment_iter][36]);
|
||||
serverSayLink.append("00000");
|
||||
serverSayLink.append(segments[segment_iter].substr(37));
|
||||
serverSayLink.push_back('\x12');
|
||||
}
|
||||
else {
|
||||
serverTextLink.append(segments[segment_iter]);
|
||||
serverSayLink.append(segments[segment_iter]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,6 +78,7 @@ D(OP_AdventureMerchantSell)
|
||||
D(OP_ApplyPoison)
|
||||
D(OP_AugmentItem)
|
||||
D(OP_Buff)
|
||||
D(OP_Bug)
|
||||
D(OP_CastSpell)
|
||||
D(OP_ChannelMessage)
|
||||
D(OP_CharacterCreate)
|
||||
|
||||
@@ -48,6 +48,23 @@ struct EnterWorld_Struct {
|
||||
/*068*/ uint32 return_home; // 01 on "Return Home", 00 if not
|
||||
};
|
||||
|
||||
// yep, even tit had a version of the new inventory system, used by OP_MoveMultipleItems
|
||||
struct InventorySlot_Struct
|
||||
{
|
||||
/*000*/ int32 Type; // Worn and Normal inventory = 0, Bank = 1, Shared Bank = 2, Trade = 3, World = 4, Limbo = 5
|
||||
/*004*/ int32 Slot;
|
||||
/*008*/ int32 SubIndex; // no aug index in Tit
|
||||
/*012*/ int32 Unknown01;
|
||||
};
|
||||
|
||||
// unsure if they have a version of this, completeness though
|
||||
struct TypelessInventorySlot_Struct
|
||||
{
|
||||
/*000*/ int32 Slot;
|
||||
/*004*/ int32 SubIndex; // no aug index in Tit
|
||||
/*008*/ int32 Unknown01;
|
||||
};
|
||||
|
||||
/* Name Approval Struct */
|
||||
/* Len: */
|
||||
/* Opcode: 0x8B20*/
|
||||
@@ -310,7 +327,7 @@ union
|
||||
// horse: 0=brown, 1=white, 2=black, 3=tan
|
||||
};
|
||||
/*0340*/ uint32 spawnId; // Spawn Id
|
||||
/*0344*/ uint8 unknown0344[4];
|
||||
/*0344*/ float bounding_radius; // used in melee, overrides calc
|
||||
/*0348*/ TintProfile equipment_tint;
|
||||
/*0384*/ uint8 lfg; // 0=off, 1=lfg on
|
||||
/*0385*/
|
||||
@@ -740,6 +757,7 @@ static const uint32 MAX_PP_LANGUAGE = 28;
|
||||
static const uint32 MAX_PP_SPELLBOOK = 400;
|
||||
static const uint32 MAX_PP_MEMSPELL = 9;
|
||||
static const uint32 MAX_PP_SKILL = PACKET_SKILL_ARRAY_SIZE; // 100 - actual skills buffer size
|
||||
static const uint32 MAX_PP_INNATE_SKILL = 25;
|
||||
static const uint32 MAX_PP_AA_ARRAY = 240;
|
||||
static const uint32 MAX_GROUP_MEMBERS = 6;
|
||||
static const uint32 MAX_RECAST_TYPES = 20;
|
||||
@@ -844,7 +862,8 @@ struct PlayerProfile_Struct
|
||||
/*04452*/ uint32 silver_cursor; // Silver Pieces on cursor
|
||||
/*04456*/ uint32 copper_cursor; // Copper Pieces on cursor
|
||||
/*04460*/ uint32 skills[MAX_PP_SKILL]; // [400] List of skills // 100 dword buffer
|
||||
/*04860*/ uint8 unknown04760[136];
|
||||
/*04860*/ uint32 InnateSkills[MAX_PP_INNATE_SKILL];
|
||||
/*04960*/ uint8 unknown04760[36];
|
||||
/*04996*/ uint32 toxicity; // Potion Toxicity (15=too toxic, each potion adds 3)
|
||||
/*05000*/ uint32 thirst_level; // Drink (ticks till next drink)
|
||||
/*05004*/ uint32 hunger_level; // Food (ticks till next eat)
|
||||
@@ -1100,20 +1119,18 @@ struct Action_Struct
|
||||
{
|
||||
/* 00 */ uint16 target; // id of target
|
||||
/* 02 */ uint16 source; // id of caster
|
||||
/* 04 */ uint16 level; // level of caster
|
||||
/* 06 */ uint16 instrument_mod;
|
||||
/* 08 */ uint32 unknown08;
|
||||
/* 12 */ uint16 unknown16;
|
||||
// some kind of sequence that's the same in both actions
|
||||
// as well as the combat damage, to tie em together?
|
||||
/* 14 */ uint32 sequence;
|
||||
/* 18 */ uint32 unknown18;
|
||||
/* 22 */ uint8 type; // 231 (0xE7) for spells
|
||||
/* 23 */ uint32 unknown23;
|
||||
/* 04 */ uint16 level; // level of caster for spells, OSX dump says attack rating, guess spells use it for level
|
||||
/* 06 */ uint32 instrument_mod; // OSX dump says base damage, spells use it for bard song (different from newer clients)
|
||||
/* 10 */ float force;
|
||||
/* 14 */ float hit_heading;
|
||||
/* 18 */ float hit_pitch;
|
||||
/* 22 */ uint8 type; // 231 (0xE7) for spells, skill
|
||||
/* 23 */ uint16 unknown23; // OSX says min_damage
|
||||
/* 25 */ uint16 unknown25; // OSX says tohit
|
||||
/* 27 */ uint16 spell; // spell id being cast
|
||||
/* 29 */ uint8 unknown29;
|
||||
/* 29 */ uint8 spell_level;
|
||||
// this field seems to be some sort of success flag, if it's 4
|
||||
/* 30 */ uint8 buff_unknown; // if this is 4, a buff icon is made
|
||||
/* 30 */ uint8 effect_flag; // if this is 4, a buff icon is made
|
||||
/* 31 */
|
||||
};
|
||||
|
||||
@@ -1124,12 +1141,12 @@ struct CombatDamage_Struct
|
||||
{
|
||||
/* 00 */ uint16 target;
|
||||
/* 02 */ uint16 source;
|
||||
/* 04 */ uint8 type; //slashing, etc. 231 (0xE7) for spells
|
||||
/* 04 */ uint8 type; //slashing, etc. 231 (0xE7) for spells, skill
|
||||
/* 05 */ uint16 spellid;
|
||||
/* 07 */ uint32 damage;
|
||||
/* 11 */ float force;
|
||||
/* 15 */ float meleepush_xy; // see above notes in Action_Struct
|
||||
/* 19 */ float meleepush_z;
|
||||
/* 15 */ float hit_heading; // see above notes in Action_Struct
|
||||
/* 19 */ float hit_pitch;
|
||||
/* 23 */
|
||||
};
|
||||
|
||||
@@ -1327,6 +1344,19 @@ struct MoveItem_Struct
|
||||
/*0012*/
|
||||
};
|
||||
|
||||
struct MultiMoveItemSub_Struct
|
||||
{
|
||||
/*0000*/ InventorySlot_Struct from_slot;
|
||||
/*0016*/ uint32 number_in_stack; // so the amount we are moving from the source
|
||||
/*0020*/ InventorySlot_Struct to_slot;
|
||||
};
|
||||
|
||||
struct MultiMoveItem_Struct
|
||||
{
|
||||
/*0000*/ uint32 count;
|
||||
/*0004*/ MultiMoveItemSub_Struct moves[0];
|
||||
};
|
||||
|
||||
//
|
||||
// from_slot/to_slot
|
||||
// -1 - destroy
|
||||
@@ -2539,21 +2569,32 @@ struct GuildMakeLeader{
|
||||
char name[64];
|
||||
char target[64];
|
||||
};
|
||||
struct BugStruct{
|
||||
/*0000*/ char chartype[64];
|
||||
/*0064*/ char name[96];
|
||||
/*0160*/ char ui[128];
|
||||
/*0288*/ float x;
|
||||
/*0292*/ float y;
|
||||
/*0296*/ float z;
|
||||
/*0300*/ float heading;
|
||||
/*0304*/ uint32 unknown304;
|
||||
/*0308*/ uint32 type;
|
||||
/*0312*/ char unknown312[2144];
|
||||
/*2456*/ char bug[1024];
|
||||
/*3480*/ char placeholder[2];
|
||||
/*3482*/ char system_info[4098];
|
||||
|
||||
struct BugReport_Struct {
|
||||
/*0000*/ char category_name[64];
|
||||
/*0064*/ char character_name[64];
|
||||
/*0128*/ char unused_0128[32];
|
||||
/*0160*/ char ui_path[128];
|
||||
/*0288*/ float pos_x;
|
||||
/*0292*/ float pos_y;
|
||||
/*0296*/ float pos_z;
|
||||
/*0300*/ uint32 heading;
|
||||
/*0304*/ uint32 unused_0304;
|
||||
/*0308*/ uint32 time_played;
|
||||
/*0312*/ char padding_0312[8];
|
||||
/*0320*/ uint32 target_id;
|
||||
/*0324*/ char padding_0324[140];
|
||||
/*0464*/ uint32 unknown_0464; // seems to always be '0'
|
||||
/*0468*/ char target_name[64];
|
||||
/*0532*/ uint32 optional_info_mask;
|
||||
|
||||
// this looks like a butchered 8k buffer with 2 trailing dword fields
|
||||
/*0536*/ char unused_0536[2052];
|
||||
/*2588*/ char bug_report[2050];
|
||||
/*4638*/ char system_info[4098];
|
||||
/*8736*/
|
||||
};
|
||||
|
||||
struct Make_Pet_Struct { //Simple struct for getting pet info
|
||||
uint8 level;
|
||||
uint8 class_;
|
||||
@@ -2580,20 +2621,21 @@ struct Ground_Spawn{
|
||||
struct Ground_Spawns {
|
||||
struct Ground_Spawn spawn[50]; //Assigned max number to allow
|
||||
};
|
||||
struct PetitionBug_Struct{
|
||||
uint32 petition_number;
|
||||
uint32 unknown4;
|
||||
char accountname[64];
|
||||
uint32 zoneid;
|
||||
char name[64];
|
||||
uint32 level;
|
||||
uint32 class_;
|
||||
uint32 race;
|
||||
uint32 unknown152[3];
|
||||
uint32 time;
|
||||
uint32 unknown168;
|
||||
char text[1028];
|
||||
};
|
||||
|
||||
//struct PetitionBug_Struct{
|
||||
// uint32 petition_number;
|
||||
// uint32 unknown4;
|
||||
// char accountname[64];
|
||||
// uint32 zoneid;
|
||||
// char name[64];
|
||||
// uint32 level;
|
||||
// uint32 class_;
|
||||
// uint32 race;
|
||||
// uint32 unknown152[3];
|
||||
// uint32 time;
|
||||
// uint32 unknown168;
|
||||
// char text[1028];
|
||||
//};
|
||||
|
||||
struct ApproveZone_Struct {
|
||||
char name[64];
|
||||
@@ -3521,6 +3563,21 @@ struct LFGuild_GuildToggle_Struct
|
||||
// char ScrollName; // '0'
|
||||
//};
|
||||
|
||||
struct SayLinkBodyFrame_Struct {
|
||||
/*000*/ char ActionID[1];
|
||||
/*001*/ char ItemID[5];
|
||||
/*006*/ char Augment1[5];
|
||||
/*011*/ char Augment2[5];
|
||||
/*016*/ char Augment3[5];
|
||||
/*021*/ char Augment4[5];
|
||||
/*026*/ char Augment5[5];
|
||||
/*031*/ char IsEvolving[1];
|
||||
/*032*/ char EvolveGroup[4];
|
||||
/*036*/ char EvolveLevel[1];
|
||||
/*037*/ char Hash[8];
|
||||
/*045*/
|
||||
};
|
||||
|
||||
}; /*structs*/
|
||||
|
||||
}; /*Titanium*/
|
||||
|
||||
+56
-64
@@ -53,11 +53,11 @@ namespace UF
|
||||
static inline uint32 UFToServerSlot(uint32 ufSlot);
|
||||
static inline uint32 UFToServerCorpseSlot(uint32 ufCorpseSlot);
|
||||
|
||||
// server to client text link converter
|
||||
static inline void ServerToUFTextLink(std::string& ufTextLink, const std::string& serverTextLink);
|
||||
// server to client say link converter
|
||||
static inline void ServerToUFSayLink(std::string& ufSayLink, const std::string& serverSayLink);
|
||||
|
||||
// client to server text link converter
|
||||
static inline void UFToServerTextLink(std::string& serverTextLink, const std::string& ufTextLink);
|
||||
// client to server say link converter
|
||||
static inline void UFToServerSayLink(std::string& serverSayLink, const std::string& ufSayLink);
|
||||
|
||||
static inline CastingSlot ServerToUFCastingSlot(EQEmu::CastingSlot slot);
|
||||
static inline EQEmu::CastingSlot UFToServerCastingSlot(CastingSlot slot);
|
||||
@@ -161,29 +161,20 @@ namespace UF
|
||||
OUT(source);
|
||||
OUT(level);
|
||||
eq->instrument_mod = 1.0f + (emu->instrument_mod - 10) / 10.0f;
|
||||
eq->knockback_angle = emu->sequence;
|
||||
OUT(force);
|
||||
OUT(hit_heading);
|
||||
OUT(hit_pitch);
|
||||
OUT(type);
|
||||
OUT(spell);
|
||||
eq->level2 = eq->level;
|
||||
eq->effect_flag = emu->buff_unknown;
|
||||
eq->unknown37 = 0x01;
|
||||
eq->unknown44 = 0xFFFFFFFF;
|
||||
eq->unknown48 = 0xFFFFFFFF;
|
||||
eq->unknown52 = 0xFFFFFFFF;
|
||||
|
||||
/*OUT(target);
|
||||
OUT(source);
|
||||
OUT(level);
|
||||
OUT(instrument_mod);
|
||||
eq->sequence = emu->sequence;
|
||||
OUT(type);
|
||||
//OUT(damage);
|
||||
OUT(spell);
|
||||
eq->level2 = emu->level;
|
||||
OUT(buff_unknown); // if this is 4, a buff icon is made
|
||||
//eq->unknown0036 = -1;
|
||||
//eq->unknown0040 = -1;
|
||||
//eq->unknown0044 = -1;*/
|
||||
OUT(spell_level);
|
||||
OUT(effect_flag);
|
||||
eq->spell_gem = 0;
|
||||
eq->slot[0] = -1; // type
|
||||
eq->slot[1] = -1; // slot
|
||||
eq->slot[2] = -1; // sub index
|
||||
eq->slot[3] = -1; // aug index
|
||||
eq->slot[4] = -1; // unknown
|
||||
eq->item_cast_type = 0;
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
@@ -391,7 +382,7 @@ namespace UF
|
||||
{
|
||||
SETUP_VAR_ENCODE(BuffIcon_Struct);
|
||||
|
||||
uint32 sz = 12 + (17 * emu->count);
|
||||
uint32 sz = 12 + (17 * emu->count) + emu->name_lengths; // 17 includes nullterm
|
||||
__packet->size = sz;
|
||||
__packet->pBuffer = new unsigned char[sz];
|
||||
memset(__packet->pBuffer, 0, sz);
|
||||
@@ -407,7 +398,7 @@ namespace UF
|
||||
__packet->WriteUInt32(emu->entries[i].spell_id);
|
||||
__packet->WriteUInt32(emu->entries[i].tics_remaining);
|
||||
__packet->WriteUInt32(emu->entries[i].num_hits);
|
||||
__packet->WriteString("");
|
||||
__packet->WriteString(emu->entries[i].caster);
|
||||
}
|
||||
__packet->WriteUInt8(emu->type);
|
||||
|
||||
@@ -463,7 +454,7 @@ namespace UF
|
||||
|
||||
std::string old_message = emu->message;
|
||||
std::string new_message;
|
||||
ServerToUFTextLink(new_message, old_message);
|
||||
ServerToUFSayLink(new_message, old_message);
|
||||
|
||||
//in->size = strlen(emu->sender) + 1 + strlen(emu->targetname) + 1 + strlen(emu->message) + 1 + 36;
|
||||
in->size = strlen(emu->sender) + strlen(emu->targetname) + new_message.length() + 39;
|
||||
@@ -586,8 +577,8 @@ namespace UF
|
||||
OUT(spellid);
|
||||
OUT(damage);
|
||||
OUT(force);
|
||||
OUT(meleepush_xy);
|
||||
OUT(meleepush_z);
|
||||
OUT(hit_heading);
|
||||
OUT(hit_pitch);
|
||||
OUT(special);
|
||||
|
||||
FINISH_ENCODE();
|
||||
@@ -762,7 +753,7 @@ namespace UF
|
||||
|
||||
std::string old_message = emu->message;
|
||||
std::string new_message;
|
||||
ServerToUFTextLink(new_message, old_message);
|
||||
ServerToUFSayLink(new_message, old_message);
|
||||
|
||||
//if (new_message.length() > 512) // length restricted in packet building function due vari-length name size (no nullterm)
|
||||
// new_message = new_message.substr(0, 512);
|
||||
@@ -814,7 +805,7 @@ namespace UF
|
||||
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
if (old_message_array[i].length() == 0) { break; }
|
||||
ServerToUFTextLink(new_message_array[i], old_message_array[i]);
|
||||
ServerToUFSayLink(new_message_array[i], old_message_array[i]);
|
||||
new_message_size += new_message_array[i].length() + 1;
|
||||
}
|
||||
|
||||
@@ -1850,6 +1841,7 @@ namespace UF
|
||||
OUT(copper_cursor);
|
||||
|
||||
OUT_array(skills, structs::MAX_PP_SKILL); // 1:1 direct copy (100 dword)
|
||||
OUT_array(InnateSkills, structs::MAX_PP_INNATE_SKILL); // 1:1 direct copy (25 dword)
|
||||
|
||||
// OUT(unknown04760[236]);
|
||||
OUT(toxicity);
|
||||
@@ -2468,7 +2460,7 @@ namespace UF
|
||||
std::string old_message = &emu->message[strlen(emu->sayer)];
|
||||
std::string new_message;
|
||||
|
||||
ServerToUFTextLink(new_message, old_message);
|
||||
ServerToUFSayLink(new_message, old_message);
|
||||
|
||||
//in->size = 3 + 4 + 4 + strlen(emu->sayer) + 1 + 12 + new_message.length() + 1;
|
||||
in->size = strlen(emu->sayer) + new_message.length() + 25;
|
||||
@@ -2538,7 +2530,7 @@ namespace UF
|
||||
|
||||
std::string old_message = InBuffer; // start 'Reward' as string
|
||||
std::string new_message;
|
||||
ServerToUFTextLink(new_message, old_message);
|
||||
ServerToUFSayLink(new_message, old_message);
|
||||
|
||||
in->size = sizeof(TaskDescriptionHeader_Struct) + sizeof(TaskDescriptionData1_Struct)+
|
||||
sizeof(TaskDescriptionData2_Struct) + sizeof(TaskDescriptionTrailer_Struct)+
|
||||
@@ -3286,7 +3278,7 @@ namespace UF
|
||||
|
||||
std::string old_message = InBuffer;
|
||||
std::string new_message;
|
||||
UFToServerTextLink(new_message, old_message);
|
||||
UFToServerSayLink(new_message, old_message);
|
||||
|
||||
//__packet->size = sizeof(ChannelMessage_Struct)+strlen(InBuffer) + 1;
|
||||
__packet->size = sizeof(ChannelMessage_Struct) + new_message.length() + 1;
|
||||
@@ -3397,7 +3389,7 @@ namespace UF
|
||||
IN(type);
|
||||
IN(spellid);
|
||||
IN(damage);
|
||||
IN(meleepush_xy);
|
||||
IN(hit_heading);
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
@@ -3420,7 +3412,7 @@ namespace UF
|
||||
|
||||
std::string old_message = (char *)&__eq_buffer[4]; // unknown01 offset
|
||||
std::string new_message;
|
||||
UFToServerTextLink(new_message, old_message);
|
||||
UFToServerSayLink(new_message, old_message);
|
||||
|
||||
__packet->size = sizeof(Emote_Struct);
|
||||
__packet->pBuffer = new unsigned char[__packet->size];
|
||||
@@ -4289,19 +4281,19 @@ namespace UF
|
||||
return (ufCorpseSlot - 1);
|
||||
}
|
||||
|
||||
static inline void ServerToUFTextLink(std::string& ufTextLink, const std::string& serverTextLink)
|
||||
static inline void ServerToUFSayLink(std::string& ufSayLink, const std::string& serverSayLink)
|
||||
{
|
||||
if ((constants::SayLinkBodySize == EQEmu::legacy::TEXT_LINK_BODY_LENGTH) || (serverTextLink.find('\x12') == std::string::npos)) {
|
||||
ufTextLink = serverTextLink;
|
||||
if ((constants::SayLinkBodySize == EQEmu::constants::SayLinkBodySize) || (serverSayLink.find('\x12') == std::string::npos)) {
|
||||
ufSayLink = serverSayLink;
|
||||
return;
|
||||
}
|
||||
|
||||
auto segments = SplitString(serverTextLink, '\x12');
|
||||
auto segments = SplitString(serverSayLink, '\x12');
|
||||
|
||||
for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) {
|
||||
if (segment_iter & 1) {
|
||||
if (segments[segment_iter].length() <= EQEmu::legacy::TEXT_LINK_BODY_LENGTH) {
|
||||
ufTextLink.append(segments[segment_iter]);
|
||||
if (segments[segment_iter].length() <= EQEmu::constants::SayLinkBodySize) {
|
||||
ufSayLink.append(segments[segment_iter]);
|
||||
// TODO: log size mismatch error
|
||||
continue;
|
||||
}
|
||||
@@ -4311,37 +4303,37 @@ namespace UF
|
||||
// SoF: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX X XXXXX XXXXXXXX (50)
|
||||
// Diff: ^^^^^ ^
|
||||
|
||||
ufTextLink.push_back('\x12');
|
||||
ufTextLink.append(segments[segment_iter].substr(0, 31));
|
||||
ufTextLink.append(segments[segment_iter].substr(36, 5));
|
||||
ufSayLink.push_back('\x12');
|
||||
ufSayLink.append(segments[segment_iter].substr(0, 31));
|
||||
ufSayLink.append(segments[segment_iter].substr(36, 5));
|
||||
|
||||
if (segments[segment_iter][41] == '0')
|
||||
ufTextLink.push_back(segments[segment_iter][42]);
|
||||
ufSayLink.push_back(segments[segment_iter][42]);
|
||||
else
|
||||
ufTextLink.push_back('F');
|
||||
ufSayLink.push_back('F');
|
||||
|
||||
ufTextLink.append(segments[segment_iter].substr(43));
|
||||
ufTextLink.push_back('\x12');
|
||||
ufSayLink.append(segments[segment_iter].substr(43));
|
||||
ufSayLink.push_back('\x12');
|
||||
}
|
||||
else {
|
||||
ufTextLink.append(segments[segment_iter]);
|
||||
ufSayLink.append(segments[segment_iter]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline void UFToServerTextLink(std::string& serverTextLink, const std::string& ufTextLink)
|
||||
static inline void UFToServerSayLink(std::string& serverSayLink, const std::string& ufSayLink)
|
||||
{
|
||||
if ((EQEmu::legacy::TEXT_LINK_BODY_LENGTH == constants::SayLinkBodySize) || (ufTextLink.find('\x12') == std::string::npos)) {
|
||||
serverTextLink = ufTextLink;
|
||||
if ((EQEmu::constants::SayLinkBodySize == constants::SayLinkBodySize) || (ufSayLink.find('\x12') == std::string::npos)) {
|
||||
serverSayLink = ufSayLink;
|
||||
return;
|
||||
}
|
||||
|
||||
auto segments = SplitString(ufTextLink, '\x12');
|
||||
auto segments = SplitString(ufSayLink, '\x12');
|
||||
|
||||
for (size_t segment_iter = 0; segment_iter < segments.size(); ++segment_iter) {
|
||||
if (segment_iter & 1) {
|
||||
if (segments[segment_iter].length() <= constants::SayLinkBodySize) {
|
||||
serverTextLink.append(segments[segment_iter]);
|
||||
serverSayLink.append(segments[segment_iter]);
|
||||
// TODO: log size mismatch error
|
||||
continue;
|
||||
}
|
||||
@@ -4351,16 +4343,16 @@ namespace UF
|
||||
// RoF2: X XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX X XXXX XX XXXXX XXXXXXXX (56)
|
||||
// Diff: ^^^^^ ^
|
||||
|
||||
serverTextLink.push_back('\x12');
|
||||
serverTextLink.append(segments[segment_iter].substr(0, 31));
|
||||
serverTextLink.append("00000");
|
||||
serverTextLink.append(segments[segment_iter].substr(31, 5));
|
||||
serverTextLink.push_back('0');
|
||||
serverTextLink.append(segments[segment_iter].substr(36));
|
||||
serverTextLink.push_back('\x12');
|
||||
serverSayLink.push_back('\x12');
|
||||
serverSayLink.append(segments[segment_iter].substr(0, 31));
|
||||
serverSayLink.append("00000");
|
||||
serverSayLink.append(segments[segment_iter].substr(31, 5));
|
||||
serverSayLink.push_back('0');
|
||||
serverSayLink.append(segments[segment_iter].substr(36));
|
||||
serverSayLink.push_back('\x12');
|
||||
}
|
||||
else {
|
||||
serverTextLink.append(segments[segment_iter]);
|
||||
serverSayLink.append(segments[segment_iter]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+62
-65
@@ -292,7 +292,7 @@ struct Spawn_Struct
|
||||
/*0000*/ //uint8 nullterm1; // hack to null terminate name
|
||||
/*0064*/ uint32 spawnId;
|
||||
/*0068*/ uint8 level;
|
||||
/*0069*/ float unknown1;
|
||||
/*0069*/ float bounding_radius; // used in melee, overrides calc
|
||||
/*0073*/ uint8 NPC; // 0=player,1=npc,2=pc corpse,3=npc corpse
|
||||
Spawn_Struct_Bitfields Bitfields;
|
||||
/*0000*/ uint8 otherData; // & 4 - has title, & 8 - has suffix, & 1 - it's a chest or untargetable
|
||||
@@ -848,6 +848,7 @@ static const uint32 MAX_PP_LANGUAGE = 25; //
|
||||
static const uint32 MAX_PP_SPELLBOOK = 720; // Confirmed 60 pages on Underfoot now
|
||||
static const uint32 MAX_PP_MEMSPELL = 12; //was 9 now 10 on Underfoot
|
||||
static const uint32 MAX_PP_SKILL = PACKET_SKILL_ARRAY_SIZE; // 100 - actual skills buffer size
|
||||
static const uint32 MAX_PP_INNATE_SKILL = 25;
|
||||
static const uint32 MAX_PP_AA_ARRAY = 300; //was 299
|
||||
static const uint32 MAX_GROUP_MEMBERS = 6;
|
||||
static const uint32 MAX_RECAST_TYPES = 20;
|
||||
@@ -954,7 +955,8 @@ struct PlayerProfile_Struct
|
||||
/*07336*/ uint32 silver_cursor; // Silver Pieces on cursor
|
||||
/*07340*/ uint32 copper_cursor; // Copper Pieces on cursor
|
||||
/*07344*/ uint32 skills[MAX_PP_SKILL]; // [400] List of skills // 100 dword buffer
|
||||
/*07744*/ uint8 unknown07644[136];
|
||||
/*07744*/ uint32 InnateSkills[MAX_PP_INNATE_SKILL];
|
||||
/*07844*/ uint8 unknown07644[36];
|
||||
/*07880*/ uint32 toxicity; // Potion Toxicity (15=too toxic, each potion adds 3)
|
||||
/*07884*/ uint32 thirst_level; // Drink (ticks till next drink)
|
||||
/*07888*/ uint32 hunger_level; // Food (ticks till next eat)
|
||||
@@ -1250,19 +1252,19 @@ struct Action_Struct
|
||||
{
|
||||
/*00*/ uint16 target; // id of target
|
||||
/*02*/ uint16 source; // id of caster
|
||||
/*04*/ uint16 level; // level of caster - Seen 0
|
||||
/*06*/ uint32 unknown06;
|
||||
/*10*/ uint16 instrument_focus;
|
||||
/*12*/ uint16 unknown12; // seems to always be set to something and it doesn't change between casts except in special cases like changing instrument mods
|
||||
/*14*/ uint32 unknown14; // seen 0
|
||||
/*18*/ float knockback_angle; //seems to go from 0-512 then it rolls over again
|
||||
/*22*/ uint32 unknown22;
|
||||
/*26*/ uint8 type;
|
||||
/*27*/ uint32 damage;
|
||||
/*31*/ uint16 unknown31;
|
||||
/*04*/ uint16 level; // level of caster for spells, OSX dump says attack rating, guess spells use it for level
|
||||
/*06*/ uint32 unknown06; // OSX dump says base_damage, was used for bard mod too, this is 0'd :(
|
||||
/*10*/ float instrument_mod;
|
||||
/*14*/ float force;
|
||||
/*18*/ float hit_heading;
|
||||
/*22*/ float hit_pitch;
|
||||
/*26*/ uint8 type; // 231 (0xE7) for spells, skill
|
||||
/*27*/ uint32 damage; // OSX says min_damage
|
||||
/*31*/ uint16 unknown31; // OSX says tohit
|
||||
/*33*/ uint16 spell; // spell id being cast
|
||||
/*35*/ uint8 level2; // level of caster again? Or maybe the castee
|
||||
/*35*/ uint8 spell_level; // level of caster again? Or maybe the castee
|
||||
/*36*/ uint8 effect_flag; // if this is 4, the effect is valid: or if two are sent at the same time?
|
||||
/*37*/
|
||||
};
|
||||
|
||||
|
||||
@@ -1274,27 +1276,22 @@ struct ActionAlt_Struct
|
||||
{
|
||||
/*00*/ uint16 target; // id of target
|
||||
/*02*/ uint16 source; // id of caster
|
||||
/*04*/ uint16 level; // level of caster - Seen 0
|
||||
/*06*/ uint32 unknown06;
|
||||
/*04*/ uint16 level; // level of caster for spells, OSX dump says attack rating, guess spells use it for level
|
||||
/*06*/ uint32 unknown06; // OSX dump says base_damage, was used for bard mod too, this is 0'd :(
|
||||
/*10*/ float instrument_mod;
|
||||
/*14*/ uint32 unknown14; // seen 0
|
||||
/*18*/ float knockback_angle; //seems to go from 0-512 then it rolls over again
|
||||
/*22*/ uint32 unknown22;
|
||||
/*26*/ uint8 type;
|
||||
/*27*/ uint32 damage;
|
||||
/*31*/ uint16 unknown31;
|
||||
/*14*/ float force;
|
||||
/*18*/ float hit_heading;
|
||||
/*22*/ float hit_pitch;
|
||||
/*26*/ uint8 type; // 231 (0xE7) for spells, skill
|
||||
/*27*/ uint32 damage; // OSX says min_damage
|
||||
/*31*/ uint16 unknown31; // OSX says tohit
|
||||
/*33*/ uint16 spell; // spell id being cast
|
||||
/*35*/ uint8 level2; // level of caster again? Or maybe the castee
|
||||
/*35*/ uint8 spell_level; // level of caster again? Or maybe the castee
|
||||
/*36*/ uint8 effect_flag; // if this is 4, the effect is valid: or if two are sent at the same time?
|
||||
/*37*/ uint32 unknown37; // New field to Underfoot - Seen 14
|
||||
/*41*/ uint8 unknown41; // New field to Underfoot - Seen 0
|
||||
/*42*/ uint8 unknown42; // New field to Underfoot - Seen 0
|
||||
/*43*/ uint8 unknown43; // New field to Underfoot - Seen 0
|
||||
/*44*/ uint32 unknown44; // New field to Underfoot - Seen 23
|
||||
/*48*/ uint32 unknown48; // New field to Underfoot - Seen -1
|
||||
/*52*/ uint32 unknown52; // New field to Underfoot - Seen -1
|
||||
/*56*/ uint32 unknown56; // New field to Underfoot - Seen 0
|
||||
/*60*/ uint32 unknown60; // New field to Underfoot - Seen 0
|
||||
/*37*/ uint8 spell_gem;
|
||||
/*38*/ uint8 padding38[2];
|
||||
/*40*/ uint32 slot[5];
|
||||
/*60*/ uint32 item_cast_type; // ItemSpellTypes enum from MQ2
|
||||
/*64*/
|
||||
};
|
||||
|
||||
@@ -1309,9 +1306,9 @@ struct CombatDamage_Struct
|
||||
/* 05 */ uint16 spellid;
|
||||
/* 07 */ int32 damage;
|
||||
/* 11 */ float force; // cd cc cc 3d
|
||||
/* 15 */ float meleepush_xy; // see above notes in Action_Struct
|
||||
/* 19 */ float meleepush_z;
|
||||
/* 23 */ uint8 unknown23; // was [9]
|
||||
/* 15 */ float hit_heading; // see above notes in Action_Struct
|
||||
/* 19 */ float hit_pitch;
|
||||
/* 23 */ uint8 secondary; // 0 for primary hand, 1 for secondary
|
||||
/* 24 */ uint32 special; // 2 = Rampage, 1 = Wild Rampage
|
||||
/* 28 */
|
||||
};
|
||||
@@ -3058,23 +3055,6 @@ struct GuildMakeLeader{
|
||||
char target[64];
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct BugStruct{
|
||||
/*0000*/ char chartype[64];
|
||||
/*0064*/ char name[96];
|
||||
/*0160*/ char ui[128];
|
||||
/*0288*/ float x;
|
||||
/*0292*/ float y;
|
||||
/*0296*/ float z;
|
||||
/*0300*/ float heading;
|
||||
/*0304*/ uint32 unknown304;
|
||||
/*0308*/ uint32 type;
|
||||
/*0312*/ char unknown312[2144];
|
||||
/*2456*/ char bug[1024];
|
||||
/*3480*/ char placeholder[2];
|
||||
/*3482*/ char system_info[4098];
|
||||
};
|
||||
struct Make_Pet_Struct { //Simple struct for getting pet info
|
||||
uint8 level;
|
||||
uint8 class_;
|
||||
@@ -3101,20 +3081,21 @@ struct Ground_Spawn{
|
||||
struct Ground_Spawns {
|
||||
struct Ground_Spawn spawn[50]; //Assigned max number to allow
|
||||
};
|
||||
struct PetitionBug_Struct{
|
||||
uint32 petition_number;
|
||||
uint32 unknown4;
|
||||
char accountname[64];
|
||||
uint32 zoneid;
|
||||
char name[64];
|
||||
uint32 level;
|
||||
uint32 class_;
|
||||
uint32 race;
|
||||
uint32 unknown152[3];
|
||||
uint32 time;
|
||||
uint32 unknown168;
|
||||
char text[1028];
|
||||
};
|
||||
|
||||
//struct PetitionBug_Struct{
|
||||
// uint32 petition_number;
|
||||
// uint32 unknown4;
|
||||
// char accountname[64];
|
||||
// uint32 zoneid;
|
||||
// char name[64];
|
||||
// uint32 level;
|
||||
// uint32 class_;
|
||||
// uint32 race;
|
||||
// uint32 unknown152[3];
|
||||
// uint32 time;
|
||||
// uint32 unknown168;
|
||||
// char text[1028];
|
||||
//};
|
||||
|
||||
struct ApproveZone_Struct {
|
||||
char name[64];
|
||||
@@ -4503,6 +4484,22 @@ struct MercenaryAssign_Struct {
|
||||
/*0004*/ uint32 MercUnk01; //
|
||||
/*0008*/ uint32 MercUnk02; //
|
||||
/*0012*/
|
||||
};
|
||||
|
||||
struct SayLinkBodyFrame_Struct {
|
||||
/*000*/ char ActionID[1];
|
||||
/*001*/ char ItemID[5];
|
||||
/*006*/ char Augment1[5];
|
||||
/*011*/ char Augment2[5];
|
||||
/*016*/ char Augment3[5];
|
||||
/*021*/ char Augment4[5];
|
||||
/*026*/ char Augment5[5];
|
||||
/*031*/ char IsEvolving[1];
|
||||
/*032*/ char EvolveGroup[4];
|
||||
/*036*/ char EvolveLevel[1];
|
||||
/*037*/ char OrnamentIcon[5];
|
||||
/*042*/ char Hash[8];
|
||||
/*050*/
|
||||
};
|
||||
|
||||
}; /*structs*/
|
||||
|
||||
+200
-87
@@ -1349,102 +1349,99 @@ const char* GetPlayerRaceName(uint32 player_race_value)
|
||||
return GetRaceIDName(GetRaceIDFromPlayerRaceValue(player_race_value));
|
||||
}
|
||||
|
||||
uint32 GetPlayerRaceValue(uint16 race_id)
|
||||
{
|
||||
uint32 GetPlayerRaceValue(uint16 race_id) {
|
||||
switch (race_id) {
|
||||
case HUMAN:
|
||||
case BARBARIAN:
|
||||
case ERUDITE:
|
||||
case WOOD_ELF:
|
||||
case HIGH_ELF:
|
||||
case DARK_ELF:
|
||||
case HALF_ELF:
|
||||
case DWARF:
|
||||
case TROLL:
|
||||
case OGRE:
|
||||
case HALFLING:
|
||||
case GNOME:
|
||||
return race_id;
|
||||
case IKSAR:
|
||||
return PLAYER_RACE_IKSAR;
|
||||
case VAHSHIR:
|
||||
return PLAYER_RACE_VAHSHIR;
|
||||
case FROGLOK:
|
||||
case FROGLOK2:
|
||||
return PLAYER_RACE_FROGLOK;
|
||||
case DRAKKIN:
|
||||
return PLAYER_RACE_DRAKKIN;
|
||||
default:
|
||||
return PLAYER_RACE_UNKNOWN; // watch
|
||||
case HUMAN:
|
||||
case BARBARIAN:
|
||||
case ERUDITE:
|
||||
case WOOD_ELF:
|
||||
case HIGH_ELF:
|
||||
case DARK_ELF:
|
||||
case HALF_ELF:
|
||||
case DWARF:
|
||||
case TROLL:
|
||||
case OGRE:
|
||||
case HALFLING:
|
||||
case GNOME:
|
||||
return race_id;
|
||||
case IKSAR:
|
||||
return PLAYER_RACE_IKSAR;
|
||||
case VAHSHIR:
|
||||
return PLAYER_RACE_VAHSHIR;
|
||||
case FROGLOK:
|
||||
case FROGLOK2:
|
||||
return PLAYER_RACE_FROGLOK;
|
||||
case DRAKKIN:
|
||||
return PLAYER_RACE_DRAKKIN;
|
||||
default:
|
||||
return PLAYER_RACE_UNKNOWN; // watch
|
||||
}
|
||||
}
|
||||
|
||||
uint32 GetPlayerRaceBit(uint16 race_id)
|
||||
{
|
||||
uint32 GetPlayerRaceBit(uint16 race_id) {
|
||||
switch (race_id) {
|
||||
case HUMAN:
|
||||
return PLAYER_RACE_HUMAN_BIT;
|
||||
case BARBARIAN:
|
||||
return PLAYER_RACE_BARBARIAN_BIT;
|
||||
case ERUDITE:
|
||||
return PLAYER_RACE_ERUDITE_BIT;
|
||||
case WOOD_ELF:
|
||||
return PLAYER_RACE_WOOD_ELF_BIT;
|
||||
case HIGH_ELF:
|
||||
return PLAYER_RACE_HIGH_ELF_BIT;
|
||||
case DARK_ELF:
|
||||
return PLAYER_RACE_DARK_ELF_BIT;
|
||||
case HALF_ELF:
|
||||
return PLAYER_RACE_HALF_ELF_BIT;
|
||||
case DWARF:
|
||||
return PLAYER_RACE_DWARF_BIT;
|
||||
case TROLL:
|
||||
return PLAYER_RACE_TROLL_BIT;
|
||||
case OGRE:
|
||||
return PLAYER_RACE_OGRE_BIT;
|
||||
case HALFLING:
|
||||
return PLAYER_RACE_HALFLING_BIT;
|
||||
case GNOME:
|
||||
return PLAYER_RACE_GNOME_BIT;
|
||||
case IKSAR:
|
||||
return PLAYER_RACE_IKSAR_BIT;
|
||||
case VAHSHIR:
|
||||
return PLAYER_RACE_VAHSHIR_BIT;
|
||||
case FROGLOK:
|
||||
return PLAYER_RACE_FROGLOK_BIT;
|
||||
case DRAKKIN:
|
||||
return PLAYER_RACE_DRAKKIN_BIT;
|
||||
default:
|
||||
return PLAYER_RACE_UNKNOWN_BIT;
|
||||
case HUMAN:
|
||||
return PLAYER_RACE_HUMAN_BIT;
|
||||
case BARBARIAN:
|
||||
return PLAYER_RACE_BARBARIAN_BIT;
|
||||
case ERUDITE:
|
||||
return PLAYER_RACE_ERUDITE_BIT;
|
||||
case WOOD_ELF:
|
||||
return PLAYER_RACE_WOOD_ELF_BIT;
|
||||
case HIGH_ELF:
|
||||
return PLAYER_RACE_HIGH_ELF_BIT;
|
||||
case DARK_ELF:
|
||||
return PLAYER_RACE_DARK_ELF_BIT;
|
||||
case HALF_ELF:
|
||||
return PLAYER_RACE_HALF_ELF_BIT;
|
||||
case DWARF:
|
||||
return PLAYER_RACE_DWARF_BIT;
|
||||
case TROLL:
|
||||
return PLAYER_RACE_TROLL_BIT;
|
||||
case OGRE:
|
||||
return PLAYER_RACE_OGRE_BIT;
|
||||
case HALFLING:
|
||||
return PLAYER_RACE_HALFLING_BIT;
|
||||
case GNOME:
|
||||
return PLAYER_RACE_GNOME_BIT;
|
||||
case IKSAR:
|
||||
return PLAYER_RACE_IKSAR_BIT;
|
||||
case VAHSHIR:
|
||||
return PLAYER_RACE_VAHSHIR_BIT;
|
||||
case FROGLOK:
|
||||
return PLAYER_RACE_FROGLOK_BIT;
|
||||
case DRAKKIN:
|
||||
return PLAYER_RACE_DRAKKIN_BIT;
|
||||
default:
|
||||
return PLAYER_RACE_UNKNOWN_BIT;
|
||||
}
|
||||
}
|
||||
|
||||
uint16 GetRaceIDFromPlayerRaceValue(uint32 player_race_value)
|
||||
{
|
||||
uint16 GetRaceIDFromPlayerRaceValue(uint32 player_race_value) {
|
||||
switch (player_race_value) {
|
||||
case PLAYER_RACE_HUMAN:
|
||||
case PLAYER_RACE_BARBARIAN:
|
||||
case PLAYER_RACE_ERUDITE:
|
||||
case PLAYER_RACE_WOOD_ELF:
|
||||
case PLAYER_RACE_HIGH_ELF:
|
||||
case PLAYER_RACE_DARK_ELF:
|
||||
case PLAYER_RACE_HALF_ELF:
|
||||
case PLAYER_RACE_DWARF:
|
||||
case PLAYER_RACE_TROLL:
|
||||
case PLAYER_RACE_OGRE:
|
||||
case PLAYER_RACE_HALFLING:
|
||||
case PLAYER_RACE_GNOME:
|
||||
return player_race_value;
|
||||
case PLAYER_RACE_IKSAR:
|
||||
return IKSAR;
|
||||
case PLAYER_RACE_VAHSHIR:
|
||||
return VAHSHIR;
|
||||
case PLAYER_RACE_FROGLOK:
|
||||
return FROGLOK;
|
||||
case PLAYER_RACE_DRAKKIN:
|
||||
return DRAKKIN;
|
||||
default:
|
||||
return PLAYER_RACE_UNKNOWN; // watch
|
||||
case PLAYER_RACE_HUMAN:
|
||||
case PLAYER_RACE_BARBARIAN:
|
||||
case PLAYER_RACE_ERUDITE:
|
||||
case PLAYER_RACE_WOOD_ELF:
|
||||
case PLAYER_RACE_HIGH_ELF:
|
||||
case PLAYER_RACE_DARK_ELF:
|
||||
case PLAYER_RACE_HALF_ELF:
|
||||
case PLAYER_RACE_DWARF:
|
||||
case PLAYER_RACE_TROLL:
|
||||
case PLAYER_RACE_OGRE:
|
||||
case PLAYER_RACE_HALFLING:
|
||||
case PLAYER_RACE_GNOME:
|
||||
return player_race_value;
|
||||
case PLAYER_RACE_IKSAR:
|
||||
return IKSAR;
|
||||
case PLAYER_RACE_VAHSHIR:
|
||||
return VAHSHIR;
|
||||
case PLAYER_RACE_FROGLOK:
|
||||
return FROGLOK;
|
||||
case PLAYER_RACE_DRAKKIN:
|
||||
return DRAKKIN;
|
||||
default:
|
||||
return PLAYER_RACE_UNKNOWN; // watch
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1488,6 +1485,122 @@ uint16 GetRaceIDFromPlayerRaceBit(uint32 player_race_bit)
|
||||
}
|
||||
}
|
||||
|
||||
float GetRaceGenderDefaultHeight(int race, int gender)
|
||||
{
|
||||
static float male_height[] = {
|
||||
6.0f, 6.0f, 7.0f, 6.0f, 5.0f, 6.0f, 5.0f, 5.5f, 4.0f, 8.0f, 9.0f, 3.5f, 3.0f, 6.0f, 6.0f,
|
||||
2.0f, 8.5f, 8.0f, 21.0f, 20.0f, 6.0f, 6.0f, 3.5f, 3.0f, 6.0f, 2.0f, 5.0f, 5.0f, 6.0f, 6.0f,
|
||||
6.0f, 7.5f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 5.0f, 6.0f, 6.0f, 7.0f, 4.0f, 4.7f, 6.0f,
|
||||
8.0f, 3.0f, 12.0f, 5.0f, 21.0f, 6.0f, 6.0f, 3.0f, 9.0f, 6.0f, 6.0f, 2.0f, 6.0f, 3.0f, 6.0f,
|
||||
4.0f, 20.0f, 5.0f, 5.0f, 6.0f, 9.0f, 25.0f, 6.0f, 6.0f, 10.0f, 6.0f, 6.0f, 6.0f, 6.0f, 2.5f,
|
||||
7.0f, 6.0f, 5.0f, 6.0f, 1.5f, 1.0f, 3.5f, 7.0f, 6.0f, 6.0f, 6.0f, 6.0f, 7.0f, 3.0f, 3.0f,
|
||||
7.0f, 12.0f, 8.0f, 9.0f, 4.0f, 11.5f, 8.0f, 6.0f, 6.0f, 12.0f, 6.0f, 6.0f, 6.0f, 20.0f, 10.0f,
|
||||
6.5f, 6.0f, 17.0f, 1.0f, 4.0f, 6.0f, 8.0f, 5.0f, 1.0f, 6.0f, 6.0f, 5.0f, 5.0f, 5.0f, 9.0f,
|
||||
3.0f, 8.0f, 2.0f, 24.0f, 6.0f, 10.0f, 6.0f, 6.0f, 6.0f, 3.0f, 7.0f, 9.0f, 6.0f, 11.0f, 2.5f,
|
||||
14.0f, 8.0f, 7.0f, 12.0f, 6.0f, 27.0f, 6.0f, 6.0f, 6.0f, 6.0f, 2.0f, 9.0f, 9.0f, 6.0f, 9.0f,
|
||||
3.0f, 3.0f, 6.0f, 6.0f, 10.0f, 6.0f, 6.0f, 15.0f, 15.0f, 9.0f, 7.0f, 6.0f, 6.0f, 7.0f, 8.0f,
|
||||
3.0f, 3.0f, 6.0f, 7.0f, 13.0f, 6.0f, 6.0f, 9.0f, 5.0f, 7.0f, 9.0f, 6.0f, 6.0f, 8.0f, 6.0f,
|
||||
6.0f, 5.5f, 6.0f, 4.0f, 25.0f, 6.0f, 6.0f, 6.0f, 22.0f, 20.0f, 6.0f, 10.0f, 13.5f, 12.0f, 3.0f,
|
||||
30.0f, 6.0f, 6.0f, 35.0f, 1.5f, 8.0f, 3.0f, 6.0f, 2.0f, 6.0f, 6.0f, 5.0f, 2.0f, 7.0f, 6.0f,
|
||||
6.0f, 6.0f, 6.0f, 4.0f, 6.0f, 6.0f, 6.0f, 8.0f, 8.0f, 7.0f, 8.0f, 6.0f, 7.0f, 6.0f, 7.0f,
|
||||
6.0f, 10.0f, 3.0f, 6.0f, 8.0f, 9.0f, 15.0f, 5.0f, 10.0f, 7.0f, 6.0f, 7.0f, 6.0f, 7.0f, 7.0f,
|
||||
12.0f, 6.0f, 4.0f, 6.0f, 5.0f, 3.0f, 30.0f, 30.0f, 15.0f, 20.0f, 6.0f, 10.0f, 6.0f, 14.0f, 14.0f,
|
||||
16.0f, 15.0f, 30.0f, 15.0f, 7.5f, 5.0f, 4.0f, 6.0f, 15.0f, 6.5f, 3.0f, 12.0f, 10.0f, 10.5f, 10.0f,
|
||||
7.5f, 6.0f, 6.0f, 12.5f, 9.0f, 20.0f, 2.0f, 10.0f, 25.0f, 8.0f, 6.0f, 6.0f, 10.0f, 18.0f, 45.0f,
|
||||
13.0f, 15.0f, 8.0f, 30.0f, 25.0f, 25.0f, 10.0f, 13.0f, 5.0f, 3.5f, 15.0f, 35.0f, 11.0f, 15.0f, 50.0f,
|
||||
13.0f, 6.0f, 7.0f, 6.0f, 60.0f, 6.0f, 22.0f, 22.0f, 21.0f, 22.0f, 15.0f, 25.0f, 23.0f, 8.0f, 15.0f,
|
||||
10.0f, 6.0f, 7.0f, 6.0f, 12.0f, 9.5f, 6.0f, 12.0f, 12.0f, 12.0f, 15.0f, 4.0f, 5.0f, 105.0f, 20.0f,
|
||||
5.0f, 10.0f, 10.0f, 10.0f, 20.0f, 13.5f, 8.0f, 10.0f, 3.0f, 5.0f, 9.0f, 6.0f, 6.0f, 6.0f, 10.0f,
|
||||
8.0f, 8.0f, 8.0f, 6.0f, 6.0f, 5.0f, 5.0f, 5.0f, 9.0f, 9.0f, 9.0f, 6.0f, 8.5f, 6.0f, 7.0f,
|
||||
8.0f, 7.0f, 11.0f, 6.0f, 7.0f, 9.0f, 8.0f, 6.0f, 8.0f, 6.0f, 6.0f, 6.0f, 6.0f, 9.0f, 10.0f,
|
||||
6.0f, 3.0f, 4.0f, 3.0f, 3.0f, 4.0f, 10.0f, 10.0f, 2.0f, 8.0f, 6.0f, 6.0f, 14.0f, 7.0f, 5.0f,
|
||||
9.0f, 7.0f, 7.0f, 10.0f, 10.0f, 12.0f, 9.0f, 7.0f, 12.0f, 13.0f, 16.0f, 6.0f, 9.0f, 6.0f, 6.0f,
|
||||
10.0f, 25.0f, 15.0f, 6.0f, 25.0f, 6.0f, 6.0f, 8.0f, 11.0f, 6.0f, 9.0f, 2.0f, 6.0f, 5.0f, 4.0f,
|
||||
8.5f, 6.0f, 6.0f, 6.0f, 4.0f, 6.0f, 15.0f, 1.0f, 2.0f, 6.0f, 40.0f, 8.0f, 12.0f, 3.0f, 8.0f,
|
||||
99.0f, 9.0f, 100.0f, 100.0f, 10.0f, 6.0f, 27.5f, 20.0f, 6.0f, 6.0f, 5.0f, 6.0f, 8.0f, 5.0f, 3.0f,
|
||||
11.5f, 25.0f, 80.0f, 20.0f, 9.0f, 8.0f, 5.0f, 4.0f, 7.0f, 10.0f, 6.0f, 11.0f, 8.0f, 5.0f, 6.0f,
|
||||
6.0f, 30.0f, 7.0f, 15.0f, 9.0f, 6.0f, 9.0f, 6.0f, 3.0f, 32.5f, 15.0f, 7.5f, 10.0f, 10.0f, 6.0f,
|
||||
6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 9.0f, 20.0f, 6.0f, 6.0f, 6.0f, 25.0f, 12.0f, 6.0f, 8.0f, 6.0f,
|
||||
6.0f, 20.0f, 10.0f, 8.0f, 12.0f, 8.0f, 2.0f, 6.0f, 3.0f, 6.0f, 7.0f, 1.5f, 6.0f, 3.0f, 3.0f,
|
||||
3.0f, 3.0f, 2.0f, 3.0f, 3.0f, 6.0f, 6.0f, 6.0f, 4.5f, 7.0f, 6.0f, 7.0f, 6.0f, 22.0f, 8.0f,
|
||||
15.0f, 22.0f, 8.0f, 15.0f, 6.0f, 80.0f, 150.0f, 7.0f, 6.0f, 6.0f, 6.0f, 12.0f, 6.0f, 6.0f, 6.0f,
|
||||
6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 35.0f, 20.0f, 9.0f, 6.0f, 6.0f, 6.0f, 20.0f, 20.0f,
|
||||
20.0f, 20.0f, 20.0f, 9.0f, 4.0f, 4.0f, 10.0f, 5.0f, 8.0f, 6.0f, 10.0f, 6.0f, 6.0f, 2.0f, 36.0f,
|
||||
14.0f, 7.0f, 250.0f, 6.0f, 9.0f, 6.0f, 7.0f, 4.0f, 6.0f, 8.0f, 6.0f, 23.0f, 6.0f, 6.0f, 6.0f,
|
||||
70.0f, 6.0f, 7.0f, 6.0f, 6.0f, 6.0f, 20.0f, 6.0f, 6.0f, 6.0f, 5.0f, 1.0f, 6.0f, 6.0f, 6.0f,
|
||||
6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f,
|
||||
6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f,
|
||||
6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f,
|
||||
4.0f, 4.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 10.0f, 6.0f, 6.0f, 6.0f,
|
||||
6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f,
|
||||
6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f,
|
||||
6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 7.0f, 7.0f, 7.0f, 7.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 8.0f,
|
||||
6.0f, 6.0f, 6.0f, 7.0f, 6.0f, 6.0f, 6.0f, 7.5f, 6.0f, 6.0f, 4.0f, 6.0f, 3.0f, 6.0f, 6.0f,
|
||||
1.0f, 9.0f, 7.0f, 8.0f, 7.0f, 8.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 8.0f,
|
||||
};
|
||||
|
||||
static float female_height[] = {
|
||||
6.0f, 6.0f, 7.0f, 6.0f, 5.0f, 6.0f, 5.0f, 5.5f, 4.0f, 8.0f, 9.0f, 3.5f, 3.0f, 6.0f, 6.0f,
|
||||
2.0f, 8.5f, 8.0f, 21.0f, 20.0f, 6.0f, 6.0f, 3.5f, 3.0f, 6.0f, 2.0f, 5.0f, 5.0f, 6.0f, 6.0f,
|
||||
6.0f, 7.5f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 5.0f, 6.0f, 6.0f, 7.0f, 4.0f, 4.7f, 6.0f,
|
||||
8.0f, 3.0f, 12.0f, 5.0f, 21.0f, 6.0f, 6.0f, 3.0f, 9.0f, 6.0f, 6.0f, 2.0f, 6.0f, 3.0f, 6.0f,
|
||||
4.0f, 20.0f, 5.0f, 5.0f, 6.0f, 9.0f, 25.0f, 6.0f, 6.0f, 10.0f, 6.0f, 6.0f, 6.0f, 6.0f, 2.5f,
|
||||
7.0f, 6.0f, 5.0f, 6.0f, 1.5f, 1.0f, 3.5f, 7.0f, 6.0f, 6.0f, 6.0f, 6.0f, 7.0f, 3.0f, 3.0f,
|
||||
7.0f, 12.0f, 8.0f, 9.0f, 4.0f, 11.5f, 8.0f, 6.0f, 6.0f, 12.0f, 6.0f, 6.0f, 6.0f, 20.0f, 10.0f,
|
||||
6.5f, 6.0f, 17.0f, 1.0f, 4.0f, 6.0f, 8.0f, 5.0f, 1.0f, 6.0f, 6.0f, 5.0f, 5.0f, 5.0f, 9.0f,
|
||||
3.0f, 8.0f, 2.0f, 24.0f, 6.0f, 10.0f, 6.0f, 6.0f, 6.0f, 3.0f, 7.0f, 9.0f, 6.0f, 11.0f, 2.5f,
|
||||
14.0f, 8.0f, 7.0f, 12.0f, 6.0f, 27.0f, 6.0f, 6.0f, 6.0f, 6.0f, 2.0f, 9.0f, 9.0f, 6.0f, 9.0f,
|
||||
3.0f, 3.0f, 6.0f, 6.0f, 10.0f, 6.0f, 6.0f, 15.0f, 15.0f, 9.0f, 7.0f, 6.0f, 6.0f, 7.0f, 8.0f,
|
||||
3.0f, 3.0f, 6.0f, 7.0f, 13.0f, 6.0f, 6.0f, 9.0f, 5.0f, 7.0f, 9.0f, 6.0f, 6.0f, 8.0f, 6.0f,
|
||||
6.0f, 5.5f, 6.0f, 4.0f, 25.0f, 6.0f, 6.0f, 6.0f, 22.0f, 20.0f, 6.0f, 10.0f, 13.5f, 12.0f, 3.0f,
|
||||
30.0f, 6.0f, 6.0f, 35.0f, 1.5f, 8.0f, 3.0f, 6.0f, 2.0f, 6.0f, 6.0f, 5.0f, 2.0f, 7.0f, 6.0f,
|
||||
6.0f, 6.0f, 6.0f, 4.0f, 6.0f, 6.0f, 6.0f, 8.0f, 8.0f, 7.0f, 8.0f, 6.0f, 7.0f, 6.0f, 7.0f,
|
||||
6.0f, 10.0f, 3.0f, 6.0f, 8.0f, 9.0f, 15.0f, 5.0f, 10.0f, 7.0f, 6.0f, 7.0f, 6.0f, 7.0f, 7.0f,
|
||||
12.0f, 6.0f, 4.0f, 6.0f, 5.0f, 3.0f, 30.0f, 30.0f, 15.0f, 20.0f, 6.0f, 10.0f, 6.0f, 14.0f, 14.0f,
|
||||
16.0f, 15.0f, 30.0f, 15.0f, 7.5f, 5.0f, 4.0f, 6.0f, 15.0f, 6.5f, 3.0f, 12.0f, 10.0f, 10.5f, 10.0f,
|
||||
7.5f, 6.0f, 6.0f, 12.5f, 9.0f, 20.0f, 2.0f, 10.0f, 25.0f, 8.0f, 6.0f, 6.0f, 10.0f, 18.0f, 45.0f,
|
||||
13.0f, 15.0f, 8.0f, 30.0f, 25.0f, 25.0f, 10.0f, 13.0f, 5.0f, 3.5f, 15.0f, 35.0f, 11.0f, 15.0f, 50.0f,
|
||||
13.0f, 6.0f, 7.0f, 6.0f, 60.0f, 6.0f, 22.0f, 22.0f, 21.0f, 22.0f, 15.0f, 25.0f, 23.0f, 8.0f, 15.0f,
|
||||
10.0f, 6.0f, 7.0f, 6.0f, 12.0f, 9.5f, 6.0f, 12.0f, 12.0f, 12.0f, 15.0f, 4.0f, 5.0f, 105.0f, 20.0f,
|
||||
5.0f, 10.0f, 10.0f, 10.0f, 20.0f, 13.5f, 8.0f, 10.0f, 3.0f, 5.0f, 9.0f, 6.0f, 6.0f, 6.0f, 10.0f,
|
||||
8.0f, 8.0f, 8.0f, 6.0f, 6.0f, 5.0f, 5.0f, 5.0f, 9.0f, 9.0f, 9.0f, 6.0f, 8.5f, 6.0f, 7.0f,
|
||||
8.0f, 7.0f, 11.0f, 6.0f, 7.0f, 9.0f, 8.0f, 6.0f, 8.0f, 6.0f, 6.0f, 6.0f, 6.0f, 9.0f, 10.0f,
|
||||
6.0f, 3.0f, 4.0f, 3.0f, 3.0f, 4.0f, 10.0f, 10.0f, 2.0f, 8.0f, 6.0f, 6.0f, 14.0f, 7.0f, 5.0f,
|
||||
9.0f, 7.0f, 7.0f, 10.0f, 10.0f, 12.0f, 9.0f, 7.0f, 12.0f, 13.0f, 16.0f, 6.0f, 9.0f, 6.0f, 6.0f,
|
||||
10.0f, 25.0f, 15.0f, 6.0f, 25.0f, 6.0f, 6.0f, 8.0f, 11.0f, 6.0f, 9.0f, 2.0f, 6.0f, 5.0f, 4.0f,
|
||||
8.5f, 6.0f, 6.0f, 6.0f, 4.0f, 6.0f, 15.0f, 1.0f, 2.0f, 6.0f, 40.0f, 8.0f, 12.0f, 3.0f, 8.0f,
|
||||
99.0f, 9.0f, 100.0f, 100.0f, 10.0f, 6.0f, 27.5f, 20.0f, 6.0f, 6.0f, 5.0f, 6.0f, 8.0f, 5.0f, 3.0f,
|
||||
11.5f, 25.0f, 80.0f, 20.0f, 9.0f, 8.0f, 5.0f, 4.0f, 7.0f, 10.0f, 6.0f, 11.0f, 8.0f, 5.0f, 6.0f,
|
||||
6.0f, 30.0f, 7.0f, 15.0f, 9.0f, 6.0f, 9.0f, 6.0f, 3.0f, 32.5f, 15.0f, 7.5f, 10.0f, 10.0f, 6.0f,
|
||||
6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 9.0f, 20.0f, 6.0f, 6.0f, 6.0f, 25.0f, 12.0f, 6.0f, 8.0f, 6.0f,
|
||||
6.0f, 20.0f, 9.0f, 8.0f, 12.0f, 8.0f, 2.0f, 6.0f, 3.0f, 6.0f, 7.0f, 1.5f, 6.0f, 3.0f, 3.0f,
|
||||
3.0f, 3.0f, 2.0f, 3.0f, 3.0f, 6.0f, 6.0f, 6.0f, 4.5f, 7.0f, 6.0f, 7.0f, 5.7f, 22.0f, 8.0f,
|
||||
15.0f, 22.0f, 8.0f, 15.0f, 6.0f, 80.0f, 150.0f, 7.0f, 6.0f, 6.0f, 6.0f, 12.0f, 6.0f, 6.0f, 6.0f,
|
||||
6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 35.0f, 20.0f, 9.0f, 6.0f, 6.0f, 6.0f, 20.0f, 20.0f,
|
||||
20.0f, 20.0f, 20.0f, 9.0f, 4.0f, 4.0f, 10.0f, 5.0f, 8.0f, 6.0f, 10.0f, 5.7f, 6.0f, 2.0f, 36.0f,
|
||||
14.0f, 7.0f, 250.0f, 6.0f, 9.0f, 6.0f, 7.0f, 4.0f, 6.0f, 8.0f, 6.0f, 23.0f, 6.0f, 6.0f, 6.0f,
|
||||
70.0f, 6.0f, 7.0f, 6.0f, 6.0f, 6.0f, 20.0f, 6.0f, 6.0f, 6.0f, 5.0f, 1.0f, 6.0f, 6.0f, 6.0f,
|
||||
6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f,
|
||||
6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f,
|
||||
6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f,
|
||||
4.0f, 4.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 10.0f, 6.0f, 6.0f, 6.0f,
|
||||
6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f,
|
||||
6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f,
|
||||
6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 7.0f, 7.0f, 7.0f, 7.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 8.0f,
|
||||
6.0f, 6.0f, 6.0f, 7.0f, 6.0f, 6.0f, 6.0f, 7.5f, 6.0f, 6.0f, 4.0f, 6.0f, 3.0f, 6.0f, 6.0f,
|
||||
1.0f, 9.0f, 7.0f, 8.0f, 7.0f, 8.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 8.0f,
|
||||
};
|
||||
|
||||
const auto size = sizeof(male_height) / sizeof(male_height[0]);
|
||||
|
||||
if (race >= size)
|
||||
return 6.0f;
|
||||
|
||||
if (gender == 1)
|
||||
return female_height[race];
|
||||
|
||||
return male_height[race];
|
||||
}
|
||||
|
||||
// PlayerAppearance prep
|
||||
#define HUMAN_MALE ((HUMAN << 8) | MALE)
|
||||
|
||||
+728
-409
File diff suppressed because it is too large
Load Diff
+32
-23
@@ -236,46 +236,51 @@ void RuleManager::SaveRules(Database *database, const char *ruleset_name) {
|
||||
}
|
||||
|
||||
bool RuleManager::LoadRules(Database *database, const char *ruleset_name) {
|
||||
|
||||
int ruleset_id = GetRulesetID(database, ruleset_name);
|
||||
|
||||
int ruleset_id = this->GetRulesetID(database, ruleset_name);
|
||||
if (ruleset_id < 0) {
|
||||
Log(Logs::Detail, Logs::Rules, "Failed to find ruleset '%s' for load operation. Canceling.", ruleset_name);
|
||||
return(false);
|
||||
return (false);
|
||||
}
|
||||
|
||||
Log(Logs::Detail, Logs::Rules, "Loading rule set '%s' (%d)", ruleset_name, ruleset_id);
|
||||
|
||||
m_activeRuleset = ruleset_id;
|
||||
m_activeName = ruleset_name;
|
||||
m_activeName = ruleset_name;
|
||||
|
||||
/* Load default ruleset values first if we're loading something other than default */
|
||||
if (strcasecmp(ruleset_name, "default") != 0){
|
||||
if (strcasecmp(ruleset_name, "default") != 0) {
|
||||
std::string default_ruleset_name = "default";
|
||||
int default_ruleset_id = GetRulesetID(database, default_ruleset_name.c_str());
|
||||
int default_ruleset_id = GetRulesetID(database, default_ruleset_name.c_str());
|
||||
if (default_ruleset_id < 0) {
|
||||
Log(Logs::Detail, Logs::Rules, "Failed to find default ruleset '%s' for load operation. Canceling.", default_ruleset_name.c_str());
|
||||
return(false);
|
||||
Log(Logs::Detail, Logs::Rules, "Failed to find default ruleset '%s' for load operation. Canceling.",
|
||||
default_ruleset_name.c_str());
|
||||
return (false);
|
||||
}
|
||||
Log(Logs::Detail, Logs::Rules, "Loading rule set '%s' (%d)", default_ruleset_name.c_str(), default_ruleset_id);
|
||||
|
||||
std::string query = StringFormat("SELECT rule_name, rule_value FROM rule_values WHERE ruleset_id = %d", default_ruleset_id);
|
||||
std::string query = StringFormat(
|
||||
"SELECT rule_name, rule_value FROM rule_values WHERE ruleset_id = %d",
|
||||
default_ruleset_id
|
||||
);
|
||||
|
||||
auto results = database->QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row)
|
||||
if (!SetRule(row[0], row[1], nullptr, false))
|
||||
Log(Logs::Detail, Logs::Rules, "Unable to interpret rule record for %s", row[0]);
|
||||
if (!SetRule(row[0], row[1], nullptr, false))
|
||||
Log(Logs::Detail, Logs::Rules, "Unable to interpret rule record for %s", row[0]);
|
||||
}
|
||||
|
||||
std::string query = StringFormat("SELECT rule_name, rule_value FROM rule_values WHERE ruleset_id=%d", ruleset_id);
|
||||
auto results = database->QueryDatabase(query);
|
||||
std::string query = StringFormat("SELECT rule_name, rule_value FROM rule_values WHERE ruleset_id=%d", ruleset_id);
|
||||
auto results = database->QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row)
|
||||
if (!SetRule(row[0], row[1], nullptr, false))
|
||||
Log(Logs::Detail, Logs::Rules, "Unable to interpret rule record for %s", row[0]);
|
||||
if (!SetRule(row[0], row[1], nullptr, false))
|
||||
Log(Logs::Detail, Logs::Rules, "Unable to interpret rule record for %s", row[0]);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -283,7 +288,7 @@ bool RuleManager::LoadRules(Database *database, const char *ruleset_name) {
|
||||
void RuleManager::_SaveRule(Database *database, RuleType type, uint16 index) {
|
||||
char value_string[100];
|
||||
|
||||
switch(type) {
|
||||
switch (type) {
|
||||
case IntRule:
|
||||
sprintf(value_string, "%d", m_RuleIntValues[index]);
|
||||
break;
|
||||
@@ -291,22 +296,26 @@ void RuleManager::_SaveRule(Database *database, RuleType type, uint16 index) {
|
||||
sprintf(value_string, "%.13f", m_RuleRealValues[index]);
|
||||
break;
|
||||
case BoolRule:
|
||||
sprintf(value_string, "%s", m_RuleBoolValues[index]?"true":"false");
|
||||
sprintf(value_string, "%s", m_RuleBoolValues[index] ? "true" : "false");
|
||||
break;
|
||||
}
|
||||
|
||||
std::string query = StringFormat("REPLACE INTO rule_values "
|
||||
"(ruleset_id, rule_name, rule_value) "
|
||||
" VALUES(%d, '%s', '%s')",
|
||||
m_activeRuleset, _GetRuleName(type, index), value_string);
|
||||
auto results = database->QueryDatabase(query);
|
||||
std::string query = StringFormat(
|
||||
"REPLACE INTO rule_values "
|
||||
"(ruleset_id, rule_name, rule_value) "
|
||||
" VALUES(%d, '%s', '%s')",
|
||||
m_activeRuleset,
|
||||
_GetRuleName(type, index),
|
||||
value_string
|
||||
);
|
||||
|
||||
database->QueryDatabase(query);
|
||||
}
|
||||
|
||||
|
||||
int RuleManager::GetRulesetID(Database *database, const char *ruleset_name) {
|
||||
|
||||
uint32 len = strlen(ruleset_name);
|
||||
uint32 len = static_cast<uint32>(strlen(ruleset_name));
|
||||
auto rst = new char[2 * len + 1];
|
||||
database->DoEscapeString(rst, ruleset_name, len);
|
||||
|
||||
|
||||
+31
-12
@@ -44,6 +44,7 @@ RULE_INT(Character, DeathExpLossMaxLevel, 255) // Any level greater than this wi
|
||||
RULE_INT(Character, DeathItemLossLevel, 10)
|
||||
RULE_INT(Character, DeathExpLossMultiplier, 3) //Adjust how much exp is lost
|
||||
RULE_BOOL(Character, UseDeathExpLossMult, false) //Adjust to use the above multiplier or to use code default.
|
||||
RULE_BOOL(Character, UseOldRaceRezEffects, false) // older clients had ID 757 for races with high starting STR, but it doesn't seem used anymore
|
||||
RULE_INT(Character, CorpseDecayTimeMS, 10800000)
|
||||
RULE_INT(Character, CorpseResTimeMS, 10800000) // time before cant res corpse(3 hours)
|
||||
RULE_BOOL(Character, LeaveCorpses, true)
|
||||
@@ -66,11 +67,12 @@ RULE_INT(Character, AutosaveIntervalS, 300) //0=disabled
|
||||
RULE_INT(Character, HPRegenMultiplier, 100)
|
||||
RULE_INT(Character, ManaRegenMultiplier, 100)
|
||||
RULE_INT(Character, EnduranceRegenMultiplier, 100)
|
||||
RULE_BOOL(Character, OldMinMana, false) // this is used for servers that want to follow older skill cap formulas so they can still have some regen w/o mediate
|
||||
RULE_INT(Character, ConsumptionMultiplier, 100) //item's hunger restored = this value * item's food level, 100 = normal, 50 = people eat 2x as fast, 200 = people eat 2x as slow
|
||||
RULE_BOOL(Character, HealOnLevel, false)
|
||||
RULE_BOOL(Character, FeignKillsPet, false)
|
||||
RULE_INT(Character, ItemManaRegenCap, 15)
|
||||
RULE_INT(Character, ItemHealthRegenCap, 35)
|
||||
RULE_INT(Character, ItemHealthRegenCap, 30)
|
||||
RULE_INT(Character, ItemDamageShieldCap, 30)
|
||||
RULE_INT(Character, ItemAccuracyCap, 150)
|
||||
RULE_INT(Character, ItemAvoidanceCap, 100)
|
||||
@@ -91,10 +93,12 @@ RULE_INT(Character, HasteCap, 100) // Haste cap for non-v3(overhaste) haste.
|
||||
RULE_INT(Character, SkillUpModifier, 100) //skill ups are at 100%
|
||||
RULE_BOOL(Character, SharedBankPlat, false) //off by default to prevent duping for now
|
||||
RULE_BOOL(Character, BindAnywhere, false)
|
||||
RULE_INT(Character, RestRegenPercent, 0) // Set to >0 to enable rest state bonus HP and mana regen.
|
||||
RULE_BOOL(Character, RestRegenEnabled, true) // Enable OOC Regen
|
||||
RULE_INT(Character, RestRegenHP, 180) // seconds until full from 0. this is actually zone setable, but most or all zones are 180
|
||||
RULE_INT(Character, RestRegenMana, 180) // seconds until full from 0. this is actually zone setable, but most or all zones are 180
|
||||
RULE_INT(Character, RestRegenEnd, 180) // seconds until full from 0. this is actually zone setable, but most or all zones are 180
|
||||
RULE_INT(Character, RestRegenTimeToActivate, 30) // Time in seconds for rest state regen to kick in.
|
||||
RULE_INT(Character, RestRegenRaidTimeToActivate, 300) // Time in seconds for rest state regen to kick in with a raid target.
|
||||
RULE_BOOL(Character, RestRegenEndurance, false) // Whether rest regen will work for endurance or not.
|
||||
RULE_INT(Character, KillsPerGroupLeadershipAA, 250) // Number of dark blues or above per Group Leadership AA
|
||||
RULE_INT(Character, KillsPerRaidLeadershipAA, 250) // Number of dark blues or above per Raid Leadership AA
|
||||
RULE_INT(Character, MaxFearDurationForPlayerCharacter, 4) //4 tics, each tic calculates every 6 seconds.
|
||||
@@ -117,7 +121,8 @@ RULE_BOOL(Character, EnableDiscoveredItems, true) // If enabled, it enables EVEN
|
||||
RULE_BOOL(Character, EnableXTargetting, true) // Enable Extended Targetting Window, for users with UF and later clients.
|
||||
RULE_BOOL(Character, EnableAggroMeter, true) // Enable Aggro Meter, for users with RoF and later clients.
|
||||
RULE_BOOL(Character, KeepLevelOverMax, false) // Don't delevel a character that has somehow gone over the level cap
|
||||
RULE_INT(Character, FoodLossPerUpdate, 35) // How much food/water you lose per stamina update
|
||||
RULE_INT(Character, FoodLossPerUpdate, 32) // How much food/water you lose per stamina update
|
||||
RULE_BOOL(Character, EnableHungerPenalties, false) // being hungry/thirsty has negative effects -- it does appear normal live servers do not have penalties
|
||||
RULE_INT(Character, BaseInstrumentSoftCap, 36) // Softcap for instrument mods, 36 commonly referred to as "3.6" as well.
|
||||
RULE_BOOL(Character, UseSpellFileSongCap, true) // When they removed the AA that increased the cap they removed the above and just use the spell field
|
||||
RULE_INT(Character, BaseRunSpeedCap, 158) // Base Run Speed Cap, on live it's 158% which will give you a runspeed of 1.580 hard capped to 225.
|
||||
@@ -152,6 +157,7 @@ RULE_BOOL(Character, GrantHoTTOnCreate, false) // Grant Health of Target's Targe
|
||||
RULE_BOOL(Character, UseOldConSystem, false) // Grant Health of Target's Target leadership AA on character creation
|
||||
RULE_BOOL(Character, OPClientUpdateVisualDebug, false) // Shows a pulse and forward directional particle each time the client sends its position to server
|
||||
RULE_BOOL(Character, AllowCrossClassTrainers, false)
|
||||
RULE_BOOL(Character, PetsUseReagents, true) //Pets use reagent on spells
|
||||
RULE_CATEGORY_END()
|
||||
|
||||
RULE_CATEGORY(Mercs)
|
||||
@@ -187,12 +193,14 @@ RULE_INT(Skills, MaxTrainSpecializations, 50) // Max level a GM trainer will tra
|
||||
RULE_INT(Skills, SwimmingStartValue, 100)
|
||||
RULE_BOOL(Skills, TrainSenseHeading, false)
|
||||
RULE_INT(Skills, SenseHeadingStartValue, 200)
|
||||
RULE_BOOL(Skills, SelfLanguageLearning, true)
|
||||
RULE_CATEGORY_END()
|
||||
|
||||
RULE_CATEGORY(Pets)
|
||||
RULE_REAL(Pets, AttackCommandRange, 150)
|
||||
RULE_BOOL(Pets, UnTargetableSwarmPet, false)
|
||||
RULE_REAL(Pets, PetPowerLevelCap, 10) // Max number of levels your pet can go up with pet power
|
||||
RULE_BOOL(Pets, CanTakeNoDrop, false) // Can everyone trade nodrop gear to pets
|
||||
RULE_CATEGORY_END()
|
||||
|
||||
RULE_CATEGORY(GM)
|
||||
@@ -227,6 +235,7 @@ RULE_INT(World, TitaniumStartZoneID, -1) //Sets the Starting Zone for Titanium C
|
||||
RULE_INT(World, ExpansionSettings, 16383) // Sets the expansion settings for the server, This is sent on login to world and affects client expansion settings. Defaults to all expansions enabled up to TSS.
|
||||
RULE_BOOL(World, UseClientBasedExpansionSettings, true) // if true it will overrule World, ExpansionSettings and set someone's expansion based on the client they're using
|
||||
RULE_INT(World, PVPSettings, 0) // Sets the PVP settings for the server, 1 = Rallos Zek RuleSet, 2 = Tallon/Vallon Zek Ruleset, 4 = Sullon Zek Ruleset, 6 = Discord Ruleset, anything above 6 is the Discord Ruleset without the no-drop restrictions removed. TODO: Edit IsAttackAllowed in Zone to accomodate for these rules.
|
||||
RULE_INT(World, PVPMinLevel, 0) // minimum level to pvp
|
||||
RULE_BOOL (World, IsGMPetitionWindowEnabled, false)
|
||||
RULE_INT (World, FVNoDropFlag, 0) // Sets the Firiona Vie settings on the client. If set to 2, the flag will be set for GMs only, allowing trading of no-drop items.
|
||||
RULE_BOOL (World, IPLimitDisconnectAll, false)
|
||||
@@ -269,17 +278,10 @@ RULE_INT(Zone, GlobalLootMultiplier, 1) // Sets Global Loot drop multiplier for
|
||||
RULE_CATEGORY_END()
|
||||
|
||||
RULE_CATEGORY(Map)
|
||||
//enable these to help prevent mob hopping when they are pathing
|
||||
RULE_BOOL(Map, FixPathingZWhenLoading, true) //increases zone boot times a bit to reduce hopping.
|
||||
RULE_BOOL(Map, FixPathingZAtWaypoints, false) //alternative to `WhenLoading`, accomplishes the same thing but does it at each waypoint instead of once at boot time.
|
||||
RULE_BOOL(Map, FixPathingZWhenMoving, false) //very CPU intensive, but helps hopping with widely spaced waypoints.
|
||||
RULE_BOOL(Map, FixPathingZOnSendTo, false) //try to repair Z coords in the SendTo routine as well.
|
||||
RULE_BOOL(Map, FixZWhenMoving, true) // Automatically fix NPC Z coordinates when moving/pathing/engaged (Far less CPU intensive than its predecessor)
|
||||
RULE_BOOL(Map, MobZVisualDebug, false) // Displays spell effects determining whether or not NPC is hitting Best Z calcs (blue for hit, red for miss)
|
||||
RULE_REAL(Map, FixPathingZMaxDeltaMoving, 20) //at runtime while pathing: max change in Z to allow the BestZ code to apply.
|
||||
RULE_REAL(Map, FixPathingZMaxDeltaWaypoint, 20) //at runtime at each waypoint: max change in Z to allow the BestZ code to apply.
|
||||
RULE_REAL(Map, FixPathingZMaxDeltaSendTo, 20) //at runtime in SendTo: max change in Z to allow the BestZ code to apply.
|
||||
RULE_REAL(Map, FixPathingZMaxDeltaLoading, 45) //while loading each waypoint: max change in Z to allow the BestZ code to apply.
|
||||
RULE_INT(Map, FindBestZHeightAdjust, 1) // Adds this to the current Z before seeking the best Z position
|
||||
RULE_CATEGORY_END()
|
||||
|
||||
@@ -401,6 +403,7 @@ RULE_BOOL(Spells, IgnoreSpellDmgLvlRestriction, false) // ignore the 5 level spr
|
||||
RULE_BOOL(Spells, AllowItemTGB, false) // TGB doesn't work with items on live, custom servers want it though
|
||||
RULE_BOOL(Spells, NPCInnateProcOverride, true) // NPC innate procs override the target type to single target.
|
||||
RULE_BOOL(Spells, OldRainTargets, false) // use old incorrectly implemented max targets for rains
|
||||
RULE_BOOL(Spells, NPCSpellPush, false) // enable spell push on NPCs
|
||||
RULE_CATEGORY_END()
|
||||
|
||||
RULE_CATEGORY(Combat)
|
||||
@@ -503,6 +506,7 @@ RULE_INT(Combat, NPCAssistCapTimer, 6000) // Time in milliseconds a NPC will tak
|
||||
RULE_BOOL(Combat, UseRevampHandToHand, false) // use h2h revamped dmg/delays I believe this was implemented during SoF
|
||||
RULE_BOOL(Combat, ClassicMasterWu, false) // classic master wu uses a random special, modern doesn't
|
||||
RULE_INT(Combat, LevelToStopDamageCaps, 0) // 1 will effectively disable them, 20 should give basically same results as old incorrect system
|
||||
RULE_BOOL(Combat, ClassicNPCBackstab, false) // true disables npc facestab - npcs get normal attack if not behind
|
||||
RULE_CATEGORY_END()
|
||||
|
||||
RULE_CATEGORY(NPC)
|
||||
@@ -510,7 +514,8 @@ RULE_INT(NPC, MinorNPCCorpseDecayTimeMS, 450000) //level<55
|
||||
RULE_INT(NPC, MajorNPCCorpseDecayTimeMS, 1500000) //level>=55
|
||||
RULE_INT(NPC, CorpseUnlockTimer, 150000)
|
||||
RULE_INT(NPC, EmptyNPCCorpseDecayTimeMS, 0)
|
||||
RULE_BOOL (NPC, UseItemBonusesForNonPets, true)
|
||||
RULE_BOOL(NPC, UseItemBonusesForNonPets, true)
|
||||
RULE_BOOL(NPC, UseBaneDamage, false)
|
||||
RULE_INT(NPC, SayPauseTimeInSec, 5)
|
||||
RULE_INT(NPC, OOCRegen, 0)
|
||||
RULE_BOOL(NPC, BuffFriends, false)
|
||||
@@ -543,6 +548,8 @@ RULE_INT(Aggro, IntAggroThreshold, 75) // Int <= this will aggro regardless of l
|
||||
RULE_BOOL(Aggro, AllowTickPulling, false) // tick pulling is an exploit in an NPC's call for help fixed sometime in 2006 on live
|
||||
RULE_BOOL(Aggro, UseLevelAggro, true) // Level 18+ and Undead will aggro regardless of level difference. (this will disabled Rule:IntAggroThreshold if set to true)
|
||||
RULE_INT(Aggro, ClientAggroCheckInterval, 6) // Interval in which clients actually check for aggro - in seconds
|
||||
RULE_REAL(Aggro, PetAttackRange, 40000.0) // max squared range /pet attack works at default is 200
|
||||
RULE_BOOL(Aggro, NPCAggroMaxDistanceEnabled, true) /* If enabled, NPC's will drop aggro beyond 600 units or what is defined at the zone level */
|
||||
RULE_CATEGORY_END()
|
||||
|
||||
RULE_CATEGORY(TaskSystem)
|
||||
@@ -669,6 +676,12 @@ RULE_CATEGORY_END()
|
||||
RULE_CATEGORY(AA)
|
||||
RULE_INT(AA, ExpPerPoint, 23976503) //Amount of exp per AA. Is the same as the amount of exp to go from level 51 to level 52.
|
||||
RULE_BOOL(AA, Stacking, true) //Allow AA that belong to the same group to stack on SOF+ clients.
|
||||
RULE_BOOL(AA, NormalizedAAEnabled, false) // TSS+ change to AA that normalizes AA XP to a fixed # of white con kills independent of level.
|
||||
RULE_INT(AA, NormalizedAANumberOfWhiteConPerAA, 25) // The number of white con kills per AA point.
|
||||
RULE_BOOL(AA, ModernAAScalingEnabled, false) // Are we linearly scaling AA XP based on total # of earned AA?
|
||||
RULE_REAL(AA, ModernAAScalingStartPercent, 1000) // 1000% or 10x AA XP at the start of the scaling range
|
||||
RULE_INT(AA, ModernAAScalingAAMinimum, 0) // The minimum number of earned AA before AA XP scaling begins.
|
||||
RULE_INT(AA, ModernAAScalingAALimit, 4000) // The number of earned AA when AA XP scaling ends
|
||||
RULE_CATEGORY_END()
|
||||
|
||||
RULE_CATEGORY(Console)
|
||||
@@ -714,6 +727,12 @@ RULE_BOOL(Client, UseLiveFactionMessage, false) // Allows players to see faction
|
||||
RULE_BOOL(Client, UseLiveBlockedMessage, false) // Allows players to see faction adjustments like Live
|
||||
RULE_CATEGORY_END()
|
||||
|
||||
RULE_CATEGORY(Bugs)
|
||||
RULE_BOOL(Bugs, ReportingSystemActive, true) // Activates bug reporting
|
||||
RULE_BOOL(Bugs, UseOldReportingMethod, true) // Forces the use of the old bug reporting system
|
||||
RULE_BOOL(Bugs, DumpTargetEntity, false) // Dumps the target entity, if one is provided
|
||||
RULE_CATEGORY_END()
|
||||
|
||||
#undef RULE_CATEGORY
|
||||
#undef RULE_INT
|
||||
#undef RULE_REAL
|
||||
|
||||
+51
-53
@@ -29,10 +29,10 @@
|
||||
bool EQEmu::saylink::DegenerateLinkBody(SayLinkBody_Struct& say_link_body_struct, const std::string& say_link_body)
|
||||
{
|
||||
memset(&say_link_body_struct, 0, sizeof(say_link_body_struct));
|
||||
if (say_link_body.length() != EQEmu::legacy::TEXT_LINK_BODY_LENGTH)
|
||||
if (say_link_body.length() != EQEmu::constants::SayLinkBodySize)
|
||||
return false;
|
||||
|
||||
say_link_body_struct.unknown_1 = (uint8)strtol(say_link_body.substr(0, 1).c_str(), nullptr, 16);
|
||||
say_link_body_struct.action_id = (uint8)strtol(say_link_body.substr(0, 1).c_str(), nullptr, 16);
|
||||
say_link_body_struct.item_id = (uint32)strtol(say_link_body.substr(1, 5).c_str(), nullptr, 16);
|
||||
say_link_body_struct.augment_1 = (uint32)strtol(say_link_body.substr(6, 5).c_str(), nullptr, 16);
|
||||
say_link_body_struct.augment_2 = (uint32)strtol(say_link_body.substr(11, 5).c_str(), nullptr, 16);
|
||||
@@ -44,7 +44,7 @@ bool EQEmu::saylink::DegenerateLinkBody(SayLinkBody_Struct& say_link_body_struct
|
||||
say_link_body_struct.evolve_group = (uint32)strtol(say_link_body.substr(37, 4).c_str(), nullptr, 16);
|
||||
say_link_body_struct.evolve_level = (uint8)strtol(say_link_body.substr(41, 2).c_str(), nullptr, 16);
|
||||
say_link_body_struct.ornament_icon = (uint32)strtol(say_link_body.substr(43, 5).c_str(), nullptr, 16);
|
||||
say_link_body_struct.hash = (int)strtol(say_link_body.substr(48, 8).c_str(), nullptr, 16);
|
||||
say_link_body_struct.hash = (uint32)strtol(say_link_body.substr(48, 8).c_str(), nullptr, 16);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -53,7 +53,7 @@ bool EQEmu::saylink::GenerateLinkBody(std::string& say_link_body, const SayLinkB
|
||||
{
|
||||
say_link_body = StringFormat(
|
||||
"%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%02X" "%05X" "%08X",
|
||||
(0x0F & say_link_body_struct.unknown_1),
|
||||
(0x0F & say_link_body_struct.action_id),
|
||||
(0x000FFFFF & say_link_body_struct.item_id),
|
||||
(0x000FFFFF & say_link_body_struct.augment_1),
|
||||
(0x000FFFFF & say_link_body_struct.augment_2),
|
||||
@@ -68,7 +68,7 @@ bool EQEmu::saylink::GenerateLinkBody(std::string& say_link_body, const SayLinkB
|
||||
(0xFFFFFFFF & say_link_body_struct.hash)
|
||||
);
|
||||
|
||||
if (say_link_body.length() != EQEmu::legacy::TEXT_LINK_BODY_LENGTH)
|
||||
if (say_link_body.length() != EQEmu::constants::SayLinkBodySize)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@@ -79,7 +79,7 @@ EQEmu::SayLinkEngine::SayLinkEngine()
|
||||
Reset();
|
||||
}
|
||||
|
||||
std::string EQEmu::SayLinkEngine::GenerateLink()
|
||||
const std::string& EQEmu::SayLinkEngine::GenerateLink()
|
||||
{
|
||||
m_Link.clear();
|
||||
m_LinkBody.clear();
|
||||
@@ -88,18 +88,26 @@ std::string EQEmu::SayLinkEngine::GenerateLink()
|
||||
generate_body();
|
||||
generate_text();
|
||||
|
||||
if ((m_LinkBody.length() == EQEmu::legacy::TEXT_LINK_BODY_LENGTH) && (m_LinkText.length() > 0)) {
|
||||
if ((m_LinkBody.length() == EQEmu::constants::SayLinkBodySize) && (m_LinkText.length() > 0)) {
|
||||
m_Link.push_back(0x12);
|
||||
m_Link.append(m_LinkBody);
|
||||
m_Link.append(m_LinkText);
|
||||
m_Link.push_back(0x12);
|
||||
}
|
||||
|
||||
if ((m_Link.length() == 0) || (m_Link.length() > 250)) {
|
||||
if ((m_Link.length() == 0) || (m_Link.length() > (EQEmu::constants::SayLinkMaximumSize))) {
|
||||
m_Error = true;
|
||||
m_Link = "<LINKER ERROR>";
|
||||
Log(Logs::General, Logs::Error, "TextLink::GenerateLink() failed to generate a useable text link (LinkType: %i, Lengths: {link: %u, body: %u, text: %u})",
|
||||
m_LinkType, m_Link.length(), m_LinkBody.length(), m_LinkText.length());
|
||||
Log(Logs::General, Logs::Error, "SayLinkEngine::GenerateLink() failed to generate a useable say link");
|
||||
Log(Logs::General, Logs::Error, ">> LinkType: %i, Lengths: {link: %u(%u), body: %u(%u), text: %u(%u)}",
|
||||
m_LinkType,
|
||||
m_Link.length(),
|
||||
EQEmu::constants::SayLinkMaximumSize,
|
||||
m_LinkBody.length(),
|
||||
EQEmu::constants::SayLinkBodySize,
|
||||
m_LinkText.length(),
|
||||
EQEmu::constants::SayLinkTextSize
|
||||
);
|
||||
Log(Logs::General, Logs::Error, ">> LinkBody: %s", m_LinkBody.c_str());
|
||||
Log(Logs::General, Logs::Error, ">> LinkText: %s", m_LinkText.c_str());
|
||||
}
|
||||
@@ -113,20 +121,10 @@ void EQEmu::SayLinkEngine::Reset()
|
||||
m_ItemData = nullptr;
|
||||
m_LootData = nullptr;
|
||||
m_ItemInst = nullptr;
|
||||
m_Proxy_unknown_1 = 0;
|
||||
m_ProxyItemID = 0;
|
||||
m_ProxyAugment1ID = 0;
|
||||
m_ProxyAugment2ID = 0;
|
||||
m_ProxyAugment3ID = 0;
|
||||
m_ProxyAugment4ID = 0;
|
||||
m_ProxyAugment5ID = 0;
|
||||
m_ProxyAugment6ID = 0;
|
||||
m_ProxyIsEvolving = 0;
|
||||
m_ProxyEvolveGroup = 0;
|
||||
m_ProxyEvolveLevel = 0;
|
||||
m_ProxyOrnamentIcon = 0;
|
||||
m_ProxyHash = 0;
|
||||
m_ProxyText = nullptr;
|
||||
|
||||
memset(&m_LinkBodyStruct, 0, sizeof(SayLinkBody_Struct));
|
||||
memset(&m_LinkProxyStruct, 0, sizeof(SayLinkProxy_Struct));
|
||||
|
||||
m_TaskUse = false;
|
||||
m_Link.clear();
|
||||
m_LinkBody.clear();
|
||||
@@ -194,32 +192,32 @@ void EQEmu::SayLinkEngine::generate_body()
|
||||
break;
|
||||
}
|
||||
|
||||
if (m_Proxy_unknown_1)
|
||||
m_LinkBodyStruct.unknown_1 = m_Proxy_unknown_1;
|
||||
if (m_ProxyItemID)
|
||||
m_LinkBodyStruct.item_id = m_ProxyItemID;
|
||||
if (m_ProxyAugment1ID)
|
||||
m_LinkBodyStruct.augment_1 = m_ProxyAugment1ID;
|
||||
if (m_ProxyAugment2ID)
|
||||
m_LinkBodyStruct.augment_2 = m_ProxyAugment2ID;
|
||||
if (m_ProxyAugment3ID)
|
||||
m_LinkBodyStruct.augment_3 = m_ProxyAugment3ID;
|
||||
if (m_ProxyAugment4ID)
|
||||
m_LinkBodyStruct.augment_4 = m_ProxyAugment4ID;
|
||||
if (m_ProxyAugment5ID)
|
||||
m_LinkBodyStruct.augment_5 = m_ProxyAugment5ID;
|
||||
if (m_ProxyAugment6ID)
|
||||
m_LinkBodyStruct.augment_6 = m_ProxyAugment6ID;
|
||||
if (m_ProxyIsEvolving)
|
||||
m_LinkBodyStruct.is_evolving = m_ProxyIsEvolving;
|
||||
if (m_ProxyEvolveGroup)
|
||||
m_LinkBodyStruct.evolve_group = m_ProxyEvolveGroup;
|
||||
if (m_ProxyEvolveLevel)
|
||||
m_LinkBodyStruct.evolve_level = m_ProxyEvolveLevel;
|
||||
if (m_ProxyOrnamentIcon)
|
||||
m_LinkBodyStruct.ornament_icon = m_ProxyOrnamentIcon;
|
||||
if (m_ProxyHash)
|
||||
m_LinkBodyStruct.hash = m_ProxyHash;
|
||||
if (m_LinkProxyStruct.action_id)
|
||||
m_LinkBodyStruct.action_id = m_LinkProxyStruct.action_id;
|
||||
if (m_LinkProxyStruct.item_id)
|
||||
m_LinkBodyStruct.item_id = m_LinkProxyStruct.item_id;
|
||||
if (m_LinkProxyStruct.augment_1)
|
||||
m_LinkBodyStruct.augment_1 = m_LinkProxyStruct.augment_1;
|
||||
if (m_LinkProxyStruct.augment_2)
|
||||
m_LinkBodyStruct.augment_2 = m_LinkProxyStruct.augment_2;
|
||||
if (m_LinkProxyStruct.augment_3)
|
||||
m_LinkBodyStruct.augment_3 = m_LinkProxyStruct.augment_3;
|
||||
if (m_LinkProxyStruct.augment_4)
|
||||
m_LinkBodyStruct.augment_4 = m_LinkProxyStruct.augment_4;
|
||||
if (m_LinkProxyStruct.augment_5)
|
||||
m_LinkBodyStruct.augment_5 = m_LinkProxyStruct.augment_5;
|
||||
if (m_LinkProxyStruct.augment_6)
|
||||
m_LinkBodyStruct.augment_6 = m_LinkProxyStruct.augment_6;
|
||||
if (m_LinkProxyStruct.is_evolving)
|
||||
m_LinkBodyStruct.is_evolving = m_LinkProxyStruct.is_evolving;
|
||||
if (m_LinkProxyStruct.evolve_group)
|
||||
m_LinkBodyStruct.evolve_group = m_LinkProxyStruct.evolve_group;
|
||||
if (m_LinkProxyStruct.evolve_level)
|
||||
m_LinkBodyStruct.evolve_level = m_LinkProxyStruct.evolve_level;
|
||||
if (m_LinkProxyStruct.ornament_icon)
|
||||
m_LinkBodyStruct.ornament_icon = m_LinkProxyStruct.ornament_icon;
|
||||
if (m_LinkProxyStruct.hash)
|
||||
m_LinkBodyStruct.hash = m_LinkProxyStruct.hash;
|
||||
|
||||
|
||||
if (m_TaskUse)
|
||||
@@ -227,7 +225,7 @@ void EQEmu::SayLinkEngine::generate_body()
|
||||
|
||||
m_LinkBody = StringFormat(
|
||||
"%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%02X" "%05X" "%08X",
|
||||
(0x0F & m_LinkBodyStruct.unknown_1),
|
||||
(0x0F & m_LinkBodyStruct.action_id),
|
||||
(0x000FFFFF & m_LinkBodyStruct.item_id),
|
||||
(0x000FFFFF & m_LinkBodyStruct.augment_1),
|
||||
(0x000FFFFF & m_LinkBodyStruct.augment_2),
|
||||
@@ -245,8 +243,8 @@ void EQEmu::SayLinkEngine::generate_body()
|
||||
|
||||
void EQEmu::SayLinkEngine::generate_text()
|
||||
{
|
||||
if (m_ProxyText != nullptr) {
|
||||
m_LinkText = m_ProxyText;
|
||||
if (m_LinkProxyStruct.text != nullptr) {
|
||||
m_LinkText = m_LinkProxyStruct.text;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+28
-37
@@ -47,7 +47,7 @@ namespace EQEmu
|
||||
} /*saylink*/
|
||||
|
||||
struct SayLinkBody_Struct {
|
||||
uint8 unknown_1; /* %1X */
|
||||
uint8 action_id; /* %1X */
|
||||
uint32 item_id; /* %05X */
|
||||
uint32 augment_1; /* %05X */
|
||||
uint32 augment_2; /* %05X */
|
||||
@@ -56,13 +56,18 @@ namespace EQEmu
|
||||
uint32 augment_5; /* %05X */
|
||||
uint32 augment_6; /* %05X */
|
||||
uint8 is_evolving; /* %1X */
|
||||
uint32 evolve_group; /* %05X */
|
||||
uint32 evolve_group; /* %04X */
|
||||
uint8 evolve_level; /* %02X */
|
||||
uint32 ornament_icon; /* %05X */
|
||||
int hash; /* %08X */
|
||||
uint32 hash; /* %08X */
|
||||
};
|
||||
|
||||
struct SayLinkProxy_Struct : SayLinkBody_Struct {
|
||||
const char* text;
|
||||
};
|
||||
|
||||
class SayLinkEngine {
|
||||
// TODO: consider methods for direct 'saylink' assignments
|
||||
public:
|
||||
SayLinkEngine();
|
||||
|
||||
@@ -72,29 +77,29 @@ namespace EQEmu
|
||||
void SetItemInst(const ItemInstance* item_inst) { m_ItemInst = item_inst; }
|
||||
|
||||
// mainly for saylinks..but, not limited to
|
||||
void SetProxyUnknown1(uint8 proxy_unknown_1) { m_Proxy_unknown_1 = proxy_unknown_1; }
|
||||
void SetProxyItemID(uint32 proxy_item_id) { m_ProxyItemID = proxy_item_id; }
|
||||
void SetProxyAugment1ID(uint32 proxy_augment_id) { m_ProxyAugment1ID = proxy_augment_id; }
|
||||
void SetProxyAugment2ID(uint32 proxy_augment_id) { m_ProxyAugment2ID = proxy_augment_id; }
|
||||
void SetProxyAugment3ID(uint32 proxy_augment_id) { m_ProxyAugment3ID = proxy_augment_id; }
|
||||
void SetProxyAugment4ID(uint32 proxy_augment_id) { m_ProxyAugment4ID = proxy_augment_id; }
|
||||
void SetProxyAugment5ID(uint32 proxy_augment_id) { m_ProxyAugment5ID = proxy_augment_id; }
|
||||
void SetProxyAugment6ID(uint32 proxy_augment_id) { m_ProxyAugment6ID = proxy_augment_id; }
|
||||
void SetProxyIsEvolving(uint8 proxy_is_evolving) { m_ProxyIsEvolving = proxy_is_evolving; }
|
||||
void SetProxyEvolveGroup(uint32 proxy_evolve_group) { m_ProxyEvolveGroup = proxy_evolve_group; }
|
||||
void SetProxyEvolveLevel(uint8 proxy_evolve_level) { m_ProxyEvolveLevel = proxy_evolve_level; }
|
||||
void SetProxyOrnamentIcon(uint32 proxy_ornament_icon) { m_ProxyOrnamentIcon = proxy_ornament_icon; }
|
||||
void SetProxyHash(int proxy_hash) { m_ProxyHash = proxy_hash; }
|
||||
void SetProxyActionID(uint8 proxy_action_id) { m_LinkProxyStruct.action_id = proxy_action_id; } // should always be '0'
|
||||
void SetProxyItemID(uint32 proxy_item_id) { m_LinkProxyStruct.item_id = proxy_item_id; }
|
||||
void SetProxyAugment1ID(uint32 proxy_augment_id) { m_LinkProxyStruct.augment_1 = proxy_augment_id; }
|
||||
void SetProxyAugment2ID(uint32 proxy_augment_id) { m_LinkProxyStruct.augment_2 = proxy_augment_id; }
|
||||
void SetProxyAugment3ID(uint32 proxy_augment_id) { m_LinkProxyStruct.augment_3 = proxy_augment_id; }
|
||||
void SetProxyAugment4ID(uint32 proxy_augment_id) { m_LinkProxyStruct.augment_4 = proxy_augment_id; }
|
||||
void SetProxyAugment5ID(uint32 proxy_augment_id) { m_LinkProxyStruct.augment_5 = proxy_augment_id; }
|
||||
void SetProxyAugment6ID(uint32 proxy_augment_id) { m_LinkProxyStruct.augment_6 = proxy_augment_id; }
|
||||
void SetProxyIsEvolving(uint8 proxy_is_evolving) { m_LinkProxyStruct.is_evolving = proxy_is_evolving; }
|
||||
void SetProxyEvolveGroup(uint32 proxy_evolve_group) { m_LinkProxyStruct.evolve_group = proxy_evolve_group; }
|
||||
void SetProxyEvolveLevel(uint8 proxy_evolve_level) { m_LinkProxyStruct.evolve_level = proxy_evolve_level; }
|
||||
void SetProxyOrnamentIcon(uint32 proxy_ornament_icon) { m_LinkProxyStruct.ornament_icon = proxy_ornament_icon; }
|
||||
void SetProxyHash(uint32 proxy_hash) { m_LinkProxyStruct.hash = proxy_hash; }
|
||||
|
||||
void SetProxyText(const char* proxy_text) { m_ProxyText = proxy_text; } // overrides standard text use
|
||||
void SetProxyText(const char* proxy_text) { m_LinkProxyStruct.text = proxy_text; } // overrides standard text use
|
||||
void SetTaskUse() { m_TaskUse = true; }
|
||||
|
||||
std::string GenerateLink();
|
||||
const std::string& GenerateLink();
|
||||
bool LinkError() { return m_Error; }
|
||||
|
||||
std::string Link() { return m_Link; } // contains full string format: '/12x' '<LinkBody>' '<LinkText>' '/12x'
|
||||
std::string LinkBody() { return m_LinkBody; } // contains string format: '<LinkBody>'
|
||||
std::string LinkText() { return m_LinkText; } // contains string format: '<LinkText>'
|
||||
const std::string& Link() { return m_Link; } // contains full string format: '\x12' '<LinkBody>' '<LinkText>' '\x12'
|
||||
const std::string& LinkBody() { return m_LinkBody; } // contains string format: '<LinkBody>'
|
||||
const std::string& LinkText() { return m_LinkText; } // contains string format: '<LinkText>'
|
||||
|
||||
void Reset();
|
||||
|
||||
@@ -106,23 +111,9 @@ namespace EQEmu
|
||||
const ItemData* m_ItemData;
|
||||
const ServerLootItem_Struct* m_LootData;
|
||||
const ItemInstance* m_ItemInst;
|
||||
|
||||
uint8 m_Proxy_unknown_1;
|
||||
uint32 m_ProxyItemID;
|
||||
uint32 m_ProxyAugment1ID;
|
||||
uint32 m_ProxyAugment2ID;
|
||||
uint32 m_ProxyAugment3ID;
|
||||
uint32 m_ProxyAugment4ID;
|
||||
uint32 m_ProxyAugment5ID;
|
||||
uint32 m_ProxyAugment6ID;
|
||||
uint8 m_ProxyIsEvolving;
|
||||
uint32 m_ProxyEvolveGroup;
|
||||
uint8 m_ProxyEvolveLevel;
|
||||
uint32 m_ProxyOrnamentIcon;
|
||||
int m_ProxyHash;
|
||||
const char* m_ProxyText;
|
||||
bool m_TaskUse;
|
||||
SayLinkBody_Struct m_LinkBodyStruct;
|
||||
SayLinkProxy_Struct m_LinkProxyStruct;
|
||||
bool m_TaskUse;
|
||||
std::string m_Link;
|
||||
std::string m_LinkBody;
|
||||
std::string m_LinkText;
|
||||
|
||||
@@ -190,6 +190,8 @@
|
||||
#define ServerOP_ReloadLogs 0x4010
|
||||
#define ServerOP_ReloadPerlExportSettings 0x4011
|
||||
#define ServerOP_CZSetEntityVariableByClientName 0x4012
|
||||
#define ServerOP_UCSServerStatusRequest 0x4013
|
||||
#define ServerOP_UCSServerStatusReply 0x4014
|
||||
/* Query Server OP Codes */
|
||||
#define ServerOP_QSPlayerLogTrades 0x5010
|
||||
#define ServerOP_QSPlayerLogHandins 0x5011
|
||||
@@ -1278,6 +1280,17 @@ struct ServerRequestTellQueue_Struct {
|
||||
char name[64];
|
||||
};
|
||||
|
||||
struct UCSServerStatus_Struct {
|
||||
uint8 available; // non-zero=true, 0=false
|
||||
union {
|
||||
struct {
|
||||
uint16 port;
|
||||
uint16 unused;
|
||||
};
|
||||
uint32 timestamp;
|
||||
};
|
||||
};
|
||||
|
||||
#pragma pack()
|
||||
|
||||
#endif
|
||||
|
||||
+37
-2
@@ -110,6 +110,41 @@ uint32 SharedDatabase::GetTotalTimeEntitledOnAccount(uint32 AccountID) {
|
||||
return EntitledTime;
|
||||
}
|
||||
|
||||
void SharedDatabase::SetMailKey(int CharID, int IPAddress, int MailKey)
|
||||
{
|
||||
char MailKeyString[17];
|
||||
|
||||
if (RuleB(Chat, EnableMailKeyIPVerification) == true)
|
||||
sprintf(MailKeyString, "%08X%08X", IPAddress, MailKey);
|
||||
else
|
||||
sprintf(MailKeyString, "%08X", MailKey);
|
||||
|
||||
std::string query = StringFormat("UPDATE character_data SET mailkey = '%s' WHERE id = '%i'",
|
||||
MailKeyString, CharID);
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
Log(Logs::General, Logs::Error, "SharedDatabase::SetMailKey(%i, %s) : %s", CharID, MailKeyString, results.ErrorMessage().c_str());
|
||||
|
||||
}
|
||||
|
||||
std::string SharedDatabase::GetMailKey(int CharID, bool key_only)
|
||||
{
|
||||
std::string query = StringFormat("SELECT `mailkey` FROM `character_data` WHERE `id`='%i' LIMIT 1", CharID);
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
Log(Logs::Detail, Logs::MySQLError, "Error retrieving mailkey from database: %s", results.ErrorMessage().c_str());
|
||||
return std::string();
|
||||
}
|
||||
|
||||
auto row = results.begin();
|
||||
std::string mail_key = row[0];
|
||||
|
||||
if (mail_key.length() > 8 && key_only)
|
||||
return mail_key.substr(8);
|
||||
else
|
||||
return mail_key;
|
||||
}
|
||||
|
||||
bool SharedDatabase::SaveCursor(uint32 char_id, std::list<EQEmu::ItemInstance*>::const_iterator &start, std::list<EQEmu::ItemInstance*>::const_iterator &end)
|
||||
{
|
||||
// Delete cursor items
|
||||
@@ -1817,8 +1852,8 @@ void SharedDatabase::LoadBaseData(void *data, int max_level) {
|
||||
bd->base_hp = atof(row[2]);
|
||||
bd->base_mana = atof(row[3]);
|
||||
bd->base_end = atof(row[4]);
|
||||
bd->unk1 = atof(row[5]);
|
||||
bd->unk2 = atof(row[6]);
|
||||
bd->hp_regen = atof(row[5]);
|
||||
bd->end_regen = atof(row[6]);
|
||||
bd->hp_factor = atof(row[7]);
|
||||
bd->mana_factor = atof(row[8]);
|
||||
bd->endurance_factor = atof(row[9]);
|
||||
|
||||
@@ -72,6 +72,8 @@ class SharedDatabase : public Database
|
||||
void SaveCharacterInspectMessage(uint32 character_id, const InspectMessage_Struct* message);
|
||||
bool GetCommandSettings(std::map<std::string, std::pair<uint8, std::vector<std::string>>> &command_settings);
|
||||
uint32 GetTotalTimeEntitledOnAccount(uint32 AccountID);
|
||||
void SetMailKey(int CharID, int IPAddress, int MailKey);
|
||||
std::string GetMailKey(int CharID, bool key_only = false);
|
||||
|
||||
/*
|
||||
Character InventoryProfile
|
||||
|
||||
+1
-2
@@ -244,8 +244,7 @@ bool IsBeneficialSpell(uint16 spell_id)
|
||||
} else {
|
||||
// If the resisttype is not magic and spell is Bind Sight or Cast Sight
|
||||
// It's not beneficial
|
||||
if (sai == SAI_Dispell_Sight && spells[spell_id].skill == 18 &&
|
||||
!IsEffectInSpell(spell_id, SE_VoiceGraft))
|
||||
if ((sai == SAI_Calm && IsEffectInSpell(spell_id, SE_Harmony)) || (sai == SAI_Calm_Song && IsEffectInSpell(spell_id, SE_BindSight)) || (sai == SAI_Dispell_Sight && spells[spell_id].skill == 18 && !IsEffectInSpell(spell_id, SE_VoiceGraft)))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
+7
-1
@@ -73,6 +73,8 @@ enum SpellTypes : uint32
|
||||
SpellTypes_Detrimental = (SpellType_Nuke | SpellType_Root | SpellType_Lifetap | SpellType_Snare | SpellType_DOT | SpellType_Dispel | SpellType_Mez | SpellType_Charm | SpellType_Debuff | SpellType_Slow),
|
||||
SpellTypes_Beneficial = (SpellType_Heal | SpellType_Buff | SpellType_Escape | SpellType_Pet | SpellType_InCombatBuff | SpellType_Cure | SpellType_HateRedux | SpellType_InCombatBuffSong | SpellType_OutOfCombatBuffSong | SpellType_PreCombatBuff | SpellType_PreCombatBuffSong),
|
||||
|
||||
SpellTypes_Innate = (SpellType_Nuke | SpellType_Lifetap | SpellType_DOT | SpellType_Dispel | SpellType_Mez | SpellType_Slow | SpellType_Debuff | SpellType_Charm | SpellType_Root),
|
||||
|
||||
SpellType_Any = 0xFFFFFFFF
|
||||
};
|
||||
|
||||
@@ -131,6 +133,11 @@ enum SpellAffectIndex {
|
||||
SAI_NPC_Special_80 = 80,
|
||||
SAI_Trap_Lock = 88
|
||||
};
|
||||
|
||||
enum class GlobalGroup {
|
||||
Lich = 46,
|
||||
};
|
||||
|
||||
enum RESISTTYPE
|
||||
{
|
||||
RESIST_NONE = 0,
|
||||
@@ -965,7 +972,6 @@ bool IsCastWhileInvis(uint16 spell_id);
|
||||
bool IsEffectIgnoredInStacking(int spa);
|
||||
|
||||
int CalcPetHp(int levelb, int classb, int STA = 75);
|
||||
const char *GetRandPetName();
|
||||
int GetSpellEffectDescNum(uint16 spell_id);
|
||||
DmgShieldType GetDamageShieldType(uint16 spell_id, int32 DSType = 0);
|
||||
bool DetrimentalSpellAllowsRest(uint16 spell_id);
|
||||
|
||||
+2
-3
@@ -131,12 +131,11 @@ void Timer::SetTimer(uint32 set_timer_time) {
|
||||
|
||||
uint32 Timer::GetRemainingTime() {
|
||||
if (enabled) {
|
||||
if (current_time-start_time > timer_time)
|
||||
if (current_time - start_time > timer_time)
|
||||
return 0;
|
||||
else
|
||||
return (start_time + timer_time) - current_time;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return 0xFFFFFFFF;
|
||||
}
|
||||
}
|
||||
|
||||
+5
-1
@@ -6,6 +6,10 @@
|
||||
#include <EXTERN.h>
|
||||
#define WIN32IO_IS_STDIO
|
||||
|
||||
// header to detect if libc++ is the std lib
|
||||
// this doesn't do shit for C++ but libc++ and GCC 6.1+ use it to define some macros
|
||||
#include <ciso646>
|
||||
|
||||
#ifndef WIN32
|
||||
extern "C" { //the perl headers dont do this for us...
|
||||
#endif
|
||||
@@ -47,7 +51,7 @@ extern "C" { //the perl headers dont do this for us...
|
||||
#endif
|
||||
|
||||
//These need to be cleaned up on FreeBSD
|
||||
#ifdef __FreeBSD__
|
||||
#if defined(__FreeBSD__) || defined(_LIBCPP_VERSION)
|
||||
#ifdef do_open
|
||||
#undef do_open
|
||||
#endif
|
||||
|
||||
+2
-2
@@ -30,9 +30,9 @@
|
||||
Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt
|
||||
*/
|
||||
|
||||
#define CURRENT_BINARY_DATABASE_VERSION 9114
|
||||
#define CURRENT_BINARY_DATABASE_VERSION 9122
|
||||
#ifdef BOTS
|
||||
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9017
|
||||
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9019
|
||||
#else
|
||||
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 0 // must be 0
|
||||
#endif
|
||||
|
||||
@@ -1886,6 +1886,8 @@ FMT_DEFINE_INT_FORMATTERS(unsigned long)
|
||||
FMT_DEFINE_INT_FORMATTERS(LongLong)
|
||||
FMT_DEFINE_INT_FORMATTERS(ULongLong)
|
||||
|
||||
#define CHAR_WIDTH 1
|
||||
|
||||
/**
|
||||
\rst
|
||||
Returns a string formatter that pads the formatted argument with the fill
|
||||
|
||||
@@ -1096,7 +1096,9 @@ dtStatus dtNavMeshQuery::findPath(dtPolyRef startRef, dtPolyRef endRef,
|
||||
// The API input has been cheked already, skip checking internal data.
|
||||
const dtMeshTile* neighbourTile = 0;
|
||||
const dtPoly* neighbourPoly = 0;
|
||||
m_nav->getTileAndPolyByRefUnsafe(neighbourRef, &neighbourTile, &neighbourPoly);
|
||||
if (m_nav->getTileAndPolyByRef(neighbourRef, &neighbourTile, &neighbourPoly) == DT_FAILURE) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!filter->passFilter(neighbourRef, neighbourTile, neighbourPoly))
|
||||
continue;
|
||||
|
||||
@@ -36,7 +36,7 @@ DatabaseMySQL::DatabaseMySQL(std::string user, std::string pass, std::string hos
|
||||
database = mysql_init(nullptr);
|
||||
if (database)
|
||||
{
|
||||
my_bool r = 1;
|
||||
char r = 1;
|
||||
mysql_options(database, MYSQL_OPT_RECONNECT, &r);
|
||||
if (!mysql_real_connect(database, host.c_str(), user.c_str(), pass.c_str(), name.c_str(), atoi(port.c_str()), nullptr, 0))
|
||||
{
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
|
||||
|
||||
SET(lb_sources
|
||||
src/class.cpp
|
||||
src/class_info.cpp
|
||||
src/class_registry.cpp
|
||||
src/class_rep.cpp
|
||||
src/create_class.cpp
|
||||
src/error.cpp
|
||||
src/exception_handler.cpp
|
||||
src/function.cpp
|
||||
src/inheritance.cpp
|
||||
src/link_compatibility.cpp
|
||||
src/object_rep.cpp
|
||||
src/open.cpp
|
||||
src/pcall.cpp
|
||||
src/scope.cpp
|
||||
src/stack_content_by_name.cpp
|
||||
src/weak_ref.cpp
|
||||
src/wrapper_base.cpp
|
||||
)
|
||||
|
||||
SET(lb_headers
|
||||
|
||||
)
|
||||
|
||||
ADD_LIBRARY(luabind ${lb_sources} ${lb_headers})
|
||||
|
||||
|
||||
IF(UNIX)
|
||||
ADD_DEFINITIONS(-fPIC)
|
||||
set_source_files_properties(${lb_sources} PROPERTY COMPILE_FLAGS -Wno-deprecated-declarations)
|
||||
ENDIF(UNIX)
|
||||
|
||||
IF(MSVC)
|
||||
set_source_files_properties(${lb_sources} PROPERTY COMPILE_FLAGS " /W0 " )
|
||||
ENDIF(MSVC)
|
||||
|
||||
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
|
||||
@@ -1,142 +0,0 @@
|
||||
// Copyright (c) 2003 Daniel Wallin and Arvid Norberg
|
||||
|
||||
// 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.
|
||||
|
||||
|
||||
#ifndef LUABIND_ADOPT_POLICY_HPP_INCLUDED
|
||||
#define LUABIND_ADOPT_POLICY_HPP_INCLUDED
|
||||
|
||||
#include <luabind/config.hpp>
|
||||
#include <luabind/wrapper_base.hpp>
|
||||
#include <luabind/detail/policy.hpp>
|
||||
#include <luabind/back_reference_fwd.hpp>
|
||||
#include <luabind/wrapper_base.hpp>
|
||||
#include <boost/type_traits/is_polymorphic.hpp>
|
||||
|
||||
namespace luabind { namespace detail
|
||||
{
|
||||
template <class T>
|
||||
void adjust_backref_ownership(T* ptr, mpl::true_)
|
||||
{
|
||||
if (wrap_base* p = dynamic_cast<wrap_base*>(ptr))
|
||||
{
|
||||
wrapped_self_t& wrapper = wrap_access::ref(*p);
|
||||
wrapper.get(wrapper.state());
|
||||
wrapper.m_strong_ref.set(wrapper.state());
|
||||
}
|
||||
}
|
||||
|
||||
inline void adjust_backref_ownership(void*, mpl::false_)
|
||||
{}
|
||||
|
||||
template<class Direction = lua_to_cpp>
|
||||
struct adopt_pointer : pointer_converter
|
||||
{
|
||||
typedef adopt_pointer type;
|
||||
|
||||
int const consumed_args(...)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
T* apply(lua_State* L, by_pointer<T>, int index)
|
||||
{
|
||||
T* ptr = pointer_converter::apply(
|
||||
L, LUABIND_DECORATE_TYPE(T*), index);
|
||||
|
||||
object_rep* obj = static_cast<object_rep*>(
|
||||
lua_touserdata(L, index));
|
||||
obj->release();
|
||||
|
||||
adjust_backref_ownership(ptr, boost::is_polymorphic<T>());
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
int match(lua_State* L, by_pointer<T>, int index)
|
||||
{
|
||||
return pointer_converter::match(
|
||||
L, LUABIND_DECORATE_TYPE(T*), index);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void converter_postcall(lua_State*, T, int) {}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct adopt_pointer<cpp_to_lua>
|
||||
{
|
||||
typedef adopt_pointer type;
|
||||
|
||||
template<class T>
|
||||
void apply(lua_State* L, T* ptr)
|
||||
{
|
||||
if (ptr == 0)
|
||||
{
|
||||
lua_pushnil(L);
|
||||
return;
|
||||
}
|
||||
|
||||
// if there is a back_reference, then the
|
||||
// ownership will be removed from the
|
||||
// back reference and put on the lua stack.
|
||||
if (luabind::move_back_reference(L, ptr))
|
||||
return;
|
||||
|
||||
make_instance(L, std::auto_ptr<T>(ptr));
|
||||
}
|
||||
};
|
||||
|
||||
template<int N>
|
||||
// struct adopt_policy : converter_policy_tag
|
||||
struct adopt_policy : conversion_policy<N>
|
||||
{
|
||||
// BOOST_STATIC_CONSTANT(int, index = N);
|
||||
|
||||
static void precall(lua_State*, const index_map&) {}
|
||||
static void postcall(lua_State*, const index_map&) {}
|
||||
|
||||
struct only_accepts_nonconst_pointers {};
|
||||
|
||||
template<class T, class Direction>
|
||||
struct apply
|
||||
{
|
||||
typedef luabind::detail::is_nonconst_pointer<T> is_nonconst_p;
|
||||
typedef typename boost::mpl::if_<is_nonconst_p, adopt_pointer<Direction>, only_accepts_nonconst_pointers>::type type;
|
||||
};
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
namespace luabind
|
||||
{
|
||||
template<int N>
|
||||
detail::policy_cons<detail::adopt_policy<N>, detail::null_type>
|
||||
adopt(LUABIND_PLACEHOLDER_ARG(N))
|
||||
{
|
||||
return detail::policy_cons<detail::adopt_policy<N>, detail::null_type>();
|
||||
}
|
||||
}
|
||||
|
||||
#endif // LUABIND_ADOPT_POLICY_HPP_INCLUDE
|
||||
|
||||
@@ -1,112 +0,0 @@
|
||||
// Copyright (c) 2004 Daniel Wallin and Arvid Norberg
|
||||
|
||||
// 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.
|
||||
|
||||
#ifndef LUABIND_BACK_REFERENCE_040510_HPP
|
||||
#define LUABIND_BACK_REFERENCE_040510_HPP
|
||||
|
||||
#include <luabind/lua_include.hpp>
|
||||
#include <luabind/wrapper_base.hpp>
|
||||
#include <luabind/detail/has_get_pointer.hpp>
|
||||
#include <luabind/get_pointer.hpp>
|
||||
#include <boost/type_traits/is_polymorphic.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
|
||||
namespace luabind {
|
||||
|
||||
namespace detail
|
||||
{
|
||||
namespace mpl = boost::mpl;
|
||||
|
||||
template<class T>
|
||||
wrap_base const* get_back_reference_aux0(T const* p, mpl::true_)
|
||||
{
|
||||
return dynamic_cast<wrap_base const*>(p);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
wrap_base const* get_back_reference_aux0(T const*, mpl::false_)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
wrap_base const* get_back_reference_aux1(T const* p)
|
||||
{
|
||||
return get_back_reference_aux0(p, boost::is_polymorphic<T>());
|
||||
}
|
||||
|
||||
template<class T>
|
||||
wrap_base const* get_back_reference_aux2(T const& x, mpl::true_)
|
||||
{
|
||||
return get_back_reference_aux1(get_pointer(x));
|
||||
}
|
||||
|
||||
template<class T>
|
||||
wrap_base const* get_back_reference_aux2(T const& x, mpl::false_)
|
||||
{
|
||||
return get_back_reference_aux1(&x);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
wrap_base const* get_back_reference(T const& x)
|
||||
{
|
||||
return detail::get_back_reference_aux2(
|
||||
x
|
||||
, has_get_pointer<T>()
|
||||
);
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template<class T>
|
||||
bool get_back_reference(lua_State* L, T const& x)
|
||||
{
|
||||
#ifndef LUABIND_NO_RTTI
|
||||
if (wrap_base const* w = detail::get_back_reference(x))
|
||||
{
|
||||
detail::wrap_access::ref(*w).get(L);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
bool move_back_reference(lua_State* L, T const& x)
|
||||
{
|
||||
#ifndef LUABIND_NO_RTTI
|
||||
if (wrap_base* w = const_cast<wrap_base*>(detail::get_back_reference(x)))
|
||||
{
|
||||
assert(detail::wrap_access::ref(*w).m_strong_ref.is_valid());
|
||||
detail::wrap_access::ref(*w).get(L);
|
||||
detail::wrap_access::ref(*w).m_strong_ref.reset();
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace luabind
|
||||
|
||||
#endif // LUABIND_BACK_REFERENCE_040510_HPP
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
// Copyright (c) 2004 Daniel Wallin and Arvid Norberg
|
||||
|
||||
// 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.
|
||||
|
||||
#ifndef LUABIND_BACK_REFERENCE_FWD_040510_HPP
|
||||
#define LUABIND_BACK_REFERENCE_FWD_040510_HPP
|
||||
|
||||
namespace luabind {
|
||||
|
||||
template<class T>
|
||||
bool get_back_reference(lua_State* L, T const& x);
|
||||
|
||||
template<class T>
|
||||
bool move_back_reference(lua_State* L, T const& x);
|
||||
|
||||
} // namespace luabind
|
||||
|
||||
#endif // LUABIND_BACK_REFERENCE_FWD_040510_HPP
|
||||
|
||||
@@ -1,879 +0,0 @@
|
||||
// Copyright (c) 2003 Daniel Wallin and Arvid Norberg
|
||||
|
||||
// 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.
|
||||
|
||||
|
||||
#ifndef LUABIND_CLASS_HPP_INCLUDED
|
||||
#define LUABIND_CLASS_HPP_INCLUDED
|
||||
|
||||
/*
|
||||
ISSUES:
|
||||
------------------------------------------------------
|
||||
|
||||
* solved for member functions, not application operator *
|
||||
if we have a base class that defines a function a derived class must be able to
|
||||
override that function (not just overload). Right now we just add the other overload
|
||||
to the overloads list and will probably get an ambiguity. If we want to support this
|
||||
each method_rep must include a vector of type_info pointers for each parameter.
|
||||
Operators do not have this problem, since operators always have to have
|
||||
it's own type as one of the arguments, no ambiguity can occur. Application
|
||||
operator, on the other hand, would have this problem.
|
||||
Properties cannot be overloaded, so they should always be overridden.
|
||||
If this is to work for application operator, we really need to specify if an application
|
||||
operator is const or not.
|
||||
|
||||
If one class registers two functions with the same name and the same
|
||||
signature, there's currently no error. The last registered function will
|
||||
be the one that's used.
|
||||
How do we know which class registered the function? If the function was
|
||||
defined by the base class, it is a legal operation, to override it.
|
||||
we cannot look at the pointer offset, since it always will be zero for one of the bases.
|
||||
|
||||
|
||||
|
||||
TODO:
|
||||
------------------------------------------------------
|
||||
|
||||
finish smart pointer support
|
||||
* the adopt policy should not be able to adopt pointers to held_types. This
|
||||
must be prohibited.
|
||||
* name_of_type must recognize holder_types and not return "custom"
|
||||
|
||||
document custom policies, custom converters
|
||||
|
||||
store the instance object for policies.
|
||||
|
||||
support the __concat metamethod. This is a bit tricky, since it cannot be
|
||||
treated as a normal operator. It is a binary operator but we want to use the
|
||||
__tostring implementation for both arguments.
|
||||
|
||||
*/
|
||||
|
||||
#include <luabind/prefix.hpp>
|
||||
#include <luabind/config.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <cassert>
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
|
||||
#include <boost/preprocessor/repetition/repeat.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/is_member_object_pointer.hpp>
|
||||
#include <boost/mpl/apply.hpp>
|
||||
#include <boost/mpl/lambda.hpp>
|
||||
#include <boost/mpl/logical.hpp>
|
||||
#include <boost/mpl/find_if.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/logical.hpp>
|
||||
|
||||
#include <luabind/config.hpp>
|
||||
#include <luabind/scope.hpp>
|
||||
#include <luabind/back_reference.hpp>
|
||||
#include <luabind/function.hpp>
|
||||
#include <luabind/dependency_policy.hpp>
|
||||
#include <luabind/detail/constructor.hpp>
|
||||
#include <luabind/detail/call.hpp>
|
||||
#include <luabind/detail/deduce_signature.hpp>
|
||||
#include <luabind/detail/compute_score.hpp>
|
||||
#include <luabind/detail/primitives.hpp>
|
||||
#include <luabind/detail/property.hpp>
|
||||
#include <luabind/detail/typetraits.hpp>
|
||||
#include <luabind/detail/class_rep.hpp>
|
||||
#include <luabind/detail/call.hpp>
|
||||
#include <luabind/detail/object_rep.hpp>
|
||||
#include <luabind/detail/calc_arity.hpp>
|
||||
#include <luabind/detail/call_member.hpp>
|
||||
#include <luabind/detail/enum_maker.hpp>
|
||||
#include <luabind/detail/operator_id.hpp>
|
||||
#include <luabind/detail/pointee_typeid.hpp>
|
||||
#include <luabind/detail/link_compatibility.hpp>
|
||||
#include <luabind/detail/inheritance.hpp>
|
||||
#include <luabind/typeid.hpp>
|
||||
|
||||
// to remove the 'this' used in initialization list-warning
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4355)
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
template <class T> class shared_ptr;
|
||||
|
||||
} // namespace boost
|
||||
|
||||
namespace luabind
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
struct unspecified {};
|
||||
|
||||
template<class Derived> struct operator_;
|
||||
|
||||
struct you_need_to_define_a_get_const_holder_function_for_your_smart_ptr {};
|
||||
}
|
||||
|
||||
template<class T, class X1 = detail::unspecified, class X2 = detail::unspecified, class X3 = detail::unspecified>
|
||||
struct class_;
|
||||
|
||||
// TODO: this function will only be invoked if the user hasn't defined a correct overload
|
||||
// maybe we should have a static assert in here?
|
||||
inline detail::you_need_to_define_a_get_const_holder_function_for_your_smart_ptr*
|
||||
get_const_holder(...)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
boost::shared_ptr<T const>* get_const_holder(boost::shared_ptr<T>*)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <
|
||||
BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
|
||||
LUABIND_MAX_BASES, class A, detail::null_type)
|
||||
>
|
||||
struct bases
|
||||
{};
|
||||
|
||||
typedef bases<detail::null_type> no_bases;
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template <class T>
|
||||
struct is_bases
|
||||
: mpl::false_
|
||||
{};
|
||||
|
||||
template <BOOST_PP_ENUM_PARAMS(LUABIND_MAX_BASES, class A)>
|
||||
struct is_bases<bases<BOOST_PP_ENUM_PARAMS(LUABIND_MAX_BASES, A)> >
|
||||
: mpl::true_
|
||||
{};
|
||||
|
||||
template <class T, class P>
|
||||
struct is_unspecified
|
||||
: mpl::apply1<P, T>
|
||||
{};
|
||||
|
||||
template <class P>
|
||||
struct is_unspecified<unspecified, P>
|
||||
: mpl::true_
|
||||
{};
|
||||
|
||||
template <class P>
|
||||
struct is_unspecified_mfn
|
||||
{
|
||||
template <class T>
|
||||
struct apply
|
||||
: is_unspecified<T, P>
|
||||
{};
|
||||
};
|
||||
|
||||
template<class Predicate>
|
||||
struct get_predicate
|
||||
{
|
||||
typedef mpl::protect<is_unspecified_mfn<Predicate> > type;
|
||||
};
|
||||
|
||||
template <class Result, class Default>
|
||||
struct result_or_default
|
||||
{
|
||||
typedef Result type;
|
||||
};
|
||||
|
||||
template <class Default>
|
||||
struct result_or_default<unspecified, Default>
|
||||
{
|
||||
typedef Default type;
|
||||
};
|
||||
|
||||
template<class Parameters, class Predicate, class DefaultValue>
|
||||
struct extract_parameter
|
||||
{
|
||||
typedef typename get_predicate<Predicate>::type pred;
|
||||
typedef typename boost::mpl::find_if<Parameters, pred>::type iterator;
|
||||
typedef typename result_or_default<
|
||||
typename iterator::type, DefaultValue
|
||||
>::type type;
|
||||
};
|
||||
|
||||
// prints the types of the values on the stack, in the
|
||||
// range [start_index, lua_gettop()]
|
||||
|
||||
LUABIND_API std::string stack_content_by_name(lua_State* L, int start_index);
|
||||
|
||||
struct LUABIND_API create_class
|
||||
{
|
||||
static int stage1(lua_State* L);
|
||||
static int stage2(lua_State* L);
|
||||
};
|
||||
|
||||
} // detail
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<class T>
|
||||
struct static_scope
|
||||
{
|
||||
static_scope(T& self_) : self(self_)
|
||||
{
|
||||
}
|
||||
|
||||
T& operator[](scope s) const
|
||||
{
|
||||
self.add_inner_scope(s);
|
||||
return self;
|
||||
}
|
||||
|
||||
private:
|
||||
template<class U> void operator,(U const&) const;
|
||||
void operator=(static_scope const&);
|
||||
|
||||
T& self;
|
||||
};
|
||||
|
||||
struct class_registration;
|
||||
|
||||
struct LUABIND_API class_base : scope
|
||||
{
|
||||
public:
|
||||
class_base(char const* name);
|
||||
|
||||
struct base_desc
|
||||
{
|
||||
type_id type;
|
||||
int ptr_offset;
|
||||
};
|
||||
|
||||
void init(
|
||||
type_id const& type, class_id id
|
||||
, type_id const& wrapped_type, class_id wrapper_id);
|
||||
|
||||
void add_base(type_id const& base, cast_function cast);
|
||||
|
||||
void add_member(registration* member);
|
||||
void add_default_member(registration* member);
|
||||
|
||||
const char* name() const;
|
||||
|
||||
void add_static_constant(const char* name, int val);
|
||||
void add_inner_scope(scope& s);
|
||||
|
||||
void add_cast(class_id src, class_id target, cast_function cast);
|
||||
|
||||
private:
|
||||
class_registration* m_registration;
|
||||
};
|
||||
|
||||
// MSVC complains about member being sensitive to alignment (C4121)
|
||||
// when F is a pointer to member of a class with virtual bases.
|
||||
# ifdef BOOST_MSVC
|
||||
# pragma pack(push)
|
||||
# pragma pack(16)
|
||||
# endif
|
||||
|
||||
template <class Class, class F, class Policies>
|
||||
struct memfun_registration : registration
|
||||
{
|
||||
memfun_registration(char const* name, F f, Policies const& policies)
|
||||
: name(name)
|
||||
, f(f)
|
||||
, policies(policies)
|
||||
{}
|
||||
|
||||
void register_(lua_State* L) const
|
||||
{
|
||||
object fn = make_function(
|
||||
L, f, deduce_signature(f, (Class*)0), policies);
|
||||
|
||||
add_overload(
|
||||
object(from_stack(L, -1))
|
||||
, name
|
||||
, fn
|
||||
);
|
||||
}
|
||||
|
||||
char const* name;
|
||||
F f;
|
||||
Policies policies;
|
||||
};
|
||||
|
||||
# ifdef BOOST_MSVC
|
||||
# pragma pack(pop)
|
||||
# endif
|
||||
|
||||
template <class P, class T>
|
||||
struct default_pointer
|
||||
{
|
||||
typedef P type;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct default_pointer<null_type, T>
|
||||
{
|
||||
typedef std::auto_ptr<T> type;
|
||||
};
|
||||
|
||||
template <class Class, class Pointer, class Signature, class Policies>
|
||||
struct constructor_registration : registration
|
||||
{
|
||||
constructor_registration(Policies const& policies)
|
||||
: policies(policies)
|
||||
{}
|
||||
|
||||
void register_(lua_State* L) const
|
||||
{
|
||||
typedef typename default_pointer<Pointer, Class>::type pointer;
|
||||
|
||||
object fn = make_function(
|
||||
L
|
||||
, construct<Class, pointer, Signature>(), Signature()
|
||||
, policies
|
||||
);
|
||||
|
||||
add_overload(
|
||||
object(from_stack(L, -1))
|
||||
, "__init"
|
||||
, fn
|
||||
);
|
||||
}
|
||||
|
||||
Policies policies;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct reference_result
|
||||
: mpl::if_<
|
||||
mpl::or_<boost::is_pointer<T>, is_primitive<T> >
|
||||
, T
|
||||
, typename boost::add_reference<T>::type
|
||||
>
|
||||
{};
|
||||
|
||||
template <class T, class Policies>
|
||||
struct inject_dependency_policy
|
||||
: mpl::if_<
|
||||
is_primitive<T>
|
||||
, Policies
|
||||
, policy_cons<dependency_policy<0, 1>, Policies>
|
||||
>
|
||||
{};
|
||||
|
||||
template <
|
||||
class Class
|
||||
, class Get, class GetPolicies
|
||||
, class Set = null_type, class SetPolicies = null_type
|
||||
>
|
||||
struct property_registration : registration
|
||||
{
|
||||
property_registration(
|
||||
char const* name
|
||||
, Get const& get
|
||||
, GetPolicies const& get_policies
|
||||
, Set const& set = Set()
|
||||
, SetPolicies const& set_policies = SetPolicies()
|
||||
)
|
||||
: name(name)
|
||||
, get(get)
|
||||
, get_policies(get_policies)
|
||||
, set(set)
|
||||
, set_policies(set_policies)
|
||||
{}
|
||||
|
||||
void register_(lua_State* L) const
|
||||
{
|
||||
object context(from_stack(L, -1));
|
||||
register_aux(
|
||||
L
|
||||
, context
|
||||
, make_get(L, get, boost::is_member_object_pointer<Get>())
|
||||
, set
|
||||
);
|
||||
}
|
||||
|
||||
template <class F>
|
||||
object make_get(lua_State* L, F const& f, mpl::false_) const
|
||||
{
|
||||
return make_function(
|
||||
L, f, deduce_signature(f, (Class*)0), get_policies);
|
||||
}
|
||||
|
||||
template <class T, class D>
|
||||
object make_get(lua_State* L, D T::* mem_ptr, mpl::true_) const
|
||||
{
|
||||
typedef typename reference_result<D>::type result_type;
|
||||
typedef typename inject_dependency_policy<
|
||||
D, GetPolicies>::type policies;
|
||||
|
||||
return make_function(
|
||||
L
|
||||
, access_member_ptr<T, D, result_type>(mem_ptr)
|
||||
, mpl::vector2<result_type, Class const&>()
|
||||
, policies()
|
||||
);
|
||||
}
|
||||
|
||||
template <class F>
|
||||
object make_set(lua_State* L, F const& f, mpl::false_) const
|
||||
{
|
||||
return make_function(
|
||||
L, f, deduce_signature(f, (Class*)0), set_policies);
|
||||
}
|
||||
|
||||
template <class T, class D>
|
||||
object make_set(lua_State* L, D T::* mem_ptr, mpl::true_) const
|
||||
{
|
||||
return make_function(
|
||||
L
|
||||
, access_member_ptr<T, D>(mem_ptr)
|
||||
, mpl::vector3<void, Class&, D const&>()
|
||||
, set_policies
|
||||
);
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void register_aux(
|
||||
lua_State* L, object const& context
|
||||
, object const& get_, S const&) const
|
||||
{
|
||||
context[name] = property(
|
||||
get_
|
||||
, make_set(L, set, boost::is_member_object_pointer<Set>())
|
||||
);
|
||||
}
|
||||
|
||||
void register_aux(
|
||||
lua_State*, object const& context
|
||||
, object const& get_, null_type) const
|
||||
{
|
||||
context[name] = property(get_);
|
||||
}
|
||||
|
||||
char const* name;
|
||||
Get get;
|
||||
GetPolicies get_policies;
|
||||
Set set;
|
||||
SetPolicies set_policies;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
// registers a class in the lua environment
|
||||
template<class T, class X1, class X2, class X3>
|
||||
struct class_: detail::class_base
|
||||
{
|
||||
typedef class_<T, X1, X2, X3> self_t;
|
||||
|
||||
private:
|
||||
|
||||
template<class A, class B, class C, class D>
|
||||
class_(const class_<A,B,C,D>&);
|
||||
|
||||
public:
|
||||
|
||||
typedef boost::mpl::vector4<X1, X2, X3, detail::unspecified> parameters_type;
|
||||
|
||||
// WrappedType MUST inherit from T
|
||||
typedef typename detail::extract_parameter<
|
||||
parameters_type
|
||||
, boost::is_base_and_derived<T, boost::mpl::_>
|
||||
, detail::null_type
|
||||
>::type WrappedType;
|
||||
|
||||
typedef typename detail::extract_parameter<
|
||||
parameters_type
|
||||
, boost::mpl::not_<
|
||||
boost::mpl::or_<
|
||||
detail::is_bases<boost::mpl::_>
|
||||
, boost::is_base_and_derived<boost::mpl::_, T>
|
||||
, boost::is_base_and_derived<T, boost::mpl::_>
|
||||
>
|
||||
>
|
||||
, detail::null_type
|
||||
>::type HeldType;
|
||||
|
||||
template <class Src, class Target>
|
||||
void add_downcast(Src*, Target*, boost::mpl::true_)
|
||||
{
|
||||
add_cast(
|
||||
detail::registered_class<Src>::id
|
||||
, detail::registered_class<Target>::id
|
||||
, detail::dynamic_cast_<Src, Target>::execute
|
||||
);
|
||||
}
|
||||
|
||||
template <class Src, class Target>
|
||||
void add_downcast(Src*, Target*, boost::mpl::false_)
|
||||
{}
|
||||
|
||||
// this function generates conversion information
|
||||
// in the given class_rep structure. It will be able
|
||||
// to implicitly cast to the given template type
|
||||
template<class To>
|
||||
void gen_base_info(detail::type_<To>)
|
||||
{
|
||||
add_base(typeid(To), detail::static_cast_<T, To>::execute);
|
||||
add_cast(
|
||||
detail::registered_class<T>::id
|
||||
, detail::registered_class<To>::id
|
||||
, detail::static_cast_<T, To>::execute
|
||||
);
|
||||
|
||||
add_downcast((To*)0, (T*)0, boost::is_polymorphic<To>());
|
||||
}
|
||||
|
||||
void gen_base_info(detail::type_<detail::null_type>)
|
||||
{}
|
||||
|
||||
#define LUABIND_GEN_BASE_INFO(z, n, text) gen_base_info(detail::type_<BaseClass##n>());
|
||||
|
||||
template<BOOST_PP_ENUM_PARAMS(LUABIND_MAX_BASES, class BaseClass)>
|
||||
void generate_baseclass_list(detail::type_<bases<BOOST_PP_ENUM_PARAMS(LUABIND_MAX_BASES, BaseClass)> >)
|
||||
{
|
||||
BOOST_PP_REPEAT(LUABIND_MAX_BASES, LUABIND_GEN_BASE_INFO, _)
|
||||
}
|
||||
|
||||
#undef LUABIND_GEN_BASE_INFO
|
||||
|
||||
class_(const char* name): class_base(name), scope(*this)
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
detail::check_link_compatibility();
|
||||
#endif
|
||||
init();
|
||||
}
|
||||
|
||||
template<class F>
|
||||
class_& def(const char* name, F f)
|
||||
{
|
||||
return this->virtual_def(
|
||||
name, f, detail::null_type()
|
||||
, detail::null_type(), boost::mpl::true_());
|
||||
}
|
||||
|
||||
// virtual functions
|
||||
template<class F, class DefaultOrPolicies>
|
||||
class_& def(char const* name, F fn, DefaultOrPolicies default_or_policies)
|
||||
{
|
||||
return this->virtual_def(
|
||||
name, fn, default_or_policies, detail::null_type()
|
||||
, LUABIND_MSVC_TYPENAME detail::is_policy_cons<DefaultOrPolicies>::type());
|
||||
}
|
||||
|
||||
template<class F, class Default, class Policies>
|
||||
class_& def(char const* name, F fn
|
||||
, Default default_, Policies const& policies)
|
||||
{
|
||||
return this->virtual_def(
|
||||
name, fn, default_
|
||||
, policies, boost::mpl::false_());
|
||||
}
|
||||
|
||||
template<BOOST_PP_ENUM_PARAMS(LUABIND_MAX_ARITY, class A)>
|
||||
class_& def(constructor<BOOST_PP_ENUM_PARAMS(LUABIND_MAX_ARITY, A)> sig)
|
||||
{
|
||||
return this->def_constructor(&sig, detail::null_type());
|
||||
}
|
||||
|
||||
template<BOOST_PP_ENUM_PARAMS(LUABIND_MAX_ARITY, class A), class Policies>
|
||||
class_& def(constructor<BOOST_PP_ENUM_PARAMS(LUABIND_MAX_ARITY, A)> sig, const Policies& policies)
|
||||
{
|
||||
return this->def_constructor(&sig, policies);
|
||||
}
|
||||
|
||||
template <class Getter>
|
||||
class_& property(const char* name, Getter g)
|
||||
{
|
||||
this->add_member(
|
||||
new detail::property_registration<T, Getter, detail::null_type>(
|
||||
name, g, detail::null_type()));
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class Getter, class MaybeSetter>
|
||||
class_& property(const char* name, Getter g, MaybeSetter s)
|
||||
{
|
||||
return property_impl(
|
||||
name, g, s
|
||||
, boost::mpl::bool_<detail::is_policy_cons<MaybeSetter>::value>()
|
||||
);
|
||||
}
|
||||
|
||||
template<class Getter, class Setter, class GetPolicies>
|
||||
class_& property(const char* name, Getter g, Setter s, const GetPolicies& get_policies)
|
||||
{
|
||||
typedef detail::property_registration<
|
||||
T, Getter, GetPolicies, Setter, detail::null_type
|
||||
> registration_type;
|
||||
|
||||
this->add_member(
|
||||
new registration_type(name, g, get_policies, s));
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<class Getter, class Setter, class GetPolicies, class SetPolicies>
|
||||
class_& property(
|
||||
const char* name
|
||||
, Getter g, Setter s
|
||||
, GetPolicies const& get_policies
|
||||
, SetPolicies const& set_policies)
|
||||
{
|
||||
typedef detail::property_registration<
|
||||
T, Getter, GetPolicies, Setter, SetPolicies
|
||||
> registration_type;
|
||||
|
||||
this->add_member(
|
||||
new registration_type(name, g, get_policies, s, set_policies));
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class C, class D>
|
||||
class_& def_readonly(const char* name, D C::*mem_ptr)
|
||||
{
|
||||
typedef detail::property_registration<T, D C::*, detail::null_type>
|
||||
registration_type;
|
||||
|
||||
this->add_member(
|
||||
new registration_type(name, mem_ptr, detail::null_type()));
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class C, class D, class Policies>
|
||||
class_& def_readonly(const char* name, D C::*mem_ptr, Policies const& policies)
|
||||
{
|
||||
typedef detail::property_registration<T, D C::*, Policies>
|
||||
registration_type;
|
||||
|
||||
this->add_member(
|
||||
new registration_type(name, mem_ptr, policies));
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class C, class D>
|
||||
class_& def_readwrite(const char* name, D C::*mem_ptr)
|
||||
{
|
||||
typedef detail::property_registration<
|
||||
T, D C::*, detail::null_type, D C::*
|
||||
> registration_type;
|
||||
|
||||
this->add_member(
|
||||
new registration_type(
|
||||
name, mem_ptr, detail::null_type(), mem_ptr));
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class C, class D, class GetPolicies>
|
||||
class_& def_readwrite(
|
||||
const char* name, D C::*mem_ptr, GetPolicies const& get_policies)
|
||||
{
|
||||
typedef detail::property_registration<
|
||||
T, D C::*, GetPolicies, D C::*
|
||||
> registration_type;
|
||||
|
||||
this->add_member(
|
||||
new registration_type(
|
||||
name, mem_ptr, get_policies, mem_ptr));
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class C, class D, class GetPolicies, class SetPolicies>
|
||||
class_& def_readwrite(
|
||||
const char* name
|
||||
, D C::*mem_ptr
|
||||
, GetPolicies const& get_policies
|
||||
, SetPolicies const& set_policies
|
||||
)
|
||||
{
|
||||
typedef detail::property_registration<
|
||||
T, D C::*, GetPolicies, D C::*, SetPolicies
|
||||
> registration_type;
|
||||
|
||||
this->add_member(
|
||||
new registration_type(
|
||||
name, mem_ptr, get_policies, mem_ptr, set_policies));
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<class Derived, class Policies>
|
||||
class_& def(detail::operator_<Derived>, Policies const& policies)
|
||||
{
|
||||
return this->def(
|
||||
Derived::name()
|
||||
, &Derived::template apply<T, Policies>::execute
|
||||
, policies
|
||||
);
|
||||
}
|
||||
|
||||
template<class Derived>
|
||||
class_& def(detail::operator_<Derived>)
|
||||
{
|
||||
return this->def(
|
||||
Derived::name()
|
||||
, &Derived::template apply<T, detail::null_type>::execute
|
||||
);
|
||||
}
|
||||
|
||||
detail::enum_maker<self_t> enum_(const char*)
|
||||
{
|
||||
return detail::enum_maker<self_t>(*this);
|
||||
}
|
||||
|
||||
detail::static_scope<self_t> scope;
|
||||
|
||||
private:
|
||||
void operator=(class_ const&);
|
||||
|
||||
void add_wrapper_cast(detail::null_type*)
|
||||
{}
|
||||
|
||||
template <class U>
|
||||
void add_wrapper_cast(U*)
|
||||
{
|
||||
add_cast(
|
||||
detail::registered_class<U>::id
|
||||
, detail::registered_class<T>::id
|
||||
, detail::static_cast_<U,T>::execute
|
||||
);
|
||||
|
||||
add_downcast((T*)0, (U*)0, boost::is_polymorphic<T>());
|
||||
}
|
||||
|
||||
void init()
|
||||
{
|
||||
typedef typename detail::extract_parameter<
|
||||
parameters_type
|
||||
, boost::mpl::or_<
|
||||
detail::is_bases<boost::mpl::_>
|
||||
, boost::is_base_and_derived<boost::mpl::_, T>
|
||||
>
|
||||
, no_bases
|
||||
>::type bases_t;
|
||||
|
||||
typedef typename
|
||||
boost::mpl::if_<detail::is_bases<bases_t>
|
||||
, bases_t
|
||||
, bases<bases_t>
|
||||
>::type Base;
|
||||
|
||||
class_base::init(
|
||||
typeid(T)
|
||||
, detail::registered_class<T>::id
|
||||
, typeid(WrappedType)
|
||||
, detail::registered_class<WrappedType>::id
|
||||
);
|
||||
|
||||
add_wrapper_cast((WrappedType*)0);
|
||||
|
||||
generate_baseclass_list(detail::type_<Base>());
|
||||
}
|
||||
|
||||
template<class Getter, class GetPolicies>
|
||||
class_& property_impl(const char* name,
|
||||
Getter g,
|
||||
GetPolicies policies,
|
||||
boost::mpl::bool_<true>)
|
||||
{
|
||||
this->add_member(
|
||||
new detail::property_registration<T, Getter, GetPolicies>(
|
||||
name, g, policies));
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<class Getter, class Setter>
|
||||
class_& property_impl(const char* name,
|
||||
Getter g,
|
||||
Setter s,
|
||||
boost::mpl::bool_<false>)
|
||||
{
|
||||
typedef detail::property_registration<
|
||||
T, Getter, detail::null_type, Setter, detail::null_type
|
||||
> registration_type;
|
||||
|
||||
this->add_member(
|
||||
new registration_type(name, g, detail::null_type(), s));
|
||||
return *this;
|
||||
}
|
||||
|
||||
// these handle default implementation of virtual functions
|
||||
template<class F, class Policies>
|
||||
class_& virtual_def(char const* name, F const& fn
|
||||
, Policies const&, detail::null_type, boost::mpl::true_)
|
||||
{
|
||||
this->add_member(
|
||||
new detail::memfun_registration<T, F, Policies>(
|
||||
name, fn, Policies()));
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<class F, class Default, class Policies>
|
||||
class_& virtual_def(char const* name, F const& fn
|
||||
, Default const& default_, Policies const&, boost::mpl::false_)
|
||||
{
|
||||
this->add_member(
|
||||
new detail::memfun_registration<T, F, Policies>(
|
||||
name, fn, Policies()));
|
||||
|
||||
this->add_default_member(
|
||||
new detail::memfun_registration<T, Default, Policies>(
|
||||
name, default_, Policies()));
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<class Signature, class Policies>
|
||||
class_& def_constructor(Signature*, Policies const&)
|
||||
{
|
||||
typedef typename Signature::signature signature;
|
||||
|
||||
typedef typename boost::mpl::if_<
|
||||
boost::is_same<WrappedType, detail::null_type>
|
||||
, T
|
||||
, WrappedType
|
||||
>::type construct_type;
|
||||
|
||||
this->add_member(
|
||||
new detail::constructor_registration<
|
||||
construct_type, HeldType, signature, Policies>(
|
||||
Policies()));
|
||||
|
||||
this->add_default_member(
|
||||
new detail::constructor_registration<
|
||||
construct_type, HeldType, signature, Policies>(
|
||||
Policies()));
|
||||
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif // LUABIND_CLASS_HPP_INCLUDED
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
// Copyright (c) 2003 Daniel Wallin and Arvid Norberg
|
||||
|
||||
// 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.
|
||||
|
||||
|
||||
#ifndef LUABIND_CLASS_INFO_HPP_INCLUDED
|
||||
#define LUABIND_CLASS_INFO_HPP_INCLUDED
|
||||
|
||||
#include <luabind/prefix.hpp>
|
||||
#include <luabind/lua_include.hpp>
|
||||
#include <luabind/luabind.hpp>
|
||||
#include <luabind/object.hpp>
|
||||
|
||||
namespace luabind
|
||||
{
|
||||
struct LUABIND_API class_info
|
||||
{
|
||||
std::string name;
|
||||
object methods;
|
||||
object attributes;
|
||||
};
|
||||
|
||||
LUABIND_API class_info get_class_info(argument const&);
|
||||
|
||||
// returns a table of bound class names
|
||||
LUABIND_API object get_class_names(lua_State* L);
|
||||
|
||||
LUABIND_API void bind_class_info(lua_State*);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,128 +0,0 @@
|
||||
// Copyright (c) 2003 Daniel Wallin and Arvid Norberg
|
||||
|
||||
// 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.
|
||||
|
||||
|
||||
#ifndef LUABIND_CONFIG_HPP_INCLUDED
|
||||
#define LUABIND_CONFIG_HPP_INCLUDED
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#define LUABIND_ANONYMOUS_FIX static
|
||||
#else
|
||||
#define LUABIND_ANONYMOUS_FIX
|
||||
#endif
|
||||
|
||||
#if defined (BOOST_MSVC) && (BOOST_MSVC <= 1200)
|
||||
|
||||
#define for if (false) {} else for
|
||||
|
||||
#include <cstring>
|
||||
|
||||
namespace std
|
||||
{
|
||||
using ::strlen;
|
||||
using ::strcmp;
|
||||
using ::type_info;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if defined (BOOST_MSVC) && (BOOST_MSVC <= 1300)
|
||||
#define LUABIND_MSVC_TYPENAME
|
||||
#else
|
||||
#define LUABIND_MSVC_TYPENAME typename
|
||||
#endif
|
||||
|
||||
// the maximum number of arguments of functions that's
|
||||
// registered. Must at least be 2
|
||||
#ifndef LUABIND_MAX_ARITY
|
||||
#define LUABIND_MAX_ARITY 10
|
||||
#elif LUABIND_MAX_ARITY <= 1
|
||||
#undef LUABIND_MAX_ARITY
|
||||
#define LUABIND_MAX_ARITY 2
|
||||
#endif
|
||||
|
||||
// the maximum number of classes one class
|
||||
// can derive from
|
||||
// max bases must at least be 1
|
||||
#ifndef LUABIND_MAX_BASES
|
||||
#define LUABIND_MAX_BASES 4
|
||||
#elif LUABIND_MAX_BASES <= 0
|
||||
#undef LUABIND_MAX_BASES
|
||||
#define LUABIND_MAX_BASES 1
|
||||
#endif
|
||||
|
||||
// LUABIND_NO_ERROR_CHECKING
|
||||
// define this to remove all error checks
|
||||
// this will improve performance and memory
|
||||
// footprint.
|
||||
// if it is defined matchers will only be called on
|
||||
// overloaded functions, functions that's
|
||||
// not overloaded will be called directly. The
|
||||
// parameters on the lua stack are assumed
|
||||
// to match those of the function.
|
||||
// exceptions will still be catched when there's
|
||||
// no error checking.
|
||||
|
||||
// LUABIND_NOT_THREADSAFE
|
||||
// this define will make luabind non-thread safe. That is,
|
||||
// it will rely on a static variable. You can still have
|
||||
// multiple lua states and use coroutines, but only
|
||||
// one of your real threads may run lua code.
|
||||
|
||||
// LUABIND_NO_EXCEPTIONS
|
||||
// this define will disable all usage of try, catch and throw in
|
||||
// luabind. This will in many cases disable runtime-errors, such
|
||||
// as invalid casts, when calling lua-functions that fails or
|
||||
// returns values that cannot be converted by the given policy.
|
||||
// Luabind requires that no function called directly or indirectly
|
||||
// by luabind throws an exception (throwing exceptions through
|
||||
// C code has undefined behavior, lua is written in C).
|
||||
|
||||
#ifdef LUABIND_DYNAMIC_LINK
|
||||
# ifdef BOOST_WINDOWS
|
||||
# ifdef LUABIND_BUILDING
|
||||
# define LUABIND_API __declspec(dllexport)
|
||||
# else
|
||||
# define LUABIND_API __declspec(dllimport)
|
||||
# endif
|
||||
# else
|
||||
# if defined(_GNUC_) && _GNUC_ >=4
|
||||
# define LUABIND_API __attribute__ ((visibility("default")))
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef LUABIND_API
|
||||
# define LUABIND_API
|
||||
#endif
|
||||
|
||||
namespace luabind {
|
||||
|
||||
LUABIND_API void disable_super_deprecation();
|
||||
|
||||
} // namespace luabind
|
||||
|
||||
#endif // LUABIND_CONFIG_HPP_INCLUDED
|
||||
|
||||
@@ -1,143 +0,0 @@
|
||||
// Copyright (c) 2003 Daniel Wallin and Arvid Norberg
|
||||
|
||||
// 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.
|
||||
|
||||
|
||||
#ifndef LUABIND_CONTAINER_POLICY_HPP_INCLUDED
|
||||
#define LUABIND_CONTAINER_POLICY_HPP_INCLUDED
|
||||
|
||||
#include <luabind/config.hpp>
|
||||
#include <luabind/detail/policy.hpp>
|
||||
#include <boost/mpl/apply_wrap.hpp>
|
||||
|
||||
namespace luabind { namespace detail {
|
||||
|
||||
namespace mpl = boost::mpl;
|
||||
|
||||
template<class Policies>
|
||||
struct container_converter_lua_to_cpp
|
||||
{
|
||||
int const consumed_args(...)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
T apply(lua_State* L, by_const_reference<T>, int index)
|
||||
{
|
||||
typedef typename T::value_type value_type;
|
||||
|
||||
typedef typename find_conversion_policy<1, Policies>::type converter_policy;
|
||||
typename mpl::apply_wrap2<converter_policy,value_type,lua_to_cpp>::type converter;
|
||||
|
||||
T container;
|
||||
|
||||
lua_pushnil(L);
|
||||
while (lua_next(L, index))
|
||||
{
|
||||
container.push_back(converter.apply(L, LUABIND_DECORATE_TYPE(value_type), -1));
|
||||
lua_pop(L, 1); // pop value
|
||||
}
|
||||
|
||||
return container;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
T apply(lua_State* L, by_value<T>, int index)
|
||||
{
|
||||
return apply(L, by_const_reference<T>(), index);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
static int match(lua_State* L, by_const_reference<T>, int index)
|
||||
{
|
||||
if (lua_istable(L, index)) return 0; else return -1;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void converter_postcall(lua_State*, T, int) {}
|
||||
};
|
||||
|
||||
template<class Policies>
|
||||
struct container_converter_cpp_to_lua
|
||||
{
|
||||
template<class T>
|
||||
void apply(lua_State* L, const T& container)
|
||||
{
|
||||
typedef typename T::value_type value_type;
|
||||
|
||||
typedef typename find_conversion_policy<1, Policies>::type converter_policy;
|
||||
typename mpl::apply_wrap2<converter_policy,value_type,lua_to_cpp>::type converter;
|
||||
|
||||
lua_newtable(L);
|
||||
|
||||
int index = 1;
|
||||
|
||||
for (typename T::const_iterator i = container.begin(); i != container.end(); ++i)
|
||||
{
|
||||
converter.apply(L, *i);
|
||||
lua_rawseti(L, -2, index);
|
||||
++index;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template<int N, class Policies>
|
||||
// struct container_policy : converter_policy_tag
|
||||
struct container_policy : conversion_policy<N>
|
||||
{
|
||||
// BOOST_STATIC_CONSTANT(int, index = N);
|
||||
|
||||
static void precall(lua_State*, const index_map&) {}
|
||||
static void postcall(lua_State*, const index_map&) {}
|
||||
|
||||
struct only_accepts_nonconst_pointers {};
|
||||
|
||||
template<class T, class Direction>
|
||||
struct apply
|
||||
{
|
||||
typedef typename boost::mpl::if_<boost::is_same<lua_to_cpp, Direction>
|
||||
, container_converter_lua_to_cpp<Policies>
|
||||
, container_converter_cpp_to_lua<Policies>
|
||||
>::type type;
|
||||
};
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
namespace luabind
|
||||
{
|
||||
template<int N>
|
||||
detail::policy_cons<detail::container_policy<N, detail::null_type>, detail::null_type>
|
||||
container(LUABIND_PLACEHOLDER_ARG(N))
|
||||
{
|
||||
return detail::policy_cons<detail::container_policy<N, detail::null_type>, detail::null_type>();
|
||||
}
|
||||
|
||||
template<int N, class Policies>
|
||||
detail::policy_cons<detail::container_policy<N, Policies>, detail::null_type>
|
||||
container(LUABIND_PLACEHOLDER_ARG(N), const Policies&)
|
||||
{
|
||||
return detail::policy_cons<detail::container_policy<N, Policies>, detail::null_type>();
|
||||
}
|
||||
}
|
||||
|
||||
#endif // LUABIND_CONTAINER_POLICY_HPP_INCLUDED
|
||||
@@ -1,61 +0,0 @@
|
||||
// Copyright Daniel Wallin 2008. Use, modification and distribution is
|
||||
// subject to the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef LUABIND_COPY_POLICY_081021_HPP
|
||||
# define LUABIND_COPY_POLICY_081021_HPP
|
||||
|
||||
# include <luabind/detail/policy.hpp>
|
||||
|
||||
namespace luabind {
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
struct copy_converter
|
||||
{
|
||||
template <class T>
|
||||
void apply(lua_State* L, T const& x)
|
||||
{
|
||||
value_converter().apply(L, x);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void apply(lua_State* L, T* x)
|
||||
{
|
||||
if (!x)
|
||||
lua_pushnil(L);
|
||||
else
|
||||
apply(L, *x);
|
||||
}
|
||||
};
|
||||
|
||||
template <int N>
|
||||
struct copy_policy : conversion_policy<N>
|
||||
{
|
||||
static void precall(lua_State*, index_map const&)
|
||||
{}
|
||||
|
||||
static void postcall(lua_State*, index_map const&)
|
||||
{}
|
||||
|
||||
template <class T, class Direction>
|
||||
struct apply
|
||||
{
|
||||
typedef copy_converter type;
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template <int N>
|
||||
detail::policy_cons<detail::copy_policy<N>, detail::null_type>
|
||||
copy(LUABIND_PLACEHOLDER_ARG(N))
|
||||
{
|
||||
return detail::policy_cons<detail::copy_policy<N>, detail::null_type>();
|
||||
}
|
||||
|
||||
} // namespace luabind
|
||||
|
||||
#endif // LUABIND_COPY_POLICY_081021_HPP
|
||||
|
||||
@@ -1,119 +0,0 @@
|
||||
// Copyright (c) 2003 Daniel Wallin and Arvid Norberg
|
||||
|
||||
// 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.
|
||||
|
||||
|
||||
#ifndef LUABIND_DEPENDENCY_POLICY_HPP_INCLUDED
|
||||
#define LUABIND_DEPENDENCY_POLICY_HPP_INCLUDED
|
||||
|
||||
#include <luabind/config.hpp>
|
||||
#include <luabind/detail/policy.hpp>
|
||||
|
||||
namespace luabind { namespace detail
|
||||
{
|
||||
// makes A dependent on B, meaning B will outlive A.
|
||||
// internally A stores a reference to B
|
||||
template<int A, int B>
|
||||
struct dependency_policy
|
||||
{
|
||||
static void postcall(lua_State* L, const index_map& indices)
|
||||
{
|
||||
int nurse_index = indices[A];
|
||||
int patient = indices[B];
|
||||
|
||||
object_rep* nurse = static_cast<object_rep*>(lua_touserdata(L, nurse_index));
|
||||
|
||||
// If the nurse isn't an object_rep, just make this a nop.
|
||||
if (nurse == 0)
|
||||
return;
|
||||
|
||||
nurse->add_dependency(L, patient);
|
||||
}
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#if defined (BOOST_MSVC) && (BOOST_MSVC <= 1200)
|
||||
|
||||
namespace luabind
|
||||
{
|
||||
// most absurd workaround of all time?
|
||||
namespace detail
|
||||
{
|
||||
template<int N>
|
||||
struct size_char_array
|
||||
{
|
||||
char storage[N + 2];
|
||||
};
|
||||
|
||||
template<int N>
|
||||
size_char_array<N> deduce_size(LUABIND_PLACEHOLDER_ARG(N));
|
||||
|
||||
template<class T>
|
||||
struct get_index_workaround
|
||||
{
|
||||
static T t;
|
||||
BOOST_STATIC_CONSTANT(int, value = sizeof(deduce_size(t)) - 2);
|
||||
};
|
||||
}
|
||||
|
||||
template<class A, class B>
|
||||
detail::policy_cons<detail::dependency_policy<detail::get_index_workaround<A>::value
|
||||
, detail::get_index_workaround<B>::value>, detail::null_type> dependency(A,B)
|
||||
{
|
||||
return detail::policy_cons<detail::dependency_policy<
|
||||
detail::get_index_workaround<A>::value, detail::get_index_workaround<B>::value>
|
||||
, detail::null_type>();
|
||||
}
|
||||
|
||||
template<class A>
|
||||
detail::policy_cons<detail::dependency_policy<0
|
||||
, detail::get_index_workaround<A>::value>, detail::null_type>
|
||||
return_internal_reference(A)
|
||||
{
|
||||
return detail::policy_cons<detail::dependency_policy<0
|
||||
, detail::get_index_workaround<A>::value>, detail::null_type>();
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
namespace luabind
|
||||
{
|
||||
template<int A, int B>
|
||||
detail::policy_cons<detail::dependency_policy<A, B>, detail::null_type>
|
||||
dependency(LUABIND_PLACEHOLDER_ARG(A), LUABIND_PLACEHOLDER_ARG(B))
|
||||
{
|
||||
return detail::policy_cons<detail::dependency_policy<A, B>, detail::null_type>();
|
||||
}
|
||||
|
||||
template<int A>
|
||||
detail::policy_cons<detail::dependency_policy<0, A>, detail::null_type>
|
||||
return_internal_reference(LUABIND_PLACEHOLDER_ARG(A))
|
||||
{
|
||||
return detail::policy_cons<detail::dependency_policy<0, A>, detail::null_type>();
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif // LUABIND_DEPENDENCY_POLICY_HPP_INCLUDED
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
// Copyright (c) 2003 Daniel Wallin and Arvid Norberg
|
||||
|
||||
// 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.
|
||||
|
||||
#if !BOOST_PP_IS_ITERATING
|
||||
|
||||
# include <luabind/detail/signature_match.hpp>
|
||||
|
||||
#ifndef LUABIND_CALC_ARITY_HPP_INCLUDED
|
||||
#define LUABIND_CALC_ARITY_HPP_INCLUDED
|
||||
|
||||
#define LUABIND_FIND_CONV(z,n,text) typedef typename find_conversion_policy<n + 1, Policies>::type p##n;
|
||||
#define LUABIND_CALC_ARITY(z,n,text) + BOOST_PP_CAT(p,n)::has_arg
|
||||
|
||||
namespace luabind { namespace detail
|
||||
{
|
||||
template<int N> struct calc_arity;
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 (4, (0, LUABIND_MAX_ARITY, <luabind/detail/calc_arity.hpp>, 1))
|
||||
#include BOOST_PP_ITERATE()
|
||||
}}
|
||||
|
||||
#undef LUABIND_CALC_ARITY
|
||||
#undef LUABIND_FIND_CONV
|
||||
|
||||
|
||||
#endif // LUABIND_CALC_ARITY_HPP_INCLUDED
|
||||
|
||||
#else // BOOST_PP_ITERATE
|
||||
|
||||
template<>
|
||||
struct calc_arity<BOOST_PP_ITERATION()>
|
||||
{
|
||||
template<BOOST_PP_ENUM_PARAMS(LUABIND_MAX_ARITY, class A), class Policies>
|
||||
static int apply(constructor<BOOST_PP_ENUM_PARAMS(LUABIND_MAX_ARITY, A)>, Policies*)
|
||||
{
|
||||
BOOST_PP_REPEAT(BOOST_PP_ITERATION(), LUABIND_FIND_CONV, _)
|
||||
return 0 BOOST_PP_REPEAT(BOOST_PP_ITERATION(), LUABIND_CALC_ARITY, _);
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,323 +0,0 @@
|
||||
// Copyright Daniel Wallin 2008. Use, modification and distribution is
|
||||
// subject to the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#if !BOOST_PP_IS_ITERATING
|
||||
|
||||
# ifndef LUABIND_CALL2_080911_HPP
|
||||
# define LUABIND_CALL2_080911_HPP
|
||||
|
||||
# include <boost/mpl/apply_wrap.hpp>
|
||||
# include <boost/mpl/begin_end.hpp>
|
||||
# include <boost/mpl/deref.hpp>
|
||||
# include <boost/mpl/front.hpp>
|
||||
# include <boost/mpl/long.hpp>
|
||||
# include <boost/mpl/size.hpp>
|
||||
# include <boost/preprocessor/control/if.hpp>
|
||||
# include <boost/preprocessor/iteration/iterate.hpp>
|
||||
# include <boost/preprocessor/iteration/local.hpp>
|
||||
# include <boost/preprocessor/repetition/enum.hpp>
|
||||
# include <boost/preprocessor/repetition/enum_trailing_params.hpp>
|
||||
# include <boost/type_traits/is_void.hpp>
|
||||
|
||||
# include <luabind/config.hpp>
|
||||
# include <luabind/detail/policy.hpp>
|
||||
# include <luabind/yield_policy.hpp>
|
||||
|
||||
namespace luabind { namespace detail {
|
||||
|
||||
struct invoke_context;
|
||||
|
||||
struct LUABIND_API function_object
|
||||
{
|
||||
function_object(lua_CFunction entry)
|
||||
: entry(entry)
|
||||
, next(0)
|
||||
{}
|
||||
|
||||
virtual ~function_object()
|
||||
{}
|
||||
|
||||
virtual int call(
|
||||
lua_State* L, invoke_context& ctx) const = 0;
|
||||
virtual void format_signature(lua_State* L, char const* function) const = 0;
|
||||
|
||||
lua_CFunction entry;
|
||||
std::string name;
|
||||
function_object* next;
|
||||
object keepalive;
|
||||
};
|
||||
|
||||
struct LUABIND_API invoke_context
|
||||
{
|
||||
invoke_context()
|
||||
: best_score((std::numeric_limits<int>::max)())
|
||||
, candidate_index(0)
|
||||
{}
|
||||
|
||||
operator bool() const
|
||||
{
|
||||
return candidate_index == 1;
|
||||
}
|
||||
|
||||
void format_error(lua_State* L, function_object const* overloads) const;
|
||||
|
||||
int best_score;
|
||||
function_object const* candidates[10];
|
||||
int candidate_index;
|
||||
};
|
||||
|
||||
template <class F, class Signature, class Policies, class IsVoid>
|
||||
inline int invoke0(
|
||||
lua_State* L, function_object const& self, invoke_context& ctx
|
||||
, F const& f, Signature, Policies const& policies, IsVoid, mpl::true_)
|
||||
{
|
||||
return invoke_member(
|
||||
L, self, ctx, f, Signature(), policies
|
||||
, mpl::long_<mpl::size<Signature>::value - 1>(), IsVoid()
|
||||
);
|
||||
}
|
||||
|
||||
template <class F, class Signature, class Policies, class IsVoid>
|
||||
inline int invoke0(
|
||||
lua_State* L, function_object const& self, invoke_context& ctx,
|
||||
F const& f, Signature, Policies const& policies, IsVoid, mpl::false_)
|
||||
{
|
||||
return invoke_normal(
|
||||
L, self, ctx, f, Signature(), policies
|
||||
, mpl::long_<mpl::size<Signature>::value - 1>(), IsVoid()
|
||||
);
|
||||
}
|
||||
|
||||
template <class F, class Signature, class Policies>
|
||||
inline int invoke(
|
||||
lua_State* L, function_object const& self, invoke_context& ctx
|
||||
, F const& f, Signature, Policies const& policies)
|
||||
{
|
||||
return invoke0(
|
||||
L, self, ctx, f, Signature(), policies
|
||||
, boost::is_void<typename mpl::front<Signature>::type>()
|
||||
, boost::is_member_function_pointer<F>()
|
||||
);
|
||||
}
|
||||
|
||||
inline int maybe_yield_aux(lua_State*, int results, mpl::false_)
|
||||
{
|
||||
return results;
|
||||
}
|
||||
|
||||
inline int maybe_yield_aux(lua_State* L, int results, mpl::true_)
|
||||
{
|
||||
return lua_yield(L, results);
|
||||
}
|
||||
|
||||
template <class Policies>
|
||||
int maybe_yield(lua_State* L, int results, Policies*)
|
||||
{
|
||||
return maybe_yield_aux(
|
||||
L, results, mpl::bool_<has_yield<Policies>::value>());
|
||||
}
|
||||
|
||||
inline int sum_scores(int const* first, int const* last)
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
for (; first != last; ++first)
|
||||
{
|
||||
if (*first < 0)
|
||||
return *first;
|
||||
result += *first;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
# define LUABIND_INVOKE_NEXT_ITER(n) \
|
||||
typename mpl::next< \
|
||||
BOOST_PP_IF( \
|
||||
n, BOOST_PP_CAT(iter,BOOST_PP_DEC(n)), first) \
|
||||
>::type
|
||||
|
||||
# define LUABIND_INVOKE_NEXT_INDEX(n) \
|
||||
BOOST_PP_IF( \
|
||||
n \
|
||||
, BOOST_PP_CAT(index,BOOST_PP_DEC(n)) + \
|
||||
BOOST_PP_CAT(c,BOOST_PP_DEC(n)).consumed_args() \
|
||||
, 1 \
|
||||
)
|
||||
|
||||
# define LUABIND_INVOKE_COMPUTE_ARITY(n) + BOOST_PP_CAT(c,n).consumed_args()
|
||||
|
||||
# define LUABIND_INVOKE_DECLARE_CONVERTER(n) \
|
||||
typedef LUABIND_INVOKE_NEXT_ITER(n) BOOST_PP_CAT(iter,n); \
|
||||
typedef typename mpl::deref<BOOST_PP_CAT(iter,n)>::type \
|
||||
BOOST_PP_CAT(a,n); \
|
||||
typedef typename find_conversion_policy<n + 1, Policies>::type \
|
||||
BOOST_PP_CAT(p,n); \
|
||||
typename mpl::apply_wrap2< \
|
||||
BOOST_PP_CAT(p,n), BOOST_PP_CAT(a,n), lua_to_cpp>::type BOOST_PP_CAT(c,n); \
|
||||
int const BOOST_PP_CAT(index,n) = LUABIND_INVOKE_NEXT_INDEX(n);
|
||||
|
||||
# define LUABIND_INVOKE_COMPUTE_SCORE(n) \
|
||||
, BOOST_PP_CAT(c,n).match( \
|
||||
L, LUABIND_DECORATE_TYPE(BOOST_PP_CAT(a,n)), BOOST_PP_CAT(index,n))
|
||||
|
||||
# define LUABIND_INVOKE_ARG(z, n, base) \
|
||||
BOOST_PP_CAT(c,base(n)).apply( \
|
||||
L, LUABIND_DECORATE_TYPE(BOOST_PP_CAT(a,base(n))), BOOST_PP_CAT(index,base(n)))
|
||||
|
||||
# define LUABIND_INVOKE_CONVERTER_POSTCALL(n) \
|
||||
BOOST_PP_CAT(c,n).converter_postcall( \
|
||||
L, LUABIND_DECORATE_TYPE(BOOST_PP_CAT(a,n)), BOOST_PP_CAT(index,n));
|
||||
|
||||
# define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (0, LUABIND_MAX_ARITY, <luabind/detail/call.hpp>))
|
||||
# include BOOST_PP_ITERATE()
|
||||
|
||||
# define LUABIND_INVOKE_VOID
|
||||
# define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (0, LUABIND_MAX_ARITY, <luabind/detail/call.hpp>))
|
||||
# include BOOST_PP_ITERATE()
|
||||
|
||||
# undef LUABIND_INVOKE_VOID
|
||||
# define LUABIND_INVOKE_MEMBER
|
||||
# define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (0, LUABIND_MAX_ARITY, <luabind/detail/call.hpp>))
|
||||
# include BOOST_PP_ITERATE()
|
||||
|
||||
# define LUABIND_INVOKE_VOID
|
||||
# define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (0, LUABIND_MAX_ARITY, <luabind/detail/call.hpp>))
|
||||
# include BOOST_PP_ITERATE()
|
||||
|
||||
}} // namespace luabind::detail
|
||||
|
||||
# endif // LUABIND_CALL2_080911_HPP
|
||||
|
||||
#else // BOOST_PP_IS_ITERATING
|
||||
|
||||
# ifdef LUABIND_INVOKE_MEMBER
|
||||
# define N BOOST_PP_INC(BOOST_PP_ITERATION())
|
||||
# else
|
||||
# define N BOOST_PP_ITERATION()
|
||||
# endif
|
||||
|
||||
template <class F, class Signature, class Policies>
|
||||
inline int
|
||||
# ifdef LUABIND_INVOKE_MEMBER
|
||||
invoke_member
|
||||
# else
|
||||
invoke_normal
|
||||
# endif
|
||||
(
|
||||
lua_State* L, function_object const& self, invoke_context& ctx
|
||||
, F const& f, Signature, Policies const&, mpl::long_<N>
|
||||
# ifdef LUABIND_INVOKE_VOID
|
||||
, mpl::true_
|
||||
# else
|
||||
, mpl::false_
|
||||
# endif
|
||||
)
|
||||
{
|
||||
typedef typename mpl::begin<Signature>::type first;
|
||||
# ifndef LUABIND_INVOKE_VOID
|
||||
typedef typename mpl::deref<first>::type result_type;
|
||||
typedef typename find_conversion_policy<0, Policies>::type result_policy;
|
||||
typename mpl::apply_wrap2<
|
||||
result_policy, result_type, cpp_to_lua>::type result_converter;
|
||||
# endif
|
||||
|
||||
# if N > 0
|
||||
# define BOOST_PP_LOCAL_MACRO(n) LUABIND_INVOKE_DECLARE_CONVERTER(n)
|
||||
# define BOOST_PP_LOCAL_LIMITS (0,N-1)
|
||||
# include BOOST_PP_LOCAL_ITERATE()
|
||||
# endif
|
||||
|
||||
int const arity = 0
|
||||
# if N > 0
|
||||
# define BOOST_PP_LOCAL_MACRO(n) LUABIND_INVOKE_COMPUTE_ARITY(n)
|
||||
# define BOOST_PP_LOCAL_LIMITS (0,N-1)
|
||||
# include BOOST_PP_LOCAL_ITERATE()
|
||||
# endif
|
||||
;
|
||||
|
||||
int const arguments = lua_gettop(L);
|
||||
|
||||
int score = -1;
|
||||
|
||||
if (arity == arguments)
|
||||
{
|
||||
int const scores[] = {
|
||||
0
|
||||
# if N > 0
|
||||
# define BOOST_PP_LOCAL_MACRO(n) LUABIND_INVOKE_COMPUTE_SCORE(n)
|
||||
# define BOOST_PP_LOCAL_LIMITS (0,N-1)
|
||||
# include BOOST_PP_LOCAL_ITERATE()
|
||||
# endif
|
||||
};
|
||||
|
||||
score = sum_scores(scores + 1, scores + 1 + N);
|
||||
}
|
||||
|
||||
if (score >= 0 && score < ctx.best_score)
|
||||
{
|
||||
ctx.best_score = score;
|
||||
ctx.candidates[0] = &self;
|
||||
ctx.candidate_index = 1;
|
||||
}
|
||||
else if (score == ctx.best_score)
|
||||
{
|
||||
ctx.candidates[ctx.candidate_index++] = &self;
|
||||
}
|
||||
|
||||
int results = 0;
|
||||
|
||||
if (self.next)
|
||||
{
|
||||
results = self.next->call(L, ctx);
|
||||
}
|
||||
|
||||
if (score == ctx.best_score && ctx.candidate_index == 1)
|
||||
{
|
||||
# ifndef LUABIND_INVOKE_VOID
|
||||
result_converter.apply(
|
||||
L,
|
||||
# endif
|
||||
# ifdef LUABIND_INVOKE_MEMBER
|
||||
(c0.apply(L, LUABIND_DECORATE_TYPE(a0), index0).*f)(
|
||||
BOOST_PP_ENUM(BOOST_PP_DEC(N), LUABIND_INVOKE_ARG, BOOST_PP_INC)
|
||||
)
|
||||
# else
|
||||
# define LUABIND_INVOKE_IDENTITY(x) x
|
||||
f(
|
||||
BOOST_PP_ENUM(N, LUABIND_INVOKE_ARG, LUABIND_INVOKE_IDENTITY)
|
||||
)
|
||||
# undef LUABIND_INVOKE_IDENTITY
|
||||
# endif
|
||||
# ifndef LUABIND_INVOKE_VOID
|
||||
)
|
||||
# endif
|
||||
;
|
||||
|
||||
# if N > 0
|
||||
# define BOOST_PP_LOCAL_MACRO(n) LUABIND_INVOKE_CONVERTER_POSTCALL(n)
|
||||
# define BOOST_PP_LOCAL_LIMITS (0,N-1)
|
||||
# include BOOST_PP_LOCAL_ITERATE()
|
||||
# endif
|
||||
|
||||
results = maybe_yield(L, lua_gettop(L) - arguments, (Policies*)0);
|
||||
|
||||
int const indices[] = {
|
||||
arguments + results BOOST_PP_ENUM_TRAILING_PARAMS(N, index)
|
||||
};
|
||||
|
||||
policy_list_postcall<Policies>::apply(L, indices);
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
# undef N
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,442 +0,0 @@
|
||||
// Copyright (c) 2003 Daniel Wallin and Arvid Norberg
|
||||
|
||||
// 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.
|
||||
|
||||
|
||||
#if !BOOST_PP_IS_ITERATING
|
||||
|
||||
#ifndef LUABIND_CALL_FUNCTION_HPP_INCLUDED
|
||||
#define LUABIND_CALL_FUNCTION_HPP_INCLUDED
|
||||
|
||||
#include <luabind/config.hpp>
|
||||
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/mpl/or.hpp>
|
||||
#include <boost/preprocessor/repeat.hpp>
|
||||
#include <boost/preprocessor/iteration/iterate.hpp>
|
||||
#include <boost/preprocessor/repetition/enum.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
#include <boost/preprocessor/punctuation/comma_if.hpp>
|
||||
|
||||
#include <luabind/error.hpp>
|
||||
#include <luabind/detail/convert_to_lua.hpp>
|
||||
#include <luabind/detail/pcall.hpp>
|
||||
|
||||
namespace luabind
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
// if the proxy_function_caller returns non-void
|
||||
template<class Ret, class Tuple>
|
||||
class proxy_function_caller
|
||||
{
|
||||
// friend class luabind::object;
|
||||
public:
|
||||
|
||||
typedef int(*function_t)(lua_State*, int, int);
|
||||
|
||||
proxy_function_caller(
|
||||
lua_State* L
|
||||
, int params
|
||||
, function_t fun
|
||||
, const Tuple args)
|
||||
: m_state(L)
|
||||
, m_params(params)
|
||||
, m_fun(fun)
|
||||
, m_args(args)
|
||||
, m_called(false)
|
||||
{
|
||||
}
|
||||
|
||||
proxy_function_caller(const proxy_function_caller& rhs)
|
||||
: m_state(rhs.m_state)
|
||||
, m_params(rhs.m_params)
|
||||
, m_fun(rhs.m_fun)
|
||||
, m_args(rhs.m_args)
|
||||
, m_called(rhs.m_called)
|
||||
{
|
||||
rhs.m_called = true;
|
||||
}
|
||||
|
||||
~proxy_function_caller()
|
||||
{
|
||||
if (m_called) return;
|
||||
|
||||
m_called = true;
|
||||
lua_State* L = m_state;
|
||||
|
||||
int top = lua_gettop(L);
|
||||
|
||||
push_args_from_tuple<1>::apply(L, m_args);
|
||||
if (m_fun(L, boost::tuples::length<Tuple>::value, 0))
|
||||
{
|
||||
assert(lua_gettop(L) == top - m_params + 1);
|
||||
#ifndef LUABIND_NO_EXCEPTIONS
|
||||
throw luabind::error(L);
|
||||
#else
|
||||
error_callback_fun e = get_error_callback();
|
||||
if (e) e(L);
|
||||
|
||||
assert(0 && "the lua function threw an error and exceptions are disabled."
|
||||
" If you want to handle the error you can use luabind::set_error_callback()");
|
||||
std::terminate();
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
// pops the return values from the function call
|
||||
stack_pop pop(L, lua_gettop(L) - top + m_params);
|
||||
}
|
||||
|
||||
operator Ret()
|
||||
{
|
||||
typename mpl::apply_wrap2<default_policy,Ret,lua_to_cpp>::type converter;
|
||||
|
||||
m_called = true;
|
||||
lua_State* L = m_state;
|
||||
|
||||
int top = lua_gettop(L);
|
||||
|
||||
push_args_from_tuple<1>::apply(L, m_args);
|
||||
if (m_fun(L, boost::tuples::length<Tuple>::value, 1))
|
||||
{
|
||||
assert(lua_gettop(L) == top - m_params + 1);
|
||||
#ifndef LUABIND_NO_EXCEPTIONS
|
||||
throw luabind::error(L);
|
||||
#else
|
||||
error_callback_fun e = get_error_callback();
|
||||
if (e) e(L);
|
||||
|
||||
assert(0 && "the lua function threw an error and exceptions are disabled."
|
||||
" If you want to handle the error you can use luabind::set_error_callback()");
|
||||
std::terminate();
|
||||
#endif
|
||||
}
|
||||
|
||||
// pops the return values from the function call
|
||||
stack_pop pop(L, lua_gettop(L) - top + m_params);
|
||||
|
||||
#ifndef LUABIND_NO_ERROR_CHECKING
|
||||
|
||||
if (converter.match(L, LUABIND_DECORATE_TYPE(Ret), -1) < 0)
|
||||
{
|
||||
#ifndef LUABIND_NO_EXCEPTIONS
|
||||
throw cast_failed(L, typeid(Ret));
|
||||
#else
|
||||
cast_failed_callback_fun e = get_cast_failed_callback();
|
||||
if (e) e(L, typeid(Ret));
|
||||
|
||||
assert(0 && "the lua function's return value could not be converted."
|
||||
" If you want to handle the error you can use luabind::set_error_callback()");
|
||||
std::terminate();
|
||||
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
return converter.apply(L, LUABIND_DECORATE_TYPE(Ret), -1);
|
||||
}
|
||||
|
||||
template<class Policies>
|
||||
Ret operator[](const Policies& p)
|
||||
{
|
||||
typedef typename detail::find_conversion_policy<0, Policies>::type converter_policy;
|
||||
typename mpl::apply_wrap2<converter_policy,Ret,lua_to_cpp>::type converter;
|
||||
|
||||
m_called = true;
|
||||
lua_State* L = m_state;
|
||||
|
||||
int top = lua_gettop(L);
|
||||
|
||||
detail::push_args_from_tuple<1>::apply(L, m_args, p);
|
||||
if (m_fun(L, boost::tuples::length<Tuple>::value, 1))
|
||||
{
|
||||
assert(lua_gettop(L) == top - m_params + 1);
|
||||
#ifndef LUABIND_NO_EXCEPTIONS
|
||||
throw error(L);
|
||||
#else
|
||||
error_callback_fun e = get_error_callback();
|
||||
if (e) e(L);
|
||||
|
||||
assert(0 && "the lua function threw an error and exceptions are disabled."
|
||||
" If you want to handle the error you can use luabind::set_error_callback()");
|
||||
std::terminate();
|
||||
#endif
|
||||
}
|
||||
|
||||
// pops the return values from the function call
|
||||
stack_pop pop(L, lua_gettop(L) - top + m_params);
|
||||
|
||||
#ifndef LUABIND_NO_ERROR_CHECKING
|
||||
|
||||
if (converter.match(L, LUABIND_DECORATE_TYPE(Ret), -1) < 0)
|
||||
{
|
||||
#ifndef LUABIND_NO_EXCEPTIONS
|
||||
throw cast_failed(L, typeid(Ret));
|
||||
#else
|
||||
cast_failed_callback_fun e = get_cast_failed_callback();
|
||||
if (e) e(L, typeid(Ret));
|
||||
|
||||
assert(0 && "the lua function's return value could not be converted."
|
||||
" If you want to handle the error you can use luabind::set_error_callback()");
|
||||
std::terminate();
|
||||
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
return converter.apply(L, LUABIND_DECORATE_TYPE(Ret), -1);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
lua_State* m_state;
|
||||
int m_params;
|
||||
function_t m_fun;
|
||||
Tuple m_args;
|
||||
mutable bool m_called;
|
||||
|
||||
};
|
||||
|
||||
// if the proxy_member_caller returns void
|
||||
template<class Tuple>
|
||||
class proxy_function_void_caller
|
||||
{
|
||||
friend class luabind::object;
|
||||
public:
|
||||
|
||||
typedef int(*function_t)(lua_State*, int, int);
|
||||
|
||||
proxy_function_void_caller(
|
||||
lua_State* L
|
||||
, int params
|
||||
, function_t fun
|
||||
, const Tuple args)
|
||||
: m_state(L)
|
||||
, m_params(params)
|
||||
, m_fun(fun)
|
||||
, m_args(args)
|
||||
, m_called(false)
|
||||
{
|
||||
}
|
||||
|
||||
proxy_function_void_caller(const proxy_function_void_caller& rhs)
|
||||
: m_state(rhs.m_state)
|
||||
, m_params(rhs.m_params)
|
||||
, m_fun(rhs.m_fun)
|
||||
, m_args(rhs.m_args)
|
||||
, m_called(rhs.m_called)
|
||||
{
|
||||
rhs.m_called = true;
|
||||
}
|
||||
|
||||
~proxy_function_void_caller()
|
||||
{
|
||||
if (m_called) return;
|
||||
|
||||
m_called = true;
|
||||
lua_State* L = m_state;
|
||||
|
||||
int top = lua_gettop(L);
|
||||
|
||||
push_args_from_tuple<1>::apply(L, m_args);
|
||||
if (m_fun(L, boost::tuples::length<Tuple>::value, 0))
|
||||
{
|
||||
assert(lua_gettop(L) == top - m_params + 1);
|
||||
#ifndef LUABIND_NO_EXCEPTIONS
|
||||
throw luabind::error(L);
|
||||
#else
|
||||
error_callback_fun e = get_error_callback();
|
||||
if (e) e(L);
|
||||
|
||||
assert(0 && "the lua function threw an error and exceptions are disabled."
|
||||
" If you want to handle the error you can use luabind::set_error_callback()");
|
||||
std::terminate();
|
||||
#endif
|
||||
}
|
||||
// pops the return values from the function call
|
||||
stack_pop pop(L, lua_gettop(L) - top + m_params);
|
||||
}
|
||||
|
||||
template<class Policies>
|
||||
void operator[](const Policies& p)
|
||||
{
|
||||
m_called = true;
|
||||
lua_State* L = m_state;
|
||||
|
||||
int top = lua_gettop(L);
|
||||
|
||||
detail::push_args_from_tuple<1>::apply(L, m_args, p);
|
||||
if (m_fun(L, boost::tuples::length<Tuple>::value, 0))
|
||||
{
|
||||
assert(lua_gettop(L) == top - m_params + 1);
|
||||
#ifndef LUABIND_NO_EXCEPTIONS
|
||||
throw error(L);
|
||||
#else
|
||||
error_callback_fun e = get_error_callback();
|
||||
if (e) e(L);
|
||||
|
||||
assert(0 && "the lua function threw an error and exceptions are disabled."
|
||||
" If you want to handle the error you can use luabind::set_error_callback()");
|
||||
std::terminate();
|
||||
#endif
|
||||
}
|
||||
// pops the return values from the function call
|
||||
stack_pop pop(L, lua_gettop(L) - top + m_params);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
lua_State* m_state;
|
||||
int m_params;
|
||||
function_t m_fun;
|
||||
Tuple m_args;
|
||||
mutable bool m_called;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 (4, (0, LUABIND_MAX_ARITY, <luabind/detail/call_function.hpp>, 1))
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
}
|
||||
|
||||
#endif // LUABIND_CALL_FUNCTION_HPP_INCLUDED
|
||||
|
||||
#else
|
||||
#if BOOST_PP_ITERATION_FLAGS() == 1
|
||||
|
||||
#define LUABIND_TUPLE_PARAMS(z, n, data) const A##n *
|
||||
#define LUABIND_OPERATOR_PARAMS(z, n, data) const A##n & a##n
|
||||
|
||||
|
||||
template<class Ret BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), class A)>
|
||||
typename boost::mpl::if_<boost::is_void<Ret>
|
||||
, luabind::detail::proxy_function_void_caller<boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> >
|
||||
, luabind::detail::proxy_function_caller<Ret, boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> > >::type
|
||||
call_function(lua_State* L, const char* name BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_OPERATOR_PARAMS, _) )
|
||||
{
|
||||
assert(name && "luabind::call_function() expects a function name");
|
||||
typedef boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> tuple_t;
|
||||
#if BOOST_PP_ITERATION() == 0
|
||||
tuple_t args;
|
||||
#else
|
||||
tuple_t args(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), &a));
|
||||
#endif
|
||||
typedef typename boost::mpl::if_<boost::is_void<Ret>
|
||||
, luabind::detail::proxy_function_void_caller<boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> >
|
||||
, luabind::detail::proxy_function_caller<Ret, boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> > >::type proxy_type;
|
||||
|
||||
lua_getglobal(L, name);
|
||||
|
||||
return proxy_type(L, 1, &detail::pcall, args);
|
||||
}
|
||||
|
||||
template<class Ret BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), class A)>
|
||||
typename boost::mpl::if_<boost::is_void<Ret>
|
||||
, luabind::detail::proxy_function_void_caller<boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> >
|
||||
, luabind::detail::proxy_function_caller<Ret, boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> > >::type
|
||||
call_function(luabind::object const& obj BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_OPERATOR_PARAMS, _) )
|
||||
{
|
||||
typedef boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> tuple_t;
|
||||
#if BOOST_PP_ITERATION() == 0
|
||||
tuple_t args;
|
||||
#else
|
||||
tuple_t args(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), &a));
|
||||
#endif
|
||||
typedef typename boost::mpl::if_<boost::is_void<Ret>
|
||||
, luabind::detail::proxy_function_void_caller<boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> >
|
||||
, luabind::detail::proxy_function_caller<Ret, boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> > >::type proxy_type;
|
||||
|
||||
obj.push(obj.interpreter());
|
||||
return proxy_type(obj.interpreter(), 1, &detail::pcall, args);
|
||||
}
|
||||
|
||||
template<class Ret BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), class A)>
|
||||
typename boost::mpl::if_<boost::is_void<Ret>
|
||||
, luabind::detail::proxy_function_void_caller<boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> >
|
||||
, luabind::detail::proxy_function_caller<Ret, boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> > >::type
|
||||
resume_function(lua_State* L, const char* name BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_OPERATOR_PARAMS, _) )
|
||||
{
|
||||
assert(name && "luabind::resume_function() expects a function name");
|
||||
typedef boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> tuple_t;
|
||||
#if BOOST_PP_ITERATION() == 0
|
||||
tuple_t args;
|
||||
#else
|
||||
tuple_t args(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), &a));
|
||||
#endif
|
||||
typedef typename boost::mpl::if_<boost::is_void<Ret>
|
||||
, luabind::detail::proxy_function_void_caller<boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> >
|
||||
, luabind::detail::proxy_function_caller<Ret, boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> > >::type proxy_type;
|
||||
|
||||
lua_getglobal(L, name);
|
||||
|
||||
return proxy_type(L, 1, &detail::resume_impl, args);
|
||||
}
|
||||
|
||||
template<class Ret BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), class A)>
|
||||
typename boost::mpl::if_<boost::is_void<Ret>
|
||||
, luabind::detail::proxy_function_void_caller<boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> >
|
||||
, luabind::detail::proxy_function_caller<Ret, boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> > >::type
|
||||
resume_function(luabind::object const& obj BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_OPERATOR_PARAMS, _) )
|
||||
{
|
||||
typedef boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> tuple_t;
|
||||
#if BOOST_PP_ITERATION() == 0
|
||||
tuple_t args;
|
||||
#else
|
||||
tuple_t args(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), &a));
|
||||
#endif
|
||||
typedef typename boost::mpl::if_<boost::is_void<Ret>
|
||||
, luabind::detail::proxy_function_void_caller<boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> >
|
||||
, luabind::detail::proxy_function_caller<Ret, boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> > >::type proxy_type;
|
||||
|
||||
obj.push(obj.interpreter());
|
||||
return proxy_type(obj.interpreter(), 1, &detail::resume_impl, args);
|
||||
}
|
||||
|
||||
template<class Ret BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), class A)>
|
||||
typename boost::mpl::if_<boost::is_void<Ret>
|
||||
, luabind::detail::proxy_function_void_caller<boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> >
|
||||
, luabind::detail::proxy_function_caller<Ret, boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> > >::type
|
||||
resume(lua_State* L BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_OPERATOR_PARAMS, _) )
|
||||
{
|
||||
typedef boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> tuple_t;
|
||||
#if BOOST_PP_ITERATION() == 0
|
||||
tuple_t args;
|
||||
#else
|
||||
tuple_t args(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), &a));
|
||||
#endif
|
||||
typedef typename boost::mpl::if_<boost::is_void<Ret>
|
||||
, luabind::detail::proxy_function_void_caller<boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> >
|
||||
, luabind::detail::proxy_function_caller<Ret, boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> > >::type proxy_type;
|
||||
|
||||
return proxy_type(L, 0, &detail::resume_impl, args);
|
||||
}
|
||||
|
||||
|
||||
#undef LUABIND_OPERATOR_PARAMS
|
||||
#undef LUABIND_TUPLE_PARAMS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -1,365 +0,0 @@
|
||||
// Copyright (c) 2003 Daniel Wallin and Arvid Norberg
|
||||
|
||||
// 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.
|
||||
|
||||
|
||||
#if !BOOST_PP_IS_ITERATING
|
||||
|
||||
#ifndef LUABIND_CALL_MEMBER_HPP_INCLUDED
|
||||
#define LUABIND_CALL_MEMBER_HPP_INCLUDED
|
||||
|
||||
#include <luabind/config.hpp>
|
||||
#include <luabind/detail/convert_to_lua.hpp>
|
||||
#include <luabind/detail/pcall.hpp>
|
||||
#include <luabind/error.hpp>
|
||||
#include <luabind/detail/stack_utils.hpp>
|
||||
#include <luabind/object.hpp> // TODO: REMOVE DEPENDENCY
|
||||
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
|
||||
#include <boost/preprocessor/control/if.hpp>
|
||||
#include <boost/preprocessor/facilities/expand.hpp>
|
||||
#include <boost/preprocessor/repetition/enum.hpp>
|
||||
|
||||
#include <boost/mpl/apply_wrap.hpp>
|
||||
|
||||
namespace luabind
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
namespace mpl = boost::mpl;
|
||||
|
||||
// if the proxy_member_caller returns non-void
|
||||
template<class Ret, class Tuple>
|
||||
class proxy_member_caller
|
||||
{
|
||||
// friend class luabind::object;
|
||||
public:
|
||||
|
||||
proxy_member_caller(lua_State* L_, const Tuple args)
|
||||
: L(L_)
|
||||
, m_args(args)
|
||||
, m_called(false)
|
||||
{
|
||||
}
|
||||
|
||||
proxy_member_caller(const proxy_member_caller& rhs)
|
||||
: L(rhs.L)
|
||||
, m_args(rhs.m_args)
|
||||
, m_called(rhs.m_called)
|
||||
{
|
||||
rhs.m_called = true;
|
||||
}
|
||||
|
||||
~proxy_member_caller()
|
||||
{
|
||||
if (m_called) return;
|
||||
|
||||
m_called = true;
|
||||
|
||||
// don't count the function and self-reference
|
||||
// since those will be popped by pcall
|
||||
int top = lua_gettop(L) - 2;
|
||||
|
||||
// pcall will pop the function and self reference
|
||||
// and all the parameters
|
||||
|
||||
push_args_from_tuple<1>::apply(L, m_args);
|
||||
if (pcall(L, boost::tuples::length<Tuple>::value + 1, 0))
|
||||
{
|
||||
assert(lua_gettop(L) == top + 1);
|
||||
#ifndef LUABIND_NO_EXCEPTIONS
|
||||
throw luabind::error(L);
|
||||
#else
|
||||
error_callback_fun e = get_error_callback();
|
||||
if (e) e(L);
|
||||
|
||||
assert(0 && "the lua function threw an error and exceptions are disabled."
|
||||
"If you want to handle this error use luabind::set_error_callback()");
|
||||
std::terminate();
|
||||
#endif
|
||||
}
|
||||
// pops the return values from the function
|
||||
stack_pop pop(L, lua_gettop(L) - top);
|
||||
}
|
||||
|
||||
operator Ret()
|
||||
{
|
||||
typename mpl::apply_wrap2<default_policy,Ret,lua_to_cpp>::type converter;
|
||||
|
||||
m_called = true;
|
||||
|
||||
// don't count the function and self-reference
|
||||
// since those will be popped by pcall
|
||||
int top = lua_gettop(L) - 2;
|
||||
|
||||
// pcall will pop the function and self reference
|
||||
// and all the parameters
|
||||
push_args_from_tuple<1>::apply(L, m_args);
|
||||
if (pcall(L, boost::tuples::length<Tuple>::value + 1, 1))
|
||||
{
|
||||
assert(lua_gettop(L) == top + 1);
|
||||
#ifndef LUABIND_NO_EXCEPTIONS
|
||||
throw luabind::error(L);
|
||||
#else
|
||||
error_callback_fun e = get_error_callback();
|
||||
if (e) e(L);
|
||||
|
||||
assert(0 && "the lua function threw an error and exceptions are disabled."
|
||||
"If you want to handle this error use luabind::set_error_callback()");
|
||||
std::terminate();
|
||||
#endif
|
||||
}
|
||||
|
||||
// pops the return values from the function
|
||||
stack_pop pop(L, lua_gettop(L) - top);
|
||||
|
||||
#ifndef LUABIND_NO_ERROR_CHECKING
|
||||
|
||||
if (converter.match(L, LUABIND_DECORATE_TYPE(Ret), -1) < 0)
|
||||
{
|
||||
assert(lua_gettop(L) == top + 1);
|
||||
#ifndef LUABIND_NO_EXCEPTIONS
|
||||
throw cast_failed(L, typeid(Ret));
|
||||
#else
|
||||
cast_failed_callback_fun e = get_cast_failed_callback();
|
||||
if (e) e(L, typeid(Ret));
|
||||
|
||||
assert(0 && "the lua function's return value could not be converted."
|
||||
"If you want to handle this error use luabind::set_error_callback()");
|
||||
std::terminate();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
return converter.apply(L, LUABIND_DECORATE_TYPE(Ret), -1);
|
||||
}
|
||||
|
||||
template<class Policies>
|
||||
Ret operator[](const Policies& p)
|
||||
{
|
||||
typedef typename find_conversion_policy<0, Policies>::type converter_policy;
|
||||
typename mpl::apply_wrap2<converter_policy,Ret,lua_to_cpp>::type converter;
|
||||
|
||||
m_called = true;
|
||||
|
||||
// don't count the function and self-reference
|
||||
// since those will be popped by pcall
|
||||
int top = lua_gettop(L) - 2;
|
||||
|
||||
// pcall will pop the function and self reference
|
||||
// and all the parameters
|
||||
|
||||
detail::push_args_from_tuple<1>::apply(L, m_args, p);
|
||||
if (pcall(L, boost::tuples::length<Tuple>::value + 1, 1))
|
||||
{
|
||||
assert(lua_gettop(L) == top + 1);
|
||||
#ifndef LUABIND_NO_EXCEPTIONS
|
||||
throw error(L);
|
||||
#else
|
||||
error_callback_fun e = get_error_callback();
|
||||
if (e) e(L);
|
||||
|
||||
assert(0 && "the lua function threw an error and exceptions are disabled."
|
||||
"If you want to handle this error use luabind::set_error_callback()");
|
||||
std::terminate();
|
||||
#endif
|
||||
}
|
||||
|
||||
// pops the return values from the function
|
||||
stack_pop pop(L, lua_gettop(L) - top);
|
||||
|
||||
#ifndef LUABIND_NO_ERROR_CHECKING
|
||||
|
||||
if (converter.match(L, LUABIND_DECORATE_TYPE(Ret), -1) < 0)
|
||||
{
|
||||
assert(lua_gettop(L) == top + 1);
|
||||
#ifndef LUABIND_NO_EXCEPTIONS
|
||||
throw cast_failed(L, typeid(Ret));
|
||||
#else
|
||||
cast_failed_callback_fun e = get_cast_failed_callback();
|
||||
if (e) e(L, typeid(Ret));
|
||||
|
||||
assert(0 && "the lua function's return value could not be converted."
|
||||
"If you want to handle this error use luabind::set_error_callback()");
|
||||
std::terminate();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
return converter.apply(L, LUABIND_DECORATE_TYPE(Ret), -1);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
lua_State* L;
|
||||
Tuple m_args;
|
||||
mutable bool m_called;
|
||||
|
||||
};
|
||||
|
||||
// if the proxy_member_caller returns void
|
||||
template<class Tuple>
|
||||
class proxy_member_void_caller
|
||||
{
|
||||
friend class luabind::object;
|
||||
public:
|
||||
|
||||
proxy_member_void_caller(lua_State* L_, const Tuple args)
|
||||
: L(L_)
|
||||
, m_args(args)
|
||||
, m_called(false)
|
||||
{
|
||||
}
|
||||
|
||||
proxy_member_void_caller(const proxy_member_void_caller& rhs)
|
||||
: L(rhs.L)
|
||||
, m_args(rhs.m_args)
|
||||
, m_called(rhs.m_called)
|
||||
{
|
||||
rhs.m_called = true;
|
||||
}
|
||||
|
||||
~proxy_member_void_caller()
|
||||
{
|
||||
if (m_called) return;
|
||||
|
||||
m_called = true;
|
||||
|
||||
// don't count the function and self-reference
|
||||
// since those will be popped by pcall
|
||||
int top = lua_gettop(L) - 2;
|
||||
|
||||
// pcall will pop the function and self reference
|
||||
// and all the parameters
|
||||
|
||||
push_args_from_tuple<1>::apply(L, m_args);
|
||||
if (pcall(L, boost::tuples::length<Tuple>::value + 1, 0))
|
||||
{
|
||||
assert(lua_gettop(L) == top + 1);
|
||||
#ifndef LUABIND_NO_EXCEPTIONS
|
||||
throw luabind::error(L);
|
||||
#else
|
||||
error_callback_fun e = get_error_callback();
|
||||
if (e) e(L);
|
||||
|
||||
assert(0 && "the lua function threw an error and exceptions are disabled."
|
||||
"If you want to handle this error use luabind::set_error_callback()");
|
||||
std::terminate();
|
||||
#endif
|
||||
}
|
||||
// pops the return values from the function
|
||||
stack_pop pop(L, lua_gettop(L) - top);
|
||||
}
|
||||
|
||||
template<class Policies>
|
||||
void operator[](const Policies& p)
|
||||
{
|
||||
m_called = true;
|
||||
|
||||
// don't count the function and self-reference
|
||||
// since those will be popped by pcall
|
||||
int top = lua_gettop(L) - 2;
|
||||
|
||||
// pcall will pop the function and self reference
|
||||
// and all the parameters
|
||||
|
||||
detail::push_args_from_tuple<1>::apply(L, m_args, p);
|
||||
if (pcall(L, boost::tuples::length<Tuple>::value + 1, 0))
|
||||
{
|
||||
assert(lua_gettop(L) == top + 1);
|
||||
#ifndef LUABIND_NO_EXCEPTIONS
|
||||
throw error(L);
|
||||
#else
|
||||
error_callback_fun e = get_error_callback();
|
||||
if (e) e(L);
|
||||
|
||||
assert(0 && "the lua function threw an error and exceptions are disabled."
|
||||
"If you want to handle this error use luabind::set_error_callback()");
|
||||
std::terminate();
|
||||
#endif
|
||||
}
|
||||
// pops the return values from the function
|
||||
stack_pop pop(L, lua_gettop(L) - top);
|
||||
}
|
||||
|
||||
private:
|
||||
lua_State* L;
|
||||
Tuple m_args;
|
||||
mutable bool m_called;
|
||||
|
||||
};
|
||||
|
||||
} // detail
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 (4, (0, LUABIND_MAX_ARITY, <luabind/detail/call_member.hpp>, 1))
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
}
|
||||
|
||||
#endif // LUABIND_CALL_MEMBER_HPP_INCLUDED
|
||||
|
||||
#else
|
||||
#if BOOST_PP_ITERATION_FLAGS() == 1
|
||||
|
||||
#define LUABIND_TUPLE_PARAMS(z, n, data) const A##n *
|
||||
#define LUABIND_OPERATOR_PARAMS(z, n, data) const A##n & a##n
|
||||
|
||||
template<class R BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), class A)>
|
||||
typename boost::mpl::if_<boost::is_void<R>
|
||||
, luabind::detail::proxy_member_void_caller<boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> >
|
||||
, luabind::detail::proxy_member_caller<R, boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> > >::type
|
||||
call_member(object const& obj, const char* name BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_OPERATOR_PARAMS, _))
|
||||
{
|
||||
typedef boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> tuple_t;
|
||||
#if BOOST_PP_ITERATION() == 0
|
||||
tuple_t args;
|
||||
#else
|
||||
tuple_t args(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), &a));
|
||||
#endif
|
||||
|
||||
typedef typename boost::mpl::if_<boost::is_void<R>
|
||||
, luabind::detail::proxy_member_void_caller<boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> >
|
||||
, luabind::detail::proxy_member_caller<R, boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> > >::type proxy_type;
|
||||
|
||||
// this will be cleaned up by the proxy object
|
||||
// once the call has been made
|
||||
|
||||
// get the function
|
||||
obj.push(obj.interpreter());
|
||||
lua_pushstring(obj.interpreter(), name);
|
||||
lua_gettable(obj.interpreter(), -2);
|
||||
// duplicate the self-object
|
||||
lua_pushvalue(obj.interpreter(), -2);
|
||||
// remove the bottom self-object
|
||||
lua_remove(obj.interpreter(), -3);
|
||||
|
||||
// now the function and self objects
|
||||
// are on the stack. These will both
|
||||
// be popped by pcall
|
||||
return proxy_type(obj.interpreter(), args);
|
||||
}
|
||||
|
||||
#undef LUABIND_OPERATOR_PARAMS
|
||||
#undef LUABIND_TUPLE_PARAMS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
// Copyright (c) 2004 Daniel Wallin and Arvid Norberg
|
||||
|
||||
// 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.
|
||||
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
#define LUABIND_UNWRAP_PARAMETER(z, n, _) \
|
||||
typename detail::unwrap_parameter_type<T, BOOST_PP_CAT(A, n)>::type \
|
||||
BOOST_PP_CAT(_, n)
|
||||
|
||||
template<class Self BOOST_PP_ENUM_TRAILING_PARAMS(N, class A)>
|
||||
struct BOOST_PP_CAT(call_operator, N)
|
||||
: detail::operator_<
|
||||
BOOST_PP_CAT(call_operator, N)<
|
||||
Self BOOST_PP_ENUM_TRAILING_PARAMS(N, A)
|
||||
>
|
||||
>
|
||||
{
|
||||
BOOST_PP_CAT(call_operator, N)(int) {}
|
||||
|
||||
template<class T, class Policies>
|
||||
struct apply
|
||||
{
|
||||
static void execute(
|
||||
lua_State* L
|
||||
, typename detail::unwrap_parameter_type<T, Self>::type self
|
||||
BOOST_PP_ENUM_TRAILING(N, LUABIND_UNWRAP_PARAMETER, _)
|
||||
)
|
||||
{
|
||||
using namespace detail;
|
||||
operator_result(
|
||||
L
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
||||
, self(BOOST_PP_ENUM_PARAMS(N, _))
|
||||
#else
|
||||
, (self(BOOST_PP_ENUM_PARAMS(N, _)), detail::operator_void_return())
|
||||
#endif
|
||||
, (Policies*)0
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
static char const* name() { return "__call"; }
|
||||
};
|
||||
|
||||
#undef LUABIND_UNWRAP_PARAMETER
|
||||
#undef N
|
||||
|
||||
@@ -1,89 +0,0 @@
|
||||
// Copyright (c) 2004 Daniel Wallin
|
||||
|
||||
// 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.
|
||||
|
||||
#ifndef CLASS_CACHE_040218_HPP
|
||||
#define CLASS_CACHE_040218_HPP
|
||||
|
||||
#include <luabind/prefix.hpp>
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
#include <boost/type_traits/add_const.hpp>
|
||||
|
||||
namespace luabind { namespace detail {
|
||||
|
||||
#ifdef LUABIND_NOT_THREADSAFE
|
||||
|
||||
class class_rep;
|
||||
|
||||
template<class T>
|
||||
struct class_cache_impl
|
||||
{
|
||||
static lua_State* state;
|
||||
static class_rep* class_;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
lua_State* class_cache_impl<T>::state = 0;
|
||||
|
||||
template<class T>
|
||||
class_rep* class_cache_impl<T>::class_ = 0;
|
||||
|
||||
template<class T>
|
||||
struct class_cache
|
||||
: class_cache_impl<
|
||||
typename boost::add_reference<
|
||||
typename boost::add_const<
|
||||
T
|
||||
>::type
|
||||
>::type
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
template<class T>
|
||||
class_rep* get_class_rep(lua_State* L, void(*)(T*) = 0)
|
||||
{
|
||||
if (class_cache<T>::state != L)
|
||||
{
|
||||
class_cache<T>::state = L;
|
||||
|
||||
class_registry* registry = class_registry::get_registry(L);
|
||||
class_cache<T>::class_ = registry->find_class(typeid(T));
|
||||
}
|
||||
|
||||
return class_cache<T>::class_;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
template<class T>
|
||||
class_rep* get_class_rep(lua_State* L, void(*)(T*) = 0)
|
||||
{
|
||||
class_registry* registry = class_registry::get_registry(L);
|
||||
return registry->find_class(typeid(T));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
}} // namespace luabind::detail
|
||||
|
||||
#endif // CLASS_CACHE_040218_HPP
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
// Copyright (c) 2003 Daniel Wallin and Arvid Norberg
|
||||
|
||||
// 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.
|
||||
|
||||
|
||||
#ifndef LUABIND_CLASS_REGISTRY_HPP_INCLUDED
|
||||
#define LUABIND_CLASS_REGISTRY_HPP_INCLUDED
|
||||
|
||||
#include <map>
|
||||
|
||||
#include <luabind/config.hpp>
|
||||
#include <luabind/open.hpp>
|
||||
#include <luabind/typeid.hpp>
|
||||
|
||||
namespace luabind { namespace detail
|
||||
{
|
||||
class class_rep;
|
||||
|
||||
struct LUABIND_API class_registry
|
||||
{
|
||||
class_registry(lua_State* L);
|
||||
|
||||
static class_registry* get_registry(lua_State* L);
|
||||
|
||||
int cpp_instance() const { return m_instance_metatable; }
|
||||
int cpp_class() const { return m_cpp_class_metatable; }
|
||||
|
||||
int lua_instance() const { return m_instance_metatable; }
|
||||
int lua_class() const { return m_lua_class_metatable; }
|
||||
int lua_function() const { return m_lua_function_metatable; }
|
||||
|
||||
void add_class(type_id const& info, class_rep* crep);
|
||||
|
||||
class_rep* find_class(type_id const& info) const;
|
||||
|
||||
std::map<type_id, class_rep*> const& get_classes() const
|
||||
{
|
||||
return m_classes;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
std::map<type_id, class_rep*> m_classes;
|
||||
|
||||
// this is a lua reference that points to the lua table
|
||||
// that is to be used as meta table for all C++ class
|
||||
// instances. It is a kind of v-table.
|
||||
int m_instance_metatable;
|
||||
|
||||
// this is a lua reference to the metatable to be used
|
||||
// for all classes defined in C++.
|
||||
int m_cpp_class_metatable;
|
||||
|
||||
// this is a lua reference to the metatable to be used
|
||||
// for all classes defined in lua
|
||||
int m_lua_class_metatable;
|
||||
|
||||
// this metatable only contains a destructor
|
||||
// for luabind::Detail::free_functions::function_rep
|
||||
int m_lua_function_metatable;
|
||||
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#endif // LUABIND_CLASS_REGISTRY_HPP_INCLUDED
|
||||
|
||||
@@ -1,213 +0,0 @@
|
||||
// Copyright (c) 2003 Daniel Wallin and Arvid Norberg
|
||||
|
||||
// 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.
|
||||
|
||||
|
||||
#ifndef LUABIND_CLASS_REP_HPP_INCLUDED
|
||||
#define LUABIND_CLASS_REP_HPP_INCLUDED
|
||||
|
||||
#include <boost/limits.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <luabind/config.hpp>
|
||||
#include <luabind/lua_include.hpp>
|
||||
#include <luabind/detail/object_rep.hpp>
|
||||
#include <luabind/detail/garbage_collector.hpp>
|
||||
#include <luabind/detail/operator_id.hpp>
|
||||
#include <luabind/detail/class_registry.hpp>
|
||||
#include <luabind/error.hpp>
|
||||
#include <luabind/handle.hpp>
|
||||
#include <luabind/detail/primitives.hpp>
|
||||
#include <luabind/typeid.hpp>
|
||||
#include <luabind/detail/ref.hpp>
|
||||
|
||||
namespace luabind { namespace detail
|
||||
{
|
||||
|
||||
LUABIND_API std::string stack_content_by_name(lua_State* L, int start_index);
|
||||
|
||||
struct class_registration;
|
||||
|
||||
struct conversion_storage;
|
||||
|
||||
// This function is used as a tag to identify "properties".
|
||||
LUABIND_API int property_tag(lua_State*);
|
||||
|
||||
// this is class-specific information, poor man's vtable
|
||||
// this is allocated statically (removed by the compiler)
|
||||
// a pointer to this structure is stored in the lua tables'
|
||||
// metatable with the name __classrep
|
||||
// it is used when matching parameters to function calls
|
||||
// to determine possible implicit casts
|
||||
// it is also used when finding the best match for overloaded
|
||||
// methods
|
||||
|
||||
class cast_graph;
|
||||
class class_id_map;
|
||||
|
||||
class LUABIND_API class_rep
|
||||
{
|
||||
friend struct class_registration;
|
||||
friend int super_callback(lua_State*);
|
||||
//TODO: avoid the lua-prefix
|
||||
friend int lua_class_gettable(lua_State*);
|
||||
friend int lua_class_settable(lua_State*);
|
||||
friend int static_class_gettable(lua_State*);
|
||||
public:
|
||||
|
||||
enum class_type
|
||||
{
|
||||
cpp_class = 0,
|
||||
lua_class = 1
|
||||
};
|
||||
|
||||
// EXPECTS THE TOP VALUE ON THE LUA STACK TO
|
||||
// BE THE USER DATA WHERE THIS CLASS IS BEING
|
||||
// INSTANTIATED!
|
||||
class_rep(type_id const& type
|
||||
, const char* name
|
||||
, lua_State* L
|
||||
);
|
||||
|
||||
// used when creating a lua class
|
||||
// EXPECTS THE TOP VALUE ON THE LUA STACK TO
|
||||
// BE THE USER DATA WHERE THIS CLASS IS BEING
|
||||
// INSTANTIATED!
|
||||
class_rep(lua_State* L, const char* name);
|
||||
|
||||
~class_rep();
|
||||
|
||||
std::pair<void*,void*> allocate(lua_State* L) const;
|
||||
|
||||
// this is called as metamethod __call on the class_rep.
|
||||
static int constructor_dispatcher(lua_State* L);
|
||||
|
||||
struct base_info
|
||||
{
|
||||
int pointer_offset; // the offset added to the pointer to obtain a basepointer (due to multiple-inheritance)
|
||||
class_rep* base;
|
||||
};
|
||||
|
||||
void add_base_class(const base_info& binfo);
|
||||
|
||||
const std::vector<base_info>& bases() const throw() { return m_bases; }
|
||||
|
||||
void set_type(type_id const& t) { m_type = t; }
|
||||
type_id const& type() const throw() { return m_type; }
|
||||
|
||||
const char* name() const throw() { return m_name; }
|
||||
|
||||
// the lua reference to the metatable for this class' instances
|
||||
int metatable_ref() const throw() { return m_instance_metatable; }
|
||||
|
||||
void get_table(lua_State* L) const { m_table.push(L); }
|
||||
void get_default_table(lua_State* L) const { m_default_table.push(L); }
|
||||
|
||||
class_type get_class_type() const { return m_class_type; }
|
||||
|
||||
void add_static_constant(const char* name, int val);
|
||||
|
||||
static int super_callback(lua_State* L);
|
||||
|
||||
static int lua_settable_dispatcher(lua_State* L);
|
||||
|
||||
// called from the metamethod for __index
|
||||
// obj is the object pointer
|
||||
static int static_class_gettable(lua_State* L);
|
||||
|
||||
bool has_operator_in_lua(lua_State*, int id);
|
||||
|
||||
cast_graph const& casts() const
|
||||
{
|
||||
return *m_casts;
|
||||
}
|
||||
|
||||
class_id_map const& classes() const
|
||||
{
|
||||
return *m_classes;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
void cache_operators(lua_State*);
|
||||
|
||||
// this is a pointer to the type_info structure for
|
||||
// this type
|
||||
// warning: this may be a problem when using dll:s, since
|
||||
// typeid() may actually return different pointers for the same
|
||||
// type.
|
||||
type_id m_type;
|
||||
|
||||
// a list of info for every class this class derives from
|
||||
// the information stored here is sufficient to do
|
||||
// type casts to the base classes
|
||||
std::vector<base_info> m_bases;
|
||||
|
||||
// the class' name (as given when registered to lua with class_)
|
||||
const char* m_name;
|
||||
|
||||
// a reference to this structure itself. Since this struct
|
||||
// is kept inside lua (to let lua collect it when lua_close()
|
||||
// is called) we need to lock it to prevent collection.
|
||||
// the actual reference is not currently used.
|
||||
detail::lua_reference m_self_ref;
|
||||
|
||||
// this should always be used when accessing
|
||||
// members in instances of a class.
|
||||
// this table contains c closures for all
|
||||
// member functions in this class, they
|
||||
// may point to both static and virtual functions
|
||||
handle m_table;
|
||||
|
||||
// this table contains default implementations of the
|
||||
// virtual functions in m_table.
|
||||
handle m_default_table;
|
||||
|
||||
// the type of this class.. determines if it's written in c++ or lua
|
||||
class_type m_class_type;
|
||||
|
||||
// this is a lua reference that points to the lua table
|
||||
// that is to be used as meta table for all instances
|
||||
// of this class.
|
||||
int m_instance_metatable;
|
||||
|
||||
std::map<const char*, int, ltstr> m_static_constants;
|
||||
|
||||
// the first time an operator is invoked
|
||||
// we check the associated lua table
|
||||
// and cache the result
|
||||
int m_operator_cache;
|
||||
|
||||
cast_graph* m_casts;
|
||||
class_id_map* m_classes;
|
||||
};
|
||||
|
||||
bool is_class_rep(lua_State* L, int index);
|
||||
|
||||
}}
|
||||
|
||||
//#include <luabind/detail/overload_rep_impl.hpp>
|
||||
|
||||
#endif // LUABIND_CLASS_REP_HPP_INCLUDED
|
||||
@@ -1,73 +0,0 @@
|
||||
// Copyright Daniel Wallin 2008. Use, modification and distribution is
|
||||
// subject to the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef LUABIND_COMPUTE_RANK_081006_HPP
|
||||
# define LUABIND_COMPUTE_RANK_081006_HPP
|
||||
|
||||
# include <luabind/config.hpp>
|
||||
# include <luabind/detail/policy.hpp>
|
||||
# include <boost/mpl/apply_wrap.hpp>
|
||||
# include <boost/mpl/begin_end.hpp>
|
||||
# include <boost/mpl/int.hpp>
|
||||
# include <boost/mpl/next.hpp>
|
||||
|
||||
namespace luabind { namespace detail {
|
||||
|
||||
namespace mpl = boost::mpl;
|
||||
|
||||
template <class Idx, class Iter, class End, class Policies>
|
||||
int compute_score_aux(
|
||||
lua_State*L, int index, Idx, Iter, End end, Policies const& policies)
|
||||
{
|
||||
typedef typename Iter::type arg_type;
|
||||
typedef typename find_conversion_policy<Idx::value, Policies>::type
|
||||
conversion_policy;
|
||||
typedef typename mpl::apply_wrap2<
|
||||
conversion_policy, arg_type, lua_to_cpp>::type converter;
|
||||
|
||||
int score = converter::match(L, LUABIND_DECORATE_TYPE(arg_type), index);
|
||||
|
||||
if (score < 0)
|
||||
return score;
|
||||
|
||||
if (conversion_policy::has_arg)
|
||||
++index;
|
||||
|
||||
int next = compute_score_aux(
|
||||
L
|
||||
, index
|
||||
, typename mpl::next<Idx>::type()
|
||||
, typename mpl::next<Iter>::type()
|
||||
, end
|
||||
, policies
|
||||
);
|
||||
|
||||
if (next < 0)
|
||||
return next;
|
||||
|
||||
return score + next;
|
||||
}
|
||||
|
||||
template <class Idx, class End, class Policies>
|
||||
int compute_score_aux(lua_State*, int, Idx, End, End, Policies const&)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <class Signature, class Policies>
|
||||
int compute_score(lua_State* L, Signature, Policies const& policies)
|
||||
{
|
||||
return compute_score_aux(
|
||||
L
|
||||
, 1
|
||||
, mpl::int_<1>()
|
||||
, typename mpl::next<typename mpl::begin<Signature>::type>::type()
|
||||
, typename mpl::end<Signature>::type()
|
||||
, policies
|
||||
);
|
||||
}
|
||||
|
||||
}} // namespace luabind::detail
|
||||
|
||||
#endif // LUABIND_COMPUTE_RANK_081006_HPP
|
||||
@@ -1,111 +0,0 @@
|
||||
// Copyright Daniel Wallin 2008. Use, modification and distribution is
|
||||
// subject to the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#if !BOOST_PP_IS_ITERATING
|
||||
|
||||
# ifndef LUABIND_DETAIL_CONSTRUCTOR_081018_HPP
|
||||
# define LUABIND_DETAIL_CONSTRUCTOR_081018_HPP
|
||||
|
||||
# include <luabind/get_main_thread.hpp>
|
||||
# include <luabind/object.hpp>
|
||||
# include <luabind/wrapper_base.hpp>
|
||||
# include <luabind/detail/inheritance.hpp>
|
||||
|
||||
# include <boost/preprocessor/iteration/iterate.hpp>
|
||||
# include <boost/preprocessor/iteration/local.hpp>
|
||||
# include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
# include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
|
||||
namespace luabind { namespace detail {
|
||||
|
||||
inline void inject_backref(lua_State*, void*, void*)
|
||||
{}
|
||||
|
||||
template <class T>
|
||||
void inject_backref(lua_State* L, T* p, wrap_base*)
|
||||
{
|
||||
weak_ref(get_main_thread(L), L, 1).swap(wrap_access::ref(*p));
|
||||
}
|
||||
|
||||
template <std::size_t Arity, class T, class Pointer, class Signature>
|
||||
struct construct_aux;
|
||||
|
||||
template <class T, class Pointer, class Signature>
|
||||
struct construct
|
||||
: construct_aux<mpl::size<Signature>::value - 2, T, Pointer, Signature>
|
||||
{};
|
||||
|
||||
template <class T, class Pointer, class Signature>
|
||||
struct construct_aux<0, T, Pointer, Signature>
|
||||
{
|
||||
typedef pointer_holder<Pointer, T> holder_type;
|
||||
|
||||
void operator()(argument const& self_) const
|
||||
{
|
||||
object_rep* self = touserdata<object_rep>(self_);
|
||||
class_rep* cls = self->crep();
|
||||
|
||||
std::auto_ptr<T> instance(new T);
|
||||
inject_backref(self_.interpreter(), instance.get(), instance.get());
|
||||
|
||||
void* naked_ptr = instance.get();
|
||||
Pointer ptr(instance.release());
|
||||
|
||||
void* storage = self->allocate(sizeof(holder_type));
|
||||
|
||||
self->set_instance(new (storage) holder_type(
|
||||
ptr, registered_class<T>::id, naked_ptr, cls));
|
||||
}
|
||||
};
|
||||
|
||||
# define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (1, LUABIND_MAX_ARITY, <luabind/detail/constructor.hpp>))
|
||||
# include BOOST_PP_ITERATE()
|
||||
|
||||
}} // namespace luabind::detail
|
||||
|
||||
# endif // LUABIND_DETAIL_CONSTRUCTOR_081018_HPP
|
||||
|
||||
#else // !BOOST_PP_IS_ITERATING
|
||||
|
||||
# define N BOOST_PP_ITERATION()
|
||||
|
||||
template <class T, class Pointer, class Signature>
|
||||
struct construct_aux<N, T, Pointer, Signature>
|
||||
{
|
||||
typedef typename mpl::begin<Signature>::type first;
|
||||
typedef typename mpl::next<first>::type iter0;
|
||||
|
||||
# define BOOST_PP_LOCAL_MACRO(n) \
|
||||
typedef typename mpl::next< \
|
||||
BOOST_PP_CAT(iter,BOOST_PP_DEC(n))>::type BOOST_PP_CAT(iter,n); \
|
||||
typedef typename BOOST_PP_CAT(iter,n)::type BOOST_PP_CAT(a,BOOST_PP_DEC(n));
|
||||
|
||||
# define BOOST_PP_LOCAL_LIMITS (1,N)
|
||||
# include BOOST_PP_LOCAL_ITERATE()
|
||||
|
||||
typedef pointer_holder<Pointer, T> holder_type;
|
||||
|
||||
void operator()(argument const& self_, BOOST_PP_ENUM_BINARY_PARAMS(N,a,_)) const
|
||||
{
|
||||
object_rep* self = touserdata<object_rep>(self_);
|
||||
class_rep* cls = self->crep();
|
||||
|
||||
std::auto_ptr<T> instance(new T(BOOST_PP_ENUM_PARAMS(N,_)));
|
||||
inject_backref(self_.interpreter(), instance.get(), instance.get());
|
||||
|
||||
void* naked_ptr = instance.get();
|
||||
Pointer ptr(instance.release());
|
||||
|
||||
void* storage = self->allocate(sizeof(holder_type));
|
||||
|
||||
self->set_instance(new (storage) holder_type(
|
||||
ptr, registered_class<T>::id, naked_ptr, cls));
|
||||
}
|
||||
};
|
||||
|
||||
# undef N
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
// Copyright Daniel Wallin 2008. Use, modification and distribution is
|
||||
// subject to the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef LUABIND_CONVERSION_STORAGE_080930_HPP
|
||||
# define LUABIND_CONVERSION_STORAGE_080930_HPP
|
||||
|
||||
# include <luabind/config.hpp>
|
||||
# include <boost/aligned_storage.hpp>
|
||||
|
||||
namespace luabind { namespace detail {
|
||||
|
||||
typedef void(*destruction_function)(void*);
|
||||
|
||||
// This is used by the converters in policy.hpp, and
|
||||
// class_rep::convert_to as temporary storage when constructing
|
||||
// holders.
|
||||
|
||||
struct conversion_storage
|
||||
{
|
||||
conversion_storage()
|
||||
: destructor(0)
|
||||
{}
|
||||
|
||||
~conversion_storage()
|
||||
{
|
||||
if (destructor)
|
||||
destructor(&data);
|
||||
}
|
||||
|
||||
// Unfortunately the converters currently doesn't have access to
|
||||
// the actual type being converted when this is instantiated, so
|
||||
// we have to guess a max size.
|
||||
boost::aligned_storage<128> data;
|
||||
destruction_function destructor;
|
||||
};
|
||||
|
||||
}} // namespace luabind::detail
|
||||
|
||||
#endif // LUABIND_CONVERSION_STORAGE_080930_HPP
|
||||
|
||||
@@ -1,92 +0,0 @@
|
||||
// Copyright (c) 2003 Daniel Wallin and Arvid Norberg
|
||||
|
||||
// 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.
|
||||
|
||||
|
||||
#ifndef LUABIND_CONVERT_TO_LUA_HPP_INCLUDED
|
||||
#define LUABIND_CONVERT_TO_LUA_HPP_INCLUDED
|
||||
|
||||
#include <luabind/config.hpp>
|
||||
#include <luabind/detail/policy.hpp>
|
||||
#include <boost/ref.hpp>
|
||||
|
||||
#include <boost/mpl/apply_wrap.hpp>
|
||||
|
||||
namespace luabind { namespace detail
|
||||
{
|
||||
template<bool IsReferenceWrapper = false>
|
||||
struct unwrap_ref
|
||||
{
|
||||
template<class T>
|
||||
static const T& get(const T& r) { return r; }
|
||||
|
||||
template<class T>
|
||||
struct apply
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct unwrap_ref<true>
|
||||
{
|
||||
template<class T>
|
||||
static T& get(const boost::reference_wrapper<T>& r) { return r.get(); }
|
||||
|
||||
template<class T>
|
||||
struct apply
|
||||
{
|
||||
typedef typename T::type& type;
|
||||
};
|
||||
};
|
||||
|
||||
namespace mpl = boost::mpl;
|
||||
|
||||
template<class T>
|
||||
void convert_to_lua(lua_State* L, const T& v)
|
||||
{
|
||||
typedef typename mpl::apply_wrap1<
|
||||
unwrap_ref<boost::is_reference_wrapper<T>::value>
|
||||
, T
|
||||
>::type value_type;
|
||||
|
||||
typename mpl::apply_wrap2<default_policy,value_type,cpp_to_lua>::type converter;
|
||||
|
||||
converter.apply(L, unwrap_ref<boost::is_reference_wrapper<T>::value>::get(v));
|
||||
}
|
||||
|
||||
template<int Index, class T, class Policies>
|
||||
void convert_to_lua_p(lua_State* L, const T& v, const Policies&)
|
||||
{
|
||||
typedef typename mpl::apply_wrap1<
|
||||
unwrap_ref<boost::is_reference_wrapper<T>::value>
|
||||
, T
|
||||
>::type value_type;
|
||||
|
||||
typedef typename find_conversion_policy<Index, Policies>::type converter_policy;
|
||||
typename mpl::apply_wrap2<converter_policy,value_type,cpp_to_lua>::type converter;
|
||||
|
||||
converter.apply(L, unwrap_ref<boost::is_reference_wrapper<T>::value>::get(v));
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
// Copyright (c) 2003 Daniel Wallin and Arvid Norberg
|
||||
|
||||
// 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.
|
||||
|
||||
#ifndef LUABIND_DEBUG_HPP_INCLUDED
|
||||
#define LUABIND_DEBUG_HPP_INCLUDED
|
||||
|
||||
#ifndef NDEBUG
|
||||
|
||||
#include <luabind/lua_include.hpp>
|
||||
#include <cassert>
|
||||
|
||||
namespace luabind { namespace detail
|
||||
{
|
||||
struct stack_checker_type
|
||||
{
|
||||
stack_checker_type(lua_State* L)
|
||||
: m_L(L)
|
||||
, m_stack(lua_gettop(m_L))
|
||||
{}
|
||||
|
||||
~stack_checker_type()
|
||||
{
|
||||
assert(m_stack == lua_gettop(m_L));
|
||||
}
|
||||
|
||||
lua_State* m_L;
|
||||
int m_stack;
|
||||
};
|
||||
|
||||
}}
|
||||
#define LUABIND_CHECK_STACK(L) luabind::detail::stack_checker_type stack_checker_object(L)
|
||||
#else
|
||||
#define LUABIND_CHECK_STACK(L) do {} while (0)
|
||||
#endif
|
||||
|
||||
#endif // LUABIND_DEBUG_HPP_INCLUDED
|
||||
@@ -1,266 +0,0 @@
|
||||
// Copyright (c) 2003 Daniel Wallin and Arvid Norberg
|
||||
|
||||
// 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.
|
||||
|
||||
|
||||
#ifndef LUABIND_DECORATE_TYPE_HPP_INCLUDED
|
||||
#define LUABIND_DECORATE_TYPE_HPP_INCLUDED
|
||||
|
||||
#include <luabind/config.hpp>
|
||||
#include <luabind/detail/primitives.hpp>
|
||||
|
||||
namespace luabind { namespace detail
|
||||
{
|
||||
|
||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
template<class T>
|
||||
struct decorated_type
|
||||
{
|
||||
static by_value<T> t;
|
||||
static inline by_value<T>& get() { return /*by_value<T>()*/t; }
|
||||
};
|
||||
|
||||
template<class T>
|
||||
by_value<T> decorated_type<T>::t;
|
||||
|
||||
template<class T>
|
||||
struct decorated_type<T*>
|
||||
{
|
||||
static by_pointer<T> t;
|
||||
static inline by_pointer<T>& get() { return /*by_pointer<T>()*/t; }
|
||||
};
|
||||
|
||||
template<class T>
|
||||
by_pointer<T> decorated_type<T*>::t;
|
||||
|
||||
template<class T>
|
||||
struct decorated_type<const T*>
|
||||
{
|
||||
static by_const_pointer<T> t;
|
||||
static inline by_const_pointer<T> get() { return /*by_const_pointer<T>()*/t; }
|
||||
};
|
||||
|
||||
template<class T>
|
||||
by_const_pointer<T> decorated_type<const T*>::t;
|
||||
|
||||
template<class T>
|
||||
struct decorated_type<const T* const>
|
||||
{
|
||||
static by_const_pointer<T> t;
|
||||
static inline by_const_pointer<T>& get() { return /*by_const_pointer<T>()*/t; }
|
||||
};
|
||||
|
||||
template<class T>
|
||||
by_const_pointer<T> decorated_type<const T* const>::t;
|
||||
|
||||
template<class T>
|
||||
struct decorated_type<T&>
|
||||
{
|
||||
static by_reference<T> t;
|
||||
static inline by_reference<T>& get() { return /*by_reference<T>()*/t; }
|
||||
};
|
||||
|
||||
template<class T>
|
||||
by_reference<T> decorated_type<T&>::t;
|
||||
|
||||
template<class T>
|
||||
struct decorated_type<const T&>
|
||||
{
|
||||
static by_const_reference<T> t;
|
||||
static inline by_const_reference<T>& get() { return /*by_const_reference<T>()*/t; }
|
||||
};
|
||||
|
||||
template<class T>
|
||||
by_const_reference<T> decorated_type<const T&>::t;
|
||||
|
||||
#define LUABIND_DECORATE_TYPE(t) luabind::detail::decorated_type<t>::get()
|
||||
|
||||
#else
|
||||
|
||||
#include <boost/type_traits/is_array.hpp>
|
||||
|
||||
namespace
|
||||
{
|
||||
LUABIND_ANONYMOUS_FIX char decorated_type_array[64];
|
||||
}
|
||||
|
||||
template<class T>
|
||||
struct decorated_type_cref_impl
|
||||
{
|
||||
#if defined(BOOST_MSVC) && BOOST_MSVC == 1200
|
||||
template<class U>
|
||||
static by_const_reference<U> get(const U&)
|
||||
{
|
||||
return by_const_reference<U>();
|
||||
}
|
||||
static T data() { return reinterpret_cast<T>(decorated_type_array); }
|
||||
#else
|
||||
|
||||
static void(*data())(T)
|
||||
{ return (void(*)(T))0; }
|
||||
|
||||
template<class U>
|
||||
static by_const_reference<U> get(void(*f)(const U&))
|
||||
{ return by_const_reference<U>(); }
|
||||
#endif
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct decorated_type_ref_impl
|
||||
{
|
||||
#if defined(BOOST_MSVC) && BOOST_MSVC == 1200
|
||||
template<class U>
|
||||
static by_reference<U> get(U&)
|
||||
{
|
||||
return by_reference<U>();
|
||||
}
|
||||
static T data() { return reinterpret_cast<T>(decorated_type_array); }
|
||||
#else
|
||||
static void(*data())(T)
|
||||
{ return (void(*)(T))0; }
|
||||
|
||||
template<class U>
|
||||
static by_reference<U> get(void(*)(U&))
|
||||
{ return by_reference<U>(); }
|
||||
#endif
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct decorated_type_cptr_impl
|
||||
{
|
||||
#if defined(BOOST_MSVC) && BOOST_MSVC == 1200
|
||||
template<class U>
|
||||
static by_const_pointer<U> get(const U*)
|
||||
{
|
||||
return by_const_pointer<U>();
|
||||
}
|
||||
static T& data() { return reinterpret_cast<T&>(decorated_type_array); }
|
||||
#else
|
||||
static void(*data())(T)
|
||||
{ return (void(*)(T))0; }
|
||||
|
||||
template<class U>
|
||||
static by_const_pointer<U> get(void(*)(const U*))
|
||||
{ return by_const_pointer<U>(); }
|
||||
#endif
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct decorated_type_ptr_impl
|
||||
{
|
||||
#if defined(BOOST_MSVC) && BOOST_MSVC == 1200
|
||||
template<class U>
|
||||
static by_pointer<U> get(U*)
|
||||
{
|
||||
return by_pointer<U>();
|
||||
}
|
||||
static T& data() { return reinterpret_cast<T&>(decorated_type_array); }
|
||||
#else
|
||||
static void(*data())(T)
|
||||
{ return (void(*)(T))0; }
|
||||
|
||||
template<class U>
|
||||
static by_pointer<U> get(void(*)(U*))
|
||||
{ return by_pointer<U>(); }
|
||||
#endif
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct decorated_type_value_impl
|
||||
{
|
||||
#if defined(BOOST_MSVC) && BOOST_MSVC == 1200
|
||||
template<class U>
|
||||
static by_value<U> get(U&)
|
||||
{
|
||||
return by_value<U>();
|
||||
}
|
||||
static T& data() { return reinterpret_cast<T&>(decorated_type_array); }
|
||||
#else
|
||||
static void(*data())(T&)
|
||||
{ return (void(*)(T&))0; }
|
||||
|
||||
template<class U>
|
||||
static by_value<U> get(void(*)(U&))
|
||||
{ return by_value<U>(); }
|
||||
#endif
|
||||
};
|
||||
|
||||
template<>
|
||||
struct decorated_type_value_impl<void>
|
||||
{
|
||||
static by_value<void> get(int)
|
||||
{
|
||||
return by_value<void>();
|
||||
}
|
||||
static int data() { return 0; }
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct decorated_type_array_impl
|
||||
{
|
||||
template<class U>
|
||||
static by_pointer<U> get(U*)
|
||||
{
|
||||
return by_pointer<U>();
|
||||
}
|
||||
|
||||
template<class U>
|
||||
static by_pointer<U> get(void(*)(U))
|
||||
{ return by_pointer<U>(); }
|
||||
|
||||
static T& data() { return reinterpret_cast<T&>(decorated_type_array); }
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct decorated_type
|
||||
// : boost::mpl::if_<boost::is_array<T>
|
||||
// , decorated_type_array_impl<T>
|
||||
: boost::mpl::if_<luabind::detail::is_const_reference<T>
|
||||
, decorated_type_cref_impl<T>
|
||||
, typename boost::mpl::if_<luabind::detail::is_nonconst_reference<T>
|
||||
, decorated_type_ref_impl<T>
|
||||
, typename boost::mpl::if_<luabind::detail::is_nonconst_pointer<T>
|
||||
, decorated_type_ptr_impl<T>
|
||||
, typename boost::mpl::if_<luabind::detail::is_const_pointer<T>
|
||||
, decorated_type_cptr_impl<T>
|
||||
, decorated_type_value_impl<T>
|
||||
>::type
|
||||
>::type
|
||||
>::type
|
||||
>::type
|
||||
// >::type
|
||||
{
|
||||
};
|
||||
|
||||
#if defined(BOOST_MSVC) && BOOST_MSVC == 1200
|
||||
#define LUABIND_DECORATE_TYPE(t) luabind::detail::decorated_type<t>::get(luabind::detail::decorated_type<t>::data())
|
||||
#else
|
||||
// #define LUABIND_DECORATE_TYPE(t) luabind::detail::decorated_type<t>::get((void(*)(type<t>))0)
|
||||
#define LUABIND_DECORATE_TYPE(t) luabind::detail::decorated_type<t>::get(luabind::detail::decorated_type<t>::data())
|
||||
//#define LUABIND_DECORATE_TYPE(t) luabind::detail::decorated_type<t>::get(type<t>())
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
}}
|
||||
|
||||
#endif // LUABIND_DECORATE_TYPE_HPP_INCLUDED
|
||||
@@ -1,118 +0,0 @@
|
||||
// Copyright Daniel Wallin 2008. Use, modification and distribution is
|
||||
// subject to the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#if !BOOST_PP_IS_ITERATING
|
||||
|
||||
# ifndef LUABIND_DEDUCE_SIGNATURE_080911_HPP
|
||||
# define LUABIND_DEDUCE_SIGNATURE_080911_HPP
|
||||
|
||||
# include <luabind/detail/most_derived.hpp>
|
||||
|
||||
# if LUABIND_MAX_ARITY <= 8
|
||||
# include <boost/mpl/vector/vector10.hpp>
|
||||
# else
|
||||
# include <boost/mpl/vector/vector50.hpp>
|
||||
# endif
|
||||
# include <boost/preprocessor/cat.hpp>
|
||||
# include <boost/preprocessor/iteration/iterate.hpp>
|
||||
# include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
|
||||
namespace luabind { namespace detail {
|
||||
|
||||
namespace mpl = boost::mpl;
|
||||
|
||||
template <class R>
|
||||
mpl::vector1<R> deduce_signature(R(*)(), ...)
|
||||
{
|
||||
return mpl::vector1<R>();
|
||||
}
|
||||
|
||||
template <class R, class T>
|
||||
mpl::vector2<R,T&> deduce_signature(R(T::*)())
|
||||
{
|
||||
return mpl::vector2<R,T&>();
|
||||
}
|
||||
|
||||
template <class R, class T, class Wrapped>
|
||||
mpl::vector2<R,typename most_derived<T,Wrapped>::type&>
|
||||
deduce_signature(R(T::*)(), Wrapped*)
|
||||
{
|
||||
return mpl::vector2<R,typename most_derived<T,Wrapped>::type&>();
|
||||
}
|
||||
|
||||
template <class R, class T>
|
||||
mpl::vector2<R,T const&> deduce_signature(R(T::*)() const)
|
||||
{
|
||||
return mpl::vector2<R,T const&>();
|
||||
}
|
||||
|
||||
template <class R, class T, class Wrapped>
|
||||
mpl::vector2<R,typename most_derived<T,Wrapped>::type const&>
|
||||
deduce_signature(R(T::*)() const, Wrapped*)
|
||||
{
|
||||
return mpl::vector2<R,typename most_derived<T,Wrapped>::type const&>();
|
||||
}
|
||||
|
||||
# define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (1, LUABIND_MAX_ARITY, <luabind/detail/deduce_signature.hpp>))
|
||||
# include BOOST_PP_ITERATE()
|
||||
|
||||
}} // namespace luabind::detail
|
||||
|
||||
# endif // LUABIND_DEDUCE_SIGNATURE_080911_HPP
|
||||
|
||||
#else // BOOST_PP_IS_ITERATING
|
||||
|
||||
# define N BOOST_PP_ITERATION()
|
||||
# define NPLUS1 BOOST_PP_INC(N)
|
||||
|
||||
template <class R, BOOST_PP_ENUM_PARAMS(N,class A)>
|
||||
BOOST_PP_CAT(mpl::vector,NPLUS1)<R, BOOST_PP_ENUM_PARAMS(N,A)>
|
||||
deduce_signature(R(*)(BOOST_PP_ENUM_PARAMS(N,A)), ...)
|
||||
{
|
||||
return BOOST_PP_CAT(mpl::vector,NPLUS1)<R,BOOST_PP_ENUM_PARAMS(N,A)>();
|
||||
}
|
||||
|
||||
# define NPLUS2 BOOST_PP_INC(NPLUS1)
|
||||
|
||||
template <class R, class T, BOOST_PP_ENUM_PARAMS(N,class A)>
|
||||
BOOST_PP_CAT(mpl::vector,NPLUS2)<R, T&, BOOST_PP_ENUM_PARAMS(N,A)>
|
||||
deduce_signature(R(T::*)(BOOST_PP_ENUM_PARAMS(N,A)))
|
||||
{
|
||||
return BOOST_PP_CAT(mpl::vector,NPLUS2)<R,T&,BOOST_PP_ENUM_PARAMS(N,A)>();
|
||||
}
|
||||
|
||||
template <class R, class T, BOOST_PP_ENUM_PARAMS(N,class A), class Wrapped>
|
||||
BOOST_PP_CAT(mpl::vector,NPLUS2)<
|
||||
R, typename most_derived<T,Wrapped>::type&, BOOST_PP_ENUM_PARAMS(N,A)
|
||||
>
|
||||
deduce_signature(R(T::*)(BOOST_PP_ENUM_PARAMS(N,A)), Wrapped*)
|
||||
{
|
||||
return BOOST_PP_CAT(mpl::vector,NPLUS2)<
|
||||
R,typename most_derived<T,Wrapped>::type&,BOOST_PP_ENUM_PARAMS(N,A)>();
|
||||
}
|
||||
|
||||
template <class R, class T, BOOST_PP_ENUM_PARAMS(N,class A)>
|
||||
BOOST_PP_CAT(mpl::vector,NPLUS2)<R, T const&, BOOST_PP_ENUM_PARAMS(N,A)>
|
||||
deduce_signature(R(T::*)(BOOST_PP_ENUM_PARAMS(N,A)) const)
|
||||
{
|
||||
return BOOST_PP_CAT(mpl::vector,NPLUS2)<R,T const&,BOOST_PP_ENUM_PARAMS(N,A)>();
|
||||
}
|
||||
|
||||
template <class R, class T, BOOST_PP_ENUM_PARAMS(N,class A), class Wrapped>
|
||||
BOOST_PP_CAT(mpl::vector,NPLUS2)<
|
||||
R, typename most_derived<T,Wrapped>::type const&, BOOST_PP_ENUM_PARAMS(N,A)
|
||||
>
|
||||
deduce_signature(R(T::*)(BOOST_PP_ENUM_PARAMS(N,A)) const, Wrapped*)
|
||||
{
|
||||
return BOOST_PP_CAT(mpl::vector,NPLUS2)<
|
||||
R,typename most_derived<T,Wrapped>::type const&,BOOST_PP_ENUM_PARAMS(N,A)>();
|
||||
}
|
||||
|
||||
# undef NPLUS2
|
||||
# undef NPLUS1
|
||||
# undef N
|
||||
|
||||
#endif // BOOST_PP_IS_ITERATING
|
||||
|
||||
@@ -1,123 +0,0 @@
|
||||
// Copyright (c) 2003 Daniel Wallin and Arvid Norberg
|
||||
|
||||
// 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.
|
||||
|
||||
|
||||
#ifndef LUABIND_ENUM_MAKER_HPP_INCLUDED
|
||||
#define LUABIND_ENUM_MAKER_HPP_INCLUDED
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include <luabind/config.hpp>
|
||||
#include <luabind/detail/class_rep.hpp>
|
||||
|
||||
namespace luabind
|
||||
{
|
||||
struct value;
|
||||
|
||||
struct value_vector : public std::vector<value>
|
||||
{
|
||||
// a bug in intel's compiler forces us to declare these constructors explicitly.
|
||||
value_vector();
|
||||
virtual ~value_vector();
|
||||
value_vector(const value_vector& v);
|
||||
value_vector& operator,(const value& rhs);
|
||||
};
|
||||
|
||||
struct value
|
||||
{
|
||||
friend class std::vector<value>;
|
||||
template<class T>
|
||||
value(const char* name, T v)
|
||||
: name_(name)
|
||||
, val_(v)
|
||||
{}
|
||||
|
||||
const char* name_;
|
||||
int val_;
|
||||
|
||||
value_vector operator,(const value& rhs) const
|
||||
{
|
||||
value_vector v;
|
||||
|
||||
v.push_back(*this);
|
||||
v.push_back(rhs);
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
value() {}
|
||||
};
|
||||
|
||||
inline value_vector::value_vector()
|
||||
: std::vector<value>()
|
||||
{
|
||||
}
|
||||
|
||||
inline value_vector::~value_vector() {}
|
||||
|
||||
inline value_vector::value_vector(const value_vector& rhs)
|
||||
: std::vector<value>(rhs)
|
||||
{
|
||||
}
|
||||
|
||||
inline value_vector& value_vector::operator,(const value& rhs)
|
||||
{
|
||||
push_back(rhs);
|
||||
return *this;
|
||||
}
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template<class From>
|
||||
struct enum_maker
|
||||
{
|
||||
explicit enum_maker(From& from): from_(from) {}
|
||||
|
||||
From& operator[](const value& val)
|
||||
{
|
||||
from_.add_static_constant(val.name_, val.val_);
|
||||
return from_;
|
||||
}
|
||||
|
||||
From& operator[](const value_vector& values)
|
||||
{
|
||||
for (value_vector::const_iterator i = values.begin(); i != values.end(); ++i)
|
||||
{
|
||||
from_.add_static_constant(i->name_, i->val_);
|
||||
}
|
||||
|
||||
return from_;
|
||||
}
|
||||
|
||||
From& from_;
|
||||
|
||||
private:
|
||||
void operator=(enum_maker const&); // C4512, assignment operator could not be generated
|
||||
template<class T> void operator,(T const&) const;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // LUABIND_ENUM_MAKER_HPP_INCLUDED
|
||||
@@ -1,153 +0,0 @@
|
||||
// Copyright Daniel Wallin 2008. Use, modification and distribution is
|
||||
// subject to the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef LUABIND_FORMAT_SIGNATURE_081014_HPP
|
||||
# define LUABIND_FORMAT_SIGNATURE_081014_HPP
|
||||
|
||||
# include <luabind/config.hpp>
|
||||
# include <luabind/lua_include.hpp>
|
||||
# include <luabind/typeid.hpp>
|
||||
|
||||
# include <boost/mpl/begin_end.hpp>
|
||||
# include <boost/mpl/next.hpp>
|
||||
# include <boost/mpl/size.hpp>
|
||||
|
||||
namespace luabind { namespace adl {
|
||||
|
||||
class object;
|
||||
class argument;
|
||||
template <class Base>
|
||||
struct table;
|
||||
} // namespace adl
|
||||
|
||||
using adl::object;
|
||||
using adl::argument;
|
||||
using adl::table;
|
||||
|
||||
} // namespace luabind
|
||||
|
||||
namespace luabind { namespace detail {
|
||||
|
||||
LUABIND_API std::string get_class_name(lua_State* L, type_id const& i);
|
||||
|
||||
template <class T>
|
||||
struct type_to_string
|
||||
{
|
||||
static void get(lua_State* L)
|
||||
{
|
||||
lua_pushstring(L, get_class_name(L, typeid(T)).c_str());
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct type_to_string<T*>
|
||||
{
|
||||
static void get(lua_State* L)
|
||||
{
|
||||
type_to_string<T>::get(L);
|
||||
lua_pushstring(L, "*");
|
||||
lua_concat(L, 2);
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct type_to_string<T&>
|
||||
{
|
||||
static void get(lua_State* L)
|
||||
{
|
||||
type_to_string<T>::get(L);
|
||||
lua_pushstring(L, "&");
|
||||
lua_concat(L, 2);
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct type_to_string<T const>
|
||||
{
|
||||
static void get(lua_State* L)
|
||||
{
|
||||
type_to_string<T>::get(L);
|
||||
lua_pushstring(L, " const");
|
||||
lua_concat(L, 2);
|
||||
}
|
||||
};
|
||||
|
||||
# define LUABIND_TYPE_TO_STRING(x) \
|
||||
template <> \
|
||||
struct type_to_string<x> \
|
||||
{ \
|
||||
static void get(lua_State* L) \
|
||||
{ \
|
||||
lua_pushstring(L, #x); \
|
||||
} \
|
||||
};
|
||||
|
||||
# define LUABIND_INTEGRAL_TYPE_TO_STRING(x) \
|
||||
LUABIND_TYPE_TO_STRING(x) \
|
||||
LUABIND_TYPE_TO_STRING(unsigned x)
|
||||
|
||||
LUABIND_INTEGRAL_TYPE_TO_STRING(char)
|
||||
LUABIND_INTEGRAL_TYPE_TO_STRING(short)
|
||||
LUABIND_INTEGRAL_TYPE_TO_STRING(int)
|
||||
LUABIND_INTEGRAL_TYPE_TO_STRING(long)
|
||||
|
||||
LUABIND_TYPE_TO_STRING(void)
|
||||
LUABIND_TYPE_TO_STRING(bool)
|
||||
LUABIND_TYPE_TO_STRING(std::string)
|
||||
LUABIND_TYPE_TO_STRING(lua_State)
|
||||
|
||||
LUABIND_TYPE_TO_STRING(luabind::object)
|
||||
LUABIND_TYPE_TO_STRING(luabind::argument)
|
||||
|
||||
# undef LUABIND_INTEGRAL_TYPE_TO_STRING
|
||||
# undef LUABIND_TYPE_TO_STRING
|
||||
|
||||
template <class Base>
|
||||
struct type_to_string<table<Base> >
|
||||
{
|
||||
static void get(lua_State* L)
|
||||
{
|
||||
lua_pushstring(L, "table");
|
||||
}
|
||||
};
|
||||
|
||||
template <class End>
|
||||
void format_signature_aux(lua_State*, bool, End, End)
|
||||
{}
|
||||
|
||||
template <class Iter, class End>
|
||||
void format_signature_aux(lua_State* L, bool first, Iter, End end)
|
||||
{
|
||||
if (!first)
|
||||
lua_pushstring(L, ",");
|
||||
type_to_string<typename Iter::type>::get(L);
|
||||
format_signature_aux(L, false, typename mpl::next<Iter>::type(), end);
|
||||
}
|
||||
|
||||
template <class Signature>
|
||||
void format_signature(lua_State* L, char const* function, Signature)
|
||||
{
|
||||
typedef typename mpl::begin<Signature>::type first;
|
||||
|
||||
type_to_string<typename first::type>::get(L);
|
||||
|
||||
lua_pushstring(L, " ");
|
||||
lua_pushstring(L, function);
|
||||
|
||||
lua_pushstring(L, "(");
|
||||
format_signature_aux(
|
||||
L
|
||||
, true
|
||||
, typename mpl::next<first>::type()
|
||||
, typename mpl::end<Signature>::type()
|
||||
);
|
||||
lua_pushstring(L, ")");
|
||||
|
||||
lua_concat(L, static_cast<int>(mpl::size<Signature>()) * 2 + 2);
|
||||
}
|
||||
|
||||
}} // namespace luabind::detail
|
||||
|
||||
#endif // LUABIND_FORMAT_SIGNATURE_081014_HPP
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
// Copyright (c) 2003 Daniel Wallin and Arvid Norberg
|
||||
|
||||
// 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.
|
||||
|
||||
|
||||
#ifndef LUABIND_GARBAGE_COLLECTOR_HPP_INCLUDED
|
||||
#define LUABIND_GARBAGE_COLLECTOR_HPP_INCLUDED
|
||||
|
||||
#include <luabind/config.hpp>
|
||||
|
||||
namespace luabind { namespace detail
|
||||
{
|
||||
// function that is used as __gc metafunction on several objects
|
||||
template<class T>
|
||||
inline int garbage_collector(lua_State* L)
|
||||
{
|
||||
T* obj = static_cast<T*>(lua_touserdata(L, -1));
|
||||
obj->~T();
|
||||
return 0;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
struct garbage_collector_s
|
||||
{
|
||||
static int apply(lua_State* L)
|
||||
{
|
||||
T* obj = static_cast<T*>(lua_touserdata(L, -1));
|
||||
obj->~T();
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#endif // LUABIND_GARBAGE_COLLECTOR_HPP_INCLUDED
|
||||
@@ -1,107 +0,0 @@
|
||||
// Copyright (c) 2005 Daniel Wallin
|
||||
|
||||
// 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.
|
||||
|
||||
#ifndef LUABIND_HAS_GET_POINTER_051022_HPP
|
||||
# define LUABIND_HAS_GET_POINTER_051022_HPP
|
||||
|
||||
# include <boost/type_traits/add_reference.hpp>
|
||||
|
||||
# ifndef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
|
||||
# include <memory>
|
||||
# endif
|
||||
|
||||
namespace luabind { namespace detail {
|
||||
|
||||
namespace has_get_pointer_
|
||||
{
|
||||
|
||||
struct any
|
||||
{
|
||||
template<class T> any(T const&);
|
||||
};
|
||||
|
||||
struct no_overload_tag
|
||||
{};
|
||||
|
||||
typedef char (&yes)[1];
|
||||
typedef char (&no)[2];
|
||||
|
||||
no_overload_tag operator,(no_overload_tag, int);
|
||||
|
||||
//
|
||||
// On compilers with ADL, we need these generic overloads in this
|
||||
// namespace as well as in luabind::. Otherwise get_pointer(any)
|
||||
// will be found before them.
|
||||
//
|
||||
# ifndef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
|
||||
|
||||
template<class T>
|
||||
T* get_pointer(T const volatile*);
|
||||
|
||||
template<class T>
|
||||
T* get_pointer(std::auto_ptr<T> const&);
|
||||
|
||||
# endif
|
||||
|
||||
//
|
||||
// On compilers that doesn't support ADL, the overload below has to
|
||||
// live in luabind::.
|
||||
//
|
||||
# ifdef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
|
||||
}} // namespace detail::has_get_pointer_
|
||||
# endif
|
||||
|
||||
detail::has_get_pointer_::no_overload_tag
|
||||
get_pointer(detail::has_get_pointer_::any);
|
||||
|
||||
# ifdef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
|
||||
namespace detail { namespace has_get_pointer_
|
||||
{
|
||||
# endif
|
||||
|
||||
template<class T>
|
||||
yes check(T const&);
|
||||
no check(no_overload_tag);
|
||||
|
||||
template<class T>
|
||||
struct impl
|
||||
{
|
||||
static typename boost::add_reference<T>::type x;
|
||||
|
||||
BOOST_STATIC_CONSTANT(bool,
|
||||
value = sizeof(has_get_pointer_::check( (get_pointer(x),0) )) == 1
|
||||
);
|
||||
|
||||
typedef boost::mpl::bool_<value> type;
|
||||
};
|
||||
|
||||
} // namespace has_get_pointer_
|
||||
|
||||
template<class T>
|
||||
struct has_get_pointer
|
||||
: has_get_pointer_::impl<T>::type
|
||||
{};
|
||||
|
||||
}} // namespace luabind::detail
|
||||
|
||||
#endif // LUABIND_HAS_GET_POINTER_051022_HPP
|
||||
|
||||
@@ -1,168 +0,0 @@
|
||||
// Copyright Daniel Wallin 2009. Use, modification and distribution is
|
||||
// subject to the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef LUABIND_INHERITANCE_090217_HPP
|
||||
# define LUABIND_INHERITANCE_090217_HPP
|
||||
|
||||
# include <cassert>
|
||||
# include <limits>
|
||||
# include <map>
|
||||
# include <memory>
|
||||
# include <vector>
|
||||
# include <luabind/typeid.hpp>
|
||||
# include <boost/scoped_ptr.hpp>
|
||||
|
||||
namespace luabind { namespace detail {
|
||||
|
||||
typedef void*(*cast_function)(void*);
|
||||
typedef std::size_t class_id;
|
||||
|
||||
class_id const unknown_class = (std::numeric_limits<class_id>::max)();
|
||||
|
||||
class class_rep;
|
||||
|
||||
class LUABIND_API cast_graph
|
||||
{
|
||||
public:
|
||||
cast_graph();
|
||||
~cast_graph();
|
||||
|
||||
// `src` and `p` here describe the *most derived* object. This means that
|
||||
// for a polymorphic type, the pointer must be cast with
|
||||
// dynamic_cast<void*> before being passed in here, and `src` has to
|
||||
// match typeid(*p).
|
||||
std::pair<void*, int> cast(
|
||||
void* p, class_id src, class_id target
|
||||
, class_id dynamic_id, void const* dynamic_ptr) const;
|
||||
void insert(class_id src, class_id target, cast_function cast);
|
||||
|
||||
private:
|
||||
class impl;
|
||||
boost::scoped_ptr<impl> m_impl;
|
||||
};
|
||||
|
||||
// Maps a type_id to a class_id. Note that this actually partitions the
|
||||
// id-space into two, using one half for "local" ids; ids that are used only as
|
||||
// keys into the conversion cache. This is needed because we need a unique key
|
||||
// even for types that hasn't been registered explicitly.
|
||||
class LUABIND_API class_id_map
|
||||
{
|
||||
public:
|
||||
class_id_map();
|
||||
|
||||
class_id get(type_id const& type) const;
|
||||
class_id get_local(type_id const& type);
|
||||
void put(class_id id, type_id const& type);
|
||||
|
||||
private:
|
||||
typedef std::map<type_id, class_id> map_type;
|
||||
map_type m_classes;
|
||||
class_id m_local_id;
|
||||
|
||||
static class_id const local_id_base;
|
||||
};
|
||||
|
||||
inline class_id_map::class_id_map()
|
||||
: m_local_id(local_id_base)
|
||||
{}
|
||||
|
||||
inline class_id class_id_map::get(type_id const& type) const
|
||||
{
|
||||
map_type::const_iterator i = m_classes.find(type);
|
||||
if (i == m_classes.end() || i->second >= local_id_base)
|
||||
return unknown_class;
|
||||
return i->second;
|
||||
}
|
||||
|
||||
inline class_id class_id_map::get_local(type_id const& type)
|
||||
{
|
||||
std::pair<map_type::iterator, bool> result = m_classes.insert(
|
||||
std::make_pair(type, 0));
|
||||
|
||||
if (result.second)
|
||||
result.first->second = m_local_id++;
|
||||
|
||||
assert(m_local_id >= local_id_base);
|
||||
|
||||
return result.first->second;
|
||||
}
|
||||
|
||||
inline void class_id_map::put(class_id id, type_id const& type)
|
||||
{
|
||||
assert(id < local_id_base);
|
||||
|
||||
std::pair<map_type::iterator, bool> result = m_classes.insert(
|
||||
std::make_pair(type, 0));
|
||||
|
||||
assert(
|
||||
result.second
|
||||
|| result.first->second == id
|
||||
|| result.first->second >= local_id_base
|
||||
);
|
||||
|
||||
result.first->second = id;
|
||||
}
|
||||
|
||||
class class_map
|
||||
{
|
||||
public:
|
||||
class_rep* get(class_id id) const;
|
||||
void put(class_id id, class_rep* cls);
|
||||
|
||||
private:
|
||||
std::vector<class_rep*> m_classes;
|
||||
};
|
||||
|
||||
inline class_rep* class_map::get(class_id id) const
|
||||
{
|
||||
if (id >= m_classes.size())
|
||||
return 0;
|
||||
return m_classes[id];
|
||||
}
|
||||
|
||||
inline void class_map::put(class_id id, class_rep* cls)
|
||||
{
|
||||
if (id >= m_classes.size())
|
||||
m_classes.resize(id + 1);
|
||||
m_classes[id] = cls;
|
||||
}
|
||||
|
||||
template <class S, class T>
|
||||
struct static_cast_
|
||||
{
|
||||
static void* execute(void* p)
|
||||
{
|
||||
return static_cast<T*>(static_cast<S*>(p));
|
||||
}
|
||||
};
|
||||
|
||||
template <class S, class T>
|
||||
struct dynamic_cast_
|
||||
{
|
||||
static void* execute(void* p)
|
||||
{
|
||||
return dynamic_cast<T*>(static_cast<S*>(p));
|
||||
}
|
||||
};
|
||||
|
||||
// Thread safe class_id allocation.
|
||||
LUABIND_API class_id allocate_class_id(type_id const& cls);
|
||||
|
||||
template <class T>
|
||||
struct registered_class
|
||||
{
|
||||
static class_id const id;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class_id const registered_class<T>::id = allocate_class_id(typeid(T));
|
||||
|
||||
template <class T>
|
||||
struct registered_class<T const>
|
||||
: registered_class<T>
|
||||
{};
|
||||
|
||||
}} // namespace luabind::detail
|
||||
|
||||
#endif // LUABIND_INHERITANCE_090217_HPP
|
||||
@@ -1,131 +0,0 @@
|
||||
// Copyright Daniel Wallin 2008. Use, modification and distribution is
|
||||
// subject to the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef LUABIND_INSTANCE_HOLDER_081024_HPP
|
||||
# define LUABIND_INSTANCE_HOLDER_081024_HPP
|
||||
|
||||
# include <luabind/detail/inheritance.hpp>
|
||||
# include <luabind/detail/class_rep.hpp> // TODO
|
||||
# include <luabind/get_pointer.hpp>
|
||||
# include <luabind/typeid.hpp>
|
||||
# include <boost/type_traits/is_polymorphic.hpp>
|
||||
# include <stdexcept>
|
||||
|
||||
namespace luabind { namespace detail {
|
||||
|
||||
class instance_holder
|
||||
{
|
||||
public:
|
||||
instance_holder(class_rep* cls, bool pointee_const)
|
||||
: m_cls(cls)
|
||||
, m_pointee_const(pointee_const)
|
||||
{}
|
||||
|
||||
virtual ~instance_holder()
|
||||
{}
|
||||
|
||||
virtual std::pair<void*, int> get(class_id target) const = 0;
|
||||
|
||||
virtual void release() = 0;
|
||||
|
||||
class_rep* get_class() const
|
||||
{
|
||||
return m_cls;
|
||||
}
|
||||
|
||||
bool pointee_const() const
|
||||
{
|
||||
return m_pointee_const;
|
||||
}
|
||||
|
||||
private:
|
||||
class_rep* m_cls;
|
||||
bool m_pointee_const;
|
||||
};
|
||||
|
||||
namespace mpl = boost::mpl;
|
||||
|
||||
inline mpl::false_ check_const_pointer(void*)
|
||||
{
|
||||
return mpl::false_();
|
||||
}
|
||||
|
||||
inline mpl::true_ check_const_pointer(void const*)
|
||||
{
|
||||
return mpl::true_();
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void release_ownership(std::auto_ptr<T>& p)
|
||||
{
|
||||
p.release();
|
||||
}
|
||||
|
||||
template <class P>
|
||||
void release_ownership(P const&)
|
||||
{
|
||||
throw std::runtime_error(
|
||||
"luabind: smart pointer does not allow ownership transfer");
|
||||
}
|
||||
|
||||
template <class T>
|
||||
class_id static_class_id(T*)
|
||||
{
|
||||
return registered_class<T>::id;
|
||||
}
|
||||
|
||||
template <class P, class Pointee = void const>
|
||||
class pointer_holder : public instance_holder
|
||||
{
|
||||
public:
|
||||
pointer_holder(
|
||||
P p, class_id dynamic_id, void* dynamic_ptr, class_rep* cls
|
||||
)
|
||||
: instance_holder(cls, check_const_pointer(false ? get_pointer(p) : 0))
|
||||
, p(p)
|
||||
, weak(0)
|
||||
, dynamic_id(dynamic_id)
|
||||
, dynamic_ptr(dynamic_ptr)
|
||||
{}
|
||||
|
||||
std::pair<void*, int> get(class_id target) const
|
||||
{
|
||||
if (target == registered_class<P>::id)
|
||||
return std::pair<void*, int>(&this->p, 0);
|
||||
|
||||
void* naked_ptr = const_cast<void*>(static_cast<void const*>(
|
||||
weak ? weak : get_pointer(p)));
|
||||
|
||||
if (!naked_ptr)
|
||||
return std::pair<void*, int>((void*)0, 0);
|
||||
|
||||
return get_class()->casts().cast(
|
||||
naked_ptr
|
||||
, static_class_id(false ? get_pointer(p) : 0)
|
||||
, target
|
||||
, dynamic_id
|
||||
, dynamic_ptr
|
||||
);
|
||||
}
|
||||
|
||||
void release()
|
||||
{
|
||||
weak = const_cast<void*>(static_cast<void const*>(
|
||||
get_pointer(p)));
|
||||
release_ownership(p);
|
||||
}
|
||||
|
||||
private:
|
||||
mutable P p;
|
||||
// weak will hold a possibly stale pointer to the object owned
|
||||
// by p once p has released it's owership. This is a workaround
|
||||
// to make adopt() work with virtual function wrapper classes.
|
||||
void* weak;
|
||||
class_id dynamic_id;
|
||||
void* dynamic_ptr;
|
||||
};
|
||||
|
||||
}} // namespace luabind::detail
|
||||
|
||||
#endif // LUABIND_INSTANCE_HOLDER_081024_HPP
|
||||
@@ -1,70 +0,0 @@
|
||||
// Copyright (c) 2004 Daniel Wallin and Arvid Norberg
|
||||
|
||||
// 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.
|
||||
|
||||
#ifndef IS_INDIRECT_CONST_040211_HPP
|
||||
#define IS_INDIRECT_CONST_040211_HPP
|
||||
|
||||
#include <luabind/detail/yes_no.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
|
||||
namespace luabind {
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<class T>
|
||||
typename boost::is_const<T>::type
|
||||
is_indirect_const_check(T(*)(), int);
|
||||
|
||||
template<class T>
|
||||
typename boost::is_const<T>::type
|
||||
is_indirect_const_check(T*(*)(), long);
|
||||
|
||||
template<class T>
|
||||
typename boost::is_const<T>::type
|
||||
is_indirect_const_check(T&(*)(), long);
|
||||
|
||||
yes_t to_yes_no(boost::mpl::true_);
|
||||
no_t to_yes_no(boost::mpl::false_);
|
||||
|
||||
} // namespace detail
|
||||
|
||||
// returns true for:
|
||||
// T = U* is_const<U>
|
||||
// T = U& is_const<U>
|
||||
// T = U is_const<U>
|
||||
template<class T>
|
||||
struct is_indirect_const
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(int, value = (
|
||||
sizeof(
|
||||
detail::to_yes_no(
|
||||
detail::is_indirect_const_check((T(*)())0, 0L)
|
||||
))
|
||||
== sizeof(detail::yes_t)
|
||||
));
|
||||
};
|
||||
|
||||
} // namespace luabind
|
||||
|
||||
#endif // IS_INDIRECT_CONST_040211_HPP
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
// Copyright (c) 2003 Daniel Wallin and Arvid Norberg
|
||||
|
||||
// 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.
|
||||
|
||||
#ifndef LUABIND_LINK_COMPATIBILITY_HPP_INCLUDED
|
||||
#define LUABIND_LINK_COMPATIBILITY_HPP_INCLUDED
|
||||
|
||||
#include <luabind/config.hpp>
|
||||
|
||||
namespace luabind { namespace detail
|
||||
{
|
||||
|
||||
#ifdef LUABIND_NOT_THREADSAFE
|
||||
LUABIND_API void not_threadsafe_defined_conflict();
|
||||
#else
|
||||
LUABIND_API void not_threadsafe_not_defined_conflict();
|
||||
#endif
|
||||
|
||||
#ifdef LUABIND_NO_ERROR_CHECKING
|
||||
LUABIND_API void no_error_checking_defined_conflict();
|
||||
#else
|
||||
LUABIND_API void no_error_checking_not_defined_conflict();
|
||||
#endif
|
||||
|
||||
inline void check_link_compatibility()
|
||||
{
|
||||
#ifdef LUABIND_NOT_THREADSAFE
|
||||
not_threadsafe_defined_conflict();
|
||||
#else
|
||||
not_threadsafe_not_defined_conflict();
|
||||
#endif
|
||||
|
||||
#ifdef LUABIND_NO_ERROR_CHECKING
|
||||
no_error_checking_defined_conflict();
|
||||
#else
|
||||
no_error_checking_not_defined_conflict();
|
||||
#endif
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -1,105 +0,0 @@
|
||||
// Copyright Daniel Wallin 2009. Use, modification and distribution is
|
||||
// subject to the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef LUABIND_DETAIL_MAKE_INSTANCE_090310_HPP
|
||||
# define LUABIND_DETAIL_MAKE_INSTANCE_090310_HPP
|
||||
|
||||
# include <boost/type_traits/is_polymorphic.hpp>
|
||||
# include <luabind/detail/inheritance.hpp>
|
||||
# include <luabind/detail/object_rep.hpp>
|
||||
|
||||
namespace luabind { namespace detail {
|
||||
|
||||
template <class T>
|
||||
std::pair<class_id, void*> get_dynamic_class_aux(
|
||||
lua_State* L, T const* p, mpl::true_)
|
||||
{
|
||||
lua_pushliteral(L, "__luabind_class_id_map");
|
||||
lua_rawget(L, LUA_REGISTRYINDEX);
|
||||
|
||||
class_id_map& class_ids = *static_cast<class_id_map*>(
|
||||
lua_touserdata(L, -1));
|
||||
|
||||
lua_pop(L, 1);
|
||||
|
||||
return std::make_pair(
|
||||
class_ids.get_local(typeid(*p))
|
||||
, dynamic_cast<void*>(const_cast<T*>(p))
|
||||
);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
std::pair<class_id, void*> get_dynamic_class_aux(
|
||||
lua_State*, T const* p, mpl::false_)
|
||||
{
|
||||
return std::make_pair(registered_class<T>::id, (void*)p);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
std::pair<class_id, void*> get_dynamic_class(lua_State* L, T* p)
|
||||
{
|
||||
return get_dynamic_class_aux(L, p, boost::is_polymorphic<T>());
|
||||
}
|
||||
|
||||
template <class T>
|
||||
class_rep* get_pointee_class(class_map const& classes, T*)
|
||||
{
|
||||
return classes.get(registered_class<T>::id);
|
||||
}
|
||||
|
||||
template <class P>
|
||||
class_rep* get_pointee_class(lua_State* L, P const& p, class_id dynamic_id)
|
||||
{
|
||||
lua_pushliteral(L, "__luabind_class_map");
|
||||
lua_rawget(L, LUA_REGISTRYINDEX);
|
||||
|
||||
class_map const& classes = *static_cast<class_map*>(
|
||||
lua_touserdata(L, -1));
|
||||
|
||||
lua_pop(L, 1);
|
||||
|
||||
class_rep* cls = classes.get(dynamic_id);
|
||||
|
||||
if (!cls)
|
||||
cls = get_pointee_class(classes, get_pointer(p));
|
||||
|
||||
return cls;
|
||||
}
|
||||
|
||||
// Create an appropriate instance holder for the given pointer like object.
|
||||
template <class P>
|
||||
void make_instance(lua_State* L, P p)
|
||||
{
|
||||
std::pair<class_id, void*> dynamic = get_dynamic_class(L, get_pointer(p));
|
||||
|
||||
class_rep* cls = get_pointee_class(L, p, dynamic.first);
|
||||
|
||||
if (!cls)
|
||||
{
|
||||
throw std::runtime_error("Trying to use unregistered class");
|
||||
}
|
||||
|
||||
object_rep* instance = push_new_instance(L, cls);
|
||||
|
||||
typedef pointer_holder<P> holder_type;
|
||||
|
||||
void* storage = instance->allocate(sizeof(holder_type));
|
||||
|
||||
try
|
||||
{
|
||||
new (storage) holder_type(p, dynamic.first, dynamic.second, cls);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
instance->deallocate(storage);
|
||||
lua_pop(L, 1);
|
||||
throw;
|
||||
}
|
||||
|
||||
instance->set_instance(static_cast<holder_type*>(storage));
|
||||
}
|
||||
|
||||
}} // namespace luabind::detail
|
||||
|
||||
#endif // LUABIND_DETAIL_MAKE_INSTANCE_090310_HPP
|
||||
@@ -1,44 +0,0 @@
|
||||
// Copyright (c) 2005 Daniel Wallin and Arvid Norberg
|
||||
|
||||
// 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.
|
||||
|
||||
#ifndef MOST_DERIVED_051018_HPP
|
||||
# define MOST_DERIVED_051018_HPP
|
||||
|
||||
# include <boost/mpl/if.hpp>
|
||||
# include <boost/type_traits/is_base_and_derived.hpp>
|
||||
|
||||
namespace luabind { namespace detail {
|
||||
|
||||
template<class Class, class WrappedClass>
|
||||
struct most_derived
|
||||
{
|
||||
typedef typename boost::mpl::if_<
|
||||
boost::is_base_and_derived<Class, WrappedClass>
|
||||
, WrappedClass
|
||||
, Class
|
||||
>::type type;
|
||||
};
|
||||
|
||||
}} // namespace luabind::detail
|
||||
|
||||
#endif // MOST_DERIVED_051018_HPP
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
// Copyright (c) 2005 Daniel Wallin and Arvid Norberg
|
||||
|
||||
// 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.
|
||||
|
||||
#if !BOOST_PP_IS_ITERATING
|
||||
# error Do not include object_call.hpp directly!
|
||||
#endif
|
||||
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
#include <boost/preprocessor/facilities/intercept.hpp>
|
||||
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
template<BOOST_PP_ENUM_PARAMS(N, class A)>
|
||||
call_proxy<
|
||||
Derived
|
||||
, boost::tuples::tuple<
|
||||
BOOST_PP_ENUM_BINARY_PARAMS(N, A, const* BOOST_PP_INTERCEPT)
|
||||
>
|
||||
> operator()(BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& a))
|
||||
{
|
||||
typedef boost::tuples::tuple<
|
||||
BOOST_PP_ENUM_BINARY_PARAMS(N, A, const* BOOST_PP_INTERCEPT)
|
||||
> arguments;
|
||||
|
||||
return call_proxy<Derived, arguments>(
|
||||
derived()
|
||||
, arguments(BOOST_PP_ENUM_PARAMS(N, &a))
|
||||
);
|
||||
}
|
||||
|
||||
#undef N
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user