mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-22 20:33:01 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b224142b2a |
@@ -33,7 +33,5 @@ Build_32/
|
||||
build_32/
|
||||
Build_64/
|
||||
build_64/
|
||||
x64/
|
||||
x86/
|
||||
log/
|
||||
logs/
|
||||
|
||||
+5
-19
@@ -1,25 +1,11 @@
|
||||
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
|
||||
install:
|
||||
- if [ "$CXX" = "g++" ]; then export CXX="g++-4.8" CC="gcc-4.8"; fi
|
||||
before_install:
|
||||
- sudo apt-get update -qq
|
||||
- sudo apt-get install -y libmysqlclient-dev libperl-dev libboost-dev liblua5.1-0-dev zlib1g-dev
|
||||
script:
|
||||
- cmake -G "Unix Makefiles" -DEQEMU_BUILD_TESTS=ON -DEQEMU_ENABLE_BOTS=ON -DEQEMU_BUILD_LOGIN=ON
|
||||
- make -j2
|
||||
- cmake -G "Unix Makefiles" -DEQEMU_BUILD_TESTS=ON -DEQEMU_ENABLE_BOTS=ON
|
||||
- make
|
||||
- ./bin/tests
|
||||
branches:
|
||||
only:
|
||||
|
||||
+33
-65
@@ -13,6 +13,12 @@
|
||||
#EQEMU_LOG_LEVEL_QUEST
|
||||
#EQEMU_LOG_LEVEL_COMMANDS
|
||||
#EQEMU_LOG_LEVEL_CRASH
|
||||
#EQEMU_STREAM_SEND_RATE
|
||||
#EQEMU_STREAM_DECAY_RATE
|
||||
#EQEMU_STREAM_RETRANSMIT_TIMEOUT_MUL
|
||||
#EQEMU_STREAM_RETRANSMIT_TIMEOUT_MAX
|
||||
#EQEMU_STREAM_AVERAGE_DELTA_MAX
|
||||
#EQEMU_STREAM_RETRANSMIT_ACKED_PACKETS
|
||||
#EQEMU_DEPOP_INVALIDATES_CACHE
|
||||
#EQEMU_ENABLE_BOTS
|
||||
#EQEMU_DISABLE_LOGSYS
|
||||
@@ -24,7 +30,6 @@
|
||||
#EQEMU_BUILD_LUA
|
||||
#EQEMU_SANITIZE_LUA_LIBS
|
||||
#EQEMU_BUILD_CLIENT_FILES
|
||||
#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
|
||||
@@ -58,28 +63,10 @@ IF(MSVC)
|
||||
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
|
||||
@@ -231,6 +218,14 @@ SET(EQEMU_LOG_LEVEL_CRASH 3 CACHE STRING "EQEmu logging level for [Crash]:
|
||||
|
||||
MARK_AS_ADVANCED(EQEMU_LOG_LEVEL_STATUS EQEMU_LOG_LEVEL_NORMAL EQEMU_LOG_LEVEL_ERROR EQEMU_LOG_LEVEL_DEBUG EQEMU_LOG_LEVEL_QUEST EQEMU_LOG_LEVEL_COMMANDS EQEMU_LOG_LEVEL_CRASH)
|
||||
|
||||
SET(EQEMU_STREAM_SEND_RATE 1048576 CACHE STRING "Advanced: Base amount of data stream can send before throttle.")
|
||||
SET(EQEMU_STREAM_DECAY_RATE 78642 CACHE STRING "Advanced: Base amount of data stream recovers per tic.")
|
||||
SET(EQEMU_STREAM_RETRANSMIT_TIMEOUT_MUL 3.0 CACHE STRING "Advanced: Multiplier on retransmit timeout.")
|
||||
SET(EQEMU_STREAM_RETRANSMIT_TIMEOUT_MAX 5000 CACHE STRING "Advanced: Max in ms for retransmit timeout timer.")
|
||||
SET(EQEMU_STREAM_AVERAGE_DELTA_MAX 2500 CACHE STRING "Advanced: The maximum average delta in ms allowed.")
|
||||
SET(EQEMU_STREAM_RETRANSMIT_ACKED_PACKETS TRUE CACHE BOOL "Advanced: Whether or not acked packets can be retransmitted")
|
||||
MARK_AS_ADVANCED(EQEMU_STREAM_SEND_RATE EQEMU_STREAM_DECAY_RATE EQEMU_STREAM_RETRANSMIT_TIMEOUT_MUL EQEMU_STREAM_RETRANSMIT_TIMEOUT_MAX EQEMU_STREAM_AVERAGE_DELTA_MAX EQEMU_STREAM_RETRANSMIT_ACKED_PACKETS)
|
||||
|
||||
#NPC Types Cache Behavior
|
||||
OPTION(EQEMU_DEPOP_INVALIDATES_CACHE "#repop invalidates the npc_types cache (will cause a larger database hit on #repop but is more convienent)." ON)
|
||||
|
||||
@@ -258,7 +253,6 @@ ENDIF(EQEMU_ENABLE_BOTS)
|
||||
#What to build
|
||||
OPTION(EQEMU_BUILD_SERVER "Build the game server." ON)
|
||||
OPTION(EQEMU_BUILD_LOGIN "Build the login server." OFF)
|
||||
OPTION(EQEMU_BUILD_HC "Build the headless client." OFF)
|
||||
OPTION(EQEMU_BUILD_TESTS "Build utility tests." OFF)
|
||||
OPTION(EQEMU_BUILD_PERL "Build Perl parser." ON)
|
||||
OPTION(EQEMU_BUILD_LUA "Build Lua parser." ON)
|
||||
@@ -281,17 +275,17 @@ IF(EQEMU_BUILD_LUA)
|
||||
ADD_DEFINITIONS(-DLUA_EQEMU)
|
||||
ENDIF(EQEMU_BUILD_LUA)
|
||||
|
||||
OPTION(EQEMU_USE_MAP_MMFS "Create and use Zone Map MMF files." OFF)
|
||||
IF(EQEMU_USE_MAP_MMFS)
|
||||
ADD_DEFINITIONS(-DUSE_MAP_MMFS)
|
||||
ENDIF(EQEMU_USE_MAP_MMFS)
|
||||
|
||||
SET(EQEMU_MAP_DIR "./Maps" CACHE STRING "The dir that maps, water maps, and paths are located in.")
|
||||
|
||||
ADD_DEFINITIONS(-DEQDEBUG=${EQEMU_DEBUG_LEVEL})
|
||||
ADD_DEFINITIONS(-DINVERSEXY)
|
||||
ADD_DEFINITIONS(-DFIELD_ITEMS)
|
||||
ADD_DEFINITIONS(-DMAP_DIR="${EQEMU_MAP_DIR}")
|
||||
ADD_DEFINITIONS(-DRATEBASE=${EQEMU_STREAM_SEND_RATE})
|
||||
ADD_DEFINITIONS(-DDECAYBASE=${EQEMU_STREAM_DECAY_RATE})
|
||||
ADD_DEFINITIONS(-DRETRANSMIT_TIMEOUT_MULT=${EQEMU_STREAM_RETRANSMIT_TIMEOUT_MUL})
|
||||
ADD_DEFINITIONS(-DRETRANSMIT_TIMEOUT_MAX=${EQEMU_STREAM_RETRANSMIT_TIMEOUT_MAX})
|
||||
ADD_DEFINITIONS(-DAVERAGE_DELTA_MAX=${EQEMU_STREAM_AVERAGE_DELTA_MAX})
|
||||
ADD_DEFINITIONS(-DLOG_LEVEL_STATUS=${EQEMU_LOG_LEVEL_STATUS})
|
||||
ADD_DEFINITIONS(-DLOG_LEVEL_NORMAL=${EQEMU_LOG_LEVEL_NORMAL})
|
||||
ADD_DEFINITIONS(-DLOG_LEVEL_ERROR=${EQEMU_LOG_LEVEL_ERROR})
|
||||
@@ -301,6 +295,12 @@ ADD_DEFINITIONS(-DLOG_LEVEL_COMMANDS=${EQEMU_LOG_LEVEL_COMMANDS})
|
||||
ADD_DEFINITIONS(-DLOG_LEVEL_CRASH=${EQEMU_LOG_LEVEL_CRASH})
|
||||
ADD_DEFINITIONS(-DGLM_FORCE_RADIANS)
|
||||
|
||||
IF(EQEMU_STREAM_RETRANSMIT_ACKED_PACKETS)
|
||||
ADD_DEFINITIONS(-DRETRANSMIT_ACKED_PACKETS=true)
|
||||
ELSE(EQEMU_STREAM_RETRANSMIT_ACKED_PACKETS)
|
||||
ADD_DEFINITIONS(-DRETRANSMIT_ACKED_PACKETS=false)
|
||||
ENDIF(EQEMU_STREAM_RETRANSMIT_ACKED_PACKETS)
|
||||
|
||||
#Find everything we need
|
||||
FIND_PACKAGE(ZLIB REQUIRED)
|
||||
FIND_PACKAGE(MySQL REQUIRED)
|
||||
@@ -309,30 +309,6 @@ IF(EQEMU_BUILD_PERL)
|
||||
INCLUDE_DIRECTORIES(SYSTEM "${PERL_INCLUDE_PATH}")
|
||||
ENDIF(EQEMU_BUILD_PERL)
|
||||
|
||||
SET(SERVER_LIBS common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY} libuv fmt)
|
||||
|
||||
FIND_PACKAGE(Sodium REQUIRED)
|
||||
IF(SODIUM_FOUND)
|
||||
OPTION(EQEMU_ENABLE_SECURITY "Use Encryption For TCP Connections" ON)
|
||||
IF(EQEMU_ENABLE_SECURITY)
|
||||
INCLUDE_DIRECTORIES(SYSTEM "${SODIUM_INCLUDE_DIRS}")
|
||||
ADD_DEFINITIONS(-DENABLE_SECURITY)
|
||||
SET(SERVER_LIBS ${SERVER_LIBS} ${SODIUM_LIBRARIES})
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(WIN32)
|
||||
SET(SERVER_LIBS ${SERVER_LIBS} "ws2_32" "psapi" "iphlpapi" "userenv")
|
||||
ENDIF()
|
||||
|
||||
IF(UNIX)
|
||||
SET(SERVER_LIBS ${SERVER_LIBS} ${CMAKE_DL_LIBS} "z" "m" "pthread")
|
||||
IF(NOT DARWIN)
|
||||
SET(SERVER_LIBS ${SERVER_LIBS} "rt")
|
||||
ENDIF()
|
||||
SET(SERVER_LIBS ${SERVER_LIBS} "uuid")
|
||||
ENDIF()
|
||||
|
||||
IF(EQEMU_BUILD_LUA)
|
||||
FIND_PACKAGE(EQLua51 REQUIRED)
|
||||
SET(Boost_USE_STATIC_LIBS OFF)
|
||||
@@ -341,8 +317,7 @@ IF(EQEMU_BUILD_LUA)
|
||||
SET(BOOST_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/boost")
|
||||
|
||||
FIND_PACKAGE(Boost REQUIRED)
|
||||
INCLUDE_DIRECTORIES(SYSTEM "${LUA_INCLUDE_DIR}" "${Boost_INCLUDE_DIRS}")
|
||||
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/luabind")
|
||||
INCLUDE_DIRECTORIES(SYSTEM "${LUA_INCLUDE_DIR}" "${Boost_INCLUDE_DIRS}" "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)
|
||||
@@ -350,18 +325,15 @@ IF(EQEMU_BUILD_LUA)
|
||||
ENDIF(EQEMU_SANITIZE_LUA_LIBS)
|
||||
ENDIF(EQEMU_BUILD_LUA)
|
||||
|
||||
INCLUDE_DIRECTORIES(SYSTEM "${ZLIB_INCLUDE_DIRS}")
|
||||
INCLUDE_DIRECTORIES(SYSTEM "${MySQL_INCLUDE_DIR}")
|
||||
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/common/glm")
|
||||
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/libs/cereal")
|
||||
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/libs/libuv/include" )
|
||||
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/libs/libuv/src")
|
||||
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/libs/format")
|
||||
INCLUDE_DIRECTORIES(SYSTEM "${ZLIB_INCLUDE_DIRS}" "${MySQL_INCLUDE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/common/glm/glm")
|
||||
|
||||
IF(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS OR EQEMU_BUILD_HC)
|
||||
IF(EQEMU_BUILD_LUA)
|
||||
ADD_SUBDIRECTORY(luabind)
|
||||
ENDIF(EQEMU_BUILD_LUA)
|
||||
|
||||
IF(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS)
|
||||
ADD_SUBDIRECTORY(common)
|
||||
ADD_SUBDIRECTORY(libs)
|
||||
ENDIF(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS OR EQEMU_BUILD_HC)
|
||||
ENDIF(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS)
|
||||
IF(EQEMU_BUILD_SERVER)
|
||||
ADD_SUBDIRECTORY(shared_memory)
|
||||
ADD_SUBDIRECTORY(world)
|
||||
@@ -374,10 +346,6 @@ IF(EQEMU_BUILD_LOGIN)
|
||||
ADD_SUBDIRECTORY(loginserver)
|
||||
ENDIF(EQEMU_BUILD_LOGIN)
|
||||
|
||||
IF(EQEMU_BUILD_HC)
|
||||
ADD_SUBDIRECTORY(hc)
|
||||
ENDIF(EQEMU_BUILD_HC)
|
||||
|
||||
IF(EQEMU_BUILD_TESTS)
|
||||
ADD_SUBDIRECTORY(tests)
|
||||
ENDIF(EQEMU_BUILD_TESTS)
|
||||
|
||||
@@ -1,59 +1,53 @@
|
||||
# EQEmulator Core Server
|
||||
|Travis CI (Linux)|Appveyor (Windows) |
|
||||
|:---:|:---:|
|
||||
|[](https://travis-ci.org/EQEmu/Server) |[](https://ci.appveyor.com/project/KimLS/server/branch/master) |
|
||||
EQEmu
|
||||
===
|
||||
|
||||
***
|
||||
[](https://travis-ci.org/EQEmu/Server)
|
||||
|
||||
**EQEmulator is a custom completely from-scratch open source server implementation for EverQuest built mostly on C++**
|
||||
* MySQL/MariaDB is used as the database engine (over 200+ tables)
|
||||
* Perl and LUA are both supported scripting languages for NPC/Player/Quest oriented events
|
||||
* Open source database (Project EQ) has content up to expansion OoW (included in server installs)
|
||||
* Game server environments and databases can be heavily customized to create all new experiences
|
||||
* Hundreds of Quests/events created and maintained by Project EQ
|
||||
Overview
|
||||
---
|
||||
|
||||
## Server Installs
|
||||
| |Windows|Linux|
|
||||
|:---:|:---:|:---:|
|
||||
|**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)
|
||||
EQEmu is a custom server implementation for EverQuest
|
||||
|
||||
Dependencies
|
||||
---
|
||||
|
||||
For Windows: http://eqemu.github.io
|
||||
|
||||
### > Debian/Ubuntu/CentOS/Fedora
|
||||
* You can use curl or wget to kick off the installer (whichever your OS has)
|
||||
> curl -O https://raw.githubusercontent.com/EQEmu/Server/master/utils/scripts/linux_installer/install.sh install.sh && chmod 755 install.sh && ./install.sh
|
||||
Login Server dependencies for Windows/Linux/OSX: http://eqemu.github.io
|
||||
|
||||
> wget --no-check-certificate https://raw.githubusercontent.com/EQEmu/Server/master/utils/scripts/linux_installer/install.sh -O install.sh && chmod 755 install.sh && ./install.sh
|
||||
For Debian based distros (adjust to your local flavor):
|
||||
|
||||
## Supported Clients
|
||||
- libmysqlclient-dev
|
||||
- libperl-dev
|
||||
- liblua5.1-0-dev (5.2 should work as well)
|
||||
- libboost-dev
|
||||
|
||||
|Titanium Edition|Secrets of Faydwer|Seeds of Destruction|Underfoot|Rain of Fear|
|
||||
|:---:|:---:|:---:|:---:|:---:|
|
||||
|<img src="http://i.imgur.com/hrwDxoM.jpg" height="150">|<img src="http://i.imgur.com/cRDW5tn.png" height="150">|<img src="http://i.imgur.com/V48kuVn.jpg" height="150">|<img src="http://i.imgur.com/IJQ0XMa.jpg" height="150">|<img src="http://i.imgur.com/OMpHkKa.png" height="100">|
|
||||
Further instructions on building the source can be found on the
|
||||
[wiki](http://wiki.eqemulator.org/i?M=Wiki).
|
||||
|
||||
## Bug Reports <img src="http://i.imgur.com/daf1Vjw.png" height="20">
|
||||
* Please use the [issue tracker](https://github.com/EQEmu/Server/issues) provided by GitHub to send us bug
|
||||
Bug reports
|
||||
---
|
||||
|
||||
Please use the [issue tracker](https://github.com/EQEmu/Server/issues) provided by GitHub to send us bug
|
||||
reports or feature requests.
|
||||
* The [EQEmu Forums](http://www.eqemulator.org/forums/) are also a place to submit and get help with bugs.
|
||||
|
||||
## Contributions <img src="http://image.flaticon.com/icons/png/512/25/25231.png" width="20">
|
||||
The [EQEmu Forums](http://www.eqemulator.org/forums/) also have forums to submit
|
||||
bugs/get help with bugs.
|
||||
|
||||
* The preferred way to contribute is to fork the repo and submit a pull request on
|
||||
Contributions
|
||||
---
|
||||
|
||||
The preferred way to contribute is to fork the repo and submit a pull request on
|
||||
GitHub. If you need help with your changes, you can always post on the forums or
|
||||
try Discord. You can also post unified diffs (`git diff` should do the trick) on the
|
||||
try IRC. You can also post unified diffs (`git diff` should do the trick) on the
|
||||
[Server Code Submissions](http://www.eqemulator.org/forums/forumdisplay.php?f=669)
|
||||
forum, although pull requests will be much quicker and easier on all parties.
|
||||
|
||||
## Contact <img src="http://gamerescape.com/wp-content/uploads/2015/06/discord.png" height="20">
|
||||
|
||||
- Discord Channel: https://discord.gg/QHsm7CD
|
||||
- **User Discord Channel**: `#general`
|
||||
- **Developer Discord Channel**: `#eqemucoders`
|
||||
|
||||
Resources
|
||||
Contact
|
||||
---
|
||||
- **User IRC Channel**: `#eqemu` on `irc.eqemulator.net`
|
||||
- **Developer IRC Channel**: `#eqemucoders` on `irc.eqemulator.net`
|
||||
|
||||
- [EQEmulator Forums](http://www.eqemulator.org/forums)
|
||||
- [EQEmulator Wiki](http://wiki.eqemulator.org/i?M=Wiki)
|
||||
|
||||
|
||||
+321
-1448
File diff suppressed because it is too large
Load Diff
@@ -9,8 +9,28 @@ SET(export_headers
|
||||
|
||||
ADD_EXECUTABLE(export_client_files ${export_sources} ${export_headers})
|
||||
|
||||
INSTALL(TARGETS export_client_files RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
|
||||
INSTALL(TARGETS export_client_files RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
|
||||
TARGET_LINK_LIBRARIES(export_client_files ${SERVER_LIBS})
|
||||
TARGET_LINK_LIBRARIES(export_client_files common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY})
|
||||
|
||||
IF(MSVC)
|
||||
SET_TARGET_PROPERTIES(export_client_files PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF")
|
||||
TARGET_LINK_LIBRARIES(export_client_files "Ws2_32.lib")
|
||||
ENDIF(MSVC)
|
||||
|
||||
IF(MINGW)
|
||||
TARGET_LINK_LIBRARIES(export_client_files "WS2_32")
|
||||
ENDIF(MINGW)
|
||||
|
||||
IF(UNIX)
|
||||
TARGET_LINK_LIBRARIES(export_client_files "${CMAKE_DL_LIBS}")
|
||||
TARGET_LINK_LIBRARIES(export_client_files "z")
|
||||
TARGET_LINK_LIBRARIES(export_client_files "m")
|
||||
IF(NOT DARWIN)
|
||||
TARGET_LINK_LIBRARIES(export_client_files "rt")
|
||||
ENDIF(NOT DARWIN)
|
||||
TARGET_LINK_LIBRARIES(export_client_files "pthread")
|
||||
ADD_DEFINITIONS(-fPIC)
|
||||
ENDIF(UNIX)
|
||||
|
||||
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
|
||||
|
||||
@@ -17,9 +17,7 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "../../common/eqemu_logsys.h"
|
||||
#include "../../common/global_define.h"
|
||||
#include "../../common/debug.h"
|
||||
#include "../../common/shareddb.h"
|
||||
#include "../../common/eqemu_config.h"
|
||||
#include "../../common/platform.h"
|
||||
@@ -27,55 +25,47 @@
|
||||
#include "../../common/rulesys.h"
|
||||
#include "../../common/string_util.h"
|
||||
|
||||
EQEmuLogSys LogSys;
|
||||
|
||||
void ExportSpells(SharedDatabase *db);
|
||||
void ExportSkillCaps(SharedDatabase *db);
|
||||
void ExportBaseData(SharedDatabase *db);
|
||||
void ExportDBStrings(SharedDatabase *db);
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
RegisterExecutablePlatform(ExePlatformClientExport);
|
||||
LogSys.LoadLogSettingsDefaults();
|
||||
set_exception_handler();
|
||||
|
||||
Log(Logs::General, Logs::Status, "Client Files Export Utility");
|
||||
LogFile->write(EQEMuLog::Status, "Client Files Export Utility");
|
||||
if(!EQEmuConfig::LoadConfig()) {
|
||||
Log(Logs::General, Logs::Error, "Unable to load configuration file.");
|
||||
LogFile->write(EQEMuLog::Error, "Unable to load configuration file.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
auto Config = EQEmuConfig::get();
|
||||
const EQEmuConfig *config = EQEmuConfig::get();
|
||||
if(!load_log_settings(config->LogSettingsFile.c_str())) {
|
||||
LogFile->write(EQEMuLog::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str());
|
||||
}
|
||||
|
||||
SharedDatabase database;
|
||||
Log(Logs::General, Logs::Status, "Connecting to database...");
|
||||
if(!database.Connect(Config->DatabaseHost.c_str(), Config->DatabaseUsername.c_str(),
|
||||
Config->DatabasePassword.c_str(), Config->DatabaseDB.c_str(), Config->DatabasePort)) {
|
||||
Log(Logs::General, Logs::Error, "Unable to connect to the database, cannot continue without a "
|
||||
LogFile->write(EQEMuLog::Status, "Connecting to database...");
|
||||
if(!database.Connect(config->DatabaseHost.c_str(), config->DatabaseUsername.c_str(),
|
||||
config->DatabasePassword.c_str(), config->DatabaseDB.c_str(), config->DatabasePort)) {
|
||||
LogFile->write(EQEMuLog::Error, "Unable to connect to the database, cannot continue without a "
|
||||
"database connection");
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Register Log System and Settings */
|
||||
database.LoadLogSettings(LogSys.log_settings);
|
||||
LogSys.StartFileLogs();
|
||||
|
||||
ExportSpells(&database);
|
||||
ExportSkillCaps(&database);
|
||||
ExportBaseData(&database);
|
||||
ExportDBStrings(&database);
|
||||
|
||||
LogSys.CloseFileLogs();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ExportSpells(SharedDatabase *db) {
|
||||
Log(Logs::General, Logs::Status, "Exporting Spells...");
|
||||
LogFile->write(EQEMuLog::Status, "Exporting Spells...");
|
||||
|
||||
FILE *f = fopen("export/spells_us.txt", "w");
|
||||
if(!f) {
|
||||
Log(Logs::General, Logs::Error, "Unable to open export/spells_us.txt to write, skipping.");
|
||||
LogFile->write(EQEMuLog::Error, "Unable to open export/spells_us.txt to write, skipping.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -99,6 +89,7 @@ void ExportSpells(SharedDatabase *db) {
|
||||
fprintf(f, "%s\n", line.c_str());
|
||||
}
|
||||
} else {
|
||||
LogFile->write(EQEMuLog::Error, "Error in ExportSpells query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
@@ -112,6 +103,7 @@ bool SkillUsable(SharedDatabase *db, int skill_id, int class_id) {
|
||||
class_id, skill_id);
|
||||
auto results = db->QueryDatabase(query);
|
||||
if(!results.Success()) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in skill_usable query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -131,6 +123,7 @@ int GetSkill(SharedDatabase *db, int skill_id, int class_id, int level) {
|
||||
class_id, skill_id, level);
|
||||
auto results = db->QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in get_skill query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -142,11 +135,11 @@ int GetSkill(SharedDatabase *db, int skill_id, int class_id, int level) {
|
||||
}
|
||||
|
||||
void ExportSkillCaps(SharedDatabase *db) {
|
||||
Log(Logs::General, Logs::Status, "Exporting Skill Caps...");
|
||||
LogFile->write(EQEMuLog::Status, "Exporting Skill Caps...");
|
||||
|
||||
FILE *f = fopen("export/SkillCaps.txt", "w");
|
||||
if(!f) {
|
||||
Log(Logs::General, Logs::Error, "Unable to open export/SkillCaps.txt to write, skipping.");
|
||||
LogFile->write(EQEMuLog::Error, "Unable to open export/SkillCaps.txt to write, skipping.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -171,11 +164,11 @@ void ExportSkillCaps(SharedDatabase *db) {
|
||||
}
|
||||
|
||||
void ExportBaseData(SharedDatabase *db) {
|
||||
Log(Logs::General, Logs::Status, "Exporting Base Data...");
|
||||
LogFile->write(EQEMuLog::Status, "Exporting Base Data...");
|
||||
|
||||
FILE *f = fopen("export/BaseData.txt", "w");
|
||||
if(!f) {
|
||||
Log(Logs::General, Logs::Error, "Unable to open export/BaseData.txt to write, skipping.");
|
||||
LogFile->write(EQEMuLog::Error, "Unable to open export/BaseData.txt to write, skipping.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -196,38 +189,8 @@ void ExportBaseData(SharedDatabase *db) {
|
||||
|
||||
fprintf(f, "%s\n", line.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
void ExportDBStrings(SharedDatabase *db) {
|
||||
Log(Logs::General, Logs::Status, "Exporting DB Strings...");
|
||||
|
||||
FILE *f = fopen("export/dbstr_us.txt", "w");
|
||||
if(!f) {
|
||||
Log(Logs::General, Logs::Error, "Unable to open export/dbstr_us.txt to write, skipping.");
|
||||
return;
|
||||
}
|
||||
|
||||
fprintf(f, "Major^Minor^String(New)\n");
|
||||
const std::string query = "SELECT * FROM db_str ORDER BY id, type";
|
||||
auto results = db->QueryDatabase(query);
|
||||
if(results.Success()) {
|
||||
for(auto row = results.begin(); row != results.end(); ++row) {
|
||||
std::string line;
|
||||
unsigned int fields = results.ColumnCount();
|
||||
for(unsigned int rowIndex = 0; rowIndex < fields; ++rowIndex) {
|
||||
if(rowIndex != 0)
|
||||
line.push_back('^');
|
||||
|
||||
if(row[rowIndex] != nullptr) {
|
||||
line += row[rowIndex];
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(f, "%s\n", line.c_str());
|
||||
}
|
||||
} else {
|
||||
LogFile->write(EQEMuLog::Error, "Error in ExportBaseData query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
|
||||
@@ -9,8 +9,28 @@ SET(import_headers
|
||||
|
||||
ADD_EXECUTABLE(import_client_files ${import_sources} ${import_headers})
|
||||
|
||||
INSTALL(TARGETS import_client_files RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
|
||||
INSTALL(TARGETS import_client_files RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
|
||||
TARGET_LINK_LIBRARIES(import_client_files ${SERVER_LIBS})
|
||||
TARGET_LINK_LIBRARIES(import_client_files common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY})
|
||||
|
||||
IF(MSVC)
|
||||
SET_TARGET_PROPERTIES(import_client_files PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF")
|
||||
TARGET_LINK_LIBRARIES(import_client_files "Ws2_32.lib")
|
||||
ENDIF(MSVC)
|
||||
|
||||
IF(MINGW)
|
||||
TARGET_LINK_LIBRARIES(import_client_files "WS2_32")
|
||||
ENDIF(MINGW)
|
||||
|
||||
IF(UNIX)
|
||||
TARGET_LINK_LIBRARIES(import_client_files "${CMAKE_DL_LIBS}")
|
||||
TARGET_LINK_LIBRARIES(import_client_files "z")
|
||||
TARGET_LINK_LIBRARIES(import_client_files "m")
|
||||
IF(NOT DARWIN)
|
||||
TARGET_LINK_LIBRARIES(import_client_files "rt")
|
||||
ENDIF(NOT DARWIN)
|
||||
TARGET_LINK_LIBRARIES(import_client_files "pthread")
|
||||
ADD_DEFINITIONS(-fPIC)
|
||||
ENDIF(UNIX)
|
||||
|
||||
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
|
||||
|
||||
+23
-110
@@ -16,8 +16,7 @@
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "../../common/eqemu_logsys.h"
|
||||
#include "../../common/global_define.h"
|
||||
#include "../../common/debug.h"
|
||||
#include "../../common/shareddb.h"
|
||||
#include "../../common/eqemu_config.h"
|
||||
#include "../../common/platform.h"
|
||||
@@ -25,45 +24,38 @@
|
||||
#include "../../common/rulesys.h"
|
||||
#include "../../common/string_util.h"
|
||||
|
||||
EQEmuLogSys LogSys;
|
||||
|
||||
void ImportSpells(SharedDatabase *db);
|
||||
void ImportSkillCaps(SharedDatabase *db);
|
||||
void ImportBaseData(SharedDatabase *db);
|
||||
void ImportDBStrings(SharedDatabase *db);
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
RegisterExecutablePlatform(ExePlatformClientImport);
|
||||
LogSys.LoadLogSettingsDefaults();
|
||||
set_exception_handler();
|
||||
|
||||
Log(Logs::General, Logs::Status, "Client Files Import Utility");
|
||||
LogFile->write(EQEMuLog::Status, "Client Files Import Utility");
|
||||
if(!EQEmuConfig::LoadConfig()) {
|
||||
Log(Logs::General, Logs::Error, "Unable to load configuration file.");
|
||||
LogFile->write(EQEMuLog::Error, "Unable to load configuration file.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
auto Config = EQEmuConfig::get();
|
||||
const EQEmuConfig *config = EQEmuConfig::get();
|
||||
if(!load_log_settings(config->LogSettingsFile.c_str())) {
|
||||
LogFile->write(EQEMuLog::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str());
|
||||
}
|
||||
|
||||
SharedDatabase database;
|
||||
Log(Logs::General, Logs::Status, "Connecting to database...");
|
||||
if(!database.Connect(Config->DatabaseHost.c_str(), Config->DatabaseUsername.c_str(),
|
||||
Config->DatabasePassword.c_str(), Config->DatabaseDB.c_str(), Config->DatabasePort)) {
|
||||
Log(Logs::General, Logs::Error, "Unable to connect to the database, cannot continue without a "
|
||||
LogFile->write(EQEMuLog::Status, "Connecting to database...");
|
||||
if(!database.Connect(config->DatabaseHost.c_str(), config->DatabaseUsername.c_str(),
|
||||
config->DatabasePassword.c_str(), config->DatabaseDB.c_str(), config->DatabasePort)) {
|
||||
LogFile->write(EQEMuLog::Error, "Unable to connect to the database, cannot continue without a "
|
||||
"database connection");
|
||||
return 1;
|
||||
}
|
||||
|
||||
database.LoadLogSettings(LogSys.log_settings);
|
||||
LogSys.StartFileLogs();
|
||||
|
||||
ImportSpells(&database);
|
||||
ImportSkillCaps(&database);
|
||||
ImportBaseData(&database);
|
||||
ImportDBStrings(&database);
|
||||
|
||||
LogSys.CloseFileLogs();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -72,35 +64,18 @@ int GetSpellColumns(SharedDatabase *db) {
|
||||
const std::string query = "DESCRIBE spells_new";
|
||||
auto results = db->QueryDatabase(query);
|
||||
if(!results.Success()) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in GetSpellColumns query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
return results.RowCount();
|
||||
}
|
||||
|
||||
bool IsStringField(int i) {
|
||||
switch(i)
|
||||
{
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
return true;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void ImportSpells(SharedDatabase *db) {
|
||||
Log(Logs::General, Logs::Status, "Importing Spells...");
|
||||
LogFile->write(EQEMuLog::Status, "Importing Spells...");
|
||||
FILE *f = fopen("import/spells_us.txt", "r");
|
||||
if(!f) {
|
||||
Log(Logs::General, Logs::Error, "Unable to open import/spells_us.txt to read, skipping.");
|
||||
LogFile->write(EQEMuLog::Error, "Unable to open import/spells_us.txt to read, skipping.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -133,12 +108,7 @@ void ImportSpells(SharedDatabase *db) {
|
||||
sql += "'";
|
||||
}
|
||||
|
||||
if(split[i].compare("") == 0 && !IsStringField(i)) {
|
||||
sql += "0";
|
||||
}
|
||||
else {
|
||||
sql += split[i];
|
||||
}
|
||||
sql += split[i];
|
||||
sql += "'";
|
||||
}
|
||||
|
||||
@@ -153,12 +123,7 @@ void ImportSpells(SharedDatabase *db) {
|
||||
sql += "'";
|
||||
}
|
||||
|
||||
if(split[i].compare("") == 0 && !IsStringField(i)) {
|
||||
sql += "0";
|
||||
} else {
|
||||
sql += split[i];
|
||||
}
|
||||
|
||||
sql += split[i];
|
||||
sql += "'";
|
||||
}
|
||||
|
||||
@@ -173,23 +138,23 @@ void ImportSpells(SharedDatabase *db) {
|
||||
|
||||
spells_imported++;
|
||||
if(spells_imported % 1000 == 0) {
|
||||
Log(Logs::General, Logs::Status, "%d spells imported.", spells_imported);
|
||||
LogFile->write(EQEMuLog::Status, "%d spells imported.", spells_imported);
|
||||
}
|
||||
}
|
||||
|
||||
if(spells_imported % 1000 != 0) {
|
||||
Log(Logs::General, Logs::Status, "%d spells imported.", spells_imported);
|
||||
LogFile->write(EQEMuLog::Status, "%d spells imported.", spells_imported);
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
void ImportSkillCaps(SharedDatabase *db) {
|
||||
Log(Logs::General, Logs::Status, "Importing Skill Caps...");
|
||||
LogFile->write(EQEMuLog::Status, "Importing Skill Caps...");
|
||||
|
||||
FILE *f = fopen("import/SkillCaps.txt", "r");
|
||||
if(!f) {
|
||||
Log(Logs::General, Logs::Error, "Unable to open import/SkillCaps.txt to read, skipping.");
|
||||
LogFile->write(EQEMuLog::Error, "Unable to open import/SkillCaps.txt to read, skipping.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -204,6 +169,7 @@ void ImportSkillCaps(SharedDatabase *db) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
int class_id, skill_id, level, cap;
|
||||
class_id = atoi(split[0].c_str());
|
||||
skill_id = atoi(split[1].c_str());
|
||||
@@ -220,11 +186,11 @@ void ImportSkillCaps(SharedDatabase *db) {
|
||||
}
|
||||
|
||||
void ImportBaseData(SharedDatabase *db) {
|
||||
Log(Logs::General, Logs::Status, "Importing Base Data...");
|
||||
LogFile->write(EQEMuLog::Status, "Importing Base Data...");
|
||||
|
||||
FILE *f = fopen("import/BaseData.txt", "r");
|
||||
if(!f) {
|
||||
Log(Logs::General, Logs::Error, "Unable to open import/BaseData.txt to read, skipping.");
|
||||
LogFile->write(EQEMuLog::Error, "Unable to open import/BaseData.txt to read, skipping.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -263,56 +229,3 @@ void ImportBaseData(SharedDatabase *db) {
|
||||
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
void ImportDBStrings(SharedDatabase *db) {
|
||||
Log(Logs::General, Logs::Status, "Importing DB Strings...");
|
||||
|
||||
FILE *f = fopen("import/dbstr_us.txt", "r");
|
||||
if(!f) {
|
||||
Log(Logs::General, Logs::Error, "Unable to open import/dbstr_us.txt to read, skipping.");
|
||||
return;
|
||||
}
|
||||
|
||||
std::string delete_sql = "DELETE FROM db_str";
|
||||
db->QueryDatabase(delete_sql);
|
||||
|
||||
char buffer[2048];
|
||||
bool first = true;
|
||||
while(fgets(buffer, 2048, f)) {
|
||||
if(first) {
|
||||
first = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
for(int i = 0; i < 2048; ++i) {
|
||||
if(buffer[i] == '\n') {
|
||||
buffer[i] = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
auto split = SplitString(buffer, '^');
|
||||
|
||||
if(split.size() < 2) {
|
||||
continue;
|
||||
}
|
||||
|
||||
std::string sql;
|
||||
int id, type;
|
||||
std::string value;
|
||||
|
||||
id = atoi(split[0].c_str());
|
||||
type = atoi(split[1].c_str());
|
||||
|
||||
if(split.size() >= 3) {
|
||||
value = ::EscapeString(split[2]);
|
||||
}
|
||||
|
||||
sql = StringFormat("INSERT INTO db_str(id, type, value) VALUES(%u, %u, '%s')",
|
||||
id, type, value.c_str());
|
||||
|
||||
db->QueryDatabase(sql);
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
+20
-23
@@ -21,12 +21,6 @@ IF(MYSQL_ROOT)
|
||||
NAMES mysql.h
|
||||
PATHS ${MYSQL_ROOT}/include
|
||||
PATH_SUFFIXES mysql
|
||||
NO_DEFAULT_PATH
|
||||
NO_SYSTEM_ENVIRONMENT_PATH
|
||||
)
|
||||
FIND_PATH(MySQL_INCLUDE_DIR
|
||||
NAMES mysql.h
|
||||
PATH_SUFFIXES mysql
|
||||
)
|
||||
ELSE(MYSQL_ROOT)
|
||||
FIND_PATH(MySQL_INCLUDE_DIR
|
||||
@@ -36,46 +30,49 @@ ELSE(MYSQL_ROOT)
|
||||
ENDIF(MYSQL_ROOT)
|
||||
|
||||
# Library
|
||||
SET(MySQL_NAMES libmysql)
|
||||
SET(MySQL_NAMES mysqlclient_r mysqlclient)
|
||||
IF(MYSQL_ROOT)
|
||||
FIND_LIBRARY(MySQL_LIBRARY
|
||||
FIND_LIBRARY(MySQL_LIBRARY_DEBUG
|
||||
NAMES ${MySQL_NAMES}
|
||||
PATHS ${MYSQL_ROOT}/lib
|
||||
PATHS ${MYSQL_ROOT}/lib/debug /usr/lib /usr/local/lib /usr/lib64 /usr/local/lib64
|
||||
PATH_SUFFIXES mysql
|
||||
NO_DEFAULT_PATH
|
||||
NO_SYSTEM_ENVIRONMENT_PATH
|
||||
)
|
||||
|
||||
FIND_LIBRARY(MySQL_LIBRARY
|
||||
|
||||
FIND_LIBRARY(MySQL_LIBRARY_RELEASE
|
||||
NAMES ${MySQL_NAMES}
|
||||
PATHS ${MYSQL_ROOT}/lib /usr/lib /usr/local/lib /usr/lib64 /usr/local/lib64
|
||||
PATH_SUFFIXES mysql
|
||||
)
|
||||
ELSE(MYSQL_ROOT)
|
||||
FIND_LIBRARY(MySQL_LIBRARY
|
||||
NAMES ${MySQL_NAMES} mysqlclient_r mysqlclient
|
||||
FIND_LIBRARY(MySQL_LIBRARY_DEBUG
|
||||
NAMES ${MySQL_NAMES}
|
||||
PATHS /usr/lib /usr/local/lib /usr/lib64 /usr/local/lib64
|
||||
PATH_SUFFIXES mysql
|
||||
)
|
||||
|
||||
FIND_LIBRARY(MySQL_LIBRARY_RELEASE
|
||||
NAMES ${MySQL_NAMES}
|
||||
PATHS /usr/lib /usr/local/lib /usr/lib64 /usr/local/lib64
|
||||
PATH_SUFFIXES mysql
|
||||
)
|
||||
ENDIF(MYSQL_ROOT)
|
||||
|
||||
IF (MySQL_INCLUDE_DIR AND MySQL_LIBRARY)
|
||||
IF (MySQL_INCLUDE_DIR AND MySQL_LIBRARY_DEBUG AND MySQL_LIBRARY_RELEASE)
|
||||
SET(MySQL_FOUND TRUE)
|
||||
SET( MySQL_LIBRARIES ${MySQL_LIBRARY} )
|
||||
ELSE (MySQL_INCLUDE_DIR AND MySQL_LIBRARY)
|
||||
SET( MySQL_LIBRARIES ${MySQL_LIBRARY_DEBUG} ${MySQL_LIBRARY_RELEASE} )
|
||||
ELSE (MySQL_INCLUDE_DIR AND MySQL_LIBRARY_DEBUG AND MySQL_LIBRARY_RELEASE)
|
||||
SET(MySQL_FOUND FALSE)
|
||||
SET( MySQL_LIBRARIES )
|
||||
ENDIF (MySQL_INCLUDE_DIR AND MySQL_LIBRARY)
|
||||
ENDIF (MySQL_INCLUDE_DIR AND MySQL_LIBRARY_DEBUG AND MySQL_LIBRARY_RELEASE)
|
||||
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set MySQL_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(MySQL DEFAULT_MSG MySQL_LIBRARY MySQL_INCLUDE_DIR)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(MySQL DEFAULT_MSG MySQL_LIBRARY_DEBUG MySQL_LIBRARY_RELEASE MySQL_INCLUDE_DIR)
|
||||
|
||||
IF(MySQL_FOUND)
|
||||
SET( MySQL_LIBRARY_RELEASE ${MySQL_LIBRARY} )
|
||||
SET( MySQL_LIBRARY_DEBUG ${MySQL_LIBRARY} )
|
||||
SET( MySQL_LIBRARIES ${MySQL_LIBRARY_RELEASE} ${MySQL_LIBRARY_DEBUG} )
|
||||
SET( MySQL_LIBRARIES ${MySQL_LIBRARY_DEBUG} ${MySQL_LIBRARY_RELEASE} )
|
||||
ELSE(MySQL_FOUND)
|
||||
SET( MySQL_LIBRARIES )
|
||||
ENDIF(MySQL_FOUND)
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
if (NOT MSVC)
|
||||
include(FindPkgConfig)
|
||||
pkg_check_modules(PC_SODIUM "libsodium")
|
||||
if (NOT PC_SODIUM_FOUND)
|
||||
pkg_check_modules(PC_SODIUM "sodium")
|
||||
endif (NOT PC_SODIUM_FOUND)
|
||||
if (PC_SODIUM_FOUND)
|
||||
set(SODIUM_INCLUDE_HINTS ${PC_SODIUM_INCLUDE_DIRS} ${PC_SODIUM_INCLUDE_DIRS}/*)
|
||||
set(SODIUM_LIBRARY_HINTS ${PC_SODIUM_LIBRARY_DIRS} ${PC_SODIUM_LIBRARY_DIRS}/*)
|
||||
endif()
|
||||
endif (NOT MSVC)
|
||||
|
||||
# some libraries install the headers is a subdirectory of the include dir
|
||||
# returned by pkg-config, so use a wildcard match to improve chances of finding
|
||||
# headers and libraries.
|
||||
find_path(
|
||||
SODIUM_INCLUDE_DIRS
|
||||
NAMES sodium.h
|
||||
HINTS ${SODIUM_INCLUDE_HINTS}
|
||||
)
|
||||
|
||||
find_library(
|
||||
SODIUM_LIBRARIES
|
||||
NAMES libsodium sodium
|
||||
HINTS ${SODIUM_LIBRARY_HINTS}
|
||||
)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(SODIUM DEFAULT_MSG SODIUM_LIBRARIES SODIUM_INCLUDE_DIRS)
|
||||
mark_as_advanced(SODIUM_FOUND SODIUM_LIBRARIES SODIUM_INCLUDE_DIRS)
|
||||
+131
-163
@@ -8,42 +8,36 @@ SET(common_sources
|
||||
crc16.cpp
|
||||
crc32.cpp
|
||||
database.cpp
|
||||
database_conversions.cpp
|
||||
database_instances.cpp
|
||||
dbcore.cpp
|
||||
deity.cpp
|
||||
emu_constants.cpp
|
||||
emu_legacy.cpp
|
||||
emu_limits.cpp
|
||||
debug.cpp
|
||||
emu_opcodes.cpp
|
||||
emu_versions.cpp
|
||||
emu_tcp_connection.cpp
|
||||
emu_tcp_server.cpp
|
||||
eq_dictionary.cpp
|
||||
eqdb.cpp
|
||||
eqdb_res.cpp
|
||||
eqemu_exception.cpp
|
||||
eqemu_config.cpp
|
||||
eqemu_logsys.cpp
|
||||
eq_limits.cpp
|
||||
eqemu_error.cpp
|
||||
eq_packet.cpp
|
||||
eq_stream.cpp
|
||||
eq_stream_factory.cpp
|
||||
eq_stream_ident.cpp
|
||||
eq_stream_proxy.cpp
|
||||
eqtime.cpp
|
||||
event_sub.cpp
|
||||
extprofile.cpp
|
||||
faction.cpp
|
||||
guild_base.cpp
|
||||
guilds.cpp
|
||||
inventory_profile.cpp
|
||||
inventory_slot.cpp
|
||||
ipc_mutex.cpp
|
||||
item_data.cpp
|
||||
item_instance.cpp
|
||||
json_config.cpp
|
||||
light_source.cpp
|
||||
item.cpp
|
||||
logsys.cpp
|
||||
logsys_eqemu.cpp
|
||||
md5.cpp
|
||||
memory_buffer.cpp
|
||||
memory_mapped_file.cpp
|
||||
misc.cpp
|
||||
misc_functions.cpp
|
||||
moremath.cpp
|
||||
mutex.cpp
|
||||
mysql_request_result.cpp
|
||||
mysql_request_row.cpp
|
||||
@@ -59,52 +53,44 @@ SET(common_sources
|
||||
races.cpp
|
||||
rdtsc.cpp
|
||||
rulesys.cpp
|
||||
say_link.cpp
|
||||
serverinfo.cpp
|
||||
shareddb.cpp
|
||||
skills.cpp
|
||||
spdat.cpp
|
||||
string_util.cpp
|
||||
struct_strategy.cpp
|
||||
textures.cpp
|
||||
tcp_connection.cpp
|
||||
tcp_server.cpp
|
||||
timeoutmgr.cpp
|
||||
timer.cpp
|
||||
unix.cpp
|
||||
worldconn.cpp
|
||||
xml_parser.cpp
|
||||
platform.cpp
|
||||
event/event_loop.cpp
|
||||
json/jsoncpp.cpp
|
||||
net/console_server.cpp
|
||||
net/console_server_connection.cpp
|
||||
net/crc32.cpp
|
||||
net/daybreak_connection.cpp
|
||||
net/eqstream.cpp
|
||||
net/packet.cpp
|
||||
net/servertalk_client_connection.cpp
|
||||
net/servertalk_legacy_client_connection.cpp
|
||||
net/servertalk_server.cpp
|
||||
net/servertalk_server_connection.cpp
|
||||
net/tcp_connection.cpp
|
||||
net/tcp_server.cpp
|
||||
patches/client62.cpp
|
||||
patches/patches.cpp
|
||||
patches/sod.cpp
|
||||
patches/sod_limits.cpp
|
||||
patches/sof.cpp
|
||||
patches/sof_limits.cpp
|
||||
patches/rof.cpp
|
||||
patches/rof_limits.cpp
|
||||
patches/rof2.cpp
|
||||
patches/rof2_limits.cpp
|
||||
patches/titanium.cpp
|
||||
patches/titanium_limits.cpp
|
||||
patches/uf.cpp
|
||||
patches/uf_limits.cpp
|
||||
patches/underfoot.cpp
|
||||
SocketLib/Base64.cpp
|
||||
SocketLib/File.cpp
|
||||
SocketLib/HttpdCookies.cpp
|
||||
SocketLib/HttpdForm.cpp
|
||||
SocketLib/HttpdSocket.cpp
|
||||
SocketLib/HTTPSocket.cpp
|
||||
SocketLib/MemFile.cpp
|
||||
SocketLib/Mime.cpp
|
||||
SocketLib/Parse.cpp
|
||||
SocketLib/socket_include.cpp
|
||||
SocketLib/Utility.cpp
|
||||
StackWalker/StackWalker.cpp
|
||||
tinyxml/tinystr.cpp
|
||||
tinyxml/tinyxml.cpp
|
||||
tinyxml/tinyxmlerror.cpp
|
||||
tinyxml/tinyxmlparser.cpp
|
||||
util/directory.cpp
|
||||
util/uuid.cpp
|
||||
)
|
||||
|
||||
SET(common_headers
|
||||
@@ -112,6 +98,7 @@ SET(common_headers
|
||||
base_packet.h
|
||||
base_data.h
|
||||
bodytypes.h
|
||||
breakdowns.h
|
||||
classes.h
|
||||
condition.h
|
||||
crash.h
|
||||
@@ -120,55 +107,53 @@ SET(common_headers
|
||||
data_verification.h
|
||||
database.h
|
||||
dbcore.h
|
||||
debug.h
|
||||
deity.h
|
||||
emu_constants.h
|
||||
emu_legacy.h
|
||||
emu_limits.h
|
||||
emu_opcodes.h
|
||||
emu_oplist.h
|
||||
emu_versions.h
|
||||
emu_tcp_connection.h
|
||||
emu_tcp_server.h
|
||||
eq_constants.h
|
||||
eq_dictionary.h
|
||||
eq_packet_structs.h
|
||||
eqdb.h
|
||||
eqdb_res.h
|
||||
eqemu_exception.h
|
||||
eqemu_config.h
|
||||
eqemu_config_elements.h
|
||||
eqemu_logsys.h
|
||||
eq_limits.h
|
||||
eqemu_error.h
|
||||
eq_packet.h
|
||||
eq_stream.h
|
||||
eq_stream_factory.h
|
||||
eq_stream_ident.h
|
||||
eq_stream_intf.h
|
||||
eq_stream_locator.h
|
||||
eq_stream_proxy.h
|
||||
eq_stream_type.h
|
||||
eqtime.h
|
||||
errmsg.h
|
||||
event_sub.h
|
||||
extprofile.h
|
||||
faction.h
|
||||
features.h
|
||||
fixed_memory_hash_set.h
|
||||
fixed_memory_variable_hash_set.h
|
||||
global_define.h
|
||||
guild_base.h
|
||||
guilds.h
|
||||
inventory_profile.h
|
||||
inventory_slot.h
|
||||
ipc_mutex.h
|
||||
item_data.h
|
||||
item.h
|
||||
item_fieldlist.h
|
||||
item_instance.h
|
||||
json_config.h
|
||||
item_struct.h
|
||||
languages.h
|
||||
light_source.h
|
||||
linked_list.h
|
||||
logsys.h
|
||||
logtypes.h
|
||||
loottable.h
|
||||
mail_oplist.h
|
||||
md5.h
|
||||
memory_buffer.h
|
||||
memory_mapped_file.h
|
||||
misc.h
|
||||
misc_functions.h
|
||||
moremath.h
|
||||
mutex.h
|
||||
mysql_request_result.h
|
||||
mysql_request_row.h
|
||||
@@ -188,7 +173,6 @@ SET(common_headers
|
||||
rdtsc.h
|
||||
rulesys.h
|
||||
ruletypes.h
|
||||
say_link.h
|
||||
seperator.h
|
||||
serverinfo.h
|
||||
servertalk.h
|
||||
@@ -197,159 +181,150 @@ SET(common_headers
|
||||
spdat.h
|
||||
string_util.h
|
||||
struct_strategy.h
|
||||
textures.h
|
||||
tcp_basic_server.h
|
||||
tcp_connection.h
|
||||
tcp_server.h
|
||||
timeoutmgr.h
|
||||
timer.h
|
||||
types.h
|
||||
unix.h
|
||||
useperl.h
|
||||
version.h
|
||||
worldconn.h
|
||||
xml_parser.h
|
||||
zone_numbers.h
|
||||
event/background_task.h
|
||||
event/event_loop.h
|
||||
event/timer.h
|
||||
json/json.h
|
||||
json/json-forwards.h
|
||||
net/console_server.h
|
||||
net/console_server_connection.h
|
||||
net/crc32.h
|
||||
net/daybreak_connection.h
|
||||
net/daybreak_structs.h
|
||||
net/dns.h
|
||||
net/endian.h
|
||||
net/eqstream.h
|
||||
net/packet.h
|
||||
net/servertalk_client_connection.h
|
||||
net/servertalk_legacy_client_connection.h
|
||||
net/servertalk_common.h
|
||||
net/servertalk_server.h
|
||||
net/servertalk_server_connection.h
|
||||
net/tcp_connection.h
|
||||
net/tcp_server.h
|
||||
patches/client62.h
|
||||
patches/client62_constants.h
|
||||
patches/client62_itemfields.h
|
||||
patches/client62_ops.h
|
||||
patches/client62_structs.h
|
||||
patches/patches.h
|
||||
patches/sod.h
|
||||
patches/sod_limits.h
|
||||
patches/sod_constants.h
|
||||
patches/sod_itemfields.h
|
||||
patches/sod_ops.h
|
||||
patches/sod_structs.h
|
||||
patches/sof.h
|
||||
patches/sof_limits.h
|
||||
patches/sof_constants.h
|
||||
patches/sof_itemfields.h
|
||||
patches/sof_opcode_list.h
|
||||
patches/sof_ops.h
|
||||
patches/sof_structs.h
|
||||
patches/ss_declare.h
|
||||
patches/ss_define.h
|
||||
patches/ss_register.h
|
||||
patches/rof.h
|
||||
patches/rof_limits.h
|
||||
patches/rof_constants.h
|
||||
patches/rof_itemfields.h
|
||||
patches/rof_ops.h
|
||||
patches/rof_structs.h
|
||||
patches/rof2.h
|
||||
patches/rof2_limits.h
|
||||
patches/rof2_constants.h
|
||||
patches/rof2_itemfields.h
|
||||
patches/rof2_ops.h
|
||||
patches/rof2_structs.h
|
||||
patches/titanium.h
|
||||
patches/titanium_limits.h
|
||||
patches/titanium_constants.h
|
||||
patches/titanium_itemfields.h
|
||||
patches/titanium_ops.h
|
||||
patches/titanium_structs.h
|
||||
patches/uf.h
|
||||
patches/uf_limits.h
|
||||
patches/uf_ops.h
|
||||
patches/uf_structs.h
|
||||
patches/underfoot.h
|
||||
patches/underfoot_constants.h
|
||||
patches/underfoot_itemfields.h
|
||||
patches/underfoot_ops.h
|
||||
patches/underfoot_structs.h
|
||||
SocketLib/Base64.h
|
||||
SocketLib/File.h
|
||||
SocketLib/HttpdCookies.h
|
||||
SocketLib/HttpdForm.h
|
||||
SocketLib/HttpdSocket.h
|
||||
SocketLib/HTTPSocket.h
|
||||
SocketLib/IFile.h
|
||||
SocketLib/MemFile.h
|
||||
SocketLib/Mime.h
|
||||
SocketLib/Parse.h
|
||||
SocketLib/socket_include.h
|
||||
SocketLib/Utility.h
|
||||
StackWalker/StackWalker.h
|
||||
tinyxml/tinystr.h
|
||||
tinyxml/tinyxml.h
|
||||
util/memory_stream.h
|
||||
util/directory.h
|
||||
util/uuid.h
|
||||
)
|
||||
|
||||
SOURCE_GROUP(Event FILES
|
||||
event/background_task.h
|
||||
event/event_loop.cpp
|
||||
event/event_loop.h
|
||||
event/timer.h
|
||||
)
|
||||
|
||||
SOURCE_GROUP(Json FILES
|
||||
json/json.h
|
||||
json/jsoncpp.cpp
|
||||
json/json-forwards.h
|
||||
)
|
||||
|
||||
SOURCE_GROUP(Net FILES
|
||||
net/console_server.cpp
|
||||
net/console_server.h
|
||||
net/console_server_connection.cpp
|
||||
net/console_server_connection.h
|
||||
net/crc32.cpp
|
||||
net/crc32.h
|
||||
net/daybreak_connection.cpp
|
||||
net/daybreak_connection.h
|
||||
net/daybreak_structs.h
|
||||
net/dns.h
|
||||
net/endian.h
|
||||
net/eqmq.cpp
|
||||
net/eqmq.h
|
||||
net/eqstream.cpp
|
||||
net/eqstream.h
|
||||
net/packet.cpp
|
||||
net/packet.h
|
||||
net/servertalk_client_connection.cpp
|
||||
net/servertalk_client_connection.h
|
||||
net/servertalk_legacy_client_connection.cpp
|
||||
net/servertalk_legacy_client_connection.h
|
||||
net/servertalk_common.h
|
||||
net/servertalk_server.cpp
|
||||
net/servertalk_server.h
|
||||
net/servertalk_server_connection.cpp
|
||||
net/servertalk_server_connection.h
|
||||
net/tcp_connection.cpp
|
||||
net/tcp_connection.h
|
||||
net/tcp_server.cpp
|
||||
net/tcp_server.h
|
||||
)
|
||||
|
||||
SOURCE_GROUP(Patches FILES
|
||||
patches/client62.h
|
||||
patches/client62_itemfields.h
|
||||
patches/client62_ops.h
|
||||
patches/client62_constants.h
|
||||
patches/client62_structs.h
|
||||
patches/patches.h
|
||||
patches/sod.h
|
||||
patches/sod_limits.h
|
||||
patches/sod_itemfields.h
|
||||
patches/sod_ops.h
|
||||
patches/sod_constants.h
|
||||
patches/sod_structs.h
|
||||
patches/sof.h
|
||||
patches/sof_limits.h
|
||||
patches/sof_itemfields.h
|
||||
patches/sof_opcode_list.h
|
||||
patches/sof_ops.h
|
||||
patches/sof_constants.h
|
||||
patches/sof_structs.h
|
||||
patches/ss_declare.h
|
||||
patches/ss_define.h
|
||||
patches/ss_register.h
|
||||
patches/rof.h
|
||||
patches/rof_limits.h
|
||||
patches/rof_itemfields.h
|
||||
patches/rof_ops.h
|
||||
patches/rof_constants.h
|
||||
patches/rof_structs.h
|
||||
patches/rof2.h
|
||||
patches/rof2_limits.h
|
||||
patches/rof2_itemfields.h
|
||||
patches/rof2_ops.h
|
||||
patches/rof2_constants.h
|
||||
patches/rof2_structs.h
|
||||
patches/titanium.h
|
||||
patches/titanium_limits.h
|
||||
patches/titanium_itemfields.h
|
||||
patches/titanium_ops.h
|
||||
patches/titanium_constants.h
|
||||
patches/titanium_structs.h
|
||||
patches/uf.h
|
||||
patches/uf_limits.h
|
||||
patches/uf_ops.h
|
||||
patches/uf_structs.h
|
||||
patches/underfoot.h
|
||||
patches/underfoot_itemfields.h
|
||||
patches/underfoot_ops.h
|
||||
patches/underfoot_constants.h
|
||||
patches/underfoot_structs.h
|
||||
patches/client62.cpp
|
||||
patches/patches.cpp
|
||||
patches/sod.cpp
|
||||
patches/sod_limits.cpp
|
||||
patches/sof.cpp
|
||||
patches/sof_limits.cpp
|
||||
patches/rof.cpp
|
||||
patches/rof_limits.cpp
|
||||
patches/rof2.cpp
|
||||
patches/rof2_limits.cpp
|
||||
patches/titanium.cpp
|
||||
patches/titanium_limits.cpp
|
||||
patches/uf.cpp
|
||||
patches/uf_limits.cpp
|
||||
patches/underfoot.cpp
|
||||
)
|
||||
|
||||
SOURCE_GROUP(SocketLib FILES
|
||||
SocketLib/Base64.h
|
||||
SocketLib/File.h
|
||||
SocketLib/HttpdCookies.h
|
||||
SocketLib/HttpdForm.h
|
||||
SocketLib/HttpdSocket.h
|
||||
SocketLib/HTTPSocket.h
|
||||
SocketLib/IFile.h
|
||||
SocketLib/MemFile.h
|
||||
SocketLib/Mime.h
|
||||
SocketLib/Parse.h
|
||||
SocketLib/socket_include.h
|
||||
SocketLib/Utility.h
|
||||
SocketLib/Base64.cpp
|
||||
SocketLib/File.cpp
|
||||
SocketLib/HttpdCookies.cpp
|
||||
SocketLib/HttpdForm.cpp
|
||||
SocketLib/HttpdSocket.cpp
|
||||
SocketLib/HTTPSocket.cpp
|
||||
SocketLib/MemFile.cpp
|
||||
SocketLib/Mime.cpp
|
||||
SocketLib/Parse.cpp
|
||||
SocketLib/socket_include.cpp
|
||||
SocketLib/Utility.cpp
|
||||
)
|
||||
|
||||
SOURCE_GROUP(StackWalker FILES
|
||||
@@ -366,21 +341,14 @@ SOURCE_GROUP(TinyXML FILES
|
||||
tinyxml/tinyxmlparser.cpp
|
||||
)
|
||||
|
||||
SOURCE_GROUP(Util FILES
|
||||
util/memory_stream.h
|
||||
util/directory.cpp
|
||||
util/directory.h
|
||||
util/uuid.cpp
|
||||
util/uuid.h
|
||||
)
|
||||
|
||||
INCLUDE_DIRECTORIES(Patches SocketLib StackWalker TinyXML)
|
||||
|
||||
ADD_LIBRARY(common ${common_sources} ${common_headers})
|
||||
|
||||
IF(UNIX)
|
||||
ADD_DEFINITIONS(-fPIC)
|
||||
SET_SOURCE_FILES_PROPERTIES("SocketLib/Mime.cpp" PROPERTY COMPILE_FLAGS -Wno-unused-result)
|
||||
SET_SOURCE_FILES_PROPERTIES("patches/sod.cpp" "patches/sof.cpp" "patches/rof.cpp" "patches/rof2.cpp" "patches/uf.cpp" PROPERTIES COMPILE_FLAGS -O0)
|
||||
SET_SOURCE_FILES_PROPERTIES("patches/sod.cpp" "patches/sof.cpp" "patches/rof.cpp" "patches/rof2.cpp" "patches/underfoot.cpp" PROPERTIES COMPILE_FLAGS -O0)
|
||||
ENDIF(UNIX)
|
||||
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#ifdef _WIN32
|
||||
#pragma warning(disable:4786)
|
||||
#endif
|
||||
#include "../global_define.h"
|
||||
#include "../debug.h"
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
#include <stdarg.h>
|
||||
|
||||
@@ -26,7 +26,7 @@ along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "../global_define.h"
|
||||
#include "../debug.h"
|
||||
#ifdef _WIN32
|
||||
#pragma warning(disable:4786)
|
||||
#endif
|
||||
|
||||
@@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#ifdef _WIN32
|
||||
#pragma warning(disable:4786)
|
||||
#endif
|
||||
#include "../global_define.h"
|
||||
#include "../debug.h"
|
||||
#include "Utility.h"
|
||||
#include "HttpdCookies.h"
|
||||
#include "HttpdForm.h"
|
||||
@@ -194,6 +194,7 @@ void HttpdSocket::OnHeaderComplete()
|
||||
|
||||
void HttpdSocket::OnData(const char *p,size_t l)
|
||||
{
|
||||
//printf("Got %d bytes: %.*s\n", l, l, p);
|
||||
if (m_file)
|
||||
{
|
||||
m_file -> fwrite(p,1,l);
|
||||
|
||||
@@ -110,6 +110,7 @@ size_t MemFile::fread(char *ptr, size_t size, size_t nmemb)
|
||||
size_t sz = size * nmemb;
|
||||
if (p + sz < BLOCKSIZE)
|
||||
{
|
||||
//printf("Read @ %d(%d). %d bytes. (%c)\n", m_read_ptr, p, sz, *(m_current_read -> data + p));
|
||||
memcpy(ptr, m_current_read -> data + p, sz);
|
||||
m_read_ptr += sz;
|
||||
}
|
||||
@@ -141,6 +142,7 @@ size_t MemFile::fwrite(const char *ptr, size_t size, size_t nmemb)
|
||||
size_t sz = size * nmemb;
|
||||
if (p + sz < BLOCKSIZE)
|
||||
{
|
||||
//printf("Write @ %d(%d). %d bytes.\n", m_write_ptr, p, sz);
|
||||
memcpy(m_current_write -> data + p, ptr, sz);
|
||||
m_write_ptr += sz;
|
||||
}
|
||||
|
||||
@@ -1128,6 +1128,7 @@ BOOL __stdcall StackWalker::myReadProcMem(
|
||||
SIZE_T st;
|
||||
BOOL bRet = ReadProcessMemory(hProcess, (LPVOID) qwBaseAddress, lpBuffer, nSize, &st);
|
||||
*lpNumberOfBytesRead = (DWORD) st;
|
||||
//printf("ReadMemory: hProcess: %p, baseAddr: %p, buffer: %p, size: %d, read: %d, result: %d\n", hProcess, (LPVOID) qwBaseAddress, lpBuffer, nSize, (DWORD) st, (DWORD) bRet);
|
||||
return bRet;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -15,12 +15,13 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "global_define.h"
|
||||
#include "debug.h"
|
||||
#include "base_packet.h"
|
||||
#include "misc.h"
|
||||
#include "packet_dump.h"
|
||||
|
||||
|
||||
|
||||
BasePacket::BasePacket(const unsigned char *buf, uint32 len)
|
||||
{
|
||||
this->pBuffer=nullptr;
|
||||
|
||||
@@ -21,11 +21,12 @@
|
||||
#include "types.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#ifdef WIN32
|
||||
#include <time.h>
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
#include <winsock2.h>
|
||||
#else
|
||||
#include <sys/time.h>
|
||||
#include <netinet/in.h>
|
||||
@@ -63,12 +64,9 @@ public:
|
||||
void WriteFloat(float value) { *(float *)(pBuffer + _wpos) = value; _wpos += sizeof(float); }
|
||||
void WriteDouble(double value) { *(double *)(pBuffer + _wpos) = value; _wpos += sizeof(double); }
|
||||
void WriteString(const char * str) { uint32 len = static_cast<uint32>(strlen(str)) + 1; memcpy(pBuffer + _wpos, str, len); _wpos += len; }
|
||||
void WriteData(const void *ptr, size_t n) { memcpy(pBuffer + _wpos, ptr, n); _wpos += n; }
|
||||
|
||||
uint8 ReadUInt8() { uint8 value = *(uint8 *)(pBuffer + _rpos); _rpos += sizeof(uint8); return value; }
|
||||
uint8 ReadUInt8(uint32 Offset) const { uint8 value = *(uint8 *)(pBuffer + Offset); return value; }
|
||||
uint16 ReadUInt16() { uint16 value = *(uint16 *)(pBuffer + _rpos); _rpos += sizeof(uint16); return value; }
|
||||
uint16 ReadUInt16(uint32 Offset) const { uint16 value = *(uint16 *)(pBuffer + Offset); return value; }
|
||||
uint32 ReadUInt32() { uint32 value = *(uint32 *)(pBuffer + _rpos); _rpos += sizeof(uint32); return value; }
|
||||
uint32 ReadUInt32(uint32 Offset) const { uint32 value = *(uint32 *)(pBuffer + Offset); return value; }
|
||||
void ReadString(char *str) { uint32 len = static_cast<uint32>(strlen((char *)(pBuffer + _rpos))) + 1; memcpy(str, pBuffer + _rpos, len); _rpos += len; }
|
||||
|
||||
@@ -35,7 +35,6 @@ typedef enum {
|
||||
BT_Greater_Akheva = 14,
|
||||
BT_Khati_Sha = 15,
|
||||
BT_Seru = 16, //not confirmed....
|
||||
BT_Draz_Nurakk = 18,
|
||||
BT_Zek = 19,
|
||||
BT_Luggald = 20,
|
||||
BT_Animal = 21,
|
||||
|
||||
@@ -0,0 +1,134 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
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; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#ifndef BREAKDOWNS_H_
|
||||
#define BREAKDOWNS_H_
|
||||
|
||||
#include "types.h"
|
||||
|
||||
|
||||
#pragma pack(1)
|
||||
struct uint16_breakdown {
|
||||
union {
|
||||
uint16 all;
|
||||
struct {
|
||||
uint8 b1;
|
||||
uint8 b2;
|
||||
} bytes;
|
||||
};
|
||||
inline uint16& operator=(const uint16& val) { return (all=val); }
|
||||
inline uint16* operator&() { return &all; }
|
||||
inline operator uint16&() { return all; }
|
||||
inline uint8& b1() { return bytes.b1; }
|
||||
inline uint8& b2() { return bytes.b2; }
|
||||
};
|
||||
|
||||
struct uint32_breakdown {
|
||||
union {
|
||||
uint32 all;
|
||||
struct {
|
||||
uint16 w1;
|
||||
uint16 w2;
|
||||
} words;
|
||||
struct {
|
||||
uint8 b1;
|
||||
union {
|
||||
struct {
|
||||
uint8 b2;
|
||||
uint8 b3;
|
||||
} middle;
|
||||
uint16 w2_3; // word bytes 2 to 3
|
||||
};
|
||||
uint8 b4;
|
||||
} bytes;
|
||||
};
|
||||
inline uint32& operator=(const uint32& val) { return (all=val); }
|
||||
inline uint32* operator&() { return &all; }
|
||||
inline operator uint32&() { return all; }
|
||||
|
||||
inline uint16& w1() { return words.w1; }
|
||||
inline uint16& w2() { return words.w2; }
|
||||
inline uint16& w2_3() { return bytes.w2_3; }
|
||||
inline uint8& b1() { return bytes.b1; }
|
||||
inline uint8& b2() { return bytes.middle.b2; }
|
||||
inline uint8& b3() { return bytes.middle.b3; }
|
||||
inline uint8& b4() { return bytes.b4; }
|
||||
};
|
||||
/*
|
||||
struct uint64_breakdown {
|
||||
union {
|
||||
uint64 all;
|
||||
struct {
|
||||
uint16 w1; // 1 2
|
||||
uint16 w2; // 3 4
|
||||
uint16 w3; // 5 6
|
||||
uint16 w4; // 7 8
|
||||
};
|
||||
struct {
|
||||
uint32 dw1; // 1 4
|
||||
uint32 dw2; // 5 6
|
||||
};
|
||||
struct {
|
||||
uint8 b1;
|
||||
union {
|
||||
struct {
|
||||
uint16 w2_3;
|
||||
uint16 w4_5;
|
||||
uint16 w6_7;
|
||||
};
|
||||
uint32 dw2_5;
|
||||
struct {
|
||||
uint8 b2;
|
||||
union {
|
||||
uint32 dw3_6;
|
||||
struct {
|
||||
uint8 b3;
|
||||
union {
|
||||
uint32 dw4_7;
|
||||
struct {
|
||||
uint8 b4;
|
||||
uint8 b5;
|
||||
uint8 b6;
|
||||
uint8 b7;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
inline uint64* operator&() { return &all; }
|
||||
inline operator uint64&() { return all; }
|
||||
};
|
||||
*/
|
||||
#pragma pack()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /*BREAKDOWNS_H_*/
|
||||
+272
-573
@@ -1,5 +1,5 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemu.org)
|
||||
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
|
||||
|
||||
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
|
||||
@@ -14,580 +14,279 @@
|
||||
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include "../common/global_define.h"
|
||||
*/
|
||||
#include "../common/debug.h"
|
||||
#include "../common/classes.h"
|
||||
|
||||
const char* GetClassIDName(uint8 class_id, uint8 level)
|
||||
{
|
||||
switch (class_id) {
|
||||
case WARRIOR:
|
||||
if (level >= 70)
|
||||
return "Vanquisher";
|
||||
else if (level >= 65)
|
||||
return "Overlord"; //Baron-Sprite: LEAVE MY CLASSES ALONE.
|
||||
else if (level >= 60)
|
||||
return "Warlord";
|
||||
else if (level >= 55)
|
||||
return "Myrmidon";
|
||||
else if (level >= 51)
|
||||
return "Champion";
|
||||
else
|
||||
return "Warrior";
|
||||
case CLERIC:
|
||||
if (level >= 70)
|
||||
return "Prelate";
|
||||
else if (level >= 65)
|
||||
return "Archon";
|
||||
else if (level >= 60)
|
||||
return "High Priest";
|
||||
else if (level >= 55)
|
||||
return "Templar";
|
||||
else if (level >= 51)
|
||||
return "Vicar";
|
||||
else
|
||||
return "Cleric";
|
||||
case PALADIN:
|
||||
if (level >= 70)
|
||||
return "Lord";
|
||||
else if (level >= 65)
|
||||
return "Lord Protector";
|
||||
else if (level >= 60)
|
||||
return "Crusader";
|
||||
else if (level >= 55)
|
||||
return "Knight";
|
||||
else if (level >= 51)
|
||||
return "Cavalier";
|
||||
else
|
||||
return "Paladin";
|
||||
case RANGER:
|
||||
if (level >= 70)
|
||||
return "Plainswalker";
|
||||
else if (level >= 65)
|
||||
return "Forest Stalker";
|
||||
else if (level >= 60)
|
||||
return "Warder";
|
||||
else if (level >= 55)
|
||||
return "Outrider";
|
||||
else if (level >= 51)
|
||||
return "Pathfinder";
|
||||
else
|
||||
return "Ranger";
|
||||
case SHADOWKNIGHT:
|
||||
if (level >= 70)
|
||||
return "Scourge Knight";
|
||||
else if (level >= 65)
|
||||
return "Dread Lord";
|
||||
else if (level >= 60)
|
||||
return "Grave Lord";
|
||||
else if (level >= 55)
|
||||
return "Revenant";
|
||||
else if (level >= 51)
|
||||
return "Reaver";
|
||||
else
|
||||
return "Shadowknight";
|
||||
case DRUID:
|
||||
if (level >= 70)
|
||||
return "Natureguard";
|
||||
else if (level >= 65)
|
||||
return "Storm Warden";
|
||||
else if (level >= 60)
|
||||
return "Hierophant";
|
||||
else if (level >= 55)
|
||||
return "Preserver";
|
||||
else if (level >= 51)
|
||||
return "Wanderer";
|
||||
else
|
||||
return "Druid";
|
||||
case MONK:
|
||||
if (level >= 70)
|
||||
return "Stone Fist";
|
||||
else if (level >= 65)
|
||||
return "Transcendent";
|
||||
else if (level >= 60)
|
||||
return "Grandmaster";
|
||||
else if (level >= 55)
|
||||
return "Master";
|
||||
else if (level >= 51)
|
||||
return "Disciple";
|
||||
else
|
||||
return "Monk";
|
||||
case BARD:
|
||||
if (level >= 70)
|
||||
return "Performer";
|
||||
else if (level >= 65)
|
||||
return "Maestro";
|
||||
else if (level >= 60)
|
||||
return "Virtuoso";
|
||||
else if (level >= 55)
|
||||
return "Troubadour";
|
||||
else if (level >= 51)
|
||||
return "Minstrel";
|
||||
else
|
||||
return "Bard";
|
||||
case ROGUE:
|
||||
if (level >= 70)
|
||||
return "Nemesis";
|
||||
else if (level >= 65)
|
||||
return "Deceiver";
|
||||
else if (level >= 60)
|
||||
return "Assassin";
|
||||
else if (level >= 55)
|
||||
return "Blackguard";
|
||||
else if (level >= 51)
|
||||
return "Rake";
|
||||
else
|
||||
return "Rogue";
|
||||
case SHAMAN:
|
||||
if (level >= 70)
|
||||
return "Soothsayer";
|
||||
else if (level >= 65)
|
||||
return "Prophet";
|
||||
else if (level >= 60)
|
||||
return "Oracle";
|
||||
else if (level >= 55)
|
||||
return "Luminary";
|
||||
else if (level >= 51)
|
||||
return "Mystic";
|
||||
else
|
||||
return "Shaman";
|
||||
case NECROMANCER:
|
||||
if (level >= 70)
|
||||
return "Wraith";
|
||||
else if (level >= 65)
|
||||
return "Arch Lich";
|
||||
else if (level >= 60)
|
||||
return "Warlock";
|
||||
else if (level >= 55)
|
||||
return "Defiler";
|
||||
else if (level >= 51)
|
||||
return "Heretic";
|
||||
else
|
||||
return "Necromancer";
|
||||
case WIZARD:
|
||||
if (level >= 70)
|
||||
return "Grand Arcanist";
|
||||
else if (level >= 65)
|
||||
return "Arcanist";
|
||||
else if (level >= 60)
|
||||
return "Sorcerer";
|
||||
else if (level >= 55)
|
||||
return "Evoker";
|
||||
else if (level >= 51)
|
||||
return "Channeler";
|
||||
else
|
||||
return "Wizard";
|
||||
case MAGICIAN:
|
||||
if (level >= 70)
|
||||
return "Arch Magus";
|
||||
else if (level >= 65)
|
||||
return "Arch Convoker";
|
||||
else if (level >= 60)
|
||||
return "Arch Mage";
|
||||
else if (level >= 55)
|
||||
return "Conjurer";
|
||||
if (level >= 51)
|
||||
return "Elementalist";
|
||||
else
|
||||
return "Magician";
|
||||
case ENCHANTER:
|
||||
if (level >= 70)
|
||||
return "Bedazzler";
|
||||
else if (level >= 65)
|
||||
return "Coercer";
|
||||
else if (level >= 60)
|
||||
return "Phantasmist";
|
||||
else if (level >= 55)
|
||||
return "Beguiler";
|
||||
else if (level >= 51)
|
||||
return "Illusionist";
|
||||
else
|
||||
return "Enchanter";
|
||||
case BEASTLORD:
|
||||
if (level >= 70)
|
||||
return "Wildblood";
|
||||
else if (level >= 65)
|
||||
return "Feral Lord";
|
||||
else if (level >= 60)
|
||||
return "Savage Lord";
|
||||
else if (level >= 55)
|
||||
return "Animist";
|
||||
else if (level >= 51)
|
||||
return "Primalist";
|
||||
else
|
||||
return "Beastlord";
|
||||
case BERSERKER:
|
||||
if (level >= 70)
|
||||
return "Ravager";
|
||||
else if (level >= 65)
|
||||
return "Fury";
|
||||
else if (level >= 60)
|
||||
return "Rager";
|
||||
else if (level >= 55)
|
||||
return "Vehement";
|
||||
else if (level >= 51)
|
||||
return "Brawler";
|
||||
else
|
||||
return "Berserker";
|
||||
case BANKER:
|
||||
if (level >= 70)
|
||||
return "Master Banker";
|
||||
else if (level >= 65)
|
||||
return "Elder Banker";
|
||||
else if (level >= 60)
|
||||
return "Oldest Banker";
|
||||
else if (level >= 55)
|
||||
return "Older Banker";
|
||||
else if (level >= 51)
|
||||
return "Old Banker";
|
||||
else
|
||||
return "Banker";
|
||||
case WARRIORGM:
|
||||
return "Warrior Guildmaster";
|
||||
case CLERICGM:
|
||||
return "Cleric Guildmaster";
|
||||
case PALADINGM:
|
||||
return "Paladin Guildmaster";
|
||||
case RANGERGM:
|
||||
return "Ranger Guildmaster";
|
||||
case SHADOWKNIGHTGM:
|
||||
return "Shadowknight Guildmaster";
|
||||
case DRUIDGM:
|
||||
return "Druid Guildmaster";
|
||||
case MONKGM:
|
||||
return "Monk Guildmaster";
|
||||
case BARDGM:
|
||||
return "Bard Guildmaster";
|
||||
case ROGUEGM:
|
||||
return "Rogue Guildmaster";
|
||||
case SHAMANGM:
|
||||
return "Shaman Guildmaster";
|
||||
case NECROMANCERGM:
|
||||
return "Necromancer Guildmaster";
|
||||
case WIZARDGM:
|
||||
return "Wizard Guildmaster";
|
||||
case MAGICIANGM:
|
||||
return "Magician Guildmaster";
|
||||
case ENCHANTERGM:
|
||||
return "Enchanter Guildmaster";
|
||||
case BEASTLORDGM:
|
||||
return "Beastlord Guildmaster";
|
||||
case BERSERKERGM:
|
||||
return "Berserker Guildmaster";
|
||||
case MERCHANT:
|
||||
return "Merchant";
|
||||
case ADVENTURERECRUITER:
|
||||
return "Adventure Recruiter";
|
||||
case ADVENTUREMERCHANT:
|
||||
return "Adventure Merchant";
|
||||
case CORPSE_CLASS:
|
||||
return "Corpse Class";
|
||||
case TRIBUTE_MASTER:
|
||||
return "Tribute Master";
|
||||
case GUILD_TRIBUTE_MASTER:
|
||||
return "Guild Tribute Master";
|
||||
default:
|
||||
return "Unknown";
|
||||
const char* GetEQClassName(uint8 class_, uint8 level) {
|
||||
switch(class_) {
|
||||
case WARRIOR:
|
||||
if (level >= 70)
|
||||
return "Vanquisher";
|
||||
else if (level >= 65)
|
||||
return "Overlord"; //Baron-Sprite: LEAVE MY CLASSES ALONE.
|
||||
else if (level >= 60)
|
||||
return "Warlord";
|
||||
else if (level >= 55)
|
||||
return "Myrmidon";
|
||||
else if (level >= 51)
|
||||
return "Champion";
|
||||
else
|
||||
return "Warrior";
|
||||
case CLERIC:
|
||||
if (level >= 70)
|
||||
return "Prelate";
|
||||
else if (level >= 65)
|
||||
return "Archon";
|
||||
else if (level >= 60)
|
||||
return "High Priest";
|
||||
else if (level >= 55)
|
||||
return "Templar";
|
||||
else if (level >= 51)
|
||||
return "Vicar";
|
||||
else
|
||||
return "Cleric";
|
||||
case PALADIN:
|
||||
if (level >= 70)
|
||||
return "Lord";
|
||||
else if (level >= 65)
|
||||
return "Lord Protector";
|
||||
else if (level >= 60)
|
||||
return "Crusader";
|
||||
else if (level >= 55)
|
||||
return "Knight";
|
||||
else if (level >= 51)
|
||||
return "Cavalier";
|
||||
else
|
||||
return "Paladin";
|
||||
case RANGER:
|
||||
if (level >= 70)
|
||||
return "Plainswalker";
|
||||
else if (level >= 65)
|
||||
return "Forest Stalker";
|
||||
else if (level >= 60)
|
||||
return "Warder";
|
||||
else if (level >= 55)
|
||||
return "Outrider";
|
||||
else if (level >= 51)
|
||||
return "Pathfinder";
|
||||
else
|
||||
return "Ranger";
|
||||
case SHADOWKNIGHT:
|
||||
if (level >= 70)
|
||||
return "Scourge Knight";
|
||||
else if (level >= 65)
|
||||
return "Dread Lord";
|
||||
else if (level >= 60)
|
||||
return "Grave Lord";
|
||||
else if (level >= 55)
|
||||
return "Revenant";
|
||||
else if (level >= 51)
|
||||
return "Reaver";
|
||||
else
|
||||
return "Shadowknight";
|
||||
case DRUID:
|
||||
if (level >= 70)
|
||||
return "Natureguard";
|
||||
else if (level >= 65)
|
||||
return "Storm Warden";
|
||||
else if (level >= 60)
|
||||
return "Hierophant";
|
||||
else if (level >= 55)
|
||||
return "Preserver";
|
||||
else if (level >= 51)
|
||||
return "Wanderer";
|
||||
else
|
||||
return "Druid";
|
||||
case MONK:
|
||||
if (level >= 70)
|
||||
return "Stone Fist";
|
||||
else if (level >= 65)
|
||||
return "Transcendent";
|
||||
else if (level >= 60)
|
||||
return "Grandmaster";
|
||||
else if (level >= 55)
|
||||
return "Master";
|
||||
else if (level >= 51)
|
||||
return "Disciple";
|
||||
else
|
||||
return "Monk";
|
||||
case BARD:
|
||||
if (level >= 70)
|
||||
return "Performer";
|
||||
else if (level >= 65)
|
||||
return "Maestro";
|
||||
else if (level >= 60)
|
||||
return "Virtuoso";
|
||||
else if (level >= 55)
|
||||
return "Troubadour";
|
||||
else if (level >= 51)
|
||||
return "Minstrel";
|
||||
else
|
||||
return "Bard";
|
||||
case ROGUE:
|
||||
if (level >= 70)
|
||||
return "Nemesis";
|
||||
else if (level >= 65)
|
||||
return "Deceiver";
|
||||
else if (level >= 60)
|
||||
return "Assassin";
|
||||
else if (level >= 55)
|
||||
return "Blackguard";
|
||||
else if (level >= 51)
|
||||
return "Rake";
|
||||
else
|
||||
return "Rogue";
|
||||
case SHAMAN:
|
||||
if (level >= 70)
|
||||
return "Soothsayer";
|
||||
else if (level >= 65)
|
||||
return "Prophet";
|
||||
else if (level >= 60)
|
||||
return "Oracle";
|
||||
else if (level >= 55)
|
||||
return "Luminary";
|
||||
else if (level >= 51)
|
||||
return "Mystic";
|
||||
else
|
||||
return "Shaman";
|
||||
case NECROMANCER:
|
||||
if (level >= 70)
|
||||
return "Wraith";
|
||||
else if (level >= 65)
|
||||
return "Arch Lich";
|
||||
else if (level >= 60)
|
||||
return "Warlock";
|
||||
else if (level >= 55)
|
||||
return "Defiler";
|
||||
else if (level >= 51)
|
||||
return "Heretic";
|
||||
else
|
||||
return "Necromancer";
|
||||
case WIZARD:
|
||||
if (level >= 70)
|
||||
return "Grand Arcanist";
|
||||
else if (level >= 65)
|
||||
return "Arcanist";
|
||||
else if (level >= 60)
|
||||
return "Sorcerer";
|
||||
else if (level >= 55)
|
||||
return "Evoker";
|
||||
else if (level >= 51)
|
||||
return "Channeler";
|
||||
else
|
||||
return "Wizard";
|
||||
case MAGICIAN:
|
||||
if (level >= 70)
|
||||
return "Arch Magus";
|
||||
else if (level >= 65)
|
||||
return "Arch Convoker";
|
||||
else if (level >= 60)
|
||||
return "Arch Mage";
|
||||
else if (level >= 55)
|
||||
return "Conjurer";
|
||||
if (level >= 51)
|
||||
return "Elementalist";
|
||||
else
|
||||
return "Magician";
|
||||
case ENCHANTER:
|
||||
if (level >= 70)
|
||||
return "Bedazzler";
|
||||
else if (level >= 65)
|
||||
return "Coercer";
|
||||
else if (level >= 60)
|
||||
return "Phantasmist";
|
||||
else if (level >= 55)
|
||||
return "Beguiler";
|
||||
else if (level >= 51)
|
||||
return "Illusionist";
|
||||
else
|
||||
return "Enchanter";
|
||||
case BEASTLORD:
|
||||
if (level >= 70)
|
||||
return "Wildblood";
|
||||
else if (level >= 65)
|
||||
return "Feral Lord";
|
||||
else if (level >= 60)
|
||||
return "Savage Lord";
|
||||
else if (level >= 55)
|
||||
return "Animist";
|
||||
else if (level >= 51)
|
||||
return "Primalist";
|
||||
else
|
||||
return "Beastlord";
|
||||
case BERSERKER:
|
||||
if (level >= 70)
|
||||
return "Ravager";
|
||||
else if (level >= 65)
|
||||
return "Fury";
|
||||
else if (level >= 60)
|
||||
return "Rager";
|
||||
else if (level >= 55)
|
||||
return "Vehement";
|
||||
else if (level >= 51)
|
||||
return "Brawler";
|
||||
else
|
||||
return "Berserker";
|
||||
case BANKER:
|
||||
if (level >= 70)
|
||||
return "Master Banker";
|
||||
else if (level >= 65)
|
||||
return "Elder Banker";
|
||||
else if (level >= 60)
|
||||
return "Oldest Banker";
|
||||
else if (level >= 55)
|
||||
return "Older Banker";
|
||||
else if (level >= 51)
|
||||
return "Old Banker";
|
||||
else
|
||||
return "Banker";
|
||||
case WARRIORGM:
|
||||
return "Warrior Guildmaster";
|
||||
case CLERICGM:
|
||||
return "Cleric Guildmaster";
|
||||
case PALADINGM:
|
||||
return "Paladin Guildmaster";
|
||||
case RANGERGM:
|
||||
return "Ranger Guildmaster";
|
||||
case SHADOWKNIGHTGM:
|
||||
return "Shadowknight Guildmaster";
|
||||
case DRUIDGM:
|
||||
return "Druid Guildmaster";
|
||||
case MONKGM:
|
||||
return "Monk Guildmaster";
|
||||
case BARDGM:
|
||||
return "Bard Guildmaster";
|
||||
case ROGUEGM:
|
||||
return "Rogue Guildmaster";
|
||||
case SHAMANGM:
|
||||
return "Shaman Guildmaster";
|
||||
case NECROMANCERGM:
|
||||
return "Necromancer Guildmaster";
|
||||
case WIZARDGM:
|
||||
return "Wizard Guildmaster";
|
||||
case MAGICIANGM:
|
||||
return "Magician Guildmaster";
|
||||
case ENCHANTERGM:
|
||||
return "Enchanter Guildmaster";
|
||||
case BEASTLORDGM:
|
||||
return "Beastlord Guildmaster";
|
||||
case BERSERKERGM:
|
||||
return "Berserker Guildmaster";
|
||||
case MERCHANT:
|
||||
return "Merchant";
|
||||
case ADVENTURERECRUITER:
|
||||
return "Adventure Recruiter";
|
||||
case ADVENTUREMERCHANT:
|
||||
return "Adventure Merchant";
|
||||
case CORPSE_CLASS:
|
||||
return "Corpse Class";
|
||||
case TRIBUTE_MASTER:
|
||||
return "Tribute Master";
|
||||
case GUILD_TRIBUTE_MASTER:
|
||||
return "Guild Tribute Master";
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
const char* GetPlayerClassName(uint32 player_class_value, uint8 level)
|
||||
{
|
||||
return GetClassIDName(GetClassIDFromPlayerClassValue(player_class_value), level);
|
||||
}
|
||||
|
||||
uint32 GetPlayerClassValue(uint8 class_id)
|
||||
{
|
||||
switch (class_id) {
|
||||
case WARRIOR:
|
||||
case CLERIC:
|
||||
case PALADIN:
|
||||
case RANGER:
|
||||
case SHADOWKNIGHT:
|
||||
case DRUID:
|
||||
case MONK:
|
||||
case BARD:
|
||||
case ROGUE:
|
||||
case SHAMAN:
|
||||
case NECROMANCER:
|
||||
case WIZARD:
|
||||
case MAGICIAN:
|
||||
case ENCHANTER:
|
||||
case BEASTLORD:
|
||||
case BERSERKER:
|
||||
return class_id;
|
||||
default:
|
||||
return PLAYER_CLASS_UNKNOWN; // watch
|
||||
}
|
||||
}
|
||||
|
||||
uint32 GetPlayerClassBit(uint8 class_id)
|
||||
{
|
||||
switch (class_id) {
|
||||
case WARRIOR:
|
||||
return PLAYER_CLASS_WARRIOR_BIT;
|
||||
case CLERIC:
|
||||
return PLAYER_CLASS_CLERIC_BIT;
|
||||
case PALADIN:
|
||||
return PLAYER_CLASS_PALADIN_BIT;
|
||||
case RANGER:
|
||||
return PLAYER_CLASS_RANGER_BIT;
|
||||
case SHADOWKNIGHT:
|
||||
return PLAYER_CLASS_SHADOWKNIGHT_BIT;
|
||||
case DRUID:
|
||||
return PLAYER_CLASS_DRUID_BIT;
|
||||
case MONK:
|
||||
return PLAYER_CLASS_MONK_BIT;
|
||||
case BARD:
|
||||
return PLAYER_CLASS_BARD_BIT;
|
||||
case ROGUE:
|
||||
return PLAYER_CLASS_ROGUE_BIT;
|
||||
case SHAMAN:
|
||||
return PLAYER_CLASS_SHAMAN_BIT;
|
||||
case NECROMANCER:
|
||||
return PLAYER_CLASS_NECROMANCER_BIT;
|
||||
case WIZARD:
|
||||
return PLAYER_CLASS_WIZARD_BIT;
|
||||
case MAGICIAN:
|
||||
return PLAYER_CLASS_MAGICIAN_BIT;
|
||||
case ENCHANTER:
|
||||
return PLAYER_CLASS_ENCHANTER_BIT;
|
||||
case BEASTLORD:
|
||||
return PLAYER_CLASS_BEASTLORD_BIT;
|
||||
case BERSERKER:
|
||||
return PLAYER_CLASS_BERSERKER_BIT;
|
||||
default:
|
||||
return PLAYER_CLASS_UNKNOWN_BIT;
|
||||
}
|
||||
}
|
||||
|
||||
uint8 GetClassIDFromPlayerClassValue(uint32 player_class_value)
|
||||
{
|
||||
switch (player_class_value) {
|
||||
case PLAYER_CLASS_WARRIOR:
|
||||
case PLAYER_CLASS_CLERIC:
|
||||
case PLAYER_CLASS_PALADIN:
|
||||
case PLAYER_CLASS_RANGER:
|
||||
case PLAYER_CLASS_SHADOWKNIGHT:
|
||||
case PLAYER_CLASS_DRUID:
|
||||
case PLAYER_CLASS_MONK:
|
||||
case PLAYER_CLASS_BARD:
|
||||
case PLAYER_CLASS_ROGUE:
|
||||
case PLAYER_CLASS_SHAMAN:
|
||||
case PLAYER_CLASS_NECROMANCER:
|
||||
case PLAYER_CLASS_WIZARD:
|
||||
case PLAYER_CLASS_MAGICIAN:
|
||||
case PLAYER_CLASS_ENCHANTER:
|
||||
case PLAYER_CLASS_BEASTLORD:
|
||||
case PLAYER_CLASS_BERSERKER:
|
||||
return player_class_value;
|
||||
default:
|
||||
return PLAYER_CLASS_UNKNOWN; // watch
|
||||
}
|
||||
}
|
||||
|
||||
uint8 GetClassIDFromPlayerClassBit(uint32 player_class_bit)
|
||||
{
|
||||
switch (player_class_bit) {
|
||||
case PLAYER_CLASS_WARRIOR_BIT:
|
||||
return WARRIOR;
|
||||
case PLAYER_CLASS_CLERIC_BIT:
|
||||
return CLERIC;
|
||||
case PLAYER_CLASS_PALADIN_BIT:
|
||||
return PALADIN;
|
||||
case PLAYER_CLASS_RANGER_BIT:
|
||||
return RANGER;
|
||||
case PLAYER_CLASS_SHADOWKNIGHT_BIT:
|
||||
return SHADOWKNIGHT;
|
||||
case PLAYER_CLASS_DRUID_BIT:
|
||||
return DRUID;
|
||||
case PLAYER_CLASS_MONK_BIT:
|
||||
return MONK;
|
||||
case PLAYER_CLASS_BARD_BIT:
|
||||
return BARD;
|
||||
case PLAYER_CLASS_ROGUE_BIT:
|
||||
return ROGUE;
|
||||
case PLAYER_CLASS_SHAMAN_BIT:
|
||||
return SHAMAN;
|
||||
case PLAYER_CLASS_NECROMANCER_BIT:
|
||||
return NECROMANCER;
|
||||
case PLAYER_CLASS_WIZARD_BIT:
|
||||
return WIZARD;
|
||||
case PLAYER_CLASS_MAGICIAN_BIT:
|
||||
return MAGICIAN;
|
||||
case PLAYER_CLASS_ENCHANTER_BIT:
|
||||
return ENCHANTER;
|
||||
case PLAYER_CLASS_BEASTLORD_BIT:
|
||||
return BEASTLORD;
|
||||
case PLAYER_CLASS_BERSERKER_BIT:
|
||||
return BERSERKER;
|
||||
default:
|
||||
return PLAYER_CLASS_UNKNOWN; // watch
|
||||
}
|
||||
}
|
||||
|
||||
bool IsFighterClass(uint8 class_id)
|
||||
{
|
||||
switch (class_id) {
|
||||
case WARRIOR:
|
||||
case PALADIN:
|
||||
case RANGER:
|
||||
case SHADOWKNIGHT:
|
||||
case MONK:
|
||||
case BARD:
|
||||
case ROGUE:
|
||||
case BEASTLORD:
|
||||
case BERSERKER:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool IsSpellFighterClass(uint8 class_id)
|
||||
{
|
||||
switch (class_id) {
|
||||
case PALADIN:
|
||||
case RANGER:
|
||||
case SHADOWKNIGHT:
|
||||
case BEASTLORD:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool IsNonSpellFighterClass(uint8 class_id)
|
||||
{
|
||||
switch (class_id) {
|
||||
case WARRIOR:
|
||||
case MONK:
|
||||
case BARD:
|
||||
case ROGUE:
|
||||
case BERSERKER:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool IsCasterClass(uint8 class_id)
|
||||
{
|
||||
switch (class_id) {
|
||||
case CLERIC:
|
||||
case DRUID:
|
||||
case SHAMAN:
|
||||
case NECROMANCER:
|
||||
case WIZARD:
|
||||
case MAGICIAN:
|
||||
case ENCHANTER:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool IsINTCasterClass(uint8 class_id)
|
||||
{
|
||||
switch (class_id) {
|
||||
case NECROMANCER:
|
||||
case WIZARD:
|
||||
case MAGICIAN:
|
||||
case ENCHANTER:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool IsWISCasterClass(uint8 class_id)
|
||||
{
|
||||
switch (class_id) {
|
||||
case CLERIC:
|
||||
case DRUID:
|
||||
case SHAMAN:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool IsPlateClass(uint8 class_id)
|
||||
{
|
||||
switch (class_id) {
|
||||
case WARRIOR:
|
||||
case CLERIC:
|
||||
case PALADIN:
|
||||
case SHADOWKNIGHT:
|
||||
case BARD:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool IsChainClass(uint8 class_id)
|
||||
{
|
||||
switch (class_id) {
|
||||
case RANGER:
|
||||
case ROGUE:
|
||||
case SHAMAN:
|
||||
case BERSERKER:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool IsLeatherClass(uint8 class_id)
|
||||
{
|
||||
switch (class_id) {
|
||||
case DRUID:
|
||||
case MONK:
|
||||
case BEASTLORD:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool IsClothClass(uint8 class_id)
|
||||
{
|
||||
switch (class_id) {
|
||||
case NECROMANCER:
|
||||
case WIZARD:
|
||||
case MAGICIAN:
|
||||
case ENCHANTER:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
uint8 ClassArmorType(uint8 class_id)
|
||||
{
|
||||
switch (class_id) {
|
||||
case WARRIOR:
|
||||
case CLERIC:
|
||||
case PALADIN:
|
||||
case SHADOWKNIGHT:
|
||||
case BARD:
|
||||
return ARMOR_TYPE_PLATE;
|
||||
case RANGER:
|
||||
case ROGUE:
|
||||
case SHAMAN:
|
||||
case BERSERKER:
|
||||
return ARMOR_TYPE_CHAIN;
|
||||
case DRUID:
|
||||
case MONK:
|
||||
case BEASTLORD:
|
||||
return ARMOR_TYPE_LEATHER;
|
||||
case NECROMANCER:
|
||||
case WIZARD:
|
||||
case MAGICIAN:
|
||||
case ENCHANTER:
|
||||
return ARMOR_TYPE_CLOTH;
|
||||
default:
|
||||
return ARMOR_TYPE_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
+42
-100
@@ -1,5 +1,5 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemu.org)
|
||||
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
|
||||
|
||||
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
|
||||
@@ -17,25 +17,26 @@
|
||||
*/
|
||||
#ifndef CLASSES_CH
|
||||
#define CLASSES_CH
|
||||
|
||||
#include "../common/types.h"
|
||||
|
||||
#define WARRIOR 1
|
||||
#define CLERIC 2
|
||||
#define PALADIN 3
|
||||
#define RANGER 4
|
||||
#define SHADOWKNIGHT 5
|
||||
#define DRUID 6
|
||||
#define MONK 7
|
||||
#define BARD 8
|
||||
#define ROGUE 9
|
||||
#define SHAMAN 10
|
||||
#define NECROMANCER 11
|
||||
#define WIZARD 12
|
||||
#define MAGICIAN 13
|
||||
#define ENCHANTER 14
|
||||
#define BEASTLORD 15
|
||||
#define BERSERKER 16
|
||||
#define Array_Class_UNKNOWN 0
|
||||
#define WARRIOR 1
|
||||
#define CLERIC 2
|
||||
#define PALADIN 3
|
||||
#define RANGER 4
|
||||
#define SHADOWKNIGHT 5
|
||||
#define DRUID 6
|
||||
#define MONK 7
|
||||
#define BARD 8
|
||||
#define ROGUE 9
|
||||
#define SHAMAN 10
|
||||
#define NECROMANCER 11
|
||||
#define WIZARD 12
|
||||
#define MAGICIAN 13
|
||||
#define ENCHANTER 14
|
||||
#define BEASTLORD 15
|
||||
#define BERSERKER 16
|
||||
#define PLAYER_CLASS_COUNT 16 // used for array defines, must be the count of playable classes
|
||||
#define WARRIORGM 20
|
||||
#define CLERICGM 21
|
||||
#define PALADINGM 22
|
||||
@@ -57,92 +58,33 @@
|
||||
#define DISCORD_MERCHANT 59
|
||||
#define ADVENTURERECRUITER 60
|
||||
#define ADVENTUREMERCHANT 61
|
||||
#define LDON_TREASURE 62 // objects you can use /open on first seen in LDONs
|
||||
#define CORPSE_CLASS 62 // only seen on Danvi's Corpse in Akheva so far..
|
||||
#define TRIBUTE_MASTER 63
|
||||
#define GUILD_TRIBUTE_MASTER 64 // not sure
|
||||
#define LDON_TREASURE 62 //objects you can use /open on first seen in LDONs
|
||||
#define CORPSE_CLASS 62 //only seen on Danvi's Corpse in Akheva so far..
|
||||
#define TRIBUTE_MASTER 63
|
||||
#define GUILD_TRIBUTE_MASTER 64 //not sure
|
||||
#define NORRATHS_KEEPERS_MERCHANT 67
|
||||
#define DARK_REIGN_MERCHANT 68
|
||||
#define FELLOWSHIP_MASTER 69
|
||||
#define ALT_CURRENCY_MERCHANT 70
|
||||
#define MERCERNARY_MASTER 71
|
||||
#define warrior_1 1
|
||||
#define monk_1 64
|
||||
#define paladin_1 4
|
||||
#define shadow_1 16
|
||||
#define bard_1 128
|
||||
#define cleric_1 2
|
||||
#define necromancer_1 1024
|
||||
#define ranger_1 8
|
||||
#define druid_1 32
|
||||
#define mage_1 4096
|
||||
#define wizard_1 2048
|
||||
#define enchanter_1 8192
|
||||
#define rogue_1 256
|
||||
#define shaman_1 512
|
||||
#define beastlord_1 16384
|
||||
#define berserker_1 32768
|
||||
#define call_1 65536
|
||||
|
||||
|
||||
// player class values
|
||||
#define PLAYER_CLASS_UNKNOWN 0
|
||||
#define PLAYER_CLASS_WARRIOR 1
|
||||
#define PLAYER_CLASS_CLERIC 2
|
||||
#define PLAYER_CLASS_PALADIN 3
|
||||
#define PLAYER_CLASS_RANGER 4
|
||||
#define PLAYER_CLASS_SHADOWKNIGHT 5
|
||||
#define PLAYER_CLASS_DRUID 6
|
||||
#define PLAYER_CLASS_MONK 7
|
||||
#define PLAYER_CLASS_BARD 8
|
||||
#define PLAYER_CLASS_ROGUE 9
|
||||
#define PLAYER_CLASS_SHAMAN 10
|
||||
#define PLAYER_CLASS_NECROMANCER 11
|
||||
#define PLAYER_CLASS_WIZARD 12
|
||||
#define PLAYER_CLASS_MAGICIAN 13
|
||||
#define PLAYER_CLASS_ENCHANTER 14
|
||||
#define PLAYER_CLASS_BEASTLORD 15
|
||||
#define PLAYER_CLASS_BERSERKER 16
|
||||
|
||||
#define PLAYER_CLASS_COUNT 16
|
||||
|
||||
|
||||
// player class bits
|
||||
#define PLAYER_CLASS_UNKNOWN_BIT 0
|
||||
#define PLAYER_CLASS_WARRIOR_BIT 1
|
||||
#define PLAYER_CLASS_CLERIC_BIT 2
|
||||
#define PLAYER_CLASS_PALADIN_BIT 4
|
||||
#define PLAYER_CLASS_RANGER_BIT 8
|
||||
#define PLAYER_CLASS_SHADOWKNIGHT_BIT 16
|
||||
#define PLAYER_CLASS_DRUID_BIT 32
|
||||
#define PLAYER_CLASS_MONK_BIT 64
|
||||
#define PLAYER_CLASS_BARD_BIT 128
|
||||
#define PLAYER_CLASS_ROGUE_BIT 256
|
||||
#define PLAYER_CLASS_SHAMAN_BIT 512
|
||||
#define PLAYER_CLASS_NECROMANCER_BIT 1024
|
||||
#define PLAYER_CLASS_WIZARD_BIT 2048
|
||||
#define PLAYER_CLASS_MAGICIAN_BIT 4096
|
||||
#define PLAYER_CLASS_ENCHANTER_BIT 8192
|
||||
#define PLAYER_CLASS_BEASTLORD_BIT 16384
|
||||
#define PLAYER_CLASS_BERSERKER_BIT 32768
|
||||
|
||||
#define PLAYER_CLASS_ALL_MASK 65535 // was 65536
|
||||
|
||||
|
||||
#define ARMOR_TYPE_UNKNOWN 0
|
||||
#define ARMOR_TYPE_CLOTH 1
|
||||
#define ARMOR_TYPE_LEATHER 2
|
||||
#define ARMOR_TYPE_CHAIN 3
|
||||
#define ARMOR_TYPE_PLATE 4
|
||||
|
||||
#define ARMOR_TYPE_FIRST ARMOR_TYPE_UNKNOWN
|
||||
#define ARMOR_TYPE_LAST ARMOR_TYPE_PLATE
|
||||
#define ARMOR_TYPE_COUNT 5
|
||||
|
||||
|
||||
const char* GetClassIDName(uint8 class_id, uint8 level = 0);
|
||||
const char* GetPlayerClassName(uint32 player_class_value, uint8 level = 0);
|
||||
|
||||
uint32 GetPlayerClassValue(uint8 class_id);
|
||||
uint32 GetPlayerClassBit(uint8 class_id);
|
||||
|
||||
uint8 GetClassIDFromPlayerClassValue(uint32 player_class_value);
|
||||
uint8 GetClassIDFromPlayerClassBit(uint32 player_class_bit);
|
||||
|
||||
bool IsFighterClass(uint8 class_id);
|
||||
bool IsSpellFighterClass(uint8 class_id);
|
||||
bool IsNonSpellFighterClass(uint8 class_id);
|
||||
bool IsCasterClass(uint8 class_id);
|
||||
bool IsINTCasterClass(uint8 class_id);
|
||||
bool IsWISCasterClass(uint8 class_id);
|
||||
|
||||
bool IsPlateClass(uint8 class_id);
|
||||
bool IsChainClass(uint8 class_id);
|
||||
bool IsLeatherClass(uint8 class_id);
|
||||
bool IsClothClass(uint8 class_id);
|
||||
uint8 ClassArmorType(uint8 class_id);
|
||||
|
||||
const char* GetEQClassName(uint8 class_, uint8 level = 0);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
#ifndef CLIENTVERSIONS_H
|
||||
#define CLIENTVERSIONS_H
|
||||
|
||||
static const uint32 BIT_Client62 = 1;
|
||||
static const uint32 BIT_Titanium = 2;
|
||||
static const uint32 BIT_SoF = 4;
|
||||
static const uint32 BIT_SoD = 8;
|
||||
static const uint32 BIT_Underfoot = 16;
|
||||
static const uint32 BIT_RoF = 32;
|
||||
static const uint32 BIT_RoF2 = 64;
|
||||
|
||||
static const uint32 BIT_TitaniumAndEarlier = 0x00000003;
|
||||
static const uint32 BIT_SoFAndLater = 0xFFFFFFFC;
|
||||
static const uint32 BIT_SoDAndLater = 0xFFFFFFF8;
|
||||
static const uint32 BIT_UnderfootAndLater = 0xFFFFFFF0;
|
||||
static const uint32 BIT_RoFAndLater = 0xFFFFFFE0;
|
||||
static const uint32 BIT_RoF2AndLater = 0xFFFFFFC0;
|
||||
static const uint32 BIT_AllClients = 0xFFFFFFFF;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
EQClientUnknown = 0,
|
||||
EQClient62, // Build: 'Aug 4 2005 15:40:59'
|
||||
EQClientTitanium, // Build: 'Oct 31 2005 10:33:37'
|
||||
EQClientSoF, // Build: 'Sep 7 2007 09:11:49'
|
||||
EQClientSoD, // Build: 'Dec 19 2008 15:22:49'
|
||||
EQClientUnderfoot, // Build: 'Jun 8 2010 16:44:32'
|
||||
EQClientRoF, // Build: 'Dec 10 2012 17:35:44'
|
||||
EQClientRoF2, // Build: 'May 10 2013 23:30:08'
|
||||
|
||||
_EQClientCount, // place new clients before this point (preferably, in release/attribute order)
|
||||
|
||||
// Values below are not implemented, as yet...
|
||||
|
||||
EmuNPC = _EQClientCount,
|
||||
EmuMerc,
|
||||
EmuBot,
|
||||
EmuPet,
|
||||
|
||||
_EmuClientCount // array size for EQLimits
|
||||
} EQClientVersion;
|
||||
|
||||
static const char* EQClientVersionName(EQClientVersion version)
|
||||
{
|
||||
switch (version)
|
||||
{
|
||||
case EQClientUnknown:
|
||||
return "EQClientUnknown";
|
||||
case EQClient62:
|
||||
return "EQClient62";
|
||||
case EQClientTitanium:
|
||||
return "EQClientTitanium";
|
||||
case EQClientSoF:
|
||||
return "EQClientSoF";
|
||||
case EQClientSoD:
|
||||
return "EQClientSoD";
|
||||
case EQClientUnderfoot:
|
||||
return "EQClientUnderfoot";
|
||||
case EQClientRoF:
|
||||
return "EQClientRoF";
|
||||
case EQClientRoF2:
|
||||
return "EQClientRoF2";
|
||||
case EmuNPC:
|
||||
return "EmuNPC";
|
||||
case EmuMerc:
|
||||
return "EmuMerc";
|
||||
case EmuBot:
|
||||
return "EmuBot";
|
||||
case EmuPet:
|
||||
return "EmuPet";
|
||||
default:
|
||||
return "ERROR: Invalid EQClientVersion";
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* CLIENTVERSIONS_H */
|
||||
@@ -16,6 +16,7 @@
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "debug.h"
|
||||
#include "condition.h"
|
||||
|
||||
#ifdef _WINDOWS
|
||||
|
||||
+1
-2
@@ -18,8 +18,7 @@
|
||||
#ifndef __CONDITION_H
|
||||
#define __CONDITION_H
|
||||
|
||||
#include "global_define.h"
|
||||
#include "mutex.h"
|
||||
#include "debug.h"
|
||||
#ifndef WIN32
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
+23
-24
@@ -1,5 +1,4 @@
|
||||
#include "global_define.h"
|
||||
#include "eqemu_logsys.h"
|
||||
#include "debug.h"
|
||||
#include "crash.h"
|
||||
|
||||
#if defined(_WINDOWS) && defined(CRASH_LOGGING)
|
||||
@@ -25,7 +24,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
Log(Logs::General, Logs::Crash, buffer);
|
||||
LogFile->write(EQEMuLog::Crash, buffer);
|
||||
StackWalker::OnOutput(szText);
|
||||
}
|
||||
};
|
||||
@@ -35,67 +34,67 @@ LONG WINAPI windows_exception_handler(EXCEPTION_POINTERS *ExceptionInfo)
|
||||
switch(ExceptionInfo->ExceptionRecord->ExceptionCode)
|
||||
{
|
||||
case EXCEPTION_ACCESS_VIOLATION:
|
||||
Log(Logs::General, Logs::Crash, "EXCEPTION_ACCESS_VIOLATION");
|
||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_ACCESS_VIOLATION");
|
||||
break;
|
||||
case EXCEPTION_ARRAY_BOUNDS_EXCEEDED:
|
||||
Log(Logs::General, Logs::Crash, "EXCEPTION_ARRAY_BOUNDS_EXCEEDED");
|
||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_ARRAY_BOUNDS_EXCEEDED");
|
||||
break;
|
||||
case EXCEPTION_BREAKPOINT:
|
||||
Log(Logs::General, Logs::Crash, "EXCEPTION_BREAKPOINT");
|
||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_BREAKPOINT");
|
||||
break;
|
||||
case EXCEPTION_DATATYPE_MISALIGNMENT:
|
||||
Log(Logs::General, Logs::Crash, "EXCEPTION_DATATYPE_MISALIGNMENT");
|
||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_DATATYPE_MISALIGNMENT");
|
||||
break;
|
||||
case EXCEPTION_FLT_DENORMAL_OPERAND:
|
||||
Log(Logs::General, Logs::Crash, "EXCEPTION_FLT_DENORMAL_OPERAND");
|
||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_FLT_DENORMAL_OPERAND");
|
||||
break;
|
||||
case EXCEPTION_FLT_DIVIDE_BY_ZERO:
|
||||
Log(Logs::General, Logs::Crash, "EXCEPTION_FLT_DIVIDE_BY_ZERO");
|
||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_FLT_DIVIDE_BY_ZERO");
|
||||
break;
|
||||
case EXCEPTION_FLT_INEXACT_RESULT:
|
||||
Log(Logs::General, Logs::Crash, "EXCEPTION_FLT_INEXACT_RESULT");
|
||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_FLT_INEXACT_RESULT");
|
||||
break;
|
||||
case EXCEPTION_FLT_INVALID_OPERATION:
|
||||
Log(Logs::General, Logs::Crash, "EXCEPTION_FLT_INVALID_OPERATION");
|
||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_FLT_INVALID_OPERATION");
|
||||
break;
|
||||
case EXCEPTION_FLT_OVERFLOW:
|
||||
Log(Logs::General, Logs::Crash, "EXCEPTION_FLT_OVERFLOW");
|
||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_FLT_OVERFLOW");
|
||||
break;
|
||||
case EXCEPTION_FLT_STACK_CHECK:
|
||||
Log(Logs::General, Logs::Crash, "EXCEPTION_FLT_STACK_CHECK");
|
||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_FLT_STACK_CHECK");
|
||||
break;
|
||||
case EXCEPTION_FLT_UNDERFLOW:
|
||||
Log(Logs::General, Logs::Crash, "EXCEPTION_FLT_UNDERFLOW");
|
||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_FLT_UNDERFLOW");
|
||||
break;
|
||||
case EXCEPTION_ILLEGAL_INSTRUCTION:
|
||||
Log(Logs::General, Logs::Crash, "EXCEPTION_ILLEGAL_INSTRUCTION");
|
||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_ILLEGAL_INSTRUCTION");
|
||||
break;
|
||||
case EXCEPTION_IN_PAGE_ERROR:
|
||||
Log(Logs::General, Logs::Crash, "EXCEPTION_IN_PAGE_ERROR");
|
||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_IN_PAGE_ERROR");
|
||||
break;
|
||||
case EXCEPTION_INT_DIVIDE_BY_ZERO:
|
||||
Log(Logs::General, Logs::Crash, "EXCEPTION_INT_DIVIDE_BY_ZERO");
|
||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_INT_DIVIDE_BY_ZERO");
|
||||
break;
|
||||
case EXCEPTION_INT_OVERFLOW:
|
||||
Log(Logs::General, Logs::Crash, "EXCEPTION_INT_OVERFLOW");
|
||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_INT_OVERFLOW");
|
||||
break;
|
||||
case EXCEPTION_INVALID_DISPOSITION:
|
||||
Log(Logs::General, Logs::Crash, "EXCEPTION_INVALID_DISPOSITION");
|
||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_INVALID_DISPOSITION");
|
||||
break;
|
||||
case EXCEPTION_NONCONTINUABLE_EXCEPTION:
|
||||
Log(Logs::General, Logs::Crash, "EXCEPTION_NONCONTINUABLE_EXCEPTION");
|
||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_NONCONTINUABLE_EXCEPTION");
|
||||
break;
|
||||
case EXCEPTION_PRIV_INSTRUCTION:
|
||||
Log(Logs::General, Logs::Crash, "EXCEPTION_PRIV_INSTRUCTION");
|
||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_PRIV_INSTRUCTION");
|
||||
break;
|
||||
case EXCEPTION_SINGLE_STEP:
|
||||
Log(Logs::General, Logs::Crash, "EXCEPTION_SINGLE_STEP");
|
||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_SINGLE_STEP");
|
||||
break;
|
||||
case EXCEPTION_STACK_OVERFLOW:
|
||||
Log(Logs::General, Logs::Crash, "EXCEPTION_STACK_OVERFLOW");
|
||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_STACK_OVERFLOW");
|
||||
break;
|
||||
default:
|
||||
Log(Logs::General, Logs::Crash, "Unknown Exception");
|
||||
LogFile->write(EQEMuLog::Crash, "Unknown Exception");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
+20
-27
@@ -1,6 +1,5 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
|
||||
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
|
||||
Copyright (C) 2001-2014 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
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
|
||||
@@ -14,42 +13,36 @@
|
||||
|
||||
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef COMMON_DATA_VERIFICATION_H
|
||||
#define COMMON_DATA_VERIFICATION_H
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
namespace EQEmu
|
||||
{
|
||||
template <typename T>
|
||||
T Clamp(const T& value, const T& lower, const T& upper) {
|
||||
return std::max(lower, std::min(value, upper));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T ClampLower(const T& value, const T& lower) {
|
||||
return std::max(lower, value);
|
||||
}
|
||||
template <typename T>
|
||||
T Clamp(const T& value, const T& lower, const T& upper) {
|
||||
return std::max(lower, std::min(value, upper));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T ClampUpper(const T& value, const T& upper) {
|
||||
return std::min(value, upper);
|
||||
}
|
||||
template <typename T>
|
||||
T ClampLower(const T& value, const T& lower) {
|
||||
return std::max(lower, value);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool ValueWithin(const T& value, const T& lower, const T& upper) {
|
||||
return value >= lower && value <= upper;
|
||||
}
|
||||
template <typename T>
|
||||
T ClampUpper(const T& value, const T& upper) {
|
||||
return std::min(value, upper);
|
||||
}
|
||||
|
||||
template <typename T1, typename T2, typename T3>
|
||||
bool ValueWithin(const T1& value, const T2& lower, const T3& upper) {
|
||||
return value >= (T1)lower && value <= (T1)upper;
|
||||
}
|
||||
template <typename T>
|
||||
bool ValueWithin(const T& value, const T& lower, const T& upper) {
|
||||
return value >= lower && value <= upper;
|
||||
}
|
||||
|
||||
} /*EQEmu*/
|
||||
}
|
||||
|
||||
#endif /*COMMON_DATA_VERIFICATION_H*/
|
||||
#endif
|
||||
|
||||
+2394
-320
File diff suppressed because it is too large
Load Diff
+543
-141
@@ -1,5 +1,5 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
|
||||
Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
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
|
||||
@@ -21,15 +21,11 @@
|
||||
#define AUTHENTICATION_TIMEOUT 60
|
||||
#define INVALID_ID 0xFFFFFFFF
|
||||
|
||||
#include "global_define.h"
|
||||
#include "eqemu_logsys.h"
|
||||
|
||||
#include "debug.h"
|
||||
#include "types.h"
|
||||
#include "dbcore.h"
|
||||
#include "linked_list.h"
|
||||
#include "eq_packet_structs.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
@@ -37,13 +33,23 @@
|
||||
//atoi is not uint32 or uint32 safe!!!!
|
||||
#define atoul(str) strtoul(str, nullptr, 10)
|
||||
|
||||
class MySQLRequestResult;
|
||||
//class Spawn;
|
||||
class Corpse;
|
||||
class Spawn2;
|
||||
class NPC;
|
||||
class SpawnGroupList;
|
||||
class Petition;
|
||||
class Client;
|
||||
|
||||
namespace EQEmu
|
||||
{
|
||||
class InventoryProfile;
|
||||
}
|
||||
class Merc;
|
||||
class MySQLRequestResult;
|
||||
struct Combine_Struct;
|
||||
//struct Faction;
|
||||
//struct FactionMods;
|
||||
//struct FactionValue;
|
||||
struct ZonePoint;
|
||||
struct NPCType;
|
||||
class Inventory;
|
||||
class ItemInst;
|
||||
|
||||
struct EventLogDetails_Struct {
|
||||
uint32 id;
|
||||
@@ -58,9 +64,9 @@ struct EventLogDetails_Struct {
|
||||
};
|
||||
|
||||
struct CharacterEventLog_Struct {
|
||||
uint32 count;
|
||||
uint8 eventid;
|
||||
EventLogDetails_Struct eld[255];
|
||||
uint32 count;
|
||||
uint8 eventid;
|
||||
EventLogDetails_Struct eld[255];
|
||||
};
|
||||
|
||||
struct npcDecayTimes_Struct {
|
||||
@@ -71,213 +77,609 @@ struct npcDecayTimes_Struct {
|
||||
|
||||
|
||||
struct VarCache_Struct {
|
||||
std::map<std::string, std::string> m_cache;
|
||||
uint32 last_update;
|
||||
VarCache_Struct() : last_update(0) { }
|
||||
void Add(const std::string &key, const std::string &value) { m_cache[key] = value; }
|
||||
const std::string *Get(const std::string &key) {
|
||||
auto it = m_cache.find(key);
|
||||
return (it != m_cache.end() ? &it->second : nullptr);
|
||||
}
|
||||
char varname[26];
|
||||
char value[0];
|
||||
};
|
||||
|
||||
struct PlayerProfile_Struct;
|
||||
struct GuildRankLevel_Struct;
|
||||
struct GuildRanks_Struct;
|
||||
struct ExtendedProfile_Struct;
|
||||
struct GuildMember_Struct;
|
||||
class PTimerList;
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#if _MSC_VER > 1700 // greater than 2012 (2013+)
|
||||
# define _ISNAN_(a) std::isnan(a)
|
||||
#else
|
||||
# include <float.h>
|
||||
# define _ISNAN_(a) _isnan(a)
|
||||
#endif
|
||||
#else
|
||||
# define _ISNAN_(a) std::isnan(a)
|
||||
#endif
|
||||
#pragma pack(1)
|
||||
|
||||
/* Conversion Structs */
|
||||
|
||||
namespace Convert {
|
||||
struct BindStruct {
|
||||
/*000*/ uint32 zoneId;
|
||||
/*004*/ float x;
|
||||
/*008*/ float y;
|
||||
/*012*/ float z;
|
||||
/*016*/ float heading;
|
||||
};
|
||||
struct Color_Struct
|
||||
{
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
uint8 blue;
|
||||
uint8 green;
|
||||
uint8 red;
|
||||
uint8 use_tint; // if there's a tint this is FF
|
||||
} rgb;
|
||||
uint32 color;
|
||||
};
|
||||
};
|
||||
struct AA_Array
|
||||
{
|
||||
uint32 AA;
|
||||
uint32 value;
|
||||
};
|
||||
struct SpellBuff_Struct
|
||||
{
|
||||
/*000*/ uint8 slotid; //badly named... seems to be 2 for a real buff, 0 otherwise
|
||||
/*001*/ uint8 level;
|
||||
/*002*/ uint8 bard_modifier;
|
||||
/*003*/ uint8 effect; //not real
|
||||
/*004*/ uint32 spellid;
|
||||
/*008*/ uint32 duration;
|
||||
/*012*/ uint32 counters;
|
||||
/*016*/ uint32 player_id; //'global' ID of the caster, for wearoff messages
|
||||
/*020*/
|
||||
};
|
||||
struct Tribute_Struct {
|
||||
uint32 tribute;
|
||||
uint32 tier;
|
||||
};
|
||||
struct Disciplines_Struct {
|
||||
uint32 values[MAX_PP_DISCIPLINES];
|
||||
};
|
||||
struct GroupLeadershipAA_Struct {
|
||||
union {
|
||||
struct {
|
||||
uint32 groupAAMarkNPC;
|
||||
uint32 groupAANPCHealth;
|
||||
uint32 groupAADelegateMainAssist;
|
||||
uint32 groupAADelegateMarkNPC;
|
||||
uint32 groupAA4;
|
||||
uint32 groupAA5;
|
||||
uint32 groupAAInspectBuffs;
|
||||
uint32 groupAA7;
|
||||
uint32 groupAASpellAwareness;
|
||||
uint32 groupAAOffenseEnhancement;
|
||||
uint32 groupAAManaEnhancement;
|
||||
uint32 groupAAHealthEnhancement;
|
||||
uint32 groupAAHealthRegeneration;
|
||||
uint32 groupAAFindPathToPC;
|
||||
uint32 groupAAHealthOfTargetsTarget;
|
||||
uint32 groupAA15;
|
||||
};
|
||||
uint32 ranks[MAX_GROUP_LEADERSHIP_AA_ARRAY];
|
||||
};
|
||||
};
|
||||
|
||||
struct RaidLeadershipAA_Struct {
|
||||
union {
|
||||
struct {
|
||||
uint32 raidAAMarkNPC;
|
||||
uint32 raidAANPCHealth;
|
||||
uint32 raidAADelegateMainAssist;
|
||||
uint32 raidAADelegateMarkNPC;
|
||||
uint32 raidAA4;
|
||||
uint32 raidAA5;
|
||||
uint32 raidAA6;
|
||||
uint32 raidAASpellAwareness;
|
||||
uint32 raidAAOffenseEnhancement;
|
||||
uint32 raidAAManaEnhancement;
|
||||
uint32 raidAAHealthEnhancement;
|
||||
uint32 raidAAHealthRegeneration;
|
||||
uint32 raidAAFindPathToPC;
|
||||
uint32 raidAAHealthOfTargetsTarget;
|
||||
uint32 raidAA14;
|
||||
uint32 raidAA15;
|
||||
};
|
||||
uint32 ranks[MAX_RAID_LEADERSHIP_AA_ARRAY];
|
||||
};
|
||||
};
|
||||
|
||||
struct LeadershipAA_Struct {
|
||||
union {
|
||||
struct {
|
||||
Convert::GroupLeadershipAA_Struct group;
|
||||
Convert::RaidLeadershipAA_Struct raid;
|
||||
};
|
||||
uint32 ranks[MAX_LEADERSHIP_AA_ARRAY];
|
||||
};
|
||||
};
|
||||
typedef struct
|
||||
{
|
||||
/*00*/ char Name[64];
|
||||
/*64*/ uint32 Level;
|
||||
/*68*/ uint32 Race;
|
||||
/*72*/ uint32 Class;
|
||||
/*76*/ uint32 Zone;
|
||||
/*80*/ uint32 Time;
|
||||
/*84*/ uint32 Points;
|
||||
/*88*/
|
||||
} PVPStatsEntry_Struct;
|
||||
struct BandolierItem_Struct {
|
||||
uint32 item_id;
|
||||
uint32 icon;
|
||||
char item_name[64];
|
||||
};
|
||||
struct Bandolier_Struct {
|
||||
char name[32];
|
||||
Convert::BandolierItem_Struct items[EmuConstants::BANDOLIER_SIZE];
|
||||
};
|
||||
struct PotionBelt_Struct {
|
||||
Convert::BandolierItem_Struct items[EmuConstants::POTION_BELT_SIZE];
|
||||
};
|
||||
struct SuspendedMinion_Struct
|
||||
{
|
||||
/*000*/ uint16 SpellID;
|
||||
/*002*/ uint32 HP;
|
||||
/*006*/ uint32 Mana;
|
||||
/*010*/ Convert::SpellBuff_Struct Buffs[BUFF_COUNT];
|
||||
/*510*/ uint32 Items[_MaterialCount];
|
||||
/*546*/ char Name[64];
|
||||
/*610*/
|
||||
};
|
||||
|
||||
struct PlayerProfile_Struct {
|
||||
/*0000*/ uint32 checksum; // Checksum from CRC32::SetEQChecksum
|
||||
/*0004*/ char name[64]; // Name of player sizes not right
|
||||
/*0068*/ char last_name[32]; // Last name of player sizes not right
|
||||
/*0100*/ uint32 gender; // Player Gender - 0 Male, 1 Female
|
||||
/*0104*/ uint32 race; // Player race
|
||||
/*0108*/ uint32 class_; // Player class
|
||||
/*0112*/ uint32 unknown0112; //
|
||||
/*0116*/ uint32 level; // Level of player (might be one byte)
|
||||
/*0120*/ Convert::BindStruct binds[5]; // Bind points (primary is first, home city is fifth)
|
||||
/*0220*/ uint32 deity; // deity
|
||||
/*0224*/ uint32 guild_id;
|
||||
/*0228*/ uint32 birthday; // characters bday
|
||||
/*0232*/ uint32 lastlogin; // last login or zone time
|
||||
/*0236*/ uint32 timePlayedMin; // in minutes
|
||||
/*0240*/ uint8 pvp;
|
||||
/*0241*/ uint8 level2; //no idea why this is here, but thats how it is on live
|
||||
/*0242*/ uint8 anon; // 2=roleplay, 1=anon, 0=not anon
|
||||
/*0243*/ uint8 gm;
|
||||
/*0244*/ uint8 guildrank;
|
||||
/*0245*/ uint8 guildbanker;
|
||||
/*0246*/ uint8 unknown0246[6]; //
|
||||
/*0252*/ uint32 intoxication;
|
||||
/*0256*/ uint32 spellSlotRefresh[MAX_PP_REF_MEMSPELL]; //in ms
|
||||
/*0292*/ uint32 abilitySlotRefresh;
|
||||
/*0296*/ uint8 haircolor; // Player hair color
|
||||
/*0297*/ uint8 beardcolor; // Player beard color
|
||||
/*0298*/ uint8 eyecolor1; // Player left eye color
|
||||
/*0299*/ uint8 eyecolor2; // Player right eye color
|
||||
/*0300*/ uint8 hairstyle; // Player hair style
|
||||
/*0301*/ uint8 beard; // Beard type
|
||||
/*0302*/ uint8 ability_time_seconds; //The following four spots are unknown right now.....
|
||||
/*0303*/ uint8 ability_number; //ability used
|
||||
/*0304*/ uint8 ability_time_minutes;
|
||||
/*0305*/ uint8 ability_time_hours; //place holder
|
||||
/*0306*/ uint8 unknown0306[6]; // @bp Spacer/Flag?
|
||||
/*0312*/ uint32 item_material[_MaterialCount]; // Item texture/material of worn/held items
|
||||
/*0348*/ uint8 unknown0348[44];
|
||||
/*0392*/ Convert::Color_Struct item_tint[_MaterialCount];
|
||||
/*0428*/ Convert::AA_Array aa_array[MAX_PP_AA_ARRAY];
|
||||
/*2348*/ float unknown2384; //seen ~128, ~47
|
||||
/*2352*/ char servername[32]; // length probably not right
|
||||
/*2384*/ char title[32]; // length might be wrong
|
||||
/*2416*/ char suffix[32]; // length might be wrong
|
||||
/*2448*/ uint32 guildid2; //
|
||||
/*2452*/ uint32 exp; // Current Experience
|
||||
/*2456*/ uint32 unknown2492;
|
||||
/*2460*/ uint32 points; // Unspent Practice points
|
||||
/*2464*/ uint32 mana; // current mana
|
||||
/*2468*/ uint32 cur_hp; // current hp
|
||||
/*2472*/ uint32 unknown2508; // 0x05
|
||||
/*2476*/ uint32 STR; // Strength
|
||||
/*2480*/ uint32 STA; // Stamina
|
||||
/*2484*/ uint32 CHA; // Charisma
|
||||
/*2488*/ uint32 DEX; // Dexterity
|
||||
/*2492*/ uint32 INT; // Intelligence
|
||||
/*2496*/ uint32 AGI; // Agility
|
||||
/*2500*/ uint32 WIS; // Wisdom
|
||||
/*2504*/ uint8 face; // Player face
|
||||
/*2505*/ uint8 unknown2541[47]; // ?
|
||||
/*2552*/ uint8 languages[MAX_PP_LANGUAGE];
|
||||
/*2580*/ uint8 unknown2616[4];
|
||||
/*2584*/ uint32 spell_book[MAX_PP_REF_SPELLBOOK];
|
||||
/*4504*/ uint8 unknown4540[128]; // Was [428] all 0xff
|
||||
/*4632*/ uint32 mem_spells[MAX_PP_REF_MEMSPELL];
|
||||
/*4668*/ uint8 unknown4704[32]; //
|
||||
/*4700*/ float y; // Player y position
|
||||
/*4704*/ float x; // Player x position
|
||||
/*4708*/ float z; // Player z position
|
||||
/*4712*/ float heading; // Direction player is facing
|
||||
/*4716*/ uint8 unknown4752[4]; //
|
||||
/*4720*/ int32 platinum; // Platinum Pieces on player
|
||||
/*4724*/ int32 gold; // Gold Pieces on player
|
||||
/*4728*/ int32 silver; // Silver Pieces on player
|
||||
/*4732*/ int32 copper; // Copper Pieces on player
|
||||
/*4736*/ int32 platinum_bank; // Platinum Pieces in Bank
|
||||
/*4740*/ int32 gold_bank; // Gold Pieces in Bank
|
||||
/*4744*/ int32 silver_bank; // Silver Pieces in Bank
|
||||
/*4748*/ int32 copper_bank; // Copper Pieces in Bank
|
||||
/*4752*/ int32 platinum_cursor; // Platinum on cursor
|
||||
/*4756*/ int32 gold_cursor; // Gold on cursor
|
||||
/*4760*/ int32 silver_cursor; // Silver on cursor
|
||||
/*4764*/ int32 copper_cursor; // Copper on cursor
|
||||
/*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];
|
||||
/*5380*/ uint32 pvp2; //
|
||||
/*5384*/ uint32 unknown5420; //
|
||||
/*5388*/ uint32 pvptype; //
|
||||
/*5392*/ uint32 unknown5428; //
|
||||
/*5396*/ uint32 ability_down; // Guessing
|
||||
/*5400*/ uint8 unknown5436[8]; //
|
||||
/*5408*/ uint32 autosplit; //not used right now
|
||||
/*5412*/ uint8 unknown5448[8];
|
||||
/*5420*/ uint32 zone_change_count; // Number of times user has zoned in their career (guessing)
|
||||
/*5424*/ uint8 unknown5460[16]; //
|
||||
/*5440*/ uint32 drakkin_heritage; //
|
||||
/*5444*/ uint32 drakkin_tattoo; //
|
||||
/*5448*/ uint32 drakkin_details; //
|
||||
/*5452*/ uint32 expansions; // expansion setting, bit field of expansions avaliable
|
||||
/*5456*/ int32 toxicity; //from drinking potions, seems to increase by 3 each time you drink
|
||||
/*5460*/ char unknown5496[16]; //
|
||||
/*5476*/ int32 hunger_level;
|
||||
/*5480*/ int32 thirst_level;
|
||||
/*5484*/ uint32 ability_up;
|
||||
/*5488*/ char unknown5524[16];
|
||||
/*5504*/ uint16 zone_id; // Current zone of the player
|
||||
/*5506*/ uint16 zoneInstance; // Instance ID
|
||||
/*5508*/ Convert::SpellBuff_Struct buffs[BUFF_COUNT]; // Buffs currently on the player
|
||||
/*6008*/ char groupMembers[6][64];//
|
||||
/*6392*/ char unknown6428[656];
|
||||
/*7048*/ uint32 entityid;
|
||||
/*7052*/ uint32 leadAAActive;
|
||||
/*7056*/ uint32 unknown7092;
|
||||
/*7060*/ int32 ldon_points_guk; //client uses these as signed
|
||||
/*7064*/ int32 ldon_points_mir;
|
||||
/*7068*/ int32 ldon_points_mmc;
|
||||
/*7072*/ int32 ldon_points_ruj;
|
||||
/*7076*/ int32 ldon_points_tak;
|
||||
/*7080*/ int32 ldon_points_available;
|
||||
/*7084*/ int32 ldon_wins_guk;
|
||||
/*7088*/ int32 ldon_wins_mir;
|
||||
/*7092*/ int32 ldon_wins_mmc;
|
||||
/*7096*/ int32 ldon_wins_ruj;
|
||||
/*7100*/ int32 ldon_wins_tak;
|
||||
/*7104*/ int32 ldon_losses_guk;
|
||||
/*7108*/ int32 ldon_losses_mir;
|
||||
/*7112*/ int32 ldon_losses_mmc;
|
||||
/*7116*/ int32 ldon_losses_ruj;
|
||||
/*7120*/ int32 ldon_losses_tak;
|
||||
/*7124*/ uint8 unknown7160[72];
|
||||
/*7196*/ uint32 tribute_time_remaining; //in miliseconds
|
||||
/*7200*/ uint32 showhelm;
|
||||
/*7204*/ uint32 career_tribute_points;
|
||||
/*7208*/ uint32 unknown7244;
|
||||
/*7212*/ uint32 tribute_points;
|
||||
/*7216*/ uint32 unknown7252;
|
||||
/*7220*/ uint32 tribute_active; //1=active
|
||||
/*7224*/ Convert::Tribute_Struct tributes[EmuConstants::TRIBUTE_SIZE];
|
||||
/*7264*/ Convert::Disciplines_Struct disciplines;
|
||||
/*7664*/ uint32 recastTimers[MAX_RECAST_TYPES]; // Timers (GMT of last use)
|
||||
/*7744*/ char unknown7780[160];
|
||||
/*7904*/ uint32 endurance;
|
||||
/*7908*/ uint32 group_leadership_exp; //0-1000
|
||||
/*7912*/ uint32 raid_leadership_exp; //0-2000
|
||||
/*7916*/ uint32 group_leadership_points;
|
||||
/*7920*/ uint32 raid_leadership_points;
|
||||
/*7924*/ Convert::LeadershipAA_Struct leader_abilities;
|
||||
/*8052*/ uint8 unknown8088[132];
|
||||
/*8184*/ uint32 air_remaining;
|
||||
/*8188*/ uint32 PVPKills;
|
||||
/*8192*/ uint32 PVPDeaths;
|
||||
/*8196*/ uint32 PVPCurrentPoints;
|
||||
/*8200*/ uint32 PVPCareerPoints;
|
||||
/*8204*/ uint32 PVPBestKillStreak;
|
||||
/*8208*/ uint32 PVPWorstDeathStreak;
|
||||
/*8212*/ uint32 PVPCurrentKillStreak;
|
||||
/*8216*/ Convert::PVPStatsEntry_Struct PVPLastKill;
|
||||
/*8304*/ Convert::PVPStatsEntry_Struct PVPLastDeath;
|
||||
/*8392*/ uint32 PVPNumberOfKillsInLast24Hours;
|
||||
/*8396*/ Convert::PVPStatsEntry_Struct PVPRecentKills[50];
|
||||
/*12796*/ uint32 aapoints_spent;
|
||||
/*12800*/ uint32 expAA;
|
||||
/*12804*/ uint32 aapoints; //avaliable, unspent
|
||||
/*12808*/ uint8 unknown12844[36];
|
||||
/*12844*/ Convert::Bandolier_Struct bandoliers[EmuConstants::BANDOLIERS_COUNT];
|
||||
/*14124*/ uint8 unknown14160[4506];
|
||||
/*18630*/ Convert::SuspendedMinion_Struct SuspendedMinion; // No longer in use
|
||||
/*19240*/ uint32 timeentitledonaccount;
|
||||
/*19244*/ Convert::PotionBelt_Struct potionbelt; //there should be 3 more of these
|
||||
/*19532*/ uint8 unknown19568[8];
|
||||
/*19540*/ uint32 currentRadCrystals; // Current count of radiant crystals
|
||||
/*19544*/ uint32 careerRadCrystals; // Total count of radiant crystals ever
|
||||
/*19548*/ uint32 currentEbonCrystals;// Current count of ebon crystals
|
||||
/*19552*/ uint32 careerEbonCrystals; // Total count of ebon crystals ever
|
||||
/*19556*/ uint8 groupAutoconsent; // 0=off, 1=on
|
||||
/*19557*/ uint8 raidAutoconsent; // 0=off, 1=on
|
||||
/*19558*/ uint8 guildAutoconsent; // 0=off, 1=on
|
||||
/*19559*/ uint8 unknown19595[5]; // ***Placeholder (6/29/2005)
|
||||
/*19564*/ uint32 RestTimer;
|
||||
/*19568*/
|
||||
};
|
||||
|
||||
|
||||
namespace player_lootitem_temp
|
||||
{
|
||||
struct ServerLootItem_Struct_temp {
|
||||
uint32 item_id;
|
||||
int16 equipSlot;
|
||||
uint8 charges;
|
||||
uint16 lootslot;
|
||||
uint32 aug1;
|
||||
uint32 aug2;
|
||||
uint32 aug3;
|
||||
uint32 aug4;
|
||||
uint32 aug5;
|
||||
};
|
||||
}
|
||||
|
||||
struct DBPlayerCorpse_Struct_temp {
|
||||
uint32 crc;
|
||||
bool locked;
|
||||
uint32 itemcount;
|
||||
uint32 exp;
|
||||
float size;
|
||||
uint8 level;
|
||||
uint8 race;
|
||||
uint8 gender;
|
||||
uint8 class_;
|
||||
uint8 deity;
|
||||
uint8 texture;
|
||||
uint8 helmtexture;
|
||||
uint32 copper;
|
||||
uint32 silver;
|
||||
uint32 gold;
|
||||
uint32 plat;
|
||||
Color_Struct item_tint[9];
|
||||
uint8 haircolor;
|
||||
uint8 beardcolor;
|
||||
uint8 eyecolor1;
|
||||
uint8 eyecolor2;
|
||||
uint8 hairstyle;
|
||||
uint8 face;
|
||||
uint8 beard;
|
||||
uint32 drakkin_heritage;
|
||||
uint32 drakkin_tattoo;
|
||||
uint32 drakkin_details;
|
||||
player_lootitem_temp::ServerLootItem_Struct_temp items[0];
|
||||
};
|
||||
|
||||
namespace classic_db_temp {
|
||||
struct DBPlayerCorpse_Struct_temp {
|
||||
uint32 crc;
|
||||
bool locked;
|
||||
uint32 itemcount;
|
||||
uint32 exp;
|
||||
float size;
|
||||
uint8 level;
|
||||
uint8 race;
|
||||
uint8 gender;
|
||||
uint8 class_;
|
||||
uint8 deity;
|
||||
uint8 texture;
|
||||
uint8 helmtexture;
|
||||
uint32 copper;
|
||||
uint32 silver;
|
||||
uint32 gold;
|
||||
uint32 plat;
|
||||
Color_Struct item_tint[9];
|
||||
uint8 haircolor;
|
||||
uint8 beardcolor;
|
||||
uint8 eyecolor1;
|
||||
uint8 eyecolor2;
|
||||
uint8 hairstyle;
|
||||
uint8 face;
|
||||
uint8 beard;
|
||||
player_lootitem_temp::ServerLootItem_Struct_temp items[0];
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#pragma pack()
|
||||
|
||||
class Database : public DBcore {
|
||||
public:
|
||||
Database();
|
||||
Database(const char* host, const char* user, const char* passwd, const char* database,uint32 port);
|
||||
bool Connect(const char* host, const char* user, const char* passwd, const char* database, uint32 port);
|
||||
bool Connect(const char* host, const char* user, const char* passwd, const char* database,uint32 port);
|
||||
~Database();
|
||||
|
||||
/* Character Creation */
|
||||
|
||||
bool AddToNameFilter(const char* name);
|
||||
bool CreateCharacter(uint32 account_id, char* name, uint16 gender, uint16 race, uint16 class_, uint8 str, uint8 sta, uint8 cha, uint8 dex, uint8 int_, uint8 agi, uint8 wis, uint8 face);
|
||||
bool DeleteCharacter(char* name);
|
||||
/*
|
||||
* General Character Related Stuff
|
||||
*/
|
||||
|
||||
/* Character Creation */
|
||||
bool SaveCharacterCreate(uint32 character_id, uint32 account_id, PlayerProfile_Struct* pp);
|
||||
|
||||
bool MoveCharacterToZone(const char* charname, const char* zonename);
|
||||
bool MoveCharacterToZone(const char* charname, const char* zonename,uint32 zoneid);
|
||||
bool MoveCharacterToZone(uint32 iCharID, const char* iZonename);
|
||||
bool ReserveName(uint32 account_id, char* name);
|
||||
bool SaveCharacterCreate(uint32 character_id, uint32 account_id, PlayerProfile_Struct* pp);
|
||||
bool UpdateName(const char* oldname, const char* newname);
|
||||
bool SetHackerFlag(const char* accountname, const char* charactername, const char* hacked);
|
||||
bool SetMQDetectionFlag(const char* accountname, const char* charactername, const char* hacked, const char* zone);
|
||||
bool StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, EQEmu::InventoryProfile* inv);
|
||||
bool UpdateName(const char* oldname, const char* newname);
|
||||
bool AddToNameFilter(const char* name);
|
||||
bool ReserveName(uint32 account_id, char* name);
|
||||
bool CreateCharacter(uint32 account_id, char* name, uint16 gender, uint16 race, uint16 class_, uint8 str, uint8 sta, uint8 cha, uint8 dex, uint8 int_, uint8 agi, uint8 wis, uint8 face);
|
||||
bool StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, Inventory* inv);
|
||||
bool DeleteCharacter(char* name);
|
||||
|
||||
/* General Information Queries */
|
||||
|
||||
bool AddBannedIP(char* bannedIP, const char* notes); //Add IP address to the Banned_IPs table.
|
||||
bool AddGMIP(char* ip_address, char* name);
|
||||
bool CheckBannedIPs(const char* loginIP); //Check incoming connection against banned IP table.
|
||||
bool CheckGMIPs(const char* loginIP, uint32 account_id);
|
||||
/*
|
||||
* General Information Getting Queries
|
||||
*/
|
||||
bool CheckNameFilter(const char* name, bool surname = false);
|
||||
bool CheckUsedName(const char* name);
|
||||
|
||||
uint32 GetAccountIDByChar(const char* charname, uint32* oCharID = 0);
|
||||
uint32 GetAccountIDByChar(uint32 char_id);
|
||||
uint32 GetAccountIDByName(const char* accname, int16* status = 0, uint32* lsid = 0);
|
||||
uint32 GetCharacterID(const char *name);
|
||||
uint32 GetCharacterInfo(const char* iName, uint32* oAccID = 0, uint32* oZoneID = 0, uint32* oInstanceID = 0, float* oX = 0, float* oY = 0, float* oZ = 0);
|
||||
uint32 GetGuildIDByCharID(uint32 char_id);
|
||||
|
||||
void GetAccountName(uint32 accountid, char* name, uint32* oLSAccountID = 0);
|
||||
void GetCharName(uint32 char_id, char* name);
|
||||
uint32 GetCharacterInfo(const char* iName, uint32* oAccID = 0, uint32* oZoneID = 0, uint32* oInstanceID = 0,float* oX = 0, float* oY = 0, float* oZ = 0);
|
||||
uint32 GetCharacterID(const char *name);
|
||||
bool CheckBannedIPs(const char* loginIP); //Lieka Edit: Check incomming connection against banned IP table.
|
||||
bool AddBannedIP(char* bannedIP, const char* notes); //Lieka Edit: Add IP address to the Banned_IPs table.
|
||||
bool CheckGMIPs(const char* loginIP, uint32 account_id);
|
||||
bool AddGMIP(char* ip_address, char* name);
|
||||
void LoginIP(uint32 AccountID, const char* LoginIP);
|
||||
|
||||
/* Instancing */
|
||||
|
||||
bool AddClientToInstance(uint16 instance_id, uint32 char_id);
|
||||
/*
|
||||
* Instancing Stuff
|
||||
*/
|
||||
bool VerifyZoneInstance(uint32 zone_id, uint16 instance_id);
|
||||
bool VerifyInstanceAlive(uint16 instance_id, uint32 char_id);
|
||||
bool CharacterInInstanceGroup(uint16 instance_id, uint32 char_id);
|
||||
bool CheckInstanceExists(uint16 instance_id);
|
||||
void DeleteInstance(uint16 instance_id);
|
||||
bool CheckInstanceExpired(uint16 instance_id);
|
||||
bool CreateInstance(uint16 instance_id, uint32 zone_id, uint32 version, uint32 duration);
|
||||
uint32 ZoneIDFromInstanceID(uint16 instance_id);
|
||||
uint32 VersionFromInstanceID(uint16 instance_id);
|
||||
uint32 GetTimeRemainingInstance(uint16 instance_id, bool &is_perma);
|
||||
bool GetUnusedInstanceID(uint16 &instance_id);
|
||||
bool GlobalInstance(uint16 instance_id);
|
||||
bool CreateInstance(uint16 instance_id, uint32 zone_id, uint32 version, uint32 duration);
|
||||
void PurgeExpiredInstances();
|
||||
bool AddClientToInstance(uint16 instance_id, uint32 char_id);
|
||||
bool RemoveClientFromInstance(uint16 instance_id, uint32 char_id);
|
||||
bool RemoveClientsFromInstance(uint16 instance_id);
|
||||
bool VerifyInstanceAlive(uint16 instance_id, uint32 char_id);
|
||||
bool VerifyZoneInstance(uint32 zone_id, uint16 instance_id);
|
||||
|
||||
bool CheckInstanceExists(uint16 instance_id);
|
||||
void BuryCorpsesInInstance(uint16 instance_id);
|
||||
uint16 GetInstanceVersion(uint16 instance_id);
|
||||
uint16 GetInstanceID(const char* zone, uint32 charid, int16 version);
|
||||
uint16 GetInstanceID(uint32 zone, uint32 charid, int16 version);
|
||||
uint16 GetInstanceVersion(uint16 instance_id);
|
||||
uint32 GetTimeRemainingInstance(uint16 instance_id, bool &is_perma);
|
||||
uint32 VersionFromInstanceID(uint16 instance_id);
|
||||
uint32 ZoneIDFromInstanceID(uint16 instance_id);
|
||||
|
||||
void GetCharactersInInstance(uint16 instance_id, std::list<uint32> &charid_list);
|
||||
void AssignGroupToInstance(uint32 gid, uint32 instance_id);
|
||||
void AssignRaidToInstance(uint32 rid, uint32 instance_id);
|
||||
void BuryCorpsesInInstance(uint16 instance_id);
|
||||
void DeleteInstance(uint16 instance_id);
|
||||
void FlagInstanceByGroupLeader(uint32 zone, int16 version, uint32 charid, uint32 gid);
|
||||
void FlagInstanceByRaidLeader(uint32 zone, int16 version, uint32 charid, uint32 rid);
|
||||
void GetCharactersInInstance(uint16 instance_id, std::list<uint32> &charid_list);
|
||||
void PurgeExpiredInstances();
|
||||
void SetInstanceDuration(uint16 instance_id, uint32 new_duration);
|
||||
bool GlobalInstance(uint16 instance_id);
|
||||
|
||||
/* Adventure related. */
|
||||
|
||||
/*
|
||||
* Adventure related.
|
||||
*/
|
||||
void UpdateAdventureStatsEntry(uint32 char_id, uint8 theme, bool win);
|
||||
bool GetAdventureStats(uint32 char_id, AdventureStats_Struct *as);
|
||||
|
||||
/* Account Related */
|
||||
|
||||
/*
|
||||
* Account Related
|
||||
*/
|
||||
uint32 GetMiniLoginAccount(char* ip);
|
||||
void GetAccountFromID(uint32 id, char* oAccountName, int16* oStatus);
|
||||
uint32 CheckLogin(const char* name, const char* password, int16* oStatus = 0);
|
||||
int16 CheckStatus(uint32 account_id);
|
||||
uint32 CreateAccount(const char* name, const char* password, int16 status, uint32 lsaccount_id = 0);
|
||||
bool DeleteAccount(const char* name);
|
||||
bool GetLiveChar(uint32 account_id, char* cname);
|
||||
bool SetAccountStatus(const char* name, int16 status);
|
||||
bool SetLocalPassword(uint32 accid, const char* password);
|
||||
bool UpdateLiveChar(char* charname, uint32 lsaccount_id);
|
||||
|
||||
int16 CheckStatus(uint32 account_id);
|
||||
|
||||
uint32 CheckLogin(const char* name, const char* password, int16* oStatus = 0);
|
||||
uint32 CreateAccount(const char* name, const char* password, int16 status, uint32 lsaccount_id = 0);
|
||||
uint32 GetAccountIDFromLSID(uint32 iLSID, char* oAccountName = 0, int16* oStatus = 0);
|
||||
uint32 GetMiniLoginAccount(char* ip);
|
||||
bool UpdateLiveChar(char* charname,uint32 lsaccount_id);
|
||||
bool GetLiveChar(uint32 account_id, char* cname);
|
||||
uint8 GetAgreementFlag(uint32 acctid);
|
||||
|
||||
void GetAccountFromID(uint32 id, char* oAccountName, int16* oStatus);
|
||||
void SetAgreementFlag(uint32 acctid);
|
||||
|
||||
int GetIPExemption(std::string account_ip);
|
||||
|
||||
int GetInstanceID(uint32 char_id, uint32 zone_id);
|
||||
|
||||
|
||||
/* Groups */
|
||||
|
||||
char* GetGroupLeaderForLogin(const char* name,char* leaderbuf);
|
||||
char* GetGroupLeadershipInfo(uint32 gid, char* leaderbuf, char* maintank = nullptr, char* assist = nullptr, char* puller = nullptr, char *marknpc = nullptr, char *mentoree = nullptr, int *mentor_percent = nullptr, GroupLeadershipAA_Struct* GLAA = nullptr);
|
||||
|
||||
/*
|
||||
* Groups
|
||||
*/
|
||||
uint32 GetGroupID(const char* name);
|
||||
|
||||
void ClearGroup(uint32 gid = 0);
|
||||
void ClearGroupLeader(uint32 gid = 0);
|
||||
void SetGroupID(const char* name, uint32 id, uint32 charid, uint32 ismerc = false);
|
||||
void ClearGroup(uint32 gid = 0);
|
||||
char* GetGroupLeaderForLogin(const char* name,char* leaderbuf);
|
||||
|
||||
void SetGroupLeaderName(uint32 gid, const char* name);
|
||||
char* GetGroupLeadershipInfo(uint32 gid, char* leaderbuf, char* maintank = nullptr, char* assist = nullptr, char* puller = nullptr, char *marknpc = nullptr,
|
||||
char *mentoree = nullptr, int *mentor_percent = nullptr, GroupLeadershipAA_Struct* GLAA = nullptr);
|
||||
void ClearGroupLeader(uint32 gid = 0);
|
||||
|
||||
|
||||
/* Raids */
|
||||
|
||||
const char *GetRaidLeaderName(uint32 rid);
|
||||
|
||||
uint32 GetRaidID(const char* name);
|
||||
|
||||
/*
|
||||
* Raids
|
||||
*/
|
||||
void ClearRaid(uint32 rid = 0);
|
||||
void ClearRaidDetails(uint32 rid = 0);
|
||||
void ClearRaidLeader(uint32 gid = 0xFFFFFFFF, uint32 rid = 0);
|
||||
void GetGroupLeadershipInfo(uint32 gid, uint32 rid, char* maintank = nullptr, char* assist = nullptr, char* puller = nullptr, char *marknpc = nullptr, char *mentoree = nullptr, int *mentor_percent = nullptr, GroupLeadershipAA_Struct* GLAA = nullptr);
|
||||
void GetRaidLeadershipInfo(uint32 rid, char* maintank = nullptr, char* assist = nullptr, char* puller = nullptr, char *marknpc = nullptr, RaidLeadershipAA_Struct* RLAA = nullptr);
|
||||
uint32 GetRaidID(const char* name);
|
||||
const char *GetRaidLeaderName(uint32 rid);
|
||||
void GetGroupLeadershipInfo(uint32 gid, uint32 rid, char* maintank = nullptr, char* assist = nullptr, char* puller = nullptr, char *marknpc = nullptr,
|
||||
char *mentoree = nullptr, int *mentor_percent = nullptr, GroupLeadershipAA_Struct* GLAA = nullptr);
|
||||
void GetRaidLeadershipInfo(uint32 rid, char* maintank = nullptr, char* assist = nullptr, char* puller = nullptr, char *marknpc = nullptr,
|
||||
RaidLeadershipAA_Struct* RLAA = nullptr);
|
||||
void SetRaidGroupLeaderInfo(uint32 gid, uint32 rid);
|
||||
void ClearRaidLeader(uint32 gid = 0xFFFFFFFF, uint32 rid = 0);
|
||||
|
||||
/* Database Conversions 'database_conversions.cpp' */
|
||||
|
||||
/* Database Conversions*/
|
||||
bool CheckDatabaseConversions();
|
||||
bool CheckDatabaseConvertCorpseDeblob();
|
||||
bool CheckDatabaseConvertPPDeblob();
|
||||
bool CheckDatabaseConvertCorpseDeblob();
|
||||
bool CheckDatabaseConvertBotsPostPPDeblob();
|
||||
|
||||
/* Database Variables */
|
||||
|
||||
bool GetVariable(std::string varname, std::string &varvalue);
|
||||
bool SetVariable(const std::string varname, const std::string &varvalue);
|
||||
/*
|
||||
* Database Variables
|
||||
*/
|
||||
bool GetVariable(const char* varname, char* varvalue, uint16 varvalue_len);
|
||||
bool SetVariable(const char* varname, const char* varvalue);
|
||||
bool LoadVariables();
|
||||
uint32 LoadVariables_MQ(char** query);
|
||||
bool LoadVariables_result(MySQLRequestResult results);
|
||||
|
||||
/* General Queries */
|
||||
|
||||
bool GetSafePoints(const char* short_name, uint32 version, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, int16* minstatus = 0, uint8* minlevel = 0, char *flag_needed = nullptr);
|
||||
bool GetSafePoints(uint32 zoneID, uint32 version, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, int16* minstatus = 0, uint8* minlevel = 0, char *flag_needed = nullptr) { return GetSafePoints(GetZoneName(zoneID), version, safe_x, safe_y, safe_z, minstatus, minlevel, flag_needed); }
|
||||
bool GetZoneGraveyard(const uint32 graveyard_id, uint32* graveyard_zoneid = 0, float* graveyard_x = 0, float* graveyard_y = 0, float* graveyard_z = 0, float* graveyard_heading = 0);
|
||||
bool GetZoneLongName(const char* short_name, char** long_name, char* file_name = 0, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, uint32* graveyard_id = 0, uint32* maxclients = 0);
|
||||
bool LoadPTimers(uint32 charid, PTimerList &into);
|
||||
/*
|
||||
* General Queries
|
||||
*/
|
||||
bool LoadZoneNames();
|
||||
|
||||
const char* GetZoneName(uint32 zoneID, bool ErrorUnknown = false);
|
||||
|
||||
bool GetZoneLongName(const char* short_name, char** long_name, char* file_name = 0, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, uint32* graveyard_id = 0, uint32* maxclients = 0);
|
||||
bool GetZoneGraveyard(const uint32 graveyard_id, uint32* graveyard_zoneid = 0, float* graveyard_x = 0, float* graveyard_y = 0, float* graveyard_z = 0, float* graveyard_heading = 0);
|
||||
uint32 GetZoneGraveyardID(uint32 zone_id, uint32 version);
|
||||
uint32 GetZoneID(const char* zonename);
|
||||
|
||||
uint8 GetPEQZone(uint32 zoneID, uint32 version);
|
||||
uint8 GetRaceSkill(uint8 skillid, uint8 in_race);
|
||||
const char* GetZoneName(uint32 zoneID, bool ErrorUnknown = false);
|
||||
uint8 GetServerType();
|
||||
bool GetSafePoints(const char* short_name, uint32 version, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, int16* minstatus = 0, uint8* minlevel = 0, char *flag_needed = nullptr);
|
||||
bool GetSafePoints(uint32 zoneID, uint32 version, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, int16* minstatus = 0, uint8* minlevel = 0, char *flag_needed = nullptr) { return GetSafePoints(GetZoneName(zoneID), version, safe_x, safe_y, safe_z, minstatus, minlevel, flag_needed); }
|
||||
uint8 GetSkillCap(uint8 skillid, uint8 in_race, uint8 in_class, uint16 in_level);
|
||||
|
||||
void AddReport(std::string who, std::string against, std::string lines);
|
||||
struct TimeOfDay_Struct LoadTime(time_t &realtime);
|
||||
bool SaveTime(int8 minute, int8 hour, int8 day, int8 month, int16 year);
|
||||
void ClearMerchantTemp();
|
||||
uint8 GetRaceSkill(uint8 skillid, uint8 in_race);
|
||||
bool LoadPTimers(uint32 charid, PTimerList &into);
|
||||
void ClearPTimers(uint32 charid);
|
||||
void SetFirstLogon(uint32 CharID, uint8 firstlogon);
|
||||
void SetLFG(uint32 CharID, bool LFG);
|
||||
void ClearMerchantTemp();
|
||||
void SetLFP(uint32 CharID, bool LFP);
|
||||
void SetLFG(uint32 CharID, bool LFG);
|
||||
void SetFirstLogon(uint32 CharID, uint8 firstlogon);
|
||||
void SetLoginFlags(uint32 CharID, bool LFP, bool LFG, uint8 firstlogon);
|
||||
|
||||
void ClearInvSnapshots(bool use_rule = true);
|
||||
|
||||
/* EQEmuLogSys */
|
||||
void LoadLogSettings(EQEmuLogSys::LogSettings* log_settings);
|
||||
void AddReport(std::string who, std::string against, std::string lines);
|
||||
|
||||
private:
|
||||
void DBInitVars();
|
||||
|
||||
std::map<uint32,std::string> zonename_array;
|
||||
|
||||
Mutex Mvarcache;
|
||||
VarCache_Struct varcache;
|
||||
Mutex Mvarcache;
|
||||
uint32 varcache_max;
|
||||
VarCache_Struct** varcache_array;
|
||||
uint32 varcache_lastupdate;
|
||||
|
||||
/* Groups, utility methods. */
|
||||
|
||||
/*
|
||||
* Groups, utility methods.
|
||||
*/
|
||||
void ClearAllGroupLeaders();
|
||||
void ClearAllGroups();
|
||||
|
||||
/* Raid, utility methods. */
|
||||
|
||||
/*
|
||||
* Raid, utility methods.
|
||||
*/
|
||||
void ClearAllRaids();
|
||||
void ClearAllRaidDetails();
|
||||
void ClearAllRaidLeaders();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,562 +0,0 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2015 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
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; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "../common/global_define.h"
|
||||
#include "../common/rulesys.h"
|
||||
#include "../common/string_util.h"
|
||||
#include "../common/timer.h"
|
||||
|
||||
#include "database.h"
|
||||
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
|
||||
// Disgrace: for windows compile
|
||||
#ifdef _WINDOWS
|
||||
#include <windows.h>
|
||||
#define snprintf _snprintf
|
||||
#define strncasecmp _strnicmp
|
||||
#define strcasecmp _stricmp
|
||||
#else
|
||||
#include "unix.h"
|
||||
#include <netinet/in.h>
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
bool Database::AddClientToInstance(uint16 instance_id, uint32 char_id)
|
||||
{
|
||||
std::string query = StringFormat(
|
||||
"REPLACE INTO `instance_list_player` (id, charid) "
|
||||
"VALUES "
|
||||
"(%lu, %lu)",
|
||||
(unsigned long)instance_id,
|
||||
(unsigned long)char_id
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
return results.Success();
|
||||
}
|
||||
|
||||
bool Database::CharacterInInstanceGroup(uint16 instance_id, uint32 char_id)
|
||||
{
|
||||
|
||||
std::string query = StringFormat("SELECT charid FROM instance_list_player where id=%u AND charid=%u", instance_id, char_id);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
if (results.RowCount() != 1)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Database::CheckInstanceExists(uint16 instance_id) {
|
||||
std::string query = StringFormat(
|
||||
"SELECT "
|
||||
"`id` "
|
||||
"FROM "
|
||||
"`instance_list` "
|
||||
"WHERE "
|
||||
"`id` = %u",
|
||||
instance_id
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
if (results.RowCount() == 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Database::CheckInstanceExpired(uint16 instance_id)
|
||||
{
|
||||
|
||||
int32 start_time = 0;
|
||||
int32 duration = 0;
|
||||
uint32 never_expires = 0;
|
||||
|
||||
std::string query = StringFormat("SELECT start_time, duration, never_expires FROM instance_list WHERE id=%u", instance_id);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success())
|
||||
return true;
|
||||
|
||||
if (results.RowCount() == 0)
|
||||
return true;
|
||||
|
||||
auto row = results.begin();
|
||||
|
||||
start_time = atoi(row[0]);
|
||||
duration = atoi(row[1]);
|
||||
never_expires = atoi(row[2]);
|
||||
|
||||
if (never_expires == 1)
|
||||
return false;
|
||||
|
||||
timeval tv;
|
||||
gettimeofday(&tv, nullptr);
|
||||
|
||||
if ((start_time + duration) <= tv.tv_sec)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Database::CreateInstance(uint16 instance_id, uint32 zone_id, uint32 version, uint32 duration)
|
||||
{
|
||||
std::string query = StringFormat("INSERT INTO instance_list (id, zone, version, start_time, duration)"
|
||||
" values(%lu, %lu, %lu, UNIX_TIMESTAMP(), %lu)",
|
||||
(unsigned long)instance_id, (unsigned long)zone_id, (unsigned long)version, (unsigned long)duration);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
return results.Success();
|
||||
}
|
||||
|
||||
bool Database::GetUnusedInstanceID(uint16 &instance_id)
|
||||
{
|
||||
uint32 count = RuleI(Zone, ReservedInstances);
|
||||
uint32 max = 65535;
|
||||
|
||||
std::string query = StringFormat("SELECT IFNULL(MAX(id),%u)+1 FROM instance_list WHERE id > %u", count, count);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success())
|
||||
{
|
||||
instance_id = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (results.RowCount() == 0)
|
||||
{
|
||||
instance_id = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
auto row = results.begin();
|
||||
|
||||
if (atoi(row[0]) <= max)
|
||||
{
|
||||
instance_id = atoi(row[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
query = StringFormat("SELECT id FROM instance_list where id > %u ORDER BY id", count);
|
||||
results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success())
|
||||
{
|
||||
instance_id = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (results.RowCount() == 0)
|
||||
{
|
||||
instance_id = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
count++;
|
||||
for (auto row = results.begin(); row != results.end(); ++row)
|
||||
{
|
||||
if (count < atoi(row[0]))
|
||||
{
|
||||
instance_id = count;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (count > max)
|
||||
{
|
||||
instance_id = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
count++;
|
||||
}
|
||||
|
||||
instance_id = count;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Database::GlobalInstance(uint16 instance_id)
|
||||
{
|
||||
std::string query = StringFormat(
|
||||
"SELECT "
|
||||
"is_global "
|
||||
"FROM "
|
||||
"instance_list "
|
||||
"WHERE "
|
||||
"id = %u "
|
||||
"LIMIT 1 ",
|
||||
instance_id
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
if (results.RowCount() == 0)
|
||||
return false;
|
||||
|
||||
auto row = results.begin();
|
||||
|
||||
return (atoi(row[0]) == 1) ? true : false;
|
||||
}
|
||||
|
||||
bool Database::RemoveClientFromInstance(uint16 instance_id, uint32 char_id)
|
||||
{
|
||||
std::string query = StringFormat("DELETE FROM instance_list_player WHERE id=%lu AND charid=%lu",
|
||||
(unsigned long)instance_id, (unsigned long)char_id);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
return results.Success();
|
||||
}
|
||||
|
||||
|
||||
bool Database::RemoveClientsFromInstance(uint16 instance_id)
|
||||
{
|
||||
std::string query = StringFormat("DELETE FROM instance_list_player WHERE id=%lu", (unsigned long)instance_id);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
return results.Success();
|
||||
}
|
||||
|
||||
bool Database::VerifyInstanceAlive(uint16 instance_id, uint32 char_id)
|
||||
{
|
||||
//we are not saved to this instance so set our instance to 0
|
||||
if (!GlobalInstance(instance_id) && !CharacterInInstanceGroup(instance_id, char_id))
|
||||
return false;
|
||||
|
||||
if (CheckInstanceExpired(instance_id))
|
||||
{
|
||||
DeleteInstance(instance_id);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Database::VerifyZoneInstance(uint32 zone_id, uint16 instance_id)
|
||||
{
|
||||
|
||||
std::string query = StringFormat("SELECT id FROM instance_list where id=%u AND zone=%u", instance_id, zone_id);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
if (results.RowCount() == 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
uint16 Database::GetInstanceID(const char* zone, uint32 character_id, int16 version) {
|
||||
|
||||
std::string query = StringFormat(
|
||||
"SELECT "
|
||||
"instance_list.id "
|
||||
"FROM "
|
||||
"instance_list, "
|
||||
"instance_list_player "
|
||||
"WHERE "
|
||||
"instance_list.zone = %u "
|
||||
"AND instance_list.version = %u "
|
||||
"AND instance_list.id = instance_list_player.id "
|
||||
"AND instance_list_player.charid = %u "
|
||||
"LIMIT 1 ",
|
||||
GetZoneID(zone),
|
||||
version,
|
||||
character_id
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success())
|
||||
return 0;
|
||||
|
||||
if (results.RowCount() == 0)
|
||||
return 0;
|
||||
|
||||
auto row = results.begin();
|
||||
return atoi(row[0]);
|
||||
}
|
||||
|
||||
uint16 Database::GetInstanceID(uint32 zone, uint32 character_id, int16 version)
|
||||
{
|
||||
if (!zone)
|
||||
return 0;
|
||||
|
||||
std::string query = StringFormat(
|
||||
"SELECT "
|
||||
"instance_list.id "
|
||||
"FROM "
|
||||
"instance_list, "
|
||||
"instance_list_player "
|
||||
"WHERE "
|
||||
"instance_list.zone = %u "
|
||||
"AND instance_list.version = %u "
|
||||
"AND instance_list.id = instance_list_player.id "
|
||||
"AND instance_list_player.charid = %u "
|
||||
"LIMIT 1; ",
|
||||
zone,
|
||||
version,
|
||||
character_id
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success())
|
||||
return 0;
|
||||
|
||||
if (results.RowCount() == 0)
|
||||
return 0;
|
||||
|
||||
auto row = results.begin();
|
||||
|
||||
return atoi(row[0]);
|
||||
}
|
||||
|
||||
uint16 Database::GetInstanceVersion(uint16 instance_id) {
|
||||
if (instance_id == 0)
|
||||
return 0;
|
||||
|
||||
std::string query = StringFormat("SELECT version FROM instance_list where id=%u", instance_id);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success())
|
||||
return 0;
|
||||
|
||||
if (results.RowCount() == 0)
|
||||
return 0;
|
||||
|
||||
auto row = results.begin();
|
||||
return atoi(row[0]);
|
||||
}
|
||||
|
||||
uint32 Database::GetTimeRemainingInstance(uint16 instance_id, bool &is_perma)
|
||||
{
|
||||
uint32 start_time = 0;
|
||||
uint32 duration = 0;
|
||||
uint32 never_expires = 0;
|
||||
|
||||
std::string query = StringFormat("SELECT start_time, duration, never_expires FROM instance_list WHERE id=%u", instance_id);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success())
|
||||
{
|
||||
is_perma = false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (results.RowCount() == 0)
|
||||
{
|
||||
is_perma = false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
auto row = results.begin();
|
||||
|
||||
start_time = atoi(row[0]);
|
||||
duration = atoi(row[1]);
|
||||
never_expires = atoi(row[2]);
|
||||
|
||||
if (never_expires == 1)
|
||||
{
|
||||
is_perma = true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
is_perma = false;
|
||||
|
||||
timeval tv;
|
||||
gettimeofday(&tv, nullptr);
|
||||
return ((start_time + duration) - tv.tv_sec);
|
||||
}
|
||||
|
||||
uint32 Database::VersionFromInstanceID(uint16 instance_id)
|
||||
{
|
||||
|
||||
std::string query = StringFormat("SELECT version FROM instance_list where id=%u", instance_id);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success())
|
||||
return 0;
|
||||
|
||||
if (results.RowCount() == 0)
|
||||
return 0;
|
||||
|
||||
auto row = results.begin();
|
||||
|
||||
return atoi(row[0]);
|
||||
}
|
||||
|
||||
uint32 Database::ZoneIDFromInstanceID(uint16 instance_id)
|
||||
{
|
||||
|
||||
std::string query = StringFormat("SELECT zone FROM instance_list where id=%u", instance_id);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success())
|
||||
return 0;
|
||||
|
||||
if (results.RowCount() == 0)
|
||||
return 0;
|
||||
|
||||
auto row = results.begin();
|
||||
|
||||
return atoi(row[0]);
|
||||
}
|
||||
|
||||
void Database::AssignGroupToInstance(uint32 group_id, uint32 instance_id)
|
||||
{
|
||||
|
||||
uint32 zone_id = ZoneIDFromInstanceID(instance_id);
|
||||
uint16 version = VersionFromInstanceID(instance_id);
|
||||
|
||||
std::string query = StringFormat("SELECT `charid` FROM `group_id` WHERE `groupid` = %u", group_id);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success())
|
||||
return;
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row)
|
||||
{
|
||||
uint32 charid = atoi(row[0]);
|
||||
if (GetInstanceID(zone_id, charid, version) == 0)
|
||||
AddClientToInstance(instance_id, charid);
|
||||
}
|
||||
}
|
||||
|
||||
void Database::AssignRaidToInstance(uint32 raid_id, uint32 instance_id)
|
||||
{
|
||||
|
||||
uint32 zone_id = ZoneIDFromInstanceID(instance_id);
|
||||
uint16 version = VersionFromInstanceID(instance_id);
|
||||
|
||||
std::string query = StringFormat("SELECT `charid` FROM `raid_members` WHERE `raidid` = %u", raid_id);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success())
|
||||
return;
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row)
|
||||
{
|
||||
uint32 charid = atoi(row[0]);
|
||||
if (GetInstanceID(zone_id, charid, version) == 0)
|
||||
AddClientToInstance(instance_id, charid);
|
||||
}
|
||||
}
|
||||
|
||||
void Database::BuryCorpsesInInstance(uint16 instance_id) {
|
||||
std::string query = StringFormat(
|
||||
"UPDATE `character_corpses` "
|
||||
"SET `is_buried` = 1, "
|
||||
"`instance_id` = 0 "
|
||||
"WHERE "
|
||||
"`instance_id` = %u ",
|
||||
instance_id
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
}
|
||||
|
||||
void Database::DeleteInstance(uint16 instance_id)
|
||||
{
|
||||
|
||||
std::string query = StringFormat("DELETE FROM instance_list WHERE id=%u", instance_id);
|
||||
QueryDatabase(query);
|
||||
|
||||
query = StringFormat("DELETE FROM instance_list_player WHERE id=%u", instance_id);
|
||||
QueryDatabase(query);
|
||||
|
||||
query = StringFormat("DELETE FROM respawn_times WHERE instance_id=%u", instance_id);
|
||||
QueryDatabase(query);
|
||||
|
||||
query = StringFormat("DELETE FROM spawn_condition_values WHERE instance_id=%u", instance_id);
|
||||
QueryDatabase(query);
|
||||
|
||||
BuryCorpsesInInstance(instance_id);
|
||||
}
|
||||
|
||||
void Database::FlagInstanceByGroupLeader(uint32 zone, int16 version, uint32 charid, uint32 gid)
|
||||
{
|
||||
uint16 id = GetInstanceID(zone, charid, version);
|
||||
if (id != 0)
|
||||
return;
|
||||
|
||||
char ln[128];
|
||||
memset(ln, 0, 128);
|
||||
strcpy(ln, GetGroupLeadershipInfo(gid, ln));
|
||||
uint32 l_charid = GetCharacterID((const char*)ln);
|
||||
uint16 l_id = GetInstanceID(zone, l_charid, version);
|
||||
|
||||
if (l_id == 0)
|
||||
return;
|
||||
|
||||
AddClientToInstance(l_id, charid);
|
||||
}
|
||||
|
||||
void Database::FlagInstanceByRaidLeader(uint32 zone, int16 version, uint32 charid, uint32 rid)
|
||||
{
|
||||
uint16 id = GetInstanceID(zone, charid, version);
|
||||
if (id != 0)
|
||||
return;
|
||||
|
||||
uint32 l_charid = GetCharacterID(GetRaidLeaderName(rid));
|
||||
uint16 l_id = GetInstanceID(zone, l_charid, version);
|
||||
|
||||
if (l_id == 0)
|
||||
return;
|
||||
|
||||
AddClientToInstance(l_id, charid);
|
||||
}
|
||||
|
||||
void Database::GetCharactersInInstance(uint16 instance_id, std::list<uint32> &charid_list) {
|
||||
|
||||
std::string query = StringFormat("SELECT `charid` FROM `instance_list_player` WHERE `id` = %u", instance_id);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success())
|
||||
return;
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row)
|
||||
charid_list.push_back(atoi(row[0]));
|
||||
}
|
||||
|
||||
void Database::PurgeExpiredInstances()
|
||||
{
|
||||
std::string query("SELECT id FROM instance_list where (start_time+duration) <= UNIX_TIMESTAMP() and never_expires = 0");
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success())
|
||||
return;
|
||||
|
||||
if (results.RowCount() == 0)
|
||||
return;
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row)
|
||||
DeleteInstance(atoi(row[0]));
|
||||
}
|
||||
|
||||
void Database::SetInstanceDuration(uint16 instance_id, uint32 new_duration)
|
||||
{
|
||||
std::string query = StringFormat("UPDATE `instance_list` SET start_time=UNIX_TIMESTAMP(), "
|
||||
"duration=%u WHERE id=%u", new_duration, instance_id);
|
||||
auto results = QueryDatabase(query);
|
||||
}
|
||||
+33
-18
@@ -1,17 +1,18 @@
|
||||
#include "../common/debug.h"
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#include <winsock2.h>
|
||||
#endif
|
||||
|
||||
#include "../common/misc_functions.h"
|
||||
#include "../common/eqemu_logsys.h"
|
||||
|
||||
#include "dbcore.h"
|
||||
|
||||
#include <errmsg.h>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <errmsg.h>
|
||||
#include <mysqld_error.h>
|
||||
#include <limits.h>
|
||||
#include "dbcore.h"
|
||||
#include <string.h>
|
||||
#include "../common/misc_functions.h"
|
||||
#include <cstdlib>
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#define snprintf _snprintf
|
||||
@@ -98,20 +99,29 @@ MySQLRequestResult DBcore::QueryDatabase(const char* query, uint32 querylen, boo
|
||||
|
||||
pStatus = Error;
|
||||
|
||||
auto errorBuffer = new char[MYSQL_ERRMSG_SIZE];
|
||||
char *errorBuffer = new char[MYSQL_ERRMSG_SIZE];
|
||||
|
||||
snprintf(errorBuffer, MYSQL_ERRMSG_SIZE, "#%i: %s", mysql_errno(&mysql), mysql_error(&mysql));
|
||||
|
||||
std::cout << "DB Query Error #" << mysql_errno(&mysql) << ": " << mysql_error(&mysql) << std::endl;
|
||||
|
||||
return MySQLRequestResult(nullptr, 0, 0, 0, 0, (uint32)mysql_errno(&mysql), errorBuffer);
|
||||
}
|
||||
|
||||
auto errorBuffer = new char[MYSQL_ERRMSG_SIZE];
|
||||
char *errorBuffer = new char[MYSQL_ERRMSG_SIZE];
|
||||
snprintf(errorBuffer, MYSQL_ERRMSG_SIZE, "#%i: %s", mysql_errno(&mysql), mysql_error(&mysql));
|
||||
|
||||
#ifdef _EQDEBUG
|
||||
std::cout << "DB Query Error #" << mysql_errno(&mysql) << ": " << mysql_error(&mysql) << std::endl;
|
||||
#endif
|
||||
|
||||
/* Implement Logging at the Root */
|
||||
if (mysql_errno(&mysql) > 0 && strlen(query) > 0){
|
||||
if (LogSys.log_settings[Logs::MySQLError].is_category_enabled == 1)
|
||||
Log(Logs::General, Logs::MySQLError, "%i: %s \n %s", mysql_errno(&mysql), mysql_error(&mysql), query);
|
||||
std::cout << "\n[MYSQL ERR] " << mysql_errno(&mysql) << ": " << mysql_error(&mysql) << " [Query]: \n" << query << "\n" << std::endl;
|
||||
/* Write to log file */
|
||||
std::ofstream log("eqemu_query_error_log.txt", std::ios_base::app | std::ios_base::out);
|
||||
log << "[MYSQL ERR] " << mysql_error(&mysql) << "\n" << query << "\n";
|
||||
log.close();
|
||||
}
|
||||
|
||||
return MySQLRequestResult(nullptr, 0, 0, 0, 0, mysql_errno(&mysql),errorBuffer);
|
||||
@@ -126,16 +136,21 @@ MySQLRequestResult DBcore::QueryDatabase(const char* query, uint32 querylen, boo
|
||||
rowCount = (uint32)mysql_num_rows(res);
|
||||
|
||||
MySQLRequestResult requestResult(res, (uint32)mysql_affected_rows(&mysql), rowCount, (uint32)mysql_field_count(&mysql), (uint32)mysql_insert_id(&mysql));
|
||||
|
||||
if (LogSys.log_settings[Logs::MySQLQuery].is_category_enabled == 1)
|
||||
|
||||
#if DEBUG_MYSQL_QUERIES >= 1
|
||||
if (requestResult.Success())
|
||||
{
|
||||
if ((strncasecmp(query, "select", 6) == 0)) {
|
||||
Log(Logs::General, Logs::MySQLQuery, "%s (%u row%s returned)", query, requestResult.RowCount(), requestResult.RowCount() == 1 ? "" : "s");
|
||||
}
|
||||
else {
|
||||
Log(Logs::General, Logs::MySQLQuery, "%s (%u row%s affected)", query, requestResult.RowsAffected(), requestResult.RowsAffected() == 1 ? "" : "s");
|
||||
}
|
||||
std::cout << "query successful";
|
||||
if (requestResult.Result())
|
||||
std::cout << ", " << (int) mysql_num_rows(requestResult.Result()) << " rows returned";
|
||||
|
||||
std::cout << ", " << requestResult.RowCount() << " rows affected";
|
||||
std::cout<< std::endl;
|
||||
}
|
||||
else {
|
||||
std::cout << "QUERY: query FAILED" << std::endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
return requestResult;
|
||||
}
|
||||
|
||||
+8
-5
@@ -2,16 +2,19 @@
|
||||
#define DBCORE_H
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#include <winsock2.h>
|
||||
#include <winsock.h>
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include "../common/mutex.h"
|
||||
#include "../common/mysql_request_result.h"
|
||||
#include "../common/types.h"
|
||||
|
||||
#include <mysql.h>
|
||||
#include <string.h>
|
||||
#include "../common/types.h"
|
||||
#include "../common/mutex.h"
|
||||
#include "../common/linked_list.h"
|
||||
#include "../common/queue.h"
|
||||
#include "../common/timer.h"
|
||||
#include "../common/condition.h"
|
||||
#include "../common/mysql_request_result.h"
|
||||
|
||||
class DBcore {
|
||||
public:
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
// Doors
|
||||
#ifdef SHAREMEM
|
||||
int32 Database::GetDoorsCount(uint32* oMaxID) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
char *query = 0;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
query = new char[256];
|
||||
strcpy(query, "SELECT MAX(id), count(*) FROM doors");
|
||||
if (RunQuery(query, strlen(query), errbuf, &result)) {
|
||||
safe_delete(query);
|
||||
row = mysql_fetch_row(result);
|
||||
if (row && row[1]) {
|
||||
int32 ret = atoi(row[1]);
|
||||
if (oMaxID) {
|
||||
if (row[0])
|
||||
*oMaxID = atoi(row[0]);
|
||||
else
|
||||
*oMaxID = 0;
|
||||
}
|
||||
mysql_free_result(result);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
else {
|
||||
cerr << "Error in GetDoorsCount query '" << query << "' " << errbuf << endl;
|
||||
delete[] query;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
extern "C" bool extDBLoadDoors(uint32 iDoorCount, uint32 iMaxDoorID) { return database.DBLoadDoors(iDoorCount, iMaxDoorID); }
|
||||
const Door* Database::GetDoor(uint8 door_id, const char* zone_name) {
|
||||
for(uint32 i=0; i<max_door_type; i++) {
|
||||
const Door* door = GetDoorDBID(i);
|
||||
if(door && door->door_id == door_id && strcasecmp(door->zone_name, zone_name) == 0)
|
||||
return door;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
const Door* Database::GetDoorDBID(uint32 db_id) {
|
||||
return EMuShareMemDLL.Doors.GetDoor(db_id);
|
||||
}
|
||||
|
||||
bool Database::LoadDoors() {
|
||||
if (!EMuShareMemDLL.Load())
|
||||
return false;
|
||||
int32 tmp_max_door_type = -1;
|
||||
uint32 tmp = 0;
|
||||
tmp_max_door_type = GetDoorsCount(&tmp);
|
||||
if (tmp_max_door_type < 0) {
|
||||
cout << "Error: Database::LoadDoors-ShareMem: GetDoorsCount() returned < 0" << endl;
|
||||
return false;
|
||||
}
|
||||
max_door_type = tmp_max_door_type;
|
||||
bool ret = EMuShareMemDLL.Doors.DLLLoadDoors(&extDBLoadDoors, sizeof(Door), max_door_type, tmp);
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool Database::DBLoadDoors(uint32 iDoorCount, uint32 iMaxDoorID) {
|
||||
cout << "Loading Doors from database..." << endl;
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
char *query = 0;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
query = new char[256];
|
||||
strcpy(query, "SELECT MAX(id), Count(*) FROM doors");
|
||||
if (RunQuery(query, strlen(query), errbuf, &result))
|
||||
{
|
||||
safe_delete(query);
|
||||
row = mysql_fetch_row(result);
|
||||
if (row && row[0]) {
|
||||
if (atoi(row[0]) > iMaxDoorID) {
|
||||
cout << "Error: Insufficient shared memory to load doors." << endl;
|
||||
cout << "Max(id): " << atoi(row[0]) << ", iMaxDoorID: " << iMaxDoorID << endl;
|
||||
cout << "Fix this by increasing the MMF_MAX_Door_ID define statement" << endl;
|
||||
return false;
|
||||
}
|
||||
if (atoi(row[1]) != iDoorCount) {
|
||||
cout << "Error: Insufficient shared memory to load doors." << endl;
|
||||
cout << "Count(*): " << atoi(row[1]) << ", iDoorCount: " << iDoorCount << endl;
|
||||
return false;
|
||||
}
|
||||
max_door_type = atoi(row[0]);
|
||||
mysql_free_result(result);
|
||||
Door tmpDoor;
|
||||
MakeAnyLenString(&query, "SELECT id,doorid,zone,name,pos_x,pos_y,pos_z,heading,opentype,guild,lockpick,keyitem,triggerdoor,triggertype from doors");//WHERE zone='%s'", zone_name
|
||||
if (RunQuery(query, strlen(query), errbuf, &result))
|
||||
{
|
||||
safe_delete(query);
|
||||
while((row = mysql_fetch_row(result))) {
|
||||
memset(&tmpDoor, 0, sizeof(Door));
|
||||
tmpDoor.db_id = atoi(row[0]);
|
||||
tmpDoor.door_id = atoi(row[1]);
|
||||
strn0cpy(tmpDoor.zone_name,row[2],32);
|
||||
strn0cpy(tmpDoor.door_name,row[3],32);
|
||||
tmpDoor.pos_x = (float)atof(row[4]);
|
||||
tmpDoor.pos_y = (float)atof(row[5]);
|
||||
tmpDoor.pos_z = (float)atof(row[6]);
|
||||
tmpDoor.heading = atoi(row[7]);
|
||||
tmpDoor.opentype = atoi(row[8]);
|
||||
tmpDoor.guild_id = atoi(row[9]);
|
||||
tmpDoor.lockpick = atoi(row[10]);
|
||||
tmpDoor.keyitem = atoi(row[11]);
|
||||
tmpDoor.trigger_door = atoi(row[12]);
|
||||
tmpDoor.trigger_type = atoi(row[13]);
|
||||
EMuShareMemDLL.Doors.cbAddDoor(tmpDoor.db_id, &tmpDoor);
|
||||
Sleep(0);
|
||||
}
|
||||
mysql_free_result(result);
|
||||
}
|
||||
else
|
||||
{
|
||||
cerr << "Error in DBLoadDoors query '" << query << "' " << errbuf << endl;
|
||||
delete[] query;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,441 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <cstdarg>
|
||||
#include <time.h>
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#include <process.h>
|
||||
|
||||
#define snprintf _snprintf
|
||||
#define vsnprintf _vsnprintf
|
||||
#define strncasecmp _strnicmp
|
||||
#define strcasecmp _stricmp
|
||||
|
||||
#else
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#endif
|
||||
|
||||
#include "debug.h"
|
||||
#include "string_util.h"
|
||||
#include "misc_functions.h"
|
||||
#include "platform.h"
|
||||
|
||||
#ifndef va_copy
|
||||
#define va_copy(d,s) ((d) = (s))
|
||||
#endif
|
||||
|
||||
static volatile bool logFileValid = false;
|
||||
static EQEMuLog realLogFile;
|
||||
EQEMuLog *LogFile = &realLogFile;
|
||||
|
||||
static const char* FileNames[EQEMuLog::MaxLogID] = { "logs/eqemu", "logs/eqemu", "logs/eqemu_error", "logs/eqemu_debug", "logs/eqemu_quest", "logs/eqemu_commands", "logs/crash" };
|
||||
static const char* LogNames[EQEMuLog::MaxLogID] = { "Status", "Normal", "Error", "Debug", "Quest", "Command", "Crash" };
|
||||
|
||||
EQEMuLog::EQEMuLog() {
|
||||
for (int i=0; i<MaxLogID; i++) {
|
||||
fp[i] = 0;
|
||||
logCallbackFmt[i] = nullptr;
|
||||
logCallbackBuf[i] = nullptr;
|
||||
logCallbackPva[i] = nullptr;
|
||||
}
|
||||
|
||||
pLogStatus[Status] = LOG_LEVEL_STATUS;
|
||||
pLogStatus[Normal] = LOG_LEVEL_NORMAL;
|
||||
pLogStatus[Error] = LOG_LEVEL_ERROR;
|
||||
pLogStatus[Debug] = LOG_LEVEL_DEBUG;
|
||||
pLogStatus[Quest] = LOG_LEVEL_QUEST;
|
||||
pLogStatus[Commands] = LOG_LEVEL_COMMANDS;
|
||||
pLogStatus[Crash] = LOG_LEVEL_CRASH;
|
||||
logFileValid = true;
|
||||
}
|
||||
|
||||
EQEMuLog::~EQEMuLog() {
|
||||
logFileValid = false;
|
||||
for (int i=0; i<MaxLogID; i++) {
|
||||
LockMutex lock(&MLog[i]); //to prevent termination race
|
||||
if (fp[i])
|
||||
fclose(fp[i]);
|
||||
}
|
||||
}
|
||||
|
||||
bool EQEMuLog::open(LogIDs id) {
|
||||
if (!logFileValid) {
|
||||
return false;
|
||||
}
|
||||
if (id >= MaxLogID) {
|
||||
return false;
|
||||
}
|
||||
LockMutex lock(&MOpen);
|
||||
if (pLogStatus[id] & 4) {
|
||||
return false;
|
||||
}
|
||||
if (fp[id]) {
|
||||
//cerr<<"Warning: LogFile already open"<<endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
char exename[200] = "";
|
||||
const EQEmuExePlatform &platform = GetExecutablePlatform();
|
||||
if(platform == ExePlatformWorld) {
|
||||
snprintf(exename, sizeof(exename), "_world");
|
||||
} else if(platform == ExePlatformZone) {
|
||||
snprintf(exename, sizeof(exename), "_zone");
|
||||
} else if(platform == ExePlatformLaunch) {
|
||||
snprintf(exename, sizeof(exename), "_launch");
|
||||
} else if(platform == ExePlatformUCS) {
|
||||
snprintf(exename, sizeof(exename), "_ucs");
|
||||
} else if(platform == ExePlatformQueryServ) {
|
||||
snprintf(exename, sizeof(exename), "_queryserv");
|
||||
} else if(platform == ExePlatformSharedMemory) {
|
||||
snprintf(exename, sizeof(exename), "_shared_memory");
|
||||
} else if(platform == ExePlatformClientImport) {
|
||||
snprintf(exename, sizeof(exename), "_import");
|
||||
} else if(platform == ExePlatformClientExport) {
|
||||
snprintf(exename, sizeof(exename), "_export");
|
||||
}
|
||||
|
||||
char filename[200];
|
||||
#ifndef NO_PIDLOG
|
||||
snprintf(filename, sizeof(filename), "%s%s_%04i.log", FileNames[id], exename, getpid());
|
||||
#else
|
||||
snprintf(filename, sizeof(filename), "%s%s.log", FileNames[id], exename);
|
||||
#endif
|
||||
fp[id] = fopen(filename, "a");
|
||||
if (!fp[id]) {
|
||||
std::cerr << "Failed to open log file: " << filename << std::endl;
|
||||
pLogStatus[id] |= 4; // set file state to error
|
||||
return false;
|
||||
}
|
||||
fputs("---------------------------------------------\n",fp[id]);
|
||||
write(id, "Starting Log: %s", filename);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EQEMuLog::write(LogIDs id, const char *fmt, ...) {
|
||||
if (!logFileValid) {
|
||||
return false;
|
||||
}
|
||||
if (id >= MaxLogID) {
|
||||
return false;
|
||||
}
|
||||
bool dofile = false;
|
||||
if (pLogStatus[id] & 1) {
|
||||
dofile = open(id);
|
||||
}
|
||||
if (!(dofile || pLogStatus[id] & 2))
|
||||
return false;
|
||||
LockMutex lock(&MLog[id]);
|
||||
if (!logFileValid)
|
||||
return false; //check again for threading race reasons (to avoid two mutexes)
|
||||
|
||||
time_t aclock;
|
||||
struct tm *newtime;
|
||||
|
||||
time( &aclock ); /* Get time in seconds */
|
||||
newtime = localtime( &aclock ); /* Convert time to struct */
|
||||
|
||||
if (dofile)
|
||||
#ifndef NO_PIDLOG
|
||||
fprintf(fp[id], "[%02d.%02d. - %02d:%02d:%02d] ", newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec);
|
||||
#else
|
||||
fprintf(fp[id], "%04i [%02d.%02d. - %02d:%02d:%02d] ", getpid(), newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec);
|
||||
#endif
|
||||
|
||||
va_list argptr, tmpargptr;
|
||||
va_start(argptr, fmt);
|
||||
if (dofile) {
|
||||
va_copy(tmpargptr, argptr);
|
||||
vfprintf( fp[id], fmt, tmpargptr );
|
||||
}
|
||||
if(logCallbackFmt[id]) {
|
||||
msgCallbackFmt p = logCallbackFmt[id];
|
||||
va_copy(tmpargptr, argptr);
|
||||
p(id, fmt, tmpargptr );
|
||||
}
|
||||
if (pLogStatus[id] & 2) {
|
||||
if (pLogStatus[id] & 8) {
|
||||
fprintf(stderr, "[%s] ", LogNames[id]);
|
||||
vfprintf( stderr, fmt, argptr );
|
||||
}
|
||||
else {
|
||||
fprintf(stdout, "[%s] ", LogNames[id]);
|
||||
vfprintf( stdout, fmt, argptr );
|
||||
}
|
||||
}
|
||||
va_end(argptr);
|
||||
if (dofile)
|
||||
fprintf(fp[id], "\n");
|
||||
if (pLogStatus[id] & 2) {
|
||||
if (pLogStatus[id] & 8) {
|
||||
fprintf(stderr, "\n");
|
||||
fflush(stderr);
|
||||
} else {
|
||||
fprintf(stdout, "\n");
|
||||
fflush(stdout);
|
||||
}
|
||||
}
|
||||
if(dofile)
|
||||
fflush(fp[id]);
|
||||
return true;
|
||||
}
|
||||
|
||||
//write with Prefix and a VA_list
|
||||
bool EQEMuLog::writePVA(LogIDs id, const char *prefix, const char *fmt, va_list argptr) {
|
||||
if (!logFileValid) {
|
||||
return false;
|
||||
}
|
||||
if (id >= MaxLogID) {
|
||||
return false;
|
||||
}
|
||||
bool dofile = false;
|
||||
if (pLogStatus[id] & 1) {
|
||||
dofile = open(id);
|
||||
}
|
||||
if (!(dofile || pLogStatus[id] & 2)) {
|
||||
return false;
|
||||
}
|
||||
LockMutex lock(&MLog[id]);
|
||||
if (!logFileValid)
|
||||
return false; //check again for threading race reasons (to avoid two mutexes)
|
||||
|
||||
time_t aclock;
|
||||
struct tm *newtime;
|
||||
|
||||
time( &aclock ); /* Get time in seconds */
|
||||
newtime = localtime( &aclock ); /* Convert time to struct */
|
||||
|
||||
va_list tmpargptr;
|
||||
|
||||
if (dofile) {
|
||||
#ifndef NO_PIDLOG
|
||||
fprintf(fp[id], "[%02d.%02d. - %02d:%02d:%02d] %s", newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec, prefix);
|
||||
#else
|
||||
fprintf(fp[id], "%04i [%02d.%02d. - %02d:%02d:%02d] %s", getpid(), newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec, prefix);
|
||||
#endif
|
||||
va_copy(tmpargptr, argptr);
|
||||
vfprintf( fp[id], fmt, tmpargptr );
|
||||
}
|
||||
if(logCallbackPva[id]) {
|
||||
msgCallbackPva p = logCallbackPva[id];
|
||||
va_copy(tmpargptr, argptr);
|
||||
p(id, prefix, fmt, tmpargptr );
|
||||
}
|
||||
if (pLogStatus[id] & 2) {
|
||||
if (pLogStatus[id] & 8) {
|
||||
fprintf(stderr, "[%s] %s", LogNames[id], prefix);
|
||||
vfprintf( stderr, fmt, argptr );
|
||||
}
|
||||
else {
|
||||
fprintf(stdout, "[%s] %s", LogNames[id], prefix);
|
||||
vfprintf( stdout, fmt, argptr );
|
||||
}
|
||||
}
|
||||
va_end(argptr);
|
||||
if (dofile)
|
||||
fprintf(fp[id], "\n");
|
||||
if (pLogStatus[id] & 2) {
|
||||
if (pLogStatus[id] & 8)
|
||||
fprintf(stderr, "\n");
|
||||
else
|
||||
fprintf(stdout, "\n");
|
||||
}
|
||||
if(dofile)
|
||||
fflush(fp[id]);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EQEMuLog::writebuf(LogIDs id, const char *buf, uint8 size, uint32 count) {
|
||||
if (!logFileValid) {
|
||||
return false;
|
||||
}
|
||||
if (id >= MaxLogID) {
|
||||
return false;
|
||||
}
|
||||
bool dofile = false;
|
||||
if (pLogStatus[id] & 1) {
|
||||
dofile = open(id);
|
||||
}
|
||||
if (!(dofile || pLogStatus[id] & 2))
|
||||
return false;
|
||||
LockMutex lock(&MLog[id]);
|
||||
if (!logFileValid)
|
||||
return false; //check again for threading race reasons (to avoid two mutexes)
|
||||
|
||||
time_t aclock;
|
||||
struct tm *newtime;
|
||||
|
||||
time( &aclock ); /* Get time in seconds */
|
||||
newtime = localtime( &aclock ); /* Convert time to struct */
|
||||
|
||||
if (dofile)
|
||||
#ifndef NO_PIDLOG
|
||||
fprintf(fp[id], "[%02d.%02d. - %02d:%02d:%02d] ", newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec);
|
||||
#else
|
||||
fprintf(fp[id], "%04i [%02d.%02d. - %02d:%02d:%02d] ", getpid(), newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec);
|
||||
#endif
|
||||
|
||||
if (dofile) {
|
||||
fwrite(buf, size, count, fp[id]);
|
||||
fprintf(fp[id], "\n");
|
||||
}
|
||||
if(logCallbackBuf[id]) {
|
||||
msgCallbackBuf p = logCallbackBuf[id];
|
||||
p(id, buf, size, count);
|
||||
}
|
||||
if (pLogStatus[id] & 2) {
|
||||
if (pLogStatus[id] & 8) {
|
||||
fprintf(stderr, "[%s] ", LogNames[id]);
|
||||
fwrite(buf, size, count, stderr);
|
||||
fprintf(stderr, "\n");
|
||||
} else {
|
||||
fprintf(stdout, "[%s] ", LogNames[id]);
|
||||
fwrite(buf, size, count, stdout);
|
||||
fprintf(stdout, "\n");
|
||||
}
|
||||
}
|
||||
if(dofile)
|
||||
fflush(fp[id]);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EQEMuLog::writeNTS(LogIDs id, bool dofile, const char *fmt, ...) {
|
||||
va_list argptr, tmpargptr;
|
||||
va_start(argptr, fmt);
|
||||
if (dofile) {
|
||||
va_copy(tmpargptr, argptr);
|
||||
vfprintf( fp[id], fmt, tmpargptr );
|
||||
}
|
||||
if (pLogStatus[id] & 2) {
|
||||
if (pLogStatus[id] & 8)
|
||||
vfprintf( stderr, fmt, argptr );
|
||||
else
|
||||
vfprintf( stdout, fmt, argptr );
|
||||
}
|
||||
va_end(argptr);
|
||||
return true;
|
||||
};
|
||||
|
||||
bool EQEMuLog::Dump(LogIDs id, uint8* data, uint32 size, uint32 cols, uint32 skip) {
|
||||
if (!logFileValid) {
|
||||
#if EQDEBUG >= 10
|
||||
std::cerr << "Error: Dump() from null pointer" << std::endl;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
if (size == 0)
|
||||
return true;
|
||||
if (!LogFile)
|
||||
return false;
|
||||
if (id >= MaxLogID)
|
||||
return false;
|
||||
bool dofile = false;
|
||||
if (pLogStatus[id] & 1) {
|
||||
dofile = open(id);
|
||||
}
|
||||
if (!(dofile || pLogStatus[id] & 2))
|
||||
return false;
|
||||
LockMutex lock(&MLog[id]);
|
||||
if (!logFileValid)
|
||||
return false; //check again for threading race reasons (to avoid two mutexes)
|
||||
|
||||
write(id, "Dumping Packet: %i", size);
|
||||
// Output as HEX
|
||||
|
||||
int beginningOfLineOffset = 0;
|
||||
uint32 indexInData;
|
||||
std::string asciiOutput;
|
||||
|
||||
for(indexInData=skip; indexInData<size; indexInData++) {
|
||||
if ((indexInData-skip)%cols==0) {
|
||||
if (indexInData != skip)
|
||||
writeNTS(id, dofile, " | %s\n", asciiOutput.c_str());
|
||||
writeNTS(id, dofile, "%4i: ", indexInData-skip);
|
||||
asciiOutput.clear();
|
||||
beginningOfLineOffset = 0;
|
||||
}
|
||||
else if ((indexInData-skip)%(cols/2) == 0) {
|
||||
writeNTS(id, dofile, "- ");
|
||||
}
|
||||
writeNTS(id, dofile, "%02X ", (unsigned char)data[indexInData]);
|
||||
|
||||
if (data[indexInData] >= 32 && data[indexInData] < 127)
|
||||
{
|
||||
// According to http://msdn.microsoft.com/en-us/library/vstudio/ee404875(v=vs.100).aspx
|
||||
// Visual Studio 2010 doesn't have std::to_string(int) but it does have the long long
|
||||
// version.
|
||||
asciiOutput.append(std::to_string((long long)data[indexInData]));
|
||||
}
|
||||
else
|
||||
{
|
||||
asciiOutput.append(".");
|
||||
}
|
||||
}
|
||||
uint32 k = ((indexInData-skip)-1)%cols;
|
||||
if (k < 8)
|
||||
writeNTS(id, dofile, " ");
|
||||
for (uint32 h = k+1; h < cols; h++) {
|
||||
writeNTS(id, dofile, " ");
|
||||
}
|
||||
writeNTS(id, dofile, " | %s\n", asciiOutput.c_str());
|
||||
if (dofile)
|
||||
fflush(fp[id]);
|
||||
return true;
|
||||
}
|
||||
|
||||
void EQEMuLog::SetCallback(LogIDs id, msgCallbackFmt proc) {
|
||||
if (!logFileValid)
|
||||
return;
|
||||
if (id >= MaxLogID) {
|
||||
return;
|
||||
}
|
||||
logCallbackFmt[id] = proc;
|
||||
}
|
||||
|
||||
void EQEMuLog::SetCallback(LogIDs id, msgCallbackBuf proc) {
|
||||
if (!logFileValid)
|
||||
return;
|
||||
if (id >= MaxLogID) {
|
||||
return;
|
||||
}
|
||||
logCallbackBuf[id] = proc;
|
||||
}
|
||||
|
||||
void EQEMuLog::SetCallback(LogIDs id, msgCallbackPva proc) {
|
||||
if (!logFileValid)
|
||||
return;
|
||||
if (id >= MaxLogID) {
|
||||
return;
|
||||
}
|
||||
logCallbackPva[id] = proc;
|
||||
}
|
||||
|
||||
void EQEMuLog::SetAllCallbacks(msgCallbackFmt proc) {
|
||||
if (!logFileValid)
|
||||
return;
|
||||
int r;
|
||||
for(r = Status; r < MaxLogID; r++) {
|
||||
SetCallback((LogIDs)r, proc);
|
||||
}
|
||||
}
|
||||
|
||||
void EQEMuLog::SetAllCallbacks(msgCallbackBuf proc) {
|
||||
if (!logFileValid)
|
||||
return;
|
||||
int r;
|
||||
for(r = Status; r < MaxLogID; r++) {
|
||||
SetCallback((LogIDs)r, proc);
|
||||
}
|
||||
}
|
||||
|
||||
void EQEMuLog::SetAllCallbacks(msgCallbackPva proc) {
|
||||
if (!logFileValid)
|
||||
return;
|
||||
int r;
|
||||
for(r = Status; r < MaxLogID; r++) {
|
||||
SetCallback((LogIDs)r, proc);
|
||||
}
|
||||
}
|
||||
|
||||
+149
@@ -0,0 +1,149 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
|
||||
|
||||
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; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
// Debug Levels
|
||||
#ifndef EQDEBUG
|
||||
#define EQDEBUG 1
|
||||
#else
|
||||
////// File/Console options
|
||||
// 0 <= Quiet mode Errors to file Status and Normal ignored
|
||||
// 1 >= Status and Normal to console, Errors to file
|
||||
// 2 >= Status, Normal, and Error to console and logfile
|
||||
// 3 >= Lite debug
|
||||
// 4 >= Medium debug
|
||||
// 5 >= Debug release (Anything higher is not recommended for regular use)
|
||||
// 6 == (Reserved for special builds) Login opcode debug All packets dumped
|
||||
// 7 == (Reserved for special builds) Chat Opcode debug All packets dumped
|
||||
// 8 == (Reserved for special builds) World opcode debug All packets dumped
|
||||
// 9 == (Reserved for special builds) Zone Opcode debug All packets dumped
|
||||
// 10 >= More than you ever wanted to know
|
||||
//
|
||||
/////
|
||||
// Add more below to reserve for file's functions ect.
|
||||
/////
|
||||
// Any setup code based on defines should go here
|
||||
//
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(_DEBUG) && defined(WIN32)
|
||||
#ifndef _CRTDBG_MAP_ALLOC
|
||||
#include <stdlib.h>
|
||||
#include <crtdbg.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef EQDEBUG_H
|
||||
#define EQDEBUG_H
|
||||
|
||||
#ifndef _WINDOWS
|
||||
#define DebugBreak() if(0) {}
|
||||
#endif
|
||||
|
||||
#define _WINSOCKAPI_ //stupid windows, trying to fix the winsock2 vs. winsock issues
|
||||
#if defined(WIN32) && ( defined(PACKETCOLLECTOR) || defined(COLLECTOR) )
|
||||
// Packet Collector on win32 requires winsock.h due to latest pcap.h
|
||||
// winsock.h must come before windows.h
|
||||
#include <winsock.h>
|
||||
#endif
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#include <windows.h>
|
||||
#include <winsock2.h>
|
||||
#endif
|
||||
|
||||
#include "logsys.h"
|
||||
|
||||
#include "../common/mutex.h"
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
|
||||
class EQEMuLog {
|
||||
public:
|
||||
EQEMuLog();
|
||||
~EQEMuLog();
|
||||
|
||||
enum LogIDs {
|
||||
Status = 0, /* This must stay the first entry in this list */
|
||||
Normal, /* Normal Logs */
|
||||
Error, /* Error Logs */
|
||||
Debug, /* Debug Logs */
|
||||
Quest, /* Quest Logs */
|
||||
Commands, /* Issued Comamnds */
|
||||
Crash, /* Crash Logs */
|
||||
Save, /* Client Saves */
|
||||
MaxLogID /* Max, used in functions to get the max log ID */
|
||||
};
|
||||
|
||||
//these are callbacks called for each
|
||||
typedef void (* msgCallbackBuf)(LogIDs id, const char *buf, uint8 size, uint32 count);
|
||||
typedef void (* msgCallbackFmt)(LogIDs id, const char *fmt, va_list ap);
|
||||
typedef void (* msgCallbackPva)(LogIDs id, const char *prefix, const char *fmt, va_list ap);
|
||||
|
||||
void SetAllCallbacks(msgCallbackFmt proc);
|
||||
void SetAllCallbacks(msgCallbackBuf proc);
|
||||
void SetAllCallbacks(msgCallbackPva proc);
|
||||
void SetCallback(LogIDs id, msgCallbackFmt proc);
|
||||
void SetCallback(LogIDs id, msgCallbackBuf proc);
|
||||
void SetCallback(LogIDs id, msgCallbackPva proc);
|
||||
|
||||
bool writebuf(LogIDs id, const char *buf, uint8 size, uint32 count);
|
||||
bool write(LogIDs id, const char *fmt, ...);
|
||||
bool writePVA(LogIDs id, const char *prefix, const char *fmt, va_list args);
|
||||
bool Dump(LogIDs id, uint8* data, uint32 size, uint32 cols=16, uint32 skip=0);
|
||||
private:
|
||||
bool open(LogIDs id);
|
||||
bool writeNTS(LogIDs id, bool dofile, const char *fmt, ...); // no error checking, assumes is open, no locking, no timestamp, no newline
|
||||
|
||||
Mutex MOpen;
|
||||
Mutex MLog[MaxLogID];
|
||||
FILE* fp[MaxLogID];
|
||||
|
||||
/* LogStatus: bitwise variable
|
||||
1 = output to file
|
||||
2 = output to stdout
|
||||
4 = fopen error, dont retry
|
||||
8 = use stderr instead (2 must be set)
|
||||
*/
|
||||
uint8 pLogStatus[MaxLogID];
|
||||
|
||||
msgCallbackFmt logCallbackFmt[MaxLogID];
|
||||
msgCallbackBuf logCallbackBuf[MaxLogID];
|
||||
msgCallbackPva logCallbackPva[MaxLogID];
|
||||
};
|
||||
|
||||
extern EQEMuLog* LogFile;
|
||||
|
||||
#ifdef _EQDEBUG
|
||||
class PerformanceMonitor {
|
||||
public:
|
||||
PerformanceMonitor(int64* ip) {
|
||||
p = ip;
|
||||
QueryPerformanceCounter(&tmp);
|
||||
}
|
||||
~PerformanceMonitor() {
|
||||
LARGE_INTEGER tmp2;
|
||||
QueryPerformanceCounter(&tmp2);
|
||||
*p += tmp2.QuadPart - tmp.QuadPart;
|
||||
}
|
||||
LARGE_INTEGER tmp;
|
||||
int64* p;
|
||||
};
|
||||
#endif
|
||||
#endif
|
||||
@@ -1,149 +0,0 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
|
||||
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
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; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "deity.h"
|
||||
|
||||
|
||||
EQEmu::deity::DeityTypeBit EQEmu::deity::ConvertDeityTypeToDeityTypeBit(DeityType deity_type)
|
||||
{
|
||||
switch (deity_type) {
|
||||
case DeityBertoxxulous:
|
||||
return bit_DeityBertoxxulous;
|
||||
case DeityBrellSirilis:
|
||||
return bit_DeityBrellSirilis;
|
||||
case DeityCazicThule:
|
||||
return bit_DeityCazicThule;
|
||||
case DeityErollisiMarr:
|
||||
return bit_DeityErollisiMarr;
|
||||
case DeityBristlebane:
|
||||
return bit_DeityBristlebane;
|
||||
case DeityInnoruuk:
|
||||
return bit_DeityInnoruuk;
|
||||
case DeityKarana:
|
||||
return bit_DeityKarana;
|
||||
case DeityMithanielMarr:
|
||||
return bit_DeityMithanielMarr;
|
||||
case DeityPrexus:
|
||||
return bit_DeityPrexus;
|
||||
case DeityQuellious:
|
||||
return bit_DeityQuellious;
|
||||
case DeityRallosZek:
|
||||
return bit_DeityRallosZek;
|
||||
case DeityRodcetNife:
|
||||
return bit_DeityRodcetNife;
|
||||
case DeitySolusekRo:
|
||||
return bit_DeitySolusekRo;
|
||||
case DeityTheTribunal:
|
||||
return bit_DeityTheTribunal;
|
||||
case DeityTunare:
|
||||
return bit_DeityTunare;
|
||||
case DeityVeeshan:
|
||||
return bit_DeityVeeshan;
|
||||
case DeityAgnostic_LB:
|
||||
case DeityAgnostic:
|
||||
return bit_DeityAgnostic;
|
||||
default:
|
||||
return bit_DeityAll;
|
||||
};
|
||||
}
|
||||
|
||||
EQEmu::deity::DeityType EQEmu::deity::ConvertDeityTypeBitToDeityType(DeityTypeBit deity_type_bit)
|
||||
{
|
||||
switch (deity_type_bit) {
|
||||
case bit_DeityAgnostic:
|
||||
return DeityAgnostic;
|
||||
case bit_DeityBertoxxulous:
|
||||
return DeityBertoxxulous;
|
||||
case bit_DeityBrellSirilis:
|
||||
return DeityBrellSirilis;
|
||||
case bit_DeityCazicThule:
|
||||
return DeityCazicThule;
|
||||
case bit_DeityErollisiMarr:
|
||||
return DeityErollisiMarr;
|
||||
case bit_DeityBristlebane:
|
||||
return DeityBristlebane;
|
||||
case bit_DeityInnoruuk:
|
||||
return DeityInnoruuk;
|
||||
case bit_DeityKarana:
|
||||
return DeityKarana;
|
||||
case bit_DeityMithanielMarr:
|
||||
return DeityMithanielMarr;
|
||||
case bit_DeityPrexus:
|
||||
return DeityPrexus;
|
||||
case bit_DeityQuellious:
|
||||
return DeityQuellious;
|
||||
case bit_DeityRallosZek:
|
||||
return DeityRallosZek;
|
||||
case bit_DeityRodcetNife:
|
||||
return DeityRodcetNife;
|
||||
case bit_DeitySolusekRo:
|
||||
return DeitySolusekRo;
|
||||
case bit_DeityTheTribunal:
|
||||
return DeityTheTribunal;
|
||||
case bit_DeityTunare:
|
||||
return DeityTunare;
|
||||
case bit_DeityVeeshan:
|
||||
return DeityVeeshan;
|
||||
default:
|
||||
return DeityUnknown;
|
||||
};
|
||||
}
|
||||
|
||||
const char* EQEmu::deity::DeityName(DeityType deity_type)
|
||||
{
|
||||
switch (deity_type) {
|
||||
case DeityBertoxxulous:
|
||||
return "Bertoxxulous";
|
||||
case DeityBrellSirilis:
|
||||
return "Brell Serilis";
|
||||
case DeityCazicThule:
|
||||
return "Cazic-Thule";
|
||||
case DeityErollisiMarr:
|
||||
return "Erollisi Marr";
|
||||
case DeityBristlebane:
|
||||
return "Bristlebane";
|
||||
case DeityInnoruuk:
|
||||
return "Innoruuk";
|
||||
case DeityKarana:
|
||||
return "Karana";
|
||||
case DeityMithanielMarr:
|
||||
return "Mithaniel Marr";
|
||||
case DeityPrexus:
|
||||
return "Prexus";
|
||||
case DeityQuellious:
|
||||
return "Quellious";
|
||||
case DeityRallosZek:
|
||||
return "Rallos Zek";
|
||||
case DeityRodcetNife:
|
||||
return "Rodcet Nife";
|
||||
case DeitySolusekRo:
|
||||
return "Solusek Ro";
|
||||
case DeityTheTribunal:
|
||||
return "The Tribunal";
|
||||
case DeityTunare:
|
||||
return "Tunare";
|
||||
case DeityVeeshan:
|
||||
return "Veeshan";
|
||||
case DeityAgnostic_LB:
|
||||
case DeityAgnostic:
|
||||
return "Agnostic";
|
||||
default:
|
||||
return "Unknown";
|
||||
};
|
||||
}
|
||||
+141
-56
@@ -1,6 +1,5 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
|
||||
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemu.org)
|
||||
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
|
||||
|
||||
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
|
||||
@@ -14,68 +13,154 @@
|
||||
|
||||
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef COMMON_DEITY_H
|
||||
#define COMMON_DEITY_H
|
||||
#ifndef DEITY_H
|
||||
#define DEITY_H
|
||||
|
||||
#include "types.h"
|
||||
#include <string>
|
||||
|
||||
// NOTE: This code is not fully implemented since there are no references in the existing code
|
||||
|
||||
namespace EQEmu
|
||||
/*
|
||||
** Diety types
|
||||
**
|
||||
** (ref: eqstr_us.txt)
|
||||
**
|
||||
** (Another orphaned enumeration...)
|
||||
*/
|
||||
enum DeityTypes
|
||||
{
|
||||
namespace deity {
|
||||
enum DeityType {
|
||||
DeityUnknown = 0,
|
||||
DeityAgnostic_LB = 140,
|
||||
DeityBertoxxulous = 201,
|
||||
DeityBrellSirilis,
|
||||
DeityCazicThule,
|
||||
DeityErollisiMarr,
|
||||
DeityBristlebane,
|
||||
DeityInnoruuk,
|
||||
DeityKarana,
|
||||
DeityMithanielMarr,
|
||||
DeityPrexus,
|
||||
DeityQuellious,
|
||||
DeityRallosZek,
|
||||
DeityRodcetNife,
|
||||
DeitySolusekRo,
|
||||
DeityTheTribunal,
|
||||
DeityTunare,
|
||||
DeityVeeshan,
|
||||
DeityAgnostic = 396
|
||||
};
|
||||
/*----*/ DeityUnknown = 0,
|
||||
/*----*/ DeityAgnostic_LB = 140,
|
||||
/*3251*/ DeityBertoxxulous = 201,
|
||||
/*3262*/ DeityBrellSirilis,
|
||||
/*3253*/ DeityCazicThule,
|
||||
/*3256*/ DeityErollisiMarr,
|
||||
/*3252*/ DeityBristlebane,
|
||||
/*3254*/ DeityInnoruuk,
|
||||
/*3255*/ DeityKarana,
|
||||
/*3257*/ DeityMithanielMarr,
|
||||
/*3259*/ DeityPrexus,
|
||||
/*3260*/ DeityQuellious,
|
||||
/*3266*/ DeityRallosZek,
|
||||
/*3258*/ DeityRodcetNife,
|
||||
/*3261*/ DeitySolusekRo,
|
||||
/*3263*/ DeityTheTribunal,
|
||||
/*3264*/ DeityTunare,
|
||||
/*3265*/ DeityVeeshan,
|
||||
/*3250*/ DeityAgnostic = 396
|
||||
};
|
||||
|
||||
enum DeityTypeBit : uint32 {
|
||||
bit_DeityNone = 0x00000000,
|
||||
bit_DeityAgnostic = 0x00000001,
|
||||
bit_DeityBertoxxulous = 0x00000002,
|
||||
bit_DeityBrellSirilis = 0x00000004,
|
||||
bit_DeityCazicThule = 0x00000008,
|
||||
bit_DeityErollisiMarr = 0x00000010,
|
||||
bit_DeityBristlebane = 0x00000020,
|
||||
bit_DeityInnoruuk = 0x00000040,
|
||||
bit_DeityKarana = 0x00000080,
|
||||
bit_DeityMithanielMarr = 0x00000100,
|
||||
bit_DeityPrexus = 0x00000200,
|
||||
bit_DeityQuellious = 0x00000400,
|
||||
bit_DeityRallosZek = 0x00000800,
|
||||
bit_DeityRodcetNife = 0x00001000,
|
||||
bit_DeitySolusekRo = 0x00002000,
|
||||
bit_DeityTheTribunal = 0x00004000,
|
||||
bit_DeityTunare = 0x00008000,
|
||||
bit_DeityVeeshan = 0x00010000,
|
||||
bit_DeityAll = 0xFFFFFFFF
|
||||
};
|
||||
/*
|
||||
** Deity type bits
|
||||
**
|
||||
** (New orphan, but make use of it!)
|
||||
*/
|
||||
enum DeityTypeBits : uint32
|
||||
{
|
||||
BIT_DeityAll = 0x00000000,
|
||||
BIT_DeityAgnostic = 0x00000001,
|
||||
BIT_DeityBertoxxulous = 0x00000002,
|
||||
BIT_DeityBrellSirilis = 0x00000004,
|
||||
BIT_DeityCazicThule = 0x00000008,
|
||||
BIT_DeityErollisiMarr = 0x00000010,
|
||||
BIT_DeityBristlebane = 0x00000020,
|
||||
BIT_DeityInnoruuk = 0x00000040,
|
||||
BIT_DeityKarana = 0x00000080,
|
||||
BIT_DeityMithanielMarr = 0x00000100,
|
||||
BIT_DeityPrexus = 0x00000200,
|
||||
BIT_DeityQuellious = 0x00000400,
|
||||
BIT_DeityRallosZek = 0x00000800,
|
||||
BIT_DeityRodcetNife = 0x00001000,
|
||||
BIT_DeitySolusekRo = 0x00002000,
|
||||
BIT_DeityTheTribunal = 0x00004000,
|
||||
BIT_DeityTunare = 0x00008000,
|
||||
BIT_DeityVeeshan = 0x00010000
|
||||
};
|
||||
|
||||
extern DeityTypeBit ConvertDeityTypeToDeityTypeBit(DeityType deity_type);
|
||||
extern DeityType ConvertDeityTypeBitToDeityType(DeityTypeBit deity_type_bit);
|
||||
extern const char* DeityName(DeityType deity_type);
|
||||
static DeityTypeBits ConvertDeityToBitDeity(DeityTypes deity)
|
||||
{
|
||||
switch(deity)
|
||||
{
|
||||
case DeityBertoxxulous: { return BIT_DeityBertoxxulous; }
|
||||
case DeityBrellSirilis: { return BIT_DeityBrellSirilis; }
|
||||
case DeityCazicThule: { return BIT_DeityCazicThule; }
|
||||
case DeityErollisiMarr: { return BIT_DeityErollisiMarr; }
|
||||
case DeityBristlebane: { return BIT_DeityBristlebane; }
|
||||
case DeityInnoruuk: { return BIT_DeityInnoruuk; }
|
||||
case DeityKarana: { return BIT_DeityKarana; }
|
||||
case DeityMithanielMarr: { return BIT_DeityMithanielMarr; }
|
||||
case DeityPrexus: { return BIT_DeityPrexus; }
|
||||
case DeityQuellious: { return BIT_DeityQuellious; }
|
||||
case DeityRallosZek: { return BIT_DeityRallosZek; }
|
||||
case DeityRodcetNife: { return BIT_DeityRodcetNife; }
|
||||
case DeitySolusekRo: { return BIT_DeitySolusekRo; }
|
||||
case DeityTheTribunal: { return BIT_DeityTheTribunal; }
|
||||
case DeityTunare: { return BIT_DeityTunare; }
|
||||
case DeityVeeshan: { return BIT_DeityVeeshan; }
|
||||
case DeityAgnostic_LB:
|
||||
case DeityAgnostic: { return BIT_DeityAgnostic; }
|
||||
default: { break; }
|
||||
};
|
||||
|
||||
} /*deity*/
|
||||
return BIT_DeityAll;
|
||||
};
|
||||
|
||||
} /*EQEmu*/
|
||||
static DeityTypes ConvertBitDeityToDeity(DeityTypeBits deity_bit)
|
||||
{
|
||||
switch(deity_bit)
|
||||
{
|
||||
case BIT_DeityAgnostic: { return DeityAgnostic; }
|
||||
case BIT_DeityBertoxxulous: { return DeityBertoxxulous; }
|
||||
case BIT_DeityBrellSirilis: { return DeityBrellSirilis; }
|
||||
case BIT_DeityCazicThule: { return DeityCazicThule; }
|
||||
case BIT_DeityErollisiMarr: { return DeityErollisiMarr; }
|
||||
case BIT_DeityBristlebane: { return DeityBristlebane; }
|
||||
case BIT_DeityInnoruuk: { return DeityInnoruuk; }
|
||||
case BIT_DeityKarana: { return DeityKarana; }
|
||||
case BIT_DeityMithanielMarr: { return DeityMithanielMarr; }
|
||||
case BIT_DeityPrexus: { return DeityPrexus; }
|
||||
case BIT_DeityQuellious: { return DeityQuellious; }
|
||||
case BIT_DeityRallosZek: { return DeityRallosZek; }
|
||||
case BIT_DeityRodcetNife: { return DeityRodcetNife; }
|
||||
case BIT_DeitySolusekRo: { return DeitySolusekRo; }
|
||||
case BIT_DeityTheTribunal: { return DeityTheTribunal; }
|
||||
case BIT_DeityTunare: { return DeityTunare; }
|
||||
case BIT_DeityVeeshan: { return DeityVeeshan; }
|
||||
default: { break; }
|
||||
};
|
||||
|
||||
#endif /* COMMON_DEITY_H */
|
||||
return DeityUnknown;
|
||||
};
|
||||
|
||||
static std::string GetDeityName(DeityTypes deity)
|
||||
{
|
||||
switch(deity)
|
||||
{
|
||||
case DeityBertoxxulous: { return "Bertoxxulous"; }
|
||||
case DeityBrellSirilis: { return "Brell Serilis"; }
|
||||
case DeityCazicThule: { return "Cazic-Thule"; }
|
||||
case DeityErollisiMarr: { return "Erollisi Marr"; }
|
||||
case DeityBristlebane: { return "Bristlebane"; }
|
||||
case DeityInnoruuk: { return "Innoruuk"; }
|
||||
case DeityKarana: { return "Karana"; }
|
||||
case DeityMithanielMarr: { return "Mithaniel Marr"; }
|
||||
case DeityPrexus: { return "Prexus"; }
|
||||
case DeityQuellious: { return "Quellious"; }
|
||||
case DeityRallosZek: { return "Rallos Zek"; }
|
||||
case DeityRodcetNife: { return "Rodcet Nife"; }
|
||||
case DeitySolusekRo: { return "Solusek Ro"; }
|
||||
case DeityTheTribunal: { return "The Tribunal"; }
|
||||
case DeityTunare: { return "Tunare"; }
|
||||
case DeityVeeshan: { return "Veeshan"; }
|
||||
case DeityAgnostic_LB:
|
||||
case DeityAgnostic: { return "Agnostic"; }
|
||||
default: { break; }
|
||||
};
|
||||
|
||||
return "Unknown";
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
|
||||
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
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; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "emu_constants.h"
|
||||
@@ -1,158 +0,0 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
|
||||
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
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; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef COMMON_EMU_CONSTANTS_H
|
||||
#define COMMON_EMU_CONSTANTS_H
|
||||
|
||||
#include "eq_limits.h"
|
||||
#include "emu_legacy.h"
|
||||
#include "emu_versions.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace EQEmu
|
||||
{
|
||||
namespace inventory {
|
||||
//using namespace RoF2::invtype;
|
||||
//using namespace RoF2::invslot;
|
||||
//using namespace RoF2::invbag;
|
||||
//using namespace RoF2::invaug;
|
||||
|
||||
enum : int16 { typeInvalid = -1, slotInvalid = -1, containerInvalid = -1, socketInvalid = -1 }; // temporary
|
||||
enum : int16 { typeBegin = 0, slotBegin = 0, containerBegin = 0, socketBegin = 0 }; // temporary
|
||||
|
||||
enum PossessionsSlots : int16 { // temporary
|
||||
slotCharm = 0,
|
||||
slotEar1,
|
||||
slotHead,
|
||||
slotFace,
|
||||
slotEar2,
|
||||
slotNeck, // 5
|
||||
slotShoulders,
|
||||
slotArms,
|
||||
slotBack,
|
||||
slotWrist1,
|
||||
slotWrist2, // 10
|
||||
slotRange,
|
||||
slotHands,
|
||||
slotPrimary,
|
||||
slotSecondary,
|
||||
slotFinger1, // 15
|
||||
slotFinger2,
|
||||
slotChest,
|
||||
slotLegs,
|
||||
slotFeet,
|
||||
slotWaist, // 20
|
||||
slotPowerSource = 9999,
|
||||
slotAmmo = 21,
|
||||
slotGeneral1,
|
||||
slotGeneral2,
|
||||
slotGeneral3,
|
||||
slotGeneral4, // 25
|
||||
slotGeneral5,
|
||||
slotGeneral6,
|
||||
slotGeneral7,
|
||||
slotGeneral8,
|
||||
slotCursor, // 30
|
||||
slotCount
|
||||
};
|
||||
|
||||
enum InventoryTypes : int16 { // temporary
|
||||
typePossessions = 0,
|
||||
typeBank,
|
||||
typeSharedBank,
|
||||
typeTrade,
|
||||
typeWorld,
|
||||
typeLimbo, // 5
|
||||
typeTribute,
|
||||
typeTrophyTribute,
|
||||
typeGuildTribute,
|
||||
typeMerchant,
|
||||
typeDeleted, // 10
|
||||
typeCorpse,
|
||||
typeBazaar,
|
||||
typeInspect,
|
||||
typeRealEstate,
|
||||
typeViewMODPC, // 15
|
||||
typeViewMODBank,
|
||||
typeViewMODSharedBank,
|
||||
typeViewMODLimbo,
|
||||
typeAltStorage,
|
||||
typeArchived, // 20
|
||||
typeMail,
|
||||
typeGuildTrophyTribute,
|
||||
typeKrono,
|
||||
typeOther,
|
||||
typeCount
|
||||
};
|
||||
|
||||
static int16 SlotCount(int16 type_index) { return 0; } // temporary
|
||||
|
||||
const int16 ContainerCount = 10; // temporary
|
||||
const int16 SocketCount = 6; // temporary
|
||||
|
||||
} /*inventory*/
|
||||
|
||||
namespace constants {
|
||||
const EQEmu::versions::ClientVersion CharacterCreationClient = EQEmu::versions::ClientVersion::RoF2;
|
||||
const size_t CharacterCreationMax = RoF2::constants::CharacterCreationLimit;
|
||||
|
||||
const size_t SayLinkBodySize = RoF2::constants::SayLinkBodySize;
|
||||
|
||||
const int LongBuffs = RoF2::constants::LongBuffs;
|
||||
const int ShortBuffs = RoF2::constants::ShortBuffs;
|
||||
const int DiscBuffs = RoF2::constants::DiscBuffs;
|
||||
const int TotalBuffs = RoF2::constants::TotalBuffs;
|
||||
const int NPCBuffs = RoF2::constants::NPCBuffs;
|
||||
const int PetBuffs = RoF2::constants::PetBuffs;
|
||||
const int MercBuffs = RoF2::constants::MercBuffs;
|
||||
|
||||
} /*constants*/
|
||||
|
||||
enum class CastingSlot : uint32 {
|
||||
Gem1 = 0,
|
||||
Gem2 = 1,
|
||||
Gem3 = 2,
|
||||
Gem4 = 3,
|
||||
Gem5 = 4,
|
||||
Gem6 = 5,
|
||||
Gem7 = 6,
|
||||
Gem8 = 7,
|
||||
Gem9 = 8,
|
||||
Gem10 = 9,
|
||||
Gem11 = 10,
|
||||
Gem12 = 11,
|
||||
MaxGems = 12,
|
||||
Ability = 20, // HT/LoH for Tit
|
||||
PotionBelt = 21, // Tit uses a different slot for PB
|
||||
Item = 22,
|
||||
Discipline = 23,
|
||||
AltAbility = 0xFF
|
||||
};
|
||||
|
||||
} /*EQEmu*/
|
||||
|
||||
#endif /*COMMON_EMU_CONSTANTS_H*/
|
||||
|
||||
/* hack list to prevent circular references
|
||||
|
||||
eq_limits.h:EQEmu::inventory::LookupEntry::InventoryTypeSize[n];
|
||||
|
||||
*/
|
||||
@@ -1,20 +0,0 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
|
||||
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
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; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "emu_legacy.h"
|
||||
@@ -1,182 +0,0 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
|
||||
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
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; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef COMMON_EMU_LEGACY_H
|
||||
#define COMMON_EMU_LEGACY_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
namespace EQEmu
|
||||
{
|
||||
// this is for perl and other legacy systems
|
||||
namespace legacy {
|
||||
enum InventorySlot {
|
||||
SLOT_CHARM = 0,
|
||||
SLOT_EAR01 = 1,
|
||||
SLOT_HEAD = 2,
|
||||
SLOT_FACE = 3,
|
||||
SLOT_EAR02 = 4,
|
||||
SLOT_NECK = 5,
|
||||
SLOT_SHOULDER = 6,
|
||||
SLOT_ARMS = 7,
|
||||
SLOT_BACK = 8,
|
||||
SLOT_BRACER01 = 9,
|
||||
SLOT_BRACER02 = 10,
|
||||
SLOT_RANGE = 11,
|
||||
SLOT_HANDS = 12,
|
||||
SLOT_PRIMARY = 13,
|
||||
SLOT_SECONDARY = 14,
|
||||
SLOT_RING01 = 15,
|
||||
SLOT_RING02 = 16,
|
||||
SLOT_CHEST = 17,
|
||||
SLOT_LEGS = 18,
|
||||
SLOT_FEET = 19,
|
||||
SLOT_WAIST = 20,
|
||||
SLOT_POWER_SOURCE = 9999,
|
||||
SLOT_AMMO = 21,
|
||||
SLOT_GENERAL_1 = 22,
|
||||
SLOT_GENERAL_2 = 23,
|
||||
SLOT_GENERAL_3 = 24,
|
||||
SLOT_GENERAL_4 = 25,
|
||||
SLOT_GENERAL_5 = 26,
|
||||
SLOT_GENERAL_6 = 27,
|
||||
SLOT_GENERAL_7 = 28,
|
||||
SLOT_GENERAL_8 = 29,
|
||||
SLOT_CURSOR = 30,
|
||||
SLOT_CURSOR_END = (int16)0xFFFE, // I hope no one is using this...
|
||||
SLOT_TRADESKILL = 1000,
|
||||
SLOT_AUGMENT = 1001,
|
||||
SLOT_INVALID = (int16)0xFFFF,
|
||||
SLOT_POSSESSIONS_BEGIN = 0,
|
||||
SLOT_POSSESSIONS_END = 30,
|
||||
SLOT_EQUIPMENT_BEGIN = 0,
|
||||
SLOT_EQUIPMENT_END = 21,
|
||||
SLOT_PERSONAL_BEGIN = 22,
|
||||
SLOT_PERSONAL_END = 29,
|
||||
SLOT_PERSONAL_BAGS_BEGIN = 251,
|
||||
SLOT_PERSONAL_BAGS_END = 330,
|
||||
SLOT_CURSOR_BAG_BEGIN = 331,
|
||||
SLOT_CURSOR_BAG_END = 340,
|
||||
SLOT_TRIBUTE_BEGIN = 400,
|
||||
SLOT_TRIBUTE_END = 404,
|
||||
SLOT_BANK_BEGIN = 2000,
|
||||
SLOT_BANK_END = 2023,
|
||||
SLOT_BANK_BAGS_BEGIN = 2031,
|
||||
SLOT_BANK_BAGS_END = 2270,
|
||||
SLOT_SHARED_BANK_BEGIN = 2500,
|
||||
SLOT_SHARED_BANK_END = 2501,
|
||||
SLOT_SHARED_BANK_BAGS_BEGIN = 2531,
|
||||
SLOT_SHARED_BANK_BAGS_END = 2550,
|
||||
SLOT_TRADE_BEGIN = 3000,
|
||||
SLOT_TRADE_END = 3007,
|
||||
SLOT_TRADE_BAGS_BEGIN = 3031,
|
||||
SLOT_TRADE_BAGS_END = 3110,
|
||||
SLOT_WORLD_BEGIN = 4000,
|
||||
SLOT_WORLD_END = 4009
|
||||
};
|
||||
|
||||
// these are currently hard-coded for existing inventory system..do not use in place of special client version handlers until ready
|
||||
static const uint16 TYPE_POSSESSIONS_SIZE = 31;
|
||||
static const uint16 TYPE_BANK_SIZE = 24;
|
||||
static const uint16 TYPE_SHARED_BANK_SIZE = 2;
|
||||
static const uint16 TYPE_TRADE_SIZE = 8;
|
||||
static const uint16 TYPE_WORLD_SIZE = 10;
|
||||
static const uint16 TYPE_LIMBO_SIZE = 36;
|
||||
static const uint16 TYPE_TRIBUTE_SIZE = 5; // (need client values)
|
||||
static const uint16 TYPE_TROPHY_TRIBUTE_SIZE = 0;
|
||||
static const uint16 TYPE_GUILD_TRIBUTE_SIZE = 0;
|
||||
static const uint16 TYPE_MERCHANT_SIZE = 0;
|
||||
static const uint16 TYPE_DELETED_SIZE = 0;
|
||||
static const uint16 TYPE_CORPSE_SIZE = 31; // no bitmask use..limits to size of client corpse window (see EQLimits::InventoryMapSize(MapCorpse, <EQClientVersion))
|
||||
static const uint16 TYPE_BAZAAR_SIZE = 80;
|
||||
static const uint16 TYPE_INSPECT_SIZE = 22;
|
||||
static const uint16 TYPE_REAL_ESTATE_SIZE = 0;
|
||||
static const uint16 TYPE_VIEW_MOD_PC_SIZE = 0;
|
||||
static const uint16 TYPE_VIEW_MOD_BANK_SIZE = 0;
|
||||
static const uint16 TYPE_VIEW_MOD_SHARED_BANK_SIZE = 0;
|
||||
static const uint16 TYPE_VIEW_MOD_LIMBO_SIZE = 0;
|
||||
static const uint16 TYPE_ALT_STORAGE_SIZE = 0;
|
||||
static const uint16 TYPE_ARCHIVED_SIZE = 0;
|
||||
static const uint16 TYPE_MAIL_SIZE = 0;
|
||||
static const uint16 TYPE_GUILD_TROPHY_TRIBUTE_SIZE = 0;
|
||||
static const uint16 TYPE_KRONO_SIZE = 0;
|
||||
static const uint16 TYPE_OTHER_SIZE = 0;
|
||||
|
||||
// most of these definitions will go away with the structure-based system..this maintains compatibility for now
|
||||
// (these are mainly to assign specific values to constants used in conversions and to identify per-client ranges/offsets)
|
||||
static const int16 EQUIPMENT_BEGIN = 0;
|
||||
static const int16 EQUIPMENT_END = 21;
|
||||
static const uint16 EQUIPMENT_SIZE = 22; // does not account for 'Power Source' - used mainly for npc equipment arrays
|
||||
|
||||
static const int16 GENERAL_BEGIN = 22;
|
||||
static const int16 GENERAL_END = 29;
|
||||
static const uint16 GENERAL_SIZE = 8;
|
||||
static const int16 GENERAL_BAGS_BEGIN = 251;
|
||||
static const int16 GENERAL_BAGS_END_OFFSET = 79;
|
||||
static const int16 GENERAL_BAGS_END = GENERAL_BAGS_BEGIN + GENERAL_BAGS_END_OFFSET;
|
||||
|
||||
static const int16 CURSOR_BAG_BEGIN = 331;
|
||||
static const int16 CURSOR_BAG_END_OFFSET = 9;
|
||||
static const int16 CURSOR_BAG_END = CURSOR_BAG_BEGIN + CURSOR_BAG_END_OFFSET;
|
||||
|
||||
static const int16 BANK_BEGIN = 2000;
|
||||
static const int16 BANK_END = 2023;
|
||||
static const int16 BANK_BAGS_BEGIN = 2031;
|
||||
static const int16 BANK_BAGS_END_OFFSET = 239;
|
||||
static const int16 BANK_BAGS_END = BANK_BAGS_BEGIN + BANK_BAGS_END_OFFSET;
|
||||
|
||||
static const int16 SHARED_BANK_BEGIN = 2500;
|
||||
static const int16 SHARED_BANK_END = 2501;
|
||||
static const int16 SHARED_BANK_BAGS_BEGIN = 2531;
|
||||
static const int16 SHARED_BANK_BAGS_END_OFFSET = 19;
|
||||
static const int16 SHARED_BANK_BAGS_END = SHARED_BANK_BAGS_BEGIN + SHARED_BANK_BAGS_END_OFFSET;
|
||||
|
||||
static const int16 TRADE_BEGIN = 3000;
|
||||
static const int16 TRADE_END = 3007;
|
||||
static const int16 TRADE_NPC_END = 3003;
|
||||
static const int16 TRADE_BAGS_BEGIN = 3031;
|
||||
static const int16 TRADE_BAGS_END_OFFSET = 79;
|
||||
static const int16 TRADE_BAGS_END = TRADE_BAGS_BEGIN + TRADE_BAGS_END_OFFSET;
|
||||
|
||||
static const int16 WORLD_BEGIN = 4000;
|
||||
static const int16 WORLD_END = 4009;
|
||||
static const int16 WORLD_SIZE = TYPE_WORLD_SIZE;
|
||||
|
||||
static const int16 TRIBUTE_BEGIN = 400;
|
||||
static const int16 TRIBUTE_END = 404;
|
||||
static const int16 TRIBUTE_SIZE = TYPE_TRIBUTE_SIZE;
|
||||
|
||||
static const int16 CORPSE_BEGIN = 22;
|
||||
|
||||
// BANDOLIERS_SIZE sets maximum limit..active limit will need to be handled by the appropriate AA or spell (or item?)
|
||||
static const size_t BANDOLIERS_SIZE = 20; // number of bandolier instances
|
||||
static const size_t BANDOLIER_ITEM_COUNT = 4; // number of equipment slots in bandolier instance
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif /* COMMON_EMU_LEGACY_H */
|
||||
@@ -1,18 +0,0 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
|
||||
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
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; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
@@ -1,104 +0,0 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
|
||||
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
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; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef COMMON_EMU_LIMITS_H
|
||||
#define COMMON_EMU_LIMITS_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
namespace EntityLimits
|
||||
{
|
||||
namespace NPC {
|
||||
enum : int { Invalid = -1, Null, Safety };
|
||||
|
||||
enum : bool { False = false, True = true };
|
||||
|
||||
const size_t InvTypeTradeSize = 4;
|
||||
|
||||
} /*NPC*/
|
||||
|
||||
namespace NPCMerchant {
|
||||
enum : int { Invalid = -1, Null, Safety };
|
||||
|
||||
enum : bool { False = false, True = true };
|
||||
|
||||
const size_t InvTypeTradeSize = 4;
|
||||
|
||||
} /*NPCMerchant*/
|
||||
|
||||
namespace Merc {
|
||||
enum : int { Invalid = -1, Null, Safety };
|
||||
|
||||
enum : bool { False = false, True = true };
|
||||
|
||||
const size_t InvTypeTradeSize = 4;
|
||||
|
||||
} /*Merc*/
|
||||
|
||||
namespace Bot {
|
||||
enum : int { Invalid = -1, Null, Safety };
|
||||
|
||||
enum : bool { False = false, True = true };
|
||||
|
||||
const size_t InvTypeTradeSize = 8;
|
||||
|
||||
} /*Bot*/
|
||||
|
||||
namespace ClientPet {
|
||||
enum : int { Invalid = -1, Null, Safety };
|
||||
|
||||
enum : bool { False = false, True = true };
|
||||
|
||||
const size_t InvTypeTradeSize = 4;
|
||||
|
||||
} /*Pet*/
|
||||
|
||||
namespace NPCPet {
|
||||
enum : int { Invalid = -1, Null, Safety };
|
||||
|
||||
enum : bool { False = false, True = true };
|
||||
|
||||
const size_t InvTypeTradeSize = 4;
|
||||
|
||||
} /*Pet*/
|
||||
|
||||
namespace MercPet {
|
||||
enum : int { Invalid = -1, Null, Safety };
|
||||
|
||||
enum : bool { False = false, True = true };
|
||||
|
||||
const size_t InvTypeTradeSize = 4;
|
||||
|
||||
} /*Pet*/
|
||||
|
||||
namespace BotPet {
|
||||
enum : int { Invalid = -1, Null, Safety };
|
||||
|
||||
enum : bool { False = false, True = true };
|
||||
|
||||
const size_t InvTypeTradeSize = 4;
|
||||
|
||||
} /*Pet*/
|
||||
|
||||
}; /*EntityLimits*/
|
||||
|
||||
#endif /*COMMON_EMU_LIMITS_H*/
|
||||
@@ -16,7 +16,7 @@
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 04111-1307 USA
|
||||
*/
|
||||
|
||||
#include "global_define.h"
|
||||
#include "debug.h"
|
||||
#include "emu_opcodes.h"
|
||||
|
||||
const char *OpcodeNames[_maxEmuOpcode+1] = {
|
||||
|
||||
+2
-16
@@ -25,9 +25,6 @@ N(OP_AdventureRequest),
|
||||
N(OP_AdventureStatsReply),
|
||||
N(OP_AdventureStatsRequest),
|
||||
N(OP_AdventureUpdate),
|
||||
N(OP_AggroMeterLockTarget),
|
||||
N(OP_AggroMeterTargetInfo),
|
||||
N(OP_AggroMeterUpdate),
|
||||
N(OP_AltCurrency),
|
||||
N(OP_AltCurrencyMerchantReply),
|
||||
N(OP_AltCurrencyMerchantRequest),
|
||||
@@ -67,7 +64,6 @@ N(OP_BuffRemoveRequest),
|
||||
N(OP_Bug),
|
||||
N(OP_CameraEffect),
|
||||
N(OP_Camp),
|
||||
N(OP_CancelSneakHide),
|
||||
N(OP_CancelTask),
|
||||
N(OP_CancelTrade),
|
||||
N(OP_CastSpell),
|
||||
@@ -78,9 +74,7 @@ N(OP_CharacterCreateRequest),
|
||||
N(OP_CharInventory),
|
||||
N(OP_Charm),
|
||||
N(OP_ChatMessage),
|
||||
N(OP_ClearAA),
|
||||
N(OP_ClearBlockedBuffs),
|
||||
N(OP_ClearLeadershipAbilities),
|
||||
N(OP_ClearNPCMarks),
|
||||
N(OP_ClearObject),
|
||||
N(OP_ClearSurname),
|
||||
@@ -168,7 +162,6 @@ N(OP_FinishTrade),
|
||||
N(OP_FinishWindow),
|
||||
N(OP_FinishWindow2),
|
||||
N(OP_Fishing),
|
||||
N(OP_Fling),
|
||||
N(OP_FloatListThing),
|
||||
N(OP_Forage),
|
||||
N(OP_ForceFindPerson),
|
||||
@@ -220,7 +213,6 @@ N(OP_GroupUpdate),
|
||||
N(OP_GroupUpdateB),
|
||||
N(OP_GroupUpdateLeaderAA),
|
||||
N(OP_GuildBank),
|
||||
N(OP_GuildBankItemList),
|
||||
N(OP_GuildCreate),
|
||||
N(OP_GuildDelete),
|
||||
N(OP_GuildDemote),
|
||||
@@ -292,7 +284,6 @@ N(OP_LFGuild),
|
||||
N(OP_LFPCommand),
|
||||
N(OP_LFPGetMatchesRequest),
|
||||
N(OP_LFPGetMatchesResponse),
|
||||
N(OP_LinkedReuse),
|
||||
N(OP_LoadSpellSet),
|
||||
N(OP_LocInfo),
|
||||
N(OP_LockoutTimerInfo),
|
||||
@@ -355,8 +346,6 @@ N(OP_OpenTributeMaster),
|
||||
N(OP_PDeletePetition),
|
||||
N(OP_PetBuffWindow),
|
||||
N(OP_PetCommands),
|
||||
N(OP_PetCommandState),
|
||||
N(OP_PetHoTT),
|
||||
N(OP_Petition),
|
||||
N(OP_PetitionBug),
|
||||
N(OP_PetitionCheckIn),
|
||||
@@ -373,8 +362,6 @@ N(OP_PetitionUnCheckout),
|
||||
N(OP_PetitionUpdate),
|
||||
N(OP_PickPocket),
|
||||
N(OP_PlayerProfile),
|
||||
N(OP_PlayerStateAdd),
|
||||
N(OP_PlayerStateRemove),
|
||||
N(OP_PlayEverquestRequest),
|
||||
N(OP_PlayEverquestResponse),
|
||||
N(OP_PlayMP3),
|
||||
@@ -530,6 +517,8 @@ N(OP_VetRewardsAvaliable),
|
||||
N(OP_VoiceMacroIn),
|
||||
N(OP_VoiceMacroOut),
|
||||
N(OP_WeaponEquip1),
|
||||
N(OP_WeaponEquip2),
|
||||
N(OP_WeaponUnequip2),
|
||||
N(OP_WearChange),
|
||||
N(OP_Weather),
|
||||
N(OP_Weblink),
|
||||
@@ -543,8 +532,6 @@ N(OP_WorldLogout),
|
||||
N(OP_WorldObjectsSent),
|
||||
N(OP_WorldUnknown001),
|
||||
N(OP_XTargetAutoAddHaters),
|
||||
N(OP_XTargetOpen),
|
||||
N(OP_XTargetOpenResponse),
|
||||
N(OP_XTargetRequest),
|
||||
N(OP_XTargetResponse),
|
||||
N(OP_YellForHelp),
|
||||
@@ -558,5 +545,4 @@ N(OP_ZoneServerInfo),
|
||||
N(OP_ZoneServerReady),
|
||||
N(OP_ZoneSpawns),
|
||||
N(OP_ZoneUnavail),
|
||||
N(OP_ResetAA),
|
||||
// mail and chat opcodes located in ../mail_oplist.h
|
||||
|
||||
@@ -0,0 +1,820 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
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; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/*
|
||||
There are really two or three different objects shoe-hored into this
|
||||
connection object. Sombody really needs to factor out the relay link
|
||||
crap into its own subclass of this object, it will clean things up
|
||||
tremendously.
|
||||
*/
|
||||
|
||||
#include "../common/debug.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <iomanip>
|
||||
|
||||
#include "emu_tcp_connection.h"
|
||||
#include "emu_tcp_server.h"
|
||||
#include "../common/servertalk.h"
|
||||
#include "../common/packet_dump.h"
|
||||
|
||||
#ifdef FREEBSD //Timothy Whitman - January 7, 2003
|
||||
#define MSG_NOSIGNAL 0
|
||||
#endif
|
||||
|
||||
#define TCPN_DEBUG 0
|
||||
#define TCPN_DEBUG_Console 0
|
||||
#define TCPN_DEBUG_Memory 0
|
||||
#define TCPN_LOG_PACKETS 0
|
||||
#define TCPN_LOG_RAW_DATA_OUT 0
|
||||
#define TCPN_LOG_RAW_DATA_IN 0
|
||||
|
||||
|
||||
//server side case
|
||||
EmuTCPConnection::EmuTCPConnection(uint32 ID, EmuTCPServer* iServer, SOCKET in_socket, uint32 irIP, uint16 irPort, bool iOldFormat)
|
||||
: TCPConnection(ID, in_socket, irIP, irPort),
|
||||
keepalive_timer(SERVER_TIMEOUT),
|
||||
timeout_timer(SERVER_TIMEOUT * 2)
|
||||
{
|
||||
id = 0;
|
||||
Server = nullptr;
|
||||
pOldFormat = iOldFormat;
|
||||
#ifdef MINILOGIN
|
||||
TCPMode = modePacket;
|
||||
PacketMode = packetModeLogin;
|
||||
#else
|
||||
if (pOldFormat)
|
||||
TCPMode = modePacket;
|
||||
else
|
||||
TCPMode = modeConsole;
|
||||
PacketMode = packetModeZone;
|
||||
#endif
|
||||
RelayLink = 0;
|
||||
RelayServer = false;
|
||||
RelayCount = 0;
|
||||
RemoteID = 0;
|
||||
|
||||
}
|
||||
|
||||
//client outgoing connection case (and client side relay)
|
||||
EmuTCPConnection::EmuTCPConnection(bool iOldFormat, EmuTCPServer* iRelayServer, eTCPMode iMode)
|
||||
: TCPConnection(),
|
||||
keepalive_timer(SERVER_TIMEOUT),
|
||||
timeout_timer(SERVER_TIMEOUT * 2)
|
||||
{
|
||||
Server = iRelayServer;
|
||||
if (Server)
|
||||
RelayServer = true;
|
||||
else
|
||||
RelayServer = false;
|
||||
RelayLink = 0;
|
||||
RelayCount = 0;
|
||||
RemoteID = 0;
|
||||
pOldFormat = iOldFormat;
|
||||
TCPMode = iMode;
|
||||
PacketMode = packetModeZone;
|
||||
#if TCPN_DEBUG_Memory >= 7
|
||||
std::cout << "Constructor #1 on outgoing TCP# " << GetID() << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
//server side relay case
|
||||
EmuTCPConnection::EmuTCPConnection(uint32 ID, EmuTCPServer* iServer, EmuTCPConnection* iRelayLink, uint32 iRemoteID, uint32 irIP, uint16 irPort)
|
||||
: TCPConnection(ID, 0, irIP, irPort),
|
||||
keepalive_timer(SERVER_TIMEOUT),
|
||||
timeout_timer(SERVER_TIMEOUT * 2)
|
||||
{
|
||||
Server = iServer;
|
||||
RelayLink = iRelayLink;
|
||||
RelayServer = true;
|
||||
RelayCount = 0;
|
||||
RemoteID = iRemoteID;
|
||||
pOldFormat = false;
|
||||
ConnectionType = Incomming;
|
||||
TCPMode = modePacket;
|
||||
PacketMode = packetModeZone;
|
||||
#if TCPN_DEBUG_Memory >= 7
|
||||
std::cout << "Constructor #3 on outgoing TCP# " << GetID() << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
EmuTCPConnection::~EmuTCPConnection() {
|
||||
//the queues free their content right now I believe.
|
||||
}
|
||||
|
||||
EmuTCPNetPacket_Struct* EmuTCPConnection::MakePacket(ServerPacket* pack, uint32 iDestination) {
|
||||
int32 size = sizeof(EmuTCPNetPacket_Struct) + pack->size;
|
||||
if (pack->compressed) {
|
||||
size += 4;
|
||||
}
|
||||
if (iDestination) {
|
||||
size += 4;
|
||||
}
|
||||
EmuTCPNetPacket_Struct* tnps = (EmuTCPNetPacket_Struct*) new uchar[size];
|
||||
tnps->size = size;
|
||||
tnps->opcode = pack->opcode;
|
||||
*((uint8*) &tnps->flags) = 0;
|
||||
uchar* buffer = tnps->buffer;
|
||||
if (pack->compressed) {
|
||||
tnps->flags.compressed = 1;
|
||||
*((int32*) buffer) = pack->InflatedSize;
|
||||
buffer += 4;
|
||||
}
|
||||
if (iDestination) {
|
||||
tnps->flags.destination = 1;
|
||||
*((int32*) buffer) = iDestination;
|
||||
buffer += 4;
|
||||
}
|
||||
memcpy(buffer, pack->pBuffer, pack->size);
|
||||
return tnps;
|
||||
}
|
||||
|
||||
SPackSendQueue* EmuTCPConnection::MakeOldPacket(ServerPacket* pack) {
|
||||
SPackSendQueue* spsq = (SPackSendQueue*) new uchar[sizeof(SPackSendQueue) + pack->size + 4];
|
||||
if (pack->pBuffer != 0 && pack->size != 0)
|
||||
memcpy((char *) &spsq->buffer[4], (char *) pack->pBuffer, pack->size);
|
||||
memcpy((char *) &spsq->buffer[0], (char *) &pack->opcode, 2);
|
||||
spsq->size = pack->size+4;
|
||||
memcpy((char *) &spsq->buffer[2], (char *) &spsq->size, 2);
|
||||
return spsq;
|
||||
}
|
||||
|
||||
bool EmuTCPConnection::SendPacket(ServerPacket* pack, uint32 iDestination) {
|
||||
if (!Connected())
|
||||
return false;
|
||||
eTCPMode tmp = GetMode();
|
||||
if (tmp != modePacket && tmp != modeTransition)
|
||||
return false;
|
||||
LockMutex lock(&MState);
|
||||
if (RemoteID)
|
||||
return RelayLink->SendPacket(pack, RemoteID);
|
||||
else if (pOldFormat) {
|
||||
#if TCPN_LOG_PACKETS >= 1
|
||||
if (pack && pack->opcode != 0) {
|
||||
struct in_addr in;
|
||||
in.s_addr = GetrIP();
|
||||
CoutTimestamp(true);
|
||||
std::cout << ": Logging outgoing TCP OldPacket. OPCode: 0x" << std::hex << std::setw(4) << std::setfill('0') << pack->opcode << std::dec << ", size: " << std::setw(5) << std::setfill(' ') << pack->size << " " << inet_ntoa(in) << ":" << GetrPort() << std::endl;
|
||||
#if TCPN_LOG_PACKETS == 2
|
||||
if (pack->size >= 32)
|
||||
DumpPacket(pack->pBuffer, 32);
|
||||
else
|
||||
DumpPacket(pack);
|
||||
#endif
|
||||
#if TCPN_LOG_PACKETS >= 3
|
||||
DumpPacket(pack);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
SPackSendQueue* spsq = MakeOldPacket(pack);
|
||||
ServerSendQueuePushEnd(spsq->buffer, spsq->size);
|
||||
safe_delete_array(spsq);
|
||||
}
|
||||
else {
|
||||
EmuTCPNetPacket_Struct* tnps = MakePacket(pack, iDestination);
|
||||
if (tmp == modeTransition) {
|
||||
InModeQueuePush(tnps);
|
||||
}
|
||||
else {
|
||||
#if TCPN_LOG_PACKETS >= 1
|
||||
if (pack && pack->opcode != 0) {
|
||||
struct in_addr in;
|
||||
in.s_addr = GetrIP();
|
||||
CoutTimestamp(true);
|
||||
std::cout << ": Logging outgoing TCP packet. OPCode: 0x" << std::hex << std::setw(4) << std::setfill('0') << pack->opcode << std::dec << ", size: " << std::setw(5) << std::setfill(' ') << pack->size << " " << inet_ntoa(in) << ":" << GetrPort() << std::endl;
|
||||
#if TCPN_LOG_PACKETS == 2
|
||||
if (pack->size >= 32)
|
||||
DumpPacket(pack->pBuffer, 32);
|
||||
else
|
||||
DumpPacket(pack);
|
||||
#endif
|
||||
#if TCPN_LOG_PACKETS >= 3
|
||||
DumpPacket(pack);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
ServerSendQueuePushEnd((uchar**) &tnps, tnps->size);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EmuTCPConnection::SendPacket(EmuTCPNetPacket_Struct* tnps) {
|
||||
if (RemoteID)
|
||||
return false;
|
||||
if (!Connected())
|
||||
return false;
|
||||
if (GetMode() != modePacket)
|
||||
return false;
|
||||
|
||||
LockMutex lock(&MState);
|
||||
eTCPMode tmp = GetMode();
|
||||
if (tmp == modeTransition) {
|
||||
EmuTCPNetPacket_Struct* tnps2 = (EmuTCPNetPacket_Struct*) new uchar[tnps->size];
|
||||
memcpy(tnps2, tnps, tnps->size);
|
||||
InModeQueuePush(tnps2);
|
||||
return true;
|
||||
}
|
||||
#if TCPN_LOG_PACKETS >= 1
|
||||
if (tnps && tnps->opcode != 0) {
|
||||
struct in_addr in;
|
||||
in.s_addr = GetrIP();
|
||||
CoutTimestamp(true);
|
||||
std::cout << ": Logging outgoing TCP NetPacket. OPCode: 0x" << std::hex << std::setw(4) << std::setfill('0') << tnps->opcode << std::dec << ", size: " << std::setw(5) << std::setfill(' ') << tnps->size << " " << inet_ntoa(in) << ":" << GetrPort();
|
||||
if (pOldFormat)
|
||||
std::cout << " (OldFormat)";
|
||||
std::cout << std::endl;
|
||||
#if TCPN_LOG_PACKETS == 2
|
||||
if (tnps->size >= 32)
|
||||
DumpPacket((uchar*) tnps, 32);
|
||||
else
|
||||
DumpPacket((uchar*) tnps, tnps->size);
|
||||
#endif
|
||||
#if TCPN_LOG_PACKETS >= 3
|
||||
DumpPacket((uchar*) tnps, tnps->size);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
ServerSendQueuePushEnd((const uchar*) tnps, tnps->size);
|
||||
return true;
|
||||
}
|
||||
|
||||
ServerPacket* EmuTCPConnection::PopPacket() {
|
||||
ServerPacket* ret;
|
||||
if (!MOutQueueLock.trylock())
|
||||
return nullptr;
|
||||
ret = OutQueue.pop();
|
||||
MOutQueueLock.unlock();
|
||||
return ret;
|
||||
}
|
||||
|
||||
void EmuTCPConnection::InModeQueuePush(EmuTCPNetPacket_Struct* tnps) {
|
||||
MSendQueue.lock();
|
||||
InModeQueue.push(tnps);
|
||||
MSendQueue.unlock();
|
||||
}
|
||||
|
||||
void EmuTCPConnection::OutQueuePush(ServerPacket* pack) {
|
||||
MOutQueueLock.lock();
|
||||
OutQueue.push(pack);
|
||||
MOutQueueLock.unlock();
|
||||
}
|
||||
|
||||
|
||||
bool EmuTCPConnection::LineOutQueuePush(char* line) {
|
||||
#if defined(GOTFRAGS) && 0
|
||||
if (strcmp(line, "**CRASHME**") == 0) {
|
||||
int i = 0;
|
||||
std::cout << (5 / i) << std::endl;
|
||||
}
|
||||
#endif
|
||||
if(line[0] == '*') {
|
||||
if (strcmp(line, "**PACKETMODE**") == 0) {
|
||||
MSendQueue.lock();
|
||||
safe_delete_array(sendbuf);
|
||||
if (TCPMode == modeConsole)
|
||||
Send((const uchar*) "\0**PACKETMODE**\r", 16);
|
||||
TCPMode = modePacket;
|
||||
PacketMode = packetModeLogin;
|
||||
EmuTCPNetPacket_Struct* tnps = 0;
|
||||
while ((tnps = InModeQueue.pop())) {
|
||||
SendPacket(tnps);
|
||||
safe_delete_array(tnps);
|
||||
}
|
||||
MSendQueue.unlock();
|
||||
safe_delete_array(line);
|
||||
return(true);
|
||||
}
|
||||
if (strcmp(line, "**PACKETMODEZONE**") == 0) {
|
||||
MSendQueue.lock();
|
||||
safe_delete_array(sendbuf);
|
||||
if (TCPMode == modeConsole)
|
||||
Send((const uchar*) "\0**PACKETMODEZONE**\r", 20);
|
||||
TCPMode = modePacket;
|
||||
PacketMode = packetModeZone;
|
||||
EmuTCPNetPacket_Struct* tnps = 0;
|
||||
while ((tnps = InModeQueue.pop())) {
|
||||
SendPacket(tnps);
|
||||
safe_delete_array(tnps);
|
||||
}
|
||||
MSendQueue.unlock();
|
||||
safe_delete_array(line);
|
||||
return(true);
|
||||
}
|
||||
if (strcmp(line, "**PACKETMODELAUNCHER**") == 0) {
|
||||
MSendQueue.lock();
|
||||
safe_delete_array(sendbuf);
|
||||
if (TCPMode == modeConsole)
|
||||
Send((const uchar*) "\0**PACKETMODELAUNCHER**\r", 24);
|
||||
TCPMode = modePacket;
|
||||
PacketMode = packetModeLauncher;
|
||||
EmuTCPNetPacket_Struct* tnps = 0;
|
||||
while ((tnps = InModeQueue.pop())) {
|
||||
SendPacket(tnps);
|
||||
safe_delete_array(tnps);
|
||||
}
|
||||
MSendQueue.unlock();
|
||||
safe_delete_array(line);
|
||||
return(true);
|
||||
}
|
||||
if (strcmp(line, "**PACKETMODEUCS**") == 0) {
|
||||
MSendQueue.lock();
|
||||
safe_delete_array(sendbuf);
|
||||
if (TCPMode == modeConsole)
|
||||
Send((const uchar*) "\0**PACKETMODEUCS**\r", 19);
|
||||
TCPMode = modePacket;
|
||||
PacketMode = packetModeUCS;
|
||||
EmuTCPNetPacket_Struct* tnps = 0;
|
||||
while ((tnps = InModeQueue.pop())) {
|
||||
SendPacket(tnps);
|
||||
safe_delete_array(tnps);
|
||||
}
|
||||
MSendQueue.unlock();
|
||||
safe_delete_array(line);
|
||||
return(true);
|
||||
}
|
||||
if (strcmp(line, "**PACKETMODEQS**") == 0) {
|
||||
MSendQueue.lock();
|
||||
safe_delete_array(sendbuf);
|
||||
if (TCPMode == modeConsole)
|
||||
Send((const uchar*) "\0**PACKETMODEQS**\r", 18);
|
||||
TCPMode = modePacket;
|
||||
PacketMode = packetModeQueryServ;
|
||||
EmuTCPNetPacket_Struct* tnps = 0;
|
||||
while ((tnps = InModeQueue.pop())) {
|
||||
SendPacket(tnps);
|
||||
safe_delete_array(tnps);
|
||||
}
|
||||
MSendQueue.unlock();
|
||||
safe_delete_array(line);
|
||||
return(true);
|
||||
}
|
||||
}
|
||||
|
||||
return(TCPConnection::LineOutQueuePush(line));
|
||||
}
|
||||
|
||||
void EmuTCPConnection::Disconnect(bool iSendRelayDisconnect) {
|
||||
TCPConnection::Disconnect();
|
||||
|
||||
if (RelayLink) {
|
||||
RelayLink->RemoveRelay(this, iSendRelayDisconnect);
|
||||
RelayLink = 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool EmuTCPConnection::ConnectIP(uint32 irIP, uint16 irPort, char* errbuf) {
|
||||
if(!TCPConnection::ConnectIP(irIP, irPort, errbuf))
|
||||
return(false);
|
||||
|
||||
MSendQueue.lock();
|
||||
#ifdef MINILOGIN
|
||||
TCPMode = modePacket;
|
||||
#else
|
||||
if (pOldFormat) {
|
||||
TCPMode = modePacket;
|
||||
}
|
||||
else if (TCPMode == modePacket || TCPMode == modeTransition) {
|
||||
TCPMode = modeTransition;
|
||||
if(PacketMode == packetModeLauncher) {
|
||||
safe_delete_array(sendbuf);
|
||||
sendbuf_size = 24;
|
||||
sendbuf_used = sendbuf_size;
|
||||
sendbuf = new uchar[sendbuf_size];
|
||||
memcpy(sendbuf, "\0**PACKETMODELAUNCHER**\r", sendbuf_size);
|
||||
} else if(PacketMode == packetModeLogin) {
|
||||
safe_delete_array(sendbuf);
|
||||
sendbuf_size = 16;
|
||||
sendbuf_used = sendbuf_size;
|
||||
sendbuf = new uchar[sendbuf_size];
|
||||
memcpy(sendbuf, "\0**PACKETMODE**\r", sendbuf_size);
|
||||
} else if(PacketMode == packetModeUCS) {
|
||||
safe_delete_array(sendbuf);
|
||||
sendbuf_size = 19;
|
||||
sendbuf_used = sendbuf_size;
|
||||
sendbuf = new uchar[sendbuf_size];
|
||||
memcpy(sendbuf, "\0**PACKETMODEUCS**\r", sendbuf_size);
|
||||
}
|
||||
else if(PacketMode == packetModeQueryServ) {
|
||||
safe_delete_array(sendbuf);
|
||||
sendbuf_size = 18;
|
||||
sendbuf_used = sendbuf_size;
|
||||
sendbuf = new uchar[sendbuf_size];
|
||||
memcpy(sendbuf, "\0**PACKETMODEQS**\r", sendbuf_size);
|
||||
}
|
||||
else {
|
||||
//default: packetModeZone
|
||||
safe_delete_array(sendbuf);
|
||||
sendbuf_size = 20;
|
||||
sendbuf_used = sendbuf_size;
|
||||
sendbuf = new uchar[sendbuf_size];
|
||||
memcpy(sendbuf, "\0**PACKETMODEZONE**\r", sendbuf_size);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
MSendQueue.unlock();
|
||||
|
||||
return(true);
|
||||
}
|
||||
|
||||
void EmuTCPConnection::ClearBuffers() {
|
||||
TCPConnection::ClearBuffers();
|
||||
|
||||
LockMutex lock2(&MOutQueueLock);
|
||||
ServerPacket* pack = 0;
|
||||
while ((pack = OutQueue.pop()))
|
||||
safe_delete(pack);
|
||||
|
||||
EmuTCPNetPacket_Struct* tnps = 0;
|
||||
while ((tnps = InModeQueue.pop()))
|
||||
safe_delete(tnps);
|
||||
|
||||
keepalive_timer.Start();
|
||||
timeout_timer.Start();
|
||||
}
|
||||
|
||||
void EmuTCPConnection::SendNetErrorPacket(const char* reason) {
|
||||
#if TCPC_DEBUG >= 1
|
||||
struct in_addr in;
|
||||
in.s_addr = GetrIP();
|
||||
std::cout "NetError: '";
|
||||
if (reason)
|
||||
std::cout << reason;
|
||||
std::cout << "': " << inet_ntoa(in) << ":" << GetPort() << std::endl;
|
||||
#endif
|
||||
ServerPacket* pack = new ServerPacket(0);
|
||||
pack->size = 1;
|
||||
if (reason)
|
||||
pack->size += strlen(reason) + 1;
|
||||
pack->pBuffer = new uchar[pack->size];
|
||||
memset(pack->pBuffer, 0, pack->size);
|
||||
pack->pBuffer[0] = 255;
|
||||
strcpy((char*) &pack->pBuffer[1], reason);
|
||||
SendPacket(pack);
|
||||
safe_delete(pack);
|
||||
}
|
||||
|
||||
void EmuTCPConnection::RemoveRelay(EmuTCPConnection* relay, bool iSendRelayDisconnect) {
|
||||
if (iSendRelayDisconnect) {
|
||||
ServerPacket* pack = new ServerPacket(0, 5);
|
||||
pack->pBuffer[0] = 3;
|
||||
*((uint32*) &pack->pBuffer[1]) = relay->GetRemoteID();
|
||||
SendPacket(pack);
|
||||
safe_delete(pack);
|
||||
}
|
||||
RelayCount--;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool EmuTCPConnection::ProcessReceivedData(char* errbuf) {
|
||||
if (errbuf)
|
||||
errbuf[0] = 0;
|
||||
timeout_timer.Start();
|
||||
if (!recvbuf)
|
||||
return true;
|
||||
if (TCPMode == modePacket) {
|
||||
if (pOldFormat)
|
||||
return ProcessReceivedDataAsOldPackets(errbuf);
|
||||
else
|
||||
return ProcessReceivedDataAsPackets(errbuf);
|
||||
}
|
||||
//else, use the base class's text processing.
|
||||
bool ret = TCPConnection::ProcessReceivedData(errbuf);
|
||||
//see if we made the transition to packet mode...
|
||||
if(ret && TCPMode == modePacket) {
|
||||
return ProcessReceivedDataAsPackets(errbuf);
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool EmuTCPConnection::ProcessReceivedDataAsPackets(char* errbuf) {
|
||||
if (errbuf)
|
||||
errbuf[0] = 0;
|
||||
int32 base = 0;
|
||||
int32 size = 7;
|
||||
uchar* buffer;
|
||||
ServerPacket* pack = 0;
|
||||
while ((recvbuf_used - base) >= size) {
|
||||
EmuTCPNetPacket_Struct* tnps = (EmuTCPNetPacket_Struct*) &recvbuf[base];
|
||||
buffer = tnps->buffer;
|
||||
size = tnps->size;
|
||||
if (size >= MaxTCPReceiveBuffferSize) {
|
||||
#if TCPN_DEBUG_Memory >= 1
|
||||
std::cout << "TCPConnection[" << GetID() << "]::ProcessReceivedDataAsPackets(): size[" << size << "] >= MaxTCPReceiveBuffferSize" << std::endl;
|
||||
DumpPacket(&recvbuf[base], 16);
|
||||
#endif
|
||||
if (errbuf)
|
||||
snprintf(errbuf, TCPConnection_ErrorBufferSize, "EmuTCPConnection::ProcessReceivedDataAsPackets(): size >= MaxTCPReceiveBuffferSize");
|
||||
return false;
|
||||
}
|
||||
if ((recvbuf_used - base) >= size) {
|
||||
// ok, we got enough data to make this packet!
|
||||
pack = new ServerPacket;
|
||||
pack->size = size - sizeof(EmuTCPNetPacket_Struct);
|
||||
// read headers
|
||||
pack->opcode = tnps->opcode;
|
||||
if (tnps->flags.compressed) {
|
||||
pack->compressed = true;
|
||||
pack->InflatedSize = *((int32*)buffer);
|
||||
pack->size -= 4;
|
||||
buffer += 4;
|
||||
}
|
||||
if (tnps->flags.destination) {
|
||||
pack->destination = *((int32*)buffer);
|
||||
pack->size -= 4;
|
||||
buffer += 4;
|
||||
}
|
||||
// end read headers
|
||||
if (pack->size > 0) {
|
||||
if (tnps->flags.compressed) {
|
||||
// Lets decompress the packet here
|
||||
pack->compressed = false;
|
||||
pack->pBuffer = new uchar[pack->InflatedSize];
|
||||
pack->size = InflatePacket(buffer, pack->size, pack->pBuffer, pack->InflatedSize);
|
||||
}
|
||||
else {
|
||||
pack->pBuffer = new uchar[pack->size];
|
||||
memcpy(pack->pBuffer, buffer, pack->size);
|
||||
}
|
||||
}
|
||||
if (pack->opcode == 0) {
|
||||
if (pack->size) {
|
||||
#if TCPN_DEBUG >= 2
|
||||
std::cout << "Received TCP Network layer packet" << std::endl;
|
||||
#endif
|
||||
ProcessNetworkLayerPacket(pack);
|
||||
}
|
||||
#if TCPN_DEBUG >= 5
|
||||
else {
|
||||
std::cout << "Received TCP keepalive packet. (opcode=0)" << std::endl;
|
||||
}
|
||||
#endif
|
||||
// keepalive, no need to process
|
||||
safe_delete(pack);
|
||||
}
|
||||
else {
|
||||
#if TCPN_LOG_PACKETS >= 1
|
||||
if (pack && pack->opcode != 0) {
|
||||
struct in_addr in;
|
||||
in.s_addr = GetrIP();
|
||||
CoutTimestamp(true);
|
||||
std::cout << ": Logging incoming TCP packet. OPCode: 0x" << std::hex << std::setw(4) << std::setfill('0') << pack->opcode << std::dec << ", size: " << std::setw(5) << std::setfill(' ') << pack->size << " " << inet_ntoa(in) << ":" << GetrPort() << std::endl;
|
||||
#if TCPN_LOG_PACKETS == 2
|
||||
if (pack->size >= 32)
|
||||
DumpPacket(pack->pBuffer, 32);
|
||||
else
|
||||
DumpPacket(pack);
|
||||
#endif
|
||||
#if TCPN_LOG_PACKETS >= 3
|
||||
DumpPacket(pack);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
if (RelayServer && Server && pack->destination) {
|
||||
EmuTCPConnection* con = Server->FindConnection(pack->destination);
|
||||
if (!con) {
|
||||
#if TCPN_DEBUG >= 1
|
||||
std::cout << "Error relaying packet: con = 0" << std::endl;
|
||||
#endif
|
||||
safe_delete(pack);
|
||||
}
|
||||
else
|
||||
con->OutQueuePush(pack);
|
||||
}
|
||||
else
|
||||
OutQueuePush(pack);
|
||||
}
|
||||
base += size;
|
||||
size = 7;
|
||||
}
|
||||
}
|
||||
if (base != 0) {
|
||||
if (base >= recvbuf_used) {
|
||||
safe_delete_array(recvbuf);
|
||||
} else {
|
||||
uchar* tmpbuf = new uchar[recvbuf_size - base];
|
||||
memcpy(tmpbuf, &recvbuf[base], recvbuf_used - base);
|
||||
safe_delete_array(recvbuf);
|
||||
recvbuf = tmpbuf;
|
||||
recvbuf_used -= base;
|
||||
recvbuf_size -= base;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EmuTCPConnection::ProcessReceivedDataAsOldPackets(char* errbuf) {
|
||||
int32 base = 0;
|
||||
int32 size = 4;
|
||||
uchar* buffer;
|
||||
ServerPacket* pack = 0;
|
||||
while ((recvbuf_used - base) >= size) {
|
||||
buffer = &recvbuf[base];
|
||||
memcpy(&size, &buffer[2], 2);
|
||||
if (size >= MaxTCPReceiveBuffferSize) {
|
||||
#if TCPN_DEBUG_Memory >= 1
|
||||
std::cout << "TCPConnection[" << GetID() << "]::ProcessReceivedDataAsPackets(): size[" << size << "] >= MaxTCPReceiveBuffferSize" << std::endl;
|
||||
#endif
|
||||
if (errbuf)
|
||||
snprintf(errbuf, TCPConnection_ErrorBufferSize, "EmuTCPConnection::ProcessReceivedDataAsPackets(): size >= MaxTCPReceiveBuffferSize");
|
||||
return false;
|
||||
}
|
||||
if ((recvbuf_used - base) >= size) {
|
||||
// ok, we got enough data to make this packet!
|
||||
pack = new ServerPacket;
|
||||
memcpy(&pack->opcode, &buffer[0], 2);
|
||||
pack->size = size - 4;
|
||||
/* if () { // TODO: Checksum or size check or something similar
|
||||
// Datastream corruption, get the hell outta here!
|
||||
delete pack;
|
||||
return false;
|
||||
}*/
|
||||
if (pack->size > 0) {
|
||||
pack->pBuffer = new uchar[pack->size];
|
||||
memcpy(pack->pBuffer, &buffer[4], pack->size);
|
||||
}
|
||||
if (pack->opcode == 0) {
|
||||
// keepalive, no need to process
|
||||
safe_delete(pack);
|
||||
}
|
||||
else {
|
||||
#if TCPN_LOG_PACKETS >= 1
|
||||
if (pack && pack->opcode != 0) {
|
||||
struct in_addr in;
|
||||
in.s_addr = GetrIP();
|
||||
CoutTimestamp(true);
|
||||
std::cout << ": Logging incoming TCP OldPacket. OPCode: 0x" << std::hex << std::setw(4) << std::setfill('0') << pack->opcode << std::dec << ", size: " << std::setw(5) << std::setfill(' ') << pack->size << " " << inet_ntoa(in) << ":" << GetrPort() << std::endl;
|
||||
#if TCPN_LOG_PACKETS == 2
|
||||
if (pack->size >= 32)
|
||||
DumpPacket(pack->pBuffer, 32);
|
||||
else
|
||||
DumpPacket(pack);
|
||||
#endif
|
||||
#if TCPN_LOG_PACKETS >= 3
|
||||
DumpPacket(pack);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
OutQueuePush(pack);
|
||||
}
|
||||
base += size;
|
||||
size = 4;
|
||||
}
|
||||
}
|
||||
if (base != 0) {
|
||||
if (base >= recvbuf_used) {
|
||||
safe_delete_array(recvbuf);
|
||||
}
|
||||
else {
|
||||
uchar* tmpbuf = new uchar[recvbuf_size - base];
|
||||
memcpy(tmpbuf, &recvbuf[base], recvbuf_used - base);
|
||||
safe_delete_array(recvbuf);
|
||||
recvbuf = tmpbuf;
|
||||
recvbuf_used -= base;
|
||||
recvbuf_size -= base;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void EmuTCPConnection::ProcessNetworkLayerPacket(ServerPacket* pack) {
|
||||
uint8 opcode = pack->pBuffer[0];
|
||||
uint8* data = &pack->pBuffer[1];
|
||||
switch (opcode) {
|
||||
case 0: {
|
||||
break;
|
||||
}
|
||||
case 1: { // Switch to RelayServer mode
|
||||
if (pack->size != 1) {
|
||||
SendNetErrorPacket("New RelayClient: wrong size, expected 1");
|
||||
break;
|
||||
}
|
||||
if (RelayServer) {
|
||||
SendNetErrorPacket("Switch to RelayServer mode when already in RelayServer mode");
|
||||
break;
|
||||
}
|
||||
if (RemoteID) {
|
||||
SendNetErrorPacket("Switch to RelayServer mode by a Relay Client");
|
||||
break;
|
||||
}
|
||||
if (ConnectionType != Incomming) {
|
||||
SendNetErrorPacket("Switch to RelayServer mode on outgoing connection");
|
||||
break;
|
||||
}
|
||||
#if TCPC_DEBUG >= 3
|
||||
struct in_addr in;
|
||||
in.s_addr = GetrIP();
|
||||
std::cout << "Switching to RelayServer mode: " << inet_ntoa(in) << ":" << GetPort() << std::endl;
|
||||
#endif
|
||||
RelayServer = true;
|
||||
break;
|
||||
}
|
||||
case 2: { // New Relay Client
|
||||
if (!RelayServer) {
|
||||
SendNetErrorPacket("New RelayClient when not in RelayServer mode");
|
||||
break;
|
||||
}
|
||||
if (pack->size != 11) {
|
||||
SendNetErrorPacket("New RelayClient: wrong size, expected 11");
|
||||
break;
|
||||
}
|
||||
if (ConnectionType != Incomming) {
|
||||
SendNetErrorPacket("New RelayClient: illegal on outgoing connection");
|
||||
break;
|
||||
}
|
||||
EmuTCPConnection* con = new EmuTCPConnection(Server->GetNextID(), Server, this, *((uint32*) data), *((uint32*) &data[4]), *((uint16*) &data[8]));
|
||||
Server->AddConnection(con);
|
||||
RelayCount++;
|
||||
break;
|
||||
}
|
||||
case 3: { // Delete Relay Client
|
||||
if (!RelayServer) {
|
||||
SendNetErrorPacket("Delete RelayClient when not in RelayServer mode");
|
||||
break;
|
||||
}
|
||||
if (pack->size != 5) {
|
||||
SendNetErrorPacket("Delete RelayClient: wrong size, expected 5");
|
||||
break;
|
||||
}
|
||||
EmuTCPConnection* con = Server->FindConnection(*((uint32*)data));
|
||||
if (con) {
|
||||
if (ConnectionType == Incomming) {
|
||||
if (con->GetRelayLink() != this) {
|
||||
SendNetErrorPacket("Delete RelayClient: RelayLink != this");
|
||||
break;
|
||||
}
|
||||
}
|
||||
con->Disconnect(false);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 255: {
|
||||
#if TCPC_DEBUG >= 1
|
||||
struct in_addr in;
|
||||
in.s_addr = GetrIP();
|
||||
std::cout "Received NetError: '";
|
||||
if (pack->size > 1)
|
||||
std::cout << (char*) data;
|
||||
std::cout << "': " << inet_ntoa(in) << ":" << GetPort() << std::endl;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool EmuTCPConnection::SendData(bool &sent_something, char* errbuf) {
|
||||
sent_something = false;
|
||||
if(!TCPConnection::SendData(sent_something, errbuf))
|
||||
return(false);
|
||||
|
||||
if(sent_something)
|
||||
keepalive_timer.Start();
|
||||
else if (TCPMode == modePacket && keepalive_timer.Check()) {
|
||||
ServerPacket* pack = new ServerPacket(0, 0);
|
||||
SendPacket(pack);
|
||||
safe_delete(pack);
|
||||
#if TCPN_DEBUG >= 5
|
||||
std::cout << "Sending TCP keepalive packet. (timeout=" << timeout_timer.GetRemainingTime() << " remaining)" << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
return(true);
|
||||
}
|
||||
|
||||
bool EmuTCPConnection::RecvData(char* errbuf) {
|
||||
if(!TCPConnection::RecvData(errbuf)) {
|
||||
if (OutQueue.count())
|
||||
return(true);
|
||||
else
|
||||
return(false);
|
||||
}
|
||||
|
||||
if ((TCPMode == modePacket || TCPMode == modeTransition) && timeout_timer.Check()) {
|
||||
if (errbuf)
|
||||
snprintf(errbuf, TCPConnection_ErrorBufferSize, "TCPConnection::RecvData(): Connection timeout");
|
||||
return false;
|
||||
}
|
||||
|
||||
return(true);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
#ifndef EmuTCPCONNECTION_H_
|
||||
#define EmuTCPCONNECTION_H_
|
||||
|
||||
#include "tcp_connection.h"
|
||||
#include "timer.h"
|
||||
|
||||
//moved out of TCPConnection:: to be more exportable
|
||||
#pragma pack(1)
|
||||
struct EmuTCPNetPacket_Struct {
|
||||
uint32 size;
|
||||
struct {
|
||||
uint8
|
||||
compressed : 1,
|
||||
destination : 1,
|
||||
flag3 : 1,
|
||||
flag4 : 1,
|
||||
flag5 : 1,
|
||||
flag6 : 1,
|
||||
flag7 : 1,
|
||||
flag8 : 1;
|
||||
} flags;
|
||||
uint16 opcode;
|
||||
uchar buffer[0];
|
||||
};
|
||||
#pragma pack()
|
||||
|
||||
struct SPackSendQueue;
|
||||
class EmuTCPServer;
|
||||
|
||||
class EmuTCPConnection : public TCPConnection {
|
||||
public:
|
||||
enum eTCPMode { modeConsole, modeTransition, modePacket };
|
||||
enum ePacketMode { packetModeZone, packetModeLauncher, packetModeLogin, packetModeUCS, packetModeQueryServ };
|
||||
|
||||
EmuTCPConnection(uint32 ID, EmuTCPServer* iServer, SOCKET iSock, uint32 irIP, uint16 irPort, bool iOldFormat = false);
|
||||
EmuTCPConnection(bool iOldFormat = false, EmuTCPServer* iRelayServer = 0, eTCPMode iMode = modePacket); // for outgoing connections
|
||||
EmuTCPConnection(uint32 ID, EmuTCPServer* iServer, EmuTCPConnection* iRelayLink, uint32 iRemoteID, uint32 irIP, uint16 irPort); // for relay connections
|
||||
virtual ~EmuTCPConnection();
|
||||
|
||||
virtual bool ConnectIP(uint32 irIP, uint16 irPort, char* errbuf = 0);
|
||||
virtual void Disconnect(bool iSendRelayDisconnect = true);
|
||||
|
||||
static EmuTCPNetPacket_Struct* MakePacket(ServerPacket* pack, uint32 iDestination = 0);
|
||||
static SPackSendQueue* MakeOldPacket(ServerPacket* pack);
|
||||
|
||||
virtual bool SendPacket(ServerPacket* pack, uint32 iDestination = 0);
|
||||
virtual bool SendPacket(EmuTCPNetPacket_Struct* tnps);
|
||||
ServerPacket* PopPacket(); // OutQueuePop()
|
||||
void SetPacketMode(ePacketMode mode) { PacketMode = mode; }
|
||||
|
||||
eTCPMode GetMode() const { return TCPMode; }
|
||||
ePacketMode GetPacketMode() const { return(PacketMode); }
|
||||
|
||||
//relay crap:
|
||||
inline bool IsRelayServer() const { return RelayServer; }
|
||||
inline TCPConnection* GetRelayLink() const { return RelayLink; }
|
||||
inline uint32 GetRemoteID() const { return RemoteID; }
|
||||
|
||||
protected:
|
||||
void OutQueuePush(ServerPacket* pack);
|
||||
void RemoveRelay(EmuTCPConnection* relay, bool iSendRelayDisconnect);
|
||||
|
||||
void SendNetErrorPacket(const char* reason = 0);
|
||||
|
||||
virtual bool SendData(bool &sent_something, char* errbuf = 0);
|
||||
virtual bool RecvData(char* errbuf = 0);
|
||||
|
||||
virtual bool ProcessReceivedData(char* errbuf = 0);
|
||||
bool ProcessReceivedDataAsPackets(char* errbuf = 0);
|
||||
bool ProcessReceivedDataAsOldPackets(char* errbuf = 0);
|
||||
void ProcessNetworkLayerPacket(ServerPacket* pack);
|
||||
|
||||
virtual bool LineOutQueuePush(char* line);
|
||||
virtual void ClearBuffers();
|
||||
|
||||
EmuTCPServer* Server;
|
||||
|
||||
eTCPMode TCPMode;
|
||||
ePacketMode PacketMode;
|
||||
bool pOldFormat;
|
||||
|
||||
Timer keepalive_timer;
|
||||
Timer timeout_timer;
|
||||
|
||||
//relay crap:
|
||||
EmuTCPConnection* RelayLink;
|
||||
int32 RelayCount;
|
||||
bool RelayServer;
|
||||
uint32 RemoteID;
|
||||
|
||||
//input queue...
|
||||
void InModeQueuePush(EmuTCPNetPacket_Struct* tnps);
|
||||
MyQueue<EmuTCPNetPacket_Struct> InModeQueue;
|
||||
|
||||
//output queue...
|
||||
MyQueue<ServerPacket> OutQueue;
|
||||
Mutex MOutQueueLock;
|
||||
};
|
||||
|
||||
#endif /*EmuTCPCONNECTION_H_*/
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
#include "debug.h"
|
||||
#include "emu_tcp_server.h"
|
||||
#include "emu_tcp_connection.h"
|
||||
|
||||
EmuTCPServer::EmuTCPServer(uint16 iPort, bool iOldFormat)
|
||||
: TCPServer<EmuTCPConnection>(iPort),
|
||||
pOldFormat(iOldFormat)
|
||||
{
|
||||
}
|
||||
|
||||
EmuTCPServer::~EmuTCPServer() {
|
||||
MInQueue.lock();
|
||||
while(!m_InQueue.empty()) {
|
||||
delete m_InQueue.front();
|
||||
m_InQueue.pop();
|
||||
}
|
||||
MInQueue.unlock();
|
||||
}
|
||||
|
||||
void EmuTCPServer::Process() {
|
||||
CheckInQueue();
|
||||
TCPServer<EmuTCPConnection>::Process();
|
||||
}
|
||||
|
||||
void EmuTCPServer::CreateNewConnection(uint32 ID, SOCKET in_socket, uint32 irIP, uint16 irPort)
|
||||
{
|
||||
EmuTCPConnection *conn = new EmuTCPConnection(ID, this, in_socket, irIP, irPort, pOldFormat);
|
||||
AddConnection(conn);
|
||||
}
|
||||
|
||||
|
||||
void EmuTCPServer::SendPacket(ServerPacket* pack) {
|
||||
EmuTCPNetPacket_Struct* tnps = EmuTCPConnection::MakePacket(pack);
|
||||
SendPacket(&tnps);
|
||||
}
|
||||
|
||||
void EmuTCPServer::SendPacket(EmuTCPNetPacket_Struct** tnps) {
|
||||
MInQueue.lock();
|
||||
m_InQueue.push(*tnps);
|
||||
MInQueue.unlock();
|
||||
tnps = nullptr;
|
||||
}
|
||||
|
||||
void EmuTCPServer::CheckInQueue() {
|
||||
EmuTCPNetPacket_Struct* tnps = 0;
|
||||
|
||||
while (( tnps = InQueuePop() )) {
|
||||
vitr cur, end;
|
||||
cur = m_list.begin();
|
||||
end = m_list.end();
|
||||
for(; cur != end; cur++) {
|
||||
if ((*cur)->GetMode() != EmuTCPConnection::modeConsole && (*cur)->GetRemoteID() == 0)
|
||||
(*cur)->SendPacket(tnps);
|
||||
}
|
||||
safe_delete(tnps);
|
||||
}
|
||||
}
|
||||
|
||||
EmuTCPNetPacket_Struct* EmuTCPServer::InQueuePop() {
|
||||
EmuTCPNetPacket_Struct* ret = nullptr;
|
||||
MInQueue.lock();
|
||||
if(!m_InQueue.empty()) {
|
||||
ret = m_InQueue.front();
|
||||
m_InQueue.pop();
|
||||
}
|
||||
MInQueue.unlock();
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
EmuTCPConnection *EmuTCPServer::FindConnection(uint32 iID) {
|
||||
vitr cur, end;
|
||||
cur = m_list.begin();
|
||||
end = m_list.end();
|
||||
for(; cur != end; cur++) {
|
||||
if ((*cur)->GetID() == iID)
|
||||
return *cur;
|
||||
}
|
||||
return(nullptr);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
#ifndef EmuTCPSERVER_H_
|
||||
#define EmuTCPSERVER_H_
|
||||
|
||||
#include "tcp_server.h"
|
||||
|
||||
class EmuTCPConnection;
|
||||
struct EmuTCPNetPacket_Struct;
|
||||
class ServerPacket;
|
||||
|
||||
class EmuTCPServer : public TCPServer<EmuTCPConnection> {
|
||||
public:
|
||||
EmuTCPServer(uint16 iPort = 0, bool iOldFormat = false);
|
||||
virtual ~EmuTCPServer();
|
||||
|
||||
//packet broadcast routines.
|
||||
void SendPacket(ServerPacket* pack);
|
||||
void SendPacket(EmuTCPNetPacket_Struct** tnps);
|
||||
|
||||
//special crap for relay management
|
||||
EmuTCPConnection *FindConnection(uint32 iID);
|
||||
|
||||
//exposed for some crap we pull. Do not call from outside this object.
|
||||
using TCPServer<EmuTCPConnection>::AddConnection;
|
||||
|
||||
protected:
|
||||
virtual void Process();
|
||||
|
||||
virtual void CreateNewConnection(uint32 ID, SOCKET in_socket, uint32 irIP, uint16 irPort);
|
||||
|
||||
bool pOldFormat;
|
||||
|
||||
//broadcast packet queue..
|
||||
void CheckInQueue();
|
||||
Mutex MInQueue;
|
||||
EmuTCPNetPacket_Struct* InQueuePop(); //returns ownership
|
||||
std::queue<EmuTCPNetPacket_Struct *> m_InQueue;
|
||||
};
|
||||
#endif /*EmuTCPSERVER_H_*/
|
||||
@@ -1,370 +0,0 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
|
||||
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
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; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "emu_versions.h"
|
||||
|
||||
|
||||
bool EQEmu::versions::IsValidClientVersion(ClientVersion client_version)
|
||||
{
|
||||
if (client_version <= ClientVersion::Unknown || client_version > LastClientVersion)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
EQEmu::versions::ClientVersion EQEmu::versions::ValidateClientVersion(ClientVersion client_version)
|
||||
{
|
||||
if (client_version <= ClientVersion::Unknown || client_version > LastClientVersion)
|
||||
return ClientVersion::Unknown;
|
||||
|
||||
return client_version;
|
||||
}
|
||||
|
||||
const char* EQEmu::versions::ClientVersionName(ClientVersion client_version)
|
||||
{
|
||||
switch (client_version) {
|
||||
case ClientVersion::Unknown:
|
||||
return "Unknown Version";
|
||||
case ClientVersion::Client62:
|
||||
return "Client 6.2";
|
||||
case ClientVersion::Titanium:
|
||||
return "Titanium";
|
||||
case ClientVersion::SoF:
|
||||
return "SoF";
|
||||
case ClientVersion::SoD:
|
||||
return "SoD";
|
||||
case ClientVersion::UF:
|
||||
return "UF";
|
||||
case ClientVersion::RoF:
|
||||
return "RoF";
|
||||
case ClientVersion::RoF2:
|
||||
return "RoF2";
|
||||
default:
|
||||
return "Invalid Version";
|
||||
};
|
||||
}
|
||||
|
||||
uint32 EQEmu::versions::ConvertClientVersionToClientVersionBit(ClientVersion client_version)
|
||||
{
|
||||
switch (client_version) {
|
||||
case ClientVersion::Unknown:
|
||||
case ClientVersion::Client62:
|
||||
return bit_Unknown;
|
||||
case ClientVersion::Titanium:
|
||||
return bit_Titanium;
|
||||
case ClientVersion::SoF:
|
||||
return bit_SoF;
|
||||
case ClientVersion::SoD:
|
||||
return bit_SoD;
|
||||
case ClientVersion::UF:
|
||||
return bit_UF;
|
||||
case ClientVersion::RoF:
|
||||
return bit_RoF;
|
||||
case ClientVersion::RoF2:
|
||||
return bit_RoF2;
|
||||
default:
|
||||
return bit_Unknown;
|
||||
}
|
||||
}
|
||||
|
||||
EQEmu::versions::ClientVersion EQEmu::versions::ConvertClientVersionBitToClientVersion(uint32 client_version_bit)
|
||||
{
|
||||
switch (client_version_bit) {
|
||||
case (uint32)static_cast<unsigned int>(ClientVersion::Unknown) :
|
||||
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::Client62) - 1)) :
|
||||
return ClientVersion::Unknown;
|
||||
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::Titanium) - 1)) :
|
||||
return ClientVersion::Titanium;
|
||||
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::SoF) - 1)) :
|
||||
return ClientVersion::SoF;
|
||||
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::SoD) - 1)) :
|
||||
return ClientVersion::SoD;
|
||||
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::UF) - 1)) :
|
||||
return ClientVersion::UF;
|
||||
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::RoF) - 1)) :
|
||||
return ClientVersion::RoF;
|
||||
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::RoF2) - 1)) :
|
||||
return ClientVersion::RoF2;
|
||||
default:
|
||||
return ClientVersion::Unknown;
|
||||
}
|
||||
}
|
||||
|
||||
uint32 EQEmu::versions::ConvertClientVersionToExpansion(ClientVersion client_version)
|
||||
{
|
||||
switch (client_version) {
|
||||
case ClientVersion::Unknown:
|
||||
case ClientVersion::Client62:
|
||||
case ClientVersion::Titanium:
|
||||
return 0x000007FFU;
|
||||
case ClientVersion::SoF:
|
||||
return 0x00007FFFU;
|
||||
case ClientVersion::SoD:
|
||||
return 0x0000FFFFU;
|
||||
case ClientVersion::UF:
|
||||
return 0x0001FFFFU;
|
||||
case ClientVersion::RoF:
|
||||
case ClientVersion::RoF2:
|
||||
return 0x000FFFFFU;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool EQEmu::versions::IsValidMobVersion(MobVersion mob_version)
|
||||
{
|
||||
if (mob_version <= MobVersion::Unknown || mob_version > LastMobVersion)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EQEmu::versions::IsValidPCMobVersion(MobVersion mob_version)
|
||||
{
|
||||
if (mob_version <= MobVersion::Unknown || mob_version > LastPCMobVersion)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EQEmu::versions::IsValidNonPCMobVersion(MobVersion mob_version)
|
||||
{
|
||||
if (mob_version <= LastPCMobVersion || mob_version > LastNonPCMobVersion)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EQEmu::versions::IsValidOfflinePCMobVersion(MobVersion mob_version)
|
||||
{
|
||||
if (mob_version <= LastNonPCMobVersion || mob_version > LastOfflinePCMobVersion)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
EQEmu::versions::MobVersion EQEmu::versions::ValidateMobVersion(MobVersion mob_version)
|
||||
{
|
||||
if (mob_version <= MobVersion::Unknown || mob_version > LastMobVersion)
|
||||
return MobVersion::Unknown;
|
||||
|
||||
return mob_version;
|
||||
}
|
||||
|
||||
EQEmu::versions::MobVersion EQEmu::versions::ValidatePCMobVersion(MobVersion mob_version)
|
||||
{
|
||||
if (mob_version <= MobVersion::Unknown || mob_version > LastPCMobVersion)
|
||||
return MobVersion::Unknown;
|
||||
|
||||
return mob_version;
|
||||
}
|
||||
|
||||
EQEmu::versions::MobVersion EQEmu::versions::ValidateNonPCMobVersion(MobVersion mob_version)
|
||||
{
|
||||
if (mob_version <= LastPCMobVersion || mob_version > LastNonPCMobVersion)
|
||||
return MobVersion::Unknown;
|
||||
|
||||
return mob_version;
|
||||
}
|
||||
|
||||
EQEmu::versions::MobVersion EQEmu::versions::ValidateOfflinePCMobVersion(MobVersion mob_version)
|
||||
{
|
||||
if (mob_version <= LastNonPCMobVersion || mob_version > LastOfflinePCMobVersion)
|
||||
return MobVersion::Unknown;
|
||||
|
||||
return mob_version;
|
||||
}
|
||||
|
||||
const char* EQEmu::versions::MobVersionName(MobVersion mob_version)
|
||||
{
|
||||
switch (mob_version) {
|
||||
case MobVersion::Unknown:
|
||||
return "Unknown Version";
|
||||
case MobVersion::Client62:
|
||||
return "Client 6.2";
|
||||
case MobVersion::Titanium:
|
||||
return "Titanium";
|
||||
case MobVersion::SoF:
|
||||
return "SoF";
|
||||
case MobVersion::SoD:
|
||||
return "SoD";
|
||||
case MobVersion::UF:
|
||||
return "UF";
|
||||
case MobVersion::RoF:
|
||||
return "RoF";
|
||||
case MobVersion::RoF2:
|
||||
return "RoF2";
|
||||
case MobVersion::NPC:
|
||||
return "NPC";
|
||||
case MobVersion::NPCMerchant:
|
||||
return "NPC Merchant";
|
||||
case MobVersion::Merc:
|
||||
return "Merc";
|
||||
case MobVersion::Bot:
|
||||
return "Bot";
|
||||
case MobVersion::ClientPet:
|
||||
return "Client Pet";
|
||||
case MobVersion::NPCPet:
|
||||
return "NPC Pet";
|
||||
case MobVersion::MercPet:
|
||||
return "Merc Pet";
|
||||
case MobVersion::BotPet:
|
||||
return "Bot Pet";
|
||||
case MobVersion::OfflineTitanium:
|
||||
return "Offline Titanium";
|
||||
case MobVersion::OfflineSoF:
|
||||
return "Offline SoF";
|
||||
case MobVersion::OfflineSoD:
|
||||
return "Offline SoD";
|
||||
case MobVersion::OfflineUF:
|
||||
return "Offline UF";
|
||||
case MobVersion::OfflineRoF:
|
||||
return "Offline RoF";
|
||||
case MobVersion::OfflineRoF2:
|
||||
return "Offline RoF2";
|
||||
default:
|
||||
return "Invalid Version";
|
||||
};
|
||||
}
|
||||
|
||||
EQEmu::versions::ClientVersion EQEmu::versions::ConvertMobVersionToClientVersion(MobVersion mob_version)
|
||||
{
|
||||
switch (mob_version) {
|
||||
case MobVersion::Unknown:
|
||||
case MobVersion::Client62:
|
||||
return ClientVersion::Unknown;
|
||||
case MobVersion::Titanium:
|
||||
return ClientVersion::Titanium;
|
||||
case MobVersion::SoF:
|
||||
return ClientVersion::SoF;
|
||||
case MobVersion::SoD:
|
||||
return ClientVersion::SoD;
|
||||
case MobVersion::UF:
|
||||
return ClientVersion::UF;
|
||||
case MobVersion::RoF:
|
||||
return ClientVersion::RoF;
|
||||
case MobVersion::RoF2:
|
||||
return ClientVersion::RoF2;
|
||||
default:
|
||||
return ClientVersion::Unknown;
|
||||
}
|
||||
}
|
||||
|
||||
EQEmu::versions::MobVersion EQEmu::versions::ConvertClientVersionToMobVersion(ClientVersion client_version)
|
||||
{
|
||||
switch (client_version) {
|
||||
case ClientVersion::Unknown:
|
||||
case ClientVersion::Client62:
|
||||
return MobVersion::Unknown;
|
||||
case ClientVersion::Titanium:
|
||||
return MobVersion::Titanium;
|
||||
case ClientVersion::SoF:
|
||||
return MobVersion::SoF;
|
||||
case ClientVersion::SoD:
|
||||
return MobVersion::SoD;
|
||||
case ClientVersion::UF:
|
||||
return MobVersion::UF;
|
||||
case ClientVersion::RoF:
|
||||
return MobVersion::RoF;
|
||||
case ClientVersion::RoF2:
|
||||
return MobVersion::RoF2;
|
||||
default:
|
||||
return MobVersion::Unknown;
|
||||
}
|
||||
}
|
||||
|
||||
EQEmu::versions::MobVersion EQEmu::versions::ConvertPCMobVersionToOfflinePCMobVersion(MobVersion mob_version)
|
||||
{
|
||||
switch (mob_version) {
|
||||
case MobVersion::Titanium:
|
||||
return MobVersion::OfflineTitanium;
|
||||
case MobVersion::SoF:
|
||||
return MobVersion::OfflineSoF;
|
||||
case MobVersion::SoD:
|
||||
return MobVersion::OfflineSoD;
|
||||
case MobVersion::UF:
|
||||
return MobVersion::OfflineUF;
|
||||
case MobVersion::RoF:
|
||||
return MobVersion::OfflineRoF;
|
||||
case MobVersion::RoF2:
|
||||
return MobVersion::OfflineRoF2;
|
||||
default:
|
||||
return MobVersion::Unknown;
|
||||
}
|
||||
}
|
||||
|
||||
EQEmu::versions::MobVersion EQEmu::versions::ConvertOfflinePCMobVersionToPCMobVersion(MobVersion mob_version)
|
||||
{
|
||||
switch (mob_version) {
|
||||
case MobVersion::OfflineTitanium:
|
||||
return MobVersion::Titanium;
|
||||
case MobVersion::OfflineSoF:
|
||||
return MobVersion::SoF;
|
||||
case MobVersion::OfflineSoD:
|
||||
return MobVersion::SoD;
|
||||
case MobVersion::OfflineUF:
|
||||
return MobVersion::UF;
|
||||
case MobVersion::OfflineRoF:
|
||||
return MobVersion::RoF;
|
||||
case MobVersion::OfflineRoF2:
|
||||
return MobVersion::RoF2;
|
||||
default:
|
||||
return MobVersion::Unknown;
|
||||
}
|
||||
}
|
||||
|
||||
EQEmu::versions::ClientVersion EQEmu::versions::ConvertOfflinePCMobVersionToClientVersion(MobVersion mob_version)
|
||||
{
|
||||
switch (mob_version) {
|
||||
case MobVersion::OfflineTitanium:
|
||||
return ClientVersion::Titanium;
|
||||
case MobVersion::OfflineSoF:
|
||||
return ClientVersion::SoF;
|
||||
case MobVersion::OfflineSoD:
|
||||
return ClientVersion::SoD;
|
||||
case MobVersion::OfflineUF:
|
||||
return ClientVersion::UF;
|
||||
case MobVersion::OfflineRoF:
|
||||
return ClientVersion::RoF;
|
||||
case MobVersion::OfflineRoF2:
|
||||
return ClientVersion::RoF2;
|
||||
default:
|
||||
return ClientVersion::Unknown;
|
||||
}
|
||||
}
|
||||
|
||||
EQEmu::versions::MobVersion EQEmu::versions::ConvertClientVersionToOfflinePCMobVersion(ClientVersion client_version)
|
||||
{
|
||||
switch (client_version) {
|
||||
case ClientVersion::Titanium:
|
||||
return MobVersion::OfflineTitanium;
|
||||
case ClientVersion::SoF:
|
||||
return MobVersion::OfflineSoF;
|
||||
case ClientVersion::SoD:
|
||||
return MobVersion::OfflineSoD;
|
||||
case ClientVersion::UF:
|
||||
return MobVersion::OfflineUF;
|
||||
case ClientVersion::RoF:
|
||||
return MobVersion::OfflineRoF;
|
||||
case ClientVersion::RoF2:
|
||||
return MobVersion::OfflineRoF2;
|
||||
default:
|
||||
return MobVersion::Unknown;
|
||||
}
|
||||
}
|
||||
@@ -1,128 +0,0 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
|
||||
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
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; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef COMMON_EMU_VERSIONS_H
|
||||
#define COMMON_EMU_VERSIONS_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
namespace EQEmu
|
||||
{
|
||||
namespace versions {
|
||||
enum class ClientVersion {
|
||||
Unknown = 0,
|
||||
Client62, // Build: 'Aug 4 2005 15:40:59'
|
||||
Titanium, // Build: 'Oct 31 2005 10:33:37'
|
||||
SoF, // Build: 'Sep 7 2007 09:11:49'
|
||||
SoD, // Build: 'Dec 19 2008 15:22:49'
|
||||
UF, // Build: 'Jun 8 2010 16:44:32'
|
||||
RoF, // Build: 'Dec 10 2012 17:35:44'
|
||||
RoF2 // Build: 'May 10 2013 23:30:08'
|
||||
};
|
||||
|
||||
enum ClientVersionBit : uint32 {
|
||||
bit_Unknown = 0,
|
||||
bit_Client62 = 0x00000001, // unsupported (placeholder for scripts)
|
||||
bit_Titanium = 0x00000002,
|
||||
bit_SoF = 0x00000004,
|
||||
bit_SoD = 0x00000008,
|
||||
bit_UF = 0x00000010,
|
||||
bit_RoF = 0x00000020,
|
||||
bit_RoF2 = 0x00000040,
|
||||
bit_TitaniumAndEarlier = 0x00000003,
|
||||
bit_SoFAndEarlier = 0x00000007,
|
||||
bit_SoDAndEarlier = 0x0000000F,
|
||||
bit_UFAndEarlier = 0x0000001F,
|
||||
bit_RoFAndEarlier = 0x0000003F,
|
||||
bit_SoFAndLater = 0xFFFFFFFC,
|
||||
bit_SoDAndLater = 0xFFFFFFF8,
|
||||
bit_UFAndLater = 0xFFFFFFF0,
|
||||
bit_RoFAndLater = 0xFFFFFFE0,
|
||||
bit_RoF2AndLater = 0xFFFFFFC0,
|
||||
bit_AllClients = 0xFFFFFFFF
|
||||
};
|
||||
|
||||
const ClientVersion LastClientVersion = ClientVersion::RoF2;
|
||||
const size_t ClientVersionCount = (static_cast<size_t>(LastClientVersion) + 1);
|
||||
|
||||
bool IsValidClientVersion(ClientVersion client_version);
|
||||
ClientVersion ValidateClientVersion(ClientVersion client_version);
|
||||
const char* ClientVersionName(ClientVersion client_version);
|
||||
uint32 ConvertClientVersionToClientVersionBit(ClientVersion client_version);
|
||||
ClientVersion ConvertClientVersionBitToClientVersion(uint32 client_version_bit);
|
||||
uint32 ConvertClientVersionToExpansion(ClientVersion client_version);
|
||||
|
||||
|
||||
enum class MobVersion {
|
||||
Unknown = 0,
|
||||
Client62,
|
||||
Titanium,
|
||||
SoF,
|
||||
SoD,
|
||||
UF,
|
||||
RoF,
|
||||
RoF2,
|
||||
NPC,
|
||||
NPCMerchant,
|
||||
Merc,
|
||||
Bot,
|
||||
ClientPet,
|
||||
NPCPet,
|
||||
MercPet,
|
||||
BotPet,
|
||||
OfflineTitanium,
|
||||
OfflineSoF,
|
||||
OfflineSoD,
|
||||
OfflineUF,
|
||||
OfflineRoF,
|
||||
OfflineRoF2
|
||||
};
|
||||
|
||||
const MobVersion LastMobVersion = MobVersion::OfflineRoF2;
|
||||
const MobVersion LastPCMobVersion = MobVersion::RoF2;
|
||||
const MobVersion LastNonPCMobVersion = MobVersion::BotPet;
|
||||
const MobVersion LastOfflinePCMobVersion = MobVersion::OfflineRoF2;
|
||||
const size_t MobVersionCount = (static_cast<size_t>(LastMobVersion) + 1);
|
||||
|
||||
bool IsValidMobVersion(MobVersion mob_version);
|
||||
bool IsValidPCMobVersion(MobVersion mob_version);
|
||||
bool IsValidNonPCMobVersion(MobVersion mob_version);
|
||||
bool IsValidOfflinePCMobVersion(MobVersion mob_version);
|
||||
|
||||
MobVersion ValidateMobVersion(MobVersion mob_version);
|
||||
MobVersion ValidatePCMobVersion(MobVersion mob_version);
|
||||
MobVersion ValidateNonPCMobVersion(MobVersion mob_version);
|
||||
MobVersion ValidateOfflinePCMobVersion(MobVersion mob_version);
|
||||
|
||||
const char* MobVersionName(MobVersion mob_version);
|
||||
ClientVersion ConvertMobVersionToClientVersion(MobVersion mob_version);
|
||||
MobVersion ConvertClientVersionToMobVersion(ClientVersion client_version);
|
||||
MobVersion ConvertPCMobVersionToOfflinePCMobVersion(MobVersion mob_version);
|
||||
MobVersion ConvertOfflinePCMobVersionToPCMobVersion(MobVersion mob_version);
|
||||
ClientVersion ConvertOfflinePCMobVersionToClientVersion(MobVersion mob_version);
|
||||
MobVersion ConvertClientVersionToOfflinePCMobVersion(ClientVersion client_version);
|
||||
|
||||
} /*versions*/
|
||||
|
||||
} /*EQEmu*/
|
||||
|
||||
#endif /*COMMON_EMU_VERSIONS_H*/
|
||||
+552
-79
@@ -1,6 +1,5 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
|
||||
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
|
||||
Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
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
|
||||
@@ -14,59 +13,361 @@
|
||||
|
||||
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef COMMON_EQ_CONSTANTS_H
|
||||
#define COMMON_EQ_CONSTANTS_H
|
||||
#ifndef EQ_CONSTANTS_H
|
||||
#define EQ_CONSTANTS_H
|
||||
|
||||
#include "skills.h"
|
||||
#include "types.h"
|
||||
|
||||
/*
|
||||
** Item attributes
|
||||
**
|
||||
** (There are no grepwin hits other than these declarations... Do they have a use?)
|
||||
*/
|
||||
enum ItemAttributes : uint32
|
||||
{
|
||||
ItemAttrNone = 0x00000000,
|
||||
ItemAttrLore = 0x00000001,
|
||||
ItemAttrArtifact = 0x00000002,
|
||||
ItemAttrSummoned = 0x00000004,
|
||||
ItemAttrMagic = 0x00000008,
|
||||
ItemAttrAugment = 0x00000010,
|
||||
ItemAttrPendingLore = 0x00000020,
|
||||
ItemAttrUnknown = 0xFFFFFFFF
|
||||
};
|
||||
|
||||
//SpawnAppearance types: (compared two clients for server-originating types: SoF & RoF2)
|
||||
#define AT_Die 0 // this causes the client to keel over and zone to bind point (default action)
|
||||
#define AT_WhoLevel 1 // the level that shows up on /who
|
||||
//#define AT_2 2 // unknown
|
||||
#define AT_Invis 3 // 0 = visible, 1 = invisible
|
||||
#define AT_PVP 4 // 0 = blue, 1 = pvp (red)
|
||||
#define AT_Light 5 // light type emitted by player (lightstone, shiny shield)
|
||||
#define AT_Anim 14 // 100=standing, 110=sitting, 111=ducking, 115=feigned, 105=looting
|
||||
#define AT_Sneak 15 // 0 = normal, 1 = sneaking
|
||||
#define AT_SpawnID 16 // server to client, sets player spawn id
|
||||
#define AT_HP 17 // Client->Server, my HP has changed (like regen tic)
|
||||
#define AT_Linkdead 18 // 0 = normal, 1 = linkdead
|
||||
#define AT_Levitate 19 // 0=off, 1=flymode, 2=levitate
|
||||
#define AT_GM 20 // 0 = normal, 1 = GM - all odd numbers seem to make it GM
|
||||
#define AT_Anon 21 // 0 = normal, 1 = anon, 2 = roleplay
|
||||
#define AT_GuildID 22
|
||||
#define AT_GuildRank 23 // 0=member, 1=officer, 2=leader
|
||||
#define AT_AFK 24 // 0 = normal, 1 = afk
|
||||
#define AT_Pet 25 // Param is EntityID of owner, or 0 for when charm breaks
|
||||
//#define AT_27 27 // unknown
|
||||
#define AT_Split 28 // 0 = normal, 1 = autosplit on (not showing in SoF+) (client-to-server only)
|
||||
#define AT_Size 29 // spawn's size (present: SoF, absent: RoF2)
|
||||
//#define AT_30 30 // unknown
|
||||
#define AT_NPCName 31 // change PC's name's color to NPC color 0 = normal, 1 = npc name
|
||||
//#define AT_32 32 // unknown
|
||||
//#define AT_33 33 // unknown
|
||||
//#define AT_34 34 // unknown (present: SoF, absent: RoF2)
|
||||
//#define AT_35 35 // unknown
|
||||
//#define AT_36 36 // unknown
|
||||
//#define AT_37 37 // unknown
|
||||
//#define AT_38 38 // unknown
|
||||
//#define AT_39 39 // unknown
|
||||
#define AT_ShowHelm 43 // 0 = hide graphic, 1 = show graphic
|
||||
#define AT_DamageState 44 // The damage state of a destructible object (0 through 4)
|
||||
//#define AT_46 46 // unknown
|
||||
//#define AT_48 48 // unknown
|
||||
//#define AT_49 49 // unknown
|
||||
//#define AT_52 52 // (absent: SoF, present: RoF2) (not a replacement for RoF absent 29 or 34)
|
||||
//#define AT_53 53 // (absent: SoF, present: RoF2) (not a replacement for RoF absent 29 or 34)
|
||||
/*
|
||||
** Item class types
|
||||
**
|
||||
*/
|
||||
enum ItemClassTypes
|
||||
{
|
||||
ItemClassCommon = 0,
|
||||
ItemClassContainer,
|
||||
ItemClassBook,
|
||||
_ItemClassCount
|
||||
};
|
||||
|
||||
//#define AT_Trader 300 // Bazaar Trader Mode (not present in SoF or RoF2)
|
||||
/*
|
||||
** Item use types
|
||||
**
|
||||
** (ref: database and eqstr_us.txt)
|
||||
**
|
||||
** (Looking at a recent database, it's possible that some of the item values may be off [10-27-2013] -U)
|
||||
*/
|
||||
enum ItemUseTypes : uint8
|
||||
{
|
||||
/*9138*/ ItemType1HSlash = 0,
|
||||
/*9141*/ ItemType2HSlash,
|
||||
/*9140*/ ItemType1HPiercing,
|
||||
/*9139*/ ItemType1HBlunt,
|
||||
/*9142*/ ItemType2HBlunt,
|
||||
/*5504*/ ItemTypeBow,
|
||||
/*----*/ ItemTypeUnknown1,
|
||||
/*----*/ ItemTypeLargeThrowing,
|
||||
/*5505*/ ItemTypeShield,
|
||||
/*5506*/ ItemTypeScroll,
|
||||
/*5507*/ ItemTypeArmor,
|
||||
/*5508*/ ItemTypeMisc, // a lot of random crap has this item use.
|
||||
/*7564*/ ItemTypeLockPick,
|
||||
/*----*/ ItemTypeUnknown2,
|
||||
/*5509*/ ItemTypeFood,
|
||||
/*5510*/ ItemTypeDrink,
|
||||
/*5511*/ ItemTypeLight,
|
||||
/*5512*/ ItemTypeCombinable, // not all stackable items are this use...
|
||||
/*5513*/ ItemTypeBandage,
|
||||
/*----*/ ItemTypeSmallThrowing,
|
||||
/*----*/ ItemTypeSpell, // spells and tomes
|
||||
/*5514*/ ItemTypePotion,
|
||||
/*----*/ ItemTypeUnknown3,
|
||||
/*0406*/ ItemTypeWindInstrument,
|
||||
/*0407*/ ItemTypeStringedInstrument,
|
||||
/*0408*/ ItemTypeBrassInstrument,
|
||||
/*0405*/ ItemTypePercussionInstrument,
|
||||
/*5515*/ ItemTypeArrow,
|
||||
/*----*/ ItemTypeUnknown4,
|
||||
/*5521*/ ItemTypeJewelry,
|
||||
/*----*/ ItemTypeSkull,
|
||||
/*5516*/ ItemTypeBook, // skill-up tomes/books? (would probably need a pp flag if true...)
|
||||
/*5517*/ ItemTypeNote,
|
||||
/*5518*/ ItemTypeKey,
|
||||
/*----*/ ItemTypeCoin,
|
||||
/*5520*/ ItemType2HPiercing,
|
||||
/*----*/ ItemTypeFishingPole,
|
||||
/*----*/ ItemTypeFishingBait,
|
||||
/*5519*/ ItemTypeAlcohol,
|
||||
/*----*/ ItemTypeKey2, // keys and satchels?? (questable keys?)
|
||||
/*----*/ ItemTypeCompass,
|
||||
/*----*/ ItemTypeUnknown5,
|
||||
/*----*/ ItemTypePoison, // might be wrong, but includes poisons
|
||||
/*----*/ ItemTypeUnknown6,
|
||||
/*----*/ ItemTypeUnknown7,
|
||||
/*5522*/ ItemTypeMartial,
|
||||
/*----*/ ItemTypeUnknown8,
|
||||
/*----*/ ItemTypeUnknown9,
|
||||
/*----*/ ItemTypeUnknown10,
|
||||
/*----*/ ItemTypeUnknown11,
|
||||
/*----*/ ItemTypeSinging,
|
||||
/*5750*/ ItemTypeAllInstrumentTypes,
|
||||
/*5776*/ ItemTypeCharm,
|
||||
/*----*/ ItemTypeDye,
|
||||
/*----*/ ItemTypeAugmentation,
|
||||
/*----*/ ItemTypeAugmentationSolvent,
|
||||
/*----*/ ItemTypeAugmentationDistiller,
|
||||
/*----*/ ItemTypeUnknown12,
|
||||
/*----*/ ItemTypeFellowshipKit,
|
||||
/*----*/ ItemTypeUnknown13,
|
||||
/*----*/ ItemTypeRecipe,
|
||||
/*----*/ ItemTypeAdvancedRecipe,
|
||||
/*----*/ ItemTypeJournal, // only one(1) database entry
|
||||
/*----*/ ItemTypeAltCurrency, // alt-currency (as opposed to coinage)
|
||||
/*5881*/ ItemTypePerfectedAugmentationDistiller,
|
||||
/*----*/ _ItemTypeCount
|
||||
|
||||
// animations for AT_Anim
|
||||
/*
|
||||
Unknowns:
|
||||
|
||||
Mounts?
|
||||
Ornamentations?
|
||||
GuildBanners?
|
||||
Collectible?
|
||||
Placeable?
|
||||
(others?)
|
||||
*/
|
||||
};
|
||||
|
||||
/*
|
||||
** Augmentation use type bitmasks (1-based)
|
||||
**
|
||||
** (ref: dbstr_us.txt)
|
||||
**
|
||||
*/
|
||||
enum AugmentationUseTypeBitmasks : uint32 {
|
||||
AugUseNone = 0x00000000,
|
||||
AugUseGeneralSingleStat = 0x00000001, /*1^16^1 (General: Single Stat)^0*/
|
||||
AugUseGeneralMultipleStat = 0x00000002, /*2^16^2 (General: Multiple Stat)^0*/
|
||||
AugUseGeneralSpellEffect = 0x00000004, /*3^16^3 (General: Spell Effect)^0*/
|
||||
AugUseWeaponGeneral = 0x00000008, /*4^16^4 (Weapon: General)^0*/
|
||||
AugUseWeaponElemDamage = 0x00000010, /*5^16^5 (Weapon: Elem Damage)^0*/
|
||||
AugUseWeaponBaseDamage = 0x00000020, /*6^16^6 (Weapon: Base Damage)^0*/
|
||||
AugUseGeneralGroup = 0x00000040, /*7^16^7 (General: Group)^0*/
|
||||
AugUseGeneralRaid = 0x00000080, /*8^16^8 (General: Raid)^0*/
|
||||
AugUseGeneralDragonsPoints = 0x00000100, /*9^16^9 (General: Dragons Points)^0*/
|
||||
AugUseCraftedCommon = 0x00000200, /*10^16^10 (Crafted: Common)^0*/
|
||||
AugUseCraftedGroup1 = 0x00000400, /*11^16^11 (Crafted: Group)^0*/
|
||||
AugUseCraftedRaid1 = 0x00000800, /*12^16^12 (Crafted: Raid)^0*/
|
||||
AugUseEnergeiacGroup = 0x00001000, /*13^16^13 (Energeiac: Group)^0*/
|
||||
AugUseEnergeiacRaid = 0x00002000, /*14^16^14 (Energeiac: Raid)^0*/
|
||||
AugUseEmblem = 0x00004000, /*15^16^15 (Emblem)^0*/
|
||||
AugUseCraftedGroup2 = 0x00008000, /*16^16^16 (Crafted: Group)^0*/
|
||||
AugUseCraftedRaid2 = 0x00010000, /*17^16^17 (Crafted: Raid)^0*/
|
||||
AugUseUnknown1 = 0x00020000, /*18^16^18^0*/
|
||||
AugUseUnknown2 = 0x00040000, /*19^16^19^0*/
|
||||
AugUseOrnamentation = 0x00080000, /*20^16^20 (Ornamentation)^0*/
|
||||
AugUseSpecialOrnamentation = 0x00100000, /*21^16^21 (Special Ornamentation)^0*/
|
||||
AugUseUnknown3 = 0x00200000, /*22^16^22^0*/
|
||||
AugUseUnknown4 = 0x00400000, /*23^16^23^0*/
|
||||
AugUseUnknown5 = 0x00800000, /*24^16^24^0*/
|
||||
AugUseUnknown6 = 0x01000000, /*25^16^25^0*/
|
||||
AugUseUnknown7 = 0x02000000, /*26^16^26^0*/
|
||||
AugUseUnknown8 = 0x04000000, /*27^16^27^0*/
|
||||
AugUseUnknown9 = 0x08000000, /*28^16^28^0*/
|
||||
AugUseUnknown10 = 0x10000000, /*29^16^29^0*/
|
||||
AugUseEpic25 = 0x20000000, /*30^16^30^0*/
|
||||
AugUseTest = 0x40000000, /*31^16^Test^0*/ // listed as 31^16^31^0 in 5-10 client
|
||||
AugUseAll = 0xFFFFFFFF
|
||||
};
|
||||
|
||||
/*
|
||||
** Augmentation use types (enumerated)
|
||||
**
|
||||
*/
|
||||
enum AugmentationUseTypes : uint8 {
|
||||
AugTypeNone = 0,
|
||||
AugTypeGeneralSingleStat,
|
||||
AugTypeGeneralMultipleStat,
|
||||
AugTypeGeneralSpellEffect,
|
||||
AugTypeWeaponGeneral,
|
||||
AugTypeWeaponElemDamage,
|
||||
AugTypeWeaponBaseDamage,
|
||||
AugTypeGeneralGroup,
|
||||
AugTypeGeneralRaid,
|
||||
AugTypeGeneralDragonsPoints,
|
||||
AugTypeCraftedCommon,
|
||||
AugTypeCraftedGroup1,
|
||||
AugTypeCraftedRaid1,
|
||||
AugTypeEnergeiacGroup,
|
||||
AugTypeEnergeiacRaid,
|
||||
AugTypeEmblem,
|
||||
AugTypeCraftedGroup2,
|
||||
AugTypeCraftedRaid2,
|
||||
AugTypeUnknown1,
|
||||
AugTypeUnknown2,
|
||||
AugTypeOrnamentation,
|
||||
AugTypeSpecialOrnamentation,
|
||||
AugTypeUnknown3,
|
||||
AugTypeUnknown4,
|
||||
AugTypeUnknown5,
|
||||
AugTypeUnknown6,
|
||||
AugTypeUnknown7,
|
||||
AugTypeUnknown8,
|
||||
AugTypeUnknown9,
|
||||
AugTypeUnknown10,
|
||||
AugTypeEpic25,
|
||||
AugTypeTest,
|
||||
_AugTypeCount,
|
||||
AugTypeAll = 255
|
||||
};
|
||||
|
||||
/*
|
||||
** Augmentation restriction types (in-work)
|
||||
**
|
||||
** (ref: eqstr_us.txt)
|
||||
**
|
||||
*/
|
||||
enum AugmentationRestrictionTypes : uint8 {
|
||||
/*4690*/ AugRestrAny = 0,
|
||||
/*9134*/ AugRestrArmor,
|
||||
/*9135*/ AugRestrWeapons,
|
||||
/*9136*/ AugRestr1HWeapons,
|
||||
/*9137*/ AugRestr2HWeapons,
|
||||
/*9138*/ AugRestr1HSlash,
|
||||
/*9139*/ AugRestr1HBlunt,
|
||||
/*9140*/ AugRestrPiercing,
|
||||
/*9148*/ AugRestrHandToHand,
|
||||
/*9141*/ AugRestr2HSlash,
|
||||
/*9142*/ AugRestr2HBlunt,
|
||||
/*9143*/ AugRestr2HPierce,
|
||||
/*9144*/ AugRestrBows,
|
||||
/*9145*/ AugRestrShields,
|
||||
/*8052*/ AugRestr1HSlash1HBluntOrHandToHand,
|
||||
/*9200*/ AugRestr1HBluntOrHandToHand, // no listed peq entries
|
||||
|
||||
// these three appear to be post-RoF (12-10-2012) and can not be verified until RoF (05-10-2013) is supported
|
||||
/*????*/ AugRestrUnknown1,
|
||||
/*????*/ AugRestrUnknown2,
|
||||
/*????*/ AugRestrUnknown3, // last value in peq entries
|
||||
_AugRestrCount
|
||||
|
||||
/*4687*/ //AugTypeAllItems, // ?? unknown atm
|
||||
/*4688*/ //AugTypePrestige, // ?? unknown atm
|
||||
/*4689*/ //AugTypeNonPrestige, // ?? unknown atm
|
||||
};
|
||||
|
||||
/*
|
||||
** Container use types
|
||||
**
|
||||
** This correlates to world 'object.type' (object.h/Object.cpp) as well as Item_Struct.BagType
|
||||
**
|
||||
** (ref: database, web forums and eqstr_us.txt)
|
||||
*/
|
||||
enum ContainerUseTypes : uint8
|
||||
{
|
||||
/*3400*/ BagTypeSmallBag = 0,
|
||||
/*3401*/ BagTypeLargeBag,
|
||||
/*3402*/ BagTypeQuiver,
|
||||
/*3403*/ BagTypeBeltPouch,
|
||||
/*3404*/ BagTypeWristPouch,
|
||||
/*3405*/ BagTypeBackPack,
|
||||
/*3406*/ BagTypeSmallChest,
|
||||
/*3407*/ BagTypeLargeChest,
|
||||
/*----*/ BagTypeBandolier, // <*Database Reference Only>
|
||||
/*3408*/ BagTypeMedicineBag,
|
||||
/*3409*/ BagTypeToolBox,
|
||||
/*3410*/ BagTypeLexicon,
|
||||
/*3411*/ BagTypeMortar,
|
||||
/*3412*/ BagTypeSelfDusting, // Quest container (Auto-clear contents?)
|
||||
/*3413*/ BagTypeMixingBowl,
|
||||
/*3414*/ BagTypeOven,
|
||||
/*3415*/ BagTypeSewingKit,
|
||||
/*3416*/ BagTypeForge,
|
||||
/*3417*/ BagTypeFletchingKit,
|
||||
/*3418*/ BagTypeBrewBarrel,
|
||||
/*3419*/ BagTypeJewelersKit,
|
||||
/*3420*/ BagTypePotteryWheel,
|
||||
/*3421*/ BagTypeKiln,
|
||||
/*3422*/ BagTypeKeymaker, // (no database entries as of peq rev 69)
|
||||
/*3423*/ BagTypeWizardsLexicon,
|
||||
/*3424*/ BagTypeMagesLexicon,
|
||||
/*3425*/ BagTypeNecromancersLexicon,
|
||||
/*3426*/ BagTypeEnchantersLexicon,
|
||||
/*----*/ BagTypeUnknown1, // (a coin pouch/purse?) (no database entries as of peq rev 69)
|
||||
/*----*/ BagTypeConcordanceofResearch, // <*Database Reference Only>
|
||||
/*3427*/ BagTypeAlwaysWorks, // Quest container (Never-fail combines?)
|
||||
/*3428*/ BagTypeKoadaDalForge, // High Elf
|
||||
/*3429*/ BagTypeTeirDalForge, // Dark Elf
|
||||
/*3430*/ BagTypeOggokForge, // Ogre
|
||||
/*3431*/ BagTypeStormguardForge, // Dwarf
|
||||
/*3432*/ BagTypeAkanonForge, // Gnome
|
||||
/*3433*/ BagTypeNorthmanForge, // Barbarian
|
||||
/*----*/ BagTypeUnknown2, // (no database entries as of peq rev 69)
|
||||
/*3434*/ BagTypeCabilisForge, // Iksar
|
||||
/*3435*/ BagTypeFreeportForge, // Human 1
|
||||
/*3436*/ BagTypeRoyalQeynosForge, // Human 2
|
||||
/*3439*/ BagTypeHalflingTailoringKit,
|
||||
/*3438*/ BagTypeErudTailoringKit,
|
||||
/*3440*/ BagTypeFierDalTailoringKit, // Wood Elf
|
||||
/*3441*/ BagTypeFierDalFletchingKit, // Wood Elf
|
||||
/*3437*/ BagTypeIksarPotteryWheel,
|
||||
/*3442*/ BagTypeTackleBox,
|
||||
/*3443*/ BagTypeTrollForge,
|
||||
/*3445*/ BagTypeFierDalForge, // Wood Elf
|
||||
/*3444*/ BagTypeValeForge, // Halfling
|
||||
/*3446*/ BagTypeErudForge,
|
||||
/*----*/ BagTypeTradersSatchel, // <*Database Reference Only> (db: Yellow Trader's Satchel Token?)
|
||||
/*5785*/ BagTypeGuktaForge, // Froglok (no database entries as of peq rev 69)
|
||||
/*3359*/ BagTypeAugmentationSealer,
|
||||
/*----*/ BagTypeIceCreamChurn, // <*Database Reference Only>
|
||||
/*6325*/ BagTypeTransformationmold, // Ornamentation
|
||||
/*6340*/ BagTypeDetransformationmold, // Ornamentation Stripper
|
||||
/*5400*/ BagTypeUnattuner,
|
||||
/*7684*/ BagTypeTradeskillBag,
|
||||
/*7692*/ BagTypeCollectibleBag,
|
||||
/*----*/ _BagTypeCount
|
||||
};
|
||||
|
||||
/*
|
||||
** Item Effect Types
|
||||
**
|
||||
*/
|
||||
enum {
|
||||
ET_CombatProc = 0,
|
||||
ET_ClickEffect = 1,
|
||||
ET_WornEffect = 2,
|
||||
ET_Expendable = 3,
|
||||
ET_EquipClick = 4,
|
||||
ET_ClickEffect2 = 5, //name unknown
|
||||
ET_Focus = 6,
|
||||
ET_Scroll = 7
|
||||
};
|
||||
|
||||
//SpawnAppearance types:
|
||||
#define AT_Die 0 // this causes the client to keel over and zone to bind point
|
||||
#define AT_WhoLevel 1 // the level that shows up on /who
|
||||
#define AT_Invis 3 // 0 = visible, 1 = invisible
|
||||
#define AT_PVP 4 // 0 = blue, 1 = pvp (red)
|
||||
#define AT_Light 5 // light type emitted by player (lightstone, shiny shield)
|
||||
#define AT_Anim 14 // 100=standing, 110=sitting, 111=ducking, 115=feigned, 105=looting
|
||||
#define AT_Sneak 15 // 0 = normal, 1 = sneaking
|
||||
#define AT_SpawnID 16 // server to client, sets player spawn id
|
||||
#define AT_HP 17 // Client->Server, my HP has changed (like regen tic)
|
||||
#define AT_Linkdead 18 // 0 = normal, 1 = linkdead
|
||||
#define AT_Levitate 19 // 0=off, 1=flymode, 2=levitate
|
||||
#define AT_GM 20 // 0 = normal, 1 = GM - all odd numbers seem to make it GM
|
||||
#define AT_Anon 21 // 0 = normal, 1 = anon, 2 = roleplay
|
||||
#define AT_GuildID 22
|
||||
#define AT_GuildRank 23 // 0=member, 1=officer, 2=leader
|
||||
#define AT_AFK 24 // 0 = normal, 1 = afk
|
||||
#define AT_Pet 25 // Param is EntityID of owner, or 0 for when charm breaks
|
||||
#define AT_Split 28 // 0 = normal, 1 = autosplit on
|
||||
#define AT_Size 29 // spawn's size
|
||||
#define AT_NPCName 31 // change PC's name's color to NPC color 0 = normal, 1 = npc name
|
||||
#define AT_ShowHelm 43 // 0 = do not show helmet graphic, 1 = show graphic
|
||||
#define AT_DamageState 44 // The damage state of a destructible object (0 through 4)
|
||||
//#define AT_Trader 300 // Bazzar Trader Mode
|
||||
|
||||
// solar: animations for AT_Anim
|
||||
#define ANIM_FREEZE 102
|
||||
#define ANIM_STAND 0x64
|
||||
#define ANIM_SIT 0x6e
|
||||
@@ -170,40 +471,15 @@ typedef enum {
|
||||
#define MT_StrikeThrough 339
|
||||
#define MT_Stun 340
|
||||
|
||||
// TODO: Really should combine above and below into one
|
||||
|
||||
//from showeq
|
||||
enum ChatColor
|
||||
{
|
||||
/*
|
||||
CC_Default = 0,
|
||||
CC_DarkGrey = 1,
|
||||
CC_DarkGreen = 2,
|
||||
CC_DarkBlue = 3,
|
||||
CC_Purple = 5,
|
||||
CC_LightGrey = 6,
|
||||
*/
|
||||
|
||||
CC_WhiteSmoke = 0, // FF|F0F0F0
|
||||
CC_Green = 2, // FF|008000
|
||||
CC_BrightBlue = 3, // FF|0040FF
|
||||
CC_Magenta = 5, // FF|F000F0
|
||||
CC_Gray = 6, // FF|808080
|
||||
CC_LightGray = 7, // FF|E0E0E0
|
||||
//CC_WhiteSmoke2 = 10, // FF|F0F0F0
|
||||
CC_DarkGray = 12, // FF|A0A0A0
|
||||
CC_Red = 13, // FF|F00000
|
||||
CC_Lime = 14, // FF|00F000
|
||||
CC_Yellow = 15, // FF|F0F000
|
||||
CC_Blue = 16, // FF|0000F0
|
||||
CC_LightNavy = 17, // FF|0000AF
|
||||
CC_Cyan = 18, // FF|00F0F0
|
||||
CC_Black = 20, // FF|000000
|
||||
|
||||
// any index <= 255 that is not defined above
|
||||
CC_DimGray = 1, // FF|606060
|
||||
CC_Default = 1,
|
||||
|
||||
CC_User_Say = 256,
|
||||
CC_User_Tell = 257,
|
||||
CC_User_Group = 258,
|
||||
@@ -399,7 +675,7 @@ static const uint8 DamageTypeUnknown = 0xFF;
|
||||
**
|
||||
** (indexed by 'Skill' of SkillUseTypes)
|
||||
*/
|
||||
static const uint8 SkillDamageTypes[EQEmu::skills::HIGHEST_SKILL + 1] = // change to _SkillServerArraySize once activated
|
||||
static const uint8 SkillDamageTypes[HIGHEST_SKILL + 1] = // change to _SkillServerArraySize once activated
|
||||
{
|
||||
/*1HBlunt*/ 0,
|
||||
/*1HSlashing*/ 1,
|
||||
@@ -475,10 +751,29 @@ static const uint8 SkillDamageTypes[EQEmu::skills::HIGHEST_SKILL + 1] = // chang
|
||||
/*Intimidation*/ DamageTypeUnknown,
|
||||
/*Berserking*/ DamageTypeUnknown,
|
||||
/*Taunt*/ DamageTypeUnknown,
|
||||
/*Frenzy*/ 74,
|
||||
/*RemoveTrap*/ DamageTypeUnknown, // Needs research (set for SenseTrap value)
|
||||
/*TripleAttack*/ DamageTypeUnknown, // Needs research (set for DoubleAttack value)
|
||||
/*2HPiercing*/ 36 // Needs research (set for 1HPiercing value - similar to slash/blunt)
|
||||
/*Frenzy*/ 74 //,
|
||||
// /*RemoveTrap*/ DamageTypeUnknown, // Needs research (set for SenseTrap value)
|
||||
// /*TripleAttack*/ DamageTypeUnknown, // Needs research (set for DoubleAttack value)
|
||||
// /*2HPiercing*/ 36 // Needs research (set for 1HPiercing value - similar to slash/blunt)
|
||||
};
|
||||
|
||||
/*
|
||||
** Material use slots
|
||||
**
|
||||
*/
|
||||
enum MaterialUseSlots : uint8
|
||||
{
|
||||
MaterialHead = 0,
|
||||
MaterialChest,
|
||||
MaterialArms,
|
||||
MaterialWrist,
|
||||
MaterialHands,
|
||||
MaterialLegs,
|
||||
MaterialFeet,
|
||||
MaterialPrimary,
|
||||
MaterialSecondary,
|
||||
_MaterialCount,
|
||||
_MaterialInvalid = 255
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -515,8 +810,186 @@ static const uint8 SkillDamageTypes[EQEmu::skills::HIGHEST_SKILL + 1] = // chang
|
||||
**
|
||||
*/
|
||||
|
||||
enum InventoryMapTypes : int16 {
|
||||
MapPossessions = 0,
|
||||
MapBank,
|
||||
MapSharedBank,
|
||||
MapTrade,
|
||||
MapWorld,
|
||||
MapLimbo,
|
||||
MapTribute,
|
||||
MapTrophyTribute,
|
||||
MapGuildTribute,
|
||||
MapMerchant,
|
||||
MapDeleted,
|
||||
MapCorpse,
|
||||
MapBazaar,
|
||||
MapInspect,
|
||||
MapRealEstate,
|
||||
MapViewMODPC,
|
||||
MapViewMODBank,
|
||||
MapViewMODSharedBank,
|
||||
MapViewMODLimbo,
|
||||
MapAltStorage,
|
||||
MapArchived,
|
||||
MapMail,
|
||||
MapGuildTrophyTribute,
|
||||
MapKrono,
|
||||
MapOther,
|
||||
_MapCount
|
||||
};
|
||||
|
||||
enum InventoryMainTypes : int16 {
|
||||
MainCharm = 0,
|
||||
MainEar1,
|
||||
MainHead,
|
||||
MainFace,
|
||||
MainEar2,
|
||||
MainNeck,
|
||||
MainShoulders,
|
||||
MainArms,
|
||||
MainBack,
|
||||
MainWrist1,
|
||||
MainWrist2,
|
||||
MainRange,
|
||||
MainHands,
|
||||
MainPrimary,
|
||||
MainSecondary,
|
||||
MainFinger1,
|
||||
MainFinger2,
|
||||
MainChest,
|
||||
MainLegs,
|
||||
MainFeet,
|
||||
MainWaist,
|
||||
MainPowerSource = 9999, // temp
|
||||
MainAmmo = 21, // temp
|
||||
MainGeneral1,
|
||||
MainGeneral2,
|
||||
MainGeneral3,
|
||||
MainGeneral4,
|
||||
MainGeneral5,
|
||||
MainGeneral6,
|
||||
MainGeneral7,
|
||||
MainGeneral8,
|
||||
//MainGeneral9,
|
||||
//MainGeneral10,
|
||||
MainCursor,
|
||||
_MainCount
|
||||
};
|
||||
|
||||
#define INVALID_INDEX -1
|
||||
#define NOT_USED 0
|
||||
#define NO_ITEM 0
|
||||
|
||||
// yes..these are redundant... but, they help to identify and define what is actually being performed
|
||||
// plus, since they're pre-op's, they don't affect the actual binary size
|
||||
#define MAP_BEGIN 0
|
||||
#define MAIN_BEGIN 0
|
||||
#define SUB_BEGIN 0
|
||||
#define AUG_BEGIN 0
|
||||
|
||||
namespace legacy {
|
||||
// this is for perl and other legacy systems
|
||||
|
||||
typedef enum {
|
||||
SLOT_CHARM = 0,
|
||||
SLOT_EAR01 = 1,
|
||||
SLOT_HEAD = 2,
|
||||
SLOT_FACE = 3,
|
||||
SLOT_EAR02 = 4,
|
||||
SLOT_NECK = 5,
|
||||
SLOT_SHOULDER = 6,
|
||||
SLOT_ARMS = 7,
|
||||
SLOT_BACK = 8,
|
||||
SLOT_BRACER01 = 9,
|
||||
SLOT_BRACER02 = 10,
|
||||
SLOT_RANGE = 11,
|
||||
SLOT_HANDS = 12,
|
||||
SLOT_PRIMARY = 13,
|
||||
SLOT_SECONDARY = 14,
|
||||
SLOT_RING01 = 15,
|
||||
SLOT_RING02 = 16,
|
||||
SLOT_CHEST = 17,
|
||||
SLOT_LEGS = 18,
|
||||
SLOT_FEET = 19,
|
||||
SLOT_WAIST = 20,
|
||||
SLOT_POWER_SOURCE = 9999,
|
||||
SLOT_AMMO = 21,
|
||||
SLOT_GENERAL_1 = 22,
|
||||
SLOT_GENERAL_2 = 23,
|
||||
SLOT_GENERAL_3 = 24,
|
||||
SLOT_GENERAL_4 = 25,
|
||||
SLOT_GENERAL_5 = 26,
|
||||
SLOT_GENERAL_6 = 27,
|
||||
SLOT_GENERAL_7 = 28,
|
||||
SLOT_GENERAL_8 = 29,
|
||||
//SLOT_GENERAL_9 = not supported
|
||||
//SLOT_GENERAL_10 = not supported
|
||||
SLOT_CURSOR = 30,
|
||||
SLOT_CURSOR_END = (int16)0xFFFE, // I hope no one is using this...
|
||||
SLOT_TRADESKILL = 1000,
|
||||
SLOT_AUGMENT = 1001,
|
||||
SLOT_INVALID = (int16)0xFFFF,
|
||||
|
||||
SLOT_POSSESSIONS_BEGIN = 0,
|
||||
SLOT_POSSESSIONS_END = 30,
|
||||
|
||||
SLOT_EQUIPMENT_BEGIN = 0,
|
||||
SLOT_EQUIPMENT_END = 21,
|
||||
|
||||
SLOT_PERSONAL_BEGIN = 22,
|
||||
SLOT_PERSONAL_END = 29,
|
||||
SLOT_PERSONAL_BAGS_BEGIN = 251,
|
||||
SLOT_PERSONAL_BAGS_END = 330,
|
||||
|
||||
SLOT_CURSOR_BAG_BEGIN = 331,
|
||||
SLOT_CURSOR_BAG_END = 340,
|
||||
|
||||
SLOT_TRIBUTE_BEGIN = 400,
|
||||
SLOT_TRIBUTE_END = 404,
|
||||
|
||||
SLOT_BANK_BEGIN = 2000,
|
||||
SLOT_BANK_END = 2023,
|
||||
SLOT_BANK_BAGS_BEGIN = 2031,
|
||||
SLOT_BANK_BAGS_END = 2270,
|
||||
|
||||
SLOT_SHARED_BANK_BEGIN = 2500,
|
||||
SLOT_SHARED_BANK_END = 2501,
|
||||
SLOT_SHARED_BANK_BAGS_BEGIN = 2531,
|
||||
SLOT_SHARED_BANK_BAGS_END = 2550,
|
||||
|
||||
SLOT_TRADE_BEGIN = 3000,
|
||||
SLOT_TRADE_END = 3007,
|
||||
SLOT_TRADE_BAGS_BEGIN = 3031,
|
||||
SLOT_TRADE_BAGS_END = 3110,
|
||||
|
||||
SLOT_WORLD_BEGIN = 4000,
|
||||
SLOT_WORLD_END = 4009
|
||||
} InventorySlot;
|
||||
}
|
||||
|
||||
#pragma pack(1) // will be used in packets as well as other inventory-related systems
|
||||
|
||||
struct ItemSlot_Struct
|
||||
{
|
||||
int16 indexMap;
|
||||
int16 unknown02;
|
||||
int16 indexMain;
|
||||
int16 indexSub;
|
||||
int16 indexAug;
|
||||
int16 unknown01;
|
||||
};
|
||||
|
||||
struct ItemSlotShort_Struct
|
||||
{
|
||||
int16 indexMain;
|
||||
int16 indexSub;
|
||||
int16 indexAug;
|
||||
int16 unknown01;
|
||||
};
|
||||
|
||||
#pragma pack()
|
||||
|
||||
static const uint32 MAX_SPELL_DB_ID_VAL = 65535;
|
||||
|
||||
#endif /*COMMON_EQ_CONSTANTS_H*/
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,211 @@
|
||||
/*
|
||||
EQEMu: Everquest Server Emulator
|
||||
|
||||
Copyright (C) 2001-2014 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
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; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#ifndef EQ_DICTIONARY_H
|
||||
#define EQ_DICTIONARY_H
|
||||
|
||||
#include "types.h"
|
||||
#include "eq_constants.h"
|
||||
#include "clientversions.h"
|
||||
#include <string>
|
||||
#include "../common/patches/client62_constants.h"
|
||||
#include "../common/patches/titanium_constants.h"
|
||||
#include "../common/patches/sof_constants.h"
|
||||
#include "../common/patches/sod_constants.h"
|
||||
#include "../common/patches/underfoot_constants.h"
|
||||
#include "../common/patches/rof_constants.h"
|
||||
#include "../common/patches/rof2_constants.h"
|
||||
|
||||
// *** DO NOT CHANGE without a full understanding of the consequences..the server is set up to use these settings explicitly!! ***
|
||||
// *** You will cause compilation failures and corrupt your database if partial or incorrect attempts to change them are made!! ***
|
||||
|
||||
// Hard-coded values usually indicate that further research is needed and the values given are from the old (known) system
|
||||
|
||||
// (future use)
|
||||
//using namespace RoF2::maps; // server inventory maps enumeration (code and database sync'd to reference)
|
||||
//using namespace RoF::slots; // server possessions slots enumeration (code and database sync'd to reference)
|
||||
|
||||
class EmuConstants {
|
||||
// an immutable value is required to initialize arrays, etc... use this class as a repository for those
|
||||
public:
|
||||
// database
|
||||
static const EQClientVersion CHARACTER_CREATION_CLIENT = EQClientRoF; // adjust according to starting item placement and target client
|
||||
|
||||
// inventory
|
||||
static uint16 InventoryMapSize(int16 map);
|
||||
//static std::string InventoryLocationName(Location_Struct location);
|
||||
static std::string InventoryMapName(int16 map);
|
||||
static std::string InventoryMainName(int16 main);
|
||||
static std::string InventorySubName(int16 sub);
|
||||
static std::string InventoryAugName(int16 aug);
|
||||
|
||||
// these are currently hard-coded for existing inventory system..do not use in place of special client version handlers until ready
|
||||
static const uint16 MAP_POSSESSIONS_SIZE = _MainCount;
|
||||
static const uint16 MAP_BANK_SIZE = 24;
|
||||
static const uint16 MAP_SHARED_BANK_SIZE = 2;
|
||||
static const uint16 MAP_TRADE_SIZE = 8;
|
||||
static const uint16 MAP_WORLD_SIZE = 10;
|
||||
static const uint16 MAP_LIMBO_SIZE = 36;
|
||||
static const uint16 MAP_TRIBUTE_SIZE = 5; // (need client values)
|
||||
static const uint16 MAP_TROPHY_TRIBUTE_SIZE = 0;
|
||||
static const uint16 MAP_GUILD_TRIBUTE_SIZE = 0;
|
||||
static const uint16 MAP_MERCHANT_SIZE = 0;
|
||||
static const uint16 MAP_DELETED_SIZE = 0;
|
||||
static const uint16 MAP_CORPSE_SIZE = _MainCount; // no bitmask use..limits to size of client corpse window (see EQLimits::InventoryMapSize(MapCorpse, <EQClientVersion))
|
||||
static const uint16 MAP_BAZAAR_SIZE = 80;
|
||||
static const uint16 MAP_INSPECT_SIZE = 22;
|
||||
static const uint16 MAP_REAL_ESTATE_SIZE = 0;
|
||||
static const uint16 MAP_VIEW_MOD_PC_SIZE = NOT_USED;
|
||||
static const uint16 MAP_VIEW_MOD_BANK_SIZE = NOT_USED;
|
||||
static const uint16 MAP_VIEW_MOD_SHARED_BANK_SIZE = NOT_USED;
|
||||
static const uint16 MAP_VIEW_MOD_LIMBO_SIZE = NOT_USED;
|
||||
static const uint16 MAP_ALT_STORAGE_SIZE = 0;
|
||||
static const uint16 MAP_ARCHIVED_SIZE = 0;
|
||||
static const uint16 MAP_MAIL_SIZE = 0;
|
||||
static const uint16 MAP_GUILD_TROPHY_TRIBUTE_SIZE = 0;
|
||||
static const uint16 MAP_KRONO_SIZE = 0;
|
||||
static const uint16 MAP_OTHER_SIZE = 0;
|
||||
|
||||
// most of these definitions will go away with the structure-based system..this maintains compatibility for now
|
||||
// (these are mainly to assign specific values to constants used in conversions and to identify per-client ranges/offsets)
|
||||
static const int16 EQUIPMENT_BEGIN = MainCharm;
|
||||
static const int16 EQUIPMENT_END = MainAmmo;
|
||||
static const uint16 EQUIPMENT_SIZE = 22; // does not account for 'Power Source' - used mainly for npc equipment arrays
|
||||
|
||||
static const int16 GENERAL_BEGIN = MainGeneral1;
|
||||
static const int16 GENERAL_END = MainGeneral8;
|
||||
static const uint16 GENERAL_SIZE = 8;
|
||||
static const int16 GENERAL_BAGS_BEGIN = 251;
|
||||
static const int16 GENERAL_BAGS_END_OFFSET = 79;
|
||||
static const int16 GENERAL_BAGS_END = GENERAL_BAGS_BEGIN + GENERAL_BAGS_END_OFFSET;
|
||||
|
||||
static const int16 CURSOR_BAG_BEGIN = 331;
|
||||
static const int16 CURSOR_BAG_END_OFFSET = 9;
|
||||
static const int16 CURSOR_BAG_END = CURSOR_BAG_BEGIN + CURSOR_BAG_END_OFFSET;
|
||||
|
||||
static const int16 BANK_BEGIN = 2000;
|
||||
static const int16 BANK_END = 2023;
|
||||
static const int16 BANK_BAGS_BEGIN = 2031;
|
||||
static const int16 BANK_BAGS_END_OFFSET = 239;
|
||||
static const int16 BANK_BAGS_END = BANK_BAGS_BEGIN + BANK_BAGS_END_OFFSET;
|
||||
|
||||
static const int16 SHARED_BANK_BEGIN = 2500;
|
||||
static const int16 SHARED_BANK_END = 2501;
|
||||
static const int16 SHARED_BANK_BAGS_BEGIN = 2531;
|
||||
static const int16 SHARED_BANK_BAGS_END_OFFSET = 19;
|
||||
static const int16 SHARED_BANK_BAGS_END = SHARED_BANK_BAGS_BEGIN + SHARED_BANK_BAGS_END_OFFSET;
|
||||
|
||||
static const int16 TRADE_BEGIN = 3000;
|
||||
static const int16 TRADE_END = 3007;
|
||||
static const int16 TRADE_NPC_END = 3003;
|
||||
static const int16 TRADE_BAGS_BEGIN = 3031;
|
||||
static const int16 TRADE_BAGS_END_OFFSET = 79;
|
||||
static const int16 TRADE_BAGS_END = TRADE_BAGS_BEGIN + TRADE_BAGS_END_OFFSET;
|
||||
|
||||
static const int16 WORLD_BEGIN = 4000;
|
||||
static const int16 WORLD_END = 4009;
|
||||
static const int16 WORLD_SIZE = MAP_WORLD_SIZE;
|
||||
|
||||
static const int16 TRIBUTE_BEGIN = 400;
|
||||
static const int16 TRIBUTE_END = 404;
|
||||
static const int16 TRIBUTE_SIZE = MAP_TRIBUTE_SIZE;
|
||||
|
||||
static const int16 CORPSE_BEGIN = 22;
|
||||
//static const int16 CORPSE_END = RoF::consts::CORPSE_END; // not ready for use
|
||||
|
||||
static const int16 MATERIAL_BEGIN = MaterialHead;
|
||||
static const int16 MATERIAL_END = MaterialSecondary;
|
||||
static const int16 MATERIAL_TINT_END = MaterialFeet;
|
||||
static const int16 MATERIAL_SIZE = _MaterialCount;
|
||||
|
||||
// items
|
||||
// common and container sizes will not increase until the new 'location' struct is implemented
|
||||
static const uint16 ITEM_COMMON_SIZE = Underfoot::consts::ITEM_COMMON_SIZE;
|
||||
static const uint16 ITEM_CONTAINER_SIZE = Underfoot::consts::ITEM_CONTAINER_SIZE;
|
||||
|
||||
// player profile
|
||||
//static const uint32 CLASS_BITMASK = 0; // needs value
|
||||
//static const uint32 RACE_BITMASK = 0; // needs value
|
||||
|
||||
// BANDOLIERS_COUNT sets maximum limit..active limit will need to be handled by the appropriate AA
|
||||
static const uint32 BANDOLIERS_COUNT = Titanium::consts::BANDOLIERS_COUNT; // count = number of bandolier instances
|
||||
static const uint32 BANDOLIER_SIZE = Titanium::consts::BANDOLIER_SIZE; // size = number of equipment slots in bandolier instance
|
||||
static const uint32 POTION_BELT_SIZE = Titanium::consts::POTION_BELT_SIZE;
|
||||
|
||||
// legacy-related functions
|
||||
//static int ServerToPerlSlot(int slot); // encode
|
||||
//static int PerlToServerSlot(int slot); // decode
|
||||
};
|
||||
|
||||
class EQLimits {
|
||||
// values should default to a non-beneficial value..unless value conflicts with intended operation
|
||||
//
|
||||
// EmuConstants may be used as references..but, not every reference needs to be in EmuConstants (i.e., AllowsEmptyBagInBag(), CoinHasWeight(), etc...)
|
||||
public:
|
||||
// client version validation (checks to avoid crashing zone server when accessing reference arrays)
|
||||
// use this inside of class Client (limits to actual clients)
|
||||
static bool IsValidClientVersion(uint32 version);
|
||||
static uint32 ValidateClientVersion(uint32 version);
|
||||
static EQClientVersion ValidateClientVersion(EQClientVersion version);
|
||||
|
||||
// basically..any non-client classes - do not when setting a valid client
|
||||
static bool IsValidNPCVersion(uint32 version);
|
||||
static uint32 ValidateNPCVersion(uint32 version);
|
||||
static EQClientVersion ValidateNPCVersion(EQClientVersion version);
|
||||
|
||||
// these are 'universal' - do not when setting a valid client
|
||||
static bool IsValidMobVersion(uint32 version);
|
||||
static uint32 ValidateMobVersion(uint32 version);
|
||||
static EQClientVersion ValidateMobVersion(EQClientVersion version);
|
||||
|
||||
// inventory
|
||||
static uint16 InventoryMapSize(int16 map, uint32 version);
|
||||
static uint64 PossessionsBitmask(uint32 version);
|
||||
static uint64 EquipmentBitmask(uint32 version);
|
||||
static uint64 GeneralBitmask(uint32 version);
|
||||
static uint64 CursorBitmask(uint32 version);
|
||||
|
||||
static bool AllowsEmptyBagInBag(uint32 version);
|
||||
static bool AllowsClickCastFromBag(uint32 version);
|
||||
|
||||
// items
|
||||
static uint16 ItemCommonSize(uint32 version);
|
||||
static uint16 ItemContainerSize(uint32 version);
|
||||
|
||||
// player profile
|
||||
static bool CoinHasWeight(uint32 version);
|
||||
|
||||
static uint32 BandoliersCount(uint32 version);
|
||||
static uint32 BandolierSize(uint32 version);
|
||||
|
||||
static uint32 PotionBeltSize(uint32 version);
|
||||
};
|
||||
|
||||
#endif /* EQ_LIMITS_H */
|
||||
|
||||
/*
|
||||
Working Notes:
|
||||
--------------
|
||||
|
||||
- full review of client_packet.cpp and client translators needed
|
||||
|
||||
|
||||
*/
|
||||
@@ -1,983 +0,0 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
|
||||
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
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; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "emu_constants.h"
|
||||
#include "emu_limits.h"
|
||||
|
||||
|
||||
static const EQEmu::constants::LookupEntry constants_lookup_entries[EQEmu::versions::ClientVersionCount] =
|
||||
{
|
||||
{
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null
|
||||
},
|
||||
{
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null
|
||||
},
|
||||
{
|
||||
Titanium::constants::CharacterCreationLimit,
|
||||
Titanium::constants::LongBuffs,
|
||||
Titanium::constants::ShortBuffs,
|
||||
Titanium::constants::DiscBuffs,
|
||||
Titanium::constants::TotalBuffs,
|
||||
Titanium::constants::NPCBuffs,
|
||||
Titanium::constants::PetBuffs,
|
||||
Titanium::constants::MercBuffs
|
||||
},
|
||||
{
|
||||
SoF::constants::CharacterCreationLimit,
|
||||
SoF::constants::LongBuffs,
|
||||
SoF::constants::ShortBuffs,
|
||||
SoF::constants::DiscBuffs,
|
||||
SoF::constants::TotalBuffs,
|
||||
SoF::constants::NPCBuffs,
|
||||
SoF::constants::PetBuffs,
|
||||
SoF::constants::MercBuffs
|
||||
},
|
||||
{
|
||||
SoD::constants::CharacterCreationLimit,
|
||||
SoD::constants::LongBuffs,
|
||||
SoD::constants::ShortBuffs,
|
||||
SoD::constants::DiscBuffs,
|
||||
SoD::constants::TotalBuffs,
|
||||
SoD::constants::NPCBuffs,
|
||||
SoD::constants::PetBuffs,
|
||||
SoD::constants::MercBuffs
|
||||
},
|
||||
{
|
||||
UF::constants::CharacterCreationLimit,
|
||||
UF::constants::LongBuffs,
|
||||
UF::constants::ShortBuffs,
|
||||
UF::constants::DiscBuffs,
|
||||
UF::constants::TotalBuffs,
|
||||
UF::constants::NPCBuffs,
|
||||
UF::constants::PetBuffs,
|
||||
UF::constants::MercBuffs
|
||||
},
|
||||
{
|
||||
RoF::constants::CharacterCreationLimit,
|
||||
RoF::constants::LongBuffs,
|
||||
RoF::constants::ShortBuffs,
|
||||
RoF::constants::DiscBuffs,
|
||||
RoF::constants::TotalBuffs,
|
||||
RoF::constants::NPCBuffs,
|
||||
RoF::constants::PetBuffs,
|
||||
RoF::constants::MercBuffs
|
||||
},
|
||||
{
|
||||
RoF2::constants::CharacterCreationLimit,
|
||||
RoF2::constants::LongBuffs,
|
||||
RoF2::constants::ShortBuffs,
|
||||
RoF2::constants::DiscBuffs,
|
||||
RoF2::constants::TotalBuffs,
|
||||
RoF2::constants::NPCBuffs,
|
||||
RoF2::constants::PetBuffs,
|
||||
RoF2::constants::MercBuffs
|
||||
}
|
||||
};
|
||||
|
||||
const EQEmu::constants::LookupEntry* EQEmu::constants::Lookup(versions::ClientVersion client_version)
|
||||
{
|
||||
return &constants_lookup_entries[static_cast<int>(versions::ValidateClientVersion(client_version))];
|
||||
}
|
||||
|
||||
static const EQEmu::inventory::LookupEntry inventory_lookup_entries[EQEmu::versions::MobVersionCount] =
|
||||
{
|
||||
{
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
|
||||
ClientUnknown::False,
|
||||
ClientUnknown::False,
|
||||
ClientUnknown::False,
|
||||
ClientUnknown::False
|
||||
},
|
||||
{
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
|
||||
Client62::False,
|
||||
Client62::False,
|
||||
Client62::False,
|
||||
Client62::False
|
||||
},
|
||||
{
|
||||
EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*Titanium::invtype::InvTypePossessionsSize,*/
|
||||
Titanium::invtype::InvTypeBankSize,
|
||||
Titanium::invtype::InvTypeSharedBankSize,
|
||||
Titanium::invtype::InvTypeTradeSize,
|
||||
Titanium::invtype::InvTypeWorldSize,
|
||||
Titanium::invtype::InvTypeLimboSize,
|
||||
Titanium::invtype::InvTypeTributeSize,
|
||||
Titanium::Null,
|
||||
Titanium::Null, /*Titanium::invtype::InvTypeGuildTributeSize,*/
|
||||
Titanium::invtype::InvTypeMerchantSize,
|
||||
Titanium::Null,
|
||||
Titanium::invtype::InvTypeCorpseSize,
|
||||
EQEmu::legacy::TYPE_BAZAAR_SIZE, /*Titanium::invtype::InvTypeBazaarSize,*/
|
||||
Titanium::invtype::InvTypeInspectSize,
|
||||
Titanium::Null,
|
||||
Titanium::invtype::InvTypeViewMODPCSize,
|
||||
Titanium::invtype::InvTypeViewMODBankSize,
|
||||
Titanium::invtype::InvTypeViewMODSharedBankSize,
|
||||
Titanium::invtype::InvTypeViewMODLimboSize,
|
||||
Titanium::invtype::InvTypeAltStorageSize,
|
||||
Titanium::invtype::InvTypeArchivedSize,
|
||||
Titanium::Null,
|
||||
Titanium::Null,
|
||||
Titanium::Null,
|
||||
Titanium::invtype::InvTypeOtherSize,
|
||||
|
||||
Titanium::Null, /*0x000000027FDFFFFF,*/
|
||||
EQEmu::inventory::ContainerCount, /*Titanium::invbag::ItemBagSize,*/
|
||||
EQEmu::inventory::SocketCount, /*Titanium::invaug::ItemAugSize,*/
|
||||
|
||||
Titanium::inventory::AllowEmptyBagInBag,
|
||||
Titanium::inventory::AllowClickCastFromBag,
|
||||
Titanium::inventory::ConcatenateInvTypeLimbo,
|
||||
Titanium::inventory::AllowOverLevelEquipment
|
||||
},
|
||||
{
|
||||
EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*SoF::invtype::InvTypePossessionsSize,*/
|
||||
SoF::invtype::InvTypeBankSize,
|
||||
SoF::invtype::InvTypeSharedBankSize,
|
||||
SoF::invtype::InvTypeTradeSize,
|
||||
SoF::invtype::InvTypeWorldSize,
|
||||
SoF::invtype::InvTypeLimboSize,
|
||||
SoF::invtype::InvTypeTributeSize,
|
||||
SoF::Null,
|
||||
SoF::Null, /*SoF::invtype::InvTypeGuildTributeSize,*/
|
||||
SoF::invtype::InvTypeMerchantSize,
|
||||
SoF::Null,
|
||||
SoF::invtype::InvTypeCorpseSize,
|
||||
EQEmu::legacy::TYPE_BAZAAR_SIZE, /*SoF::invtype::InvTypeBazaarSize,*/
|
||||
SoF::invtype::InvTypeInspectSize,
|
||||
SoF::Null,
|
||||
SoF::invtype::InvTypeViewMODPCSize,
|
||||
SoF::invtype::InvTypeViewMODBankSize,
|
||||
SoF::invtype::InvTypeViewMODSharedBankSize,
|
||||
SoF::invtype::InvTypeViewMODLimboSize,
|
||||
SoF::invtype::InvTypeAltStorageSize,
|
||||
SoF::invtype::InvTypeArchivedSize, SoF::Null, SoF::Null, SoF::Null, SoF::invtype::InvTypeOtherSize,
|
||||
|
||||
SoF::Null, /*0x000000027FFFFFFF,*/
|
||||
EQEmu::inventory::ContainerCount, /*SoF::invbag::ItemBagSize,*/
|
||||
EQEmu::inventory::SocketCount, /*SoF::invaug::ItemAugSize,*/
|
||||
|
||||
SoF::inventory::AllowEmptyBagInBag,
|
||||
SoF::inventory::AllowClickCastFromBag,
|
||||
SoF::inventory::ConcatenateInvTypeLimbo,
|
||||
SoF::inventory::AllowOverLevelEquipment
|
||||
},
|
||||
{
|
||||
EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*SoD::invtype::InvTypePossessionsSize,*/
|
||||
SoD::invtype::InvTypeBankSize,
|
||||
SoD::invtype::InvTypeSharedBankSize,
|
||||
SoD::invtype::InvTypeTradeSize,
|
||||
SoD::invtype::InvTypeWorldSize,
|
||||
SoD::invtype::InvTypeLimboSize,
|
||||
SoD::invtype::InvTypeTributeSize,
|
||||
SoD::Null,
|
||||
SoD::Null, /*SoD::invtype::InvTypeGuildTributeSize,*/
|
||||
SoD::invtype::InvTypeMerchantSize,
|
||||
SoD::Null,
|
||||
SoD::invtype::InvTypeCorpseSize,
|
||||
EQEmu::legacy::TYPE_BAZAAR_SIZE, /*SoD::invtype::InvTypeBazaarSize,*/
|
||||
SoD::invtype::InvTypeInspectSize,
|
||||
SoD::Null,
|
||||
SoD::invtype::InvTypeViewMODPCSize,
|
||||
SoD::invtype::InvTypeViewMODBankSize,
|
||||
SoD::invtype::InvTypeViewMODSharedBankSize,
|
||||
SoD::invtype::InvTypeViewMODLimboSize,
|
||||
SoD::invtype::InvTypeAltStorageSize,
|
||||
SoD::invtype::InvTypeArchivedSize,
|
||||
SoD::Null,
|
||||
SoD::Null,
|
||||
SoD::Null,
|
||||
SoD::invtype::InvTypeOtherSize,
|
||||
|
||||
SoD::Null, /*0x000000027FFFFFFF,*/
|
||||
EQEmu::inventory::ContainerCount, /*SoD::invbag::ItemBagSize,*/
|
||||
EQEmu::inventory::SocketCount, /*SoD::invaug::ItemAugSize,*/
|
||||
|
||||
SoD::inventory::AllowEmptyBagInBag,
|
||||
SoD::inventory::AllowClickCastFromBag,
|
||||
SoD::inventory::ConcatenateInvTypeLimbo,
|
||||
SoD::inventory::AllowOverLevelEquipment
|
||||
},
|
||||
{
|
||||
EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*UF::invtype::InvTypePossessionsSize,*/
|
||||
UF::invtype::InvTypeBankSize,
|
||||
UF::invtype::InvTypeSharedBankSize,
|
||||
UF::invtype::InvTypeTradeSize,
|
||||
UF::invtype::InvTypeWorldSize,
|
||||
UF::invtype::InvTypeLimboSize,
|
||||
UF::invtype::InvTypeTributeSize,
|
||||
UF::Null,
|
||||
UF::Null, /*UF::invtype::InvTypeGuildTributeSize,*/
|
||||
UF::invtype::InvTypeMerchantSize,
|
||||
UF::Null,
|
||||
UF::invtype::InvTypeCorpseSize,
|
||||
EQEmu::legacy::TYPE_BAZAAR_SIZE, /*UF::invtype::InvTypeBazaarSize,*/
|
||||
UF::invtype::InvTypeInspectSize,
|
||||
UF::Null,
|
||||
UF::invtype::InvTypeViewMODPCSize,
|
||||
UF::invtype::InvTypeViewMODBankSize,
|
||||
UF::invtype::InvTypeViewMODSharedBankSize,
|
||||
UF::invtype::InvTypeViewMODLimboSize,
|
||||
UF::invtype::InvTypeAltStorageSize,
|
||||
UF::invtype::InvTypeArchivedSize,
|
||||
UF::Null,
|
||||
UF::Null,
|
||||
UF::Null,
|
||||
UF::invtype::InvTypeOtherSize,
|
||||
|
||||
UF::Null, /*0x000000027FFFFFFF,*/
|
||||
EQEmu::inventory::ContainerCount, /*UF::invbag::ItemBagSize,*/
|
||||
EQEmu::inventory::SocketCount, /*UF::invaug::ItemAugSize,*/
|
||||
|
||||
UF::inventory::AllowEmptyBagInBag,
|
||||
UF::inventory::AllowClickCastFromBag,
|
||||
UF::inventory::ConcatenateInvTypeLimbo,
|
||||
UF::inventory::AllowOverLevelEquipment
|
||||
},
|
||||
{
|
||||
EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*RoF::invtype::InvTypePossessionsSize,*/
|
||||
RoF::invtype::InvTypeBankSize,
|
||||
RoF::invtype::InvTypeSharedBankSize,
|
||||
RoF::invtype::InvTypeTradeSize,
|
||||
RoF::invtype::InvTypeWorldSize,
|
||||
RoF::invtype::InvTypeLimboSize,
|
||||
RoF::invtype::InvTypeTributeSize,
|
||||
RoF::Null, /*RoF::invtype::InvTypeTrophyTributeSize,*/
|
||||
RoF::Null, /*RoF::invtype::InvTypeGuildTributeSize,*/
|
||||
RoF::invtype::InvTypeMerchantSize,
|
||||
RoF::Null, /*RoF::invtype::InvTypeDeletedSize,*/
|
||||
RoF::invtype::InvTypeCorpseSize,
|
||||
EQEmu::legacy::TYPE_BAZAAR_SIZE, /*RoF::invtype::InvTypeBazaarSize,*/
|
||||
RoF::invtype::InvTypeInspectSize,
|
||||
RoF::Null, /*RoF::invtype::InvTypeRealEstateSize,*/
|
||||
RoF::invtype::InvTypeViewMODPCSize,
|
||||
RoF::invtype::InvTypeViewMODBankSize,
|
||||
RoF::invtype::InvTypeViewMODSharedBankSize,
|
||||
RoF::invtype::InvTypeViewMODLimboSize,
|
||||
RoF::invtype::InvTypeAltStorageSize,
|
||||
RoF::invtype::InvTypeArchivedSize,
|
||||
RoF::invtype::InvTypeMailSize,
|
||||
RoF::invtype::InvTypeGuildTrophyTributeSize,
|
||||
RoF::Null,
|
||||
RoF::invtype::InvTypeOtherSize,
|
||||
|
||||
RoF::Null, /*0x00000003FFFFFFFF,*/
|
||||
EQEmu::inventory::ContainerCount, /*RoF::invbag::ItemBagSize,*/
|
||||
EQEmu::inventory::SocketCount, /*RoF::invaug::ItemAugSize,*/
|
||||
|
||||
RoF::False, /*RoF::inventory::AllowEmptyBagInBag,*/
|
||||
RoF::inventory::AllowClickCastFromBag,
|
||||
RoF::inventory::ConcatenateInvTypeLimbo,
|
||||
RoF::inventory::AllowOverLevelEquipment
|
||||
},
|
||||
{
|
||||
EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*RoF2::invtype::InvTypePossessionsSize,*/
|
||||
RoF2::invtype::InvTypeBankSize,
|
||||
RoF2::invtype::InvTypeSharedBankSize,
|
||||
RoF2::invtype::InvTypeTradeSize,
|
||||
RoF2::invtype::InvTypeWorldSize,
|
||||
RoF2::invtype::InvTypeLimboSize,
|
||||
RoF2::invtype::InvTypeTributeSize,
|
||||
RoF2::Null, /*RoF2::invtype::InvTypeTrophyTributeSize,*/
|
||||
RoF2::Null, /*RoF2::invtype::InvTypeGuildTributeSize,*/
|
||||
RoF2::invtype::InvTypeMerchantSize,
|
||||
RoF2::Null, /*RoF2::invtype::InvTypeDeletedSize,*/
|
||||
RoF2::invtype::InvTypeCorpseSize,
|
||||
EQEmu::legacy::TYPE_BAZAAR_SIZE, /*RoF2::invtype::InvTypeBazaarSize,*/
|
||||
RoF2::invtype::InvTypeInspectSize,
|
||||
RoF2::Null, /*RoF2::invtype::InvTypeRealEstateSize*/
|
||||
RoF2::invtype::InvTypeViewMODPCSize,
|
||||
RoF2::invtype::InvTypeViewMODBankSize,
|
||||
RoF2::invtype::InvTypeViewMODSharedBankSize,
|
||||
RoF2::invtype::InvTypeViewMODLimboSize,
|
||||
RoF2::invtype::InvTypeAltStorageSize,
|
||||
RoF2::invtype::InvTypeArchivedSize,
|
||||
RoF2::invtype::InvTypeMailSize,
|
||||
RoF2::invtype::InvTypeGuildTrophyTributeSize,
|
||||
RoF2::invtype::InvTypeKronoSize,
|
||||
RoF2::invtype::InvTypeOtherSize,
|
||||
|
||||
RoF2::Null, /*0x00000003FFFFFFFF,*/
|
||||
EQEmu::inventory::ContainerCount, /*RoF2::invbag::ItemBagSize,*/
|
||||
EQEmu::inventory::SocketCount, /*RoF2::invaug::ItemAugSize,*/
|
||||
|
||||
RoF2::False, /*RoF2::inventory::AllowEmptyBagInBag,*/
|
||||
RoF2::inventory::AllowClickCastFromBag,
|
||||
RoF2::inventory::ConcatenateInvTypeLimbo,
|
||||
RoF2::inventory::AllowOverLevelEquipment
|
||||
},
|
||||
{
|
||||
EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/
|
||||
EntityLimits::NPC::Null,
|
||||
EntityLimits::NPC::Null,
|
||||
EntityLimits::NPC::InvTypeTradeSize,
|
||||
EntityLimits::NPC::Null,
|
||||
EntityLimits::NPC::Null,
|
||||
EntityLimits::NPC::Null,
|
||||
EntityLimits::NPC::Null,
|
||||
EntityLimits::NPC::Null,
|
||||
EntityLimits::NPC::Null,
|
||||
EntityLimits::NPC::Null,
|
||||
EntityLimits::NPC::Null, /*InvTypeCorpseSize,*/
|
||||
EntityLimits::NPC::Null,
|
||||
EntityLimits::NPC::Null,
|
||||
EntityLimits::NPC::Null,
|
||||
EntityLimits::NPC::Null,
|
||||
EntityLimits::NPC::Null,
|
||||
EntityLimits::NPC::Null,
|
||||
EntityLimits::NPC::Null,
|
||||
EntityLimits::NPC::Null,
|
||||
EntityLimits::NPC::Null,
|
||||
EntityLimits::NPC::Null,
|
||||
EntityLimits::NPC::Null,
|
||||
EntityLimits::NPC::Null,
|
||||
EntityLimits::NPC::Null,
|
||||
|
||||
EntityLimits::NPC::Null,
|
||||
EQEmu::inventory::ContainerCount, /*ItemBagSize,*/
|
||||
EQEmu::inventory::SocketCount, /*ItemAugSize,*/
|
||||
|
||||
EntityLimits::NPC::False,
|
||||
EntityLimits::NPC::False,
|
||||
EntityLimits::NPC::False,
|
||||
EntityLimits::NPC::False
|
||||
},
|
||||
{
|
||||
EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/
|
||||
EntityLimits::NPCMerchant::Null,
|
||||
EntityLimits::NPCMerchant::Null,
|
||||
EntityLimits::NPCMerchant::InvTypeTradeSize,
|
||||
EntityLimits::NPCMerchant::Null,
|
||||
EntityLimits::NPCMerchant::Null,
|
||||
EntityLimits::NPCMerchant::Null,
|
||||
EntityLimits::NPCMerchant::Null,
|
||||
EntityLimits::NPCMerchant::Null,
|
||||
EntityLimits::NPCMerchant::Null,
|
||||
EntityLimits::NPCMerchant::Null,
|
||||
EntityLimits::NPCMerchant::Null, /*InvTypeCorpseSize,*/
|
||||
EntityLimits::NPCMerchant::Null,
|
||||
EntityLimits::NPCMerchant::Null,
|
||||
EntityLimits::NPCMerchant::Null,
|
||||
EntityLimits::NPCMerchant::Null,
|
||||
EntityLimits::NPCMerchant::Null,
|
||||
EntityLimits::NPCMerchant::Null,
|
||||
EntityLimits::NPCMerchant::Null,
|
||||
EntityLimits::NPCMerchant::Null,
|
||||
EntityLimits::NPCMerchant::Null,
|
||||
EntityLimits::NPCMerchant::Null,
|
||||
EntityLimits::NPCMerchant::Null,
|
||||
EntityLimits::NPCMerchant::Null,
|
||||
EntityLimits::NPCMerchant::Null,
|
||||
|
||||
EntityLimits::NPCMerchant::Null,
|
||||
EQEmu::inventory::ContainerCount, /*ItemBagSize,*/
|
||||
EQEmu::inventory::SocketCount, /*ItemAugSize,*/
|
||||
|
||||
EntityLimits::NPCMerchant::False,
|
||||
EntityLimits::NPCMerchant::False,
|
||||
EntityLimits::NPCMerchant::False,
|
||||
EntityLimits::NPCMerchant::False
|
||||
},
|
||||
{
|
||||
EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/
|
||||
EntityLimits::Merc::Null,
|
||||
EntityLimits::Merc::Null,
|
||||
EntityLimits::Merc::InvTypeTradeSize,
|
||||
EntityLimits::Merc::Null,
|
||||
EntityLimits::Merc::Null,
|
||||
EntityLimits::Merc::Null,
|
||||
EntityLimits::Merc::Null,
|
||||
EntityLimits::Merc::Null,
|
||||
EntityLimits::Merc::Null,
|
||||
EntityLimits::Merc::Null,
|
||||
EntityLimits::Merc::Null, /*InvTypeCorpseSize,*/
|
||||
EntityLimits::Merc::Null,
|
||||
EntityLimits::Merc::Null,
|
||||
EntityLimits::Merc::Null,
|
||||
EntityLimits::Merc::Null,
|
||||
EntityLimits::Merc::Null,
|
||||
EntityLimits::Merc::Null,
|
||||
EntityLimits::Merc::Null,
|
||||
EntityLimits::Merc::Null,
|
||||
EntityLimits::Merc::Null,
|
||||
EntityLimits::Merc::Null,
|
||||
EntityLimits::Merc::Null,
|
||||
EntityLimits::Merc::Null,
|
||||
EntityLimits::Merc::Null,
|
||||
|
||||
EntityLimits::Merc::Null,
|
||||
EQEmu::inventory::ContainerCount, /*ItemBagSize,*/
|
||||
EQEmu::inventory::SocketCount, /*ItemAugSize,*/
|
||||
|
||||
EntityLimits::Merc::False,
|
||||
EntityLimits::Merc::False,
|
||||
EntityLimits::Merc::False,
|
||||
EntityLimits::Merc::False
|
||||
},
|
||||
{
|
||||
EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/
|
||||
EntityLimits::Bot::Null,
|
||||
EntityLimits::Bot::Null,
|
||||
EntityLimits::Bot::InvTypeTradeSize,
|
||||
EntityLimits::Bot::Null,
|
||||
EntityLimits::Bot::Null,
|
||||
EntityLimits::Bot::Null,
|
||||
EntityLimits::Bot::Null,
|
||||
EntityLimits::Bot::Null,
|
||||
EntityLimits::Bot::Null,
|
||||
EntityLimits::Bot::Null,
|
||||
EntityLimits::Bot::Null, /*InvTypeCorpseSize,*/
|
||||
EntityLimits::Bot::Null,
|
||||
EntityLimits::Bot::Null,
|
||||
EntityLimits::Bot::Null,
|
||||
EntityLimits::Bot::Null,
|
||||
EntityLimits::Bot::Null,
|
||||
EntityLimits::Bot::Null,
|
||||
EntityLimits::Bot::Null,
|
||||
EntityLimits::Bot::Null,
|
||||
EntityLimits::Bot::Null,
|
||||
EntityLimits::Bot::Null,
|
||||
EntityLimits::Bot::Null,
|
||||
EntityLimits::Bot::Null,
|
||||
EntityLimits::Bot::Null,
|
||||
|
||||
EntityLimits::Bot::Null,
|
||||
EQEmu::inventory::ContainerCount, /*ItemBagSize,*/
|
||||
EQEmu::inventory::SocketCount, /*ItemAugSize,*/
|
||||
|
||||
EntityLimits::Bot::False,
|
||||
EntityLimits::Bot::False,
|
||||
EntityLimits::Bot::False,
|
||||
EntityLimits::Bot::False
|
||||
},
|
||||
{
|
||||
EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/
|
||||
EntityLimits::ClientPet::Null,
|
||||
EntityLimits::ClientPet::Null,
|
||||
EntityLimits::ClientPet::InvTypeTradeSize,
|
||||
EntityLimits::ClientPet::Null,
|
||||
EntityLimits::ClientPet::Null,
|
||||
EntityLimits::ClientPet::Null,
|
||||
EntityLimits::ClientPet::Null,
|
||||
EntityLimits::ClientPet::Null,
|
||||
EntityLimits::ClientPet::Null,
|
||||
EntityLimits::ClientPet::Null,
|
||||
EntityLimits::ClientPet::Null, /*InvTypeCorpseSize,*/
|
||||
EntityLimits::ClientPet::Null,
|
||||
EntityLimits::ClientPet::Null,
|
||||
EntityLimits::ClientPet::Null,
|
||||
EntityLimits::ClientPet::Null,
|
||||
EntityLimits::ClientPet::Null,
|
||||
EntityLimits::ClientPet::Null,
|
||||
EntityLimits::ClientPet::Null,
|
||||
EntityLimits::ClientPet::Null,
|
||||
EntityLimits::ClientPet::Null,
|
||||
EntityLimits::ClientPet::Null,
|
||||
EntityLimits::ClientPet::Null,
|
||||
EntityLimits::ClientPet::Null,
|
||||
EntityLimits::ClientPet::Null,
|
||||
|
||||
EntityLimits::ClientPet::Null,
|
||||
EQEmu::inventory::ContainerCount, /*ItemBagSize,*/
|
||||
EQEmu::inventory::SocketCount, /*ItemAugSize,*/
|
||||
|
||||
EntityLimits::ClientPet::False,
|
||||
EntityLimits::ClientPet::False,
|
||||
EntityLimits::ClientPet::False,
|
||||
EntityLimits::ClientPet::False
|
||||
},
|
||||
{
|
||||
EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/
|
||||
EntityLimits::NPCPet::Null,
|
||||
EntityLimits::NPCPet::Null,
|
||||
EntityLimits::NPCPet::InvTypeTradeSize,
|
||||
EntityLimits::NPCPet::Null,
|
||||
EntityLimits::NPCPet::Null,
|
||||
EntityLimits::NPCPet::Null,
|
||||
EntityLimits::NPCPet::Null,
|
||||
EntityLimits::NPCPet::Null,
|
||||
EntityLimits::NPCPet::Null,
|
||||
EntityLimits::NPCPet::Null,
|
||||
EntityLimits::NPCPet::Null, /*InvTypeCorpseSize,*/
|
||||
EntityLimits::NPCPet::Null,
|
||||
EntityLimits::NPCPet::Null,
|
||||
EntityLimits::NPCPet::Null,
|
||||
EntityLimits::NPCPet::Null,
|
||||
EntityLimits::NPCPet::Null,
|
||||
EntityLimits::NPCPet::Null,
|
||||
EntityLimits::NPCPet::Null,
|
||||
EntityLimits::NPCPet::Null,
|
||||
EntityLimits::NPCPet::Null,
|
||||
EntityLimits::NPCPet::Null,
|
||||
EntityLimits::NPCPet::Null,
|
||||
EntityLimits::NPCPet::Null,
|
||||
EntityLimits::NPCPet::Null,
|
||||
|
||||
EntityLimits::NPCPet::Null,
|
||||
EQEmu::inventory::ContainerCount, /*ItemBagSize,*/
|
||||
EQEmu::inventory::SocketCount, /*ItemAugSize,*/
|
||||
|
||||
EntityLimits::NPCPet::False,
|
||||
EntityLimits::NPCPet::False,
|
||||
EntityLimits::NPCPet::False,
|
||||
EntityLimits::NPCPet::False
|
||||
},
|
||||
{
|
||||
EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/
|
||||
EntityLimits::MercPet::Null,
|
||||
EntityLimits::MercPet::Null,
|
||||
EntityLimits::MercPet::InvTypeTradeSize,
|
||||
EntityLimits::MercPet::Null,
|
||||
EntityLimits::MercPet::Null,
|
||||
EntityLimits::MercPet::Null,
|
||||
EntityLimits::MercPet::Null,
|
||||
EntityLimits::MercPet::Null,
|
||||
EntityLimits::MercPet::Null,
|
||||
EntityLimits::MercPet::Null,
|
||||
EntityLimits::MercPet::Null, /*InvTypeCorpseSize,*/
|
||||
EntityLimits::MercPet::Null,
|
||||
EntityLimits::MercPet::Null,
|
||||
EntityLimits::MercPet::Null,
|
||||
EntityLimits::MercPet::Null,
|
||||
EntityLimits::MercPet::Null,
|
||||
EntityLimits::MercPet::Null,
|
||||
EntityLimits::MercPet::Null,
|
||||
EntityLimits::MercPet::Null,
|
||||
EntityLimits::MercPet::Null,
|
||||
EntityLimits::MercPet::Null,
|
||||
EntityLimits::MercPet::Null,
|
||||
EntityLimits::MercPet::Null,
|
||||
EntityLimits::MercPet::Null,
|
||||
|
||||
EntityLimits::MercPet::Null,
|
||||
EQEmu::inventory::ContainerCount, /*ItemBagSize,*/
|
||||
EQEmu::inventory::SocketCount, /*ItemAugSize,*/
|
||||
|
||||
EntityLimits::MercPet::False,
|
||||
EntityLimits::MercPet::False,
|
||||
EntityLimits::MercPet::False,
|
||||
EntityLimits::MercPet::False
|
||||
},
|
||||
{
|
||||
EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/
|
||||
EntityLimits::BotPet::Null,
|
||||
EntityLimits::BotPet::Null,
|
||||
EntityLimits::BotPet::InvTypeTradeSize,
|
||||
EntityLimits::BotPet::Null,
|
||||
EntityLimits::BotPet::Null,
|
||||
EntityLimits::BotPet::Null,
|
||||
EntityLimits::BotPet::Null,
|
||||
EntityLimits::BotPet::Null,
|
||||
EntityLimits::BotPet::Null,
|
||||
EntityLimits::BotPet::Null,
|
||||
EntityLimits::BotPet::Null, /*InvTypeCorpseSize,*/
|
||||
EntityLimits::BotPet::Null,
|
||||
EntityLimits::BotPet::Null,
|
||||
EntityLimits::BotPet::Null,
|
||||
EntityLimits::BotPet::Null,
|
||||
EntityLimits::BotPet::Null,
|
||||
EntityLimits::BotPet::Null,
|
||||
EntityLimits::BotPet::Null,
|
||||
EntityLimits::BotPet::Null,
|
||||
EntityLimits::BotPet::Null,
|
||||
EntityLimits::BotPet::Null,
|
||||
EntityLimits::BotPet::Null,
|
||||
EntityLimits::BotPet::Null,
|
||||
EntityLimits::BotPet::Null,
|
||||
|
||||
EntityLimits::BotPet::Null,
|
||||
EQEmu::inventory::ContainerCount, /*ItemBagSize,*/
|
||||
EQEmu::inventory::SocketCount, /*ItemAugSize,*/
|
||||
|
||||
EntityLimits::BotPet::False,
|
||||
EntityLimits::BotPet::False,
|
||||
EntityLimits::BotPet::False,
|
||||
EntityLimits::BotPet::False
|
||||
},
|
||||
{ // OfflineTitanium
|
||||
Titanium::Null,
|
||||
Titanium::Null,
|
||||
Titanium::Null,
|
||||
Titanium::invtype::InvTypeTradeSize,
|
||||
Titanium::Null,
|
||||
Titanium::Null,
|
||||
Titanium::Null,
|
||||
Titanium::Null,
|
||||
Titanium::Null,
|
||||
Titanium::invtype::InvTypeMerchantSize,
|
||||
Titanium::Null,
|
||||
Titanium::Null,
|
||||
Titanium::Null, /*Titanium::invtype::InvTypeBazaarSize,*/
|
||||
Titanium::invtype::InvTypeInspectSize,
|
||||
Titanium::Null,
|
||||
Titanium::invtype::InvTypeViewMODPCSize,
|
||||
Titanium::invtype::InvTypeViewMODBankSize,
|
||||
Titanium::invtype::InvTypeViewMODSharedBankSize,
|
||||
Titanium::invtype::InvTypeViewMODLimboSize,
|
||||
Titanium::Null,
|
||||
Titanium::Null,
|
||||
Titanium::Null,
|
||||
Titanium::Null,
|
||||
Titanium::Null,
|
||||
Titanium::Null,
|
||||
|
||||
Titanium::Null,
|
||||
EQEmu::inventory::ContainerCount, /*Titanium::Null,*/
|
||||
Titanium::Null,
|
||||
|
||||
Titanium::False,
|
||||
Titanium::False,
|
||||
Titanium::False,
|
||||
Titanium::False
|
||||
},
|
||||
{ // OfflineSoF
|
||||
SoF::Null,
|
||||
SoF::Null,
|
||||
SoF::Null,
|
||||
SoF::invtype::InvTypeTradeSize,
|
||||
SoF::Null,
|
||||
SoF::Null,
|
||||
SoF::Null,
|
||||
SoF::Null,
|
||||
SoF::Null,
|
||||
SoF::invtype::InvTypeMerchantSize,
|
||||
SoF::Null,
|
||||
SoF::Null,
|
||||
SoF::Null, /*SoF::invtype::InvTypeBazaarSize,*/
|
||||
SoF::invtype::InvTypeInspectSize,
|
||||
SoF::Null,
|
||||
SoF::invtype::InvTypeViewMODPCSize,
|
||||
SoF::invtype::InvTypeViewMODBankSize,
|
||||
SoF::invtype::InvTypeViewMODSharedBankSize,
|
||||
SoF::invtype::InvTypeViewMODLimboSize,
|
||||
SoF::Null,
|
||||
SoF::Null,
|
||||
SoF::Null,
|
||||
SoF::Null,
|
||||
SoF::Null,
|
||||
SoF::Null,
|
||||
|
||||
SoF::Null,
|
||||
EQEmu::inventory::ContainerCount, /*SoF::Null,*/
|
||||
SoF::Null,
|
||||
|
||||
SoF::False,
|
||||
SoF::False,
|
||||
SoF::False,
|
||||
SoF::False
|
||||
},
|
||||
{ // OfflineSoD
|
||||
SoD::Null,
|
||||
SoD::Null,
|
||||
SoD::Null,
|
||||
SoD::invtype::InvTypeTradeSize,
|
||||
SoD::Null,
|
||||
SoD::Null,
|
||||
SoD::Null,
|
||||
SoD::Null,
|
||||
SoD::Null,
|
||||
SoD::invtype::InvTypeMerchantSize,
|
||||
SoD::Null,
|
||||
SoD::Null,
|
||||
SoD::Null, /*SoD::invtype::InvTypeBazaarSize,*/
|
||||
SoD::invtype::InvTypeInspectSize,
|
||||
SoD::Null,
|
||||
SoD::invtype::InvTypeViewMODPCSize,
|
||||
SoD::invtype::InvTypeViewMODBankSize,
|
||||
SoD::invtype::InvTypeViewMODSharedBankSize,
|
||||
SoD::invtype::InvTypeViewMODLimboSize,
|
||||
SoD::Null,
|
||||
SoD::Null,
|
||||
SoD::Null,
|
||||
SoD::Null,
|
||||
SoD::Null,
|
||||
SoD::Null,
|
||||
|
||||
SoD::Null,
|
||||
EQEmu::inventory::ContainerCount, /*SoD::Null,*/
|
||||
SoD::Null,
|
||||
|
||||
SoD::False,
|
||||
SoD::False,
|
||||
SoD::False,
|
||||
SoD::False
|
||||
},
|
||||
{ // OfflineUF
|
||||
UF::Null,
|
||||
UF::Null,
|
||||
UF::Null,
|
||||
UF::invtype::InvTypeTradeSize,
|
||||
UF::Null,
|
||||
UF::Null,
|
||||
UF::Null,
|
||||
UF::Null,
|
||||
UF::Null,
|
||||
UF::invtype::InvTypeMerchantSize,
|
||||
UF::Null,
|
||||
UF::Null,
|
||||
UF::Null, /*UF::invtype::InvTypeBazaarSize,*/
|
||||
UF::invtype::InvTypeInspectSize,
|
||||
UF::Null,
|
||||
UF::invtype::InvTypeViewMODPCSize,
|
||||
UF::invtype::InvTypeViewMODBankSize,
|
||||
UF::invtype::InvTypeViewMODSharedBankSize,
|
||||
UF::invtype::InvTypeViewMODLimboSize,
|
||||
UF::Null,
|
||||
UF::Null,
|
||||
UF::Null,
|
||||
UF::Null,
|
||||
UF::Null,
|
||||
UF::Null,
|
||||
|
||||
UF::Null,
|
||||
EQEmu::inventory::ContainerCount, /*UF::Null,*/
|
||||
UF::Null,
|
||||
|
||||
UF::False,
|
||||
UF::False,
|
||||
UF::False,
|
||||
UF::False
|
||||
},
|
||||
{ // OfflineRoF
|
||||
RoF::Null,
|
||||
RoF::Null,
|
||||
RoF::Null,
|
||||
RoF::invtype::InvTypeTradeSize,
|
||||
RoF::Null,
|
||||
RoF::Null,
|
||||
RoF::Null,
|
||||
RoF::Null,
|
||||
RoF::Null,
|
||||
RoF::invtype::InvTypeMerchantSize,
|
||||
RoF::Null,
|
||||
RoF::Null,
|
||||
RoF::Null, /*RoF::invtype::InvTypeBazaarSize,*/
|
||||
RoF::invtype::InvTypeInspectSize,
|
||||
RoF::Null,
|
||||
RoF::invtype::InvTypeViewMODPCSize,
|
||||
RoF::invtype::InvTypeViewMODBankSize,
|
||||
RoF::invtype::InvTypeViewMODSharedBankSize,
|
||||
RoF::invtype::InvTypeViewMODLimboSize,
|
||||
RoF::Null,
|
||||
RoF::Null,
|
||||
RoF::Null,
|
||||
RoF::Null,
|
||||
RoF::Null,
|
||||
RoF::Null,
|
||||
|
||||
RoF::Null,
|
||||
EQEmu::inventory::ContainerCount, /*RoF::Null,*/
|
||||
RoF::Null,
|
||||
|
||||
RoF::False,
|
||||
RoF::False,
|
||||
RoF::False,
|
||||
RoF::False
|
||||
},
|
||||
{ // OfflineRoF2
|
||||
RoF2::Null,
|
||||
RoF2::Null,
|
||||
RoF2::Null,
|
||||
RoF2::invtype::InvTypeTradeSize,
|
||||
RoF2::Null,
|
||||
RoF2::Null,
|
||||
RoF2::Null,
|
||||
RoF2::Null,
|
||||
RoF2::Null,
|
||||
RoF2::invtype::InvTypeMerchantSize,
|
||||
RoF2::Null,
|
||||
RoF2::Null,
|
||||
RoF2::Null, /*RoF2::invtype::InvTypeBazaarSize,*/
|
||||
RoF2::invtype::InvTypeInspectSize,
|
||||
RoF2::Null,
|
||||
RoF2::invtype::InvTypeViewMODPCSize,
|
||||
RoF2::invtype::InvTypeViewMODBankSize,
|
||||
RoF2::invtype::InvTypeViewMODSharedBankSize,
|
||||
RoF2::invtype::InvTypeViewMODLimboSize,
|
||||
RoF2::Null,
|
||||
RoF2::Null,
|
||||
RoF2::Null,
|
||||
RoF2::Null,
|
||||
RoF2::Null,
|
||||
RoF2::Null,
|
||||
|
||||
RoF2::Null,
|
||||
EQEmu::inventory::ContainerCount, /*RoF2::Null,*/
|
||||
RoF2::Null,
|
||||
|
||||
RoF2::False,
|
||||
RoF2::False,
|
||||
RoF2::False,
|
||||
RoF2::False
|
||||
}
|
||||
};
|
||||
|
||||
const EQEmu::inventory::LookupEntry* EQEmu::inventory::Lookup(versions::MobVersion mob_version)
|
||||
{
|
||||
return &inventory_lookup_entries[static_cast<int>(versions::ValidateMobVersion(mob_version))];
|
||||
}
|
||||
|
||||
static const EQEmu::behavior::LookupEntry behavior_lookup_entries[EQEmu::versions::MobVersionCount] =
|
||||
{
|
||||
{ // Unknown
|
||||
ClientUnknown::True
|
||||
},
|
||||
{ // Client62
|
||||
Client62::True
|
||||
},
|
||||
{ // Titanium
|
||||
Titanium::behavior::CoinHasWeight
|
||||
},
|
||||
{ // SoF
|
||||
SoF::behavior::CoinHasWeight
|
||||
},
|
||||
{ // SoD
|
||||
SoD::behavior::CoinHasWeight
|
||||
},
|
||||
{ // UF
|
||||
UF::behavior::CoinHasWeight
|
||||
},
|
||||
{ // RoF
|
||||
RoF::behavior::CoinHasWeight
|
||||
},
|
||||
{ // RoF2
|
||||
RoF2::behavior::CoinHasWeight
|
||||
},
|
||||
{ // NPC
|
||||
EntityLimits::NPC::True /*CoinHasWeight*/
|
||||
},
|
||||
{ // NPCMerchant
|
||||
EntityLimits::NPC::True /*CoinHasWeight*/
|
||||
},
|
||||
{ // Merc
|
||||
EntityLimits::Merc::True /*CoinHasWeight*/
|
||||
},
|
||||
{ // Bot
|
||||
EntityLimits::Bot::True /*CoinHasWeight*/
|
||||
},
|
||||
{ // ClientPet
|
||||
EntityLimits::ClientPet::True /*CoinHasWeight*/
|
||||
},
|
||||
{ // NPCPet
|
||||
EntityLimits::NPCPet::True /*CoinHasWeight*/
|
||||
},
|
||||
{ // MercPet
|
||||
EntityLimits::MercPet::True /*CoinHasWeight*/
|
||||
},
|
||||
{ // BotPet
|
||||
EntityLimits::BotPet::True /*CoinHasWeight*/
|
||||
},
|
||||
{ // OfflineTitanium
|
||||
Titanium::False
|
||||
},
|
||||
{ // OfflineSoF
|
||||
SoF::False
|
||||
},
|
||||
{ // OfflineSoD
|
||||
SoD::False
|
||||
},
|
||||
{ // OfflineUF
|
||||
UF::False
|
||||
},
|
||||
{ // OfflineRoF
|
||||
RoF::False
|
||||
},
|
||||
{ // OfflineRoF2
|
||||
RoF2::False
|
||||
}
|
||||
};
|
||||
|
||||
const EQEmu::behavior::LookupEntry* EQEmu::behavior::Lookup(versions::MobVersion mob_version)
|
||||
{
|
||||
return &behavior_lookup_entries[static_cast<int>(versions::ValidateMobVersion(mob_version))];
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
|
||||
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
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; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef COMMON_EQ_LIMITS_H
|
||||
#define COMMON_EQ_LIMITS_H
|
||||
|
||||
#include "emu_legacy.h"
|
||||
#include "types.h"
|
||||
#include "eq_constants.h"
|
||||
#include "emu_versions.h"
|
||||
#include "../common/patches/titanium_limits.h"
|
||||
#include "../common/patches/sof_limits.h"
|
||||
#include "../common/patches/sod_limits.h"
|
||||
#include "../common/patches/uf_limits.h"
|
||||
#include "../common/patches/rof_limits.h"
|
||||
#include "../common/patches/rof2_limits.h"
|
||||
|
||||
|
||||
namespace EQEmu
|
||||
{
|
||||
namespace constants {
|
||||
class LookupEntry {
|
||||
public:
|
||||
size_t CharacterCreationLimit;
|
||||
int LongBuffs;
|
||||
int ShortBuffs;
|
||||
int DiscBuffs;
|
||||
int TotalBuffs;
|
||||
int NPCBuffs;
|
||||
int PetBuffs;
|
||||
int MercBuffs;
|
||||
};
|
||||
|
||||
const LookupEntry* Lookup(versions::ClientVersion client_version);
|
||||
|
||||
} /*constants*/
|
||||
|
||||
namespace inventory {
|
||||
class LookupEntry {
|
||||
public:
|
||||
size_t InventoryTypeSize[25]; // should reflect EQEmu::inventory::typeCount referenced in emu_constants.h
|
||||
|
||||
uint64 PossessionsBitmask;
|
||||
size_t ItemBagSize;
|
||||
size_t ItemAugSize;
|
||||
|
||||
bool AllowEmptyBagInBag;
|
||||
bool AllowClickCastFromBag;
|
||||
bool ConcatenateInvTypeLimbo;
|
||||
bool AllowOverLevelEquipment;
|
||||
};
|
||||
|
||||
const LookupEntry* Lookup(versions::MobVersion mob_version);
|
||||
|
||||
} /*inventory*/
|
||||
|
||||
namespace behavior {
|
||||
class LookupEntry {
|
||||
public:
|
||||
bool CoinHasWeight;
|
||||
};
|
||||
|
||||
const LookupEntry* Lookup(versions::MobVersion mob_version);
|
||||
|
||||
} /*behavior*/
|
||||
|
||||
} /*EQEmu*/
|
||||
|
||||
namespace ClientUnknown
|
||||
{
|
||||
enum : int { Invalid = -1, Null, Safety };
|
||||
|
||||
enum : bool { False = false, True = true };
|
||||
|
||||
} /*ClientUnknown*/
|
||||
|
||||
namespace Client62
|
||||
{
|
||||
enum : int { Invalid = -1, Null, Safety };
|
||||
|
||||
enum : bool { False = false, True = true };
|
||||
|
||||
} /*Client62*/
|
||||
|
||||
#endif /*COMMON_EQ_LIMITS_H*/
|
||||
+9
-18
@@ -15,22 +15,18 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "crc16.h"
|
||||
#include "global_define.h"
|
||||
#include "debug.h"
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include "eq_packet.h"
|
||||
#include "misc.h"
|
||||
#include "op_codes.h"
|
||||
#include "crc16.h"
|
||||
#include "platform.h"
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifndef STATIC_OPCODE
|
||||
#include "opcodemgr.h"
|
||||
#endif
|
||||
|
||||
#include "packet_dump.h"
|
||||
#include "packet_functions.h"
|
||||
#include <cstdlib>
|
||||
@@ -132,7 +128,7 @@ void EQApplicationPacket::build_header_dump(char *buffer) const
|
||||
#ifdef STATIC_OPCODE
|
||||
sprintf(buffer, "[OpCode 0x%04x Size=%u]\n", emu_opcode,size);
|
||||
#else
|
||||
sprintf(buffer, "[OpCode %s(0x%04x) Size=%u]",OpcodeManager::EmuToName(emu_opcode), GetProtocolOpcode(), size);
|
||||
sprintf(buffer, "[OpCode %s Size=%u]",OpcodeManager::EmuToName(emu_opcode),size);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -260,7 +256,7 @@ bool EQProtocolPacket::combine(const EQProtocolPacket *rhs)
|
||||
{
|
||||
bool result=false;
|
||||
if (opcode==OP_Combined && size+rhs->size+5<256) {
|
||||
auto tmpbuffer = new unsigned char[size + rhs->size + 3];
|
||||
unsigned char *tmpbuffer=new unsigned char [size+rhs->size+3];
|
||||
memcpy(tmpbuffer,pBuffer,size);
|
||||
uint32 offset=size;
|
||||
tmpbuffer[offset++]=rhs->Size();
|
||||
@@ -270,7 +266,7 @@ bool result=false;
|
||||
pBuffer=tmpbuffer;
|
||||
result=true;
|
||||
} else if (size+rhs->size+7<256) {
|
||||
auto tmpbuffer = new unsigned char[size + rhs->size + 6];
|
||||
unsigned char *tmpbuffer=new unsigned char [size+rhs->size+6];
|
||||
uint32 offset=0;
|
||||
tmpbuffer[offset++]=Size();
|
||||
offset+=serialize(tmpbuffer+offset);
|
||||
@@ -457,7 +453,7 @@ EQApplicationPacket *EQApplicationPacket::Copy() const {
|
||||
}
|
||||
|
||||
EQRawApplicationPacket *EQProtocolPacket::MakeAppPacket() const {
|
||||
auto res = new EQRawApplicationPacket(opcode, pBuffer, size);
|
||||
EQRawApplicationPacket *res = new EQRawApplicationPacket(opcode, pBuffer, size);
|
||||
res->copyInfo(this);
|
||||
return(res);
|
||||
}
|
||||
@@ -511,8 +507,3 @@ void DumpPacket(const EQApplicationPacket* app, bool iShowInfo) {
|
||||
// DumpPacketAscii(app->pBuffer, app->size);
|
||||
}
|
||||
|
||||
std::string DumpPacketToString(const EQApplicationPacket* app){
|
||||
std::ostringstream out;
|
||||
out << DumpPacketHexToString(app->pBuffer, app->size);
|
||||
return out.str();
|
||||
}
|
||||
+8
-8
@@ -19,8 +19,9 @@
|
||||
#define _EQPACKET_H
|
||||
|
||||
#include "base_packet.h"
|
||||
#include "eq_stream_type.h"
|
||||
#include "op_codes.h"
|
||||
#include "platform.h"
|
||||
#include <iostream>
|
||||
|
||||
#ifdef STATIC_OPCODE
|
||||
typedef unsigned short EmuOpcode;
|
||||
@@ -29,6 +30,9 @@
|
||||
#include "emu_opcodes.h"
|
||||
#endif
|
||||
|
||||
class EQStream;
|
||||
class EQStreamPair;
|
||||
|
||||
class EQPacket : public BasePacket {
|
||||
friend class EQStream;
|
||||
public:
|
||||
@@ -62,7 +66,7 @@ class EQProtocolPacket : public BasePacket {
|
||||
friend class EQStream;
|
||||
friend class EQStreamPair;
|
||||
public:
|
||||
EQProtocolPacket(uint16 op, const unsigned char *buf, uint32 len) : BasePacket(buf, len), opcode(op) { acked = false; sent_time = 0; }
|
||||
EQProtocolPacket(uint16 op, const unsigned char *buf, uint32 len) : BasePacket(buf,len), opcode(op) { acked = false; }
|
||||
// EQProtocolPacket(const unsigned char *buf, uint32 len);
|
||||
bool combine(const EQProtocolPacket *rhs);
|
||||
uint32 serialize (unsigned char *dest) const;
|
||||
@@ -70,7 +74,6 @@ public:
|
||||
EQRawApplicationPacket *MakeAppPacket() const;
|
||||
|
||||
bool acked;
|
||||
uint32 sent_time;
|
||||
|
||||
virtual void build_raw_header_dump(char *buffer, uint16 seq=0xffff) const;
|
||||
virtual void build_header_dump(char *buffer) const;
|
||||
@@ -115,14 +118,11 @@ public:
|
||||
virtual void DumpRawHeader(uint16 seq=0xffff, FILE *to = stdout) const;
|
||||
virtual void DumpRawHeaderNoTime(uint16 seq=0xffff, FILE *to = stdout) const;
|
||||
|
||||
uint16 GetOpcodeBypass() const { return opcode_bypass; }
|
||||
uint16 GetOpcodeBypass() { return opcode_bypass; }
|
||||
void SetOpcodeBypass(uint16 v) { opcode_bypass = v; }
|
||||
|
||||
uint16 GetProtocolOpcode() const { return protocol_opcode; }
|
||||
void SetProtocolOpcode(uint16 v) { protocol_opcode = v; }
|
||||
protected:
|
||||
|
||||
uint16 protocol_opcode;
|
||||
uint8 app_opcode_size;
|
||||
uint16 opcode_bypass;
|
||||
private:
|
||||
@@ -151,6 +151,6 @@ protected:
|
||||
};
|
||||
|
||||
extern void DumpPacket(const EQApplicationPacket* app, bool iShowInfo = false);
|
||||
extern std::string DumpPacketToString(const EQApplicationPacket* app);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
+283
-373
File diff suppressed because it is too large
Load Diff
+307
-306
File diff suppressed because it is too large
Load Diff
+28
-52
@@ -1,26 +1,22 @@
|
||||
#ifndef _EQSTREAM_H
|
||||
#define _EQSTREAM_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <queue>
|
||||
#include <deque>
|
||||
|
||||
#ifndef WIN32
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#include "../common/misc.h"
|
||||
#include "../common/opcodemgr.h"
|
||||
#include "../common/timer.h"
|
||||
|
||||
#include "eq_stream_type.h"
|
||||
#include "eq_packet.h"
|
||||
#include "eq_stream_intf.h"
|
||||
#include "eq_stream_type.h"
|
||||
#include "mutex.h"
|
||||
|
||||
class EQApplicationPacket;
|
||||
class EQProtocolPacket;
|
||||
#include "../common/opcodemgr.h"
|
||||
#include "../common/misc.h"
|
||||
#include "../common/condition.h"
|
||||
#include "../common/timer.h"
|
||||
|
||||
#define FLAG_COMPRESSED 0x01
|
||||
#define FLAG_ENCODED 0x04
|
||||
@@ -49,10 +45,6 @@ class EQProtocolPacket;
|
||||
#define RETRANSMIT_ACKED_PACKETS true
|
||||
#endif
|
||||
|
||||
#ifndef MAX_SESSION_RETRIES
|
||||
#define MAX_SESSION_RETRIES 30
|
||||
#endif
|
||||
|
||||
#pragma pack(1)
|
||||
struct SessionRequest {
|
||||
uint32 UnknownA;
|
||||
@@ -71,7 +63,7 @@ struct SessionResponse {
|
||||
};
|
||||
|
||||
//Deltas are in ms, representing round trip times
|
||||
struct ClientSessionStats {
|
||||
struct SessionStats {
|
||||
/*000*/ uint16 RequestID;
|
||||
/*002*/ uint32 last_local_delta;
|
||||
/*006*/ uint32 average_delta;
|
||||
@@ -83,19 +75,10 @@ struct ClientSessionStats {
|
||||
/*038*/
|
||||
};
|
||||
|
||||
struct ServerSessionStats {
|
||||
/*000*/ uint16 RequestID;
|
||||
/*002*/ uint32 ServerTime;
|
||||
/*006*/ uint64 packets_sent_echo;
|
||||
/*014*/ uint64 packets_received_echo;
|
||||
/*022*/ uint64 packets_sent;
|
||||
/*030*/ uint64 packets_received;
|
||||
/*038*/
|
||||
};
|
||||
|
||||
#pragma pack()
|
||||
|
||||
class OpcodeManager;
|
||||
class EQStreamPair;
|
||||
class EQRawApplicationPacket;
|
||||
|
||||
class EQStream : public EQStreamInterface {
|
||||
@@ -118,9 +101,6 @@ class EQStream : public EQStreamInterface {
|
||||
uint32 retransmittimer;
|
||||
uint32 retransmittimeout;
|
||||
|
||||
uint16 sessionAttempts;
|
||||
bool streamactive;
|
||||
|
||||
//uint32 buffer_len;
|
||||
|
||||
uint32 Session, Key;
|
||||
@@ -153,6 +133,7 @@ class EQStream : public EQStreamInterface {
|
||||
std::deque<EQProtocolPacket *> SequencedQueue;
|
||||
uint16 NextOutSeq;
|
||||
uint16 SequencedBase; //the sequence number of SequencedQueue[0]
|
||||
long NextSequencedSend; //index into SequencedQueue
|
||||
Mutex MOutboundQueue;
|
||||
|
||||
//a buffer we use for compression/decompression
|
||||
@@ -167,13 +148,10 @@ class EQStream : public EQStreamInterface {
|
||||
|
||||
int32 BytesWritten;
|
||||
|
||||
uint64 sent_packet_count;
|
||||
uint64 received_packet_count;
|
||||
|
||||
Mutex MRate;
|
||||
int32 RateThreshold;
|
||||
int32 DecayRate;
|
||||
uint32 AverageDelta;
|
||||
|
||||
|
||||
OpcodeManager **OpMgr;
|
||||
|
||||
@@ -216,16 +194,10 @@ class EQStream : public EQStreamInterface {
|
||||
|
||||
void _SendDisconnect();
|
||||
|
||||
void init(bool resetSession=true);
|
||||
void init();
|
||||
public:
|
||||
EQStream() { init(); remote_ip = 0; remote_port = 0; State = UNESTABLISHED;
|
||||
StreamType = UnknownStream; compressed = true; encoded = false; app_opcode_size = 2;
|
||||
bytes_sent = 0; bytes_recv = 0; create_time = Timer::GetTimeSeconds(); sessionAttempts = 0;
|
||||
streamactive = false; }
|
||||
EQStream(sockaddr_in addr) { init(); remote_ip = addr.sin_addr.s_addr;
|
||||
remote_port = addr.sin_port; State = UNESTABLISHED; StreamType = UnknownStream;
|
||||
compressed = true; encoded = false; app_opcode_size = 2; bytes_sent = 0; bytes_recv = 0;
|
||||
create_time = Timer::GetTimeSeconds(); }
|
||||
EQStream() { init(); remote_ip = 0; remote_port = 0; State=UNESTABLISHED; StreamType=UnknownStream; compressed=true; encoded=false; app_opcode_size=2; bytes_sent=0; bytes_recv=0; create_time=Timer::GetTimeSeconds(); }
|
||||
EQStream(sockaddr_in addr) { init(); remote_ip=addr.sin_addr.s_addr; remote_port=addr.sin_port; State=UNESTABLISHED; StreamType=UnknownStream; compressed=true; encoded=false; app_opcode_size=2; bytes_sent=0; bytes_recv=0; create_time=Timer::GetTimeSeconds(); }
|
||||
virtual ~EQStream() { RemoveData(); SetState(CLOSED); }
|
||||
void SetMaxLen(uint32 length) { MaxLen=length; }
|
||||
|
||||
@@ -241,7 +213,7 @@ class EQStream : public EQStreamInterface {
|
||||
virtual bool CheckState(EQStreamState state) { return GetState() == state; }
|
||||
virtual std::string Describe() const { return("Direct EQStream"); }
|
||||
|
||||
virtual void SetOpcodeManager(OpcodeManager **opm) { OpMgr = opm; }
|
||||
void SetOpcodeManager(OpcodeManager **opm) { OpMgr = opm; }
|
||||
|
||||
void CheckTimeout(uint32 now, uint32 timeout=30);
|
||||
bool HasOutgoingData();
|
||||
@@ -249,14 +221,11 @@ class EQStream : public EQStreamInterface {
|
||||
void SetLastPacketTime(uint32 t) {LastPacket=t;}
|
||||
void Write(int eq_fd);
|
||||
|
||||
// whether or not the stream has been assigned (we passed our stream match)
|
||||
virtual void SetActive(bool val) { streamactive = val; }
|
||||
|
||||
//
|
||||
inline bool IsInUse() { bool flag; MInUse.lock(); flag=(active_users>0); MInUse.unlock(); return flag; }
|
||||
inline void PutInUse() { MInUse.lock(); active_users++; MInUse.unlock(); }
|
||||
|
||||
virtual EQStreamState GetState() { EQStreamState s; MState.lock(); s=State; MState.unlock(); return s; }
|
||||
inline EQStreamState GetState() { EQStreamState s; MState.lock(); s=State; MState.unlock(); return s; }
|
||||
|
||||
static SeqOrder CompareSequence(uint16 expected_seq , uint16 seq);
|
||||
|
||||
@@ -277,13 +246,11 @@ class EQStream : public EQStreamInterface {
|
||||
void AddBytesSent(uint32 bytes)
|
||||
{
|
||||
bytes_sent += bytes;
|
||||
++sent_packet_count;
|
||||
}
|
||||
|
||||
void AddBytesRecv(uint32 bytes)
|
||||
{
|
||||
bytes_recv += bytes;
|
||||
++received_packet_count;
|
||||
}
|
||||
|
||||
virtual const uint32 GetBytesSent() const { return bytes_sent; }
|
||||
@@ -302,11 +269,20 @@ class EQStream : public EQStreamInterface {
|
||||
return bytes_recv / (Timer::GetTimeSeconds() - create_time);
|
||||
}
|
||||
|
||||
const uint64 GetPacketsSent() { return sent_packet_count; }
|
||||
const uint64 GetPacketsReceived() { return received_packet_count; }
|
||||
|
||||
//used for dynamic stream identification
|
||||
virtual MatchState CheckSignature(const Signature *sig);
|
||||
class Signature {
|
||||
public:
|
||||
//this object could get more complicated if needed...
|
||||
uint16 ignore_eq_opcode; //0=dont ignore
|
||||
uint16 first_eq_opcode;
|
||||
uint32 first_length; //0=dont check length
|
||||
};
|
||||
typedef enum {
|
||||
MatchNotReady,
|
||||
MatchSuccessful,
|
||||
MatchFailed
|
||||
} MatchState;
|
||||
MatchState CheckSignature(const Signature *sig);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
#include "global_define.h"
|
||||
#include "eqemu_logsys.h"
|
||||
#include "debug.h"
|
||||
#include "eq_stream_factory.h"
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#include <winsock2.h>
|
||||
#include <winsock.h>
|
||||
#include <process.h>
|
||||
#include <io.h>
|
||||
#include <stdio.h>
|
||||
@@ -15,18 +13,26 @@
|
||||
#include <netdb.h>
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <iostream>
|
||||
#include "op_codes.h"
|
||||
#include "eq_stream.h"
|
||||
#include "logsys.h"
|
||||
|
||||
ThreadReturnType EQStreamFactoryReaderLoop(void *eqfs)
|
||||
{
|
||||
EQStreamFactory *fs=(EQStreamFactory *)eqfs;
|
||||
EQStreamFactory *fs=(EQStreamFactory *)eqfs;
|
||||
|
||||
#ifndef WIN32
|
||||
_log(COMMON__THREADS, "Starting EQStreamFactoryReaderLoop with thread ID %d", pthread_self());
|
||||
#endif
|
||||
|
||||
fs->ReaderLoop();
|
||||
|
||||
#ifndef WIN32
|
||||
_log(COMMON__THREADS, "Ending EQStreamFactoryReaderLoop with thread ID %d", pthread_self());
|
||||
#endif
|
||||
|
||||
THREAD_RETURN(nullptr);
|
||||
}
|
||||
|
||||
@@ -34,8 +40,16 @@ ThreadReturnType EQStreamFactoryWriterLoop(void *eqfs)
|
||||
{
|
||||
EQStreamFactory *fs=(EQStreamFactory *)eqfs;
|
||||
|
||||
#ifndef WIN32
|
||||
_log(COMMON__THREADS, "Starting EQStreamFactoryWriterLoop with thread ID %d", pthread_self());
|
||||
#endif
|
||||
|
||||
fs->WriterLoop();
|
||||
|
||||
#ifndef WIN32
|
||||
_log(COMMON__THREADS, "Ending EQStreamFactoryWriterLoop with thread ID %d", pthread_self());
|
||||
#endif
|
||||
|
||||
THREAD_RETURN(nullptr);
|
||||
}
|
||||
|
||||
@@ -90,6 +104,8 @@ struct sockaddr_in address;
|
||||
fcntl(sock, F_SETFL, O_NONBLOCK);
|
||||
#endif
|
||||
//moved these because on windows the output was delayed and causing the console window to look bad
|
||||
//std::cout << "Starting factory Reader" << std::endl;
|
||||
//std::cout << "Starting factory Writer" << std::endl;
|
||||
#ifdef _WINDOWS
|
||||
_beginthread(EQStreamFactoryReaderLoop,0, this);
|
||||
_beginthread(EQStreamFactoryWriterLoop,0, this);
|
||||
@@ -100,39 +116,44 @@ struct sockaddr_in address;
|
||||
return true;
|
||||
}
|
||||
|
||||
std::shared_ptr<EQStream> EQStreamFactory::Pop()
|
||||
EQStream *EQStreamFactory::Pop()
|
||||
{
|
||||
std::shared_ptr<EQStream> s = nullptr;
|
||||
EQStream *s=nullptr;
|
||||
//std::cout << "Pop():Locking MNewStreams" << std::endl;
|
||||
MNewStreams.lock();
|
||||
if (!NewStreams.empty()) {
|
||||
s = NewStreams.front();
|
||||
if (NewStreams.size()) {
|
||||
s=NewStreams.front();
|
||||
NewStreams.pop();
|
||||
s->PutInUse();
|
||||
}
|
||||
MNewStreams.unlock();
|
||||
//std::cout << "Pop(): Unlocking MNewStreams" << std::endl;
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
void EQStreamFactory::Push(std::shared_ptr<EQStream> s)
|
||||
void EQStreamFactory::Push(EQStream *s)
|
||||
{
|
||||
//std::cout << "Push():Locking MNewStreams" << std::endl;
|
||||
MNewStreams.lock();
|
||||
NewStreams.push(s);
|
||||
MNewStreams.unlock();
|
||||
//std::cout << "Push(): Unlocking MNewStreams" << std::endl;
|
||||
}
|
||||
|
||||
void EQStreamFactory::ReaderLoop()
|
||||
{
|
||||
fd_set readset;
|
||||
std::map<std::pair<uint32, uint16>, std::shared_ptr<EQStream>>::iterator stream_itr;
|
||||
int num;
|
||||
int length;
|
||||
unsigned char buffer[2048];
|
||||
sockaddr_in from;
|
||||
int socklen = sizeof(sockaddr_in);
|
||||
timeval sleep_time;
|
||||
ReaderRunning = true;
|
||||
fd_set readset;
|
||||
std::map<std::pair<uint32, uint16>,EQStream *>::iterator stream_itr;
|
||||
int num;
|
||||
int length;
|
||||
unsigned char buffer[2048];
|
||||
sockaddr_in from;
|
||||
int socklen=sizeof(sockaddr_in);
|
||||
timeval sleep_time;
|
||||
//time_t now;
|
||||
|
||||
ReaderRunning=true;
|
||||
while(sock!=-1) {
|
||||
MReaderRunning.lock();
|
||||
if (!ReaderRunning)
|
||||
@@ -163,10 +184,10 @@ void EQStreamFactory::ReaderLoop()
|
||||
// What do we wanna do?
|
||||
} else {
|
||||
MStreams.lock();
|
||||
stream_itr = Streams.find(std::make_pair(from.sin_addr.s_addr, from.sin_port));
|
||||
stream_itr=Streams.find(std::make_pair(from.sin_addr.s_addr, from.sin_port));
|
||||
if (stream_itr == Streams.end()) {
|
||||
if (buffer[1]==OP_SessionRequest) {
|
||||
std::shared_ptr<EQStream> s = std::make_shared<EQStream>(from);
|
||||
EQStream *s = new EQStream(from);
|
||||
s->SetStreamType(StreamType);
|
||||
Streams[std::make_pair(from.sin_addr.s_addr, from.sin_port)]=s;
|
||||
WriterWork.Signal();
|
||||
@@ -177,13 +198,13 @@ void EQStreamFactory::ReaderLoop()
|
||||
}
|
||||
MStreams.unlock();
|
||||
} else {
|
||||
std::shared_ptr<EQStream> curstream = stream_itr->second;
|
||||
EQStream *curstream = stream_itr->second;
|
||||
//dont bother processing incoming packets for closed connections
|
||||
if(curstream->CheckClosed())
|
||||
curstream = nullptr;
|
||||
else
|
||||
curstream->PutInUse();
|
||||
//the in use flag prevents the stream from being deleted while we are using it.
|
||||
MStreams.unlock(); //the in use flag prevents the stream from being deleted while we are using it.
|
||||
|
||||
if(curstream) {
|
||||
curstream->AddBytesRecv(length);
|
||||
@@ -191,7 +212,6 @@ void EQStreamFactory::ReaderLoop()
|
||||
curstream->SetLastPacketTime(Timer::GetCurrentTime());
|
||||
curstream->ReleaseFromUse();
|
||||
}
|
||||
MStreams.unlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -204,10 +224,10 @@ void EQStreamFactory::CheckTimeout()
|
||||
MStreams.lock();
|
||||
|
||||
unsigned long now=Timer::GetCurrentTime();
|
||||
std::map<std::pair<uint32, uint16>, std::shared_ptr<EQStream>>::iterator stream_itr;
|
||||
std::map<std::pair<uint32, uint16>,EQStream *>::iterator stream_itr;
|
||||
|
||||
for(stream_itr = Streams.begin(); stream_itr != Streams.end();) {
|
||||
std::shared_ptr<EQStream> s = stream_itr->second;
|
||||
for(stream_itr=Streams.begin();stream_itr!=Streams.end();) {
|
||||
EQStream *s = stream_itr->second;
|
||||
|
||||
s->CheckTimeout(now, stream_timeout);
|
||||
|
||||
@@ -219,9 +239,11 @@ void EQStreamFactory::CheckTimeout()
|
||||
//give it a little time for everybody to finish with it
|
||||
} else {
|
||||
//everybody is done, we can delete it now
|
||||
auto temp = stream_itr;
|
||||
//std::cout << "Removing connection" << std::endl;
|
||||
std::map<std::pair<uint32, uint16>,EQStream *>::iterator temp=stream_itr;
|
||||
++stream_itr;
|
||||
temp->second = nullptr;
|
||||
//let whoever has the stream outside delete it
|
||||
delete temp->second;
|
||||
Streams.erase(temp);
|
||||
continue;
|
||||
}
|
||||
@@ -234,16 +256,21 @@ void EQStreamFactory::CheckTimeout()
|
||||
|
||||
void EQStreamFactory::WriterLoop()
|
||||
{
|
||||
bool havework = true;
|
||||
std::vector<std::shared_ptr<EQStream>> wants_write;
|
||||
std::vector<std::shared_ptr<EQStream>>::iterator cur, end;
|
||||
bool decay = false;
|
||||
uint32 stream_count;
|
||||
Timer DecayTimer(20);
|
||||
WriterRunning = true;
|
||||
DecayTimer.Enable();
|
||||
std::map<std::pair<uint32, uint16>,EQStream *>::iterator stream_itr;
|
||||
bool havework=true;
|
||||
std::vector<EQStream *> wants_write;
|
||||
std::vector<EQStream *>::iterator cur,end;
|
||||
bool decay=false;
|
||||
uint32 stream_count;
|
||||
|
||||
while (sock != -1) {
|
||||
Timer DecayTimer(20);
|
||||
|
||||
WriterRunning=true;
|
||||
DecayTimer.Enable();
|
||||
while(sock!=-1) {
|
||||
//if (!havework) {
|
||||
//WriterWork.Wait();
|
||||
//}
|
||||
MWriterRunning.lock();
|
||||
if (!WriterRunning)
|
||||
break;
|
||||
@@ -252,36 +279,34 @@ void EQStreamFactory::WriterLoop()
|
||||
havework = false;
|
||||
wants_write.clear();
|
||||
|
||||
decay = DecayTimer.Check();
|
||||
decay=DecayTimer.Check();
|
||||
|
||||
// copy streams into a seperate list so we dont have to keep
|
||||
// MStreams locked while we are writting
|
||||
//copy streams into a seperate list so we dont have to keep
|
||||
//MStreams locked while we are writting
|
||||
MStreams.lock();
|
||||
for (auto stream_itr = Streams.begin(); stream_itr != Streams.end(); ++stream_itr) {
|
||||
for(stream_itr=Streams.begin();stream_itr!=Streams.end();++stream_itr) {
|
||||
// If it's time to decay the bytes sent, then let's do it before we try to write
|
||||
if (decay)
|
||||
stream_itr->second->Decay();
|
||||
|
||||
// bullshit checking, to see if this is really happening, GDB seems to think so...
|
||||
if (stream_itr->second == nullptr) {
|
||||
fprintf(stderr,
|
||||
"ERROR: nullptr Stream encountered in EQStreamFactory::WriterLoop for: %i:%i",
|
||||
stream_itr->first.first, stream_itr->first.second);
|
||||
//bullshit checking, to see if this is really happening, GDB seems to think so...
|
||||
if(stream_itr->second == nullptr) {
|
||||
fprintf(stderr, "ERROR: nullptr Stream encountered in EQStreamFactory::WriterLoop for: %i", stream_itr->first.first, stream_itr->first.second);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (stream_itr->second->HasOutgoingData()) {
|
||||
havework = true;
|
||||
havework=true;
|
||||
stream_itr->second->PutInUse();
|
||||
wants_write.push_back(stream_itr->second);
|
||||
}
|
||||
}
|
||||
MStreams.unlock();
|
||||
|
||||
// do the actual writes
|
||||
//do the actual writes
|
||||
cur = wants_write.begin();
|
||||
end = wants_write.end();
|
||||
for (; cur != end; ++cur) {
|
||||
for(; cur != end; ++cur) {
|
||||
(*cur)->Write(sock);
|
||||
(*cur)->ReleaseFromUse();
|
||||
}
|
||||
@@ -289,10 +314,12 @@ void EQStreamFactory::WriterLoop()
|
||||
Sleep(10);
|
||||
|
||||
MStreams.lock();
|
||||
stream_count = Streams.size();
|
||||
stream_count=Streams.size();
|
||||
MStreams.unlock();
|
||||
if (!stream_count) {
|
||||
//std::cout << "No streams, waiting on condition" << std::endl;
|
||||
WriterWork.Wait();
|
||||
//std::cout << "Awake from condition, must have a stream now" << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,16 +2,13 @@
|
||||
|
||||
#define _EQSTREAMFACTORY_H
|
||||
|
||||
#include <memory>
|
||||
#include <queue>
|
||||
#include <map>
|
||||
|
||||
#include "../common/eq_stream.h"
|
||||
#include "../common/condition.h"
|
||||
#include "../common/timeoutmgr.h"
|
||||
|
||||
class EQStream;
|
||||
class Timer;
|
||||
#include "../common/opcodemgr.h"
|
||||
#include "../common/timer.h"
|
||||
|
||||
class EQStreamFactory : private Timeoutable {
|
||||
private:
|
||||
@@ -27,10 +24,10 @@ class EQStreamFactory : private Timeoutable {
|
||||
|
||||
EQStreamType StreamType;
|
||||
|
||||
std::queue<std::shared_ptr<EQStream>> NewStreams;
|
||||
std::queue<EQStream *> NewStreams;
|
||||
Mutex MNewStreams;
|
||||
|
||||
std::map<std::pair<uint32, uint16>, std::shared_ptr<EQStream>> Streams;
|
||||
std::map<std::pair<uint32, uint16>,EQStream *> Streams;
|
||||
Mutex MStreams;
|
||||
|
||||
virtual void CheckTimeout();
|
||||
@@ -43,8 +40,8 @@ class EQStreamFactory : private Timeoutable {
|
||||
EQStreamFactory(EQStreamType type, uint32 timeout = 135000) : Timeoutable(5000), stream_timeout(timeout) { ReaderRunning=false; WriterRunning=false; StreamType=type; sock=-1; }
|
||||
EQStreamFactory(EQStreamType type, int port, uint32 timeout = 135000);
|
||||
|
||||
std::shared_ptr<EQStream> Pop();
|
||||
void Push(std::shared_ptr<EQStream> s);
|
||||
EQStream *Pop();
|
||||
void Push(EQStream *s);
|
||||
|
||||
bool Open();
|
||||
bool Open(unsigned long port) { Port=port; return Open(); }
|
||||
|
||||
+42
-44
@@ -1,22 +1,20 @@
|
||||
#include <utility>
|
||||
|
||||
#include "global_define.h"
|
||||
#include "eqemu_logsys.h"
|
||||
#include "debug.h"
|
||||
#include "eq_stream_ident.h"
|
||||
#include "eq_stream_proxy.h"
|
||||
#include "misc.h"
|
||||
#include "logsys.h"
|
||||
|
||||
EQStreamIdentifier::~EQStreamIdentifier() {
|
||||
while(!m_identified.empty()) {
|
||||
m_identified.front()->ReleaseFromUse();
|
||||
m_identified.pop();
|
||||
}
|
||||
std::vector<Record>::iterator cur, end;
|
||||
std::vector<Record *>::iterator cur, end;
|
||||
cur = m_streams.begin();
|
||||
end = m_streams.end();
|
||||
for(; cur != end; ++cur) {
|
||||
Record &r = *cur;
|
||||
r.stream->ReleaseFromUse();
|
||||
Record *r = *cur;
|
||||
r->stream->ReleaseFromUse();
|
||||
delete r;
|
||||
}
|
||||
std::vector<Patch *>::iterator curp, endp;
|
||||
curp = m_patches.begin();
|
||||
@@ -26,8 +24,8 @@ EQStreamIdentifier::~EQStreamIdentifier() {
|
||||
}
|
||||
}
|
||||
|
||||
void EQStreamIdentifier::RegisterPatch(const EQStreamInterface::Signature &sig, const char *name, OpcodeManager ** opcodes, const StructStrategy *structs) {
|
||||
auto p = new Patch;
|
||||
void EQStreamIdentifier::RegisterPatch(const EQStream::Signature &sig, const char *name, OpcodeManager ** opcodes, const StructStrategy *structs) {
|
||||
Patch *p = new Patch;
|
||||
p->signature = sig;
|
||||
p->name = name;
|
||||
p->opcodes = opcodes;
|
||||
@@ -36,52 +34,54 @@ void EQStreamIdentifier::RegisterPatch(const EQStreamInterface::Signature &sig,
|
||||
}
|
||||
|
||||
void EQStreamIdentifier::Process() {
|
||||
std::vector<Record>::iterator cur;
|
||||
std::vector<Record *>::iterator cur;
|
||||
std::vector<Patch *>::iterator curp, endp;
|
||||
|
||||
//foreach pending stream.
|
||||
cur = m_streams.begin();
|
||||
while(cur != m_streams.end()) {
|
||||
Record &r = *cur;
|
||||
Record *r = *cur;
|
||||
|
||||
//first see if this stream has expired
|
||||
if(r.expire.Check(false)) {
|
||||
Log(Logs::General, Logs::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d before timeout.", r.stream->GetRemoteAddr().c_str(), ntohs(r.stream->GetRemotePort()));
|
||||
r.stream->Close();
|
||||
|
||||
if(r->expire.Check(false)) {
|
||||
//this stream has failed to match any pattern in our timeframe.
|
||||
_log(NET__IDENTIFY, "Unable to identify stream from %s:%d before timeout.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()));
|
||||
r->stream->ReleaseFromUse();
|
||||
delete r;
|
||||
cur = m_streams.erase(cur);
|
||||
continue;
|
||||
}
|
||||
|
||||
//then make sure the stream is still active
|
||||
//if stream hasn't finished initializing then continue;
|
||||
if(r.stream->GetState() == UNESTABLISHED)
|
||||
if(r->stream->GetState() == UNESTABLISHED)
|
||||
{
|
||||
++cur;
|
||||
continue;
|
||||
}
|
||||
if(r.stream->GetState() != ESTABLISHED) {
|
||||
if(r->stream->GetState() != ESTABLISHED) {
|
||||
//the stream closed before it was identified.
|
||||
Log(Logs::General, Logs::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d before it closed.", long2ip(r.stream->GetRemoteIP()).c_str(), ntohs(r.stream->GetRemotePort()));
|
||||
switch(r.stream->GetState())
|
||||
_log(NET__IDENTIFY, "Unable to identify stream from %s:%d before it closed.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()));
|
||||
switch(r->stream->GetState())
|
||||
{
|
||||
case ESTABLISHED:
|
||||
Log(Logs::General, Logs::Netcode, "[IDENTIFY] Stream state was Established");
|
||||
_log(NET__IDENTIFY, "Stream state was Established");
|
||||
break;
|
||||
case CLOSING:
|
||||
Log(Logs::General, Logs::Netcode, "[IDENTIFY] Stream state was Closing");
|
||||
_log(NET__IDENTIFY, "Stream state was Closing");
|
||||
break;
|
||||
case DISCONNECTING:
|
||||
Log(Logs::General, Logs::Netcode, "[IDENTIFY] Stream state was Disconnecting");
|
||||
_log(NET__IDENTIFY, "Stream state was Disconnecting");
|
||||
break;
|
||||
case CLOSED:
|
||||
Log(Logs::General, Logs::Netcode, "[IDENTIFY] Stream state was Closed");
|
||||
_log(NET__IDENTIFY, "Stream state was Closed");
|
||||
break;
|
||||
default:
|
||||
Log(Logs::General, Logs::Netcode, "[IDENTIFY] Stream state was Unestablished or unknown");
|
||||
_log(NET__IDENTIFY, "Stream state was Unestablished or unknown");
|
||||
break;
|
||||
}
|
||||
r.stream->ReleaseFromUse();
|
||||
r->stream->ReleaseFromUse();
|
||||
delete r;
|
||||
cur = m_streams.erase(cur);
|
||||
continue;
|
||||
}
|
||||
@@ -98,31 +98,28 @@ void EQStreamIdentifier::Process() {
|
||||
Patch *p = *curp;
|
||||
|
||||
//ask the stream to see if it matches the supplied signature
|
||||
EQStreamInterface::MatchState res = r.stream->CheckSignature(&p->signature);
|
||||
EQStream::MatchState res = r->stream->CheckSignature(&p->signature);
|
||||
switch(res) {
|
||||
case EQStreamInterface::MatchNotReady:
|
||||
case EQStream::MatchNotReady:
|
||||
//the stream has not received enough packets to compare with this signature
|
||||
// Log.LogDebugType(Logs::General, Logs::Netcode, "[IDENT_TRACE] %s:%d: Tried patch %s, but stream is not ready for it.", long2ip(r.stream->GetRemoteIP()).c_str(), ntohs(r.stream->GetRemotePort()), p->name.c_str());
|
||||
// _log(NET__IDENT_TRACE, "%s:%d: Tried patch %s, but stream is not ready for it.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()), p->name.c_str());
|
||||
all_ready = false;
|
||||
break;
|
||||
case EQStreamInterface::MatchSuccessful: {
|
||||
case EQStream::MatchSuccessful: {
|
||||
//yay, a match.
|
||||
|
||||
Log(Logs::General, Logs::Netcode, "[IDENTIFY] Identified stream %s:%d with signature %s", long2ip(r.stream->GetRemoteIP()).c_str(), ntohs(r.stream->GetRemotePort()), p->name.c_str());
|
||||
|
||||
// before we assign the eqstream to an interface, let the stream recognize it is in use and the session should not be reset any further
|
||||
r.stream->SetActive(true);
|
||||
_log(NET__IDENTIFY, "Identified stream %s:%d with signature %s", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()), p->name.c_str());
|
||||
|
||||
//might want to do something less-specific here... some day..
|
||||
EQStreamInterface *s = new EQStreamProxy(r.stream, p->structs, p->opcodes);
|
||||
EQStreamInterface *s = new EQStreamProxy(r->stream, p->structs, p->opcodes);
|
||||
m_identified.push(s);
|
||||
|
||||
found_one = true;
|
||||
break;
|
||||
}
|
||||
case EQStreamInterface::MatchFailed:
|
||||
case EQStream::MatchFailed:
|
||||
//do nothing...
|
||||
Log(Logs::General, Logs::Netcode, "[IDENT_TRACE] %s:%d: Tried patch %s, and it did not match.", long2ip(r.stream->GetRemoteIP()).c_str(), ntohs(r.stream->GetRemotePort()), p->name.c_str());
|
||||
_log(NET__IDENT_TRACE, "%s:%d: Tried patch %s, and it did not match.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()), p->name.c_str());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -130,13 +127,14 @@ void EQStreamIdentifier::Process() {
|
||||
//if we checked all patches and did not find a match.
|
||||
if(all_ready && !found_one) {
|
||||
//the stream cannot be identified.
|
||||
Log(Logs::General, Logs::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d, no match found.", long2ip(r.stream->GetRemoteIP()).c_str(), ntohs(r.stream->GetRemotePort()));
|
||||
r.stream->ReleaseFromUse();
|
||||
_log(NET__IDENTIFY, "Unable to identify stream from %s:%d, no match found.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()));
|
||||
r->stream->ReleaseFromUse();
|
||||
}
|
||||
|
||||
//if we found a match, or were not able to identify it
|
||||
if(found_one || all_ready) {
|
||||
//cannot print ip/port here. r.stream is invalid.
|
||||
//cannot print ip/port here. r->stream is invalid.
|
||||
delete r;
|
||||
cur = m_streams.erase(cur);
|
||||
} else {
|
||||
++cur;
|
||||
@@ -144,8 +142,8 @@ void EQStreamIdentifier::Process() {
|
||||
} //end foreach stream
|
||||
}
|
||||
|
||||
void EQStreamIdentifier::AddStream(std::shared_ptr<EQStreamInterface> eqs) {
|
||||
m_streams.push_back(Record(eqs));
|
||||
void EQStreamIdentifier::AddStream(EQStream *&eqs) {
|
||||
m_streams.push_back(new Record(eqs));
|
||||
eqs = nullptr;
|
||||
}
|
||||
|
||||
@@ -157,8 +155,8 @@ EQStreamInterface *EQStreamIdentifier::PopIdentified() {
|
||||
return(res);
|
||||
}
|
||||
|
||||
EQStreamIdentifier::Record::Record(std::shared_ptr<EQStreamInterface> s)
|
||||
: stream(std::move(s)),
|
||||
EQStreamIdentifier::Record::Record(EQStream *s)
|
||||
: stream(s),
|
||||
expire(STREAM_IDENT_WAIT_MS)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1,28 +1,27 @@
|
||||
#ifndef EQSTREAMIDENT_H_
|
||||
#define EQSTREAMIDENT_H_
|
||||
|
||||
#include "eq_stream_intf.h"
|
||||
#include "eq_stream.h"
|
||||
#include "timer.h"
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <queue>
|
||||
#include <memory>
|
||||
|
||||
#define STREAM_IDENT_WAIT_MS 30000
|
||||
#define STREAM_IDENT_WAIT_MS 10000
|
||||
|
||||
class OpcodeManager;
|
||||
class StructStrategy;
|
||||
class EQStreamInterface;
|
||||
|
||||
class EQStreamIdentifier {
|
||||
public:
|
||||
~EQStreamIdentifier();
|
||||
|
||||
//registration interface.
|
||||
void RegisterPatch(const EQStreamInterface::Signature &sig, const char *name, OpcodeManager ** opcodes, const StructStrategy *structs);
|
||||
void RegisterPatch(const EQStream::Signature &sig, const char *name, OpcodeManager ** opcodes, const StructStrategy *structs);
|
||||
|
||||
//main processing interface
|
||||
void Process();
|
||||
void AddStream(std::shared_ptr<EQStreamInterface> eqs);
|
||||
void AddStream(EQStream *& eqs);
|
||||
EQStreamInterface *PopIdentified();
|
||||
|
||||
protected:
|
||||
@@ -31,7 +30,7 @@ protected:
|
||||
class Patch {
|
||||
public:
|
||||
std::string name;
|
||||
EQStreamInterface::Signature signature;
|
||||
EQStream::Signature signature;
|
||||
OpcodeManager ** opcodes;
|
||||
const StructStrategy *structs;
|
||||
};
|
||||
@@ -40,11 +39,11 @@ protected:
|
||||
//pending streams..
|
||||
class Record {
|
||||
public:
|
||||
Record(std::shared_ptr<EQStreamInterface> s);
|
||||
std::shared_ptr<EQStreamInterface> stream; //we own this
|
||||
Record(EQStream *s);
|
||||
EQStream *stream; //we own this
|
||||
Timer expire;
|
||||
};
|
||||
std::vector<Record> m_streams; //we own these objects, and the streams contained in them.
|
||||
std::vector<Record *> m_streams; //we own these objects, and the streams contained in them.
|
||||
std::queue<EQStreamInterface *> m_identified; //we own these objects
|
||||
};
|
||||
|
||||
|
||||
+2
-22
@@ -4,8 +4,7 @@
|
||||
//this is the only part of an EQStream that is seen by the application.
|
||||
|
||||
#include <string>
|
||||
#include "emu_versions.h"
|
||||
#include "eq_packet.h"
|
||||
#include "clientversions.h"
|
||||
|
||||
typedef enum {
|
||||
ESTABLISHED,
|
||||
@@ -16,46 +15,27 @@ typedef enum {
|
||||
} EQStreamState;
|
||||
|
||||
class EQApplicationPacket;
|
||||
class OpcodeManager;
|
||||
|
||||
class EQStreamInterface {
|
||||
public:
|
||||
virtual ~EQStreamInterface() {}
|
||||
|
||||
class Signature {
|
||||
public:
|
||||
//this object could get more complicated if needed...
|
||||
uint16 ignore_eq_opcode; //0=dont ignore
|
||||
uint16 first_eq_opcode;
|
||||
uint32 first_length; //0=dont check length
|
||||
};
|
||||
typedef enum {
|
||||
MatchNotReady,
|
||||
MatchSuccessful,
|
||||
MatchFailed
|
||||
} MatchState;
|
||||
|
||||
virtual void QueuePacket(const EQApplicationPacket *p, bool ack_req=true) = 0;
|
||||
virtual void FastQueuePacket(EQApplicationPacket **p, bool ack_req=true) = 0;
|
||||
virtual EQApplicationPacket *PopPacket() = 0;
|
||||
virtual void Close() = 0;
|
||||
virtual void ReleaseFromUse() = 0;
|
||||
virtual void RemoveData() = 0;
|
||||
virtual std::string GetRemoteAddr() const = 0;
|
||||
virtual uint32 GetRemoteIP() const = 0;
|
||||
virtual uint16 GetRemotePort() const = 0;
|
||||
virtual bool CheckState(EQStreamState state) = 0;
|
||||
virtual std::string Describe() const = 0;
|
||||
virtual void SetActive(bool val) { }
|
||||
virtual MatchState CheckSignature(const Signature *sig) { return MatchFailed; }
|
||||
virtual EQStreamState GetState() = 0;
|
||||
virtual void SetOpcodeManager(OpcodeManager **opm) = 0;
|
||||
|
||||
virtual const uint32 GetBytesSent() const { return 0; }
|
||||
virtual const uint32 GetBytesRecieved() const { return 0; }
|
||||
virtual const uint32 GetBytesSentPerSecond() const { return 0; }
|
||||
virtual const uint32 GetBytesRecvPerSecond() const { return 0; }
|
||||
virtual const EQEmu::versions::ClientVersion ClientVersion() const { return EQEmu::versions::ClientVersion::Unknown; }
|
||||
virtual const EQClientVersion ClientVersion() const { return EQClientUnknown; }
|
||||
};
|
||||
|
||||
#endif /*EQSTREAMINTF_H_*/
|
||||
|
||||
+11
-17
@@ -1,10 +1,11 @@
|
||||
|
||||
#include "global_define.h"
|
||||
#include "debug.h"
|
||||
#include "eq_stream_proxy.h"
|
||||
#include "eq_stream.h"
|
||||
#include "struct_strategy.h"
|
||||
|
||||
|
||||
EQStreamProxy::EQStreamProxy(std::shared_ptr<EQStreamInterface> &stream, const StructStrategy *structs, OpcodeManager **opcodes)
|
||||
EQStreamProxy::EQStreamProxy(EQStream *&stream, const StructStrategy *structs, OpcodeManager **opcodes)
|
||||
: m_stream(stream),
|
||||
m_structs(structs),
|
||||
m_opcodes(opcodes)
|
||||
@@ -14,27 +15,18 @@ EQStreamProxy::EQStreamProxy(std::shared_ptr<EQStreamInterface> &stream, const S
|
||||
}
|
||||
|
||||
EQStreamProxy::~EQStreamProxy() {
|
||||
//delete m_stream; //released by the stream factory.
|
||||
}
|
||||
|
||||
std::string EQStreamProxy::Describe() const {
|
||||
return(m_structs->Describe());
|
||||
}
|
||||
|
||||
const EQEmu::versions::ClientVersion EQStreamProxy::ClientVersion() const
|
||||
const EQClientVersion EQStreamProxy::ClientVersion() const
|
||||
{
|
||||
return m_structs->ClientVersion();
|
||||
}
|
||||
|
||||
EQStreamState EQStreamProxy::GetState()
|
||||
{
|
||||
return m_stream->GetState();
|
||||
}
|
||||
|
||||
void EQStreamProxy::SetOpcodeManager(OpcodeManager **opm)
|
||||
{
|
||||
return m_stream->SetOpcodeManager(opm);
|
||||
}
|
||||
|
||||
void EQStreamProxy::QueuePacket(const EQApplicationPacket *p, bool ack_req) {
|
||||
if(p == nullptr)
|
||||
return;
|
||||
@@ -63,10 +55,6 @@ void EQStreamProxy::Close() {
|
||||
m_stream->Close();
|
||||
}
|
||||
|
||||
std::string EQStreamProxy::GetRemoteAddr() const {
|
||||
return(m_stream->GetRemoteAddr());
|
||||
}
|
||||
|
||||
uint32 EQStreamProxy::GetRemoteIP() const {
|
||||
return(m_stream->GetRemoteIP());
|
||||
}
|
||||
@@ -97,6 +85,12 @@ const uint32 EQStreamProxy::GetBytesRecvPerSecond() const
|
||||
|
||||
void EQStreamProxy::ReleaseFromUse() {
|
||||
m_stream->ReleaseFromUse();
|
||||
|
||||
//this is so ugly, but I cant think of a better way to deal with
|
||||
//it right now...
|
||||
if(!m_stream->IsInUse()) {
|
||||
delete this;
|
||||
}
|
||||
}
|
||||
|
||||
void EQStreamProxy::RemoveData() {
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
#include "types.h"
|
||||
#include "eq_stream_intf.h"
|
||||
#include <memory>
|
||||
|
||||
class EQStream;
|
||||
class StructStrategy;
|
||||
class OpcodeManager;
|
||||
class EQApplicationPacket;
|
||||
@@ -13,7 +13,7 @@ class EQApplicationPacket;
|
||||
class EQStreamProxy : public EQStreamInterface {
|
||||
public:
|
||||
//takes ownership of the stream.
|
||||
EQStreamProxy(std::shared_ptr<EQStreamInterface> &stream, const StructStrategy *structs, OpcodeManager **opcodes);
|
||||
EQStreamProxy(EQStream *&stream, const StructStrategy *structs, OpcodeManager **opcodes);
|
||||
virtual ~EQStreamProxy();
|
||||
|
||||
//EQStreamInterface:
|
||||
@@ -21,16 +21,13 @@ public:
|
||||
virtual void FastQueuePacket(EQApplicationPacket **p, bool ack_req=true);
|
||||
virtual EQApplicationPacket *PopPacket();
|
||||
virtual void Close();
|
||||
virtual std::string GetRemoteAddr() const;
|
||||
virtual uint32 GetRemoteIP() const;
|
||||
virtual uint16 GetRemotePort() const;
|
||||
virtual void ReleaseFromUse();
|
||||
virtual void RemoveData();
|
||||
virtual bool CheckState(EQStreamState state);
|
||||
virtual std::string Describe() const;
|
||||
virtual const EQEmu::versions::ClientVersion ClientVersion() const;
|
||||
virtual EQStreamState GetState();
|
||||
virtual void SetOpcodeManager(OpcodeManager **opm);
|
||||
virtual const EQClientVersion ClientVersion() const;
|
||||
|
||||
virtual const uint32 GetBytesSent() const;
|
||||
virtual const uint32 GetBytesRecieved() const;
|
||||
@@ -38,8 +35,8 @@ public:
|
||||
virtual const uint32 GetBytesRecvPerSecond() const;
|
||||
|
||||
protected:
|
||||
std::shared_ptr<EQStreamInterface> const m_stream; //we own this stream object.
|
||||
const StructStrategy *const m_structs; //we do not own this object.
|
||||
EQStream *const m_stream; //we own this stream object.
|
||||
const StructStrategy *const m_structs; //we do not own this object.
|
||||
//this is a pointer to a pointer to make it less likely that a packet will
|
||||
//reference an invalid opcode manager when they are being reloaded.
|
||||
OpcodeManager **const m_opcodes; //we do not own this object.
|
||||
|
||||
+2
-2
@@ -15,7 +15,7 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include "global_define.h"
|
||||
#include "debug.h"
|
||||
#include "eqdb.h"
|
||||
#include "database.h"
|
||||
#include <mysql.h>
|
||||
@@ -63,7 +63,7 @@ EQDBRes * EQDB::query(Const_char *q) {
|
||||
//NOT THREAD SAFE!
|
||||
Const_char *EQDB::escape_string(Const_char *from) {
|
||||
int len = strlen(from);
|
||||
auto res = new char[len * 2 + 1];
|
||||
char *res = new char[len*2+1];
|
||||
|
||||
mysql_real_escape_string(mysql_ref,res,from,len);
|
||||
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include "global_define.h"
|
||||
#include "debug.h"
|
||||
#include "eqdb_res.h"
|
||||
#include <mysql.h>
|
||||
|
||||
|
||||
+300
-419
@@ -1,4 +1,4 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@@ -15,505 +15,392 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "../common/global_define.h"
|
||||
#include "../common/debug.h"
|
||||
#include "eqemu_config.h"
|
||||
#include "misc_functions.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
std::string EQEmuConfig::ConfigFile = "eqemu_config.xml";
|
||||
EQEmuConfig *EQEmuConfig::_config = nullptr;
|
||||
|
||||
void EQEmuConfig::do_world(TiXmlElement *ele)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
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,"account",true);
|
||||
if (text)
|
||||
LoginAccount=text;
|
||||
|
||||
text=ParseTextBlock(sub_ele,"password",true);
|
||||
if (text)
|
||||
LoginPassword=text;
|
||||
} else {
|
||||
char str[32];
|
||||
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;
|
||||
}
|
||||
LoginConfig* 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,"account",true);
|
||||
if (text)
|
||||
loginconfig->LoginAccount=text;
|
||||
|
||||
text=ParseTextBlock(sub_ele,"password",true);
|
||||
if (text)
|
||||
loginconfig->LoginPassword=text;
|
||||
loginlist.Insert(loginconfig);
|
||||
}
|
||||
} 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);
|
||||
}
|
||||
} while(sub_ele);
|
||||
}
|
||||
|
||||
sub_ele = ele->FirstChildElement("telnet");
|
||||
if (sub_ele != nullptr) {
|
||||
// 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) {
|
||||
TelnetIP = text;
|
||||
}
|
||||
if (text)
|
||||
WorldIP=text;
|
||||
|
||||
text = sub_ele->Attribute("port");
|
||||
if (text) {
|
||||
TelnetTCPPort = atoi(text);
|
||||
}
|
||||
text = sub_ele->Attribute("enabled");
|
||||
if (text && !strcasecmp(text, "true")) {
|
||||
TelnetEnabled = true;
|
||||
}
|
||||
if (text)
|
||||
WorldTCPPort=atoi(text);
|
||||
|
||||
text = sub_ele->Attribute("telnet");
|
||||
if (text && !strcasecmp(text,"enabled"))
|
||||
TelnetEnabled=true;
|
||||
|
||||
}
|
||||
|
||||
// Get the <http> element
|
||||
sub_ele = ele->FirstChildElement("http");
|
||||
if (sub_ele != nullptr) {
|
||||
if(sub_ele != nullptr) {
|
||||
|
||||
// text = sub_ele->Attribute("ip");
|
||||
// if (text)
|
||||
// WorldIP=text;
|
||||
|
||||
text = sub_ele->Attribute("mimefile");
|
||||
if (text) {
|
||||
WorldHTTPMimeFile = text;
|
||||
}
|
||||
if (text)
|
||||
WorldHTTPMimeFile=text;
|
||||
|
||||
text = sub_ele->Attribute("port");
|
||||
if (text) {
|
||||
WorldHTTPPort = atoi(text);
|
||||
}
|
||||
if (text)
|
||||
WorldHTTPPort=atoi(text);
|
||||
|
||||
text = sub_ele->Attribute("enabled");
|
||||
if (text && !strcasecmp(text, "true")) {
|
||||
WorldHTTPEnabled = true;
|
||||
}
|
||||
if (text && !strcasecmp(text,"true"))
|
||||
WorldHTTPEnabled=true;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void EQEmuConfig::do_chatserver(TiXmlElement *ele)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
text=ParseTextBlock(ele,"defaultstatus",true);
|
||||
if (text)
|
||||
DefaultStatus=atoi(text);
|
||||
|
||||
// Get the <ports> element
|
||||
sub_ele = ele->FirstChildElement("ports");
|
||||
if (sub_ele != nullptr) {
|
||||
if(sub_ele != nullptr) {
|
||||
|
||||
text = sub_ele->Attribute("low");
|
||||
if (text) {
|
||||
ZonePortLow = atoi(text);
|
||||
};
|
||||
if (text)
|
||||
ZonePortLow=atoi(text);;
|
||||
|
||||
text = sub_ele->Attribute("high");
|
||||
if (text) {
|
||||
ZonePortHigh = atoi(text);
|
||||
}
|
||||
if (text)
|
||||
ZonePortHigh=atoi(text);
|
||||
}
|
||||
}
|
||||
|
||||
void EQEmuConfig::do_files(TiXmlElement *ele)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
text=ParseTextBlock(ele,"spells",true);
|
||||
if (text)
|
||||
SpellsFile=text;
|
||||
|
||||
text=ParseTextBlock(ele,"opcodes",true);
|
||||
if (text)
|
||||
OpCodesFile=text;
|
||||
|
||||
text=ParseTextBlock(ele,"logsettings",true);
|
||||
if (text)
|
||||
LogSettingsFile=text;
|
||||
|
||||
text=ParseTextBlock(ele,"eqtime",true);
|
||||
if (text)
|
||||
EQTimeFile=text;
|
||||
}
|
||||
|
||||
void EQEmuConfig::do_directories(TiXmlElement *ele)
|
||||
{
|
||||
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 += '/';
|
||||
}
|
||||
|
||||
text=ParseTextBlock(ele,"maps",true);
|
||||
if (text)
|
||||
MapDir=text;
|
||||
|
||||
text=ParseTextBlock(ele,"quests",true);
|
||||
if (text)
|
||||
QuestDir=text;
|
||||
|
||||
text=ParseTextBlock(ele,"plugins",true);
|
||||
if (text)
|
||||
PluginDir=text;
|
||||
|
||||
}
|
||||
|
||||
void EQEmuConfig::do_launcher(TiXmlElement *ele)
|
||||
{
|
||||
void EQEmuConfig::do_launcher(TiXmlElement *ele) {
|
||||
const char *text;
|
||||
TiXmlElement *sub_ele;
|
||||
text = ParseTextBlock(ele, "logprefix", true);
|
||||
if (text) {
|
||||
|
||||
text=ParseTextBlock(ele,"logprefix",true);
|
||||
if (text)
|
||||
LogPrefix = text;
|
||||
}
|
||||
text = ParseTextBlock(ele, "logsuffix", true);
|
||||
if (text) {
|
||||
|
||||
text=ParseTextBlock(ele,"logsuffix",true);
|
||||
if (text)
|
||||
LogSuffix = text;
|
||||
}
|
||||
|
||||
// Get the <exe> element
|
||||
text = ParseTextBlock(ele, "exe", true);
|
||||
if (text) {
|
||||
text = ParseTextBlock(ele,"exe",true);
|
||||
if (text)
|
||||
ZoneExe = text;
|
||||
}
|
||||
|
||||
// Get the <timers> element
|
||||
sub_ele = ele->FirstChildElement("timers");
|
||||
if (sub_ele != nullptr) {
|
||||
if(sub_ele != nullptr) {
|
||||
text = sub_ele->Attribute("restart");
|
||||
if (text) {
|
||||
if (text)
|
||||
RestartWait = atoi(text);
|
||||
}
|
||||
|
||||
text = sub_ele->Attribute("reterminate");
|
||||
if (text) {
|
||||
if (text)
|
||||
TerminateWait = atoi(text);
|
||||
}
|
||||
|
||||
text = sub_ele->Attribute("initial");
|
||||
if (text) {
|
||||
if (text)
|
||||
InitialBootWait = atoi(text);
|
||||
}
|
||||
|
||||
text = sub_ele->Attribute("interval");
|
||||
if (text) {
|
||||
if (text)
|
||||
ZoneBootInterval = atoi(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::string EQEmuConfig::GetByName(const std::string &var_name) const
|
||||
{
|
||||
if (var_name == "ShortName") {
|
||||
return (ShortName);
|
||||
}
|
||||
if (var_name == "LongName") {
|
||||
return (LongName);
|
||||
}
|
||||
if (var_name == "WorldAddress") {
|
||||
return (WorldAddress);
|
||||
}
|
||||
if (var_name == "LoginHost") {
|
||||
return (LoginHost);
|
||||
}
|
||||
if (var_name == "LoginAccount") {
|
||||
return (LoginAccount);
|
||||
}
|
||||
if (var_name == "LoginPassword") {
|
||||
return (LoginPassword);
|
||||
}
|
||||
if (var_name == "LoginPort") {
|
||||
return (itoa(LoginPort));
|
||||
}
|
||||
if (var_name == "LoginLegacy") {
|
||||
return (itoa(LoginLegacy ? 1 : 0));
|
||||
}
|
||||
if (var_name == "Locked") {
|
||||
return (Locked ? "true" : "false");
|
||||
}
|
||||
if (var_name == "WorldTCPPort") {
|
||||
return (itoa(WorldTCPPort));
|
||||
}
|
||||
if (var_name == "WorldIP") {
|
||||
return (WorldIP);
|
||||
}
|
||||
if (var_name == "TelnetTCPPort") {
|
||||
return (itoa(TelnetTCPPort));
|
||||
}
|
||||
if (var_name == "TelnetIP") {
|
||||
return (TelnetIP);
|
||||
}
|
||||
if (var_name == "TelnetEnabled") {
|
||||
return (TelnetEnabled ? "true" : "false");
|
||||
}
|
||||
if (var_name == "WorldHTTPPort") {
|
||||
return (itoa(WorldHTTPPort));
|
||||
}
|
||||
if (var_name == "WorldHTTPMimeFile") {
|
||||
return (WorldHTTPMimeFile);
|
||||
}
|
||||
if (var_name == "WorldHTTPEnabled") {
|
||||
return (WorldHTTPEnabled ? "true" : "false");
|
||||
}
|
||||
if (var_name == "ChatHost") {
|
||||
return (ChatHost);
|
||||
}
|
||||
if (var_name == "ChatPort") {
|
||||
return (itoa(ChatPort));
|
||||
}
|
||||
if (var_name == "MailHost") {
|
||||
return (MailHost);
|
||||
}
|
||||
if (var_name == "MailPort") {
|
||||
return (itoa(MailPort));
|
||||
}
|
||||
if (var_name == "DatabaseHost") {
|
||||
return (DatabaseHost);
|
||||
}
|
||||
if (var_name == "DatabaseUsername") {
|
||||
return (DatabaseUsername);
|
||||
}
|
||||
if (var_name == "DatabasePassword") {
|
||||
return (DatabasePassword);
|
||||
}
|
||||
if (var_name == "DatabaseDB") {
|
||||
return (DatabaseDB);
|
||||
}
|
||||
if (var_name == "DatabasePort") {
|
||||
return (itoa(DatabasePort));
|
||||
}
|
||||
if (var_name == "QSDatabaseHost") {
|
||||
return (QSDatabaseHost);
|
||||
}
|
||||
if (var_name == "QSDatabaseUsername") {
|
||||
return (QSDatabaseUsername);
|
||||
}
|
||||
if (var_name == "QSDatabasePassword") {
|
||||
return (QSDatabasePassword);
|
||||
}
|
||||
if (var_name == "QSDatabaseDB") {
|
||||
return (QSDatabaseDB);
|
||||
}
|
||||
if (var_name == "QSDatabasePort") {
|
||||
return (itoa(QSDatabasePort));
|
||||
}
|
||||
if (var_name == "SpellsFile") {
|
||||
return (SpellsFile);
|
||||
}
|
||||
if (var_name == "OpCodesFile") {
|
||||
return (OpCodesFile);
|
||||
}
|
||||
if (var_name == "PluginPlFile") {
|
||||
return (PluginPlFile);
|
||||
}
|
||||
if (var_name == "MapDir") {
|
||||
return (MapDir);
|
||||
}
|
||||
if (var_name == "QuestDir") {
|
||||
return (QuestDir);
|
||||
}
|
||||
if (var_name == "PluginDir") {
|
||||
return (PluginDir);
|
||||
}
|
||||
if (var_name == "LuaModuleDir") {
|
||||
return (LuaModuleDir);
|
||||
}
|
||||
if (var_name == "PatchDir") {
|
||||
return (PatchDir);
|
||||
}
|
||||
if (var_name == "SharedMemDir") {
|
||||
return (SharedMemDir);
|
||||
}
|
||||
if (var_name == "LogDir") {
|
||||
return (LogDir);
|
||||
}
|
||||
if (var_name == "LogPrefix") {
|
||||
return (LogPrefix);
|
||||
}
|
||||
if (var_name == "LogSuffix") {
|
||||
return (LogSuffix);
|
||||
}
|
||||
if (var_name == "ZoneExe") {
|
||||
return (ZoneExe);
|
||||
}
|
||||
if (var_name == "ZonePortLow") {
|
||||
return (itoa(ZonePortLow));
|
||||
}
|
||||
if (var_name == "ZonePortHigh") {
|
||||
return (itoa(ZonePortHigh));
|
||||
}
|
||||
if (var_name == "DefaultStatus") {
|
||||
return (itoa(DefaultStatus));
|
||||
}
|
||||
std::string EQEmuConfig::GetByName(const std::string &var_name) const {
|
||||
if(var_name == "ShortName")
|
||||
return(ShortName);
|
||||
if(var_name == "LongName")
|
||||
return(LongName);
|
||||
if(var_name == "WorldAddress")
|
||||
return(WorldAddress);
|
||||
if(var_name == "LoginHost")
|
||||
return(LoginHost);
|
||||
if(var_name == "LoginAccount")
|
||||
return(LoginAccount);
|
||||
if(var_name == "LoginPassword")
|
||||
return(LoginPassword);
|
||||
if(var_name == "LoginPort")
|
||||
return(itoa(LoginPort));
|
||||
if(var_name == "Locked")
|
||||
return(Locked?"true":"false");
|
||||
if(var_name == "WorldTCPPort")
|
||||
return(itoa(WorldTCPPort));
|
||||
if(var_name == "WorldIP")
|
||||
return(WorldIP);
|
||||
if(var_name == "TelnetEnabled")
|
||||
return(TelnetEnabled?"true":"false");
|
||||
if(var_name == "WorldHTTPPort")
|
||||
return(itoa(WorldHTTPPort));
|
||||
if(var_name == "WorldHTTPMimeFile")
|
||||
return(WorldHTTPMimeFile);
|
||||
if(var_name == "WorldHTTPEnabled")
|
||||
return(WorldHTTPEnabled?"true":"false");
|
||||
if(var_name == "ChatHost")
|
||||
return(ChatHost);
|
||||
if(var_name == "ChatPort")
|
||||
return(itoa(ChatPort));
|
||||
if(var_name == "MailHost")
|
||||
return(MailHost);
|
||||
if(var_name == "MailPort")
|
||||
return(itoa(MailPort));
|
||||
if(var_name == "DatabaseHost")
|
||||
return(DatabaseHost);
|
||||
if(var_name == "DatabaseUsername")
|
||||
return(DatabaseUsername);
|
||||
if(var_name == "DatabasePassword")
|
||||
return(DatabasePassword);
|
||||
if(var_name == "DatabaseDB")
|
||||
return(DatabaseDB);
|
||||
if(var_name == "DatabasePort")
|
||||
return(itoa(DatabasePort));
|
||||
if(var_name == "QSDatabaseHost")
|
||||
return(QSDatabaseHost);
|
||||
if(var_name == "QSDatabaseUsername")
|
||||
return(QSDatabaseUsername);
|
||||
if(var_name == "QSDatabasePassword")
|
||||
return(QSDatabasePassword);
|
||||
if(var_name == "QSDatabaseDB")
|
||||
return(QSDatabaseDB);
|
||||
if(var_name == "QSDatabasePort")
|
||||
return(itoa(QSDatabasePort));
|
||||
if(var_name == "SpellsFile")
|
||||
return(SpellsFile);
|
||||
if(var_name == "OpCodesFile")
|
||||
return(OpCodesFile);
|
||||
if(var_name == "EQTimeFile")
|
||||
return(EQTimeFile);
|
||||
if(var_name == "LogSettingsFile")
|
||||
return(LogSettingsFile);
|
||||
if(var_name == "MapDir")
|
||||
return(MapDir);
|
||||
if(var_name == "QuestDir")
|
||||
return(QuestDir);
|
||||
if(var_name == "PluginDir")
|
||||
return(PluginDir);
|
||||
if(var_name == "LogPrefix")
|
||||
return(LogPrefix);
|
||||
if(var_name == "LogSuffix")
|
||||
return(LogSuffix);
|
||||
if(var_name == "ZoneExe")
|
||||
return(ZoneExe);
|
||||
if(var_name == "ZonePortLow")
|
||||
return(itoa(ZonePortLow));
|
||||
if(var_name == "ZonePortHigh")
|
||||
return(itoa(ZonePortHigh));
|
||||
if(var_name == "DefaultStatus")
|
||||
return(itoa(DefaultStatus));
|
||||
// if(var_name == "DynamicCount")
|
||||
// return(itoa(DynamicCount));
|
||||
return ("");
|
||||
return("");
|
||||
}
|
||||
|
||||
void EQEmuConfig::Dump() const
|
||||
@@ -525,12 +412,9 @@ void EQEmuConfig::Dump() const
|
||||
std::cout << "LoginAccount = " << LoginAccount << std::endl;
|
||||
std::cout << "LoginPassword = " << LoginPassword << std::endl;
|
||||
std::cout << "LoginPort = " << LoginPort << std::endl;
|
||||
std::cout << "LoginLegacy = " << LoginLegacy << std::endl;
|
||||
std::cout << "Locked = " << Locked << std::endl;
|
||||
std::cout << "WorldTCPPort = " << WorldTCPPort << std::endl;
|
||||
std::cout << "WorldIP = " << WorldIP << std::endl;
|
||||
std::cout << "TelnetTCPPort = " << TelnetTCPPort << std::endl;
|
||||
std::cout << "TelnetIP = " << TelnetIP << std::endl;
|
||||
std::cout << "TelnetEnabled = " << TelnetEnabled << std::endl;
|
||||
std::cout << "WorldHTTPPort = " << WorldHTTPPort << std::endl;
|
||||
std::cout << "WorldHTTPMimeFile = " << WorldHTTPMimeFile << std::endl;
|
||||
@@ -551,14 +435,11 @@ void EQEmuConfig::Dump() const
|
||||
std::cout << "QSDatabasePort = " << QSDatabasePort << std::endl;
|
||||
std::cout << "SpellsFile = " << SpellsFile << std::endl;
|
||||
std::cout << "OpCodesFile = " << OpCodesFile << std::endl;
|
||||
std::cout << "PluginPlFile = " << PluginPlFile << std::endl;
|
||||
std::cout << "EQTimeFile = " << EQTimeFile << std::endl;
|
||||
std::cout << "LogSettingsFile = " << LogSettingsFile << std::endl;
|
||||
std::cout << "MapDir = " << MapDir << std::endl;
|
||||
std::cout << "QuestDir = " << QuestDir << std::endl;
|
||||
std::cout << "PluginDir = " << PluginDir << std::endl;
|
||||
std::cout << "LuaModuleDir = " << LuaModuleDir << std::endl;
|
||||
std::cout << "PatchDir = " << PatchDir << std::endl;
|
||||
std::cout << "SharedMemDir = " << SharedMemDir << std::endl;
|
||||
std::cout << "LogDir = " << LogDir << std::endl;
|
||||
std::cout << "ZonePortLow = " << ZonePortLow << std::endl;
|
||||
std::cout << "ZonePortHigh = " << ZonePortHigh << std::endl;
|
||||
std::cout << "DefaultStatus = " << (int)DefaultStatus << std::endl;
|
||||
|
||||
+167
-173
@@ -1,4 +1,4 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@@ -26,208 +26,202 @@ struct LoginConfig {
|
||||
std::string LoginAccount;
|
||||
std::string LoginPassword;
|
||||
uint16 LoginPort;
|
||||
bool LoginLegacy;
|
||||
};
|
||||
|
||||
class EQEmuConfig : public XMLParser
|
||||
{
|
||||
public:
|
||||
virtual std::string GetByName(const std::string &var_name) const;
|
||||
class EQEmuConfig : public XMLParser {
|
||||
public:
|
||||
virtual std::string GetByName(const std::string &var_name) const;
|
||||
|
||||
// From <world/>
|
||||
std::string ShortName;
|
||||
std::string LongName;
|
||||
std::string WorldAddress;
|
||||
std::string LocalAddress;
|
||||
std::string LoginHost;
|
||||
std::string LoginAccount;
|
||||
std::string LoginPassword;
|
||||
uint16 LoginPort;
|
||||
bool LoginLegacy;
|
||||
uint32 LoginCount;
|
||||
LinkedList<LoginConfig*> loginlist;
|
||||
bool Locked;
|
||||
uint16 WorldTCPPort;
|
||||
std::string WorldIP;
|
||||
uint16 TelnetTCPPort;
|
||||
std::string TelnetIP;
|
||||
bool TelnetEnabled;
|
||||
int32 MaxClients;
|
||||
bool WorldHTTPEnabled;
|
||||
uint16 WorldHTTPPort;
|
||||
std::string WorldHTTPMimeFile;
|
||||
std::string SharedKey;
|
||||
// From <world/>
|
||||
std::string ShortName;
|
||||
std::string LongName;
|
||||
std::string WorldAddress;
|
||||
std::string LocalAddress;
|
||||
std::string LoginHost;
|
||||
std::string LoginAccount;
|
||||
std::string LoginPassword;
|
||||
uint16 LoginPort;
|
||||
uint32 LoginCount;
|
||||
LinkedList<LoginConfig*> loginlist;
|
||||
bool Locked;
|
||||
uint16 WorldTCPPort;
|
||||
std::string WorldIP;
|
||||
bool TelnetEnabled;
|
||||
int32 MaxClients;
|
||||
bool WorldHTTPEnabled;
|
||||
uint16 WorldHTTPPort;
|
||||
std::string WorldHTTPMimeFile;
|
||||
std::string SharedKey;
|
||||
|
||||
// From <chatserver/>
|
||||
std::string ChatHost;
|
||||
uint16 ChatPort;
|
||||
// From <chatserver/>
|
||||
std::string ChatHost;
|
||||
uint16 ChatPort;
|
||||
|
||||
// From <mailserver/>
|
||||
std::string MailHost;
|
||||
uint16 MailPort;
|
||||
// From <mailserver/>
|
||||
std::string MailHost;
|
||||
uint16 MailPort;
|
||||
|
||||
// From <database/>
|
||||
std::string DatabaseHost;
|
||||
std::string DatabaseUsername;
|
||||
std::string DatabasePassword;
|
||||
std::string DatabaseDB;
|
||||
uint16 DatabasePort;
|
||||
// From <database/>
|
||||
std::string DatabaseHost;
|
||||
std::string DatabaseUsername;
|
||||
std::string DatabasePassword;
|
||||
std::string DatabaseDB;
|
||||
uint16 DatabasePort;
|
||||
|
||||
// From <qsdatabase> // QueryServ
|
||||
std::string QSDatabaseHost;
|
||||
std::string QSDatabaseUsername;
|
||||
std::string QSDatabasePassword;
|
||||
std::string QSDatabaseDB;
|
||||
uint16 QSDatabasePort;
|
||||
// From <qsdatabase> // QueryServ
|
||||
std::string QSDatabaseHost;
|
||||
std::string QSDatabaseUsername;
|
||||
std::string QSDatabasePassword;
|
||||
std::string QSDatabaseDB;
|
||||
uint16 QSDatabasePort;
|
||||
|
||||
// From <files/>
|
||||
std::string SpellsFile;
|
||||
std::string OpCodesFile;
|
||||
std::string PluginPlFile;
|
||||
// From <files/>
|
||||
std::string SpellsFile;
|
||||
std::string OpCodesFile;
|
||||
std::string EQTimeFile;
|
||||
std::string LogSettingsFile;
|
||||
|
||||
// From <directories/>
|
||||
std::string MapDir;
|
||||
std::string QuestDir;
|
||||
std::string PluginDir;
|
||||
std::string LuaModuleDir;
|
||||
std::string PatchDir;
|
||||
std::string SharedMemDir;
|
||||
std::string LogDir;
|
||||
// From <directories/>
|
||||
std::string MapDir;
|
||||
std::string QuestDir;
|
||||
std::string PluginDir;
|
||||
|
||||
// From <launcher/>
|
||||
std::string LogPrefix;
|
||||
std::string LogSuffix;
|
||||
std::string ZoneExe;
|
||||
uint32 RestartWait;
|
||||
uint32 TerminateWait;
|
||||
uint32 InitialBootWait;
|
||||
uint32 ZoneBootInterval;
|
||||
// From <launcher/>
|
||||
std::string LogPrefix;
|
||||
std::string LogSuffix;
|
||||
std::string ZoneExe;
|
||||
uint32 RestartWait;
|
||||
uint32 TerminateWait;
|
||||
uint32 InitialBootWait;
|
||||
uint32 ZoneBootInterval;
|
||||
|
||||
// From <zones/>
|
||||
uint16 ZonePortLow;
|
||||
uint16 ZonePortHigh;
|
||||
uint8 DefaultStatus;
|
||||
// From <zones/>
|
||||
uint16 ZonePortLow;
|
||||
uint16 ZonePortHigh;
|
||||
uint8 DefaultStatus;
|
||||
|
||||
// uint16 DynamicCount;
|
||||
|
||||
// map<string,uint16> StaticZones;
|
||||
|
||||
protected:
|
||||
protected:
|
||||
|
||||
static EQEmuConfig *_config;
|
||||
static EQEmuConfig *_config;
|
||||
|
||||
static std::string ConfigFile;
|
||||
static std::string ConfigFile;
|
||||
|
||||
#define ELEMENT(name) \
|
||||
void do_##name(TiXmlElement *ele);
|
||||
#include "eqemu_config_elements.h"
|
||||
#include "eqemu_config_elements.h"
|
||||
|
||||
|
||||
EQEmuConfig()
|
||||
{
|
||||
// import the needed handler prototypes
|
||||
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/";
|
||||
Handlers[#name]=(ElementHandler)&EQEmuConfig::do_##name;
|
||||
#include "eqemu_config_elements.h"
|
||||
|
||||
// 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() {}
|
||||
// Set sane defaults
|
||||
|
||||
public:
|
||||
// Login server
|
||||
LoginHost="eqemulator.net";
|
||||
LoginPort=5998;
|
||||
|
||||
// Produce a const singleton
|
||||
static const EQEmuConfig *get()
|
||||
{
|
||||
if (_config == nullptr) {
|
||||
LoadConfig();
|
||||
}
|
||||
return (_config);
|
||||
}
|
||||
// World
|
||||
Locked=false;
|
||||
WorldTCPPort=9000;
|
||||
TelnetEnabled=false;
|
||||
WorldHTTPEnabled=false;
|
||||
WorldHTTPPort=9080;
|
||||
WorldHTTPMimeFile="mime.types";
|
||||
SharedKey = ""; //blank disables authentication
|
||||
|
||||
// Allow the use to set the conf file to be used.
|
||||
static void SetConfigFile(std::string file)
|
||||
{
|
||||
EQEmuConfig::ConfigFile = file;
|
||||
}
|
||||
// Mail
|
||||
ChatHost="eqchat.eqemulator.net";
|
||||
ChatPort=7778;
|
||||
|
||||
// Load the config
|
||||
static bool LoadConfig()
|
||||
{
|
||||
if (_config != nullptr) {
|
||||
delete _config;
|
||||
}
|
||||
_config = new EQEmuConfig;
|
||||
return _config->ParseFile(EQEmuConfig::ConfigFile.c_str(), "server");
|
||||
}
|
||||
// Mail
|
||||
MailHost="eqmail.eqemulator.net";
|
||||
MailPort=7779;
|
||||
|
||||
void Dump() const;
|
||||
// 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";
|
||||
EQTimeFile="eqtime.cfg";
|
||||
LogSettingsFile="log.ini";
|
||||
|
||||
// Dirs
|
||||
MapDir="Maps";
|
||||
QuestDir="quests";
|
||||
PluginDir="plugins";
|
||||
|
||||
// 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";
|
||||
|
||||
// Dynamics to start
|
||||
//DynamicCount=5;
|
||||
|
||||
MaxClients=-1;
|
||||
|
||||
LoginCount=0;
|
||||
|
||||
}
|
||||
virtual ~EQEmuConfig() {}
|
||||
|
||||
public:
|
||||
|
||||
// Produce a const singleton
|
||||
static const EQEmuConfig *get() {
|
||||
if (_config == nullptr)
|
||||
LoadConfig();
|
||||
return(_config);
|
||||
}
|
||||
|
||||
// Allow the use to set the conf file to be used.
|
||||
static void SetConfigFile(std::string file) { EQEmuConfig::ConfigFile = file; }
|
||||
|
||||
// Load the config
|
||||
static bool LoadConfig() {
|
||||
if (_config != nullptr)
|
||||
delete _config;
|
||||
_config=new EQEmuConfig;
|
||||
|
||||
return _config->ParseFile(EQEmuConfig::ConfigFile.c_str(),"server");
|
||||
}
|
||||
|
||||
void Dump() const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,135 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
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; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#ifdef _WINDOWS
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include "eqemu_error.h"
|
||||
#include "linked_list.h"
|
||||
#include "mutex.h"
|
||||
#include "misc_functions.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#ifdef _WINDOWS
|
||||
#include <conio.h>
|
||||
#endif
|
||||
|
||||
void UpdateWindowTitle(char* iNewTitle = 0);
|
||||
void CatchSignal(int sig_num);
|
||||
|
||||
const char* EQEMuErrorText[EQEMuError_MaxErrorID] = { "ErrorID# 0, No Error",
|
||||
"MySQL Error #1405 or #2001 means your mysql server rejected the username and password you presented it.",
|
||||
"MySQL Error #2003 means you were unable to connect to the mysql server.",
|
||||
"MySQL Error #2005 means you there are too many connections on the mysql server. The server is overloaded.",
|
||||
"MySQL Error #2007 means you the server is out of memory. The server is overloaded.",
|
||||
};
|
||||
|
||||
LinkedList<char*>* EQEMuErrorList;
|
||||
Mutex* MEQEMuErrorList;
|
||||
AutoDelete< LinkedList<char*> > ADEQEMuErrorList(&EQEMuErrorList);
|
||||
AutoDelete<Mutex> ADMEQEMuErrorList(&MEQEMuErrorList);
|
||||
|
||||
const char* GetErrorText(uint32 iError) {
|
||||
if (iError >= EQEMuError_MaxErrorID)
|
||||
return "ErrorID# out of range";
|
||||
else
|
||||
return EQEMuErrorText[iError];
|
||||
}
|
||||
|
||||
void AddEQEMuError(eEQEMuError iError, bool iExitNow) {
|
||||
if (!iError)
|
||||
return;
|
||||
if (!EQEMuErrorList) {
|
||||
EQEMuErrorList = new LinkedList<char*>;
|
||||
MEQEMuErrorList = new Mutex;
|
||||
}
|
||||
LockMutex lock(MEQEMuErrorList);
|
||||
|
||||
LinkedListIterator<char*> iterator(*EQEMuErrorList);
|
||||
iterator.Reset();
|
||||
while (iterator.MoreElements()) {
|
||||
if (iterator.GetData()[0] == 1) {
|
||||
//Umm... this gets a big WTF...
|
||||
// if (*((uint32*) iterator.GetData()[1]) == iError)
|
||||
//not sure whats going on, using a character as a pointer....
|
||||
if (*((eEQEMuError*) &(iterator.GetData()[1])) == iError)
|
||||
return;
|
||||
}
|
||||
iterator.Advance();
|
||||
}
|
||||
|
||||
char* tmp = new char[6];
|
||||
tmp[0] = 1;
|
||||
tmp[5] = 0;
|
||||
*((uint32*) &tmp[1]) = iError;
|
||||
EQEMuErrorList->Append(tmp);
|
||||
|
||||
if (iExitNow)
|
||||
CatchSignal(2);
|
||||
}
|
||||
|
||||
void AddEQEMuError(char* iError, bool iExitNow) {
|
||||
if (!iError)
|
||||
return;
|
||||
if (!EQEMuErrorList) {
|
||||
EQEMuErrorList = new LinkedList<char*>;
|
||||
MEQEMuErrorList = new Mutex;
|
||||
}
|
||||
LockMutex lock(MEQEMuErrorList);
|
||||
char* tmp = strcpy(new char[strlen(iError) + 1], iError);
|
||||
EQEMuErrorList->Append(tmp);
|
||||
|
||||
if (iExitNow)
|
||||
CatchSignal(2);
|
||||
}
|
||||
|
||||
uint32 CheckEQEMuError() {
|
||||
if (!EQEMuErrorList)
|
||||
return 0;
|
||||
uint32 ret = 0;
|
||||
char* tmp = 0;
|
||||
bool HeaderPrinted = false;
|
||||
LockMutex lock(MEQEMuErrorList);
|
||||
|
||||
while ((tmp = EQEMuErrorList->Pop() )) {
|
||||
if (!HeaderPrinted) {
|
||||
fprintf(stdout, "===============================\nRuntime errors:\n\n");
|
||||
HeaderPrinted = true;
|
||||
}
|
||||
if (tmp[0] == 1) {
|
||||
fprintf(stdout, "%s\n", GetErrorText(*((uint32*) &tmp[1])));
|
||||
fprintf(stdout, "For more information on this error, visit http://www.eqemu.net/eqemuerror.php?id=%u\n\n", *((uint32*) &tmp[1]));
|
||||
}
|
||||
else {
|
||||
fprintf(stdout, "%s\n\n", tmp);
|
||||
}
|
||||
safe_delete(tmp);
|
||||
ret++;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void CheckEQEMuErrorAndPause() {
|
||||
#ifdef _WINDOWS
|
||||
if (CheckEQEMuError()) {
|
||||
fprintf(stdout, "Hit any key to exit\n");
|
||||
UpdateWindowTitle("Error");
|
||||
getch();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2015 EQEMu Development Team (http://eqemu.org)
|
||||
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
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
|
||||
@@ -15,21 +15,22 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#ifndef EQEMuError_H
|
||||
#define EQEMuError_H
|
||||
|
||||
// WHY IS THIS UP HERE
|
||||
#if defined(_DEBUG) && defined(WIN32)
|
||||
#ifndef _CRTDBG_MAP_ALLOC
|
||||
#include <stdlib.h>
|
||||
#include <crtdbg.h>
|
||||
#endif
|
||||
#endif
|
||||
#include "../common/types.h"
|
||||
|
||||
#ifndef EQDEBUG_H
|
||||
#define EQDEBUG_H
|
||||
enum eEQEMuError { EQEMuError_NoError,
|
||||
EQEMuError_Mysql_1405,
|
||||
EQEMuError_Mysql_2003,
|
||||
EQEMuError_Mysql_2005,
|
||||
EQEMuError_Mysql_2007,
|
||||
EQEMuError_MaxErrorID };
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
#endif
|
||||
void AddEQEMuError(eEQEMuError iError, bool iExitNow = false);
|
||||
void AddEQEMuError(char* iError, bool iExitNow = false);
|
||||
uint32 CheckEQEMuError();
|
||||
void CheckEQEMuErrorAndPause();
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,356 +0,0 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2015 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
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; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
#include "eqemu_logsys.h"
|
||||
#include "platform.h"
|
||||
#include "string_util.h"
|
||||
#include "database.h"
|
||||
#include "misc.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <iomanip>
|
||||
#include <time.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
std::ofstream process_log;
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#include <direct.h>
|
||||
#include <conio.h>
|
||||
#include <iostream>
|
||||
#include <dos.h>
|
||||
#include <windows.h>
|
||||
#include <process.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
/* Linux ANSI console color defines */
|
||||
#define LC_RESET "\033[0m"
|
||||
#define LC_BLACK "\033[30m" /* Black */
|
||||
#define LC_RED "\033[31m" /* Red */
|
||||
#define LC_GREEN "\033[32m" /* Green */
|
||||
#define LC_YELLOW "\033[33m" /* Yellow */
|
||||
#define LC_BLUE "\033[34m" /* Blue */
|
||||
#define LC_MAGENTA "\033[35m" /* Magenta */
|
||||
#define LC_CYAN "\033[36m" /* Cyan */
|
||||
#define LC_WHITE "\033[37m" /* White */
|
||||
|
||||
namespace Console {
|
||||
enum Color {
|
||||
Black = 0,
|
||||
Blue = 1,
|
||||
Green = 2,
|
||||
Cyan = 3,
|
||||
Red = 4,
|
||||
Magenta = 5,
|
||||
Brown = 6,
|
||||
LightGray = 7,
|
||||
DarkGray = 8,
|
||||
LightBlue = 9,
|
||||
LightGreen = 10,
|
||||
LightCyan = 11,
|
||||
LightRed = 12,
|
||||
LightMagenta = 13,
|
||||
Yellow = 14,
|
||||
White = 15
|
||||
};
|
||||
}
|
||||
|
||||
EQEmuLogSys::EQEmuLogSys()
|
||||
{
|
||||
on_log_gmsay_hook = [](uint16 log_type, const std::string&) {};
|
||||
bool file_logs_enabled = false;
|
||||
int log_platform = 0;
|
||||
}
|
||||
|
||||
EQEmuLogSys::~EQEmuLogSys()
|
||||
{
|
||||
}
|
||||
|
||||
void EQEmuLogSys::LoadLogSettingsDefaults()
|
||||
{
|
||||
/* Get Executable platform currently running this code (Zone/World/etc) */
|
||||
log_platform = GetExecutablePlatformInt();
|
||||
|
||||
/* Zero out Array */
|
||||
memset(log_settings, 0, sizeof(LogSettings) * Logs::LogCategory::MaxCategoryID);
|
||||
|
||||
/* Set Defaults */
|
||||
log_settings[Logs::World_Server].log_to_console = Logs::General;
|
||||
log_settings[Logs::Zone_Server].log_to_console = Logs::General;
|
||||
log_settings[Logs::QS_Server].log_to_console = Logs::General;
|
||||
log_settings[Logs::UCS_Server].log_to_console = Logs::General;
|
||||
log_settings[Logs::Crash].log_to_console = Logs::General;
|
||||
log_settings[Logs::MySQLError].log_to_console = Logs::General;
|
||||
log_settings[Logs::Login_Server].log_to_console = Logs::General;
|
||||
log_settings[Logs::Headless_Client].log_to_console = Logs::General;
|
||||
|
||||
/* Set Category enabled status on defaults */
|
||||
log_settings[Logs::World_Server].is_category_enabled = 1;
|
||||
log_settings[Logs::Zone_Server].is_category_enabled = 1;
|
||||
log_settings[Logs::QS_Server].is_category_enabled = 1;
|
||||
log_settings[Logs::UCS_Server].is_category_enabled = 1;
|
||||
log_settings[Logs::Crash].is_category_enabled = 1;
|
||||
log_settings[Logs::MySQLError].is_category_enabled = 1;
|
||||
log_settings[Logs::Login_Server].is_category_enabled = 1;
|
||||
|
||||
/* Declare process file names for log writing
|
||||
If there is no process_file_name declared, no log file will be written, simply
|
||||
*/
|
||||
if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformWorld)
|
||||
platform_file_name = "world";
|
||||
else if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformQueryServ)
|
||||
platform_file_name = "query_server";
|
||||
else if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone)
|
||||
platform_file_name = "zone";
|
||||
else if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformUCS)
|
||||
platform_file_name = "ucs";
|
||||
else if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformLogin)
|
||||
platform_file_name = "login";
|
||||
else if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformLaunch)
|
||||
platform_file_name = "launcher";
|
||||
else if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformHC)
|
||||
platform_file_name = "hc";
|
||||
}
|
||||
|
||||
std::string EQEmuLogSys::FormatOutMessageString(uint16 log_category, const std::string &in_message)
|
||||
{
|
||||
std::string ret;
|
||||
ret.push_back('[');
|
||||
ret.append(Logs::LogCategoryName[log_category]);
|
||||
ret.push_back(']');
|
||||
ret.push_back(' ');
|
||||
ret.append(in_message);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void EQEmuLogSys::ProcessGMSay(uint16 debug_level, uint16 log_category, const std::string &message)
|
||||
{
|
||||
/* Enabling Netcode based GMSay output creates a feedback loop that ultimately ends in a crash */
|
||||
if (log_category == Logs::LogCategory::Netcode)
|
||||
return;
|
||||
|
||||
/* Check to see if the process that actually ran this is zone */
|
||||
if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone)
|
||||
on_log_gmsay_hook(log_category, message);
|
||||
}
|
||||
|
||||
void EQEmuLogSys::ProcessLogWrite(uint16 debug_level, uint16 log_category, const std::string &message)
|
||||
{
|
||||
if (log_category == Logs::Crash) {
|
||||
char time_stamp[80];
|
||||
EQEmuLogSys::SetCurrentTimeStamp(time_stamp);
|
||||
std::ofstream crash_log;
|
||||
EQEmuLogSys::MakeDirectory("logs/crashes");
|
||||
crash_log.open(StringFormat("logs/crashes/crash_%s_%i.log", platform_file_name.c_str(), getpid()), std::ios_base::app | std::ios_base::out);
|
||||
crash_log << time_stamp << " " << message << "\n";
|
||||
crash_log.close();
|
||||
}
|
||||
|
||||
char time_stamp[80];
|
||||
EQEmuLogSys::SetCurrentTimeStamp(time_stamp);
|
||||
|
||||
if (process_log)
|
||||
process_log << time_stamp << " " << message << std::endl;
|
||||
}
|
||||
|
||||
uint16 EQEmuLogSys::GetWindowsConsoleColorFromCategory(uint16 log_category) {
|
||||
switch (log_category) {
|
||||
case Logs::Status:
|
||||
case Logs::Normal:
|
||||
return Console::Color::Yellow;
|
||||
case Logs::MySQLError:
|
||||
case Logs::Error:
|
||||
return Console::Color::LightRed;
|
||||
case Logs::MySQLQuery:
|
||||
case Logs::Debug:
|
||||
return Console::Color::LightGreen;
|
||||
case Logs::Quests:
|
||||
return Console::Color::LightCyan;
|
||||
case Logs::Commands:
|
||||
case Logs::Mercenaries:
|
||||
return Console::Color::LightMagenta;
|
||||
case Logs::Crash:
|
||||
return Console::Color::LightRed;
|
||||
default:
|
||||
return Console::Color::Yellow;
|
||||
}
|
||||
}
|
||||
|
||||
std::string EQEmuLogSys::GetLinuxConsoleColorFromCategory(uint16 log_category) {
|
||||
switch (log_category) {
|
||||
case Logs::Status:
|
||||
case Logs::Normal:
|
||||
return LC_YELLOW;
|
||||
case Logs::MySQLError:
|
||||
case Logs::Error:
|
||||
return LC_RED;
|
||||
case Logs::MySQLQuery:
|
||||
case Logs::Debug:
|
||||
return LC_GREEN;
|
||||
case Logs::Quests:
|
||||
return LC_CYAN;
|
||||
case Logs::Commands:
|
||||
case Logs::Mercenaries:
|
||||
return LC_MAGENTA;
|
||||
case Logs::Crash:
|
||||
return LC_RED;
|
||||
default:
|
||||
return LC_YELLOW;
|
||||
}
|
||||
}
|
||||
|
||||
uint16 EQEmuLogSys::GetGMSayColorFromCategory(uint16 log_category) {
|
||||
switch (log_category) {
|
||||
case Logs::Status:
|
||||
case Logs::Normal:
|
||||
return 15; /* Yellow */
|
||||
case Logs::MySQLError:
|
||||
case Logs::Error:
|
||||
return 13; /* Red */
|
||||
case Logs::MySQLQuery:
|
||||
case Logs::Debug:
|
||||
return 14; /* Light Green */
|
||||
case Logs::Quests:
|
||||
return 258; /* Light Cyan */
|
||||
case Logs::Commands:
|
||||
case Logs::Mercenaries:
|
||||
return 5; /* Light Purple */
|
||||
case Logs::Crash:
|
||||
return 13; /* Red */
|
||||
default:
|
||||
return 15; /* Yellow */
|
||||
}
|
||||
}
|
||||
|
||||
void EQEmuLogSys::ProcessConsoleMessage(uint16 debug_level, uint16 log_category, const std::string &message)
|
||||
{
|
||||
|
||||
#ifdef _WINDOWS
|
||||
HANDLE console_handle;
|
||||
console_handle = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
CONSOLE_FONT_INFOEX info = { 0 };
|
||||
info.cbSize = sizeof(info);
|
||||
info.dwFontSize.Y = 12; // leave X as zero
|
||||
info.FontWeight = FW_NORMAL;
|
||||
wcscpy(info.FaceName, L"Lucida Console");
|
||||
SetCurrentConsoleFontEx(console_handle, NULL, &info);
|
||||
SetConsoleTextAttribute(console_handle, EQEmuLogSys::GetWindowsConsoleColorFromCategory(log_category));
|
||||
std::cout << message << "\n";
|
||||
SetConsoleTextAttribute(console_handle, Console::Color::White);
|
||||
#else
|
||||
std::cout << EQEmuLogSys::GetLinuxConsoleColorFromCategory(log_category) << message << LC_RESET << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
void EQEmuLogSys::Out(Logs::DebugLevel debug_level, uint16 log_category, std::string message, ...)
|
||||
{
|
||||
|
||||
bool log_to_console = true;
|
||||
if (log_settings[log_category].log_to_console < debug_level) {
|
||||
log_to_console = false;
|
||||
}
|
||||
|
||||
bool log_to_file = true;
|
||||
if (log_settings[log_category].log_to_file < debug_level) {
|
||||
log_to_file = false;
|
||||
}
|
||||
|
||||
bool log_to_gmsay = true;
|
||||
if (log_settings[log_category].log_to_gmsay < debug_level) {
|
||||
log_to_gmsay = false;
|
||||
}
|
||||
|
||||
const bool nothing_to_log = !log_to_console && !log_to_file && !log_to_gmsay;
|
||||
if (nothing_to_log)
|
||||
return;
|
||||
|
||||
va_list args;
|
||||
va_start(args, message);
|
||||
std::string output_message = vStringFormat(message.c_str(), args);
|
||||
va_end(args);
|
||||
|
||||
std::string output_debug_message = EQEmuLogSys::FormatOutMessageString(log_category, output_message);
|
||||
|
||||
if (log_to_console) EQEmuLogSys::ProcessConsoleMessage(debug_level, log_category, output_debug_message);
|
||||
if (log_to_gmsay) EQEmuLogSys::ProcessGMSay(debug_level, log_category, output_debug_message);
|
||||
if (log_to_file) EQEmuLogSys::ProcessLogWrite(debug_level, log_category, output_debug_message);
|
||||
}
|
||||
|
||||
void EQEmuLogSys::SetCurrentTimeStamp(char* time_stamp)
|
||||
{
|
||||
time_t raw_time;
|
||||
struct tm * time_info;
|
||||
time(&raw_time);
|
||||
time_info = localtime(&raw_time);
|
||||
strftime(time_stamp, 80, "[%m-%d-%Y :: %H:%M:%S]", time_info);
|
||||
}
|
||||
|
||||
void EQEmuLogSys::MakeDirectory(const std::string &directory_name)
|
||||
{
|
||||
#ifdef _WINDOWS
|
||||
struct _stat st;
|
||||
if (_stat(directory_name.c_str(), &st) == 0) // exists
|
||||
return;
|
||||
_mkdir(directory_name.c_str());
|
||||
#else
|
||||
struct stat st;
|
||||
if (stat(directory_name.c_str(), &st) == 0) // exists
|
||||
return;
|
||||
mkdir(directory_name.c_str(), 0755);
|
||||
#endif
|
||||
}
|
||||
|
||||
void EQEmuLogSys::CloseFileLogs()
|
||||
{
|
||||
if (process_log.is_open()) {
|
||||
process_log.close();
|
||||
}
|
||||
}
|
||||
|
||||
void EQEmuLogSys::StartFileLogs(const std::string &log_name)
|
||||
{
|
||||
EQEmuLogSys::CloseFileLogs();
|
||||
|
||||
/* When loading settings, we must have been given a reason in category based logging to output to a file in order to even create or open one... */
|
||||
if (file_logs_enabled == false)
|
||||
return;
|
||||
|
||||
if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone) {
|
||||
if (!log_name.empty())
|
||||
platform_file_name = log_name;
|
||||
|
||||
if (platform_file_name.empty())
|
||||
return;
|
||||
|
||||
EQEmuLogSys::Out(Logs::General, Logs::Status, "Starting File Log 'logs/%s_%i.log'", platform_file_name.c_str(), getpid());
|
||||
EQEmuLogSys::MakeDirectory("logs/zone");
|
||||
process_log.open(StringFormat("logs/zone/%s_%i.log", platform_file_name.c_str(), getpid()), std::ios_base::app | std::ios_base::out);
|
||||
} else {
|
||||
if (platform_file_name.empty())
|
||||
return;
|
||||
|
||||
EQEmuLogSys::Out(Logs::General, Logs::Status, "Starting File Log 'logs/%s_%i.log'", platform_file_name.c_str(), getpid());
|
||||
process_log.open(StringFormat("logs/%s_%i.log", platform_file_name.c_str(), getpid()), std::ios_base::app | std::ios_base::out);
|
||||
}
|
||||
}
|
||||
@@ -1,227 +0,0 @@
|
||||
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2015 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
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; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_LOGSYS_H
|
||||
#define EQEMU_LOGSYS_H
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <stdio.h>
|
||||
#include <functional>
|
||||
#include "types.h"
|
||||
|
||||
namespace Logs {
|
||||
enum DebugLevel {
|
||||
General = 1, /* 1 - Low-Level general debugging, useful info on single line */
|
||||
Moderate, /* 2 - Informational based, used in functions, when particular things load */
|
||||
Detail /* 3 - Use this for extreme detail in logging, usually in extreme debugging in the stack or interprocess communication */
|
||||
};
|
||||
|
||||
/*
|
||||
If you add to this, make sure you update LogCategoryName
|
||||
NOTE: Only add to the bottom of the enum because that is the type ID assignment
|
||||
*/
|
||||
|
||||
enum LogCategory {
|
||||
None = 0,
|
||||
AA,
|
||||
AI,
|
||||
Aggro,
|
||||
Attack,
|
||||
Client_Server_Packet,
|
||||
Combat,
|
||||
Commands,
|
||||
Crash,
|
||||
Debug,
|
||||
Doors,
|
||||
Error,
|
||||
Guilds,
|
||||
Inventory,
|
||||
Launcher,
|
||||
Netcode,
|
||||
Normal,
|
||||
Object,
|
||||
Pathing,
|
||||
QS_Server,
|
||||
Quests,
|
||||
Rules,
|
||||
Skills,
|
||||
Spawns,
|
||||
Spells,
|
||||
Status,
|
||||
TCP_Connection,
|
||||
Tasks,
|
||||
Tradeskills,
|
||||
Trading,
|
||||
Tribute,
|
||||
UCS_Server,
|
||||
WebInterface_Server,
|
||||
World_Server,
|
||||
Zone_Server,
|
||||
MySQLError,
|
||||
MySQLQuery,
|
||||
Mercenaries,
|
||||
QuestDebug,
|
||||
Server_Client_Packet,
|
||||
Client_Server_Packet_Unhandled,
|
||||
Server_Client_Packet_With_Dump,
|
||||
Client_Server_Packet_With_Dump,
|
||||
Login_Server,
|
||||
Client_Login,
|
||||
Headless_Client,
|
||||
MaxCategoryID /* Don't Remove this*/
|
||||
};
|
||||
|
||||
/* If you add to this, make sure you update LogCategory */
|
||||
static const char* LogCategoryName[LogCategory::MaxCategoryID] = {
|
||||
"",
|
||||
"AA",
|
||||
"AI",
|
||||
"Aggro",
|
||||
"Attack",
|
||||
"Packet :: Client -> Server",
|
||||
"Combat",
|
||||
"Commands",
|
||||
"Crash",
|
||||
"Debug",
|
||||
"Doors",
|
||||
"Error",
|
||||
"Guilds",
|
||||
"Inventory",
|
||||
"Launcher",
|
||||
"Netcode",
|
||||
"Normal",
|
||||
"Object",
|
||||
"Pathing",
|
||||
"QS Server",
|
||||
"Quests",
|
||||
"Rules",
|
||||
"Skills",
|
||||
"Spawns",
|
||||
"Spells",
|
||||
"Status",
|
||||
"TCP Connection",
|
||||
"Tasks",
|
||||
"Tradeskills",
|
||||
"Trading",
|
||||
"Tribute",
|
||||
"UCS Server",
|
||||
"WebInterface Server",
|
||||
"World Server",
|
||||
"Zone Server",
|
||||
"MySQL Error",
|
||||
"MySQL Query",
|
||||
"Mercenaries",
|
||||
"Quest Debug",
|
||||
"Packet :: Server -> Client",
|
||||
"Packet :: Client -> Server Unhandled",
|
||||
"Packet :: Server -> Client (Dump)",
|
||||
"Packet :: Client -> Server (Dump)",
|
||||
"Login Server",
|
||||
"Client Login"
|
||||
};
|
||||
}
|
||||
|
||||
#define Log(debug_level, log_category, message, ...) do {\
|
||||
if (LogSys.log_settings[log_category].is_category_enabled == 1)\
|
||||
LogSys.Out(debug_level, log_category, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
#define LogF(debug_level, log_category, message, ...) do {\
|
||||
if (LogSys.log_settings[log_category].is_category_enabled == 1)\
|
||||
LogSys.OutF(debug_level, log_category, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
class EQEmuLogSys {
|
||||
public:
|
||||
EQEmuLogSys();
|
||||
~EQEmuLogSys();
|
||||
|
||||
void CloseFileLogs(); /* Close File Logs wherever necessary, either at zone shutdown or entire process shutdown for everything else. This should be handled on deconstructor but to be safe we use it anyways. */
|
||||
void LoadLogSettingsDefaults(); /* Initializes log_settings and sets some defaults if DB is not present */
|
||||
void MakeDirectory(const std::string &directory_name); /* Platform independent way of performing a MakeDirectory based on name */
|
||||
/*
|
||||
The one and only Logging function that uses a debug level as a parameter, as well as a log_category
|
||||
log_category - defined in Logs::LogCategory::[]
|
||||
log_category name resolution works by passing the enum int ID to Logs::LogCategoryName[category_id]
|
||||
|
||||
Example: EQEmuLogSys::Out(Logs::General, Logs::Guilds, "This guild has no leader present");
|
||||
- This would pipe the same category and debug level to all output formats, but the internal memory reference of log_settings would
|
||||
be checked against to see if that piped output is set to actually process it for the category and debug level
|
||||
*/
|
||||
void Out(Logs::DebugLevel debug_level, uint16 log_category, std::string message, ...);
|
||||
void SetCurrentTimeStamp(char* time_stamp); /* Used in file logs to prepend a timestamp entry for logs */
|
||||
void StartFileLogs(const std::string &log_name = ""); /* Used to declare the processes file log and to keep it open for later use */
|
||||
|
||||
template <typename... Args>
|
||||
void OutF(Logs::DebugLevel debug_level, uint16 log_category, const char *fmt, const Args&... args)
|
||||
{
|
||||
std::string log_str = fmt::format(fmt, args...);
|
||||
Out(debug_level, log_category, log_str);
|
||||
}
|
||||
|
||||
/*
|
||||
LogSettings Struct
|
||||
|
||||
This struct is the master reference for all settings for each category, and for each output
|
||||
|
||||
log_to_file[category_id] = [1-3] - Sets debug level for category to output to file
|
||||
log_to_console[category_id] = [1-3] - Sets debug level for category to output to console
|
||||
log_to_gmsay[category_id] = [1-3] - Sets debug level for category to output to gmsay
|
||||
*/
|
||||
|
||||
struct LogSettings {
|
||||
uint8 log_to_file;
|
||||
uint8 log_to_console;
|
||||
uint8 log_to_gmsay;
|
||||
uint8 is_category_enabled; /* When any log output in a category > 0, set this to 1 as (Enabled) */
|
||||
};
|
||||
|
||||
/* Internally used memory reference for all log settings per category.
|
||||
These are loaded via DB and have defaults loaded in LoadLogSettingsDefaults.
|
||||
Database loaded via Database::LoadLogSettings(log_settings)
|
||||
*/
|
||||
LogSettings log_settings[Logs::LogCategory::MaxCategoryID];
|
||||
|
||||
bool file_logs_enabled; /* Set when log settings are loaded to determine if keeping a file open is necessary */
|
||||
|
||||
int log_platform; /* Sets Executable platform (Zone/World/UCS) etc. */
|
||||
|
||||
std::string platform_file_name; /* File name used in writing logs */
|
||||
|
||||
uint16 GetGMSayColorFromCategory(uint16 log_category); /* GMSay Client Message colors mapped by category */
|
||||
|
||||
void OnLogHookCallBackZone(std::function<void(uint16 log_type, const std::string&)> f) { on_log_gmsay_hook = f; }
|
||||
|
||||
private:
|
||||
std::function<void(uint16 log_category, const std::string&)> on_log_gmsay_hook; /* Callback pointer to zone process for hooking logs to zone using GMSay */
|
||||
std::string FormatOutMessageString(uint16 log_category, const std::string &in_message); /* Formats log messages like '[Category] This is a log message' */
|
||||
std::string GetLinuxConsoleColorFromCategory(uint16 log_category); /* Linux console color messages mapped by category */
|
||||
|
||||
uint16 GetWindowsConsoleColorFromCategory(uint16 log_category); /* Windows console color messages mapped by category */
|
||||
|
||||
void ProcessConsoleMessage(uint16 debug_level, uint16 log_category, const std::string &message); /* ProcessConsoleMessage called via Log */
|
||||
void ProcessGMSay(uint16 debug_level, uint16 log_category, const std::string &message); /* ProcessGMSay called via Log */
|
||||
void ProcessLogWrite(uint16 debug_level, uint16 log_category, const std::string &message); /* ProcessLogWrite called via Log */
|
||||
};
|
||||
|
||||
extern EQEmuLogSys LogSys;
|
||||
|
||||
#endif
|
||||
+110
-42
@@ -17,8 +17,7 @@
|
||||
*/
|
||||
|
||||
#include <fstream>
|
||||
#include "../common/global_define.h"
|
||||
#include "../common/eqemu_logsys.h"
|
||||
#include "../common/debug.h"
|
||||
#include "../common/eqtime.h"
|
||||
#include "../common/eq_packet_structs.h"
|
||||
#include <memory.h>
|
||||
@@ -43,19 +42,19 @@ EQTime::EQTime(TimeOfDay_Struct start_eq, time_t start_real)
|
||||
|
||||
EQTime::EQTime()
|
||||
{
|
||||
timezone = 0;
|
||||
timezone=0;
|
||||
memset(&eqTime, 0, sizeof(eqTime));
|
||||
//Defaults for time
|
||||
TimeOfDay_Struct start;
|
||||
start.day = 1;
|
||||
start.hour = 9;
|
||||
start.minute = 0;
|
||||
start.month = 1;
|
||||
start.year = 3100;
|
||||
start.day=1;
|
||||
start.hour=9;
|
||||
start.minute=0;
|
||||
start.month=1;
|
||||
start.year=3100;
|
||||
//Set default time zone
|
||||
timezone = 0;
|
||||
timezone=0;
|
||||
//Start EQTimer
|
||||
SetCurrentEQTimeOfDay(start, time(0));
|
||||
setEQTimeOfDay(start, time(0));
|
||||
}
|
||||
|
||||
EQTime::~EQTime()
|
||||
@@ -67,10 +66,10 @@ EQTime::~EQTime()
|
||||
//Input: Current Time (as a time_t), a pointer to the TimeOfDay_Struct that will be written to.
|
||||
//Output: 0=Error, 1=Sucess
|
||||
|
||||
int EQTime::GetCurrentEQTimeOfDay(time_t timeConvert, struct TimeOfDay_Struct *eqTimeOfDay)
|
||||
int EQTime::getEQTimeOfDay( time_t timeConvert, struct TimeOfDay_Struct *eqTimeOfDay )
|
||||
{
|
||||
/* check to see if we have a reference time to go by. */
|
||||
if (eqTime.start_realtime == 0)
|
||||
if( eqTime.start_realtime == 0 )
|
||||
return 0;
|
||||
|
||||
unsigned long diff = timeConvert - eqTime.start_realtime;
|
||||
@@ -83,7 +82,7 @@ int EQTime::GetCurrentEQTimeOfDay(time_t timeConvert, struct TimeOfDay_Struct *e
|
||||
int32 ntz = timezone;
|
||||
|
||||
/* The minutes range from 0 - 59 */
|
||||
diff += eqTime.start_eqtime.minute + (ntz % 60);
|
||||
diff += eqTime.start_eqtime.minute + (ntz%60);
|
||||
eqTimeOfDay->minute = diff % 60;
|
||||
diff /= 60;
|
||||
ntz /= 60;
|
||||
@@ -97,24 +96,24 @@ int EQTime::GetCurrentEQTimeOfDay(time_t timeConvert, struct TimeOfDay_Struct *e
|
||||
//
|
||||
// Modify it so that it works from
|
||||
// 0-23 for our calculations
|
||||
diff += (eqTime.start_eqtime.hour - 1) + (ntz % 24);
|
||||
eqTimeOfDay->hour = (diff % 24) + 1;
|
||||
diff += ( eqTime.start_eqtime.hour - 1) + (ntz%24);
|
||||
eqTimeOfDay->hour = (diff%24) + 1;
|
||||
diff /= 24;
|
||||
ntz /= 24;
|
||||
|
||||
// The days range from 1-28
|
||||
// Modify it so that it works from
|
||||
// 0-27 for our calculations
|
||||
diff += (eqTime.start_eqtime.day - 1) + (ntz % 28);
|
||||
eqTimeOfDay->day = (diff % 28) + 1;
|
||||
diff += ( eqTime.start_eqtime.day - 1 ) + (ntz%28);
|
||||
eqTimeOfDay->day = (diff%28) + 1;
|
||||
diff /= 28;
|
||||
ntz /= 28;
|
||||
|
||||
// The months range from 1-12
|
||||
// Modify it so that it works from
|
||||
// 0-11 for our calculations
|
||||
diff += (eqTime.start_eqtime.month - 1) + (ntz % 12);
|
||||
eqTimeOfDay->month = (diff % 12) + 1;
|
||||
diff += ( eqTime.start_eqtime.month - 1 ) + (ntz%12);
|
||||
eqTimeOfDay->month = (diff%12) + 1;
|
||||
diff /= 12;
|
||||
ntz /= 12;
|
||||
|
||||
@@ -124,34 +123,102 @@ int EQTime::GetCurrentEQTimeOfDay(time_t timeConvert, struct TimeOfDay_Struct *e
|
||||
}
|
||||
|
||||
//setEQTimeOfDay
|
||||
int EQTime::SetCurrentEQTimeOfDay(TimeOfDay_Struct start_eq, time_t start_real)
|
||||
int EQTime::setEQTimeOfDay(TimeOfDay_Struct start_eq, time_t start_real)
|
||||
{
|
||||
if (start_real == 0)
|
||||
if(start_real==0)
|
||||
return 0;
|
||||
eqTime.start_eqtime = start_eq;
|
||||
eqTime.start_realtime = start_real;
|
||||
eqTime.start_eqtime=start_eq;
|
||||
eqTime.start_realtime=start_real;
|
||||
return 1;
|
||||
}
|
||||
|
||||
//saveFile and loadFile need to use long for the save datatype...
|
||||
//For some reason, ifstream/ofstream have problems with EQEmu datatypes in files.
|
||||
bool EQTime::saveFile(const char *filename)
|
||||
{
|
||||
std::ofstream of;
|
||||
of.open(filename);
|
||||
if(!of)
|
||||
{
|
||||
LogFile->write(EQEMuLog::Error, "EQTime::saveFile failed: Unable to open file '%s'", filename);
|
||||
return false;
|
||||
}
|
||||
//Enable for debugging
|
||||
//std::cout << "SAVE: day=" << (long)eqTime.start_eqtime.day << ";hour=" << (long)eqTime.start_eqtime.hour << ";min=" << (long)eqTime.start_eqtime.minute << ";mon=" << (long)eqTime.start_eqtime.month << ";yr=" << eqTime.start_eqtime.year << ";timet=" << eqTime.start_realtime << std::endl;
|
||||
of << EQT_VERSION << std::endl;
|
||||
of << (long)eqTime.start_eqtime.day << std::endl;
|
||||
of << (long)eqTime.start_eqtime.hour << std::endl;
|
||||
of << (long)eqTime.start_eqtime.minute << std::endl;
|
||||
of << (long)eqTime.start_eqtime.month << std::endl;
|
||||
of << eqTime.start_eqtime.year << std::endl;
|
||||
of << eqTime.start_realtime << std::endl;
|
||||
of.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EQTime::loadFile(const char *filename)
|
||||
{
|
||||
int version=0;
|
||||
long in_data=0;
|
||||
std::ifstream in;
|
||||
in.open(filename);
|
||||
if(!in)
|
||||
{
|
||||
LogFile->write(EQEMuLog::Error, "Could not load EQTime file %s", filename);
|
||||
return false;
|
||||
}
|
||||
in >> version;
|
||||
in.ignore(80, '\n');
|
||||
if(version != EQT_VERSION)
|
||||
{
|
||||
LogFile->write(EQEMuLog::Error, "'%s' is NOT a valid EQTime file. File version is %i, EQTime version is %i", filename, version, EQT_VERSION);
|
||||
return false;
|
||||
}
|
||||
//in >> eqTime.start_eqtime.day;
|
||||
in >> in_data;
|
||||
in.ignore(80, '\n');
|
||||
eqTime.start_eqtime.day = in_data;
|
||||
//in >> eqTime.start_eqtime.hour;
|
||||
in >> in_data;
|
||||
eqTime.start_eqtime.hour = in_data;
|
||||
in.ignore(80, '\n');
|
||||
//in >> eqTime.start_eqtime.minute;
|
||||
in >> in_data;
|
||||
in.ignore(80, '\n');
|
||||
eqTime.start_eqtime.minute = in_data;
|
||||
//in >> eqTime.start_eqtime.month;
|
||||
in >> in_data;
|
||||
in.ignore(80, '\n');
|
||||
eqTime.start_eqtime.month = in_data;
|
||||
in >> eqTime.start_eqtime.year;
|
||||
in.ignore(80, '\n');
|
||||
in >> eqTime.start_realtime;
|
||||
//Enable for debugging...
|
||||
//std::cout << "LOAD: day=" << (long)eqTime.start_eqtime.day << ";hour=" << (long)eqTime.start_eqtime.hour << ";min=" << (long)eqTime.start_eqtime.minute << ";mon=" << (long)eqTime.start_eqtime.month << ";yr=" << eqTime.start_eqtime.year << ";timet=" << eqTime.start_realtime << std::endl;
|
||||
in.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool EQTime::IsTimeBefore(TimeOfDay_Struct *base, TimeOfDay_Struct *test) {
|
||||
if (base->year > test->year)
|
||||
if(base->year > test->year)
|
||||
return(true);
|
||||
if (base->year < test->year)
|
||||
if(base->year < test->year)
|
||||
return(false);
|
||||
//same years
|
||||
if (base->month > test->month)
|
||||
if(base->month > test->month)
|
||||
return(true);
|
||||
if (base->month < test->month)
|
||||
if(base->month < test->month)
|
||||
return(false);
|
||||
//same month
|
||||
if (base->day > test->day)
|
||||
if(base->day > test->day)
|
||||
return(true);
|
||||
if (base->day < test->day)
|
||||
if(base->day < test->day)
|
||||
return(false);
|
||||
//same day
|
||||
if (base->hour > test->hour)
|
||||
if(base->hour > test->hour)
|
||||
return(true);
|
||||
if (base->hour < test->hour)
|
||||
if(base->hour < test->hour)
|
||||
return(false);
|
||||
//same hour...
|
||||
return(base->minute > test->minute);
|
||||
@@ -164,7 +231,7 @@ void EQTime::AddMinutes(uint32 minutes, TimeOfDay_Struct *to) {
|
||||
//minutes start at 0, everything else starts at 1
|
||||
cur = to->minute;
|
||||
cur += minutes;
|
||||
if (cur < 60) {
|
||||
if(cur < 60) {
|
||||
to->minute = cur;
|
||||
return;
|
||||
}
|
||||
@@ -172,29 +239,29 @@ void EQTime::AddMinutes(uint32 minutes, TimeOfDay_Struct *to) {
|
||||
//carry hours
|
||||
cur /= 60;
|
||||
cur += to->hour;
|
||||
if (cur <= 24) {
|
||||
if(cur <= 24) {
|
||||
to->hour = cur;
|
||||
return;
|
||||
}
|
||||
to->hour = ((cur - 1) % 24) + 1;
|
||||
to->hour = ((cur-1) % 24) + 1;
|
||||
//carry days
|
||||
cur = (cur - 1) / 24;
|
||||
cur = (cur-1) / 24;
|
||||
cur += to->day;
|
||||
if (cur <= 28) {
|
||||
if(cur <= 28) {
|
||||
to->day = cur;
|
||||
return;
|
||||
}
|
||||
to->day = ((cur - 1) % 28) + 1;
|
||||
to->day = ((cur-1) % 28) + 1;
|
||||
//carry months
|
||||
cur = (cur - 1) / 28;
|
||||
cur = (cur-1) / 28;
|
||||
cur += to->month;
|
||||
if (cur <= 12) {
|
||||
if(cur <= 12) {
|
||||
to->month = cur;
|
||||
return;
|
||||
}
|
||||
to->month = ((cur - 1) % 12) + 1;
|
||||
to->month = ((cur-1) % 12) + 1;
|
||||
//carry years
|
||||
to->year += (cur - 1) / 12;
|
||||
to->year += (cur-1) / 12;
|
||||
}
|
||||
|
||||
void EQTime::ToString(TimeOfDay_Struct *t, std::string &str) {
|
||||
@@ -203,4 +270,5 @@ void EQTime::ToString(TimeOfDay_Struct *t, std::string &str) {
|
||||
t->month, t->day, t->year, t->hour, t->minute);
|
||||
buf[127] = '\0';
|
||||
str = buf;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+9
-3
@@ -21,8 +21,8 @@ public:
|
||||
~EQTime();
|
||||
|
||||
//Get functions
|
||||
int GetCurrentEQTimeOfDay( TimeOfDay_Struct *eqTimeOfDay ) { return(GetCurrentEQTimeOfDay(time(nullptr), eqTimeOfDay)); }
|
||||
int GetCurrentEQTimeOfDay( time_t timeConvert, TimeOfDay_Struct *eqTimeOfDay );
|
||||
int getEQTimeOfDay( TimeOfDay_Struct *eqTimeOfDay ) { return(getEQTimeOfDay(time(nullptr), eqTimeOfDay)); }
|
||||
int getEQTimeOfDay( time_t timeConvert, TimeOfDay_Struct *eqTimeOfDay );
|
||||
TimeOfDay_Struct getStartEQTime() { return eqTime.start_eqtime; }
|
||||
time_t getStartRealTime() { return eqTime.start_realtime; }
|
||||
uint32 getEQTimeZone() { return timezone; }
|
||||
@@ -30,7 +30,7 @@ public:
|
||||
uint32 getEQTimeZoneMin() { return timezone%60; }
|
||||
|
||||
//Set functions
|
||||
int SetCurrentEQTimeOfDay(TimeOfDay_Struct start_eq, time_t start_real);
|
||||
int setEQTimeOfDay(TimeOfDay_Struct start_eq, time_t start_real);
|
||||
void setEQTimeZone(int32 in_timezone) { timezone=in_timezone; }
|
||||
|
||||
//Time math/logic functions
|
||||
@@ -39,6 +39,12 @@ public:
|
||||
|
||||
static void ToString(TimeOfDay_Struct *t, std::string &str);
|
||||
|
||||
//Database functions
|
||||
//bool loadDB(Database q);
|
||||
//bool setDB(Database q);
|
||||
bool loadFile(const char *filename);
|
||||
bool saveFile(const char *filename);
|
||||
|
||||
private:
|
||||
//This is our reference clock.
|
||||
eqTimeOfDay eqTime;
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
#pragma once
|
||||
#include <functional>
|
||||
#include "event_loop.h"
|
||||
|
||||
namespace EQ {
|
||||
class BackgroundTask
|
||||
{
|
||||
public:
|
||||
typedef std::function<void(void)> BackgroundTaskFunction;
|
||||
struct BackgroundTaskBaton
|
||||
{
|
||||
BackgroundTaskFunction fn;
|
||||
BackgroundTaskFunction on_finish;
|
||||
};
|
||||
|
||||
BackgroundTask(BackgroundTaskFunction fn, BackgroundTaskFunction on_finish) {
|
||||
uv_work_t *m_work = new uv_work_t;
|
||||
memset(m_work, 0, sizeof(uv_work_t));
|
||||
BackgroundTaskBaton *baton = new BackgroundTaskBaton();
|
||||
baton->fn = fn;
|
||||
baton->on_finish = on_finish;
|
||||
|
||||
m_work->data = baton;
|
||||
uv_queue_work(EventLoop::Get().Handle(), m_work, [](uv_work_t* req) {
|
||||
BackgroundTaskBaton *baton = (BackgroundTaskBaton*)req->data;
|
||||
baton->fn();
|
||||
}, [](uv_work_t* req, int status) {
|
||||
BackgroundTaskBaton *baton = (BackgroundTaskBaton*)req->data;
|
||||
baton->on_finish();
|
||||
delete baton;
|
||||
delete req;
|
||||
});
|
||||
}
|
||||
|
||||
~BackgroundTask() {
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
#pragma once
|
||||
#include <functional>
|
||||
#include <uv.h>
|
||||
#include <cstring>
|
||||
|
||||
namespace EQ
|
||||
{
|
||||
class EventLoop
|
||||
{
|
||||
public:
|
||||
static EventLoop &Get() {
|
||||
static EventLoop inst;
|
||||
return inst;
|
||||
}
|
||||
|
||||
~EventLoop() {
|
||||
uv_loop_close(&m_loop);
|
||||
}
|
||||
|
||||
void Process() {
|
||||
uv_run(&m_loop, UV_RUN_NOWAIT);
|
||||
}
|
||||
|
||||
uv_loop_t* Handle() { return &m_loop; }
|
||||
|
||||
private:
|
||||
EventLoop() {
|
||||
memset(&m_loop, 0, sizeof(uv_loop_t));
|
||||
uv_loop_init(&m_loop);
|
||||
}
|
||||
|
||||
EventLoop(const EventLoop&);
|
||||
EventLoop& operator=(const EventLoop&);
|
||||
|
||||
uv_loop_t m_loop;
|
||||
};
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
#pragma once
|
||||
#include <functional>
|
||||
#include "event_loop.h"
|
||||
|
||||
namespace EQ {
|
||||
class Timer
|
||||
{
|
||||
public:
|
||||
Timer(std::function<void(Timer *)> cb)
|
||||
{
|
||||
m_timer = nullptr;
|
||||
m_cb = cb;
|
||||
}
|
||||
|
||||
Timer(uint64_t duration_ms, bool repeats, std::function<void(Timer *)> cb)
|
||||
{
|
||||
m_timer = nullptr;
|
||||
m_cb = cb;
|
||||
Start(duration_ms, repeats);
|
||||
}
|
||||
|
||||
~Timer()
|
||||
{
|
||||
Stop();
|
||||
}
|
||||
|
||||
void Start(uint64_t duration_ms, bool repeats) {
|
||||
auto loop = EventLoop::Get().Handle();
|
||||
if (!m_timer) {
|
||||
m_timer = new uv_timer_t;
|
||||
memset(m_timer, 0, sizeof(uv_timer_t));
|
||||
uv_timer_init(loop, m_timer);
|
||||
m_timer->data = this;
|
||||
|
||||
if (repeats) {
|
||||
uv_timer_start(m_timer, [](uv_timer_t *handle) {
|
||||
Timer *t = (Timer*)handle->data;
|
||||
t->Execute();
|
||||
}, duration_ms, duration_ms);
|
||||
}
|
||||
else {
|
||||
uv_timer_start(m_timer, [](uv_timer_t *handle) {
|
||||
Timer *t = (Timer*)handle->data;
|
||||
t->Stop();
|
||||
t->Execute();
|
||||
}, duration_ms, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Stop() {
|
||||
if (m_timer) {
|
||||
uv_close((uv_handle_t*)m_timer, [](uv_handle_t* handle) {
|
||||
delete handle;
|
||||
});
|
||||
m_timer = nullptr;
|
||||
}
|
||||
}
|
||||
private:
|
||||
void Execute() {
|
||||
m_cb(this);
|
||||
}
|
||||
|
||||
uv_timer_t *m_timer;
|
||||
std::function<void(Timer*)> m_cb;
|
||||
};
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
#include "event_sub.h"
|
||||
#include <string.h>
|
||||
|
||||
void EventSubscriptionWatcher::Subscribe(const std::string &event_name)
|
||||
{
|
||||
m_subs[event_name] = 1;
|
||||
}
|
||||
|
||||
void EventSubscriptionWatcher::Unsubscribe(const std::string &event_name)
|
||||
{
|
||||
m_subs[event_name] = 0;
|
||||
}
|
||||
|
||||
bool EventSubscriptionWatcher::IsSubscribed(const std::string &event_name) const
|
||||
{
|
||||
auto iter = m_subs.find(event_name);
|
||||
if (iter != m_subs.end()) {
|
||||
return iter->second;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
class EventSubscriptionWatcher
|
||||
{
|
||||
public:
|
||||
~EventSubscriptionWatcher();
|
||||
|
||||
void Subscribe(const std::string &event_name);
|
||||
void Unsubscribe(const std::string &event_name);
|
||||
bool IsSubscribed(const std::string &event_name) const;
|
||||
|
||||
static EventSubscriptionWatcher *Get() {
|
||||
static EventSubscriptionWatcher* inst = nullptr;
|
||||
if(!inst) {
|
||||
inst = new EventSubscriptionWatcher();
|
||||
}
|
||||
|
||||
return inst;
|
||||
}
|
||||
private:
|
||||
EventSubscriptionWatcher() { }
|
||||
EventSubscriptionWatcher(const EventSubscriptionWatcher&);
|
||||
EventSubscriptionWatcher& operator=(const EventSubscriptionWatcher&);
|
||||
|
||||
std::unordered_map<std::string, bool> m_subs;
|
||||
};
|
||||
@@ -16,7 +16,7 @@
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "global_define.h"
|
||||
#include "debug.h"
|
||||
#include "extprofile.h"
|
||||
|
||||
//Set defaults in the extended profile...
|
||||
|
||||
+2
-4
@@ -19,7 +19,7 @@
|
||||
#define EXTENDED_PROFILE_H
|
||||
|
||||
#include "eq_packet_structs.h"
|
||||
#include "inventory_profile.h"
|
||||
#include "item.h"
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
@@ -40,7 +40,7 @@ struct ExtendedProfile_Struct {
|
||||
uint16 old_pet_hp; /* Not Used */
|
||||
uint16 old_pet_mana; /* Not Used */
|
||||
SpellBuff_Struct pet_buffs[BUFF_COUNT]; /* Not Used */
|
||||
EQEmu::TextureMaterialProfile pet_items; /* Not Used */
|
||||
uint32 pet_items[_MaterialCount]; /* Not Used */
|
||||
char merc_name[64]; /* Used */
|
||||
|
||||
uint32 aa_effects; /* Used */
|
||||
@@ -54,8 +54,6 @@ struct ExtendedProfile_Struct {
|
||||
uint32 mercTimerRemaining; /* Not Used */
|
||||
uint8 mercGender; /* Not Used */
|
||||
int32 mercState; /* Not Used */
|
||||
uint32 last_invsnapshot_time; /* Used */
|
||||
uint32 next_invsnapshot_time; /* Used */
|
||||
};
|
||||
|
||||
#pragma pack()
|
||||
|
||||
+86
-113
@@ -1,4 +1,4 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@@ -15,35 +15,34 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "debug.h"
|
||||
#include "faction.h"
|
||||
#include "races.h"
|
||||
|
||||
const char *FactionValueToString(FACTION_VALUE fv)
|
||||
{
|
||||
switch (fv) {
|
||||
case FACTION_ALLY:
|
||||
return ("Ally");
|
||||
case FACTION_WARMLY:
|
||||
return ("Warmly");
|
||||
case FACTION_KINDLY:
|
||||
return ("Kindly");
|
||||
case FACTION_AMIABLE:
|
||||
return ("Amiable");
|
||||
case FACTION_INDIFFERENT:
|
||||
return ("Indifferent");
|
||||
case FACTION_APPREHENSIVE:
|
||||
return ("Apprehensive");
|
||||
case FACTION_DUBIOUS:
|
||||
return ("Dubious");
|
||||
case FACTION_THREATENLY:
|
||||
return ("Threatenly");
|
||||
case FACTION_SCOWLS:
|
||||
return ("Scowls, ready to attack.");
|
||||
default:
|
||||
break;
|
||||
const char *FactionValueToString(FACTION_VALUE fv) {
|
||||
switch(fv) {
|
||||
case FACTION_ALLY:
|
||||
return("Ally");
|
||||
case FACTION_WARMLY:
|
||||
return("Warmly");
|
||||
case FACTION_KINDLY:
|
||||
return("Kindly");
|
||||
case FACTION_AMIABLE:
|
||||
return("Amiable");
|
||||
case FACTION_INDIFFERENT:
|
||||
return("Indifferent");
|
||||
case FACTION_APPREHENSIVE:
|
||||
return("Apprehensive");
|
||||
case FACTION_DUBIOUS:
|
||||
return("Dubious");
|
||||
case FACTION_THREATENLY:
|
||||
return("Threatenly");
|
||||
case FACTION_SCOWLS:
|
||||
return("Scowls, ready to attack.");
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return ("Unknown Faction Con");
|
||||
return("Unknown Faction Con");
|
||||
}
|
||||
|
||||
|
||||
@@ -56,56 +55,35 @@ const char *FactionValueToString(FACTION_VALUE fv)
|
||||
FACTION_VALUE CalculateFaction(FactionMods* fm, int32 tmpCharacter_value)
|
||||
{
|
||||
int32 character_value = tmpCharacter_value;
|
||||
if (fm) {
|
||||
if (fm)
|
||||
character_value += fm->base + fm->class_mod + fm->race_mod + fm->deity_mod;
|
||||
}
|
||||
if (character_value >= 1101) {
|
||||
return FACTION_ALLY;
|
||||
}
|
||||
if (character_value >= 701 && character_value <= 1100) {
|
||||
return FACTION_WARMLY;
|
||||
}
|
||||
if (character_value >= 401 && character_value <= 700) {
|
||||
return FACTION_KINDLY;
|
||||
}
|
||||
if (character_value >= 101 && character_value <= 400) {
|
||||
return FACTION_AMIABLE;
|
||||
}
|
||||
if (character_value >= 0 && character_value <= 100) {
|
||||
return FACTION_INDIFFERENT;
|
||||
}
|
||||
if (character_value >= -100 && character_value <= -1) {
|
||||
return FACTION_APPREHENSIVE;
|
||||
}
|
||||
if (character_value >= -700 && character_value <= -101) {
|
||||
return FACTION_DUBIOUS;
|
||||
}
|
||||
if (character_value >= -999 && character_value <= -701) {
|
||||
return FACTION_THREATENLY;
|
||||
}
|
||||
if (character_value <= -1000) {
|
||||
return FACTION_SCOWLS;
|
||||
}
|
||||
if(character_value >= 1101) return FACTION_ALLY;
|
||||
if(character_value >= 701 && character_value <= 1100) return FACTION_WARMLY;
|
||||
if(character_value >= 401 && character_value <= 700) return FACTION_KINDLY;
|
||||
if(character_value >= 101 && character_value <= 400) return FACTION_AMIABLE;
|
||||
if(character_value >= 0 && character_value <= 100) return FACTION_INDIFFERENT;
|
||||
if(character_value >= -100 && character_value <= -1) return FACTION_APPREHENSIVE;
|
||||
if(character_value >= -700 && character_value <= -101) return FACTION_DUBIOUS;
|
||||
if(character_value >= -999 && character_value <= -701) return FACTION_THREATENLY;
|
||||
if(character_value <= -1000) return FACTION_SCOWLS;
|
||||
return FACTION_INDIFFERENT;
|
||||
}
|
||||
|
||||
// this function should check if some races have more than one race define
|
||||
bool IsOfEqualRace(int r1, int r2)
|
||||
{
|
||||
if (r1 == r2) {
|
||||
if (r1 == r2)
|
||||
return true;
|
||||
}
|
||||
// TODO: add more values
|
||||
switch (r1) {
|
||||
case DARK_ELF:
|
||||
if (r2 == 77) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case BARBARIAN:
|
||||
if (r2 == 90) {
|
||||
return true;
|
||||
}
|
||||
switch(r1)
|
||||
{
|
||||
case DARK_ELF:
|
||||
if (r2 == 77)
|
||||
return true;
|
||||
break;
|
||||
case BARBARIAN:
|
||||
if (r2 == 90)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -113,55 +91,50 @@ bool IsOfEqualRace(int r1, int r2)
|
||||
// trolls endure ogres, dark elves, ...
|
||||
bool IsOfIndiffRace(int r1, int r2)
|
||||
{
|
||||
if (r1 == r2) {
|
||||
if (r1 == r2)
|
||||
return true;
|
||||
}
|
||||
// TODO: add more values
|
||||
switch (r1) {
|
||||
case DARK_ELF:
|
||||
case OGRE:
|
||||
case TROLL:
|
||||
if (r2 == OGRE || r2 == TROLL || r2 == DARK_ELF) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case HUMAN:
|
||||
case BARBARIAN:
|
||||
case HALF_ELF:
|
||||
case GNOME:
|
||||
case HALFLING:
|
||||
case WOOD_ELF:
|
||||
if (r2 == HUMAN ||
|
||||
r2 == BARBARIAN ||
|
||||
r2 == ERUDITE ||
|
||||
r2 == HALF_ELF ||
|
||||
r2 == GNOME ||
|
||||
r2 == HALFLING ||
|
||||
r2 == DWARF ||
|
||||
r2 == HIGH_ELF ||
|
||||
r2 == WOOD_ELF) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case ERUDITE:
|
||||
if (r2 == HUMAN || r2 == HALF_ELF) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case DWARF:
|
||||
if (r2 == HALFLING || r2 == GNOME) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case HIGH_ELF:
|
||||
if (r2 == WOOD_ELF) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case VAHSHIR:
|
||||
switch(r1)
|
||||
{
|
||||
case DARK_ELF:
|
||||
case OGRE:
|
||||
case TROLL:
|
||||
if (r2 == OGRE || r2 == TROLL || r2 == DARK_ELF)
|
||||
return true;
|
||||
case IKSAR:
|
||||
return false;
|
||||
break;
|
||||
case HUMAN:
|
||||
case BARBARIAN:
|
||||
case HALF_ELF:
|
||||
case GNOME:
|
||||
case HALFLING:
|
||||
case WOOD_ELF:
|
||||
if (r2 == HUMAN ||
|
||||
r2 == BARBARIAN ||
|
||||
r2 == ERUDITE ||
|
||||
r2 == HALF_ELF ||
|
||||
r2 == GNOME ||
|
||||
r2 == HALFLING ||
|
||||
r2 == DWARF ||
|
||||
r2 == HIGH_ELF ||
|
||||
r2 == WOOD_ELF)
|
||||
return true;
|
||||
break;
|
||||
case ERUDITE:
|
||||
if (r2 == HUMAN || r2 == HALF_ELF)
|
||||
return true;
|
||||
break;
|
||||
case DWARF:
|
||||
if (r2 == HALFLING || r2 == GNOME)
|
||||
return true;
|
||||
break;
|
||||
case HIGH_ELF:
|
||||
if (r2 == WOOD_ELF)
|
||||
return true;
|
||||
break;
|
||||
case VAHSHIR:
|
||||
return true;
|
||||
case IKSAR:
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
+8
-13
@@ -111,6 +111,9 @@ Zone extensions and features
|
||||
//path to where sql logs should be placed
|
||||
#define SQL_LOG_PATH "sql_logs/"
|
||||
|
||||
//New aggro system to reduce overhead.
|
||||
#define REVERSE_AGGRO
|
||||
|
||||
//The highest you can #setskill / #setallskill
|
||||
#define HIGHEST_CAN_SET_SKILL 400
|
||||
|
||||
@@ -151,15 +154,15 @@ enum { //reuse times
|
||||
enum { //timer settings, all in milliseconds
|
||||
AImovement_duration = 100,
|
||||
AIthink_duration = 150,
|
||||
AIscanarea_delay = 6000,
|
||||
AIscanarea_delay = 500,
|
||||
AIfeignremember_delay = 500,
|
||||
AItarget_check_duration = 500,
|
||||
// AIClientScanarea_delay = 750, //used in REVERSE_AGGRO
|
||||
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
|
||||
ClientProximity_interval = 150,
|
||||
CombatEventTimer_expire = 12000,
|
||||
Tribute_duration = 600000,
|
||||
ZoneTimerResolution = 3, //sleep time between zone main loop runs (milliseconds)
|
||||
FeignMemoryDuration = 120000, // Duration player must feign death to clear zonewide agro.
|
||||
EnragedTimer = 360000,
|
||||
EnragedDurationTimer = 10000
|
||||
@@ -209,8 +212,8 @@ enum { //some random constants
|
||||
#define MAX_NPC_FACTIONS 20
|
||||
|
||||
//individual faction pool
|
||||
#define MAX_PERSONAL_FACTION 2000
|
||||
#define MIN_PERSONAL_FACTION -2000
|
||||
#define MAX_PERSONAL_FACTION 1200
|
||||
#define MIN_PERSONAL_FACTION -3000
|
||||
|
||||
//The Level Cap:
|
||||
//#define LEVEL_CAP RuleI(Character, MaxLevel) //hard cap is 127
|
||||
@@ -229,11 +232,6 @@ enum { //some random constants
|
||||
#define GROUP_EXP_PER_POINT 1000
|
||||
#define RAID_EXP_PER_POINT 2000
|
||||
|
||||
#define ZONE_CONTROLLER_NPC_ID 10
|
||||
|
||||
// Timer to update aggrometer
|
||||
#define AGGRO_METER_UPDATE_MS 1000
|
||||
|
||||
//Some hard coded statuses from commands and other places:
|
||||
enum {
|
||||
minStatusToBeGM = 40,
|
||||
@@ -272,9 +270,6 @@ enum {
|
||||
#define NPC_DEFAULT_LOGGING_ENABLED false
|
||||
|
||||
|
||||
// This is the item ID we use for say links, we use the max that fits in 5 ASCII chars
|
||||
#define SAYLINK_ITEM_ID 0xFFFFF
|
||||
|
||||
|
||||
/*
|
||||
|
||||
|
||||
+2
-35
@@ -1,39 +1,6 @@
|
||||
================================================================================
|
||||
OpenGL Mathematics (GLM)
|
||||
--------------------------------------------------------------------------------
|
||||
GLM can be distributed and/or modified under the terms of either
|
||||
a) The Happy Bunny License, or b) the MIT License.
|
||||
|
||||
================================================================================
|
||||
The Happy Bunny License (Modified MIT License)
|
||||
--------------------------------------------------------------------------------
|
||||
Copyright (c) 2005 - 2016 G-Truc Creation
|
||||
|
||||
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.
|
||||
|
||||
Restrictions: By making use of the Software for military purposes, you choose
|
||||
to make a Bunny unhappy.
|
||||
|
||||
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.
|
||||
|
||||
================================================================================
|
||||
The MIT License
|
||||
--------------------------------------------------------------------------------
|
||||
Copyright (c) 2005 - 2016 G-Truc Creation
|
||||
|
||||
Copyright (c) 2005 - 2013 G-Truc Creation
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
set(NAME glm_dummy)
|
||||
|
||||
file(GLOB ROOT_SOURCE *.cpp)
|
||||
file(GLOB ROOT_INLINE *.inl)
|
||||
file(GLOB ROOT_HEADER *.hpp)
|
||||
file(GLOB ROOT_TEXT ../*.txt)
|
||||
file(GLOB ROOT_MD ../*.md)
|
||||
file(GLOB ROOT_NAT ../util/glm.natvis)
|
||||
|
||||
file(GLOB_RECURSE CORE_SOURCE ./detail/*.cpp)
|
||||
file(GLOB_RECURSE CORE_INLINE ./detail/*.inl)
|
||||
@@ -17,11 +17,7 @@ file(GLOB_RECURSE GTX_SOURCE ./gtx/*.cpp)
|
||||
file(GLOB_RECURSE GTX_INLINE ./gtx/*.inl)
|
||||
file(GLOB_RECURSE GTX_HEADER ./gtx/*.hpp)
|
||||
|
||||
file(GLOB_RECURSE SIMD_SOURCE ./simd/*.cpp)
|
||||
file(GLOB_RECURSE SIMD_INLINE ./simd/*.inl)
|
||||
file(GLOB_RECURSE SIMD_HEADER ./simd/*.h)
|
||||
|
||||
source_group("Text Files" FILES ${ROOT_TEXT} ${ROOT_MD})
|
||||
source_group("Text Files" FILES ${ROOT_TEXT})
|
||||
source_group("Core Files" FILES ${CORE_SOURCE})
|
||||
source_group("Core Files" FILES ${CORE_INLINE})
|
||||
source_group("Core Files" FILES ${CORE_HEADER})
|
||||
@@ -31,37 +27,14 @@ source_group("GTC Files" FILES ${GTC_HEADER})
|
||||
source_group("GTX Files" FILES ${GTX_SOURCE})
|
||||
source_group("GTX Files" FILES ${GTX_INLINE})
|
||||
source_group("GTX Files" FILES ${GTX_HEADER})
|
||||
source_group("SIMD Files" FILES ${SIMD_SOURCE})
|
||||
source_group("SIMD Files" FILES ${SIMD_INLINE})
|
||||
source_group("SIMD Files" FILES ${SIMD_HEADER})
|
||||
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
|
||||
|
||||
if(GLM_STATIC_LIBRARY_ENABLE OR GLM_DYNAMIC_LIBRARY_ENABLE)
|
||||
if(GLM_STATIC_LIBRARY_ENABLE)
|
||||
add_library(glm_static STATIC ${ROOT_TEXT} ${ROOT_MD} ${ROOT_NAT}
|
||||
${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER}
|
||||
${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER}
|
||||
${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER}
|
||||
${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER}
|
||||
${SIMD_SOURCE} ${SIMD_INLINE} ${SIMD_HEADER})
|
||||
endif(GLM_STATIC_LIBRARY_ENABLE)
|
||||
add_executable(${NAME} ${ROOT_TEXT}
|
||||
${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER}
|
||||
${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER}
|
||||
${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER}
|
||||
${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER})
|
||||
|
||||
if(GLM_DYNAMIC_LIBRARY_ENABLE)
|
||||
add_library(glm_shared SHARED ${ROOT_TEXT} ${ROOT_MD} ${ROOT_NAT}
|
||||
${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER}
|
||||
${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER}
|
||||
${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER}
|
||||
${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER}
|
||||
${SIMD_SOURCE} ${SIMD_INLINE} ${SIMD_HEADER})
|
||||
endif(GLM_DYNAMIC_LIBRARY_ENABLE)
|
||||
|
||||
else(GLM_STATIC_LIBRARY_ENABLE OR GLM_DYNAMIC_LIBRARY_ENABLE)
|
||||
add_executable(glm_dummy ${ROOT_TEXT} ${ROOT_MD} ${ROOT_NAT}
|
||||
${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER}
|
||||
${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER}
|
||||
${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER}
|
||||
${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER}
|
||||
${SIMD_SOURCE} ${SIMD_INLINE} ${SIMD_HEADER})
|
||||
|
||||
endif(GLM_STATIC_LIBRARY_ENABLE OR GLM_DYNAMIC_LIBRARY_ENABLE)
|
||||
#add_library(glm STATIC glm.cpp)
|
||||
#add_library(glm_shared SHARED glm.cpp)
|
||||
|
||||
@@ -1,6 +1,34 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
||||
/// 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.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/common.hpp
|
||||
/// @date 2013-12-24 / 2013-12-24
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
#ifndef GLM_COMMON_INCLUDED
|
||||
#define GLM_COMMON_INCLUDED
|
||||
|
||||
#include "detail/func_common.hpp"
|
||||
|
||||
#endif//GLM_COMMON_INCLUDED
|
||||
|
||||
@@ -1,7 +1,33 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
||||
/// 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.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/detail/_features.hpp
|
||||
/// @file glm/core/_features.hpp
|
||||
/// @date 2013-02-20 / 2013-02-20
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
#ifndef glm_core_features
|
||||
#define glm_core_features
|
||||
|
||||
// #define GLM_CXX98_EXCEPTIONS
|
||||
// #define GLM_CXX98_RTTI
|
||||
@@ -397,3 +423,5 @@
|
||||
# endif
|
||||
|
||||
#endif//(GLM_COMPILER & GLM_COMPILER_CLANG)
|
||||
|
||||
#endif//glm_core_features
|
||||
|
||||
@@ -1,5 +1,30 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
||||
/// 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.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/detail/_fixes.hpp
|
||||
/// @file glm/core/_fixes.hpp
|
||||
/// @date 2011-02-21 / 2011-11-22
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <cmath>
|
||||
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
||||
/// 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.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/_literals.hpp
|
||||
/// @date 2013-05-06 / 2013-05-06
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_core_literals
|
||||
#define glm_core_literals
|
||||
|
||||
namespace glm
|
||||
{
|
||||
#define GLM_CXX11_USER_LITERALS
|
||||
#ifdef GLM_CXX11_USER_LITERALS
|
||||
/*
|
||||
GLM_FUNC_QUALIFIER detail::half operator "" _h(long double const s)
|
||||
{
|
||||
return detail::half(s);
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER float operator "" _f(long double const s)
|
||||
{
|
||||
return static_cast<float>(s);
|
||||
}
|
||||
*/
|
||||
#endif//GLM_CXX11_USER_LITERALS
|
||||
|
||||
}//namespace glm
|
||||
|
||||
#endif//glm_core_literals
|
||||
@@ -1,12 +1,33 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
||||
/// 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.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/detail/_noise.hpp
|
||||
/// @date 2013-12-24 / 2013-12-24
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../vec2.hpp"
|
||||
#include "../vec3.hpp"
|
||||
#include "../vec4.hpp"
|
||||
#include "../common.hpp"
|
||||
#ifndef GLM_DETAIL_NOISE_INCLUDED
|
||||
#define GLM_DETAIL_NOISE_INCLUDED
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
@@ -54,19 +75,19 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec2<T, P> taylorInvSqrt(tvec2<T, P> const & r)
|
||||
GLM_FUNC_QUALIFIER detail::tvec2<T, P> taylorInvSqrt(detail::tvec2<T, P> const & r)
|
||||
{
|
||||
return T(1.79284291400159) - T(0.85373472095314) * r;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec3<T, P> taylorInvSqrt(tvec3<T, P> const & r)
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<T, P> taylorInvSqrt(detail::tvec3<T, P> const & r)
|
||||
{
|
||||
return T(1.79284291400159) - T(0.85373472095314) * r;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec4<T, P> taylorInvSqrt(tvec4<T, P> const & r)
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<T, P> taylorInvSqrt(detail::tvec4<T, P> const & r)
|
||||
{
|
||||
return T(1.79284291400159) - T(0.85373472095314) * r;
|
||||
}
|
||||
@@ -79,19 +100,19 @@ namespace detail
|
||||
*/
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec2<T, P> fade(tvec2<T, P> const & t)
|
||||
GLM_FUNC_QUALIFIER detail::tvec2<T, P> fade(detail::tvec2<T, P> const & t)
|
||||
{
|
||||
return (t * t * t) * (t * (t * T(6) - T(15)) + T(10));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec3<T, P> fade(tvec3<T, P> const & t)
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<T, P> fade(detail::tvec3<T, P> const & t)
|
||||
{
|
||||
return (t * t * t) * (t * (t * T(6) - T(15)) + T(10));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec4<T, P> fade(tvec4<T, P> const & t)
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<T, P> fade(detail::tvec4<T, P> const & t)
|
||||
{
|
||||
return (t * t * t) * (t * (t * T(6) - T(15)) + T(10));
|
||||
}
|
||||
@@ -105,3 +126,5 @@ namespace detail
|
||||
}//namespace detail
|
||||
}//namespace glm
|
||||
|
||||
#endif//GLM_DETAIL_NOISE_INCLUDED
|
||||
|
||||
|
||||
+578
-535
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,33 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
||||
/// 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.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/detail/_swizzle_func.hpp
|
||||
/// @file glm/core/_swizzle_func.hpp
|
||||
/// @date 2011-10-16 / 2011-10-16
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
#ifndef glm_core_swizzle_func
|
||||
#define glm_core_swizzle_func
|
||||
|
||||
#define GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, CONST, A, B) \
|
||||
SWIZZLED_TYPE<TMPL_TYPE, PRECISION> A ## B() CONST \
|
||||
@@ -694,3 +720,5 @@
|
||||
GLM_SWIZZLE_GEN_VEC_FROM_VEC4_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, s, t, p, q)
|
||||
|
||||
//GLM_SWIZZLE_GEN_VEC_FROM_VEC4(valType, detail::vec4, detail::vec2, detail::vec3, detail::vec4)
|
||||
|
||||
#endif//glm_core_swizzle_func
|
||||
|
||||
@@ -1,131 +1,217 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
||||
/// 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.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/detail/_vectorize.hpp
|
||||
/// @file glm/core/_vectorize.hpp
|
||||
/// @date 2011-10-14 / 2011-10-14
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
#ifndef GLM_CORE_DETAIL_INCLUDED
|
||||
#define GLM_CORE_DETAIL_INCLUDED
|
||||
|
||||
#include "type_vec1.hpp"
|
||||
#include "type_vec2.hpp"
|
||||
#include "type_vec3.hpp"
|
||||
#include "type_vec4.hpp"
|
||||
|
||||
#define VECTORIZE1_VEC(func) \
|
||||
template <typename T, precision P> \
|
||||
GLM_FUNC_QUALIFIER detail::tvec1<T, P> func( \
|
||||
detail::tvec1<T, P> const & v) \
|
||||
{ \
|
||||
return detail::tvec1<T, P>( \
|
||||
func(v.x)); \
|
||||
}
|
||||
|
||||
#define VECTORIZE2_VEC(func) \
|
||||
template <typename T, precision P> \
|
||||
GLM_FUNC_QUALIFIER detail::tvec2<T, P> func( \
|
||||
detail::tvec2<T, P> const & v) \
|
||||
{ \
|
||||
return detail::tvec2<T, P>( \
|
||||
func(v.x), \
|
||||
func(v.y)); \
|
||||
}
|
||||
|
||||
#define VECTORIZE3_VEC(func) \
|
||||
template <typename T, precision P> \
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<T, P> func( \
|
||||
detail::tvec3<T, P> const & v) \
|
||||
{ \
|
||||
return detail::tvec3<T, P>( \
|
||||
func(v.x), \
|
||||
func(v.y), \
|
||||
func(v.z)); \
|
||||
}
|
||||
|
||||
#define VECTORIZE4_VEC(func) \
|
||||
template <typename T, precision P> \
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<T, P> func( \
|
||||
detail::tvec4<T, P> const & v) \
|
||||
{ \
|
||||
return detail::tvec4<T, P>( \
|
||||
func(v.x), \
|
||||
func(v.y), \
|
||||
func(v.z), \
|
||||
func(v.w)); \
|
||||
}
|
||||
|
||||
#define VECTORIZE_VEC(func) \
|
||||
VECTORIZE1_VEC(func) \
|
||||
VECTORIZE2_VEC(func) \
|
||||
VECTORIZE3_VEC(func) \
|
||||
VECTORIZE4_VEC(func)
|
||||
|
||||
#define VECTORIZE1_VEC_SCA(func) \
|
||||
template <typename T, precision P> \
|
||||
GLM_FUNC_QUALIFIER detail::tvec1<T, P> func \
|
||||
( \
|
||||
detail::tvec1<T, P> const & x, \
|
||||
T const & y \
|
||||
) \
|
||||
{ \
|
||||
return detail::tvec1<T, P>( \
|
||||
func(x.x, y)); \
|
||||
}
|
||||
|
||||
#define VECTORIZE2_VEC_SCA(func) \
|
||||
template <typename T, precision P> \
|
||||
GLM_FUNC_QUALIFIER detail::tvec2<T, P> func \
|
||||
( \
|
||||
detail::tvec2<T, P> const & x, \
|
||||
T const & y \
|
||||
) \
|
||||
{ \
|
||||
return detail::tvec2<T, P>( \
|
||||
func(x.x, y), \
|
||||
func(x.y, y)); \
|
||||
}
|
||||
|
||||
#define VECTORIZE3_VEC_SCA(func) \
|
||||
template <typename T, precision P> \
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<T, P> func \
|
||||
( \
|
||||
detail::tvec3<T, P> const & x, \
|
||||
T const & y \
|
||||
) \
|
||||
{ \
|
||||
return detail::tvec3<T, P>( \
|
||||
func(x.x, y), \
|
||||
func(x.y, y), \
|
||||
func(x.z, y)); \
|
||||
}
|
||||
|
||||
#define VECTORIZE4_VEC_SCA(func) \
|
||||
template <typename T, precision P> \
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<T, P> func \
|
||||
( \
|
||||
detail::tvec4<T, P> const & x, \
|
||||
T const & y \
|
||||
) \
|
||||
{ \
|
||||
return detail::tvec4<T, P>( \
|
||||
func(x.x, y), \
|
||||
func(x.y, y), \
|
||||
func(x.z, y), \
|
||||
func(x.w, y)); \
|
||||
}
|
||||
|
||||
#define VECTORIZE_VEC_SCA(func) \
|
||||
VECTORIZE1_VEC_SCA(func) \
|
||||
VECTORIZE2_VEC_SCA(func) \
|
||||
VECTORIZE3_VEC_SCA(func) \
|
||||
VECTORIZE4_VEC_SCA(func)
|
||||
|
||||
#define VECTORIZE2_VEC_VEC(func) \
|
||||
template <typename T, precision P> \
|
||||
GLM_FUNC_QUALIFIER detail::tvec2<T, P> func \
|
||||
( \
|
||||
detail::tvec2<T, P> const & x, \
|
||||
detail::tvec2<T, P> const & y \
|
||||
) \
|
||||
{ \
|
||||
return detail::tvec2<T, P>( \
|
||||
func(x.x, y.x), \
|
||||
func(x.y, y.y)); \
|
||||
}
|
||||
|
||||
#define VECTORIZE3_VEC_VEC(func) \
|
||||
template <typename T, precision P> \
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<T, P> func \
|
||||
( \
|
||||
detail::tvec3<T, P> const & x, \
|
||||
detail::tvec3<T, P> const & y \
|
||||
) \
|
||||
{ \
|
||||
return detail::tvec3<T, P>( \
|
||||
func(x.x, y.x), \
|
||||
func(x.y, y.y), \
|
||||
func(x.z, y.z)); \
|
||||
}
|
||||
|
||||
#define VECTORIZE4_VEC_VEC(func) \
|
||||
template <typename T, precision P> \
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<T, P> func \
|
||||
( \
|
||||
detail::tvec4<T, P> const & x, \
|
||||
detail::tvec4<T, P> const & y \
|
||||
) \
|
||||
{ \
|
||||
return detail::tvec4<T, P>( \
|
||||
func(x.x, y.x), \
|
||||
func(x.y, y.y), \
|
||||
func(x.z, y.z), \
|
||||
func(x.w, y.w)); \
|
||||
}
|
||||
|
||||
#define VECTORIZE_VEC_VEC(func) \
|
||||
VECTORIZE2_VEC_VEC(func) \
|
||||
VECTORIZE3_VEC_VEC(func) \
|
||||
VECTORIZE4_VEC_VEC(func)
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <typename R, typename T, precision P, template <typename, precision> class vecType>
|
||||
struct functor1{};
|
||||
|
||||
template <typename R, typename T, precision P>
|
||||
struct functor1<R, T, P, tvec1>
|
||||
template<bool C>
|
||||
struct If
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec1<R, P> call(R (*Func) (T x), tvec1<T, P> const & v)
|
||||
template<typename F, typename T>
|
||||
static GLM_FUNC_QUALIFIER T apply(F functor, const T& val)
|
||||
{
|
||||
return tvec1<R, P>(Func(v.x));
|
||||
return functor(val);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename R, typename T, precision P>
|
||||
struct functor1<R, T, P, tvec2>
|
||||
template<>
|
||||
struct If<false>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec2<R, P> call(R (*Func) (T x), tvec2<T, P> const & v)
|
||||
template<typename F, typename T>
|
||||
static GLM_FUNC_QUALIFIER T apply(F, const T& val)
|
||||
{
|
||||
return tvec2<R, P>(Func(v.x), Func(v.y));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename R, typename T, precision P>
|
||||
struct functor1<R, T, P, tvec3>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec3<R, P> call(R (*Func) (T x), tvec3<T, P> const & v)
|
||||
{
|
||||
return tvec3<R, P>(Func(v.x), Func(v.y), Func(v.z));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename R, typename T, precision P>
|
||||
struct functor1<R, T, P, tvec4>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec4<R, P> call(R (*Func) (T x), tvec4<T, P> const & v)
|
||||
{
|
||||
return tvec4<R, P>(Func(v.x), Func(v.y), Func(v.z), Func(v.w));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
struct functor2{};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct functor2<T, P, tvec1>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec1<T, P> call(T (*Func) (T x, T y), tvec1<T, P> const & a, tvec1<T, P> const & b)
|
||||
{
|
||||
return tvec1<T, P>(Func(a.x, b.x));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct functor2<T, P, tvec2>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec2<T, P> call(T (*Func) (T x, T y), tvec2<T, P> const & a, tvec2<T, P> const & b)
|
||||
{
|
||||
return tvec2<T, P>(Func(a.x, b.x), Func(a.y, b.y));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct functor2<T, P, tvec3>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec3<T, P> call(T (*Func) (T x, T y), tvec3<T, P> const & a, tvec3<T, P> const & b)
|
||||
{
|
||||
return tvec3<T, P>(Func(a.x, b.x), Func(a.y, b.y), Func(a.z, b.z));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct functor2<T, P, tvec4>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec4<T, P> call(T (*Func) (T x, T y), tvec4<T, P> const & a, tvec4<T, P> const & b)
|
||||
{
|
||||
return tvec4<T, P>(Func(a.x, b.x), Func(a.y, b.y), Func(a.z, b.z), Func(a.w, b.w));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
struct functor2_vec_sca{};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct functor2_vec_sca<T, P, tvec1>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec1<T, P> call(T (*Func) (T x, T y), tvec1<T, P> const & a, T b)
|
||||
{
|
||||
return tvec1<T, P>(Func(a.x, b));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct functor2_vec_sca<T, P, tvec2>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec2<T, P> call(T (*Func) (T x, T y), tvec2<T, P> const & a, T b)
|
||||
{
|
||||
return tvec2<T, P>(Func(a.x, b), Func(a.y, b));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct functor2_vec_sca<T, P, tvec3>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec3<T, P> call(T (*Func) (T x, T y), tvec3<T, P> const & a, T b)
|
||||
{
|
||||
return tvec3<T, P>(Func(a.x, b), Func(a.y, b), Func(a.z, b));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct functor2_vec_sca<T, P, tvec4>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec4<T, P> call(T (*Func) (T x, T y), tvec4<T, P> const & a, T b)
|
||||
{
|
||||
return tvec4<T, P>(Func(a.x, b), Func(a.y, b), Func(a.z, b), Func(a.w, b));
|
||||
return val;
|
||||
}
|
||||
};
|
||||
}//namespace detail
|
||||
}//namespace glm
|
||||
|
||||
#endif//GLM_CORE_DETAIL_INCLUDED
|
||||
|
||||
@@ -1,13 +1,37 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
||||
/// 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.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/dummy.cpp
|
||||
/// @date 2011-01-19 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///
|
||||
/// GLM is a header only library. There is nothing to compile.
|
||||
/// dummy.cpp exist only a wordaround for CMake file.
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*
|
||||
#define GLM_FORCE_RADIANS
|
||||
#define GLM_MESSAGES
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/ext.hpp>
|
||||
#include "../glm.hpp"
|
||||
#include <limits>
|
||||
|
||||
struct material
|
||||
@@ -18,7 +42,6 @@ struct material
|
||||
glm::vec4 specular; // Scm
|
||||
float shininess; // Srm
|
||||
};
|
||||
|
||||
struct light
|
||||
{
|
||||
glm::vec4 ambient; // Acli
|
||||
@@ -37,7 +60,6 @@ struct light
|
||||
float quadraticAttenuation;// K2
|
||||
};
|
||||
|
||||
|
||||
// Sample 1
|
||||
#include <glm/vec3.hpp>// glm::vec3
|
||||
#include <glm/geometric.hpp>// glm::cross, glm::normalize
|
||||
@@ -121,8 +143,6 @@ struct intersection
|
||||
glm::vec4 position;
|
||||
glm::vec3 normal;
|
||||
};
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
// Sample 4
|
||||
@@ -164,44 +184,7 @@ glm::vec3 lighting
|
||||
return Color;
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
template <typename T, glm::precision P, template<typename, glm::precision> class vecType>
|
||||
T normalizeDotA(vecType<T, P> const & x, vecType<T, P> const & y)
|
||||
{
|
||||
return glm::dot(x, y) * glm::inversesqrt(glm::dot(x, x) * glm::dot(y, y));
|
||||
}
|
||||
|
||||
#define GLM_TEMPLATE_GENTYPE typename T, glm::precision P, template<typename, glm::precision> class
|
||||
|
||||
template <GLM_TEMPLATE_GENTYPE vecType>
|
||||
T normalizeDotB(vecType<T, P> const & x, vecType<T, P> const & y)
|
||||
{
|
||||
return glm::dot(x, y) * glm::inversesqrt(glm::dot(x, x) * glm::dot(y, y));
|
||||
}
|
||||
|
||||
template <typename vecType>
|
||||
typename vecType::value_type normalizeDotC(vecType const & a, vecType const & b)
|
||||
{
|
||||
return glm::dot(a, b) * glm::inversesqrt(glm::dot(a, a) * glm::dot(b, b));
|
||||
}
|
||||
*/
|
||||
int main()
|
||||
{
|
||||
/*
|
||||
glm::vec1 o(1);
|
||||
glm::vec2 a(1);
|
||||
glm::vec3 b(1);
|
||||
glm::vec4 c(1);
|
||||
|
||||
glm::quat q;
|
||||
glm::dualquat p;
|
||||
|
||||
glm::mat4 m(1);
|
||||
|
||||
float a0 = normalizeDotA(a, a);
|
||||
float b0 = normalizeDotB(b, b);
|
||||
float c0 = normalizeDotC(c, c);
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user